more SourceLocation lexicon change: instead of referring to the
"logical" location, refer to the "instantiation" location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62316 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/HTMLDiagnostics.cpp b/lib/Driver/HTMLDiagnostics.cpp
index 4fac41c..c067be9 100644
--- a/lib/Driver/HTMLDiagnostics.cpp
+++ b/lib/Driver/HTMLDiagnostics.cpp
@@ -130,9 +130,8 @@
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 @@
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 @@
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 @@
<< 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 @@
{
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 @@
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 @@
// 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 @@
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 @@
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 @@
// 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/lib/Driver/PlistDiagnostics.cpp b/lib/Driver/PlistDiagnostics.cpp
index b9e35aa..7719930 100644
--- a/lib/Driver/PlistDiagnostics.cpp
+++ b/lib/Driver/PlistDiagnostics.cpp
@@ -55,7 +55,7 @@
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 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 @@
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/lib/Driver/TextDiagnosticPrinter.cpp b/lib/Driver/TextDiagnosticPrinter.cpp
index 719c611..1f98ef9 100644
--- a/lib/Driver/TextDiagnosticPrinter.cpp
+++ b/lib/Driver/TextDiagnosticPrinter.cpp
@@ -23,7 +23,7 @@
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 @@
"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 @@
// 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 @@
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 @@
// 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;