]> granicus.if.org Git - clang/commitdiff
Fix isStructureType and isUnionType to ignore typedefs, as stated
authorSeo Sanghyeon <sanxiyn@gmail.com>
Sun, 2 Dec 2007 16:57:27 +0000 (16:57 +0000)
committerSeo Sanghyeon <sanxiyn@gmail.com>
Sun, 2 Dec 2007 16:57:27 +0000 (16:57 +0000)
in the header. Patch by Cédric Venet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44519 91177308-0d34-0410-b5e6-96231b3b80d8

AST/Type.cpp
test/CodeGen/union.c

index b0ba353112c9c02b515af1dc12770ba818014e03..e1d20831fcaff19dc663ec60c680627a3b5f3180 100644 (file)
@@ -61,13 +61,13 @@ bool Type::isDerivedType() const {
 }
 
 bool Type::isStructureType() const {
-  if (const RecordType *RT = dyn_cast<RecordType>(this))
+  if (const RecordType *RT = dyn_cast<RecordType>(CanonicalType))
     if (RT->getDecl()->getKind() == Decl::Struct)
       return true;
   return false;
 }
 bool Type::isUnionType() const {
-  if (const RecordType *RT = dyn_cast<RecordType>(this))
+  if (const RecordType *RT = dyn_cast<RecordType>(CanonicalType))
     if (RT->getDecl()->getKind() == Decl::Union)
       return true;
   return false;
index 8102f9b6fd737b07114178735771642f1ece159b..473293847c0a3b280d1edd26edadd9a28ffdf34b 100644 (file)
@@ -16,3 +16,9 @@ int f2( float __x ) {
   }__u;
   return (int)(__u.__u >> 31); 
 }
+
+typedef union { int i; int *j; } value;
+
+int f3(value v) {
+  return *v.j;
+}