Page MenuHomePhabricator

[clang-format] Distinguish logical and after bracket from reference
ClosedPublic

Authored by jackhong12 on Aug 11 2022, 11:39 PM.

Details

Summary

In https://reviews.llvm.org/D127873, I missed the case bool b = 3 == int{3} && true;.

The function modifyContext will annotate && as a reference operator if there is a = behind &&. So, we can remove these redundant rules.

Diff Detail

Event Timeline

jackhong12 created this revision.Aug 11 2022, 11:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2022, 11:39 PM
jackhong12 requested review of this revision.Aug 11 2022, 11:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2022, 11:39 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
owenpan added inline comments.Aug 12 2022, 3:24 PM
clang/lib/Format/TokenAnnotator.cpp
2367–2368

Removing it would suffice.

clang/unittests/Format/FormatTest.cpp
10477

Can you add a similar test in TokenAnnotatorTest.cpp?

owenpan added inline comments.Aug 12 2022, 3:32 PM
clang/unittests/Format/FormatTest.cpp
10477

Nvm.

owenpan added a project: Restricted Project.Aug 12 2022, 3:37 PM
jackhong12 edited the summary of this revision. (Show Details)
This comment was removed by jackhong12.

Remove redundant code.

jackhong12 marked 3 inline comments as done.Aug 12 2022, 6:50 PM
owenpan accepted this revision.Aug 12 2022, 7:01 PM

LGTM

This revision is now accepted and ready to land.Aug 12 2022, 7:01 PM

You have to ask @tstellar to cherry-pick it.