[cfe-commits] r44519 - in /cfe/trunk: AST/Type.cpp test/CodeGen/union.c

Seo Sanghyeon sanxiyn at gmail.com
Sun Dec 2 08:57:28 PST 2007


Author: sanxiyn
Date: Sun Dec  2 10:57:27 2007
New Revision: 44519

URL: http://llvm.org/viewvc/llvm-project?rev=44519&view=rev
Log:
Fix isStructureType and isUnionType to ignore typedefs, as stated
in the header. Patch by C├ędric Venet.

Modified:
    cfe/trunk/AST/Type.cpp
    cfe/trunk/test/CodeGen/union.c

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

==============================================================================
--- cfe/trunk/AST/Type.cpp (original)
+++ cfe/trunk/AST/Type.cpp Sun Dec  2 10:57:27 2007
@@ -61,13 +61,13 @@
 }
 
 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;

Modified: cfe/trunk/test/CodeGen/union.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/union.c?rev=44519&r1=44518&r2=44519&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/union.c (original)
+++ cfe/trunk/test/CodeGen/union.c Sun Dec  2 10:57:27 2007
@@ -16,3 +16,9 @@
   }__u;
   return (int)(__u.__u >> 31); 
 }
+
+typedef union { int i; int *j; } value;
+
+int f3(value v) {
+  return *v.j;
+}





More information about the cfe-commits mailing list