[PATCH] D82157: Fix crash on `user defined literals`

2020-07-10 Thread Eduardo Caldas via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGf33c2c27a8d4: Fix crash on `user defined literals` (authored by eduucaldas). Changed prior to commit: https://reviews.llvm.org/D82157?vs=277060=277071#toc Repository: rG LLVM Github Monorepo

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-10 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 277060. eduucaldas marked an inline comment as done. eduucaldas added a comment. Add assert Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82157/new/ https://reviews.llvm.org/D82157 Files:

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-10 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 accepted this revision. gribozavr2 added inline comments. This revision is now accepted and ready to land. Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:749 + else +return new (allocator()) syntax::FloatUserDefinedLiteralExpression; +}

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-10 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 276960. eduucaldas added a comment. - Add comment explaining complication on LOK_Raw and LOK_Template - Use FileRange::text instead of Lexer::getSpelling Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-10 Thread Eduardo Caldas via Phabricator via cfe-commits
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()) {

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-10 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas added inline comments. Comment at: clang/unittests/Tooling/Syntax/TreeTest.cpp:1210 + 12_t; // call: operator<'1', '2'> "" _x() | kind: integer + 1.2_t; // call: operator<'1', '2'> "" _x() | kind: float } gribozavr2 wrote: > call -> calls? (as in,

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-10 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 276919. eduucaldas marked 9 inline comments as done. eduucaldas added a comment. Use right function to get TokSpelling, answer comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82157/new/

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-09 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 added inline comments. Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:737 + Builder.findToken(TokLoc)->text(Context.getSourceManager()); + auto Literal = NumericLiteralParser{TokSpelling, + TokLoc,

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-09 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 276772. eduucaldas added a comment. Nothing Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82157/new/ https://reviews.llvm.org/D82157 Files: clang/include/clang/Tooling/Syntax/Nodes.h

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-09 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas marked an inline comment as done. eduucaldas added inline comments. Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:736 + auto TokSpelling = + Builder.findToken(TokLoc)->text(Context.getSourceManager()); + auto Literal =

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-09 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 276771. eduucaldas added a comment. nothing Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82157/new/ https://reviews.llvm.org/D82157 Files: clang/include/clang/Tooling/Syntax/Nodes.h

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-09 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 276770. eduucaldas added a comment. Add support for integer and floating UDL even for raw literal operator and numeric literal operator template Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82157/new/

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-09 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 276681. eduucaldas added a comment. Document proposed solution for treating raw literal operators and numeric template operators Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82157/new/

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-09 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 added inline comments. Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:634 +// `SourceLocation`s. As a result one of these nodes has a valid +// `SourceLocation` that doesn't point to a token. +// eduucaldas wrote: > gribozavr2 wrote: >

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-09 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 276678. eduucaldas added a comment. Polishing patch Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82157/new/ https://reviews.llvm.org/D82157 Files: clang/include/clang/Tooling/Syntax/Nodes.h

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-09 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas added inline comments. Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:634 +// `SourceLocation`s. As a result one of these nodes has a valid +// `SourceLocation` that doesn't point to a token. +// gribozavr2 wrote: > "The semantic AST

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-09 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas marked 4 inline comments as done. eduucaldas added inline comments. Comment at: clang/include/clang/Tooling/Syntax/Nodes.h:347-357 +/// Expression for an unkonwn user-defined literal. C++ [lex.ext] +class UnknownUserDefinedLiteralExpression final +: public

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-09 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 276638. eduucaldas added a comment. workaround size_t Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82157/new/ https://reviews.llvm.org/D82157 Files: clang/include/clang/Testing/TestClangConfig.h

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-09 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 276637. eduucaldas marked 4 inline comments as done. eduucaldas added a comment. Add support for {Integer,Float,Char,String}UserDefinedLiteral Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82157/new/

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-08 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas marked 2 inline comments as done. eduucaldas added inline comments. Comment at: clang/unittests/Tooling/Syntax/TreeTest.cpp:1265 +| |-UserDefinedLiteralExpression +| | `-12_w +| `-; gribozavr2 wrote: > It looks somewhat weird to me that

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-08 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 added a comment. > Fix crash on `user defined literals` WDYT: Implement support for user defined literals (which also fixes a crash) > Given an UserDefinedLiteral 1.2_w: > Problem: Lexer generates one Token for the literal, but ClangAST > references two source locations > Fix:

[PATCH] D82157: Fix crash on `user defined literals`

2020-07-08 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 276361. eduucaldas added a comment. Reflect fix on RecursiveASTVisitor Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82157/new/ https://reviews.llvm.org/D82157 Files:

[PATCH] D82157: Fix crash on `user defined literals`

2020-06-29 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr2 added inline comments. Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:632 +// As a node is built by folding tokens we cannot generate one +// for `_w` +Builder.markChildToken(S->getBeginLoc(), syntax::NodeRole::LiteralToken); This

[PATCH] D82157: Fix crash on `user defined literals`

2020-06-19 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas updated this revision to Diff 271980. eduucaldas added a comment. Why does this work? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82157/new/ https://reviews.llvm.org/D82157 Files: clang/lib/Tooling/Syntax/BuildTree.cpp

[PATCH] D82157: Fix crash on `user defined literals`

2020-06-19 Thread Eduardo Caldas via Phabricator via cfe-commits
eduucaldas created this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Given an UserDefinedLiteral `1.2_w`: Problem: Lexer generates one Token for the literal, but ClangAST references two source locations Fix: Ignore the operator and interpret it as the