This is an archive of the discontinued LLVM Phabricator instance.

[clang-format][NFC] Turn on some code-changing options one by one
ClosedPublic

Authored by owenpan on Dec 14 2022, 2:36 PM.

Details

Summary

For the code-changing options InsertBraces, RemoveBracesLLVM, and RemoveSemicolon, turn the option on only when running the token analyzer pass for it. This improves the run-time and avoids interference from other options.

Diff Detail

Event Timeline

owenpan created this revision.Dec 14 2022, 2:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 14 2022, 2:36 PM
owenpan requested review of this revision.Dec 14 2022, 2:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 14 2022, 2:36 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
MyDeveloperDay accepted this revision.Dec 15 2022, 4:37 AM
This revision is now accepted and ready to land.Dec 15 2022, 4:37 AM
This revision was landed with ongoing or failed builds.Dec 15 2022, 7:48 PM
This revision was automatically updated to reflect the committed changes.

This is causing a test failure: https://buildkite.com/llvm-project/upstream-bazel/builds/48607#0185190c-43f8-43ff-b8bd-fa8ce0b6e2f5
(and likewise running ninja check-clang-unit locally, but I don't have a buildbot link to that)

clang/lib/Format/Format.cpp
3408

This looks like use-after-free. S is captured by reference but the body of the lambda executes after this scope block has ended.

BracesInserter itself takes it by ref but then stores a copy, but by the time the constructor runs, the reference is already dangling.

This is causing a test failure: https://buildkite.com/llvm-project/upstream-bazel/builds/48607#0185190c-43f8-43ff-b8bd-fa8ce0b6e2f5
(and likewise running ninja check-clang-unit locally, but I don't have a buildbot link to that)

Fixed in 5a06334c51aa75d7f044785a495cf2de5bf13a9c

This is causing a test failure: https://buildkite.com/llvm-project/upstream-bazel/builds/48607#0185190c-43f8-43ff-b8bd-fa8ce0b6e2f5
(and likewise running ninja check-clang-unit locally, but I don't have a buildbot link to that)

Fixed in 5a06334c51aa75d7f044785a495cf2de5bf13a9c

Thanks!

clang/lib/Format/Format.cpp
3408

My bad!