[clang] [clang] fix the unexpected controlflow in `ParseTentative.cpp` (PR #95917)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 18 05:57:07 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: None (c8ef)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/95917.diff
1 Files Affected:
- (modified) clang/lib/Parse/ParseTentative.cpp (+3-3)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/95917
More information about the cfe-commits
mailing list