HomePhabricator

Refactor checking of switch conditions and case values.

Authored by Richard Smith <richard-llvm@metafoo.co.uk> on Jul 26 2018, 11:41 AM.

Description

Refactor checking of switch conditions and case values.

Check each case value in turn while parsing it, performing the
conversion to the switch type within the context of the expression
itself. This will become necessary in order to properly handle cleanups
for temporaries created as part of the case label (in an upcoming
patch). For now it's just good hygiene.

This necessitates moving the checking for the switch condition itself to
earlier, so that the destination type is available when checking the
case labels.

As a nice side-effect, we get slightly improved diagnostic quality and
error recovery by separating the case expression checking from the case
statement checking and from tracking whether there are discarded case
labels.

llvm-svn: 338056

Details

Committed
Richard Smith <richard-llvm@metafoo.co.uk>Jul 26 2018, 11:41 AM
Parents
rGc5982fb63431: [OPENMP, DOCS] Fixed typo, NFC.
Branches
Unknown
Tags
Unknown

Event Timeline

Richard Smith <richard-llvm@metafoo.co.uk> committed rGef6c43dc0cb2: Refactor checking of switch conditions and case values. (authored by Richard Smith <richard-llvm@metafoo.co.uk>).Jul 26 2018, 11:41 AM