rupprecht added a comment.

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)



================
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);
       });
----------------
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.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140058

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to