[silgen] Fix up EnumElementPatternInitialization::emitEnumMatch to use ownership.

This commit does a few things:

1. It uses SwitchEnumBuilder so we are not re-inventing any wheels.
2. Instead of hacking around not putting in a destroy for .None on the fail
pass, just *do the right thing* and recognize that we have a binary case enum
and in such a case, just emit code for the other case rather than use a default
case (meaning no cleanup on .none).

rdar://31145255
This commit is contained in:
Michael Gottesman
2017-03-28 11:23:15 -07:00
parent 6de8e56cbe
commit 79b225ffa8
18 changed files with 483 additions and 267 deletions

View File

@@ -346,3 +346,10 @@ bool SILBasicBlock::isNoReturn() const {
return false;
}
bool SILBasicBlock::isTrampoline() const {
auto *Branch = dyn_cast<BranchInst>(getTerminator());
if (!Branch)
return false;
return begin() == Branch->getIterator();
}