]> granicus.if.org Git - clang/commitdiff
If preprocessed token introduced empty filename then use main translation unit's...
authorDevang Patel <dpatel@apple.com>
Wed, 16 Feb 2011 18:40:36 +0000 (18:40 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 16 Feb 2011 18:40:36 +0000 (18:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125672 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
test/CodeGen/debug-info-crash.c

index 9296b42e77dd9765ffad2bb95e830aec6245d2b3..956c358743016f683f121b00a52a1d602c99a88d 100644 (file)
@@ -161,7 +161,7 @@ llvm::DIFile CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
   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());
 
index e0c9dd415bbef36565437ec3ef8e0706392e4ab7..8d6a360c64d2f02234f6fb7f53ad1facd95d1c7b 100644 (file)
@@ -19,3 +19,12 @@ dispatch_item_t LEGACY_dispatch_call(dispatch_queue_t dq,
     }
     );
 }
+
+// radar://9008853
+typedef struct P {
+  int x;
+} PS;
+# 1 ""
+void foo() {
+  PS p2;
+}