-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C# POC: Add binary log based extraction #16581
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Microsoft.CodeAnalysis.CSharp; | ||
using Semmle.Util.Logging; | ||
|
||
namespace Semmle.Extraction.CSharp | ||
{ | ||
public class BinaryLogAnalyser : Analyser | ||
{ | ||
public BinaryLogAnalyser(IProgressMonitor pm, ILogger logger, bool addAssemblyTrapPrefix, PathTransformer pathTransformer) | ||
: base(pm, logger, addAssemblyTrapPrefix, pathTransformer) | ||
{ | ||
} | ||
|
||
public void Initialize(string cwd, string[] args, string outputPath, CSharpCompilation compilationIn, CommonOptions options) | ||
{ | ||
compilation = compilationIn; | ||
extractor = new BinaryLogExtractor(cwd, args, outputPath, Logger, PathTransformer, options); | ||
this.options = options; | ||
LogExtractorInfo(Extraction.Extractor.Version); | ||
SetReferencePaths(); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
Microsoft.Build | ||
Microsoft.CodeAnalysis.CSharp | ||
|
||
Basic.CompilerLog.Util |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Semmle.Util.Logging; | ||
|
||
namespace Semmle.Extraction | ||
{ | ||
public class BinaryLogExtractor : Extractor | ||
{ | ||
public override ExtractorMode Mode { get; } | ||
|
||
public BinaryLogExtractor(string cwd, string[] args, string outputPath, ILogger logger, PathTransformer pathTransformer, CommonOptions options) | ||
: base(cwd, args, outputPath, [], logger, pathTransformer) | ||
{ | ||
Mode = ExtractorMode.BinaryLog; | ||
Check warning Code scanning / CodeQL Virtual call in constructor or destructor Warning
Avoid virtual calls in a constructor or destructor.
|
||
if (options.QlTest) | ||
{ | ||
Mode |= ExtractorMode.QlTest; | ||
Check warning Code scanning / CodeQL Virtual call in constructor or destructor Warning
Avoid virtual calls in a constructor or destructor.
|
||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,6 @@ public enum ExtractorMode | |
Standalone = 1, | ||
Pdb = 2, | ||
QlTest = 4, | ||
BinaryLog = 8, | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
echo Args: "$@" | ||
$@ || exit $? |
Check notice
Code scanning / CodeQL
Missed ternary opportunity Note