[PATCH] D131616: [clang][dataflow] Generalise match switch utility to other AST types and add a `CFGMatchSwitch` which currently handles `CFGStmt` and `CFGInitializer`.

weiyi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 23 09:08:54 PDT 2022


wyt added inline comments.


================
Comment at: clang/include/clang/Analysis/FlowSensitive/CFGMatchSwitch.h:55
+                                        MSActionT<NodeT, State, Result> A) && {
+    std::move(std::move(StmtBuilder).template CaseOf<NodeT>(M, A));
+    return std::move(*this);
----------------
sgatev wrote:
> Is the outer move necessary? Also, aren't we supposed to assign the result back to `StmtBuilder`? Same comment for `InitBuilder` below.
> Is the outer move necessary? Also, aren't we supposed to assign the result back to StmtBuilder? Same comment for InitBuilder below.

Yeap the outer move was unnecessary.
The self-assignment wasn't necessary since the CaseOf modifies the object it is called on, in fact the self-assignment led to the destroyal of contents inside the builder.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131616



More information about the cfe-commits mailing list