forked from OSchip/llvm-project
Use FileRange::text instead of Lexer::getSpelling
* as we are using them only for integer and floating literals they have the same behavior * FileRange::text is simpler to call and is within the context of syntax trees
This commit is contained in:
parent
1db5b348c4
commit
a474d5bae4
|
@ -737,20 +737,18 @@ public:
|
||||||
// information from the token. As integer and floating point have the same
|
// information from the token. As integer and floating point have the same
|
||||||
// token kind, we run `NumericLiteralParser` again to distinguish them.
|
// token kind, we run `NumericLiteralParser` again to distinguish them.
|
||||||
auto TokLoc = S->getBeginLoc();
|
auto TokLoc = S->getBeginLoc();
|
||||||
auto buffer = SmallVector<char, 16>();
|
|
||||||
bool invalidSpelling = false;
|
|
||||||
auto TokSpelling =
|
auto TokSpelling =
|
||||||
Lexer::getSpelling(TokLoc, buffer, Context.getSourceManager(),
|
Builder.findToken(TokLoc)->text(Context.getSourceManager());
|
||||||
Context.getLangOpts(), &invalidSpelling);
|
|
||||||
assert(!invalidSpelling);
|
|
||||||
auto Literal =
|
auto Literal =
|
||||||
NumericLiteralParser(TokSpelling, TokLoc, Context.getSourceManager(),
|
NumericLiteralParser(TokSpelling, TokLoc, Context.getSourceManager(),
|
||||||
Context.getLangOpts(), Context.getTargetInfo(),
|
Context.getLangOpts(), Context.getTargetInfo(),
|
||||||
Context.getDiagnostics());
|
Context.getDiagnostics());
|
||||||
if (Literal.isIntegerLiteral())
|
if (Literal.isIntegerLiteral())
|
||||||
return new (allocator()) syntax::IntegerUserDefinedLiteralExpression;
|
return new (allocator()) syntax::IntegerUserDefinedLiteralExpression;
|
||||||
else
|
else {
|
||||||
|
assert(Literal.isFloatingLiteral());
|
||||||
return new (allocator()) syntax::FloatUserDefinedLiteralExpression;
|
return new (allocator()) syntax::FloatUserDefinedLiteralExpression;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue