diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2008-10-24 08:38:36 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2008-10-24 08:38:36 +0000 |
| commit | dec8a89d371796ba46bfd65151493ba92ebc72f9 (patch) | |
| tree | 9da2830c716230a3f1290c8e8cc2b6ba3d7ba773 /clang/lib/CodeGen | |
| parent | c86b825d5febab43a6b706e7b5545d060010dbb0 (diff) | |
| download | bcm5719-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.cpp | 9 |
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); |

