summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Analysis/BugReporter.cpp23
-rw-r--r--clang/lib/Analysis/CFRefCount.cpp6
-rw-r--r--clang/lib/Analysis/GRExprEngineInternalChecks.cpp5
-rw-r--r--clang/lib/Basic/SourceLocation.cpp22
-rw-r--r--clang/lib/Basic/SourceManager.cpp4
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp24
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp3
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp2
-rw-r--r--clang/lib/Driver/HTMLDiagnostics.cpp46
-rw-r--r--clang/lib/Driver/PlistDiagnostics.cpp9
-rw-r--r--clang/lib/Driver/TextDiagnosticPrinter.cpp27
-rw-r--r--clang/lib/Lex/Lexer.cpp8
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp6
-rw-r--r--clang/lib/Lex/Preprocessor.cpp4
-rw-r--r--clang/lib/Parse/ParseStmt.cpp4
-rw-r--r--clang/lib/Rewrite/HTMLRewrite.cpp10
16 files changed, 99 insertions, 104 deletions
diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp
index e6840c3ad25..adb3325f53d 100644
--- a/clang/lib/Analysis/BugReporter.cpp
+++ b/clang/lib/Analysis/BugReporter.cpp
@@ -94,7 +94,7 @@ static void ExecutionContinues(std::ostringstream& os, SourceManager& SMgr,
os << ' ';
os << "Execution continues on line "
- << SMgr.getLogicalLineNumber(S->getLocStart()) << '.';
+ << SMgr.getInstantiationLineNumber(S->getLocStart()) << '.';
}
@@ -534,7 +534,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
std::ostringstream os;
os << "Control jumps to line "
- << SMgr.getLogicalLineNumber(S->getLocStart()) << ".\n";
+ << SMgr.getInstantiationLineNumber(S->getLocStart()) << ".\n";
PD.push_front(new PathDiagnosticPiece(L, os.str()));
break;
@@ -548,23 +548,17 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
if (Stmt* S = Dst->getLabel())
switch (S->getStmtClass()) {
-
- default: {
+ default:
os << "No cases match in the switch statement. "
"Control jumps to line "
- << SMgr.getLogicalLineNumber(S->getLocStart()) << ".\n";
- break;
- }
-
- case Stmt::DefaultStmtClass: {
+ << SMgr.getInstantiationLineNumber(S->getLocStart()) << ".\n";
+ break;
+ case Stmt::DefaultStmtClass:
os << "Control jumps to the 'default' case at line "
- << SMgr.getLogicalLineNumber(S->getLocStart()) << ".\n";
-
+ << SMgr.getInstantiationLineNumber(S->getLocStart()) << ".\n";
break;
- }
case Stmt::CaseStmtClass: {
-
os << "Control jumps to 'case ";
CaseStmt* Case = cast<CaseStmt>(S);
@@ -602,10 +596,9 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
}
os << ":' at line "
- << SMgr.getLogicalLineNumber(S->getLocStart()) << ".\n";
+ << SMgr.getInstantiationLineNumber(S->getLocStart()) << ".\n";
break;
-
}
}
else {
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp
index d2d7ab8d041..af96c0672b6 100644
--- a/clang/lib/Analysis/CFRefCount.cpp
+++ b/clang/lib/Analysis/CFRefCount.cpp
@@ -2541,7 +2541,7 @@ PathDiagnosticPiece* CFRefReport::getEndPath(BugReporter& br,
Stmt* FirstStmt = cast<PostStmt>(AllocNode->getLocation()).getStmt();
SourceManager& SMgr = BR.getContext().getSourceManager();
- unsigned AllocLine = SMgr.getLogicalLineNumber(FirstStmt->getLocStart());
+ unsigned AllocLine =SMgr.getInstantiationLineNumber(FirstStmt->getLocStart());
// Get the leak site. We may have multiple ExplodedNodes (one with the
// leak) that occur on the same line number; if the node with the leak
@@ -2559,7 +2559,7 @@ PathDiagnosticPiece* CFRefReport::getEndPath(BugReporter& br,
Stmt* S = getStmt(BR); // This is the statement where the leak occured.
assert (S);
- unsigned EndLine = SMgr.getLogicalLineNumber(S->getLocStart());
+ unsigned EndLine = SMgr.getInstantiationLineNumber(S->getLocStart());
// Look in the *trimmed* graph at the immediate predecessor of EndN. Does
// it occur on the same line?
@@ -2574,7 +2574,7 @@ PathDiagnosticPiece* CFRefReport::getEndPath(BugReporter& br,
Stmt* SPred = PredPS->getStmt();
// Predecessor at same line?
- if (SMgr.getLogicalLineNumber(SPred->getLocStart()) != EndLine) {
+ if (SMgr.getInstantiationLineNumber(SPred->getLocStart()) != EndLine) {
Hint = PathDiagnosticPiece::Below;
S = SPred;
}
diff --git a/clang/lib/Analysis/GRExprEngineInternalChecks.cpp b/clang/lib/Analysis/GRExprEngineInternalChecks.cpp
index d32318ca7d9..e7a644ce19e 100644
--- a/clang/lib/Analysis/GRExprEngineInternalChecks.cpp
+++ b/clang/lib/Analysis/GRExprEngineInternalChecks.cpp
@@ -212,7 +212,8 @@ public:
const CompoundLiteralExpr* CL = CR->getLiteralExpr();
os << "Address of stack memory associated with a compound literal "
"declared on line "
- << BR.getSourceManager().getLogicalLineNumber(CL->getLocStart())
+ << BR.getSourceManager()
+ .getInstantiationLineNumber(CL->getLocStart())
<< " returned.";
R = CL->getSourceRange();
@@ -223,7 +224,7 @@ public:
R = ARE->getSourceRange();
os << "Address of stack memory allocated by call to alloca() on line "
- << BR.getSourceManager().getLogicalLineNumber(L)
+ << BR.getSourceManager().getInstantiationLineNumber(L)
<< " returned.";
}
else {
diff --git a/clang/lib/Basic/SourceLocation.cpp b/clang/lib/Basic/SourceLocation.cpp
index bb8cac2f9f0..a34293177ba 100644
--- a/clang/lib/Basic/SourceLocation.cpp
+++ b/clang/lib/Basic/SourceLocation.cpp
@@ -37,9 +37,9 @@ SourceRange SourceRange::ReadVal(llvm::Deserializer& D) {
return SourceRange(A,B);
}
-FullSourceLoc FullSourceLoc::getLogicalLoc() const {
+FullSourceLoc FullSourceLoc::getInstantiationLoc() const {
assert (isValid());
- return FullSourceLoc(SrcMgr->getLogicalLoc(Loc), *SrcMgr);
+ return FullSourceLoc(SrcMgr->getInstantiationLoc(Loc), *SrcMgr);
}
FullSourceLoc FullSourceLoc::getSpellingLoc() const {
@@ -63,14 +63,14 @@ unsigned FullSourceLoc::getColumnNumber() const {
}
-unsigned FullSourceLoc::getLogicalLineNumber() const {
+unsigned FullSourceLoc::getInstantiationLineNumber() const {
assert (isValid());
- return SrcMgr->getLogicalLineNumber(Loc);
+ return SrcMgr->getInstantiationLineNumber(Loc);
}
-unsigned FullSourceLoc::getLogicalColumnNumber() const {
+unsigned FullSourceLoc::getInstantiationColumnNumber() const {
assert (isValid());
- return SrcMgr->getLogicalColumnNumber(Loc);
+ return SrcMgr->getInstantiationColumnNumber(Loc);
}
unsigned FullSourceLoc::getSpellingLineNumber() const {
@@ -120,15 +120,15 @@ void FullSourceLoc::dump() const {
}
if (isFileID()) {
- // The logical and spelling pos is identical for file locs.
+ // The instantiation and spelling pos is identical for file locs.
fprintf(stderr, "File Loc from '%s': %d: %d\n",
- getSourceName(), getLogicalLineNumber(),
- getLogicalColumnNumber());
+ getSourceName(), getInstantiationLineNumber(),
+ getInstantiationColumnNumber());
} else {
fprintf(stderr, "Macro Loc (\n Spelling: ");
getSpellingLoc().dump();
- fprintf(stderr, " Logical: ");
- getLogicalLoc().dump();
+ fprintf(stderr, " Instantiation: ");
+ getInstantiationLoc().dump();
fprintf(stderr, ")\n");
}
}
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 55e8c4aee78..fa0a9bb565a 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -155,8 +155,8 @@ SourceLocation SourceManager::getInstantiationLoc(SourceLocation SpellingLoc,
// where the characters are actually located.
SpellingLoc = getSpellingLoc(SpellingLoc);
- // Resolve InstantLoc down to a real logical location.
- InstantLoc = getLogicalLoc(InstantLoc);
+ // Resolve InstantLoc down to a real instantiation location.
+ InstantLoc = getInstantiationLoc(InstantLoc);
// If the last macro id is close to the currently requested location, try to
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 6176b868ea8..9cbefa3d069 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -41,7 +41,7 @@ CGDebugInfo::~CGDebugInfo() {
void CGDebugInfo::setLocation(SourceLocation Loc) {
if (Loc.isValid())
- CurLoc = M->getContext().getSourceManager().getLogicalLoc(Loc);
+ CurLoc = M->getContext().getSourceManager().getInstantiationLoc(Loc);
}
/// getOrCreateCompileUnit - Get the compile unit from the cache or create a new
@@ -157,7 +157,7 @@ llvm::DIType CGDebugInfo::CreateType(const TypedefType *Ty,
llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(DefLoc);
SourceManager &SM = M->getContext().getSourceManager();
- uint64_t Line = SM.getLogicalLineNumber(DefLoc);
+ uint64_t Line = SM.getInstantiationLineNumber(DefLoc);
return DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_typedef, Unit,
TyName, DefUnit, Line, 0, 0, 0, 0, Src);
@@ -209,7 +209,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
std::string Name = Decl->getNameAsString();
llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(Decl->getLocation());
- uint64_t Line = SM.getLogicalLineNumber(Decl->getLocation());
+ unsigned Line = SM.getInstantiationLineNumber(Decl->getLocation());
// Records and classes and unions can all be recursive. To handle them, we
@@ -247,11 +247,11 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
// Get the location for the field.
SourceLocation FieldDefLoc = Field->getLocation();
llvm::DICompileUnit FieldDefUnit = getOrCreateCompileUnit(FieldDefLoc);
- uint64_t FieldLine = SM.getLogicalLineNumber(FieldDefLoc);
+ unsigned FieldLine = SM.getInstantiationLineNumber(FieldDefLoc);
// Bit size, align and offset of the type.
uint64_t FieldSize = M->getContext().getTypeSize(Ty);
- uint64_t FieldAlign = M->getContext().getTypeAlign(Ty);
+ unsigned FieldAlign = M->getContext().getTypeAlign(Ty);
uint64_t FieldOffset = RL.getFieldOffset(FieldNo);
// Create a DW_TAG_member node to remember the offset of this field in the
@@ -305,11 +305,11 @@ llvm::DIType CGDebugInfo::CreateType(const EnumType *Ty,
SourceLocation DefLoc = Decl->getLocation();
llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(DefLoc);
SourceManager &SM = M->getContext().getSourceManager();
- uint64_t Line = SM.getLogicalLineNumber(DefLoc);
+ unsigned Line = SM.getInstantiationLineNumber(DefLoc);
// Size and align of the type.
uint64_t Size = M->getContext().getTypeSize(Ty);
- uint64_t Align = M->getContext().getTypeAlign(Ty);
+ unsigned Align = M->getContext().getTypeAlign(Ty);
return DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_enumeration_type,
Unit, EnumName, DefUnit, Line,
@@ -428,7 +428,7 @@ void CGDebugInfo::EmitFunctionStart(const char *Name, QualType ReturnType,
// FIXME: Why is this using CurLoc???
llvm::DICompileUnit Unit = getOrCreateCompileUnit(CurLoc);
SourceManager &SM = M->getContext().getSourceManager();
- uint64_t LineNo = SM.getLogicalLineNumber(CurLoc);
+ unsigned LineNo = SM.getInstantiationLineNumber(CurLoc);
llvm::DISubprogram SP =
DebugFactory.CreateSubprogram(Unit, Name, Name, "", Unit, LineNo,
@@ -457,8 +457,8 @@ void CGDebugInfo::EmitStopPoint(llvm::Function *Fn, CGBuilderTy &Builder) {
// Get the appropriate compile unit.
llvm::DICompileUnit Unit = getOrCreateCompileUnit(CurLoc);
- DebugFactory.InsertStopPoint(Unit, SM.getLogicalLineNumber(CurLoc),
- SM.getLogicalColumnNumber(CurLoc),
+ DebugFactory.InsertStopPoint(Unit, SM.getInstantiationLineNumber(CurLoc),
+ SM.getInstantiationColumnNumber(CurLoc),
Builder.GetInsertBlock());
}
@@ -492,7 +492,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *Decl, unsigned Tag,
// Get location information.
SourceManager &SM = M->getContext().getSourceManager();
- uint64_t Line = SM.getLogicalLineNumber(Decl->getLocation());
+ unsigned Line = SM.getInstantiationLineNumber(Decl->getLocation());
llvm::DICompileUnit Unit = getOrCreateCompileUnit(Decl->getLocation());
// Create the descriptor for the variable.
@@ -525,7 +525,7 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
// Create global variable debug descriptor.
llvm::DICompileUnit Unit = getOrCreateCompileUnit(Decl->getLocation());
SourceManager &SM = M->getContext().getSourceManager();
- uint64_t LineNo = SM.getLogicalLineNumber(Decl->getLocation());
+ unsigned LineNo = SM.getInstantiationLineNumber(Decl->getLocation());
std::string Name = Decl->getNameAsString();
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index db6aae6dfd7..1acebaed4b9 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -125,7 +125,8 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D) {
if (const AnnotateAttr *AA = D.getAttr<AnnotateAttr>()) {
SourceManager &SM = CGM.getContext().getSourceManager();
llvm::Constant *Ann =
- CGM.EmitAnnotateAttr(GV, AA, SM.getLogicalLineNumber(D.getLocation()));
+ CGM.EmitAnnotateAttr(GV, AA,
+ SM.getInstantiationLineNumber(D.getLocation()));
CGM.AddAnnotation(Ann);
}
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 39611a08deb..7856b076d2d 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -591,7 +591,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
if (const AnnotateAttr *AA = D->getAttr<AnnotateAttr>()) {
SourceManager &SM = Context.getSourceManager();
AddAnnotation(EmitAnnotateAttr(GV, AA,
- SM.getLogicalLineNumber(D->getLocation())));
+ SM.getInstantiationLineNumber(D->getLocation())));
}
GV->setInitializer(Init);
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;
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index 96295d042fb..0eb439a27b6 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/lib/Lex/Lexer.cpp
@@ -179,7 +179,7 @@ unsigned Lexer::MeasureTokenLength(SourceLocation Loc,
const SourceManager &SM) {
// If this comes from a macro expansion, we really do want the macro name, not
// the token this macro expanded to.
- Loc = SM.getLogicalLoc(Loc);
+ Loc = SM.getInstantiationLoc(Loc);
const char *StrData = SM.getCharacterData(Loc);
@@ -284,12 +284,12 @@ static SourceLocation GetMappedTokenLoc(Preprocessor &PP,
// spelling location.
SourceManager &SourceMgr = PP.getSourceManager();
- // Create a new SLoc which is expanded from logical(FileLoc) but whose
+ // Create a new SLoc which is expanded from Instantiation(FileLoc) but whose
// characters come from spelling(FileLoc)+Offset.
- SourceLocation VirtLoc = SourceMgr.getLogicalLoc(FileLoc);
+ SourceLocation InstLoc = SourceMgr.getInstantiationLoc(FileLoc);
SourceLocation SpellingLoc = SourceMgr.getSpellingLoc(FileLoc);
SpellingLoc = SourceLocation::getFileLoc(SpellingLoc.getFileID(), CharNo);
- return SourceMgr.getInstantiationLoc(SpellingLoc, VirtLoc);
+ return SourceMgr.getInstantiationLoc(SpellingLoc, InstLoc);
}
/// getSourceLocation - Return a source location identifier for the specified
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 81e44f4823f..6c4096de6cc 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -244,7 +244,7 @@ bool Preprocessor::HandleMacroExpandedIdentifier(Token &Identifier,
Identifier.setFlagValue(Token::StartOfLine , isAtStartOfLine);
Identifier.setFlagValue(Token::LeadingSpace, hasLeadingSpace);
- // Update the tokens location to include both its logical and physical
+ // Update the tokens location to include both its instantiation and physical
// locations.
SourceLocation Loc =
SourceMgr.getInstantiationLoc(Identifier.getLocation(), InstantiateLoc);
@@ -453,7 +453,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
// it will tokenize as a number (and not run into stuff after it in the temp
// buffer).
sprintf(TmpBuffer, "%u ",
- SourceMgr.getLogicalLineNumber(Tok.getLocation()));
+ SourceMgr.getInstantiationLineNumber(Tok.getLocation()));
unsigned Length = strlen(TmpBuffer)-1;
Tok.setKind(tok::numeric_constant);
Tok.setLength(Length);
@@ -470,7 +470,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
}
// Escape this filename. Turn '\' -> '\\' '"' -> '\"'
- std::string FN = SourceMgr.getSourceName(SourceMgr.getLogicalLoc(Loc));
+ std::string FN =SourceMgr.getSourceName(SourceMgr.getInstantiationLoc(Loc));
FN = '"' + Lexer::Stringify(FN) + '"';
Tok.setKind(tok::string_literal);
Tok.setLength(FN.size());
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 59632edaaeb..bbe0f5c0f92 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -140,7 +140,7 @@ void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const {
}
void Preprocessor::DumpLocation(SourceLocation Loc) const {
- SourceLocation LogLoc = SourceMgr.getLogicalLoc(Loc);
+ SourceLocation LogLoc = SourceMgr.getInstantiationLoc(Loc);
llvm::cerr << SourceMgr.getSourceName(LogLoc) << ':'
<< SourceMgr.getLineNumber(LogLoc) << ':'
<< SourceMgr.getColumnNumber(LogLoc);
@@ -314,7 +314,7 @@ SourceLocation Preprocessor::AdvanceToTokenCharacter(SourceLocation TokStart,
// confusing.
if (CharNo == 0 || TokStart.isMacroID()) return TokStart;
- // Figure out how many physical characters away the specified logical
+ // Figure out how many physical characters away the specified instantiation
// character is. This needs to take into consideration newlines and
// trigraphs.
const char *TokPtr = SourceMgr.getCharacterData(TokStart);
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index d83e98d8d83..153aeb824eb 100644
--- a/clang/lib/Parse/ParseStmt.cpp
+++ b/clang/lib/Parse/ParseStmt.cpp
@@ -1037,11 +1037,11 @@ Parser::OwningStmtResult Parser::FuzzyParseMicrosoftAsmStatement() {
// that the rest of the line is an assembly-language statement.
SourceManager &SrcMgr = PP.getSourceManager();
SourceLocation TokLoc = Tok.getLocation();
- unsigned lineNo = SrcMgr.getLogicalLineNumber(TokLoc);
+ unsigned LineNo = SrcMgr.getInstantiationLineNumber(TokLoc);
do {
ConsumeAnyToken();
TokLoc = Tok.getLocation();
- } while ((SrcMgr.getLogicalLineNumber(TokLoc) == lineNo) &&
+ } while ((SrcMgr.getInstantiationLineNumber(TokLoc) == LineNo) &&
Tok.isNot(tok::r_brace) && Tok.isNot(tok::semi) &&
Tok.isNot(tok::eof));
}
diff --git a/clang/lib/Rewrite/HTMLRewrite.cpp b/clang/lib/Rewrite/HTMLRewrite.cpp
index 67afc08b9fd..a605a1e6655 100644
--- a/clang/lib/Rewrite/HTMLRewrite.cpp
+++ b/clang/lib/Rewrite/HTMLRewrite.cpp
@@ -31,8 +31,8 @@ using namespace clang;
void html::HighlightRange(Rewriter &R, SourceLocation B, SourceLocation E,
const char *StartTag, const char *EndTag) {
SourceManager &SM = R.getSourceMgr();
- B = SM.getLogicalLoc(B);
- E = SM.getLogicalLoc(E);
+ B = SM.getInstantiationLoc(B);
+ E = SM.getInstantiationLoc(E);
unsigned FileID = SM.getCanonicalFileID(B);
assert(SM.getCanonicalFileID(E) == FileID && "B/E not in the same file!");
@@ -442,8 +442,8 @@ void html::HighlightMacros(Rewriter &R, unsigned FileID, Preprocessor& PP) {
continue;
}
- // Ignore tokens whose logical location was not the main file.
- SourceLocation LLoc = SourceMgr.getLogicalLoc(Tok.getLocation());
+ // Ignore tokens whose instantiation location was not the main file.
+ SourceLocation LLoc = SourceMgr.getInstantiationLoc(Tok.getLocation());
std::pair<unsigned, unsigned> LLocInfo =
SourceMgr.getDecomposedFileLoc(LLoc);
@@ -476,7 +476,7 @@ void html::HighlightMacros(Rewriter &R, unsigned FileID, Preprocessor& PP) {
// instantiation. It would be really nice to pop up a window with all the
// spelling of the tokens or something.
while (!Tok.is(tok::eof) &&
- SourceMgr.getLogicalLoc(Tok.getLocation()) == LLoc) {
+ SourceMgr.getInstantiationLoc(Tok.getLocation()) == LLoc) {
// Insert a newline if the macro expansion is getting large.
if (LineLen > 60) {
Expansion += "<br>";
OpenPOWER on IntegriCloud