Skip to content

Commit af06202

Browse files
committed
C#: Cleanup implementation.
1 parent bf27f20 commit af06202

File tree

8 files changed

+2
-76
lines changed

8 files changed

+2
-76
lines changed

csharp/.editorconfig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,5 @@ csharp_style_var_elsewhere = true:suggestion
268268
#
269269

270270
[extractor/Semmle.Extraction/Tuples.cs,
271-
extractor/Semmle.Extraction.CSharp/Tuples.cs,
272-
extractor/Semmle.Extraction.CIL/Tuples.cs]
273-
dotnet_naming_rule.members_should_be_pascal_case.severity = none
271+
extractor/Semmle.Extraction.CSharp/Tuples.cs]
272+
dotnet_naming_rule.members_should_be_pascal_case.severity = none

csharp/CSharp.sln

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction", "extrac
88
EndProject
99
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction.CSharp", "extractor\Semmle.Extraction.CSharp\Semmle.Extraction.CSharp.csproj", "{C4D62DA0-B64B-440B-86DC-AB52318CB8BF}"
1010
EndProject
11-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction.CIL", "extractor\Semmle.Extraction.CIL\Semmle.Extraction.CIL.csproj", "{399A1579-68F0-40F4-9A23-F241BA697F9C}"
12-
EndProject
1311
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction.CSharp.DependencyFetching", "extractor\Semmle.Extraction.CSharp.DependencyFetching\Semmle.Extraction.CSharp.DependencyFetching.csproj", "{541D1AC5-E42C-4AB2-A1A4-C2355CE2A2EF}"
1412
EndProject
1513
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction.CSharp.Standalone", "extractor\Semmle.Extraction.CSharp.Standalone\Semmle.Extraction.CSharp.Standalone.csproj", "{D00E7D25-0FA0-48EC-B048-CD60CE1B30D8}"
@@ -18,8 +16,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction.CSharp.St
1816
EndProject
1917
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction.CSharp.Util", "extractor\Semmle.Extraction.CSharp.Util\Semmle.Extraction.CSharp.Util.csproj", "{998A0D4C-8BFC-4513-A28D-4816AFB89882}"
2018
EndProject
21-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction.CIL.Driver", "extractor\Semmle.Extraction.CIL.Driver\Semmle.Extraction.CIL.Driver.csproj", "{EFA400B3-C1CE-446F-A4E2-8B44E61EF47C}"
22-
EndProject
2319
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction.CSharp.Driver", "extractor\Semmle.Extraction.CSharp.Driver\Semmle.Extraction.CSharp.Driver.csproj", "{C36453BF-0C82-448A-B15D-26947503A2D3}"
2420
EndProject
2521
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction.Tests", "extractor\Semmle.Extraction.Tests\Semmle.Extraction.Tests.csproj", "{CD8D3F90-AD2E-4BB5-8E82-B94AA293864A}"

csharp/codeql-extractor.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,6 @@ options:
4747
the code (for example if it uses inaccessible dependencies).
4848
type: string
4949
pattern: "^(false|true)$"
50-
cil:
51-
title: Whether to enable CIL extraction.
52-
description: >
53-
A value indicating, whether CIL extraction should be enabled.
54-
The default is 'true'.
55-
type: string
56-
pattern: "^(false|true)$"
5750
logging:
5851
title: Options pertaining to logging.
5952
type: object

csharp/extractor/Semmle.Extraction.CSharp.Standalone/Options.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public static void ShowHelp(TextWriter output)
5858
output.WriteLine("Additional options:\n");
5959
output.WriteLine(" --threads:nnn Specify number of threads (default=CPU cores)");
6060
output.WriteLine(" --verbose Produce more output");
61-
output.WriteLine(" --pdb Cross-reference information from PDBs where available");
6261
}
6362

6463
private Options()

csharp/extractor/Semmle.Extraction.CSharp/Extractor/Analyser.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ public void AnalyseReferences()
6666
{
6767
foreach (var assembly in compilation.References.OfType<PortableExecutableReference>())
6868
{
69-
// CIL first - it takes longer.
70-
if (options.CIL)
71-
extractionTasks.Add(() => DoExtractCIL(assembly));
7269
extractionTasks.Add(() => DoAnalyseReferenceAssembly(assembly));
7370
}
7471
}
@@ -177,17 +174,6 @@ private void DoAnalyseReferenceAssembly(PortableExecutableReference r)
177174
}
178175
}
179176

