[PATCH] D117218: [clang][dataflow] Add transfer functions for constructors

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 13 09:06:26 PST 2022


xazax.hun accepted this revision.
xazax.hun added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/Analysis/FlowSensitive/Transfer.cpp:114
+    } else if (S->getCastKind() == CK_NoOp) {
+      auto *SubExprLoc = Env.getStorageLocation(*SubExpr, SkipPast::None);
+      if (SubExprLoc == nullptr)
----------------
An alternative way to handle Noop operations would be to make location lookup function always skip certain nodes, so we do not need to store locations for those subexpressions. I don't have a strong feeling for either solution, this is fine as it is, just wanted to be sure that both were considered. 


================
Comment at: clang/lib/Analysis/FlowSensitive/Transfer.cpp:277
+  void VisitCallExpr(const CallExpr *S) {
+    if (S->isCallToStdMove()) {
+      assert(S->getNumArgs() == 1);
----------------
Interesting, I only see `isCallToStdMove` in the CallExpr API, although I imagine, `std::forward` has a similar level of importance. 


================
Comment at: clang/unittests/Analysis/FlowSensitive/TransferTest.cpp:39
 protected:
+  enum class CppVersion {
+    k14 = 14,
----------------
Shouldn't we piggyback on `clang::LangStandard::Kind`? If it is not easy to convert that to the appropriate command line flag feel free to ignore this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117218



More information about the cfe-commits mailing list