Skip to content

Commit

Permalink
Factor out resources files for ILA001 and ILA002
Browse files Browse the repository at this point in the history
  • Loading branch information
Yey007 committed Mar 30, 2024
1 parent 7eef5d5 commit 61fd179
Show file tree
Hide file tree
Showing 16 changed files with 162 additions and 225 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Id: ILA004,
Title: Array of reference types in kernel,
Severity: Warning,
WarningLevel: 0,
WarningLevel: 1,
Location: : (29,25)-(29,42),
MessageFormat: Type '{0}' is an array of type '{1}', which is a reference type. Arrays of reference types cannot be used in kernels.,
Message: Type 'ILGPU.Analyzers.Tests.Programs.RefType.Arrays.RefType[]' is an array of type 'ILGPU.Analyzers.Tests.Programs.RefType.Arrays.RefType', which is a reference type. Arrays of reference types cannot be used in kernels.,
Expand All @@ -13,7 +13,7 @@
Id: ILA003,
Title: Reference type in kernel,
Severity: Warning,
WarningLevel: 0,
WarningLevel: 1,
Location: : (29,27)-(29,40),
MessageFormat: Type '{0}' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Message: Type 'ILGPU.Analyzers.Tests.Programs.RefType.Arrays.RefType' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Id: ILA003,
Title: Reference type in kernel,
Severity: Warning,
WarningLevel: 0,
WarningLevel: 1,
Location: : (17,20)-(17,33),
MessageFormat: Type '{0}' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Message: Type 'ILGPU.Analyzers.Tests.Programs.RefType.Constructors.RefType' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Id: ILA003,
Title: Reference type in kernel,
Severity: Warning,
WarningLevel: 0,
WarningLevel: 1,
Location: : (20,27)-(20,40),
MessageFormat: Type '{0}' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Message: Type 'ILGPU.Analyzers.Tests.Programs.RefType.Functions.RefType' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Expand All @@ -13,7 +13,7 @@
Id: ILA003,
Title: Reference type in kernel,
Severity: Warning,
WarningLevel: 0,
WarningLevel: 1,
Location: : (14,27)-(14,40),
MessageFormat: Type '{0}' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Message: Type 'ILGPU.Analyzers.Tests.Programs.RefType.Functions.RefType' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Expand All @@ -23,7 +23,7 @@
Id: ILA003,
Title: Reference type in kernel,
Severity: Warning,
WarningLevel: 0,
WarningLevel: 1,
Location: : (32,15)-(32,28),
MessageFormat: Type '{0}' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Message: Type 'ILGPU.Analyzers.Tests.Programs.RefType.Functions.RefType' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Id: ILA003,
Title: Reference type in kernel,
Severity: Warning,
WarningLevel: 0,
WarningLevel: 1,
Location: : (14,21)-(14,34),
MessageFormat: Type '{0}' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Message: Type 'ILGPU.Analyzers.Tests.Programs.RefType.Functions.RefType' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Expand All @@ -13,7 +13,7 @@
Id: ILA003,
Title: Reference type in kernel,
Severity: Warning,
WarningLevel: 0,
WarningLevel: 1,
Location: : (19,21)-(19,34),
MessageFormat: Type '{0}' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Message: Type 'ILGPU.Analyzers.Tests.Programs.RefType.Functions.RefType' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Expand All @@ -23,7 +23,7 @@
Id: ILA003,
Title: Reference type in kernel,
Severity: Warning,
WarningLevel: 0,
WarningLevel: 1,
Location: : (24,21)-(24,34),
MessageFormat: Type '{0}' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Message: Type 'ILGPU.Analyzers.Tests.Programs.RefType.Functions.RefType' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Expand All @@ -33,7 +33,7 @@
Id: ILA003,
Title: Reference type in kernel,
Severity: Warning,
WarningLevel: 0,
WarningLevel: 1,
Location: : (29,21)-(29,34),
MessageFormat: Type '{0}' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Message: Type 'ILGPU.Analyzers.Tests.Programs.RefType.Functions.RefType' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Expand All @@ -43,7 +43,7 @@
Id: ILA003,
Title: Reference type in kernel,
Severity: Warning,
WarningLevel: 0,
WarningLevel: 1,
Location: : (34,21)-(34,34),
MessageFormat: Type '{0}' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Message: Type 'ILGPU.Analyzers.Tests.Programs.RefType.Functions.RefType' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Expand All @@ -53,7 +53,7 @@
Id: ILA003,
Title: Reference type in kernel,
Severity: Warning,
WarningLevel: 0,
WarningLevel: 1,
Location: : (39,21)-(39,34),
MessageFormat: Type '{0}' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Message: Type 'ILGPU.Analyzers.Tests.Programs.RefType.Functions.RefType' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Id: ILA003,
Title: Reference type in kernel,
Severity: Warning,
WarningLevel: 0,
WarningLevel: 1,
Location: : (40,22)-(40,35),
MessageFormat: Type '{0}' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Message: Type 'ILGPU.Analyzers.Tests.Programs.RefType.ManagedUnmanaged.Managed' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Id: ILA003,
Title: Reference type in kernel,
Severity: Warning,
WarningLevel: 0,
WarningLevel: 1,
Location: : (13,22)-(13,35),
MessageFormat: Type '{0}' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Message: Type 'ILGPU.Analyzers.Tests.Programs.RefType.Simple.RefType' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Expand All @@ -13,7 +13,7 @@
Id: ILA003,
Title: Reference type in kernel,
Severity: Warning,
WarningLevel: 0,
WarningLevel: 1,
Location: : (14,38)-(14,45),
MessageFormat: Type '{0}' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Message: Type 'ILGPU.Analyzers.Tests.Programs.RefType.Simple.RefType' is a reference type. Reference types like classes cannot be used in kernels, except for arrays of value types.,
Expand Down
25 changes: 17 additions & 8 deletions Src/ILGPU.Analyzers/ILGPU.Analyzers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,36 @@
</ItemGroup>

