CGDebugInfo::getOrCreateCompileUnit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58081
91177308-0d34-0410-b5e6-
96231b3b80d8
}
/// 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);