[PATCH] D96112: [Syntax] No crash on OpaqueValueExpr.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 18 01:32:30 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG780ead41e075: [Syntax] No crash on OpaqueValueExpr. (authored by hokein).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96112/new/
https://reviews.llvm.org/D96112
Files:
clang/lib/Tooling/Syntax/BuildTree.cpp
clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
Index: clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
===================================================================
--- clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
+++ clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
@@ -512,6 +512,25 @@
)txt"));
}
+TEST_P(BuildSyntaxTreeTest, ConditionalOperator) {
+ // FIXME: conditional expression is not modeled yet.
+ EXPECT_TRUE(treeDumpEqualOnAnnotations(
+ R"cpp(
+void test() {
+ [[1?:2]];
+}
+)cpp",
+ {R"txt(
+UnknownExpression Expression
+|-IntegerLiteralExpression
+| `-'1' LiteralToken
+|-'?'
+|-':'
+`-IntegerLiteralExpression
+ `-'2' LiteralToken
+)txt"}));
+}
+
TEST_P(BuildSyntaxTreeTest, UnqualifiedId_Identifier) {
EXPECT_TRUE(treeDumpEqualOnAnnotations(
R"cpp(
Index: clang/lib/Tooling/Syntax/BuildTree.cpp
===================================================================
--- clang/lib/Tooling/Syntax/BuildTree.cpp
+++ clang/lib/Tooling/Syntax/BuildTree.cpp
@@ -856,6 +856,11 @@
return RecursiveASTVisitor::TraverseStmt(S);
}
+ bool TraverseOpaqueValueExpr(OpaqueValueExpr *VE) {
+ // OpaqueValue doesn't correspond to concrete syntax, ignore it.
+ return true;
+ }
+
// Some expressions are not yet handled by syntax trees.
bool WalkUpFromExpr(Expr *E) {
assert(!isImplicitExpr(E) && "should be handled by TraverseStmt");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96112.324563.patch
Type: text/x-patch
Size: 1353 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210218/54979e07/attachment.bin>
More information about the cfe-commits
mailing list