[clang] [clang] fix the unexpected controlflow in `ParseTentative.cpp` (PR #95917)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 18 05:56:32 PDT 2024
https://github.com/c8ef created https://github.com/llvm/llvm-project/pull/95917
close: #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 c3de9995fe46b55360ec13081ee25f09a0cde4cf Mon Sep 17 00:00:00 2001
From: c8ef <c8ef at outlook.com>
Date: Tue, 18 Jun 2024 20:53:29 +0800
Subject: [PATCH] fix parse func in Parser::TryParseProtocolQualifiers
---
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 ea17c3e3252ec..8ed02b32afb0b 100644
--- a/clang/lib/Parse/ParseTentative.cpp
+++ b/clang/lib/Parse/ParseTentative.cpp
@@ -1960,7 +1960,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();
@@ -1974,9 +1974,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