[cfe-commits] r58081 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Daniel Dunbar
daniel at zuster.org
Fri Oct 24 01:38:36 PDT 2008
Author: ddunbar
Date: Fri Oct 24 03:38:36 2008
New Revision: 58081
URL: http://llvm.org/viewvc/llvm-project?rev=58081&view=rev
Log:
Don't crash on invalid source locations in
CGDebugInfo::getOrCreateCompileUnit.
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=58081&r1=58080&r2=58081&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Oct 24 03:38:36 2008
@@ -131,9 +131,12 @@
}
/// 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);
More information about the cfe-commits
mailing list