diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-05-05 02:12:02 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-05-05 02:12:02 +0000 |
commit | 7665ad83d8eff7b8b2c5f3b893b6b7ece38f847c (patch) | |
tree | c5cc44786ff065f8c3dd99d7ac6c3737349aa60a /lib/Frontend/LogDiagnosticPrinter.cpp | |
parent | 9389ddc29ec60931e4dc418541ba3470b6b9fbe0 (diff) |
Frontend: Fix a crash in CC_LOG_DIAGNOSTICS handling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130909 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/LogDiagnosticPrinter.cpp')
-rw-r--r-- | lib/Frontend/LogDiagnosticPrinter.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Frontend/LogDiagnosticPrinter.cpp b/lib/Frontend/LogDiagnosticPrinter.cpp index 954bad4e7c..78eb1b2128 100644 --- a/lib/Frontend/LogDiagnosticPrinter.cpp +++ b/lib/Frontend/LogDiagnosticPrinter.cpp @@ -99,7 +99,7 @@ void LogDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, DiagnosticClient::HandleDiagnostic(Level, Info); // Initialize the main file name, if we haven't already fetched it. - if (MainFilename.empty()) { + if (MainFilename.empty() && Info.hasSourceManager()) { const SourceManager &SM = Info.getSourceManager(); FileID FID = SM.getMainFileID(); if (!FID.isInvalid()) { @@ -122,7 +122,7 @@ void LogDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, // Set the location information. DE.Filename = ""; DE.Line = DE.Column = 0; - if (Info.getLocation().isValid()) { + if (Info.getLocation().isValid() && Info.hasSourceManager()) { const SourceManager &SM = Info.getSourceManager(); PresumedLoc PLoc = SM.getPresumedLoc(Info.getLocation()); |