summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Basic/Diagnostic.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp
index 2c49c2f7606..8065b2d98f3 100644
--- a/clang/lib/Basic/Diagnostic.cpp
+++ b/clang/lib/Basic/Diagnostic.cpp
@@ -145,6 +145,9 @@ DiagnosticsEngine::GetDiagStatePointForLoc(SourceLocation L) const {
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;
OpenPOWER on IntegriCloud