summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-02-24 23:16:03 +0000
committerDevang Patel <dpatel@apple.com>2009-02-24 23:16:03 +0000
commitab19ecad22e81649b09a63c7433a3baa5893bc22 (patch)
tree81daae6f0e0b079ab6f1f7b7939dc9d5edbc3ad8 /clang/lib/CodeGen/CGDebugInfo.cpp
parent0c83e84f409ffe6f5cecbf80a01149951bdf46b5 (diff)
downloadbcm5719-llvm-ab19ecad22e81649b09a63c7433a3baa5893bc22.tar.gz
bcm5719-llvm-ab19ecad22e81649b09a63c7433a3baa5893bc22.zip
If Loc is invalid (e.g. "self" in Objective-C) then use MainFileID's compile unit.
llvm-svn: 65403
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index a48c2472390..53e28729cbb 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -52,10 +52,13 @@ llvm::DICompileUnit CGDebugInfo::getOrCreateCompileUnit(SourceLocation Loc) {
// "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.
OpenPOWER on IntegriCloud