-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a library mode for type hierarchy marking (dotnet/linker#2114)
* Fix special handling of EventSource FB * special case EventSource handling to library mode * test fixes * Update src/linker/Linker/LinkContext.cs Co-authored-by: Vitek Karas <[email protected]> * FB * FB Co-authored-by: Vitek Karas <[email protected]> Commit migrated from dotnet/linker@e1c0c83
- Loading branch information
Showing
9 changed files
with
268 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/tools/illink/test/Mono.Linker.Tests.Cases/BCLFeatures/ETW/CustomLibraryEventSource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using System; | ||
using System.Diagnostics.Tracing; | ||
using Mono.Linker.Tests.Cases.Expectations.Assertions; | ||
using Mono.Linker.Tests.Cases.Expectations.Metadata; | ||
|
||
namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW | ||
{ | ||
[SetupLinkerArgument ("-a", "test.exe", "library")] | ||
[KeptMember (".ctor()")] | ||
public class CustomLibraryEventSource | ||
{ | ||
public static void Main () | ||
{ | ||
// Reference to a derived EventSource but does not trigger Object.GetType() | ||
var b = CustomEventSourceInLibraryMode.Log.IsEnabled (); | ||
} | ||
} | ||
|
||
[Kept] | ||
[KeptBaseType (typeof (EventSource))] | ||
[KeptAttributeAttribute (typeof (EventSourceAttribute))] | ||
[KeptMember (".ctor()")] | ||
[KeptMember (".cctor()")] | ||
|
||
[EventSource (Name = "MyLibraryCompany")] | ||
class CustomEventSourceInLibraryMode : EventSource | ||
{ | ||
// In library mode, we special case nested types | ||
[Kept] | ||
public class Keywords | ||
{ | ||
[Kept] | ||
public const EventKeywords Page = (EventKeywords) 1; | ||
|
||
public int Unused; | ||
} | ||
|
||
[Kept] | ||
public class Tasks | ||
{ | ||
[Kept] | ||
public const EventTask Page = (EventTask) 1; | ||
|
||
public int Unused; | ||
} | ||
|
||
class NotMatching | ||
{ | ||
} | ||
|
||
[Kept] | ||
public static CustomEventSourceInLibraryMode Log = new CustomEventSourceInLibraryMode (); | ||
|
||
int private_member; | ||
|
||
void PrivateMethod () { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.