[llvm-commits] [llvm] r62625 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/CodeGen/AsmPrinter/DwarfWriter.cpp test/DebugInfo/forwardDecl.ll

Devang Patel dpatel at apple.com
Tue Jan 20 14:27:02 PST 2009


Author: dpatel
Date: Tue Jan 20 16:27:02 2009
New Revision: 62625

URL: http://llvm.org/viewvc/llvm-project?rev=62625&view=rev
Log:
Appropriately mark fowrad decls.

Modified:
    llvm/trunk/include/llvm/Analysis/DebugInfo.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
    llvm/trunk/test/DebugInfo/forwardDecl.ll

Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=62625&r1=62624&r2=62625&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Tue Jan 20 16:27:02 2009
@@ -129,6 +129,13 @@
   /// FIXME: Types should be factored much better so that CV qualifiers and
   /// others do not require a huge and empty descriptor full of zeros.
   class DIType : public DIDescriptor {
+  public:
+    enum {
+      FlagPrivate   = 1 << 0,
+      FlagProtected = 1 << 1,
+      FlagFwdDecl  = 1 << 2
+    };
+
   protected:
     DIType(GlobalVariable *GV, unsigned Tag) : DIDescriptor(GV, Tag) {}
     // This ctor is used when the Tag has already been validated by a derived
@@ -167,6 +174,9 @@
     // carry this is just plain insane.
     uint64_t getOffsetInBits() const    { return getUInt64Field(7); }
     unsigned getFlags() const           { return getUnsignedField(8); }
+    bool isPrivate() const              { return (getFlags() & FlagPrivate) != 0; }
+    bool isProtected() const            { return (getFlags() & FlagProtected) != 0; }
+    bool isForwardDecl() const          { return (getFlags() & FlagFwdDecl) != 0; }
 
     virtual std::string getFilename() const { 
       assert (0 && "Invalid DIDescriptor");

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=62625&r1=62624&r2=62625&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Tue Jan 20 16:27:02 2009
@@ -1820,19 +1820,16 @@
     if (Size)
       AddUInt(&Buffer, DW_AT_byte_size, 0, Size);
     else {
-      // Add zero size even if it is not a forward declaration.
-      // FIXME - Enable this.
-      //      if (!CTy.isDefinition())
-      //        AddUInt(&Buffer, DW_AT_declaration, DW_FORM_flag, 1);
-      //      else
-      //        AddUInt(&Buffer, DW_AT_byte_size, 0, 0); 
+      // Add zero size if it is not a forward declaration.
+      if (CTy.isForwardDecl())
+        AddUInt(&Buffer, DW_AT_declaration, DW_FORM_flag, 1);
+      else
+        AddUInt(&Buffer, DW_AT_byte_size, 0, 0); 
     }
 
-    // Add source line info if available and TyDesc is not a forward
-    // declaration.
-    // FIXME - Enable this.
-    // if (CTy.isForwardDecl())                                            
-    //   AddSourceLine(&Buffer, *CTy);                                    
+    // Add source line info if available.
+    if (!CTy.isForwardDecl())
+      AddSourceLine(&Buffer, &CTy);
   }
   
   // ConstructSubrangeDIE - Construct subrange DIE from DISubrange.

Modified: llvm/trunk/test/DebugInfo/forwardDecl.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/forwardDecl.ll?rev=62625&r1=62624&r2=62625&view=diff

==============================================================================
--- llvm/trunk/test/DebugInfo/forwardDecl.ll (original)
+++ llvm/trunk/test/DebugInfo/forwardDecl.ll Tue Jan 20 16:27:02 2009
@@ -1,5 +1,4 @@
 ; RUN: llvm-as < %s | llc | %prcontext ST 1 | grep 0x1 | count 1
-; XFAIL: *
 
 target triple = "i386-apple-darwin9.6"
 	%llvm.dbg.anchor.type = type { i32, i32 }





More information about the llvm-commits mailing list