[PATCH] D129752: Thread safety analysis: Handle additional cast in scoped capability construction

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 27 11:28:49 PDT 2022


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM! Do you think this warrants a release note (or did it close any open issues in the tracker)?



================
Comment at: clang/lib/Analysis/ThreadSafety.cpp:2091-2097
+  if (auto *CE = dyn_cast<CastExpr>(E))
+    if (CE->getCastKind() == CK_NoOp)
+      E = CE->getSubExpr()->IgnoreParens();
+  if (auto *CE = dyn_cast<CastExpr>(E))
+    if (CE->getCastKind() == CK_ConstructorConversion ||
+        CE->getCastKind() == CK_UserDefinedConversion)
+      E = CE->getSubExpr();
----------------
I almost wonder if we should just turn this into a while loop rather than two casts in a specific order. However, I can't think of a situation where we'd need the loop, so I think this is fine. At the very least, it's incremental progress!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129752



More information about the cfe-commits mailing list