[PATCH] D85423: [AST][RecoveryExpr] Fix the missing type when rebuilding RecoveryExpr in TreeTransform.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 7 02:15:49 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG67174765db52: [AST][RecoveryExpr] Fix the missing type when rebuilding RecoveryExpr in… (authored by hokein).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85423

Files:
  clang/lib/Sema/TreeTransform.h
  clang/test/SemaTemplate/recovery-tree-transform-crash.cpp


Index: clang/test/SemaTemplate/recovery-tree-transform-crash.cpp
===================================================================
--- /dev/null
+++ clang/test/SemaTemplate/recovery-tree-transform-crash.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -verify -frecovery-ast -frecovery-ast-type %s
+
+template <class T> struct Ptr { T *operator->() const; };
+
+struct ABC {
+  void run();
+};
+
+Ptr<ABC> call(int); // expected-note {{candidate function not viable}}
+
+void test() {
+  call()->run(undef); // expected-error {{no matching function for call to 'call'}} \
+                         expected-error {{use of undeclared identifier}}
+}
Index: clang/lib/Sema/TreeTransform.h
===================================================================
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -3618,8 +3618,8 @@
   }
 
   ExprResult RebuildRecoveryExpr(SourceLocation BeginLoc, SourceLocation EndLoc,
-                                 ArrayRef<Expr *> SubExprs) {
-    return getSema().CreateRecoveryExpr(BeginLoc, EndLoc, SubExprs);
+                                 ArrayRef<Expr *> SubExprs, QualType Type) {
+    return getSema().CreateRecoveryExpr(BeginLoc, EndLoc, SubExprs, Type);
   }
 
 private:
@@ -10209,7 +10209,7 @@
   if (!getDerived().AlwaysRebuild() && !Changed)
     return E;
   return getDerived().RebuildRecoveryExpr(E->getBeginLoc(), E->getEndLoc(),
-                                          Children);
+                                          Children, E->getType());
 }
 
 template<typename Derived>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85423.283846.patch
Type: text/x-patch
Size: 1555 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200807/7955dc87/attachment.bin>


More information about the cfe-commits mailing list