[PATCH] D80154: [AST] Fix recovery-AST crash: dependent overloaded call exprs are now possible.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 18 13:00:58 PDT 2020
sammccall created this revision.
sammccall added a reviewer: hokein.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
sammccall added a comment.
(Haha, I tried to send this 5 hours ago and found it waiting for me to confirm that clang-format could add a single space...)
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80154
Files:
clang/lib/AST/StmtProfile.cpp
clang/test/AST/ast-dump-recovery.cpp
Index: clang/test/AST/ast-dump-recovery.cpp
===================================================================
--- clang/test/AST/ast-dump-recovery.cpp
+++ clang/test/AST/ast-dump-recovery.cpp
@@ -177,3 +177,11 @@
// CHECK: `-VarDecl {{.*}} invalid unresolved_typo 'auto'
auto unresolved_typo = gned.*[] {};
}
+
+// CHECK: `-TypeAliasDecl {{.*}} Escape 'decltype([] {
+// CHECK-NEXT: return <recovery-expr>(undef);
+// CHECK-NEXT: }())'
+// CHECK-NEXT: `-DecltypeType {{.*}} 'decltype([] {
+// CHECK-NEXT: return <recovery-expr>(undef);
+// CHECK-NEXT: }())' dependent
+using Escape = decltype([] { return undef(); }());
Index: clang/lib/AST/StmtProfile.cpp
===================================================================
--- clang/lib/AST/StmtProfile.cpp
+++ clang/lib/AST/StmtProfile.cpp
@@ -1446,7 +1446,6 @@
case OO_Array_New:
case OO_Array_Delete:
case OO_Arrow:
- case OO_Call:
case OO_Conditional:
case NUM_OVERLOADED_OPERATORS:
llvm_unreachable("Invalid operator call kind");
@@ -1620,6 +1619,9 @@
case OO_Subscript:
return Stmt::ArraySubscriptExprClass;
+ case OO_Call:
+ return Stmt::CallExprClass;
+
case OO_Coawait:
UnaryOp = UO_Coawait;
return Stmt::UnaryOperatorClass;
@@ -1660,7 +1662,7 @@
SC == Stmt::CompoundAssignOperatorClass)
ID.AddInteger(BinaryOp);
else
- assert(SC == Stmt::ArraySubscriptExprClass);
+ assert(SC == Stmt::ArraySubscriptExprClass || SC == Stmt::CallExprClass);
return;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80154.264703.patch
Type: text/x-patch
Size: 1530 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200518/e710157f/attachment.bin>
More information about the cfe-commits
mailing list