[PATCH] D155396: [Sema][ObjC] Propagating value-dependent errors into BlockExpr

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 17 10:49:56 PDT 2023


aaron.ballman added a reviewer: hokein.
aaron.ballman added a subscriber: rjmccall.
aaron.ballman added inline comments.


================
Comment at: clang/include/clang/AST/ComputeDependence.h:134
 ExprDependence computeDependence(ExtVectorElementExpr *E);
-ExprDependence computeDependence(BlockExpr *E);
+ExprDependence computeDependence(BlockExpr *E, bool ContainsError);
 ExprDependence computeDependence(AsTypeExpr *E);
----------------
This doesn't seem like the correct fix, to me -- I would have expected the expression itself to track whether it contains errors, so you wouldn't need to pass in extra information about that.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:16749-16753
+  bool ContainsError = llvm::any_of(BSI->Returns, [](const ReturnStmt *Return) {
+    const auto *RetValExpr = Return->getRetValue();
+    return RetValExpr && RetValExpr->containsErrors();
+  });
+  BlockExpr *Result = new (Context) BlockExpr(BD, BlockTy, ContainsError);
----------------
Hmmm -- is the block *expression* what contains the errors in this case  or is it the block declaration? I would have expected this to be an issue for the block declaration created for the block expression. CC @rjmccall 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155396



More information about the cfe-commits mailing list