[PATCH] D140058: [clang-format][NFC] Turn on some code-changing options one by one

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 15 20:57:58 PST 2022


owenpan added a comment.

In D140058#4000332 <https://reviews.llvm.org/D140058#4000332>, @rupprecht wrote:

> In D140058#4000311 <https://reviews.llvm.org/D140058#4000311>, @rupprecht wrote:
>
>> 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 <https://reviews.llvm.org/rG5a06334c51aa75d7f044785a495cf2de5bf13a9c>

Thanks!



================
Comment at: clang/lib/Format/Format.cpp:3408
       Passes.emplace_back([&](const Environment &Env) {
-        return BracesInserter(Env, Expanded).process(/*SkipAnnotation=*/true);
+        return BracesInserter(Env, S).process(/*SkipAnnotation=*/true);
       });
----------------
rupprecht wrote:
> 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.
My bad!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140058/new/

https://reviews.llvm.org/D140058



More information about the cfe-commits mailing list