[PATCH] D129755: Thread safety analysis: Support copy-elided production of scoped capabilities through arbitrary calls

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 7 04:46:41 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/Analysis/ThreadSafety.cpp:1789
+      auto inserted = ConstructedObjects.insert({Exp, Placeholder.first});
+      assert(inserted.second && "Are we visiting the same expression again?");
+      if (isa<CXXConstructExpr>(Exp))
----------------
aaronpuchert wrote:
> chapuni wrote:
> > 'inserted' is used only here.
> Correct, is that an issue? Perhaps `-Wunused-variable` in Release builds?
> 
> Otherwise I believe it's correct—we don't need the iterator and we should generally not insert expressions twice, hence the assertion.
Yeah, that's the trouble -- this breaks release builds using -Werror. You should add `[[maybe_unused]]` to the declaration (as an NFC commit).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129755



More information about the cfe-commits mailing list