[cfe-commits] r162070 - /cfe/trunk/lib/Basic/Diagnostic.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Thu Aug 16 17:55:32 PDT 2012
Author: rsmith
Date: Thu Aug 16 19:55:32 2012
New Revision: 162070
URL: http://llvm.org/viewvc/llvm-project?rev=162070&view=rev
Log:
Avoid binding a reference to a dereferenced null pointer, if we try to emit a
diagnostic before we have a source manager.
Modified:
cfe/trunk/lib/Basic/Diagnostic.cpp
Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=162070&r1=162069&r2=162070&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Thu Aug 16 19:55:32 2012
@@ -145,6 +145,9 @@
assert(DiagStatePoints.front().Loc.isInvalid() &&
"Should have created a DiagStatePoint for command-line");
+ if (!SourceMgr)
+ return DiagStatePoints.end() - 1;
+
FullSourceLoc Loc(L, *SourceMgr);
if (Loc.isInvalid())
return DiagStatePoints.end() - 1;
More information about the cfe-commits
mailing list