-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Revert "Reapply "[clang-format] Annotate ::operator and Foo::operator… #165038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… correctly" (llvm#164670)" This reverts commit 50ca1f4. Reverting because this leads to the bug on ToT described in llvm#164866. The original fix addresses an old regression which we'd still like to land eventually. See the discussion in llvm#164670 for more context.
Member
|
@llvm/pr-subscribers-clang-format Author: None (PiJoules) Changes… correctly" (#164670)" This reverts commit 50ca1f4. Reverting because this leads to the bug on ToT described in #164866. The original fix addresses an old regression which we'd still like to land eventually. See the discussion in #164670 for more context. Full diff: https://github.com/llvm/llvm-project/pull/165038.diff 2 Files Affected:
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 1d0dfd0b9c151..a8a9c51952fbd 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -3791,12 +3791,18 @@ static bool isFunctionDeclarationName(const LangOptions &LangOpts,
if (Current.is(TT_FunctionDeclarationName))
return true;
- if (Current.isNoneOf(tok::identifier, tok::kw_operator))
+ if (!Current.Tok.getIdentifierInfo())
return false;
const auto *Prev = Current.getPreviousNonComment();
assert(Prev);
+ if (Prev->is(tok::coloncolon))
+ Prev = Prev->Previous;
+
+ if (!Prev)
+ return false;
+
const auto &Previous = *Prev;
if (const auto *PrevPrev = Previous.getPreviousNonComment();
@@ -3845,8 +3851,6 @@ static bool isFunctionDeclarationName(const LangOptions &LangOpts,
// Find parentheses of parameter list.
if (Current.is(tok::kw_operator)) {
- if (Line.startsWith(tok::kw_friend))
- return true;
if (Previous.Tok.getIdentifierInfo() &&
Previous.isNoneOf(tok::kw_return, tok::kw_co_return)) {
return true;
diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp b/clang/unittests/Format/TokenAnnotatorTest.cpp
index ca99940890984..f3637383a0a65 100644
--- a/clang/unittests/Format/TokenAnnotatorTest.cpp
+++ b/clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -1129,11 +1129,6 @@ TEST_F(TokenAnnotatorTest, UnderstandsOverloadedOperators) {
ASSERT_EQ(Tokens.size(), 7u) << Tokens;
// Not TT_FunctionDeclarationName.
EXPECT_TOKEN(Tokens[3], tok::kw_operator, TT_Unknown);
-
- Tokens = annotate("SomeAPI::operator()();");
- ASSERT_EQ(Tokens.size(), 9u) << Tokens;
- // Not TT_FunctionDeclarationName.
- EXPECT_TOKEN(Tokens[2], tok::kw_operator, TT_Unknown);
}
TEST_F(TokenAnnotatorTest, OverloadedOperatorInTemplate) {
|
Prabhuk
approved these changes
Oct 24, 2025
owenca
added a commit
that referenced
this pull request
Oct 25, 2025
…r… (#165038) This reverts commit bd27abc. See #164670 (comment)
dvbuka
pushed a commit
to dvbuka/llvm-project
that referenced
this pull request
Oct 27, 2025
llvm#165038) … correctly" (llvm#164670)" This reverts commit 50ca1f4. Reverting because this leads to the bug on ToT described in llvm#164866. The original fix addresses an old regression which we'd still like to land eventually. See the discussion in llvm#164670 for more context.
dvbuka
pushed a commit
to dvbuka/llvm-project
that referenced
this pull request
Oct 27, 2025
…r… (llvm#165038) This reverts commit bd27abc. See llvm#164670 (comment)
Lukacma
pushed a commit
to Lukacma/llvm-project
that referenced
this pull request
Oct 29, 2025
llvm#165038) … correctly" (llvm#164670)" This reverts commit 50ca1f4. Reverting because this leads to the bug on ToT described in llvm#164866. The original fix addresses an old regression which we'd still like to land eventually. See the discussion in llvm#164670 for more context.
Lukacma
pushed a commit
to Lukacma/llvm-project
that referenced
this pull request
Oct 29, 2025
…r… (llvm#165038) This reverts commit bd27abc. See llvm#164670 (comment)
aokblast
pushed a commit
to aokblast/llvm-project
that referenced
this pull request
Oct 30, 2025
llvm#165038) … correctly" (llvm#164670)" This reverts commit 50ca1f4. Reverting because this leads to the bug on ToT described in llvm#164866. The original fix addresses an old regression which we'd still like to land eventually. See the discussion in llvm#164670 for more context.
aokblast
pushed a commit
to aokblast/llvm-project
that referenced
this pull request
Oct 30, 2025
…r… (llvm#165038) This reverts commit bd27abc. See llvm#164670 (comment)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
… correctly" (#164670)"
This reverts commit 50ca1f4.
Reverting because this leads to the bug on ToT described in #164866. The original fix addresses an old regression which we'd still like to land eventually. See the discussion in #164670 for more context.