aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-01-14 21:38:57 +0000
committerSteve Naroff <snaroff@apple.com>2008-01-14 21:38:57 +0000
commit3f0c5adc2f488f40aa0f7b88c27b347f80b104bb (patch)
tree7ca4416bd7bf716edf40deba4192fccf32d41f78
parentadbbd0c625806b9d6183920d33eb78566a8f3366 (diff)
Teach Type::isIntegerType() about GCC's __complex__ integer extensions...
Bug submitted by Eli. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45976 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--AST/Type.cpp3
-rw-r--r--test/Sema/complex-int.c10
2 files changed, 13 insertions, 0 deletions
diff --git a/AST/Type.cpp b/AST/Type.cpp
index 610cd8fcab..949b6f8d2a 100644
--- a/AST/Type.cpp
+++ b/AST/Type.cpp
@@ -310,6 +310,9 @@ bool Type::isIntegerType() const {
if (const TagType *TT = dyn_cast<TagType>(CanonicalType))
if (TT->getDecl()->getKind() == Decl::Enum)
return true;
+ // Check for GCC complex integer extension.
+ if (const ComplexType *CT = dyn_cast<ComplexType>(CanonicalType))
+ return CT->getElementType()->isIntegerType();
if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
return VT->getElementType()->isIntegerType();
return false;
diff --git a/test/Sema/complex-int.c b/test/Sema/complex-int.c
new file mode 100644
index 0000000000..f0c29a94d3
--- /dev/null
+++ b/test/Sema/complex-int.c
@@ -0,0 +1,10 @@
+// RUN: clang %s -verify -fsyntax-only
+
+void a() {
+__complex__ int arr;
+__complex__ short brr;
+__complex__ int result;
+
+result = arr*brr;
+}
+