[PATCH] D116414: [AST] Produce ReturnStmt containing RecoveryExpr when type is wrong

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 4 05:21:04 PST 2022


hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

Thanks, this looks great.



================
Comment at: clang/lib/Sema/SemaStmt.cpp:4037
 
-        // Drop the expression.
-        RetValExp = nullptr;
+        // Preserve the iniializers in the AST.
+        RetValExp = AllowRecovery
----------------
iniializers => inializers


================
Comment at: clang/test/AST/ast-dump-recovery.cpp:365
+auto *brokenDeducedReturn(int *x, float *y, double *z) {
+  // CHECK:      FunctionDecl {{.*}} brokenDeducedReturn
+  if (x) return x;
----------------
nit: I would check the function-decl is invalid as well (this is important).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116414



More information about the cfe-commits mailing list