Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 983c4d0

Browse files
committed
Revert "C#: Add output assembly to compilation"
This reverts commit 5cfa900.
1 parent 5cfa900 commit 983c4d0

10 files changed

Lines changed: 8 additions & 39 deletions

File tree

csharp/extractor/Semmle.Extraction.CSharp/Entities/Compilation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ public Compilation(Context cx, string cwd, string[] args) : base(cx)
2121

2222
protected override void Populate(TextWriter trapFile)
2323
{
24-
var assembly = Extraction.Entities.Assembly.CreateOutputAssembly(cx);
24+
Extraction.Entities.Assembly.CreateOutputAssembly(cx);
2525

26-
trapFile.compilations(this, FileUtils.ConvertToUnix(cwd), assembly);
26+
trapFile.compilations(this, FileUtils.ConvertToUnix(cwd));
2727

2828
// Arguments
2929
var index = 0;

csharp/extractor/Semmle.Extraction.CSharp/Tuples.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ internal static void compilation_time(this TextWriter trapFile, Compilation comp
106106
trapFile.WriteTuple("compilation_time", compilation, num, index, metric);
107107
}
108108

109-
internal static void compilations(this TextWriter trapFile, Compilation compilation, string cwd, Assembly assembly)
109+
internal static void compilations(this TextWriter trapFile, Compilation compilation, string cwd)
110110
{
111-
trapFile.WriteTuple("compilations", compilation, cwd, assembly);
111+
trapFile.WriteTuple("compilations", compilation, cwd);
112112
}
113113

114114
internal static void compiler_generated(this TextWriter trapFile, IEntity entity)

csharp/extractor/Semmle.Extraction/Entities/Assembly.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ private class AssemblyConstructorFactory : ICachedEntityFactory<Microsoft.CodeAn
5858
}
5959

6060
private static readonly object outputAssemblyCacheKey = new object();
61-
62-
public static Assembly CreateOutputAssembly(Context cx)
61+
public static Location CreateOutputAssembly(Context cx)
6362
{
6463
if (cx.Extractor.OutputPath == null)
6564
throw new InternalError("Attempting to create the output assembly in standalone extraction mode");

csharp/ql/src/semmle/code/csharp/Location.qll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import File
1616
private import Attribute
17-
private import semmle.code.csharp.commons.Compilation
1817

1918
/**
2019
* A location of a program element.
@@ -172,9 +171,6 @@ class Assembly extends Location, Attributable, @assembly {
172171
/** Gets the version of this assembly. */
173172
Version getVersion() { assemblies(this, _, _, _, result) }
174173

175-
/** Gets the compilation producing this assembly if any. */
176-
Compilation getCompilation() { compilations(result, _, this) }
177-
178174
override File getFile() { assemblies(this, result, _, _, _) }
179175

180176
override string toString() { result = this.getFullName() }

csharp/ql/src/semmle/code/csharp/commons/Compilation.qll

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ class Compilation extends @compilation {
77
string toString() { result = "compilation" }
88

99
/** Gets the directory in which this compilation was run, as a string. */
10-
string getDirectoryString() { compilations(this, result, _) }
11-
12-
/** Gets the output assembly. */
13-
Assembly getOutputAssembly() { compilations(this, _, result) }
10+
string getDirectoryString() { compilations(this, result) }
1411

1512
/** Gets the folder in which this compilation was run. */
1613
Folder getFolder() { result.getAbsolutePath() = getDirectoryString() }

csharp/ql/src/semmlecode.csharp.dbscheme

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77
* csc f1.cs f2.cs f3.cs
88
*
99
* The `id` simply identifies the invocation, while `cwd` is the working
10-
* directory from which the compiler was invoked. The `assembly` identifies
11-
* the output assembly of the compilation.
10+
* directory from which the compiler was invoked.
1211
*/
1312
compilations(
1413
unique int id : @compilation,
15-
string cwd : string ref,
16-
int assembly: @assembly ref
14+
string cwd : string ref
1715
);
1816

1917
/**

csharp/ql/test/library-tests/assemblies/compilation.expected

Lines changed: 0 additions & 9 deletions
This file was deleted.

csharp/ql/test/library-tests/assemblies/compilation.ql

Lines changed: 0 additions & 8 deletions
This file was deleted.

csharp/ql/test/library-tests/compilations/Compilations.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,3 @@ references
3535
| compilation | mscorlib.dll |
3636
timings
3737
| compilation |
38-
assembly
39-
| compilation | Program.dll:0:0:0:0 | Program, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null |

csharp/ql/test/library-tests/compilations/Compilations.ql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,3 @@ query predicate timings(Compilation c) {
3939
c.getCpuSeconds() > 0 and
4040
c.getElapsedSeconds() > 0
4141
}
42-
43-
query predicate assembly(Compilation c, Assembly a) { c.getOutputAssembly() = a }

0 commit comments

Comments
 (0)