llvm-capstone/clang/test/Sema/atomic-expr.c
Eli Friedman e6d3395d78 Fix Sema for compares with _Atomic vars.
Use UsualArithmeticConversions unconditionally in analysis of
comparisons and conditional operators: the method performs
the usual arithmetic conversions if both sides are arithmetic, and
usual unary conversions if they are not.  This is just a cleanup
for conditional operators; for comparisons, it fixes the issue that
we would try to check isArithmetic() on an atomic type.

Also, fix GetExprRange() in SemaChecking.cpp so it deals with variables
of atomic type correctly.

Fixes PR15537.

llvm-svn: 185857
2013-07-08 20:20:06 +00:00

61 lines
739 B
C

// RUN: %clang_cc1 %s -verify -fsyntax-only
// expected-no-diagnostics
_Atomic(unsigned int) data1;
int _Atomic data2;
// Shift operations
int func_01 (int x) {
return data1 << x;
}
int func_02 (int x) {
return x << data1;
}
int func_03 (int x) {
return data2 << x;
}
int func_04 (int x) {
return x << data2;
}
int func_05 () {
return data2 << data1;
}
int func_06 () {
return data1 << data2;
}
void func_07 (int x) {
data1 <<= x;
}
void func_08 (int x) {
data2 <<= x;
}
void func_09 (int* xp) {
*xp <<= data1;
}
void func_10 (int* xp) {
*xp <<= data2;
}
int func_11 (int x) {
return data1 == x;
}
int func_12 () {
return data1 < data2;
}
int func_13 (int x, unsigned y) {
return x ? data1 : y;
}