summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Lex/PTHLexer.cpp2
-rw-r--r--clang/lib/Lex/Preprocessor.cpp4
-rw-r--r--clang/lib/Sema/SemaExpr.cpp6
3 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Lex/PTHLexer.cpp b/clang/lib/Lex/PTHLexer.cpp
index c5fc6f3da79..8d04736ced8 100644
--- a/clang/lib/Lex/PTHLexer.cpp
+++ b/clang/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/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index a815265e7c9..e09ce1312de 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/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);
}
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 41881a2e5bb..d7a041d0ecf 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -846,13 +846,13 @@ Action::ExprResult Sema::ActOnNumericConstant(const Token &Tok) {
// fast path for a single digit (which is quite common). A single digit
// cannot have a trigraph, escaped newline, radix prefix, or type suffix.
if (Tok.getLength() == 1) {
- const char *Ty = PP.getSourceManager().getCharacterData(Tok.getLocation());
-
+ const char Ty = PP.getPhysicalCharacterAt(Tok.getLocation());
unsigned IntSize =static_cast<unsigned>(Context.getTypeSize(Context.IntTy));
- return ExprResult(new IntegerLiteral(llvm::APInt(IntSize, *Ty-'0'),
+ return ExprResult(new IntegerLiteral(llvm::APInt(IntSize, Ty-'0'),
Context.IntTy,
Tok.getLocation()));
}
+
llvm::SmallString<512> IntegerBuffer;
// Add padding so that NumericLiteralParser can overread by one character.
IntegerBuffer.resize(Tok.getLength()+1);
OpenPOWER on IntegriCloud