Add support for emitting finally regions in ILEmitter (dotnet/coreclr#27109)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Fri, 11 Oct 2019 15:16:53 +0000 (17:16 +0200)
committerJan Kotas <jkotas@microsoft.com>
Fri, 11 Oct 2019 15:16:53 +0000 (08:16 -0700)
commitee54a50e6065f143e6ba08accdd4ffe9f516a3d9
treeda57fe1102a1d070a75f298b2fd0ee6663516154
parentadbc1b5e059b5d0d1e64029634ea084952ad7973
Add support for emitting finally regions in ILEmitter (dotnet/coreclr#27109)

This will be needed to properly do cleanups in marshalling stubs.

The usage goes like (I couldn't come up with anything better):

```
var b = codeStream.BeginTry();
//...
codeStream.EndTry(b);
codeStream.BeginHandler(b);
// ...
codeStream.EndHandler(b);

emit.NewFinallyRegion(b);
```

Commit migrated from https://github.com/dotnet/coreclr/commit/a7ffbba5a2843e7da03fdffe40ac85b9adfe126e
src/coreclr/src/tools/crossgen2/Common/TypeSystem/IL/MethodILDebugView.cs
src/coreclr/src/tools/crossgen2/Common/TypeSystem/IL/Stubs/ILEmitter.cs