[PATCH] D157195: [Clang] Fix the do while statement disappearing in AST when an error occurs in the conditional expression of the do while statement

Yurong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 7 04:18:14 PDT 2023


yronglin marked 2 inline comments as done.
yronglin added a comment.

Thanks for your review! @hokein @tbaeder



================
Comment at: clang/lib/Parse/ParseStmt.cpp:1897-1898
   if (Cond.isUsable())
-    Cond = Actions.CorrectDelayedTyposInExpr(Cond);
+    Cond = Actions.CorrectDelayedTyposInExpr(Cond, /*InitDecl*/ nullptr,
+                                             /*RecoveryUncorrectedTypos*/ true);
   else {
----------------
tbaeder wrote:
> 
Thanks, done!


================
Comment at: clang/test/SemaCXX/constexpr-function-recovery-crash.cpp:81
 
+constexpr int test13() { do {} while (a < 10); return 0; }   // expected-error {{use of undeclared identifier}}
+static_assert(test13());  // expected-error {{static assertion expression is not an integral constant expression}}
----------------
hokein wrote:
> nit: it is better to use the below `TEST_EVALUATE` macro for the test, `TEST_EVALUATE(DoWhile2, do {} while (undefined < 10); )`
Thanks, done!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157195



More information about the cfe-commits mailing list