[PATCH] D82157: Fix crash on `user defined literals`
Eduardo Caldas via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 9 23:34:08 PDT 2020
eduucaldas marked 2 inline comments as done.
eduucaldas added inline comments.
================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:723
+ syntax::UserDefinedLiteralExpression *
+ buildUserDefinedLiteral(UserDefinedLiteral *S) {
+ switch (S->getLiteralOperatorKind()) {
----------------
b or B? Should I use camelCase or TitleCase?
================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:735-751
+ auto TokLoc = S->getBeginLoc();
+ auto buffer = SmallVector<char, 16>();
+ bool invalidSpelling = false;
+ auto TokSpelling =
+ Lexer::getSpelling(TokLoc, buffer, Context.getSourceManager(),
+ Context.getLangOpts(), &invalidSpelling);
+ assert(!invalidSpelling);
----------------
I'll write a comment explaining why this crazyness. Promise not to rant about the lexer that doesn't distinguish between float and integer.
================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:738-740
+ auto TokSpelling =
+ Lexer::getSpelling(TokLoc, buffer, Context.getSourceManager(),
+ Context.getLangOpts(), &invalidSpelling);
----------------
This is exactly the function used by the parser to get the `TokSpelling`. see: llvm-project/clang/lib/Sema/SemaExpr.cpp:3633
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82157/new/
https://reviews.llvm.org/D82157
More information about the cfe-commits
mailing list