[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-02-05 Thread Owen Pan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG35f2ac1763ad: [clang-format] Fix inconsistent annotation of operator (authored by dkt01, committed by owenpan). Repository: rG LLVM Github

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-02-05 Thread David K Turner via Phabricator via cfe-commits
dkt01 updated this revision to Diff 494928. dkt01 marked an inline comment as done. dkt01 added a comment. Changes requested in owenpan's review. Rebased changes onto latest main branch. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141959/new/ https://reviews.llvm.org/D141959 Files:

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-02-05 Thread David K Turner via Phabricator via cfe-commits
dkt01 marked 4 inline comments as done. dkt01 added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:123 private: + ScopeType getScopeType(FormatToken ) { +switch (Token.getType()) { owenpan wrote: > As suggested before. Oops... missed the

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-02-04 Thread Owen Pan via Phabricator via cfe-commits
owenpan accepted this revision. owenpan added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:123 private: + ScopeType getScopeType(FormatToken ) { +switch (Token.getType()) { As suggested before. Comment at:

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-02-01 Thread David K Turner via Phabricator via cfe-commits
dkt01 updated this revision to Diff 494059. dkt01 added a comment. Updates recommended by owenpan in review. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141959/new/ https://reviews.llvm.org/D141959 Files: clang/lib/Format/TokenAnnotator.cpp clang/lib/Format/TokenAnnotator.h

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-02-01 Thread David K Turner via Phabricator via cfe-commits
dkt01 marked 8 inline comments as done. dkt01 added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:1195-1198 + // Handle unbalanced braces. + if (!Scopes.empty()) +Scopes.pop_back(); // Lines can start with '}'. owenpan

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-02-01 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:123-125 + bool braceTokenMatchesScope(FormatToken ) { +if (!Token.is(tok::l_brace) || Scopes.empty()) + return false; Comment at:

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-29 Thread David K Turner via Phabricator via cfe-commits
dkt01 updated this revision to Diff 493104. dkt01 added a comment. Updates suggested in owenpan's review. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141959/new/ https://reviews.llvm.org/D141959 Files: clang/lib/Format/TokenAnnotator.cpp clang/lib/Format/TokenAnnotator.h

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-29 Thread David K Turner via Phabricator via cfe-commits
dkt01 marked 11 inline comments as done. dkt01 added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:1195-1198 + // Handle unbalanced braces. + if (!Scopes.empty()) +Scopes.pop_back(); // Lines can start with '}'.

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-27 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:2488-2490 +(NextToken && NextToken->Tok.isAnyIdentifier()) && +(NextToken->getNextNonComment() && + (NextToken->getNextNonComment()->isOneOf( dkt01 wrote: >

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-26 Thread David K Turner via Phabricator via cfe-commits
dkt01 updated this revision to Diff 492482. dkt01 marked an inline comment as done. dkt01 added a comment. Changes as suggested in review from owenpan CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141959/new/ https://reviews.llvm.org/D141959 Files:

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-26 Thread David K Turner via Phabricator via cfe-commits
dkt01 marked 11 inline comments as done. dkt01 added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:1162-1169 + case TT_EnumLBrace: + case TT_ControlStatementLBrace: + case TT_ElseLBrace: + case TT_BracedListLBrace: + case

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-26 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:116-117 + SmallVector ) + : Scopes(TrackedScopes), Style(Style), Line(Line), +CurrentToken(Line.First), AutoFound(false), Keywords(Keywords) {

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-26 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment. > Good to know it worked as expected on your project as well. I have some concerns (mainly because it feels like it could be quite invasive), hence I'm delaying on the LGTM, I really want to run this on a large code base, which I think if we commit post the

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-25 Thread David K Turner via Phabricator via cfe-commits
dkt01 added a comment. David Turner Good to know it worked as expected on your project as well. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141959/new/ https://reviews.llvm.org/D141959 ___ cfe-commits mailing list

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-25 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment. I think they have branched (https://clang.llvm.org/docs/ClangFormatStyleOptions.html) the documentation has changed to 17.0 We would need your name and email in order to commit on your behalf. I checked this patch out and tested it on my large project and I

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-24 Thread David K Turner via Phabricator via cfe-commits
dkt01 added a comment. Sounds good. I don't believe I have permissions to add commits to three repo anyway, so someone can add on my behalf after the 16 branch. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141959/new/ https://reviews.llvm.org/D141959

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-24 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment. There is part of me that feels we should not rush this in to get it into 16 (which was due to branch today), I feel it might be a good idea to commit this after branching, and let it live in 'main' so we can take for a real test drive CHANGES SINCE LAST ACTION

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-24 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks accepted this revision. HazardyKnusperkeks added a reviewer: rymiel. HazardyKnusperkeks added a comment. This revision is now accepted and ready to land. Looks good to me, but please wait until another one has given their blessing, or at least no veto for a few days. CHANGES

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-24 Thread David K Turner via Phabricator via cfe-commits
dkt01 updated this revision to Diff 491823. dkt01 added a comment. Changes recommended by HazardyKnusperkeks in review. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141959/new/ https://reviews.llvm.org/D141959 Files: clang/lib/Format/TokenAnnotator.cpp

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-23 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:851 if (CurrentToken->is(tok::r_brace)) { +// Handle unbalanced braces +if (Scopes.size() > 1) See below Comment at:

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-20 Thread David K Turner via Phabricator via cfe-commits
dkt01 updated this revision to Diff 490859. dkt01 added a comment. Changes as suggested by HazardyKnusperkeks in review. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141959/new/ https://reviews.llvm.org/D141959 Files: clang/lib/Format/TokenAnnotator.cpp

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-20 Thread David K Turner via Phabricator via cfe-commits
dkt01 marked an inline comment as done. dkt01 added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:2544 SmallVector Contexts; + static SmallVector Scopes; HazardyKnusperkeks wrote: > dkt01 wrote: > > HazardyKnusperkeks wrote: > > > Why

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-20 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:2544 SmallVector Contexts; + static SmallVector Scopes; dkt01 wrote: > HazardyKnusperkeks wrote: > > Why static? > The AnnotatingParser object lifetime is too short

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-18 Thread David K Turner via Phabricator via cfe-commits
dkt01 marked an inline comment as done. dkt01 added inline comments. Comment at: clang/unittests/Format/TokenAnnotatorTest.cpp:181 + ASSERT_EQ(Tokens.size(), 5u) << Tokens; + EXPECT_TOKEN(Tokens[1], tok::amp, TT_BinaryOperator); + MyDeveloperDay wrote: > how

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-18 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments. Comment at: clang/unittests/Format/TokenAnnotatorTest.cpp:181 + ASSERT_EQ(Tokens.size(), 5u) << Tokens; + EXPECT_TOKEN(Tokens[1], tok::amp, TT_BinaryOperator); + how does this differentiate from `MyType & val2;` is that

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-17 Thread David K Turner via Phabricator via cfe-commits
dkt01 marked an inline comment as done. dkt01 added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:1205 case tok::r_brace: + if (Scopes.size() > 1) +Scopes.pop_back(); HazardyKnusperkeks wrote: > How does this happen? The only

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-17 Thread David K Turner via Phabricator via cfe-commits
dkt01 updated this revision to Diff 489967. dkt01 added a comment. Further changes based on HazardyKnusperkeks' review CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141959/new/ https://reviews.llvm.org/D141959 Files: clang/lib/Format/TokenAnnotator.cpp

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-17 Thread David K Turner via Phabricator via cfe-commits
dkt01 updated this revision to Diff 489962. dkt01 added a reviewer: HazardyKnusperkeks. dkt01 added a comment. Changes based on HazardyKnusperkeks' review CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141959/new/ https://reviews.llvm.org/D141959 Files:

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-17 Thread David K Turner via Phabricator via cfe-commits
dkt01 marked 6 inline comments as done. dkt01 added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:2490-2491 +// Opeartors at class scope are likely pointer or reference members +if (TokScope == ScopeType::Class) + return TT_PointerOrReference; +

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-17 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment. Could this be added to `Context` instead of a new type? Comment at: clang/lib/Format/TokenAnnotator.cpp:1205 case tok::r_brace: + if (Scopes.size() > 1) +Scopes.pop_back(); How does this happen? The only

[PATCH] D141959: [clang-format] Fix inconsistent identification of operator

2023-01-17 Thread David K Turner via Phabricator via cfe-commits
dkt01 created this revision. dkt01 added reviewers: MyDeveloperDay, owenpan. dkt01 added a project: clang-format. Herald added a project: All. dkt01 requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Token annotator for clang-format