Add Roslyn analyzer and code fix for unique ownership
Some checks failed
Publish NuGet Packages / publish (pull_request) Has been cancelled
Some checks failed
Publish NuGet Packages / publish (pull_request) Has been cancelled
Introduce a Roslyn analyzer to enforce unique ownership semantics for structs marked with the `[NonCopyable]` attribute. Added a corresponding code fix to resolve violations by suggesting the use of `Share()` or other ownership transfer methods. Key changes: - Added `StructCopyCodeAnalyzer` to detect invalid struct copies. - Implemented `StructCopyCodeFixProvider` to provide code fixes. - Created `Misaki.HighPerformance.Analyzer` and `CodeFixes` projects. - Added unit tests for the analyzer and code fixes. - Introduced `UniquePtr<T>` and `SharedPtr<T>` for pointer ownership. - Added a Visual Studio extension project and packaging support. - Updated `UnsafeUtility` to use `nint`/`nuint` for indices.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<RootNamespace>Misaki.HighPerformance.Analyzer.Vsix</RootNamespace>
|
||||
<AssemblyName>Misaki.HighPerformance.Analyzer.Vsix</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<GeneratePkgDefFile>false</GeneratePkgDefFile>
|
||||
<IncludeAssemblyInVSIXContainer>false</IncludeAssemblyInVSIXContainer>
|
||||
<IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
|
||||
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
|
||||
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
|
||||
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
|
||||
<VSSDKTargetPlatformRegRootSuffix>Roslyn</VSSDKTargetPlatformRegRootSuffix>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.8.3038" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<StartAction>Program</StartAction>
|
||||
<StartProgram>$(DevEnvDir)devenv.exe</StartProgram>
|
||||
<StartArguments>/rootsuffix $(VSSDKTargetPlatformRegRootSuffix)</StartArguments>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
|
||||
|
||||
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="Exists('$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets')" />
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Misaki.HighPerformance.Analyzer.CodeFixes\Misaki.HighPerformance.Analyzer.CodeFixes.csproj" />
|
||||
<ProjectReference Include="..\Misaki.HighPerformance.Analyzer\Misaki.HighPerformance.Analyzer.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- https://github.com/dotnet/sdk/issues/433 -->
|
||||
<ProjectReference Update="@(ProjectReference)" AdditionalProperties="TargetFramework=netstandard2.0" />
|
||||
|
||||
<!-- https://github.com/Microsoft/extendvs/issues/57 -->
|
||||
<ProjectReference Update="@(ProjectReference)" Name="%(Filename)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
|
||||
<Metadata>
|
||||
<Identity Id="Misaki.HighPerformance.Analyzer.11c300de-143d-4a1e-96bd-d946c0b5f452" Version="1.0" Language="en-US" Publisher="Misaki"/>
|
||||
<DisplayName>Misaki.HighPerformance.Analyzer</DisplayName>
|
||||
<Description xml:space="preserve">This is a sample diagnostic extension for the .NET Compiler Platform ("Roslyn").</Description>
|
||||
</Metadata>
|
||||
<Installation>
|
||||
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0,)" />
|
||||
</Installation>
|
||||
<Dependencies>
|
||||
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
|
||||
</Dependencies>
|
||||
<Assets>
|
||||
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="Misaki.HighPerformance.Analyzer" Path="|Misaki.HighPerformance.Analyzer|"/>
|
||||
<Asset Type="Microsoft.VisualStudio.Analyzer" d:Source="Project" d:ProjectName="Misaki.HighPerformance.Analyzer" Path="|Misaki.HighPerformance.Analyzer|"/>
|
||||
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="Misaki.HighPerformance.Analyzer.CodeFixes" Path="|Misaki.HighPerformance.Analyzer.CodeFixes|"/>
|
||||
<Asset Type="Microsoft.VisualStudio.Analyzer" d:Source="Project" d:ProjectName="Misaki.HighPerformance.Analyzer.CodeFixes" Path="|Misaki.HighPerformance.Analyzer.CodeFixes|"/>
|
||||
</Assets>
|
||||
<Prerequisites>
|
||||
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,)" DisplayName="Visual Studio core editor" />
|
||||
<Prerequisite Id="Microsoft.VisualStudio.Component.Roslyn.LanguageServices" Version="[15.0,)" DisplayName="Roslyn Language Services" />
|
||||
</Prerequisites>
|
||||
</PackageManifest>
|
||||
Reference in New Issue
Block a user