[clang][dataflow] Allow MatchSwitch to return a value
authorSam Estep <sam@samestep.com>
Fri, 24 Jun 2022 13:32:47 +0000 (13:32 +0000)
committerSam Estep <sam@samestep.com>
Fri, 24 Jun 2022 13:32:47 +0000 (13:32 +0000)
commit4eecd194b073492a309b87c8f60da6614bba9153
tree9cf85895329166fa359a580cadef3f5955060a9c
parent9081d3d8097af5e89905faf0ed568ba7e848e8df
[clang][dataflow] Allow MatchSwitch to return a value

This patch adds another `typename` parameter to `MatchSwitch` class: `Result` (defaults to `void`), corresponding to the return type of the function. This necessitates a couple minor changes to the `MatchSwitchBuilder` class, and is tested via a new `ReturnNonVoid` test in `clang/unittests/Analysis/FlowSensitive/MatchSwitchTest.cpp`.

Reviewed By: gribozavr2, sgatev, xazax.hun

Differential Revision: https://reviews.llvm.org/D128467
clang/include/clang/Analysis/FlowSensitive/MatchSwitch.h
clang/unittests/Analysis/FlowSensitive/MatchSwitchTest.cpp