aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Lex')
-rw-r--r--lib/Lex/Lexer.cpp12
-rw-r--r--lib/Lex/PTHLexer.cpp2
-rw-r--r--lib/Lex/Preprocessor.cpp30
-rw-r--r--lib/Lex/PreprocessorLexer.cpp2
4 files changed, 23 insertions, 23 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index e6030ad1d4..96295d042f 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -68,7 +68,7 @@ Lexer::Lexer(SourceLocation fileloc, Preprocessor &pp,
Features(pp.getLangOptions()) {
SourceManager &SourceMgr = PP->getSourceManager();
- unsigned InputFileID = SourceMgr.getPhysicalLoc(FileLoc).getFileID();
+ unsigned InputFileID = SourceMgr.getSpellingLoc(FileLoc).getFileID();
const llvm::MemoryBuffer *InputFile = SourceMgr.getBuffer(InputFileID);
Is_PragmaLexer = false;
@@ -281,15 +281,15 @@ static SourceLocation GetMappedTokenLoc(Preprocessor &PP,
unsigned CharNo) {
// Otherwise, we're lexing "mapped tokens". This is used for things like
// _Pragma handling. Combine the instantiation location of FileLoc with the
- // physical location.
+ // spelling location.
SourceManager &SourceMgr = PP.getSourceManager();
// Create a new SLoc which is expanded from logical(FileLoc) but whose
- // characters come from phys(FileLoc)+Offset.
+ // characters come from spelling(FileLoc)+Offset.
SourceLocation VirtLoc = SourceMgr.getLogicalLoc(FileLoc);
- SourceLocation PhysLoc = SourceMgr.getPhysicalLoc(FileLoc);
- PhysLoc = SourceLocation::getFileLoc(PhysLoc.getFileID(), CharNo);
- return SourceMgr.getInstantiationLoc(PhysLoc, VirtLoc);
+ SourceLocation SpellingLoc = SourceMgr.getSpellingLoc(FileLoc);
+ SpellingLoc = SourceLocation::getFileLoc(SpellingLoc.getFileID(), CharNo);
+ return SourceMgr.getInstantiationLoc(SpellingLoc, VirtLoc);
}
/// getSourceLocation - Return a source location identifier for the specified
diff --git a/lib/Lex/PTHLexer.cpp b/lib/Lex/PTHLexer.cpp
index 19ff4942a8..6401b9ac8f 100644
--- a/lib/Lex/PTHLexer.cpp
+++ b/lib/Lex/PTHLexer.cpp
@@ -422,7 +422,7 @@ unsigned PTHSpellingSearch::getSpellingBinarySearch(unsigned fpos,
unsigned PTHLexer::getSpelling(SourceLocation sloc, const char *&Buffer) {
SourceManager& SM = PP->getSourceManager();
- sloc = SM.getPhysicalLoc(sloc);
+ sloc = SM.getSpellingLoc(sloc);
unsigned fid = SM.getCanonicalFileID(sloc);
unsigned fpos = SM.getFullFilePos(sloc);
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index cac78fe6e0..c1d30573cd 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -145,10 +145,10 @@ void Preprocessor::DumpLocation(SourceLocation Loc) const {
<< SourceMgr.getLineNumber(LogLoc) << ':'
<< SourceMgr.getColumnNumber(LogLoc);
- SourceLocation PhysLoc = SourceMgr.getPhysicalLoc(Loc);
- if (PhysLoc != LogLoc) {
- llvm::cerr << " <PhysLoc=";
- DumpLocation(PhysLoc);
+ SourceLocation SpellingLoc = SourceMgr.getSpellingLoc(Loc);
+ if (SpellingLoc != LogLoc) {
+ llvm::cerr << " <SpellingLoc=";
+ DumpLocation(SpellingLoc);
llvm::cerr << ">";
}
}
@@ -199,12 +199,12 @@ std::string Preprocessor::getSpelling(const Token &Tok) const {
const char* TokStart;
if (PTH) {
- SourceLocation sloc = SourceMgr.getPhysicalLoc(Tok.getLocation());
- unsigned fid = SourceMgr.getCanonicalFileID(sloc);
- unsigned fpos = SourceMgr.getFullFilePos(sloc);
- if (unsigned len = PTH->getSpelling(fid, fpos, TokStart)) {
+ SourceLocation SLoc = SourceMgr.getSpellingLoc(Tok.getLocation());
+ unsigned fid = SourceMgr.getCanonicalFileID(SLoc);
+ unsigned fpos = SourceMgr.getFullFilePos(SLoc);
+ if (unsigned Len = PTH->getSpelling(fid, fpos, TokStart)) {
assert(!Tok.needsCleaning());
- return std::string(TokStart, TokStart+len);
+ return std::string(TokStart, TokStart+Len);
}
}
@@ -251,7 +251,7 @@ unsigned Preprocessor::getSpelling(const Token &Tok,
// If using PTH, try and get the spelling from the PTH file.
if (PTH) {
- unsigned len;
+ unsigned Len;
if (CurPTHLexer) {
// We perform the const_cast<> here because we will only have a PTHLexer
@@ -260,22 +260,22 @@ unsigned Preprocessor::getSpelling(const Token &Tok,
// getting token spellings in the order of tokens, and thus can update
// its internal state so that it can quickly fetch spellings from the PTH
// file.
- len =
+ Len =
const_cast<PTHLexer*>(CurPTHLexer.get())->getSpelling(Tok.getLocation(),
Buffer);
}
else {
- SourceLocation sloc = SourceMgr.getPhysicalLoc(Tok.getLocation());
+ SourceLocation sloc = SourceMgr.getSpellingLoc(Tok.getLocation());
unsigned fid = SourceMgr.getCanonicalFileID(sloc);
unsigned fpos = SourceMgr.getFullFilePos(sloc);
- len = PTH->getSpelling(fid, fpos, Buffer);
+ Len = PTH->getSpelling(fid, fpos, Buffer);
}
// Did we find a spelling? If so return its length. Otherwise fall
// back to the default behavior for getting the spelling by looking at
// at the source code.
- if (len)
- return len;
+ if (Len)
+ return Len;
}
// Otherwise, compute the start of the token in the input lexer buffer.
diff --git a/lib/Lex/PreprocessorLexer.cpp b/lib/Lex/PreprocessorLexer.cpp
index 5b3538a45b..07329e0cc7 100644
--- a/lib/Lex/PreprocessorLexer.cpp
+++ b/lib/Lex/PreprocessorLexer.cpp
@@ -18,7 +18,7 @@
using namespace clang;
PreprocessorLexer::PreprocessorLexer(Preprocessor* pp, SourceLocation L)
- : PP(pp), FileID(pp->getSourceManager().getPhysicalLoc(L).getFileID()),
+ : PP(pp), FileID(pp->getSourceManager().getSpellingLoc(L).getFileID()),
ParsingPreprocessorDirective(false),
ParsingFilename(false),
LexingRawMode(false) {}