-
Notifications
You must be signed in to change notification settings - Fork 128
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
Add analyzer for RequiresAssemblyFilesAttribute #1722
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Stop using Linq in HasName
test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs
Outdated
Show resolved
Hide resolved
internal static bool TryGetRequiresAssemblyFileAttribute (this ISymbol symbol, out AttributeData? attribute) | ||
{ | ||
attribute = null; | ||
if (symbol.GetAttributes ().FirstOrDefault (attr => attr.AttributeClass is { } attrClass && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lambda here creates an allocation, and FirstOrDefault
requires an additional delegate allocation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed all Linq usages in this file as well - PTAL.
This adds an analyzer for the proposed attribute,
RequiresAssemblyFilesAttribute
. Once (if) the attribute is landed in the runtime, the appropriate APIs should be annotated in the runtime libraries and suitable tests should be added in here.