Fix use of uninitialized value exposed by r267802. Accessors of an invalid
PresumedLoc should not be called.
llvm-svn: 267914
diff --git a/clang/lib/Frontend/DiagnosticRenderer.cpp b/clang/lib/Frontend/DiagnosticRenderer.cpp
index 302067a..c4365f9 100644
--- a/clang/lib/Frontend/DiagnosticRenderer.cpp
+++ b/clang/lib/Frontend/DiagnosticRenderer.cpp
@@ -167,7 +167,8 @@
PresumedLoc PLoc,
DiagnosticsEngine::Level Level,
const SourceManager &SM) {
- SourceLocation IncludeLoc = PLoc.getIncludeLoc();
+ SourceLocation IncludeLoc =
+ PLoc.isInvalid() ? SourceLocation() : PLoc.getIncludeLoc();
// Skip redundant include stacks altogether.
if (LastIncludeLoc == IncludeLoc)