-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Function pointer calling convention IDE support #59062
Changes from all commits
ab4d385
015ba4d
d059fdd
5d75a06
17729b6
401f294
aa40134
dc04f24
a4c777b
bbe7a76
c81035c
ac49884
c82742f
473e16a
313b53b
d8cce8c
191d071
a7ae4ee
fa85916
d0ded00
514665e
0814107
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -211,5 +211,11 @@ public static ImmutableArray<IAssemblySymbol> GetReferencedAssemblySymbols(this | |||
|
||||
public static INamedTypeSymbol? DisallowNullAttribute(this Compilation compilation) | ||||
=> compilation.GetTypeByMetadataName(typeof(DisallowNullAttribute).FullName!); | ||||
|
||||
public static INamedTypeSymbol? UnmanagedCallingConventionType(this Compilation compilation, string callConv) | ||||
{ | ||||
var corLibrary = compilation.GetSpecialType(SpecialType.System_Object).ContainingAssembly; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❔ Is this a requirement? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sharwell At compiler-side, yes. roslyn/src/Compilers/CSharp/Portable/Symbols/FunctionPointers/FunctionPointerMethodSymbol.cs Line 210 in eb95c2f
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember @jkoritzinsky mentioning how this API could be particularly slow, so much so they tried to avoid using it entirely in the COM generators. Is that still a concern (and if so, should we consider using an alternative here), or has that been fixed now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Sergio0694 To my knowledge GetSpecialType is fast, and internally it should be calculated once, and then the lookup is a simple fast array index (not even a Not sure how it caused issues in generators. I'd love to know more about that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a perf bug in Roslyn that made this call very slow a few months back. It's fixed now. |
||||
return corLibrary?.GetTypeByMetadataName("System.Runtime.CompilerServices.CallConv" + callConv); | ||||
} | ||||
} | ||||
} |
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.
don't we want to do this if GetCallingConventionSymbol returns non-null?
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.
e.g. if you write
delegate[Gibberish]
we wouldn't classify that guy :)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.
@CyrusNajmabadi This matches the compiler classification :)
roslyn/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor.Members.cs
Line 588 in eb95c2f
Quick info relies on compiler classification too: