[llvm-commits] [llvm] r117588 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Devang Patel dpatel at apple.com
Thu Oct 28 12:50:08 PDT 2010


Author: dpatel
Date: Thu Oct 28 14:50:08 2010
New Revision: 117588

URL: http://llvm.org/viewvc/llvm-project?rev=117588&view=rev
Log:
Do not work too hard to find type's file info. There is a special field to record file info.


Modified:
    llvm/trunk/include/llvm/Analysis/DebugInfo.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=117588&r1=117587&r2=117588&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Thu Oct 28 14:50:08 2010
@@ -271,8 +271,14 @@
     bool isValid() const {
       return DbgNode && (isBasicType() || isDerivedType() || isCompositeType());
     }
-    StringRef getFilename() const    { return getCompileUnit().getFilename();}
-    StringRef getDirectory() const   { return getCompileUnit().getDirectory();}
+    StringRef getDirectory() const  { 
+      DIFile F = getFieldAs<DIFile>(3);
+      return F.getDirectory();
+    }
+    StringRef getFilename() const  { 
+      DIFile F = getFieldAs<DIFile>(3);
+      return F.getFilename();
+    }
 
     /// replaceAllUsesWith - Replace all uses of debug info referenced by
     /// this descriptor.

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=117588&r1=117587&r2=117588&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Oct 28 14:50:08 2010
@@ -568,8 +568,8 @@
   unsigned Line = Ty.getLineNumber();
   if (Line == 0 || !Ty.getContext().Verify())
     return;
-  unsigned FileID = GetOrCreateSourceID(Ty.getContext().getDirectory(),
-                                        Ty.getContext().getFilename());
+  unsigned FileID = GetOrCreateSourceID(Ty.getDirectory(),
+                                        Ty.getFilename());
   assert(FileID && "Invalid file id");
   addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);
   addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);





More information about the llvm-commits mailing list