[llvm-branch-commits] [cfe-branch] r118044 - in /cfe/branches/Apple/whitney/lib: Basic/SourceManager.cpp Frontend/TextDiagnosticPrinter.cpp
Daniel Dunbar
daniel at zuster.org
Tue Nov 2 13:32:29 PDT 2010
Author: ddunbar
Date: Tue Nov 2 15:32:29 2010
New Revision: 118044
URL: http://llvm.org/viewvc/llvm-project?rev=118044&view=rev
Log:
Merge r117990:
--
Author: Douglas Gregor <dgregor at apple.com>
Date: Tue Nov 2 00:39:22 2010 +0000
Teach SourceManager::getPresumedLoc() how to fail gracefully if getLineNumber/getColumnNumber fail
Modified:
cfe/branches/Apple/whitney/lib/Basic/SourceManager.cpp
cfe/branches/Apple/whitney/lib/Frontend/TextDiagnosticPrinter.cpp
Modified: cfe/branches/Apple/whitney/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Basic/SourceManager.cpp?rev=118044&r1=118043&r2=118044&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Basic/SourceManager.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Basic/SourceManager.cpp Tue Nov 2 15:32:29 2010
@@ -1058,8 +1058,14 @@
Filename = C->Entry->getName();
else
Filename = C->getBuffer(Diag, *this)->getBufferIdentifier();
- unsigned LineNo = getLineNumber(LocInfo.first, LocInfo.second);
- unsigned ColNo = getColumnNumber(LocInfo.first, LocInfo.second);
+ bool Invalid = false;
+ unsigned LineNo = getLineNumber(LocInfo.first, LocInfo.second, &Invalid);
+ if (Invalid)
+ return PresumedLoc();
+ unsigned ColNo = getColumnNumber(LocInfo.first, LocInfo.second, &Invalid);
+ if (Invalid)
+ return PresumedLoc();
+
SourceLocation IncludeLoc = FI.getIncludeLoc();
// If we have #line directives in this file, update and overwrite the physical
Modified: cfe/branches/Apple/whitney/lib/Frontend/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Frontend/TextDiagnosticPrinter.cpp?rev=118044&r1=118043&r2=118044&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Frontend/TextDiagnosticPrinter.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Frontend/TextDiagnosticPrinter.cpp Tue Nov 2 15:32:29 2010
@@ -781,7 +781,7 @@
}
// Compute the column number.
- if (DiagOpts->ShowLocation) {
+ if (DiagOpts->ShowLocation && PLoc.isValid()) {
if (DiagOpts->ShowColors)
OS.changeColor(savedColor, true);
More information about the llvm-branch-commits
mailing list