llvm-project/clang/test/Rewriter
Shoaib Meenai 5faf6d88e8 Reapply "[Parse] Use CapturedStmt for @finally on MSVC"
This reapplies r334224 and adds explicit triples to some tests to fix
them on Windows (where otherwise they would have run with the default
windows-msvc triple, which I'm changing the behavior for).

Original commit message:
The body of a `@finally` needs to be executed on both exceptional and
non-exceptional paths. On landingpad platforms, this is straightforward:
the `@finally` body is emitted as a normal (non-exceptional) cleanup,
and then a catch-all is emitted which branches to that cleanup (the
cleanup has code to conditionally re-throw based on a flag which is set
by the catch-all).

Unfortunately, we can't use the same approach for MSVC exceptions, where
the catch-all will be emitted as a catchpad. We can't just branch to the
cleanup from within the catchpad, since we can only exit it via a
catchret, at which point the exception is destroyed and we can't
rethrow. We could potentially emit the finally body inside the catchpad
and have the normal cleanup path somehow branch into it, but that would
require some new IR construct that could branch into a catchpad.

Instead, after discussing it with Reid Kleckner, we decided that
frontend outlining was the best approach, similar to how SEH `__finally`
works today. We decided to use CapturedStmt (which was also suggested by
Reid) rather than CaptureFinder (which is what `__finally` uses) since
the latter doesn't handle a lot of cases we care about, e.g. self
accesses, property accesses, block captures, etc. Extending
CaptureFinder to handle those additional cases proved unwieldy, whereas
CapturedStmt already took care of all of those.  In theory `__finally`
could also be moved over to CapturedStmt, which would remove some
existing limitations (e.g. the inability to capture this), although
CaptureFinder would still be needed for SEH filters.

The one case supported by `@finally` but not CapturedStmt (or
CaptureFinder for that matter) is arbitrary control flow out of the
`@finally`, e.g. having a return statement inside a `@finally`. We can
add that support as a follow-up, but in practice we've found it to be
used very rarely anyway.

Differential Revision: https://reviews.llvm.org/D47564

llvm-svn: 334251
2018-06-08 00:30:00 +00:00
..
blockcast3.mm
blockstruct.m
crash.m
finally.m Consolidate header inclusion diagnostics 2014-07-11 20:53:51 +00:00
func-in-impl.m
id-test-3.m
inner-block-helper-funcs.mm
instancetype-test.mm
ivar-encoding-1.m
ivar-encoding-2.m
line-generation-test.m Stop messing with the 'g' group of options in CompilerInvocation. 2015-10-08 04:24:12 +00:00
lit.local.cfg [test] Port clang tests to canonicalized booleans 2017-01-25 13:11:45 +00:00
metadata-test-1.m
metadata-test-2.m
method-encoding-1.m
missing-dllimport.c __declspec is not a core Clang language extension. Instead, require -fms-extensions or -fborland to enable the language extension. 2015-05-26 19:44:52 +00:00
modern-write-bf-abi.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
no-integrated-preprocessing-64bit.m
no-integrated-preprocessing.m
objc-bool-literal-check-modern.mm
objc-bool-literal-modern-1.mm
objc-bool-literal-modern.mm
objc-encoding-bug-1.m
objc-ivar-receiver-1.m
objc-modern-StretAPI-2.mm
objc-modern-StretAPI-3.mm
objc-modern-StretAPI.mm
objc-modern-boxing.mm [Objective-C modern translation]. Patch to fix type of 2015-04-09 18:36:50 +00:00
objc-modern-class-init-hooks.mm
objc-modern-class-init.mm
objc-modern-container-subscript.mm
objc-modern-fast-enumeration.mm
objc-modern-getclass-proto.mm
objc-modern-implicit-cast.mm
objc-modern-ivar-receiver-1.mm
objc-modern-linkage-spec.mm
objc-modern-metadata-visibility.mm
objc-modern-numeric-literal.mm [Objective-C modern translation]. Patch to fix type of 2015-04-09 18:36:50 +00:00
objc-modern-property-attributes.mm
objc-modern-property-bitfield.m Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
objc-string-concat-1.m
objc-super-test.m
objc-synchronized-1.m
properties.m Give some obj-c rewriter tests that use MS pragmas a triple as a speculative fix 2015-03-05 00:04:18 +00:00
property-dot-syntax.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
protocol-rewrite-1.m
protocol-rewrite-2.m
rewrite-anonymous-union.m
rewrite-api-bug.m
rewrite-block-argument.m
rewrite-block-consts.mm
rewrite-block-ivar-call.mm
rewrite-block-literal-1.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-block-literal.mm Objective-C modern rewriter. Patch to fix a rewriting bug 2014-10-28 23:46:58 +00:00
rewrite-block-pointer.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-block-property.m
rewrite-byref-in-nested-blocks.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-byref-vars.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-captured-nested-bvar.c Add a bunch of missing "CHECK" colons in tests. NFC. 2015-03-14 01:10:19 +00:00
rewrite-cast-ivar-access.mm
rewrite-cast-ivar-modern-access.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-cast-to-bool.mm
rewrite-category-property.mm
rewrite-constructor-init.mm
rewrite-eh.m
rewrite-elaborated-type.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-extern-c.mm
rewrite-foreach-1.m
rewrite-foreach-2.m
rewrite-foreach-3.m
rewrite-foreach-4.m
rewrite-foreach-5.m
rewrite-foreach-6.m
rewrite-foreach-7.m
rewrite-foreach-in-block.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-foreach-protocol-id.m Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-forward-class.m Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-forward-class.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-function-decl.mm
rewrite-implementation.mm
rewrite-interface-locals.mm
rewrite-ivar-use.m Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-line-directive.m
rewrite-local-externs-in-block.mm
rewrite-local-static-id.mm
rewrite-message-expr.mm
rewrite-modern-array-literal.mm [Objective-C modern translation]. Patch to fix type of 2015-04-09 18:36:50 +00:00
rewrite-modern-atautoreleasepool.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-modern-block-consts.mm
rewrite-modern-block-ivar-call.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-modern-block.mm Objective-C modern rewriter. Patch to fix a rewriting bug 2014-10-28 23:46:58 +00:00
rewrite-modern-captured-nested-bvar.mm Add a bunch of missing "CHECK" colons in tests. NFC. 2015-03-14 01:10:19 +00:00
rewrite-modern-catch.m
rewrite-modern-class.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-modern-container-literal.mm [Objective-C modern translation]. Patch to fix type of 2015-04-09 18:36:50 +00:00
rewrite-modern-default-property-synthesis.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-modern-extern-c-func-decl.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-modern-ivar-access.mm
rewrite-modern-ivar-use.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-modern-ivars-1.mm
rewrite-modern-ivars-2.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-modern-ivars.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-modern-nested-ivar.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-modern-private-ivars.mm
rewrite-modern-protocol-1.mm
rewrite-modern-protocol.mm
rewrite-modern-qualified-type.mm
rewrite-modern-struct-ivar-1.mm
rewrite-modern-struct-ivar.mm
rewrite-modern-super.mm
rewrite-modern-synchronized.m
rewrite-modern-throw.m Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-modern-try-catch-finally.m
rewrite-modern-try-finally.m Reapply "[Parse] Use CapturedStmt for @finally on MSVC" 2018-06-08 00:30:00 +00:00
rewrite-modern-typeof.mm
rewrite-nest.m
rewrite-nested-blocks-1.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-nested-blocks-2.mm
rewrite-nested-blocks.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-nested-ivar.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-nested-property-in-blocks.mm Give some obj-c rewriter tests that use MS pragmas a triple as a speculative fix 2015-03-05 00:04:18 +00:00
rewrite-no-nextline.mm
rewrite-property-attributes.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-property-set-cfstring.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-protocol-property.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-protocol-qualified.mm
rewrite-protocol-type-1.m
rewrite-qualified-id.mm
rewrite-rewritten-initializer.mm
rewrite-static-block.mm
rewrite-super-message.mm
rewrite-trivial-constructor.mm
rewrite-try-catch.m
rewrite-typeof.mm
rewrite-unique-block-api.mm
rewrite-user-defined-accessors.mm Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-vararg.m Specify -std=gnu++98 on some Rewriter tests. NFC. 2016-12-09 01:20:40 +00:00
rewrite-weak-attr.m
static-type-protocol-1.m
undecl-objc-h.m
undeclared-method-1.m
undef-field-reference-1.m
unnamed-bf-modern-write.mm
va-method.m
weak_byref_objects.m