[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
Tue May 19 02:40:50 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG1d579f54d720: [AST] Fix recovery-AST crash: dependent overloaded call exprs are now possible. (authored by sammccall).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80154/new/

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.264829.patch
Type: text/x-patch
Size: 1530 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200519/a9903440/attachment-0001.bin>


More information about the cfe-commits mailing list