summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-10-24 08:38:36 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-10-24 08:38:36 +0000
commitdec8a89d371796ba46bfd65151493ba92ebc72f9 (patch)
tree9da2830c716230a3f1290c8e8cc2b6ba3d7ba773 /clang/lib/CodeGen
parentc86b825d5febab43a6b706e7b5545d060010dbb0 (diff)
downloadbcm5719-llvm-dec8a89d371796ba46bfd65151493ba92ebc72f9.tar.gz
bcm5719-llvm-dec8a89d371796ba46bfd65151493ba92ebc72f9.zip
Don't crash on invalid source locations in
CGDebugInfo::getOrCreateCompileUnit. llvm-svn: 58081
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 89d00aee5e8..4283dd4eaf3 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud