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);
 


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to