Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GroupedNativeMethodsGenerator: generate attributes on extension methods where applicable #79

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Xpl0itR
Copy link

@Xpl0itR Xpl0itR commented Apr 21, 2024

Adds the following attributes where applicable:

  • MethodImplAttribute with AggressiveInlining hint to generated extension methods
  • GeneratedCodeAttribute to generated extensions class
  • ObsoleteAttribute to generated extension methods where the native method binding is also marked Obsolete

@Xpl0itR Xpl0itR changed the title Add AggressiveInlining hint and GeneratedCodeAttribute to generated extension methods GroupedNativeMethodsGenerator: generate attributes on extension methods where applicable Apr 21, 2024
@neuecc
Copy link
Member

neuecc commented Apr 30, 2024

Thank you.
GeneratedCodeAttribute is for CodeDom and is an old one, isn't it?
For things like AggressiveInlining that are generated, the JIT should perform it automatically, so I think it's not necessary to explicitly specify it.

@Xpl0itR
Copy link
Author

Xpl0itR commented May 1, 2024

GeneratedCodeAttribute is useful for tools that operate on the assembly rather than the source file because they won't see the // <auto-generated/> header. It is still used by Microsoft in their source generators, like System.Text.Json for example.

Similarly, Microsoft explicitly use AggressiveInlining in the standard libraries like the Unsafe.AsPointer for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants