Files
clang-p2996/clang/unittests/Analysis/FlowSensitive/CFGMatchSwitchTest.cpp
Wei Yi Tee d931ac9e27 [clang][dataflow] Generalise match switch utility to other AST types and add a CFGMatchSwitch which currently handles CFGStmt and CFGInitializer.
`MatchSwitch` currently takes in matchers and functions for the `Stmt` class.

This patch generalises the match switch utility (renamed to `ASTMatchSwitch`) to work for different AST node types by introducing a template argument which is the base type for the AST nodes that the match switch will handle.

A `CFGMatchSwitch` is introduced as a wrapper around multiple `ASTMatchSwitch`s for different base types. It works by unwrapping `CFGElement`s into their contained AST nodes and passing the nodes to the relevant `ASTMatchSwitch`. The `CFGMatchSwitch` currently only handles `CFGStmt` and `CFGInitializer`.

Reviewed By: gribozavr2, sgatev

Differential Revision: https://reviews.llvm.org/D131616
2022-09-01 10:15:53 +00:00

4.1 KiB