[cfe-commits] r92433 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/CodeGen/complex.c test/Sema/complex-int.c
Eli Friedman
eli.friedman at gmail.com
Sat Jan 2 16:20:48 PST 2010
Author: efriedma
Date: Sat Jan 2 18:20:48 2010
New Revision: 92433
URL: http://llvm.org/viewvc/llvm-project?rev=92433&view=rev
Log:
Fix minor oversight for increment/decrement of complex int. Add tests for
coverage.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/CodeGen/complex.c
cfe/trunk/test/Sema/complex-int.c
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=92433&r1=92432&r2=92433&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sat Jan 2 18:20:48 2010
@@ -5776,7 +5776,7 @@
<< PointeeTy << Op->getSourceRange();
return QualType();
}
- } else if (ResType->isComplexType()) {
+ } else if (ResType->isAnyComplexType()) {
// C99 does not support ++/-- on complex types, we allow as an extension.
Diag(OpLoc, diag::ext_integer_increment_complex)
<< ResType << Op->getSourceRange();
Modified: cfe/trunk/test/CodeGen/complex.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/complex.c?rev=92433&r1=92432&r2=92433&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/complex.c (original)
+++ cfe/trunk/test/CodeGen/complex.c Sat Jan 2 18:20:48 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm < %s
+// RUN: %clang_cc1 -emit-llvm-only %s
int main(void)
{
@@ -39,6 +39,25 @@
g1 = D + g1;
}
+__complex__ int ci1, ci2;
+__complex__ short cs;
+int i;
+void test3int() {
+ ci1 = ci1 + ci2;
+ ci1 = ci1 - ci2;
+ ci1 = ci1 * ci2;
+ ci1 = +-~ci1;
+
+ i = __real ci1;
+
+ cs += i;
+ // FIXME: Currently unsupported!
+ //D += cf;
+ cs /= ci1;
+ ci1 = ci1 + i;
+ ci1 = i + ci1;
+}
+
void t1() {
(__real__ cf) = 4.0;
}
@@ -59,3 +78,14 @@
float _Complex x = t4();
}
+void t6() {
+ g1++;
+ g1--;
+ ++g1;
+ --g1;
+ ci1++;
+ ci1--;
+ ++ci1;
+ --ci1;
+}
+
Modified: cfe/trunk/test/Sema/complex-int.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/complex-int.c?rev=92433&r1=92432&r2=92433&view=diff
==============================================================================
--- cfe/trunk/test/Sema/complex-int.c (original)
+++ cfe/trunk/test/Sema/complex-int.c Sat Jan 2 18:20:48 2010
@@ -49,3 +49,7 @@
void test4(_Complex float *x) {
*x = ~*x;
}
+
+void test5(_Complex int *x) {
+ (*x)++;
+}
More information about the cfe-commits
mailing list