This is an archive of the discontinued LLVM Phabricator instance.

[clang][dataflow] Allow MatchSwitch to return a value
ClosedPublic

Authored by samestep on Jun 23 2022, 2:34 PM.

Details

Summary

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.

Diff Detail

Event Timeline

samestep created this revision.Jun 23 2022, 2:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2022, 2:34 PM
samestep requested review of this revision.Jun 23 2022, 2:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2022, 2:34 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
samestep edited the summary of this revision. (Show Details)Jun 23 2022, 2:36 PM
samestep added reviewers: gribozavr2, sgatev, ymandel.
sgatev accepted this revision.Jun 23 2022, 2:43 PM
This revision is now accepted and ready to land.Jun 23 2022, 2:43 PM
xazax.hun accepted this revision.Jun 23 2022, 2:48 PM
gribozavr2 accepted this revision.Jun 23 2022, 4:29 PM
gribozavr2 added inline comments.
clang/include/clang/Analysis/FlowSensitive/MatchSwitch.h
49–50

WDYT? like a "function result"

samestep added inline comments.Jun 24 2022, 6:13 AM
clang/include/clang/Analysis/FlowSensitive/MatchSwitch.h
49–50

Sure, Result is fine; changing it now.

samestep updated this revision to Diff 439723.Jun 24 2022, 6:16 AM
  • Use Result instead of Output
  • Merge branch 'main' into match-switch-return-non-void
samestep edited the summary of this revision. (Show Details)Jun 24 2022, 6:16 AM
gribozavr2 accepted this revision.Jun 24 2022, 6:17 AM
sgatev accepted this revision.Jun 24 2022, 6:27 AM
This revision was landed with ongoing or failed builds.Jun 24 2022, 6:33 AM
This revision was automatically updated to reflect the committed changes.