[clang][dataflow] Add `MatchSwitch` utility library.
authorYitzhak Mandelbaum <yitzhakm@google.com>
Thu, 3 Mar 2022 11:58:57 +0000 (11:58 +0000)
committerYitzhak Mandelbaum <yitzhakm@google.com>
Fri, 4 Mar 2022 17:19:51 +0000 (17:19 +0000)
commitc88deef0a7218dd5c30500e7d3f58fc23283d3e5
treec616d20a54205e1c1c546989e620903f093d998e
parent4e817b3fa36b0c8664a49af5c598f96efe8cfc18
[clang][dataflow] Add `MatchSwitch` utility library.

Adds `MatchSwitch`, a library for simplifying implementation of transfer
functions. `MatchSwitch` supports constructing a "switch" statement, where each
case of the switch is defined by an AST matcher. The cases are considered in
order, like pattern matching in functional languages.

Differential Revision: https://reviews.llvm.org/D120900
clang/include/clang/Analysis/FlowSensitive/MatchSwitch.h [new file with mode: 0644]
clang/unittests/Analysis/FlowSensitive/CMakeLists.txt
clang/unittests/Analysis/FlowSensitive/MatchSwitchTest.cpp [new file with mode: 0644]