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

Eduardo Caldas via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 9 00:14:41 PDT 2020


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 UserDefinedLiteralExpression {
+public:
+  UnknownUserDefinedLiteralExpression()
+      : UserDefinedLiteralExpression(
+            NodeKind::UnknownUserDefinedLiteralExpression) {}
----------------
This is gonna be removed once we are able to distinguish between integer and float on raw and template UDL


================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:218-219
     auto InitializerEnd = Initializer.getEnd();
-    assert(SM.isBeforeInTranslationUnit(End, InitializerEnd) || End == InitializerEnd);
+    assert(SM.isBeforeInTranslationUnit(End, InitializerEnd) ||
+           End == InitializerEnd);
     End = InitializerEnd;
----------------
I know it adds noise, but this is the only place where the formatting doesn't obey the llvm clang format.


================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:732
+    case clang::UserDefinedLiteral::LOK_Template:
+      return syntax::NodeKind::UnknownUserDefinedLiteralExpression;
+    }
----------------
Here we need logic to determine which kind of UDL, if float or integer


================
Comment at: clang/unittests/Tooling/Syntax/TreeTest.cpp:1309-1310
     |-ExpressionStatement
-    | |-IntegerLiteralExpression
-    | | `-12ul
+    | |-UnknownUserDefinedLiteralExpression
+    | | `-12_r
     | `-;
----------------
For raw and template UDL, we don't know yet how to get the information about integer of float


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