[PATCH] D120900: [clang][dataflow] Add `MatchSwitch` utility library.

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 3 09:20:18 PST 2022


xazax.hun added inline comments.


================
Comment at: clang/include/clang/Analysis/FlowSensitive/MatchSwitch.h:51
+template <typename State>
+using MatchSwitch = std::function<void(const Stmt &, ASTContext &, State &)>;
+
----------------
When we instantiate this with `TransferState` we have `ASTContext` both as an argument and as a member of `State`. Is this intentional?


================
Comment at: clang/include/clang/Analysis/FlowSensitive/MatchSwitch.h:110
+        size_t Index = 0;
+        if (ID.consume_front("Tag") && !ID.getAsInteger(10, Index) &&
+            Index < Actions.size()) {
----------------
This does not need to be addressed here but it looks like it could be a useful feature to be able to tag nodes with integer identifiers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120900



More information about the cfe-commits mailing list