summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-16 07:00:02 +0000
committerChris Lattner <sabre@nondot.org>2009-01-16 07:00:02 +0000
commit53e384f6335f5b361d838ab5032cb13d262023e4 (patch)
tree273027c121ac46cea71e2d421c267a670e4e5ef9 /clang/lib/Lex/Preprocessor.cpp
parent2d9e40ed2481b3fc34c747841e5c926b7c67308a (diff)
downloadbcm5719-llvm-53e384f6335f5b361d838ab5032cb13d262023e4.tar.gz
bcm5719-llvm-53e384f6335f5b361d838ab5032cb13d262023e4.zip
Change some terminology in SourceLocation: instead of referring to
the "physical" location of tokens, refer to the "spelling" location. This is more concrete and useful, tokens aren't really physical objects! llvm-svn: 62309
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r--clang/lib/Lex/Preprocessor.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index cac78fe6e00..c1d30573cda 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud