diff options
Diffstat (limited to 'clang/lib/Driver')
-rw-r--r-- | clang/lib/Driver/HTMLDiagnostics.cpp | 46 | ||||
-rw-r--r-- | clang/lib/Driver/PlistDiagnostics.cpp | 9 | ||||
-rw-r--r-- | clang/lib/Driver/TextDiagnosticPrinter.cpp | 27 |
3 files changed, 41 insertions, 41 deletions
diff --git a/clang/lib/Driver/HTMLDiagnostics.cpp b/clang/lib/Driver/HTMLDiagnostics.cpp index 4fac41c1bf8..c067be98f0e 100644 --- a/clang/lib/Driver/HTMLDiagnostics.cpp +++ b/clang/lib/Driver/HTMLDiagnostics.cpp @@ -130,9 +130,8 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) { bool FileIDInitialized = false; // Verify that the entire path is from the same FileID. - for (PathDiagnostic::const_iterator I=D.begin(), E=D.end(); I != E; ++I) { - - FullSourceLoc L = I->getLocation().getLogicalLoc(); + for (PathDiagnostic::const_iterator I = D.begin(), E = D.end(); I != E; ++I) { + FullSourceLoc L = I->getLocation().getInstantiationLoc(); if (!L.isFileID()) return; // FIXME: Emit a warning? @@ -148,7 +147,7 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) { for (PathDiagnosticPiece::range_iterator RI=I->ranges_begin(), RE=I->ranges_end(); RI!=RE; ++RI) { - SourceLocation L = SMgr.getLogicalLoc(RI->getBegin()); + SourceLocation L = SMgr.getInstantiationLoc(RI->getBegin()); if (!L.isFileID()) return; // FIXME: Emit a warning? @@ -156,7 +155,7 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) { if (SMgr.getCanonicalFileID(L) != FileID) return; // FIXME: Emit a warning? - L = SMgr.getLogicalLoc(RI->getEnd()); + L = SMgr.getInstantiationLoc(RI->getEnd()); if (!L.isFileID()) return; // FIXME: Emit a warning? @@ -230,9 +229,9 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) { << html::EscapeText(Entry->getName()) << "</td></tr>\n<tr><td class=\"rowname\">Location:</td><td>" "<a href=\"#EndPath\">line " - << (*D.rbegin()).getLocation().getLogicalLineNumber() + << (*D.rbegin()).getLocation().getInstantiationLineNumber() << ", column " - << (*D.rbegin()).getLocation().getLogicalColumnNumber() + << (*D.rbegin()).getLocation().getInstantiationColumnNumber() << "</a></td></tr>\n" "<tr><td class=\"rowname\">Description:</td><td>" << D.getDescription() << "</td></tr>\n"; @@ -280,8 +279,8 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) { { std::string s; llvm::raw_string_ostream os(s); - os << "\n<!-- BUGLINE " << D.back()->getLocation().getLogicalLineNumber() - << " -->\n"; + os << "\n<!-- BUGLINE " + << D.back()->getLocation().getInstantiationLineNumber() << " -->\n"; R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str()); } @@ -344,7 +343,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, unsigned BugFileID, return; SourceManager& SM = R.getSourceMgr(); - FullSourceLoc LPos = Pos.getLogicalLoc(); + FullSourceLoc LPos = Pos.getInstantiationLoc(); unsigned FileID = SM.getCanonicalFileID(LPos.getLocation()); assert (&LPos.getManager() == &SM && "SourceManagers are different!"); @@ -359,11 +358,11 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, unsigned BugFileID, // of the line. unsigned ColNo = LPos.getColumnNumber(); - const char *TokLogicalPtr = LPos.getCharacterData(); - const char *LineStart = TokLogicalPtr-ColNo; + const char *TokInstantiationPtr = LPos.getCharacterData(); + const char *LineStart = TokInstantiationPtr-ColNo; // Only compute LineEnd if we display below a line. - const char *LineEnd = TokLogicalPtr; + const char *LineEnd = TokInstantiationPtr; if (P.getDisplayHint() == PathDiagnosticPiece::Below) { const char* FileEnd = Buf->getBufferEnd(); @@ -376,7 +375,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, unsigned BugFileID, unsigned PosNo = 0; - for (const char* c = LineStart; c != TokLogicalPtr; ++c) + for (const char* c = LineStart; c != TokInstantiationPtr; ++c) PosNo += *c == '\t' ? 8 : 1; // Create the html for the message. @@ -471,21 +470,21 @@ void HTMLDiagnostics::HighlightRange(Rewriter& R, unsigned BugFileID, SourceManager& SM = R.getSourceMgr(); - SourceLocation LogicalStart = SM.getLogicalLoc(Range.getBegin()); - unsigned StartLineNo = SM.getLineNumber(LogicalStart); + SourceLocation InstantiationStart = SM.getInstantiationLoc(Range.getBegin()); + unsigned StartLineNo = SM.getLineNumber(InstantiationStart); - SourceLocation LogicalEnd = SM.getLogicalLoc(Range.getEnd()); - unsigned EndLineNo = SM.getLineNumber(LogicalEnd); + SourceLocation InstantiationEnd = SM.getInstantiationLoc(Range.getEnd()); + unsigned EndLineNo = SM.getLineNumber(InstantiationEnd); if (EndLineNo < StartLineNo) return; - if (SM.getCanonicalFileID(LogicalStart) != BugFileID || - SM.getCanonicalFileID(LogicalEnd) != BugFileID) + if (SM.getCanonicalFileID(InstantiationStart) != BugFileID || + SM.getCanonicalFileID(InstantiationEnd) != BugFileID) return; // Compute the column number of the end. - unsigned EndColNo = SM.getColumnNumber(LogicalEnd); + unsigned EndColNo = SM.getColumnNumber(InstantiationEnd); unsigned OldEndColNo = EndColNo; if (EndColNo) { @@ -496,8 +495,9 @@ void HTMLDiagnostics::HighlightRange(Rewriter& R, unsigned BugFileID, // Highlight the range. Make the span tag the outermost tag for the // selected range. - SourceLocation E = LogicalEnd.getFileLocWithOffset(EndColNo - OldEndColNo); + SourceLocation E = + InstantiationEnd.getFileLocWithOffset(EndColNo - OldEndColNo); - html::HighlightRange(R, LogicalStart, E, + html::HighlightRange(R, InstantiationStart, E, "<span class=\"mrange\">", "</span>"); } diff --git a/clang/lib/Driver/PlistDiagnostics.cpp b/clang/lib/Driver/PlistDiagnostics.cpp index b9e35aa815b..7719930125a 100644 --- a/clang/lib/Driver/PlistDiagnostics.cpp +++ b/clang/lib/Driver/PlistDiagnostics.cpp @@ -55,7 +55,7 @@ static void AddFID(FIDMap& FIDs, llvm::SmallVectorImpl<unsigned>& V, SourceManager& SM, SourceLocation L) { - unsigned fid = SM.getCanonicalFileID(SM.getLogicalLoc(L)); + unsigned fid = SM.getCanonicalFileID(SM.getInstantiationLoc(L)); FIDMap::iterator I = FIDs.find(fid); if (I != FIDs.end()) return; FIDs[fid] = V.size(); @@ -64,8 +64,7 @@ static void AddFID(FIDMap& FIDs, static unsigned GetFID(const FIDMap& FIDs, SourceManager& SM, SourceLocation L) { - - unsigned fid = SM.getCanonicalFileID(SM.getLogicalLoc(L)); + unsigned fid = SM.getCanonicalFileID(SM.getInstantiationLoc(L)); FIDMap::const_iterator I = FIDs.find(fid); assert (I != FIDs.end()); return I->second; @@ -82,9 +81,9 @@ static void EmitLocation(llvm::raw_ostream& o, SourceManager& SM, Indent(o, indent) << "<dict>\n"; Indent(o, indent) << " <key>line</key><integer>" - << SM.getLogicalLineNumber(L) << "</integer>\n"; + << SM.getInstantiationLineNumber(L) << "</integer>\n"; Indent(o, indent) << " <key>col</key><integer>" - << SM.getLogicalColumnNumber(L) << "</integer>\n"; + << SM.getInstantiationColumnNumber(L) << "</integer>\n"; Indent(o, indent) << " <key>file</key><integer>" << GetFID(FM, SM, L) << "</integer>\n"; Indent(o, indent) << "</dict>\n"; diff --git a/clang/lib/Driver/TextDiagnosticPrinter.cpp b/clang/lib/Driver/TextDiagnosticPrinter.cpp index 719c611e2c9..1f98ef91901 100644 --- a/clang/lib/Driver/TextDiagnosticPrinter.cpp +++ b/clang/lib/Driver/TextDiagnosticPrinter.cpp @@ -23,7 +23,7 @@ void TextDiagnosticPrinter:: PrintIncludeStack(FullSourceLoc Pos) { if (Pos.isInvalid()) return; - Pos = Pos.getLogicalLoc(); + Pos = Pos.getInstantiationLoc(); // Print out the other include frames first. PrintIncludeStack(Pos.getIncludeLoc()); @@ -44,20 +44,21 @@ void TextDiagnosticPrinter::HighlightRange(const SourceRange &R, "Expect a correspondence between source and caret line!"); if (!R.isValid()) return; - SourceLocation LogicalStart = SourceMgr.getLogicalLoc(R.getBegin()); - unsigned StartLineNo = SourceMgr.getLineNumber(LogicalStart); - if (StartLineNo > LineNo || LogicalStart.getFileID() != FileID) + SourceLocation InstantiationStart = + SourceMgr.getInstantiationLoc(R.getBegin()); + unsigned StartLineNo = SourceMgr.getLineNumber(InstantiationStart); + if (StartLineNo > LineNo || InstantiationStart.getFileID() != FileID) return; // No intersection. - SourceLocation LogicalEnd = SourceMgr.getLogicalLoc(R.getEnd()); - unsigned EndLineNo = SourceMgr.getLineNumber(LogicalEnd); - if (EndLineNo < LineNo || LogicalEnd.getFileID() != FileID) + SourceLocation InstantiationEnd = SourceMgr.getInstantiationLoc(R.getEnd()); + unsigned EndLineNo = SourceMgr.getLineNumber(InstantiationEnd); + if (EndLineNo < LineNo || InstantiationEnd.getFileID() != FileID) return; // No intersection. // Compute the column number of the start. unsigned StartColNo = 0; if (StartLineNo == LineNo) { - StartColNo = SourceMgr.getLogicalColumnNumber(R.getBegin()); + StartColNo = SourceMgr.getInstantiationColumnNumber(R.getBegin()); if (StartColNo) --StartColNo; // Zero base the col #. } @@ -69,7 +70,7 @@ void TextDiagnosticPrinter::HighlightRange(const SourceRange &R, // Compute the column number of the end. unsigned EndColNo = CaretLine.size(); if (EndLineNo == LineNo) { - EndColNo = SourceMgr.getLogicalColumnNumber(R.getEnd()); + EndColNo = SourceMgr.getInstantiationColumnNumber(R.getEnd()); if (EndColNo) { --EndColNo; // Zero base the col #. @@ -102,7 +103,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, const FullSourceLoc &Pos = Info.getLocation(); if (Pos.isValid()) { - FullSourceLoc LPos = Pos.getLogicalLoc(); + FullSourceLoc LPos = Pos.getInstantiationLoc(); LineNo = LPos.getLineNumber(); FileID = LPos.getLocation().getFileID(); @@ -116,14 +117,14 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, // Compute the column number. Rewind from the current position to the start // of the line. ColNo = LPos.getColumnNumber(); - const char *TokLogicalPtr = LPos.getCharacterData(); - LineStart = TokLogicalPtr-ColNo+1; // Column # is 1-based + const char *TokInstantiationPtr = LPos.getCharacterData(); + LineStart = TokInstantiationPtr-ColNo+1; // Column # is 1-based // Compute the line end. Scan forward from the error position to the end of // the line. const llvm::MemoryBuffer *Buffer = LPos.getBuffer(); const char *BufEnd = Buffer->getBufferEnd(); - LineEnd = TokLogicalPtr; + LineEnd = TokInstantiationPtr; while (LineEnd != BufEnd && *LineEnd != '\n' && *LineEnd != '\r') ++LineEnd; |