-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NET-515: Reduce allocation during registration by SonarSyntaxNodeRepo…
…rtingContext
- Loading branch information
1 parent
28957e8
commit 830546f
Showing
19 changed files
with
492 additions
and
229 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
analyzers/src/SonarAnalyzer.Core/AnalysisContext/IAnalysisContext.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,24 @@ | ||
/* | ||
* SonarAnalyzer for .NET | ||
* Copyright (C) 2014-2024 SonarSource SA | ||
* mailto:info AT sonarsource DOT com | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the Sonar Source-Available License for more details. | ||
* | ||
* You should have received a copy of the Sonar Source-Available License | ||
* along with this program; if not, see https://sonarsource.com/license/ssal/ | ||
*/ | ||
|
||
namespace SonarAnalyzer.AnalysisContext; | ||
|
||
public interface IAnalysisContext | ||
{ | ||
public Compilation Compilation { get; } | ||
public AnalyzerOptions Options { get; } | ||
public SonarAnalysisContext AnalysisContext { get; } | ||
} |
46 changes: 46 additions & 0 deletions
46
analyzers/src/SonarAnalyzer.Core/AnalysisContext/IReport.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,46 @@ | ||
/* | ||
* SonarAnalyzer for .NET | ||
* Copyright (C) 2014-2024 SonarSource SA | ||
* mailto:info AT sonarsource DOT com | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the Sonar Source-Available License for more details. | ||
* | ||
* You should have received a copy of the Sonar Source-Available License | ||
* along with this program; if not, see https://sonarsource.com/license/ssal/ | ||
*/ | ||
|
||
namespace SonarAnalyzer.AnalysisContext; | ||
|
||
public interface IReport | ||
{ | ||
ReportingContext CreateReportingContext(Diagnostic diagnostic); | ||
} | ||
|
||
public interface ITreeReport : IReport | ||
{ | ||
void ReportIssue(DiagnosticDescriptor rule, | ||
Location primaryLocation, | ||
IEnumerable<SecondaryLocation> secondaryLocations = null, | ||
ImmutableDictionary<string, string> properties = null, | ||
params string[] messageArgs); | ||
|
||
[Obsolete("Use another overload of ReportIssue, without calling Diagnostic.Create")] | ||
void ReportIssue(Diagnostic diagnostic); | ||
} | ||
|
||
public interface ICompilationReport : IReport | ||
{ | ||
void ReportIssue(GeneratedCodeRecognizer generatedCodeRecognizer, | ||
DiagnosticDescriptor rule, | ||
Location primaryLocation, | ||
IEnumerable<SecondaryLocation> secondaryLocations = null, | ||
params string[] messageArgs); | ||
|
||
[Obsolete("Use another overload of ReportIssue, without calling Diagnostic.Create")] | ||
void ReportIssue(GeneratedCodeRecognizer generatedCodeRecognizer, Diagnostic diagnostic); | ||
} |
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
Oops, something went wrong.