diff options
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 2 | ||||
-rw-r--r-- | test/CodeGen/debug-info-crash.c | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 9296b42e77..956c358743 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -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()); diff --git a/test/CodeGen/debug-info-crash.c b/test/CodeGen/debug-info-crash.c index e0c9dd415b..8d6a360c64 100644 --- a/test/CodeGen/debug-info-crash.c +++ b/test/CodeGen/debug-info-crash.c @@ -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; +} |