[cfe-commits] r125672 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGen/debug-info-crash.c

Devang Patel dpatel at apple.com
Wed Feb 16 10:40:37 PST 2011


Author: dpatel
Date: Wed Feb 16 12:40:36 2011
New Revision: 125672

URL: http://llvm.org/viewvc/llvm-project?rev=125672&view=rev
Log:
If preprocessed token introduced empty filename then use main translation unit's filename for debug info entries.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/test/CodeGen/debug-info-crash.c

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=125672&r1=125671&r2=125672&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Feb 16 12:40:36 2011
@@ -161,7 +161,7 @@
   SourceManager &SM = CGM.getContext().getSourceManager();
   PresumedLoc PLoc = SM.getPresumedLoc(Loc);
 
-  if (PLoc.isInvalid())
+  if (PLoc.isInvalid() || llvm::StringRef(PLoc.getFilename()).empty())
     // If the location is not valid then use main input file.
     return DBuilder.CreateFile(TheCU.getFilename(), TheCU.getDirectory());
 

Modified: cfe/trunk/test/CodeGen/debug-info-crash.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-crash.c?rev=125672&r1=125671&r2=125672&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-crash.c (original)
+++ cfe/trunk/test/CodeGen/debug-info-crash.c Wed Feb 16 12:40:36 2011
@@ -19,3 +19,12 @@
     }
     );
 }
+
+// radar://9008853
+typedef struct P {
+  int x;
+} PS;
+# 1 ""
+void foo() {
+  PS p2;
+}





More information about the cfe-commits mailing list