[all-commits] [llvm/llvm-project] 4eecd1: [clang][dataflow] Allow MatchSwitch to return a value

Sam Estep via All-commits all-commits at lists.llvm.org
Fri Jun 24 06:33:55 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4eecd194b073492a309b87c8f60da6614bba9153
      https://github.com/llvm/llvm-project/commit/4eecd194b073492a309b87c8f60da6614bba9153
  Author: Sam Estep <sam at samestep.com>
  Date:   2022-06-24 (Fri, 24 Jun 2022)

  Changed paths:
    M clang/include/clang/Analysis/FlowSensitive/MatchSwitch.h
    M clang/unittests/Analysis/FlowSensitive/MatchSwitchTest.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list