/// location in the appropriate MemoryBuffer.
char getSpelledCharacterAt(SourceLocation SL) const {
if (PTH) {
- SL = SourceMgr.getSpellingLoc(SL);
const char *Data;
if (PTH->getSpelling(SL, Data))
return *Data;
}
unsigned PTHManager::getSpelling(SourceLocation Loc, const char *&Buffer) {
- std::pair<FileID, unsigned> LocInfo =
- PP->getSourceManager().getDecomposedFileLoc(Loc);
+ SourceManager &SM = PP->getSourceManager();
+ Loc = SM.getSpellingLoc(Loc);
+ std::pair<FileID, unsigned> LocInfo = SM.getDecomposedFileLoc(Loc);
return getSpelling(LocInfo.first, LocInfo.second, Buffer);
}
const char* TokStart;
if (PTH) {
- SourceLocation SLoc = SourceMgr.getSpellingLoc(Tok.getLocation());
- if (unsigned Len = PTH->getSpelling(SLoc, TokStart)) {
+ if (unsigned Len = PTH->getSpelling(Tok.getLocation(), TokStart)) {
assert(!Tok.needsCleaning());
return std::string(TokStart, TokStart+Len);
}
if (CurPTHLexer) {
Len = CurPTHLexer.get()->getSpelling(Tok.getLocation(), Buffer);
} else {
- Len = PTH->getSpelling(SourceMgr.getSpellingLoc(Tok.getLocation()),
- Buffer);
+ Len = PTH->getSpelling(Tok.getLocation(), Buffer);
}
// Did we find a spelling? If so return its length. Otherwise fall