rename PP::getPhysicalCharacterAt -> PP::getSpelledCharacterAt.
Slightly speed up sema of numbers like '1' by going directly to
TargetInfo instead of through ASTContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62314 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index b8d58c1..bf2d7b1 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -851,12 +851,12 @@
}
Action::ExprResult Sema::ActOnNumericConstant(const Token &Tok) {
- // fast path for a single digit (which is quite common). A single digit
+ // 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.getPhysicalCharacterAt(Tok.getLocation());
- unsigned IntSize =static_cast<unsigned>(Context.getTypeSize(Context.IntTy));
- return ExprResult(new IntegerLiteral(llvm::APInt(IntSize, Ty-'0'),
+ const char Val = PP.getSpelledCharacterAt(Tok.getLocation());
+ unsigned IntSize = Context.Target.getIntWidth();
+ return ExprResult(new IntegerLiteral(llvm::APInt(IntSize, Val-'0'),
Context.IntTy,
Tok.getLocation()));
}