[cfe-commits] r65403 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Devang Patel dpatel at apple.com
Tue Feb 24 15:16:03 PST 2009


Author: dpatel
Date: Tue Feb 24 17:16:03 2009
New Revision: 65403

URL: http://llvm.org/viewvc/llvm-project?rev=65403&view=rev
Log:
If Loc is invalid (e.g. "self" in Objective-C) then use MainFileID's compile unit.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=65403&r1=65402&r2=65403&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb 24 17:16:03 2009
@@ -52,10 +52,13 @@
   // "well formed" debug info.
   const FileEntry *FE = 0;
 
+  SourceManager &SM = M->getContext().getSourceManager();
   if (Loc.isValid()) {
-    SourceManager &SM = M->getContext().getSourceManager();
     Loc = SM.getInstantiationLoc(Loc);
     FE = SM.getFileEntryForID(SM.getFileID(Loc));
+  } else {
+    // If Loc is not valid then use main file id.
+    FE = SM.getFileEntryForID(SM.getMainFileID());
   }
    
   // See if this compile unit has been used before.





More information about the cfe-commits mailing list