Add support for function pointers in ilverify (#57163)
authorAdeel Mujahid <3840695+am11@users.noreply.github.com>
Fri, 13 Aug 2021 10:24:30 +0000 (13:24 +0300)
committerGitHub <noreply@github.com>
Fri, 13 Aug 2021 10:24:30 +0000 (03:24 -0700)
commita997f3cc4e40bf0f73825c1ad726fbc17fe1c398
treeffa6119bf7069e27081b93d45de09981f6b77040
parentfad530f97a8e4d044ca092b96c025ac69bf93ec3
Add support for function pointers in ilverify (#57163)

* Provide logic verifying access to function pointer.

Extend AccessVerificationHelpers.CanAccess method so that it is
able to handle FunctionPointerType by making sure that a current class
can access all the types returned or accepted by the method pointed
by the given function pointer.

Fix #43502

* Add support for function pointers in ilverify importer

* Add ilverify tests for function pointers

* Trim trailing whitespace

* Use public surface of FunctionPointerType

* Check both return type and arguments of signature

* Delete CanAccessMethodSignature and simplify

* Add a test case for inaccessible return type
src/coreclr/tools/ILVerification/AccessVerificationHelpers.cs
src/coreclr/tools/ILVerification/ILImporter.StackValue.cs
src/coreclr/tools/ILVerification/ILImporter.Verify.cs
src/tests/ilverify/ILMethodTester.cs
src/tests/ilverify/ILTests/FunctionPointerTests.il [new file with mode: 0644]
src/tests/ilverify/ILTests/FunctionPointerTests.ilproj [new file with mode: 0644]