[clang] [Clang] Fix the do while statement disappearing in AST when an error occurs in the conditional expression of the for statement (PR #65381)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 5 09:54:51 PDT 2023


================
@@ -2158,8 +2158,10 @@ StmtResult Parser::ParseForStatement(SourceLocation *TrailingElseLoc) {
         // for-range-declaration next.
         bool MightBeForRangeStmt = !ForRangeInfo.ParsedForRangeDecl();
         ColonProtectionRAIIObject ColonProtection(*this, MightBeForRangeStmt);
+        SourceLocation SecondPartStart = Tok.getLocation();
+        Sema::ConditionKind CK = Sema::ConditionKind::Boolean;
         SecondPart = ParseCXXCondition(
----------------
yronglin wrote:

Can we use `ParseParenExprOrCondition` here? but it may need to extend the parameters of `ParseParenExprOrCondition `.

https://github.com/llvm/llvm-project/pull/65381


More information about the cfe-commits mailing list