diff options
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 89d00aee5e..4283dd4eaf 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -131,9 +131,12 @@ llvm::Value *CGDebugInfo::getValueFor(llvm::DebugInfoDesc *DD) { } /// getOrCreateCompileUnit - Get the compile unit from the cache or create a new -/// one if necessary. -llvm::CompileUnitDesc -*CGDebugInfo::getOrCreateCompileUnit(const SourceLocation Loc) { +/// one if necessary. This returns null for invalid source locations. +llvm::CompileUnitDesc* +CGDebugInfo::getOrCreateCompileUnit(const SourceLocation Loc) { + if (Loc.isInvalid()) + return NULL; + SourceManager &SM = M->getContext().getSourceManager(); const FileEntry *FE = SM.getFileEntryForLoc(Loc); |