[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:12:21 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: None (c8ef)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/109298.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 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
``````````
</details>
https://github.com/llvm/llvm-project/pull/109298
More information about the cfe-commits
mailing list