[cfe-commits] r120113 - in /cfe/trunk: lib/CodeGen/CodeGenTypes.cpp test/CodeGen/regparm.c test/CodeGen/transparent-union.c

Anders Carlsson andersca at mac.com
Wed Nov 24 13:05:09 PST 2010


Author: andersca
Date: Wed Nov 24 15:05:09 2010
New Revision: 120113

URL: http://llvm.org/viewvc/llvm-project?rev=120113&view=rev
Log:
Fix a (probably very old) regression where we weren't using the typedef name for anonymous tag types.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
    cfe/trunk/test/CodeGen/regparm.c
    cfe/trunk/test/CodeGen/transparent-union.c

Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=120113&r1=120112&r2=120113&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Wed Nov 24 15:05:09 2010
@@ -384,16 +384,15 @@
         OS << TD->getQualifiedNameAsString();
       else
         TD->printName(OS);
-    } else if (const TypedefType *TdT = dyn_cast<TypedefType>(T)) {
+    } else if (const TypedefDecl *TDD = TD->getTypedefForAnonDecl()) {
       // FIXME: We should not have to check for a null decl context here.
       // Right now we do it because the implicit Obj-C decls don't have one.
-      if (TdT->getDecl()->getDeclContext())
-        OS << TdT->getDecl()->getQualifiedNameAsString();
+      if (TDD->getDeclContext())
+        OS << TDD->getQualifiedNameAsString();
       else
-        TdT->getDecl()->printName(OS);
-    } else {
+        TDD->printName(OS);
+    } else
       OS << "anon";
-    }
 
     TheModule.addTypeName(OS.str(), Res);
     return Res;

Modified: cfe/trunk/test/CodeGen/regparm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/regparm.c?rev=120113&r1=120112&r2=120113&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/regparm.c (original)
+++ cfe/trunk/test/CodeGen/regparm.c Wed Nov 24 15:05:09 2010
@@ -21,7 +21,7 @@
 
 int
 main(void) {
-  // CHECK: call void @reduced(i8 signext inreg 0, {{.*}} %struct.anon* inreg null
+  // CHECK: call void @reduced(i8 signext inreg 0, {{.*}} %struct.foo* inreg null
   reduced(0, 0.0, 0, 0.0, 0);
   // CHECK: call x86_stdcallcc void {{.*}}(i32 inreg 1, i32 inreg 2)
   bar(1,2);

Modified: cfe/trunk/test/CodeGen/transparent-union.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/transparent-union.c?rev=120113&r1=120112&r2=120113&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/transparent-union.c (original)
+++ cfe/trunk/test/CodeGen/transparent-union.c Wed Nov 24 15:05:09 2010
@@ -11,7 +11,7 @@
 void f0(transp_t0 obj);
 
 // CHECK: define void @f1_0(i32* %a0) 
-// CHECK:  call void @f0(%union.anon* byval %{{.*}})
+// CHECK:  call void @f0(%union.transp_t0* byval %{{.*}})
 // CHECK:  call void %{{.*}}(i8* %{{[a-z0-9]*}})
 // CHECK: }
 void f1_0(int *a0) {





More information about the cfe-commits mailing list