[cfe-commits] r70980 - /cfe/branches/Apple/Dib/lib/CodeGen/CGDebugInfo.cpp

Mike Stump mrs at apple.com
Tue May 5 10:20:00 PDT 2009


Author: mrs
Date: Tue May  5 12:19:40 2009
New Revision: 70980

URL: http://llvm.org/viewvc/llvm-project?rev=70980&view=rev
Log:
Merge in 70969:

fix some more cases where we'd emit a file with a line of 0 for implicit
types.  In this case, it was objc_selector and objc_class.  This fixes
rdar://6852754 - clang sometimes generates incorrect/unknown file/line info for DW_TAG__structure_type dies

Modified:
    cfe/branches/Apple/Dib/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/branches/Apple/Dib/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/CodeGen/CGDebugInfo.cpp?rev=70980&r1=70979&r2=70980&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/branches/Apple/Dib/lib/CodeGen/CGDebugInfo.cpp Tue May  5 12:19:40 2009
@@ -275,9 +275,13 @@
   // Get overall information about the record type for the debug info.
   std::string Name = Decl->getNameAsString();
 
-  llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(Decl->getLocation());
   PresumedLoc PLoc = SM.getPresumedLoc(Decl->getLocation());
-  unsigned Line = PLoc.isInvalid() ? 0 : PLoc.getLine();  
+  llvm::DICompileUnit DefUnit;
+  unsigned Line = 0;
+  if (!PLoc.isInvalid()) {
+    DefUnit = getOrCreateCompileUnit(Decl->getLocation());
+    Line = PLoc.getLine();
+  }
   
   // Records and classes and unions can all be recursive.  To handle them, we
   // first generate a debug descriptor for the struct as a forward declaration.
@@ -317,10 +321,14 @@
 
     // Get the location for the field.
     SourceLocation FieldDefLoc = Field->getLocation();
-    llvm::DICompileUnit FieldDefUnit = getOrCreateCompileUnit(FieldDefLoc);
     PresumedLoc PLoc = SM.getPresumedLoc(FieldDefLoc);
-    unsigned FieldLine = PLoc.isInvalid() ? 0 : PLoc.getLine();
-
+    llvm::DICompileUnit FieldDefUnit;
+    unsigned FieldLine = 0;
+    
+    if (!PLoc.isInvalid()) {
+      FieldDefUnit = getOrCreateCompileUnit(FieldDefLoc);
+      FieldLine = PLoc.getLine();
+    }
 
     QualType FType = Field->getType();
     uint64_t FieldSize = 0;





More information about the cfe-commits mailing list