180-
private void DoExtractCIL(PortableExecutableReference r)
181-
{
182-
var currentTaskId = IncrementTaskCount();
183-
ReportProgressTaskStarted(currentTaskId, r.FilePath);
184-
var stopwatch = new Stopwatch();
185-
stopwatch.Start();
186-
CIL.Analyser.ExtractCIL(r.FilePath!, Logger, options, out var trapFile, out var extracted);
187-
stopwatch.Stop();
188-
ReportProgressTaskDone(currentTaskId, r.FilePath, trapFile, stopwatch.Elapsed, extracted ? AnalysisAction.Extracted : AnalysisAction.UpToDate);
189-
}
190-
191177
private void DoExtractTree(SyntaxTree tree)
192178
{
193179
try

csharp/extractor/Semmle.Extraction.CSharp/Semmle.Extraction.CSharp.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<Nullable>enable</Nullable>
1010
</PropertyGroup>
1111
<ItemGroup>
12-
<ProjectReference Include="..\Semmle.Extraction.CIL\Semmle.Extraction.CIL.csproj" />
1312
<ProjectReference Include="..\Semmle.Extraction\Semmle.Extraction.csproj" />
1413
<ProjectReference Include="..\Semmle.Extraction.CSharp.Util\Semmle.Extraction.CSharp.Util.csproj" />
1514
<ProjectReference Include="..\Semmle.Util\Semmle.Util.csproj" />

csharp/extractor/Semmle.Extraction.Tests/Options.cs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@ public void DefaultOptions()
2222
{
2323
options = CSharp.Options.CreateWithEnvironment(Array.Empty<string>());
2424
Assert.True(options.Cache);
25-
Assert.False(options.CIL);
2625
Assert.Null(options.Framework);
2726
Assert.Null(options.CompilerName);
2827
Assert.Empty(options.CompilerArguments);
2928
Assert.True(options.Threads >= 1);
3029
Assert.Equal(Verbosity.Info, options.LegacyVerbosity);
3130
Assert.False(options.Console);
32-
Assert.False(options.PDB);
3331
Assert.False(options.Fast);
3432
Assert.Equal(TrapWriter.CompressionMode.Brotli, options.TrapCompression);
3533
}
@@ -48,25 +46,6 @@ public void Cache()
4846
Assert.False(options.Cache);
4947
}
5048

51-
[Fact]
52-
public void CIL()
53-
{
54-
options = CSharp.Options.CreateWithEnvironment(Array.Empty<string>());
55-
Assert.False(options.CIL);
56-
57-
Environment.SetEnvironmentVariable("CODEQL_EXTRACTOR_CSHARP_OPTION_CIL", "false");
58-
options = CSharp.Options.CreateWithEnvironment(Array.Empty<string>());
59-
Assert.False(options.CIL);
60-
61-
Environment.SetEnvironmentVariable("CODEQL_EXTRACTOR_CSHARP_OPTION_CIL", "true");
62-
options = CSharp.Options.CreateWithEnvironment(Array.Empty<string>());
63-
Assert.True(options.CIL);
64-
65-
Environment.SetEnvironmentVariable("CODEQL_EXTRACTOR_CSHARP_OPTION_CIL", null);
66-
options = CSharp.Options.CreateWithEnvironment(Array.Empty<string>());
67-
Assert.False(options.CIL);
68-
}
69-
7049
[Fact]
7150
public void CompilerArguments()
7251
{
@@ -141,13 +120,6 @@ public void Console()
141120
Assert.True(options.Console);
142121
}
143122

144-
[Fact]
145-
public void PDB()
146-
{
147-
options = CSharp.Options.CreateWithEnvironment(new string[] { "--pdb" });
148-
Assert.True(options.PDB);
149-
}
150-
151123
[Fact]
152124
public void Compiler()
153125
{

csharp/extractor/Semmle.Extraction/Options.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,11 @@ public Verbosity Verbosity
5555
/// </summary>
5656
public bool Console { get; private set; } = false;
5757

58-
/// <summary>
59-
/// Holds if CIL should be extracted.
60-
/// </summary>
61-
public bool CIL { get; private set; } = false;
62-
6358
/// <summary>
6459
/// Holds if assemblies shouldn't be extracted twice.
6560
/// </summary>
6661
public bool Cache { get; private set; } = true;
6762

68-
/// <summary>
69-
/// Whether to extract PDB information.
70-
/// </summary>
71-
public bool PDB { get; private set; } = false;
72-
7363
/// <summary>
7464
/// Whether "fast extraction mode" has been enabled.
7565
/// </summary>
@@ -102,9 +92,6 @@ public virtual bool HandleOption(string key, string value)
10292
return true;
10393
}
10494
return false;
105-
case "cil":
106-
CIL = Boolean.Parse(value);
107-
return true;
10895
default:
10996
return false;
11097
}
@@ -128,12 +115,7 @@ public virtual bool HandleFlag(string flag, bool value)
128115
case "cache":
129116
Cache = value;
130117
return true;
131-
case "pdb":
132-
PDB = value;
133-
CIL = true;
134-
return true;
135118
case "fast":
136-
CIL = !value;
137119
Fast = value;
138120
return true;
139121
case "qltest":

0 commit comments

Comments
 (0)