[cfe-commits] r46798 - in /cfe/trunk: CodeGen/ModuleBuilder.cpp test/CodeGen/types.c

Chris Lattner sabre at nondot.org
Tue Feb 5 20:51:20 PST 2008


Author: lattner
Date: Tue Feb  5 22:51:19 2008
New Revision: 46798

URL: http://llvm.org/viewvc/llvm-project?rev=46798&view=rev
Log:
Finish off the refactoring of type handling stuff.  Now we recompile every
tag decl after it has been completed

Modified:
    cfe/trunk/CodeGen/ModuleBuilder.cpp
    cfe/trunk/test/CodeGen/types.c

Modified: cfe/trunk/CodeGen/ModuleBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/ModuleBuilder.cpp?rev=46798&r1=46797&r2=46798&view=diff

==============================================================================
--- cfe/trunk/CodeGen/ModuleBuilder.cpp (original)
+++ cfe/trunk/CodeGen/ModuleBuilder.cpp Tue Feb  5 22:51:19 2008
@@ -71,9 +71,19 @@
         // FIXME: implement C++ linkage, C linkage works mostly by C
         // language reuse already.
       } else {
-        Builder->EmitType(cast<TypeDecl>(D));
+        assert(isa<TypeDecl>(D) && "Unknown top level decl");
+        // TODO: handle debug info?
       }
     }
+    
+    /// HandleTagDeclDefinition - This callback is invoked each time a TagDecl
+    /// (e.g. struct, union, enum, class) is completed.  This allows the client to
+    /// hack on the type, which can occur at any point in the file (because these
+    /// can be defined in declspecs).
+    virtual void HandleTagDeclDefinition(TagDecl *D) {
+      Builder->EmitType(D);
+    }
+    
   };
 }
 

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

==============================================================================
--- cfe/trunk/test/CodeGen/types.c (original)
+++ cfe/trunk/test/CodeGen/types.c Tue Feb  5 22:51:19 2008
@@ -1,4 +1,4 @@
-// RUN: clang -emit-llvm %s
+// RUN: clang -emit-llvm <%s
 
 struct FileName {
     struct FileName *next;
@@ -10,7 +10,12 @@
 } *exthead;
 
 
-void f()
+void test1()
 {
     struct ieeeExternal *exttmp = exthead;
 }
+
+struct MpegEncContext;
+typedef struct MpegEncContext {int pb;} MpegEncContext;
+static void test2(void) {MpegEncContext s; s.pb;}
+





More information about the cfe-commits mailing list