aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Lex')
-rw-r--r--lib/Lex/PTHLexer.cpp2
-rw-r--r--lib/Lex/Preprocessor.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/Lex/PTHLexer.cpp b/lib/Lex/PTHLexer.cpp
index c5fc6f3da7..8d04736ced 100644
--- a/lib/Lex/PTHLexer.cpp
+++ b/lib/Lex/PTHLexer.cpp
@@ -423,7 +423,7 @@ unsigned PTHSpellingSearch::getSpellingBinarySearch(unsigned fpos,
unsigned PTHLexer::getSpelling(SourceLocation sloc, const char *&Buffer) {
SourceManager& SM = PP->getSourceManager();
sloc = SM.getPhysicalLoc(sloc);
- unsigned fid = sloc.getFileID();
+ unsigned fid = SM.getCanonicalFileID(sloc);
unsigned fpos = SM.getFullFilePos(sloc);
return (fid == FileID ) ? MySpellingSrch.getSpellingLinearSearch(fpos, Buffer)
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index a815265e7c..e09ce1312d 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -199,7 +199,7 @@ std::string Preprocessor::getSpelling(const Token &Tok) const {
if (PTH) {
SourceLocation sloc = SourceMgr.getPhysicalLoc(Tok.getLocation());
- unsigned fid = sloc.getFileID();
+ unsigned fid = SourceMgr.getCanonicalFileID(sloc);
unsigned fpos = SourceMgr.getFullFilePos(sloc);
if (unsigned len = PTH->getSpelling(fid, fpos, TokStart)) {
assert(!Tok.needsCleaning());
@@ -265,7 +265,7 @@ unsigned Preprocessor::getSpelling(const Token &Tok,
}
else {
SourceLocation sloc = SourceMgr.getPhysicalLoc(Tok.getLocation());
- unsigned fid = sloc.getFileID();
+ unsigned fid = SourceMgr.getCanonicalFileID(sloc);
unsigned fpos = SourceMgr.getFullFilePos(sloc);
len = PTH->getSpelling(fid, fpos, Buffer);
}