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
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:
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
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:
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
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
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:
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
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 '}'.
owenpan added inline comments.
Comment at: clang/lib/Format/TokenAnnotator.cpp:2488-2490
+(NextToken && NextToken->Tok.isAnyIdentifier()) &&
+(NextToken->getNextNonComment() &&
+ (NextToken->getNextNonComment()->isOneOf(
dkt01 wrote:
>
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:
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
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) {
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
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
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
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
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
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
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
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:
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
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
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
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
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
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
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
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:
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;
+
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
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
32 matches
Mail list logo