[cfe-commits] r45976 - in /cfe/trunk: AST/Type.cpp test/Sema/complex-int.c

Steve Naroff snaroff at apple.com
Mon Jan 14 13:38:58 PST 2008


Author: snaroff
Date: Mon Jan 14 15:38:57 2008
New Revision: 45976

URL: http://llvm.org/viewvc/llvm-project?rev=45976&view=rev
Log:
Teach Type::isIntegerType() about GCC's __complex__ integer extensions...

Bug submitted by Eli.


Added:
    cfe/trunk/test/Sema/complex-int.c
Modified:
    cfe/trunk/AST/Type.cpp

Modified: cfe/trunk/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Type.cpp?rev=45976&r1=45975&r2=45976&view=diff

==============================================================================
--- cfe/trunk/AST/Type.cpp (original)
+++ cfe/trunk/AST/Type.cpp Mon Jan 14 15:38:57 2008
@@ -310,6 +310,9 @@
   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;

Added: cfe/trunk/test/Sema/complex-int.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/complex-int.c?rev=45976&view=auto

==============================================================================
--- cfe/trunk/test/Sema/complex-int.c (added)
+++ cfe/trunk/test/Sema/complex-int.c Mon Jan 14 15:38:57 2008
@@ -0,0 +1,10 @@
+// RUN: clang %s -verify -fsyntax-only
+
+void a() {
+__complex__ int arr;
+__complex__ short brr;
+__complex__ int result;
+
+result = arr*brr;
+}
+





More information about the cfe-commits mailing list