<ItemGroup>
<Compile Update="Resources\ErrorMessages.Designer.cs">
<Compile Update="Resources\DiagnosticCategory.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>ErrorMessages.resx</DependentUpon>
<DependentUpon>DiagnosticCategory.resx</DependentUpon>
</Compile>
<Compile Update="Resources\DiagnosticCategory.Designer.cs">
<Compile Update="Resources\ILA001_StructMustBePartial.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>DiagnosticCategory.resx</DependentUpon>
<DependentUpon>ILA001_StructMustBePartial.resx</DependentUpon>
</Compile>
<Compile Update="Resources\ILA002_ContainingTypeMustBePartial.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>ILA002_ContainingTypeMustBePartial.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Resources\ErrorMessages.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>ErrorMessages.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Resources\DiagnosticCategory.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>DiagnosticCategory.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Resources\ILA001_StructMustBePartial.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>ILA001_StructMustBePartial.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Resources\ILA002_ContainingTypeMustBePartial.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>ILA002_ContainingTypeMustBePartial.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions Src/ILGPU.Analyzers/InterleaveFieldsGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ public class InterleaveFieldsGenerator : IIncrementalGenerator

private static readonly DiagnosticDescriptor TargetNotPartial = new(
id: "ILA001",
title: ErrorMessages.StructMustBePartial_Title,
messageFormat: ErrorMessages.StructMustBePartial_Message,
title: ILA001_StructMustBePartial.Title,
messageFormat: ILA001_StructMustBePartial.Message,
category: DiagnosticCategory.Usage,
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true);

private static readonly DiagnosticDescriptor ContainingTypeNotPartial = new(
id: "ILA002",
title: ErrorMessages.ContainingTypeMustBePartial_Title,
messageFormat: ErrorMessages.ContainingTypeMustBePartial_Message,
title: ILA002_ContainingTypeMustBePartial.Title,
messageFormat: ILA002_ContainingTypeMustBePartial.Message,
category: DiagnosticCategory.Usage,
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true);
Expand Down
8 changes: 4 additions & 4 deletions Src/ILGPU.Analyzers/ReferenceTypeAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ public class ReferenceTypeAnalyzer : KernelAnalyzer
{
private static readonly DiagnosticDescriptor GeneralDiagnosticRule = new(
id: "ILA003",
title: ErrorMessages.RefTypeInKernel_Title,
messageFormat: ErrorMessages.RefTypeInKernel_Message,
title: ILA003_ReferenceTypeInKernel.Title,
messageFormat: ILA003_ReferenceTypeInKernel.MessageFormat,
category: DiagnosticCategory.Usage,
defaultSeverity: DiagnosticSeverity.Warning,
isEnabledByDefault: true
);

private static readonly DiagnosticDescriptor ArrayDiagnosticRule = new(
id: "ILA004",
title: ErrorMessages.RefTypeArrInKernel_Title,
messageFormat: ErrorMessages.RefTypeArrInKernel_Message,
title: ILA004_ReferenceTypeArrayInKernel.Title,
messageFormat: ILA004_ReferenceTypeArrayInKernel.MessageFormat,
category: DiagnosticCategory.Usage,
defaultSeverity: DiagnosticSeverity.Warning,
isEnabledByDefault: true
Expand Down
144 changes: 0 additions & 144 deletions Src/ILGPU.Analyzers/Resources/ErrorMessages.resx

This file was deleted.

Loading

0 comments on commit 61fd179

Please sign in to comment.