[clang] [clang] fix the unexpected control flow in ParseTentative.cpp (PR #109298)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 19 08:11:45 PDT 2024
https://github.com/c8ef created https://github.com/llvm/llvm-project/pull/109298
Fixes https://github.com/llvm/llvm-project/issues/95895.
It appears that there was a logic error in the code of Parser::TryParseProtocolQualifiers related to parsing the identifier list. This pull request fixed the issue.
>From 21594f2793da5d2e1d1cd6714bfa10e742f2e526 Mon Sep 17 00:00:00 2001
From: c8ef <c8ef at outlook.com>
Date: Thu, 19 Sep 2024 23:10:48 +0800
Subject: [PATCH] Update ParseTentative.cpp
---
clang/lib/Parse/ParseTentative.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp
index 9f6b4f6118ede2..af1d146effc46d 100644
--- a/clang/lib/Parse/ParseTentative.cpp
+++ b/clang/lib/Parse/ParseTentative.cpp
@@ -1973,7 +1973,7 @@ Parser::TPResult Parser::TryParseTypeofSpecifier() {
Parser::TPResult Parser::TryParseProtocolQualifiers() {
assert(Tok.is(tok::less) && "Expected '<' for qualifier list");
ConsumeToken();
- do {
+ while (true) {
if (Tok.isNot(tok::identifier))
return TPResult::Error;
ConsumeToken();
@@ -1987,9 +1987,9 @@ Parser::TPResult Parser::TryParseProtocolQualifiers() {
ConsumeToken();
return TPResult::Ambiguous;
}
- } while (false);
- return TPResult::Error;
+ return TPResult::Error;
+ }
}
/// isCXXFunctionDeclarator - Disambiguates between a function declarator or
More information about the cfe-commits
mailing list