mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Merge remote-tracking branch 'upstream/main' into JsonHijacking
This commit is contained in:
21
.github/workflows/check-change-note.yml
vendored
Normal file
21
.github/workflows/check-change-note.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [labeled, unlabeled, opened, synchronize, reopened, ready_for_review]
|
||||
paths:
|
||||
- "*/ql/src/**/*.ql"
|
||||
- "*/ql/src/**/*.qll"
|
||||
- "!**/experimental/**"
|
||||
|
||||
jobs:
|
||||
check-change-note:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fail if no change note found. To fix, either add one, or add the `no-change-note-required` label.
|
||||
if: |
|
||||
github.event.pull_request.draft == false &&
|
||||
!contains(github.event.pull_request.labels.*.name, 'no-change-note-required')
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh api 'repos/${{github.repository}}/pulls/${{github.event.number}}/files' --paginate |
|
||||
jq 'any(.[].filename ; test("/change-notes/.*[.]md$"))' --exit-status
|
||||
4
.github/workflows/codeql-analysis.yml
vendored
4
.github/workflows/codeql-analysis.yml
vendored
@@ -5,10 +5,14 @@ on:
|
||||
branches:
|
||||
- main
|
||||
- 'rc/*'
|
||||
paths:
|
||||
- 'csharp/**'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- 'rc/*'
|
||||
paths:
|
||||
- 'csharp/**'
|
||||
schedule:
|
||||
- cron: '0 9 * * 1'
|
||||
|
||||
|
||||
15
CODEOWNERS
15
CODEOWNERS
@@ -3,18 +3,3 @@
|
||||
/java/ @github/codeql-java
|
||||
/javascript/ @github/codeql-javascript
|
||||
/python/ @github/codeql-python
|
||||
|
||||
# Assign query help for docs review
|
||||
/cpp/**/*.qhelp @hubwriter
|
||||
/csharp/**/*.qhelp @jf205
|
||||
/java/**/*.qhelp @felicitymay
|
||||
/javascript/**/*.qhelp @mchammer01
|
||||
/python/**/*.qhelp @felicitymay
|
||||
/docs/language/ @shati-patel @jf205
|
||||
|
||||
# Exclude help for experimental queries from docs review
|
||||
/cpp/**/experimental/**/*.qhelp @github/codeql-c-analysis
|
||||
/csharp/**/experimental/**/*.qhelp @github/codeql-csharp
|
||||
/java/**/experimental/**/*.qhelp @github/codeql-java
|
||||
/javascript/**/experimental/**/*.qhelp @github/codeql-javascript
|
||||
/python/**/experimental/**/*.qhelp @github/codeql-python
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* @tags reliability
|
||||
* security
|
||||
* external/cwe/cwe-242
|
||||
* external/cwe/cwe-676
|
||||
*/
|
||||
|
||||
import cpp
|
||||
|
||||
@@ -467,7 +467,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
|
||||
// ... and likewise for destructors.
|
||||
this.(Destructor).getADestruction().mayBeGloballyImpure()
|
||||
else
|
||||
// Unless it's a function that we know is side-effect-free, it may
|
||||
// Unless it's a function that we know is side-effect free, it may
|
||||
// have side-effects.
|
||||
not this.hasGlobalOrStdName([
|
||||
"strcmp", "wcscmp", "_mbscmp", "strlen", "wcslen", "_mbslen", "_mbslen_l", "_mbstrlen",
|
||||
|
||||
@@ -131,7 +131,22 @@ private predicate lvalueToUpdate(Expr lvalue, Expr outer, ControlFlowNode node)
|
||||
exists(Call call | node = call |
|
||||
outer = call.getQualifier().getFullyConverted() and
|
||||
outer.getUnspecifiedType() instanceof Class and
|
||||
not call.getTarget().hasSpecifier("const")
|
||||
not (
|
||||
call.getTarget().hasSpecifier("const") and
|
||||
// Given the following program:
|
||||
// ```
|
||||
// struct C {
|
||||
// void* data_;
|
||||
// void* data() const { return data; }
|
||||
// };
|
||||
// C c;
|
||||
// memcpy(c.data(), source, 16)
|
||||
// ```
|
||||
// the data pointed to by `c.data_` is potentially modified by the call to `memcpy` even though
|
||||
// `C::data` has a const specifier. So we further place the restriction that the type returned
|
||||
// by `call` should not be of the form `const T*` (for some deeply const type `T`).
|
||||
call.getType().isDeeplyConstBelow()
|
||||
)
|
||||
)
|
||||
or
|
||||
assignmentTo(outer, node)
|
||||
@@ -170,7 +185,11 @@ private predicate pointerToUpdate(Expr pointer, Expr outer, ControlFlowNode node
|
||||
or
|
||||
outer = call.getQualifier().getFullyConverted() and
|
||||
outer.getUnspecifiedType() instanceof PointerType and
|
||||
not call.getTarget().hasSpecifier("const")
|
||||
not (
|
||||
call.getTarget().hasSpecifier("const") and
|
||||
// See the `lvalueToUpdate` case for an explanation of this conjunct.
|
||||
call.getType().isDeeplyConstBelow()
|
||||
)
|
||||
)
|
||||
or
|
||||
exists(PointerFieldAccess fa |
|
||||
|
||||
@@ -30,3 +30,6 @@ private import implementations.SmartPointer
|
||||
private import implementations.Sscanf
|
||||
private import implementations.Send
|
||||
private import implementations.Recv
|
||||
private import implementations.Accept
|
||||
private import implementations.Poll
|
||||
private import implementations.Select
|
||||
|
||||
56
cpp/ql/src/semmle/code/cpp/models/implementations/Accept.qll
Normal file
56
cpp/ql/src/semmle/code/cpp/models/implementations/Accept.qll
Normal file
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Provides implementation classes modeling `accept` and various similar
|
||||
* functions. See `semmle.code.cpp.models.Models` for usage information.
|
||||
*/
|
||||
|
||||
import semmle.code.cpp.Function
|
||||
import semmle.code.cpp.models.interfaces.ArrayFunction
|
||||
import semmle.code.cpp.models.interfaces.Taint
|
||||
import semmle.code.cpp.models.interfaces.Alias
|
||||
import semmle.code.cpp.models.interfaces.SideEffect
|
||||
|
||||
/**
|
||||
* The function `accept` and its assorted variants
|
||||
*/
|
||||
private class Accept extends ArrayFunction, AliasFunction, TaintFunction, SideEffectFunction {
|
||||
Accept() { this.hasGlobalName(["accept", "accept4", "WSAAccept"]) }
|
||||
|
||||
override predicate hasArrayWithVariableSize(int bufParam, int countParam) {
|
||||
bufParam = 1 and countParam = 2
|
||||
}
|
||||
|
||||
override predicate hasArrayInput(int bufParam) { bufParam = 1 }
|
||||
|
||||
override predicate hasArrayOutput(int bufParam) { bufParam = 1 }
|
||||
|
||||
override predicate parameterNeverEscapes(int index) { exists(this.getParameter(index)) }
|
||||
|
||||
override predicate parameterEscapesOnlyViaReturn(int index) { none() }
|
||||
|
||||
override predicate parameterIsAlwaysReturned(int index) { none() }
|
||||
|
||||
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
|
||||
(input.isParameter(0) or input.isParameterDeref(1)) and
|
||||
(output.isReturnValue() or output.isParameterDeref(1))
|
||||
}
|
||||
|
||||
override predicate hasSpecificWriteSideEffect(ParameterIndex i, boolean buffer, boolean mustWrite) {
|
||||
i = 1 and buffer = true and mustWrite = false
|
||||
or
|
||||
i = 2 and buffer = false and mustWrite = false
|
||||
}
|
||||
|
||||
override predicate hasSpecificReadSideEffect(ParameterIndex i, boolean buffer) {
|
||||
i = 0 and buffer = true
|
||||
or
|
||||
i = 1 and buffer = false
|
||||
}
|
||||
|
||||
override ParameterIndex getParameterSizeIndex(ParameterIndex i) { i = 1 and result = 2 }
|
||||
|
||||
// NOTE: We implement thse two predicates as none because we can't model the low-level changes made to
|
||||
// the structure pointed to by the file-descriptor argument.
|
||||
override predicate hasOnlySpecificReadSideEffects() { none() }
|
||||
|
||||
override predicate hasOnlySpecificWriteSideEffects() { none() }
|
||||
}
|
||||
44
cpp/ql/src/semmle/code/cpp/models/implementations/Poll.qll
Normal file
44
cpp/ql/src/semmle/code/cpp/models/implementations/Poll.qll
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Provides implementation classes modeling `poll` and various similar
|
||||
* functions. See `semmle.code.cpp.models.Models` for usage information.
|
||||
*/
|
||||
|
||||
import semmle.code.cpp.Function
|
||||
import semmle.code.cpp.models.interfaces.ArrayFunction
|
||||
import semmle.code.cpp.models.interfaces.Alias
|
||||
import semmle.code.cpp.models.interfaces.SideEffect
|
||||
|
||||
/**
|
||||
* The function `poll` and its assorted variants
|
||||
*/
|
||||
private class Poll extends ArrayFunction, AliasFunction, SideEffectFunction {
|
||||
Poll() { this.hasGlobalName(["poll", "ppoll", "WSAPoll"]) }
|
||||
|
||||
override predicate hasArrayWithVariableSize(int bufParam, int countParam) {
|
||||
bufParam = 0 and countParam = 1
|
||||
}
|
||||
|
||||
override predicate hasArrayInput(int bufParam) { bufParam = 0 }
|
||||
|
||||
override predicate hasArrayOutput(int bufParam) { bufParam = 0 }
|
||||
|
||||
override predicate parameterNeverEscapes(int index) { exists(this.getParameter(index)) }
|
||||
|
||||
override predicate parameterEscapesOnlyViaReturn(int index) { none() }
|
||||
|
||||
override predicate parameterIsAlwaysReturned(int index) { none() }
|
||||
|
||||
override predicate hasSpecificWriteSideEffect(ParameterIndex i, boolean buffer, boolean mustWrite) {
|
||||
i = 0 and buffer = true and mustWrite = false
|
||||
}
|
||||
|
||||
override predicate hasSpecificReadSideEffect(ParameterIndex i, boolean buffer) {
|
||||
i = 0 and buffer = true
|
||||
or
|
||||
this.hasGlobalName("ppoll") and i = [2, 3] and buffer = false
|
||||
}
|
||||
|
||||
override predicate hasOnlySpecificReadSideEffects() { any() }
|
||||
|
||||
override predicate hasOnlySpecificWriteSideEffects() { any() }
|
||||
}
|
||||
@@ -3,7 +3,10 @@ import semmle.code.cpp.models.interfaces.Taint
|
||||
import semmle.code.cpp.models.interfaces.Alias
|
||||
import semmle.code.cpp.models.interfaces.SideEffect
|
||||
|
||||
/** Pure string functions. */
|
||||
/**
|
||||
* A function that operates on strings and is pure. That is, its evaluation is
|
||||
* guaranteed to be side-effect free.
|
||||
*/
|
||||
private class PureStrFunction extends AliasFunction, ArrayFunction, TaintFunction,
|
||||
SideEffectFunction {
|
||||
PureStrFunction() {
|
||||
@@ -89,7 +92,9 @@ private string strcmp() {
|
||||
]
|
||||
}
|
||||
|
||||
/** String standard `strlen` function, and related functions for computing string lengths. */
|
||||
/**
|
||||
* A function such as `strlen` that returns the length of the given string.
|
||||
*/
|
||||
private class StrLenFunction extends AliasFunction, ArrayFunction, SideEffectFunction {
|
||||
StrLenFunction() {
|
||||
hasGlobalOrStdOrBslName(["strlen", "strnlen", "wcslen"])
|
||||
@@ -123,7 +128,10 @@ private class StrLenFunction extends AliasFunction, ArrayFunction, SideEffectFun
|
||||
}
|
||||
}
|
||||
|
||||
/** Pure functions. */
|
||||
/**
|
||||
* A function that is pure, that is, its evaluation is guaranteed to be
|
||||
* side-effect free. Excludes functions modeled by `PureStrFunction` and `PureMemFunction`.
|
||||
*/
|
||||
private class PureFunction extends TaintFunction, SideEffectFunction {
|
||||
PureFunction() { hasGlobalOrStdOrBslName(["abs", "labs"]) }
|
||||
|
||||
@@ -140,7 +148,10 @@ private class PureFunction extends TaintFunction, SideEffectFunction {
|
||||
override predicate hasOnlySpecificWriteSideEffects() { any() }
|
||||
}
|
||||
|
||||
/** Pure raw-memory functions. */
|
||||
/**
|
||||
* A function that operates on memory buffers and is pure. That is, its
|
||||
* evaluation is guaranteed to be side-effect free.
|
||||
*/
|
||||
private class PureMemFunction extends AliasFunction, ArrayFunction, TaintFunction,
|
||||
SideEffectFunction {
|
||||
PureMemFunction() {
|
||||
|
||||
40
cpp/ql/src/semmle/code/cpp/models/implementations/Select.qll
Normal file
40
cpp/ql/src/semmle/code/cpp/models/implementations/Select.qll
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Provides implementation classes modeling `select` and various similar
|
||||
* functions. See `semmle.code.cpp.models.Models` for usage information.
|
||||
*/
|
||||
|
||||
import semmle.code.cpp.Function
|
||||
import semmle.code.cpp.models.interfaces.ArrayFunction
|
||||
import semmle.code.cpp.models.interfaces.Alias
|
||||
import semmle.code.cpp.models.interfaces.SideEffect
|
||||
|
||||
/**
|
||||
* The function `select` and its assorted variants
|
||||
*/
|
||||
private class Select extends ArrayFunction, AliasFunction, SideEffectFunction {
|
||||
Select() { this.hasGlobalName(["select", "pselect"]) }
|
||||
|
||||
override predicate hasArrayWithUnknownSize(int bufParam) { bufParam = [1 .. 3] }
|
||||
|
||||
override predicate hasArrayInput(int bufParam) { bufParam = [1 .. 3] }
|
||||
|
||||
override predicate hasArrayOutput(int bufParam) { bufParam = [1 .. 3] }
|
||||
|
||||
override predicate parameterNeverEscapes(int index) { exists(this.getParameter(index)) }
|
||||
|
||||
override predicate parameterEscapesOnlyViaReturn(int index) { none() }
|
||||
|
||||
override predicate parameterIsAlwaysReturned(int index) { none() }
|
||||
|
||||
override predicate hasSpecificWriteSideEffect(ParameterIndex i, boolean buffer, boolean mustWrite) {
|
||||
i = [1 .. 3] and buffer = true and mustWrite = false
|
||||
}
|
||||
|
||||
override predicate hasSpecificReadSideEffect(ParameterIndex i, boolean buffer) {
|
||||
i = [1 .. 5] and buffer = true
|
||||
}
|
||||
|
||||
override predicate hasOnlySpecificReadSideEffects() { any() }
|
||||
|
||||
override predicate hasOnlySpecificWriteSideEffects() { any() }
|
||||
}
|
||||
@@ -36,9 +36,6 @@ argHasPostUpdate
|
||||
| arrays.cpp:10:8:10:15 | * ... | ArgumentNode is missing PostUpdateNode. |
|
||||
| arrays.cpp:16:8:16:13 | access to array | ArgumentNode is missing PostUpdateNode. |
|
||||
| arrays.cpp:17:8:17:13 | access to array | ArgumentNode is missing PostUpdateNode. |
|
||||
| by_reference.cpp:51:8:51:8 | s | ArgumentNode is missing PostUpdateNode. |
|
||||
| by_reference.cpp:57:8:57:8 | s | ArgumentNode is missing PostUpdateNode. |
|
||||
| by_reference.cpp:63:8:63:8 | s | ArgumentNode is missing PostUpdateNode. |
|
||||
postWithInFlow
|
||||
| A.cpp:25:13:25:13 | c [post update] | PostUpdateNode should not be the target of local flow. |
|
||||
| A.cpp:27:28:27:28 | c [post update] | PostUpdateNode should not be the target of local flow. |
|
||||
|
||||
@@ -227,14 +227,18 @@
|
||||
| by_reference.cpp:20:23:20:27 | value | AST only |
|
||||
| by_reference.cpp:24:19:24:22 | this | AST only |
|
||||
| by_reference.cpp:24:25:24:29 | value | AST only |
|
||||
| by_reference.cpp:40:12:40:15 | this | AST only |
|
||||
| by_reference.cpp:50:3:50:3 | s | AST only |
|
||||
| by_reference.cpp:50:17:50:26 | call to user_input | AST only |
|
||||
| by_reference.cpp:51:8:51:8 | s | AST only |
|
||||
| by_reference.cpp:51:10:51:20 | call to getDirectly | AST only |
|
||||
| by_reference.cpp:56:3:56:3 | s | AST only |
|
||||
| by_reference.cpp:56:19:56:28 | call to user_input | AST only |
|
||||
| by_reference.cpp:57:8:57:8 | s | AST only |
|
||||
| by_reference.cpp:57:10:57:22 | call to getIndirectly | AST only |
|
||||
| by_reference.cpp:62:3:62:3 | s | AST only |
|
||||
| by_reference.cpp:62:25:62:34 | call to user_input | AST only |
|
||||
| by_reference.cpp:63:8:63:8 | s | AST only |
|
||||
| by_reference.cpp:63:10:63:28 | call to getThroughNonMember | AST only |
|
||||
| by_reference.cpp:68:17:68:18 | & ... | AST only |
|
||||
| by_reference.cpp:68:21:68:30 | call to user_input | AST only |
|
||||
|
||||
@@ -266,14 +266,18 @@
|
||||
| by_reference.cpp:20:23:20:27 | value |
|
||||
| by_reference.cpp:24:19:24:22 | this |
|
||||
| by_reference.cpp:24:25:24:29 | value |
|
||||
| by_reference.cpp:40:12:40:15 | this |
|
||||
| by_reference.cpp:50:3:50:3 | s |
|
||||
| by_reference.cpp:50:17:50:26 | call to user_input |
|
||||
| by_reference.cpp:51:8:51:8 | s |
|
||||
| by_reference.cpp:51:10:51:20 | call to getDirectly |
|
||||
| by_reference.cpp:56:3:56:3 | s |
|
||||
| by_reference.cpp:56:19:56:28 | call to user_input |
|
||||
| by_reference.cpp:57:8:57:8 | s |
|
||||
| by_reference.cpp:57:10:57:22 | call to getIndirectly |
|
||||
| by_reference.cpp:62:3:62:3 | s |
|
||||
| by_reference.cpp:62:25:62:34 | call to user_input |
|
||||
| by_reference.cpp:63:8:63:8 | s |
|
||||
| by_reference.cpp:63:10:63:28 | call to getThroughNonMember |
|
||||
| by_reference.cpp:68:17:68:18 | & ... |
|
||||
| by_reference.cpp:68:21:68:30 | call to user_input |
|
||||
|
||||
24
cpp/ql/test/library-tests/dataflow/taint-tests/bsd.cpp
Normal file
24
cpp/ql/test/library-tests/dataflow/taint-tests/bsd.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
void sink(...);
|
||||
int source();
|
||||
|
||||
// --- accept ---
|
||||
|
||||
struct sockaddr {
|
||||
unsigned char length;
|
||||
int sa_family;
|
||||
char* sa_data;
|
||||
};
|
||||
|
||||
int accept(int, const sockaddr*, int*);
|
||||
|
||||
void sink(sockaddr);
|
||||
|
||||
void test_accept() {
|
||||
int s = source();
|
||||
sockaddr addr;
|
||||
int size = sizeof(sockaddr);
|
||||
int a = accept(s, &addr, &size);
|
||||
|
||||
sink(a); // $ ast=17:11 SPURIOUS: ast=18:12 MISSING: ir
|
||||
sink(addr); // $ ast MISSING: ir
|
||||
}
|
||||
@@ -135,6 +135,17 @@
|
||||
| arrayassignment.cpp:145:12:145:12 | 5 | arrayassignment.cpp:145:7:145:13 | access to array | TAINT |
|
||||
| arrayassignment.cpp:146:7:146:10 | arr3 | arrayassignment.cpp:146:7:146:13 | access to array | |
|
||||
| arrayassignment.cpp:146:12:146:12 | 5 | arrayassignment.cpp:146:7:146:13 | access to array | TAINT |
|
||||
| bsd.cpp:17:11:17:16 | call to source | bsd.cpp:20:18:20:18 | s | |
|
||||
| bsd.cpp:18:12:18:15 | addr | bsd.cpp:20:22:20:25 | addr | |
|
||||
| bsd.cpp:18:12:18:15 | addr | bsd.cpp:23:8:23:11 | addr | |
|
||||
| bsd.cpp:19:14:19:29 | sizeof(sockaddr) | bsd.cpp:20:29:20:32 | size | |
|
||||
| bsd.cpp:20:11:20:16 | call to accept | bsd.cpp:22:8:22:8 | a | |
|
||||
| bsd.cpp:20:18:20:18 | s | bsd.cpp:20:11:20:16 | call to accept | TAINT |
|
||||
| bsd.cpp:20:21:20:25 | & ... | bsd.cpp:20:11:20:16 | call to accept | TAINT |
|
||||
| bsd.cpp:20:22:20:25 | addr | bsd.cpp:20:11:20:16 | call to accept | TAINT |
|
||||
| bsd.cpp:20:22:20:25 | addr | bsd.cpp:20:21:20:25 | & ... | |
|
||||
| bsd.cpp:20:28:20:32 | ref arg & ... | bsd.cpp:20:29:20:32 | size [inner post update] | |
|
||||
| bsd.cpp:20:29:20:32 | size | bsd.cpp:20:28:20:32 | & ... | |
|
||||
| constructor_delegation.cpp:8:2:8:8 | this | constructor_delegation.cpp:8:20:8:24 | constructor init of field x [pre-this] | |
|
||||
| constructor_delegation.cpp:8:14:8:15 | _x | constructor_delegation.cpp:8:22:8:23 | _x | |
|
||||
| constructor_delegation.cpp:8:22:8:23 | _x | constructor_delegation.cpp:8:20:8:24 | constructor init of field x | TAINT |
|
||||
@@ -796,8 +807,23 @@
|
||||
| map.cpp:146:40:146:41 | ref arg i1 | map.cpp:150:8:150:9 | i1 | |
|
||||
| map.cpp:148:8:148:8 | call to operator* | map.cpp:148:8:148:10 | call to pair | TAINT |
|
||||
| map.cpp:148:9:148:10 | i1 | map.cpp:148:8:148:8 | call to operator* | TAINT |
|
||||
| map.cpp:148:9:148:10 | ref arg i1 | map.cpp:146:24:146:25 | i1 | |
|
||||
| map.cpp:148:9:148:10 | ref arg i1 | map.cpp:146:40:146:41 | i1 | |
|
||||
| map.cpp:148:9:148:10 | ref arg i1 | map.cpp:148:9:148:10 | i1 | |
|
||||
| map.cpp:148:9:148:10 | ref arg i1 | map.cpp:149:8:149:9 | i1 | |
|
||||
| map.cpp:148:9:148:10 | ref arg i1 | map.cpp:150:8:150:9 | i1 | |
|
||||
| map.cpp:149:8:149:9 | i1 | map.cpp:149:10:149:10 | call to operator-> | TAINT |
|
||||
| map.cpp:149:8:149:9 | ref arg i1 | map.cpp:146:24:146:25 | i1 | |
|
||||
| map.cpp:149:8:149:9 | ref arg i1 | map.cpp:146:40:146:41 | i1 | |
|
||||
| map.cpp:149:8:149:9 | ref arg i1 | map.cpp:148:9:148:10 | i1 | |
|
||||
| map.cpp:149:8:149:9 | ref arg i1 | map.cpp:149:8:149:9 | i1 | |
|
||||
| map.cpp:149:8:149:9 | ref arg i1 | map.cpp:150:8:150:9 | i1 | |
|
||||
| map.cpp:150:8:150:9 | i1 | map.cpp:150:10:150:10 | call to operator-> | TAINT |
|
||||
| map.cpp:150:8:150:9 | ref arg i1 | map.cpp:146:24:146:25 | i1 | |
|
||||
| map.cpp:150:8:150:9 | ref arg i1 | map.cpp:146:40:146:41 | i1 | |
|
||||
| map.cpp:150:8:150:9 | ref arg i1 | map.cpp:148:9:148:10 | i1 | |
|
||||
| map.cpp:150:8:150:9 | ref arg i1 | map.cpp:149:8:149:9 | i1 | |
|
||||
| map.cpp:150:8:150:9 | ref arg i1 | map.cpp:150:8:150:9 | i1 | |
|
||||
| map.cpp:152:12:152:13 | m2 | map.cpp:152:15:152:19 | call to begin | TAINT |
|
||||
| map.cpp:152:12:152:13 | ref arg m2 | map.cpp:152:30:152:31 | m2 | |
|
||||
| map.cpp:152:12:152:13 | ref arg m2 | map.cpp:182:7:182:8 | m2 | |
|
||||
@@ -830,8 +856,23 @@
|
||||
| map.cpp:152:40:152:41 | ref arg i2 | map.cpp:156:8:156:9 | i2 | |
|
||||
| map.cpp:154:8:154:8 | call to operator* | map.cpp:154:8:154:10 | call to pair | TAINT |
|
||||
| map.cpp:154:9:154:10 | i2 | map.cpp:154:8:154:8 | call to operator* | TAINT |
|
||||
| map.cpp:154:9:154:10 | ref arg i2 | map.cpp:152:24:152:25 | i2 | |
|
||||
| map.cpp:154:9:154:10 | ref arg i2 | map.cpp:152:40:152:41 | i2 | |
|
||||
| map.cpp:154:9:154:10 | ref arg i2 | map.cpp:154:9:154:10 | i2 | |
|
||||
| map.cpp:154:9:154:10 | ref arg i2 | map.cpp:155:8:155:9 | i2 | |
|
||||
| map.cpp:154:9:154:10 | ref arg i2 | map.cpp:156:8:156:9 | i2 | |
|
||||
| map.cpp:155:8:155:9 | i2 | map.cpp:155:10:155:10 | call to operator-> | TAINT |
|
||||
| map.cpp:155:8:155:9 | ref arg i2 | map.cpp:152:24:152:25 | i2 | |
|
||||
| map.cpp:155:8:155:9 | ref arg i2 | map.cpp:152:40:152:41 | i2 | |
|
||||
| map.cpp:155:8:155:9 | ref arg i2 | map.cpp:154:9:154:10 | i2 | |
|
||||
| map.cpp:155:8:155:9 | ref arg i2 | map.cpp:155:8:155:9 | i2 | |
|
||||
| map.cpp:155:8:155:9 | ref arg i2 | map.cpp:156:8:156:9 | i2 | |
|
||||
| map.cpp:156:8:156:9 | i2 | map.cpp:156:10:156:10 | call to operator-> | TAINT |
|
||||
| map.cpp:156:8:156:9 | ref arg i2 | map.cpp:152:24:152:25 | i2 | |
|
||||
| map.cpp:156:8:156:9 | ref arg i2 | map.cpp:152:40:152:41 | i2 | |
|
||||
| map.cpp:156:8:156:9 | ref arg i2 | map.cpp:154:9:154:10 | i2 | |
|
||||
| map.cpp:156:8:156:9 | ref arg i2 | map.cpp:155:8:155:9 | i2 | |
|
||||
| map.cpp:156:8:156:9 | ref arg i2 | map.cpp:156:8:156:9 | i2 | |
|
||||
| map.cpp:158:12:158:13 | m3 | map.cpp:158:15:158:19 | call to begin | TAINT |
|
||||
| map.cpp:158:12:158:13 | ref arg m3 | map.cpp:158:30:158:31 | m3 | |
|
||||
| map.cpp:158:12:158:13 | ref arg m3 | map.cpp:252:1:252:1 | m3 | |
|
||||
@@ -852,8 +893,23 @@
|
||||
| map.cpp:158:40:158:41 | ref arg i3 | map.cpp:162:8:162:9 | i3 | |
|
||||
| map.cpp:160:8:160:8 | call to operator* | map.cpp:160:8:160:10 | call to pair | TAINT |
|
||||
| map.cpp:160:9:160:10 | i3 | map.cpp:160:8:160:8 | call to operator* | TAINT |
|
||||
| map.cpp:160:9:160:10 | ref arg i3 | map.cpp:158:24:158:25 | i3 | |
|
||||
| map.cpp:160:9:160:10 | ref arg i3 | map.cpp:158:40:158:41 | i3 | |
|
||||
| map.cpp:160:9:160:10 | ref arg i3 | map.cpp:160:9:160:10 | i3 | |
|
||||
| map.cpp:160:9:160:10 | ref arg i3 | map.cpp:161:8:161:9 | i3 | |
|
||||
| map.cpp:160:9:160:10 | ref arg i3 | map.cpp:162:8:162:9 | i3 | |
|
||||
| map.cpp:161:8:161:9 | i3 | map.cpp:161:10:161:10 | call to operator-> | TAINT |
|
||||
| map.cpp:161:8:161:9 | ref arg i3 | map.cpp:158:24:158:25 | i3 | |
|
||||
| map.cpp:161:8:161:9 | ref arg i3 | map.cpp:158:40:158:41 | i3 | |
|
||||
| map.cpp:161:8:161:9 | ref arg i3 | map.cpp:160:9:160:10 | i3 | |
|
||||
| map.cpp:161:8:161:9 | ref arg i3 | map.cpp:161:8:161:9 | i3 | |
|
||||
| map.cpp:161:8:161:9 | ref arg i3 | map.cpp:162:8:162:9 | i3 | |
|
||||
| map.cpp:162:8:162:9 | i3 | map.cpp:162:10:162:10 | call to operator-> | TAINT |
|
||||
| map.cpp:162:8:162:9 | ref arg i3 | map.cpp:158:24:158:25 | i3 | |
|
||||
| map.cpp:162:8:162:9 | ref arg i3 | map.cpp:158:40:158:41 | i3 | |
|
||||
| map.cpp:162:8:162:9 | ref arg i3 | map.cpp:160:9:160:10 | i3 | |
|
||||
| map.cpp:162:8:162:9 | ref arg i3 | map.cpp:161:8:161:9 | i3 | |
|
||||
| map.cpp:162:8:162:9 | ref arg i3 | map.cpp:162:8:162:9 | i3 | |
|
||||
| map.cpp:166:27:166:29 | call to map | map.cpp:167:7:167:9 | m10 | |
|
||||
| map.cpp:166:27:166:29 | call to map | map.cpp:171:7:171:9 | m10 | |
|
||||
| map.cpp:166:27:166:29 | call to map | map.cpp:252:1:252:1 | m10 | |
|
||||
@@ -1460,8 +1516,23 @@
|
||||
| map.cpp:298:40:298:41 | ref arg i1 | map.cpp:302:8:302:9 | i1 | |
|
||||
| map.cpp:300:8:300:8 | call to operator* | map.cpp:300:8:300:10 | call to pair | TAINT |
|
||||
| map.cpp:300:9:300:10 | i1 | map.cpp:300:8:300:8 | call to operator* | TAINT |
|
||||
| map.cpp:300:9:300:10 | ref arg i1 | map.cpp:298:24:298:25 | i1 | |
|
||||
| map.cpp:300:9:300:10 | ref arg i1 | map.cpp:298:40:298:41 | i1 | |
|
||||
| map.cpp:300:9:300:10 | ref arg i1 | map.cpp:300:9:300:10 | i1 | |
|
||||
| map.cpp:300:9:300:10 | ref arg i1 | map.cpp:301:8:301:9 | i1 | |
|
||||
| map.cpp:300:9:300:10 | ref arg i1 | map.cpp:302:8:302:9 | i1 | |
|
||||
| map.cpp:301:8:301:9 | i1 | map.cpp:301:10:301:10 | call to operator-> | TAINT |
|
||||
| map.cpp:301:8:301:9 | ref arg i1 | map.cpp:298:24:298:25 | i1 | |
|
||||
| map.cpp:301:8:301:9 | ref arg i1 | map.cpp:298:40:298:41 | i1 | |
|
||||
| map.cpp:301:8:301:9 | ref arg i1 | map.cpp:300:9:300:10 | i1 | |
|
||||
| map.cpp:301:8:301:9 | ref arg i1 | map.cpp:301:8:301:9 | i1 | |
|
||||
| map.cpp:301:8:301:9 | ref arg i1 | map.cpp:302:8:302:9 | i1 | |
|
||||
| map.cpp:302:8:302:9 | i1 | map.cpp:302:10:302:10 | call to operator-> | TAINT |
|
||||
| map.cpp:302:8:302:9 | ref arg i1 | map.cpp:298:24:298:25 | i1 | |
|
||||
| map.cpp:302:8:302:9 | ref arg i1 | map.cpp:298:40:298:41 | i1 | |
|
||||
| map.cpp:302:8:302:9 | ref arg i1 | map.cpp:300:9:300:10 | i1 | |
|
||||
| map.cpp:302:8:302:9 | ref arg i1 | map.cpp:301:8:301:9 | i1 | |
|
||||
| map.cpp:302:8:302:9 | ref arg i1 | map.cpp:302:8:302:9 | i1 | |
|
||||
| map.cpp:304:12:304:13 | m2 | map.cpp:304:15:304:19 | call to begin | TAINT |
|
||||
| map.cpp:304:12:304:13 | ref arg m2 | map.cpp:304:30:304:31 | m2 | |
|
||||
| map.cpp:304:12:304:13 | ref arg m2 | map.cpp:334:7:334:8 | m2 | |
|
||||
@@ -1488,8 +1559,23 @@
|
||||
| map.cpp:304:40:304:41 | ref arg i2 | map.cpp:308:8:308:9 | i2 | |
|
||||
| map.cpp:306:8:306:8 | call to operator* | map.cpp:306:8:306:10 | call to pair | TAINT |
|
||||
| map.cpp:306:9:306:10 | i2 | map.cpp:306:8:306:8 | call to operator* | TAINT |
|
||||
| map.cpp:306:9:306:10 | ref arg i2 | map.cpp:304:24:304:25 | i2 | |
|
||||
| map.cpp:306:9:306:10 | ref arg i2 | map.cpp:304:40:304:41 | i2 | |
|
||||
| map.cpp:306:9:306:10 | ref arg i2 | map.cpp:306:9:306:10 | i2 | |
|
||||
| map.cpp:306:9:306:10 | ref arg i2 | map.cpp:307:8:307:9 | i2 | |
|
||||
| map.cpp:306:9:306:10 | ref arg i2 | map.cpp:308:8:308:9 | i2 | |
|
||||
| map.cpp:307:8:307:9 | i2 | map.cpp:307:10:307:10 | call to operator-> | TAINT |
|
||||
| map.cpp:307:8:307:9 | ref arg i2 | map.cpp:304:24:304:25 | i2 | |
|
||||
| map.cpp:307:8:307:9 | ref arg i2 | map.cpp:304:40:304:41 | i2 | |
|
||||
| map.cpp:307:8:307:9 | ref arg i2 | map.cpp:306:9:306:10 | i2 | |
|
||||
| map.cpp:307:8:307:9 | ref arg i2 | map.cpp:307:8:307:9 | i2 | |
|
||||
| map.cpp:307:8:307:9 | ref arg i2 | map.cpp:308:8:308:9 | i2 | |
|
||||
| map.cpp:308:8:308:9 | i2 | map.cpp:308:10:308:10 | call to operator-> | TAINT |
|
||||
| map.cpp:308:8:308:9 | ref arg i2 | map.cpp:304:24:304:25 | i2 | |
|
||||
| map.cpp:308:8:308:9 | ref arg i2 | map.cpp:304:40:304:41 | i2 | |
|
||||
| map.cpp:308:8:308:9 | ref arg i2 | map.cpp:306:9:306:10 | i2 | |
|
||||
| map.cpp:308:8:308:9 | ref arg i2 | map.cpp:307:8:307:9 | i2 | |
|
||||
| map.cpp:308:8:308:9 | ref arg i2 | map.cpp:308:8:308:9 | i2 | |
|
||||
| map.cpp:310:12:310:13 | m3 | map.cpp:310:15:310:19 | call to begin | TAINT |
|
||||
| map.cpp:310:12:310:13 | ref arg m3 | map.cpp:310:30:310:31 | m3 | |
|
||||
| map.cpp:310:12:310:13 | ref arg m3 | map.cpp:438:1:438:1 | m3 | |
|
||||
@@ -1510,8 +1596,23 @@
|
||||
| map.cpp:310:40:310:41 | ref arg i3 | map.cpp:314:8:314:9 | i3 | |
|
||||
| map.cpp:312:8:312:8 | call to operator* | map.cpp:312:8:312:10 | call to pair | TAINT |
|
||||
| map.cpp:312:9:312:10 | i3 | map.cpp:312:8:312:8 | call to operator* | TAINT |
|
||||
| map.cpp:312:9:312:10 | ref arg i3 | map.cpp:310:24:310:25 | i3 | |
|
||||
| map.cpp:312:9:312:10 | ref arg i3 | map.cpp:310:40:310:41 | i3 | |
|
||||
| map.cpp:312:9:312:10 | ref arg i3 | map.cpp:312:9:312:10 | i3 | |
|
||||
| map.cpp:312:9:312:10 | ref arg i3 | map.cpp:313:8:313:9 | i3 | |
|
||||
| map.cpp:312:9:312:10 | ref arg i3 | map.cpp:314:8:314:9 | i3 | |
|
||||
| map.cpp:313:8:313:9 | i3 | map.cpp:313:10:313:10 | call to operator-> | TAINT |
|
||||
| map.cpp:313:8:313:9 | ref arg i3 | map.cpp:310:24:310:25 | i3 | |
|
||||
| map.cpp:313:8:313:9 | ref arg i3 | map.cpp:310:40:310:41 | i3 | |
|
||||
| map.cpp:313:8:313:9 | ref arg i3 | map.cpp:312:9:312:10 | i3 | |
|
||||
| map.cpp:313:8:313:9 | ref arg i3 | map.cpp:313:8:313:9 | i3 | |
|
||||
| map.cpp:313:8:313:9 | ref arg i3 | map.cpp:314:8:314:9 | i3 | |
|
||||
| map.cpp:314:8:314:9 | i3 | map.cpp:314:10:314:10 | call to operator-> | TAINT |
|
||||
| map.cpp:314:8:314:9 | ref arg i3 | map.cpp:310:24:310:25 | i3 | |
|
||||
| map.cpp:314:8:314:9 | ref arg i3 | map.cpp:310:40:310:41 | i3 | |
|
||||
| map.cpp:314:8:314:9 | ref arg i3 | map.cpp:312:9:312:10 | i3 | |
|
||||
| map.cpp:314:8:314:9 | ref arg i3 | map.cpp:313:8:313:9 | i3 | |
|
||||
| map.cpp:314:8:314:9 | ref arg i3 | map.cpp:314:8:314:9 | i3 | |
|
||||
| map.cpp:318:37:318:39 | call to unordered_map | map.cpp:319:7:319:9 | m10 | |
|
||||
| map.cpp:318:37:318:39 | call to unordered_map | map.cpp:323:7:323:9 | m10 | |
|
||||
| map.cpp:318:37:318:39 | call to unordered_map | map.cpp:438:1:438:1 | m10 | |
|
||||
@@ -2347,6 +2448,9 @@
|
||||
| set.cpp:55:40:55:41 | ref arg i1 | set.cpp:55:40:55:41 | i1 | |
|
||||
| set.cpp:55:40:55:41 | ref arg i1 | set.cpp:57:9:57:10 | i1 | |
|
||||
| set.cpp:57:9:57:10 | i1 | set.cpp:57:8:57:8 | call to operator* | TAINT |
|
||||
| set.cpp:57:9:57:10 | ref arg i1 | set.cpp:55:24:55:25 | i1 | |
|
||||
| set.cpp:57:9:57:10 | ref arg i1 | set.cpp:55:40:55:41 | i1 | |
|
||||
| set.cpp:57:9:57:10 | ref arg i1 | set.cpp:57:9:57:10 | i1 | |
|
||||
| set.cpp:59:12:59:13 | ref arg s2 | set.cpp:59:30:59:31 | s2 | |
|
||||
| set.cpp:59:12:59:13 | ref arg s2 | set.cpp:126:1:126:1 | s2 | |
|
||||
| set.cpp:59:12:59:13 | s2 | set.cpp:59:15:59:19 | call to begin | TAINT |
|
||||
@@ -2362,6 +2466,9 @@
|
||||
| set.cpp:59:40:59:41 | ref arg i2 | set.cpp:59:40:59:41 | i2 | |
|
||||
| set.cpp:59:40:59:41 | ref arg i2 | set.cpp:61:9:61:10 | i2 | |
|
||||
| set.cpp:61:9:61:10 | i2 | set.cpp:61:8:61:8 | call to operator* | TAINT |
|
||||
| set.cpp:61:9:61:10 | ref arg i2 | set.cpp:59:24:59:25 | i2 | |
|
||||
| set.cpp:61:9:61:10 | ref arg i2 | set.cpp:59:40:59:41 | i2 | |
|
||||
| set.cpp:61:9:61:10 | ref arg i2 | set.cpp:61:9:61:10 | i2 | |
|
||||
| set.cpp:65:19:65:21 | call to set | set.cpp:66:2:66:4 | s11 | |
|
||||
| set.cpp:65:19:65:21 | call to set | set.cpp:67:2:67:4 | s11 | |
|
||||
| set.cpp:65:19:65:21 | call to set | set.cpp:68:2:68:4 | s11 | |
|
||||
@@ -2845,6 +2952,9 @@
|
||||
| set.cpp:169:40:169:41 | ref arg i1 | set.cpp:169:40:169:41 | i1 | |
|
||||
| set.cpp:169:40:169:41 | ref arg i1 | set.cpp:171:9:171:10 | i1 | |
|
||||
| set.cpp:171:9:171:10 | i1 | set.cpp:171:8:171:8 | call to operator* | TAINT |
|
||||
| set.cpp:171:9:171:10 | ref arg i1 | set.cpp:169:24:169:25 | i1 | |
|
||||
| set.cpp:171:9:171:10 | ref arg i1 | set.cpp:169:40:169:41 | i1 | |
|
||||
| set.cpp:171:9:171:10 | ref arg i1 | set.cpp:171:9:171:10 | i1 | |
|
||||
| set.cpp:173:12:173:13 | ref arg s2 | set.cpp:173:30:173:31 | s2 | |
|
||||
| set.cpp:173:12:173:13 | ref arg s2 | set.cpp:238:1:238:1 | s2 | |
|
||||
| set.cpp:173:12:173:13 | s2 | set.cpp:173:15:173:19 | call to begin | TAINT |
|
||||
@@ -2860,6 +2970,9 @@
|
||||
| set.cpp:173:40:173:41 | ref arg i2 | set.cpp:173:40:173:41 | i2 | |
|
||||
| set.cpp:173:40:173:41 | ref arg i2 | set.cpp:175:9:175:10 | i2 | |
|
||||
| set.cpp:175:9:175:10 | i2 | set.cpp:175:8:175:8 | call to operator* | TAINT |
|
||||
| set.cpp:175:9:175:10 | ref arg i2 | set.cpp:173:24:173:25 | i2 | |
|
||||
| set.cpp:175:9:175:10 | ref arg i2 | set.cpp:173:40:173:41 | i2 | |
|
||||
| set.cpp:175:9:175:10 | ref arg i2 | set.cpp:175:9:175:10 | i2 | |
|
||||
| set.cpp:179:29:179:31 | call to unordered_set | set.cpp:180:2:180:4 | s11 | |
|
||||
| set.cpp:179:29:179:31 | call to unordered_set | set.cpp:181:2:181:4 | s11 | |
|
||||
| set.cpp:179:29:179:31 | call to unordered_set | set.cpp:182:2:182:4 | s11 | |
|
||||
@@ -3111,21 +3224,27 @@
|
||||
| smart_pointer.cpp:11:30:11:50 | call to make_shared | smart_pointer.cpp:13:10:13:10 | p | |
|
||||
| smart_pointer.cpp:11:52:11:57 | call to source | smart_pointer.cpp:11:30:11:50 | call to make_shared | TAINT |
|
||||
| smart_pointer.cpp:12:11:12:11 | p | smart_pointer.cpp:12:10:12:10 | call to operator* | TAINT |
|
||||
| smart_pointer.cpp:12:11:12:11 | ref arg p | smart_pointer.cpp:13:10:13:10 | p | |
|
||||
| smart_pointer.cpp:17:32:17:54 | call to make_shared | smart_pointer.cpp:18:11:18:11 | p | |
|
||||
| smart_pointer.cpp:17:32:17:54 | call to make_shared | smart_pointer.cpp:19:10:19:10 | p | |
|
||||
| smart_pointer.cpp:18:11:18:11 | p | smart_pointer.cpp:18:10:18:10 | call to operator* | TAINT |
|
||||
| smart_pointer.cpp:18:11:18:11 | ref arg p | smart_pointer.cpp:19:10:19:10 | p | |
|
||||
| smart_pointer.cpp:23:30:23:50 | call to make_unique | smart_pointer.cpp:24:11:24:11 | p | |
|
||||
| smart_pointer.cpp:23:30:23:50 | call to make_unique | smart_pointer.cpp:25:10:25:10 | p | |
|
||||
| smart_pointer.cpp:23:52:23:57 | call to source | smart_pointer.cpp:23:30:23:50 | call to make_unique | TAINT |
|
||||
| smart_pointer.cpp:24:11:24:11 | p | smart_pointer.cpp:24:10:24:10 | call to operator* | TAINT |
|
||||
| smart_pointer.cpp:24:11:24:11 | ref arg p | smart_pointer.cpp:25:10:25:10 | p | |
|
||||
| smart_pointer.cpp:29:32:29:54 | call to make_unique | smart_pointer.cpp:30:11:30:11 | p | |
|
||||
| smart_pointer.cpp:29:32:29:54 | call to make_unique | smart_pointer.cpp:31:10:31:10 | p | |
|
||||
| smart_pointer.cpp:30:11:30:11 | p | smart_pointer.cpp:30:10:30:10 | call to operator* | TAINT |
|
||||
| smart_pointer.cpp:30:11:30:11 | ref arg p | smart_pointer.cpp:31:10:31:10 | p | |
|
||||
| smart_pointer.cpp:35:30:35:50 | call to make_shared | smart_pointer.cpp:37:6:37:6 | p | |
|
||||
| smart_pointer.cpp:35:30:35:50 | call to make_shared | smart_pointer.cpp:38:10:38:10 | p | |
|
||||
| smart_pointer.cpp:35:30:35:50 | call to make_shared | smart_pointer.cpp:39:11:39:11 | p | |
|
||||
| smart_pointer.cpp:37:5:37:17 | ... = ... | smart_pointer.cpp:37:5:37:5 | call to operator* [post update] | |
|
||||
| smart_pointer.cpp:37:6:37:6 | p | smart_pointer.cpp:37:5:37:5 | call to operator* | TAINT |
|
||||
| smart_pointer.cpp:37:6:37:6 | ref arg p | smart_pointer.cpp:38:10:38:10 | p | |
|
||||
| smart_pointer.cpp:37:6:37:6 | ref arg p | smart_pointer.cpp:39:11:39:11 | p | |
|
||||
| smart_pointer.cpp:37:10:37:15 | call to source | smart_pointer.cpp:37:5:37:17 | ... = ... | |
|
||||
| smart_pointer.cpp:38:10:38:10 | ref arg p | smart_pointer.cpp:39:11:39:11 | p | |
|
||||
| smart_pointer.cpp:39:11:39:11 | p | smart_pointer.cpp:39:10:39:10 | call to operator* | TAINT |
|
||||
@@ -3134,6 +3253,8 @@
|
||||
| smart_pointer.cpp:43:29:43:51 | call to unique_ptr | smart_pointer.cpp:47:11:47:11 | p | |
|
||||
| smart_pointer.cpp:45:5:45:17 | ... = ... | smart_pointer.cpp:45:5:45:5 | call to operator* [post update] | |
|
||||
| smart_pointer.cpp:45:6:45:6 | p | smart_pointer.cpp:45:5:45:5 | call to operator* | TAINT |
|
||||
| smart_pointer.cpp:45:6:45:6 | ref arg p | smart_pointer.cpp:46:10:46:10 | p | |
|
||||
| smart_pointer.cpp:45:6:45:6 | ref arg p | smart_pointer.cpp:47:11:47:11 | p | |
|
||||
| smart_pointer.cpp:45:10:45:15 | call to source | smart_pointer.cpp:45:5:45:17 | ... = ... | |
|
||||
| smart_pointer.cpp:46:10:46:10 | ref arg p | smart_pointer.cpp:47:11:47:11 | p | |
|
||||
| smart_pointer.cpp:47:11:47:11 | p | smart_pointer.cpp:47:10:47:10 | call to operator* | TAINT |
|
||||
@@ -3147,6 +3268,7 @@
|
||||
| smart_pointer.cpp:65:28:65:46 | call to make_unique | smart_pointer.cpp:67:10:67:10 | p | |
|
||||
| smart_pointer.cpp:65:48:65:53 | call to source | smart_pointer.cpp:65:28:65:46 | call to make_unique | TAINT |
|
||||
| smart_pointer.cpp:65:58:65:58 | 0 | smart_pointer.cpp:65:28:65:46 | call to make_unique | TAINT |
|
||||
| smart_pointer.cpp:66:10:66:10 | ref arg p | smart_pointer.cpp:67:10:67:10 | p | |
|
||||
| standalone_iterators.cpp:39:45:39:51 | source1 | standalone_iterators.cpp:39:45:39:51 | source1 | |
|
||||
| standalone_iterators.cpp:39:45:39:51 | source1 | standalone_iterators.cpp:40:11:40:17 | source1 | |
|
||||
| standalone_iterators.cpp:39:45:39:51 | source1 | standalone_iterators.cpp:41:12:41:18 | source1 | |
|
||||
@@ -3458,6 +3580,9 @@
|
||||
| string.cpp:121:15:121:15 | ref arg (__begin) | string.cpp:121:15:121:15 | (__begin) | |
|
||||
| string.cpp:121:15:121:15 | ref arg (__begin) | string.cpp:121:15:121:15 | (__begin) | |
|
||||
| string.cpp:121:15:121:15 | ref arg (__begin) | string.cpp:121:15:121:15 | (__begin) | |
|
||||
| string.cpp:121:15:121:15 | ref arg (__begin) | string.cpp:121:15:121:15 | (__begin) | |
|
||||
| string.cpp:121:15:121:15 | ref arg (__begin) | string.cpp:121:15:121:15 | (__begin) | |
|
||||
| string.cpp:121:15:121:15 | ref arg (__begin) | string.cpp:121:15:121:15 | (__begin) | |
|
||||
| string.cpp:121:15:121:15 | ref arg (__range) | string.cpp:121:15:121:15 | (__range) | |
|
||||
| string.cpp:121:15:121:15 | s | string.cpp:121:15:121:15 | (__range) | |
|
||||
| string.cpp:121:15:121:15 | s | string.cpp:121:15:121:15 | (__range) | |
|
||||
@@ -3476,6 +3601,9 @@
|
||||
| string.cpp:125:61:125:62 | ref arg it | string.cpp:125:61:125:62 | it | |
|
||||
| string.cpp:125:61:125:62 | ref arg it | string.cpp:126:9:126:10 | it | |
|
||||
| string.cpp:126:9:126:10 | it | string.cpp:126:8:126:8 | call to operator* | TAINT |
|
||||
| string.cpp:126:9:126:10 | ref arg it | string.cpp:125:44:125:45 | it | |
|
||||
| string.cpp:126:9:126:10 | ref arg it | string.cpp:125:61:125:62 | it | |
|
||||
| string.cpp:126:9:126:10 | ref arg it | string.cpp:126:9:126:10 | it | |
|
||||
| string.cpp:129:16:129:16 | (__begin) | string.cpp:129:16:129:16 | call to operator* | TAINT |
|
||||
| string.cpp:129:16:129:16 | (__begin) | string.cpp:129:16:129:16 | call to operator++ | |
|
||||
| string.cpp:129:16:129:16 | (__end) | string.cpp:129:16:129:16 | call to iterator | |
|
||||
@@ -3489,6 +3617,9 @@
|
||||
| string.cpp:129:16:129:16 | ref arg (__begin) | string.cpp:129:16:129:16 | (__begin) | |
|
||||
| string.cpp:129:16:129:16 | ref arg (__begin) | string.cpp:129:16:129:16 | (__begin) | |
|
||||
| string.cpp:129:16:129:16 | ref arg (__begin) | string.cpp:129:16:129:16 | (__begin) | |
|
||||
| string.cpp:129:16:129:16 | ref arg (__begin) | string.cpp:129:16:129:16 | (__begin) | |
|
||||
| string.cpp:129:16:129:16 | ref arg (__begin) | string.cpp:129:16:129:16 | (__begin) | |
|
||||
| string.cpp:129:16:129:16 | ref arg (__begin) | string.cpp:129:16:129:16 | (__begin) | |
|
||||
| string.cpp:129:16:129:16 | ref arg (__range) | string.cpp:129:16:129:16 | (__range) | |
|
||||
| string.cpp:129:16:129:16 | s | string.cpp:129:16:129:16 | (__range) | |
|
||||
| string.cpp:129:16:129:16 | s | string.cpp:129:16:129:16 | (__range) | |
|
||||
@@ -3857,11 +3988,13 @@
|
||||
| string.cpp:376:31:376:35 | call to begin | string.cpp:378:9:378:13 | iter1 | |
|
||||
| string.cpp:376:31:376:35 | call to begin | string.cpp:379:8:379:12 | iter1 | |
|
||||
| string.cpp:378:9:378:13 | iter1 | string.cpp:378:8:378:8 | call to operator* | TAINT |
|
||||
| string.cpp:378:9:378:13 | ref arg iter1 | string.cpp:379:8:379:12 | iter1 | |
|
||||
| string.cpp:379:8:379:12 | iter1 | string.cpp:379:13:379:13 | call to operator[] | TAINT |
|
||||
| string.cpp:380:28:380:29 | s2 | string.cpp:380:31:380:35 | call to begin | TAINT |
|
||||
| string.cpp:380:31:380:35 | call to begin | string.cpp:382:9:382:13 | iter2 | |
|
||||
| string.cpp:380:31:380:35 | call to begin | string.cpp:383:8:383:12 | iter2 | |
|
||||
| string.cpp:382:9:382:13 | iter2 | string.cpp:382:8:382:8 | call to operator* | TAINT |
|
||||
| string.cpp:382:9:382:13 | ref arg iter2 | string.cpp:383:8:383:12 | iter2 | |
|
||||
| string.cpp:383:8:383:12 | iter2 | string.cpp:383:13:383:13 | call to operator[] | TAINT |
|
||||
| string.cpp:388:18:388:24 | hello | string.cpp:388:18:388:25 | call to basic_string | TAINT |
|
||||
| string.cpp:388:18:388:25 | call to basic_string | string.cpp:391:25:391:26 | s1 | |
|
||||
@@ -3905,10 +4038,12 @@
|
||||
| string.cpp:398:8:398:9 | i2 | string.cpp:398:3:398:9 | ... = ... | |
|
||||
| string.cpp:398:8:398:9 | i2 | string.cpp:399:12:399:13 | i3 | |
|
||||
| string.cpp:399:10:399:10 | call to operator++ | string.cpp:399:8:399:8 | call to operator* | TAINT |
|
||||
| string.cpp:399:10:399:10 | ref arg call to operator++ | string.cpp:399:12:399:13 | ref arg i3 | |
|
||||
| string.cpp:399:12:399:13 | i3 | string.cpp:399:10:399:10 | call to operator++ | |
|
||||
| string.cpp:400:8:400:9 | i2 | string.cpp:400:3:400:9 | ... = ... | |
|
||||
| string.cpp:400:8:400:9 | i2 | string.cpp:401:12:401:13 | i4 | |
|
||||
| string.cpp:401:10:401:10 | call to operator-- | string.cpp:401:8:401:8 | call to operator* | TAINT |
|
||||
| string.cpp:401:10:401:10 | ref arg call to operator-- | string.cpp:401:12:401:13 | ref arg i4 | |
|
||||
| string.cpp:401:12:401:13 | i4 | string.cpp:401:10:401:10 | call to operator-- | |
|
||||
| string.cpp:402:8:402:9 | i2 | string.cpp:402:3:402:9 | ... = ... | |
|
||||
| string.cpp:402:8:402:9 | i2 | string.cpp:403:3:403:4 | i5 | |
|
||||
@@ -3926,11 +4061,13 @@
|
||||
| string.cpp:408:8:408:9 | i2 | string.cpp:409:10:409:11 | i7 | |
|
||||
| string.cpp:409:10:409:11 | i7 | string.cpp:409:12:409:12 | call to operator+= | |
|
||||
| string.cpp:409:12:409:12 | call to operator+= | string.cpp:409:8:409:8 | call to operator* | TAINT |
|
||||
| string.cpp:409:12:409:12 | ref arg call to operator+= | string.cpp:409:10:409:11 | ref arg i7 | TAINT |
|
||||
| string.cpp:409:14:409:14 | 1 | string.cpp:409:10:409:11 | ref arg i7 | TAINT |
|
||||
| string.cpp:410:8:410:9 | i2 | string.cpp:410:3:410:9 | ... = ... | |
|
||||
| string.cpp:410:8:410:9 | i2 | string.cpp:411:10:411:11 | i8 | |
|
||||
| string.cpp:411:10:411:11 | i8 | string.cpp:411:12:411:12 | call to operator-= | |
|
||||
| string.cpp:411:12:411:12 | call to operator-= | string.cpp:411:8:411:8 | call to operator* | TAINT |
|
||||
| string.cpp:411:12:411:12 | ref arg call to operator-= | string.cpp:411:10:411:11 | ref arg i8 | TAINT |
|
||||
| string.cpp:411:14:411:14 | 1 | string.cpp:411:10:411:11 | ref arg i8 | TAINT |
|
||||
| string.cpp:413:8:413:9 | s2 | string.cpp:413:11:413:13 | call to end | TAINT |
|
||||
| string.cpp:413:11:413:13 | call to end | string.cpp:413:3:413:15 | ... = ... | |
|
||||
@@ -6104,6 +6241,7 @@
|
||||
| taint.cpp:655:35:655:40 | source | taint.cpp:657:20:657:25 | source | |
|
||||
| taint.cpp:656:27:656:27 | c | taint.cpp:657:10:657:10 | c | |
|
||||
| taint.cpp:656:27:656:27 | c | taint.cpp:658:8:658:8 | c | |
|
||||
| taint.cpp:657:10:657:10 | ref arg c | taint.cpp:658:8:658:8 | c | |
|
||||
| taint.cpp:657:12:657:15 | call to data | taint.cpp:657:3:657:8 | call to memcpy | |
|
||||
| taint.cpp:657:20:657:25 | source | taint.cpp:657:3:657:8 | call to memcpy | TAINT |
|
||||
| taint.cpp:657:20:657:25 | source | taint.cpp:657:12:657:15 | ref arg call to data | TAINT |
|
||||
@@ -6128,6 +6266,9 @@
|
||||
| vector.cpp:19:14:19:14 | ref arg (__begin) | vector.cpp:19:14:19:14 | (__begin) | |
|
||||
| vector.cpp:19:14:19:14 | ref arg (__begin) | vector.cpp:19:14:19:14 | (__begin) | |
|
||||
| vector.cpp:19:14:19:14 | ref arg (__begin) | vector.cpp:19:14:19:14 | (__begin) | |
|
||||
| vector.cpp:19:14:19:14 | ref arg (__begin) | vector.cpp:19:14:19:14 | (__begin) | |
|
||||
| vector.cpp:19:14:19:14 | ref arg (__begin) | vector.cpp:19:14:19:14 | (__begin) | |
|
||||
| vector.cpp:19:14:19:14 | ref arg (__begin) | vector.cpp:19:14:19:14 | (__begin) | |
|
||||
| vector.cpp:19:14:19:14 | ref arg (__range) | vector.cpp:19:14:19:14 | (__range) | |
|
||||
| vector.cpp:19:14:19:14 | v | vector.cpp:19:14:19:14 | (__range) | |
|
||||
| vector.cpp:19:14:19:14 | v | vector.cpp:19:14:19:14 | (__range) | |
|
||||
@@ -6148,6 +6289,9 @@
|
||||
| vector.cpp:23:66:23:67 | ref arg it | vector.cpp:23:66:23:67 | it | |
|
||||
| vector.cpp:23:66:23:67 | ref arg it | vector.cpp:24:9:24:10 | it | |
|
||||
| vector.cpp:24:9:24:10 | it | vector.cpp:24:8:24:8 | call to operator* | TAINT |
|
||||
| vector.cpp:24:9:24:10 | ref arg it | vector.cpp:23:49:23:50 | it | |
|
||||
| vector.cpp:24:9:24:10 | ref arg it | vector.cpp:23:66:23:67 | it | |
|
||||
| vector.cpp:24:9:24:10 | ref arg it | vector.cpp:24:9:24:10 | it | |
|
||||
| vector.cpp:27:15:27:15 | (__begin) | vector.cpp:27:15:27:15 | call to operator* | TAINT |
|
||||
| vector.cpp:27:15:27:15 | (__begin) | vector.cpp:27:15:27:15 | call to operator++ | |
|
||||
| vector.cpp:27:15:27:15 | (__end) | vector.cpp:27:15:27:15 | call to iterator | |
|
||||
@@ -6161,6 +6305,9 @@
|
||||
| vector.cpp:27:15:27:15 | ref arg (__begin) | vector.cpp:27:15:27:15 | (__begin) | |
|
||||
| vector.cpp:27:15:27:15 | ref arg (__begin) | vector.cpp:27:15:27:15 | (__begin) | |
|
||||
| vector.cpp:27:15:27:15 | ref arg (__begin) | vector.cpp:27:15:27:15 | (__begin) | |
|
||||
| vector.cpp:27:15:27:15 | ref arg (__begin) | vector.cpp:27:15:27:15 | (__begin) | |
|
||||
| vector.cpp:27:15:27:15 | ref arg (__begin) | vector.cpp:27:15:27:15 | (__begin) | |
|
||||
| vector.cpp:27:15:27:15 | ref arg (__begin) | vector.cpp:27:15:27:15 | (__begin) | |
|
||||
| vector.cpp:27:15:27:15 | ref arg (__range) | vector.cpp:27:15:27:15 | (__range) | |
|
||||
| vector.cpp:27:15:27:15 | v | vector.cpp:27:15:27:15 | (__range) | |
|
||||
| vector.cpp:27:15:27:15 | v | vector.cpp:27:15:27:15 | (__range) | |
|
||||
@@ -7084,16 +7231,20 @@
|
||||
| vector.cpp:329:62:329:65 | iter | vector.cpp:329:62:329:65 | iter | |
|
||||
| vector.cpp:329:62:329:65 | iter | vector.cpp:330:3:330:6 | iter | |
|
||||
| vector.cpp:330:2:330:2 | call to operator* [post update] | vector.cpp:329:62:329:65 | iter | |
|
||||
| vector.cpp:330:2:330:2 | call to operator* [post update] | vector.cpp:330:3:330:6 | ref arg iter | TAINT |
|
||||
| vector.cpp:330:2:330:17 | ... = ... | vector.cpp:330:2:330:2 | call to operator* [post update] | |
|
||||
| vector.cpp:330:3:330:6 | iter | vector.cpp:330:2:330:2 | call to operator* | TAINT |
|
||||
| vector.cpp:330:3:330:6 | ref arg iter | vector.cpp:329:62:329:65 | iter | |
|
||||
| vector.cpp:330:10:330:15 | call to source | vector.cpp:330:2:330:2 | call to operator* [post update] | TAINT |
|
||||
| vector.cpp:330:10:330:15 | call to source | vector.cpp:330:2:330:17 | ... = ... | |
|
||||
| vector.cpp:333:64:333:67 | iter | vector.cpp:333:64:333:67 | iter | |
|
||||
| vector.cpp:333:64:333:67 | iter | vector.cpp:334:3:334:6 | iter | |
|
||||
| vector.cpp:333:74:333:74 | i | vector.cpp:334:10:334:10 | i | |
|
||||
| vector.cpp:334:2:334:2 | call to operator* [post update] | vector.cpp:333:64:333:67 | iter | |
|
||||
| vector.cpp:334:2:334:2 | call to operator* [post update] | vector.cpp:334:3:334:6 | ref arg iter | TAINT |
|
||||
| vector.cpp:334:2:334:10 | ... = ... | vector.cpp:334:2:334:2 | call to operator* [post update] | |
|
||||
| vector.cpp:334:3:334:6 | iter | vector.cpp:334:2:334:2 | call to operator* | TAINT |
|
||||
| vector.cpp:334:3:334:6 | ref arg iter | vector.cpp:333:64:333:67 | iter | |
|
||||
| vector.cpp:334:10:334:10 | i | vector.cpp:334:2:334:2 | call to operator* [post update] | TAINT |
|
||||
| vector.cpp:334:10:334:10 | i | vector.cpp:334:2:334:10 | ... = ... | |
|
||||
| vector.cpp:337:38:337:38 | b | vector.cpp:372:5:372:5 | b | |
|
||||
@@ -7151,6 +7302,7 @@
|
||||
| vector.cpp:340:34:340:35 | ref arg v1 | vector.cpp:415:1:415:1 | v1 | |
|
||||
| vector.cpp:340:34:340:35 | v1 | vector.cpp:340:37:340:41 | call to begin | TAINT |
|
||||
| vector.cpp:340:37:340:41 | call to begin | vector.cpp:341:3:341:4 | i1 | |
|
||||
| vector.cpp:341:2:341:2 | call to operator* [post update] | vector.cpp:341:3:341:4 | ref arg i1 | TAINT |
|
||||
| vector.cpp:341:2:341:2 | call to operator* [post update] | vector.cpp:342:7:342:8 | v1 | |
|
||||
| vector.cpp:341:2:341:2 | call to operator* [post update] | vector.cpp:415:1:415:1 | v1 | |
|
||||
| vector.cpp:341:2:341:15 | ... = ... | vector.cpp:341:2:341:2 | call to operator* [post update] | |
|
||||
@@ -7174,10 +7326,14 @@
|
||||
| vector.cpp:344:68:344:69 | ref arg it | vector.cpp:344:68:344:69 | it | |
|
||||
| vector.cpp:344:68:344:69 | ref arg it | vector.cpp:345:4:345:5 | it | |
|
||||
| vector.cpp:345:3:345:3 | call to operator* [post update] | vector.cpp:344:56:344:57 | v2 | |
|
||||
| vector.cpp:345:3:345:3 | call to operator* [post update] | vector.cpp:345:4:345:5 | ref arg it | TAINT |
|
||||
| vector.cpp:345:3:345:3 | call to operator* [post update] | vector.cpp:347:7:347:8 | v2 | |
|
||||
| vector.cpp:345:3:345:3 | call to operator* [post update] | vector.cpp:415:1:415:1 | v2 | |
|
||||
| vector.cpp:345:3:345:16 | ... = ... | vector.cpp:345:3:345:3 | call to operator* [post update] | |
|
||||
| vector.cpp:345:4:345:5 | it | vector.cpp:345:3:345:3 | call to operator* | TAINT |
|
||||
| vector.cpp:345:4:345:5 | ref arg it | vector.cpp:344:50:344:51 | it | |
|
||||
| vector.cpp:345:4:345:5 | ref arg it | vector.cpp:344:68:344:69 | it | |
|
||||
| vector.cpp:345:4:345:5 | ref arg it | vector.cpp:345:4:345:5 | it | |
|
||||
| vector.cpp:345:9:345:14 | call to source | vector.cpp:345:3:345:3 | call to operator* [post update] | TAINT |
|
||||
| vector.cpp:345:9:345:14 | call to source | vector.cpp:345:3:345:16 | ... = ... | |
|
||||
| vector.cpp:347:7:347:8 | ref arg v2 | vector.cpp:415:1:415:1 | v2 | |
|
||||
@@ -7193,6 +7349,9 @@
|
||||
| vector.cpp:349:15:349:15 | ref arg (__begin) | vector.cpp:349:15:349:15 | (__begin) | |
|
||||
| vector.cpp:349:15:349:15 | ref arg (__begin) | vector.cpp:349:15:349:15 | (__begin) | |
|
||||
| vector.cpp:349:15:349:15 | ref arg (__begin) | vector.cpp:349:15:349:15 | (__begin) | |
|
||||
| vector.cpp:349:15:349:15 | ref arg (__begin) | vector.cpp:349:15:349:15 | (__begin) | |
|
||||
| vector.cpp:349:15:349:15 | ref arg (__begin) | vector.cpp:349:15:349:15 | (__begin) | |
|
||||
| vector.cpp:349:15:349:15 | ref arg (__begin) | vector.cpp:349:15:349:15 | (__begin) | |
|
||||
| vector.cpp:349:15:349:15 | ref arg (__range) | vector.cpp:349:15:349:15 | (__range) | |
|
||||
| vector.cpp:349:15:349:16 | v3 | vector.cpp:349:15:349:15 | (__range) | |
|
||||
| vector.cpp:349:15:349:16 | v3 | vector.cpp:349:15:349:15 | (__range) | |
|
||||
@@ -7229,15 +7388,18 @@
|
||||
| vector.cpp:359:34:359:35 | v5 | vector.cpp:359:37:359:41 | call to begin | TAINT |
|
||||
| vector.cpp:359:37:359:41 | call to begin | vector.cpp:360:3:360:4 | i5 | |
|
||||
| vector.cpp:359:37:359:41 | call to begin | vector.cpp:362:3:362:4 | i5 | |
|
||||
| vector.cpp:360:2:360:2 | call to operator* [post update] | vector.cpp:360:3:360:4 | ref arg i5 | TAINT |
|
||||
| vector.cpp:360:2:360:2 | call to operator* [post update] | vector.cpp:361:7:361:8 | v5 | |
|
||||
| vector.cpp:360:2:360:2 | call to operator* [post update] | vector.cpp:363:7:363:8 | v5 | |
|
||||
| vector.cpp:360:2:360:2 | call to operator* [post update] | vector.cpp:415:1:415:1 | v5 | |
|
||||
| vector.cpp:360:2:360:15 | ... = ... | vector.cpp:360:2:360:2 | call to operator* [post update] | |
|
||||
| vector.cpp:360:3:360:4 | i5 | vector.cpp:360:2:360:2 | call to operator* | TAINT |
|
||||
| vector.cpp:360:3:360:4 | ref arg i5 | vector.cpp:362:3:362:4 | i5 | |
|
||||
| vector.cpp:360:8:360:13 | call to source | vector.cpp:360:2:360:2 | call to operator* [post update] | TAINT |
|
||||
| vector.cpp:360:8:360:13 | call to source | vector.cpp:360:2:360:15 | ... = ... | |
|
||||
| vector.cpp:361:7:361:8 | ref arg v5 | vector.cpp:363:7:363:8 | v5 | |
|
||||
| vector.cpp:361:7:361:8 | ref arg v5 | vector.cpp:415:1:415:1 | v5 | |
|
||||
| vector.cpp:362:2:362:2 | call to operator* [post update] | vector.cpp:362:3:362:4 | ref arg i5 | TAINT |
|
||||
| vector.cpp:362:2:362:2 | call to operator* [post update] | vector.cpp:363:7:363:8 | v5 | |
|
||||
| vector.cpp:362:2:362:2 | call to operator* [post update] | vector.cpp:415:1:415:1 | v5 | |
|
||||
| vector.cpp:362:2:362:8 | ... = ... | vector.cpp:362:2:362:2 | call to operator* [post update] | |
|
||||
@@ -7251,6 +7413,7 @@
|
||||
| vector.cpp:365:34:365:35 | ref arg v6 | vector.cpp:415:1:415:1 | v6 | |
|
||||
| vector.cpp:365:34:365:35 | v6 | vector.cpp:365:37:365:41 | call to begin | TAINT |
|
||||
| vector.cpp:365:37:365:41 | call to begin | vector.cpp:366:3:366:4 | i6 | |
|
||||
| vector.cpp:366:2:366:2 | call to operator* [post update] | vector.cpp:366:3:366:4 | ref arg i6 | TAINT |
|
||||
| vector.cpp:366:2:366:2 | call to operator* [post update] | vector.cpp:367:7:367:8 | v6 | |
|
||||
| vector.cpp:366:2:366:2 | call to operator* [post update] | vector.cpp:368:2:368:3 | v6 | |
|
||||
| vector.cpp:366:2:366:2 | call to operator* [post update] | vector.cpp:369:7:369:8 | v6 | |
|
||||
@@ -7274,6 +7437,7 @@
|
||||
| vector.cpp:371:34:371:35 | v7 | vector.cpp:371:37:371:41 | call to begin | TAINT |
|
||||
| vector.cpp:371:37:371:41 | call to begin | vector.cpp:373:4:373:5 | i7 | |
|
||||
| vector.cpp:371:37:371:41 | call to begin | vector.cpp:376:4:376:5 | i7 | |
|
||||
| vector.cpp:373:3:373:3 | call to operator* [post update] | vector.cpp:373:4:373:5 | ref arg i7 | TAINT |
|
||||
| vector.cpp:373:3:373:3 | call to operator* [post update] | vector.cpp:374:8:374:9 | v7 | |
|
||||
| vector.cpp:373:3:373:3 | call to operator* [post update] | vector.cpp:379:7:379:8 | v7 | |
|
||||
| vector.cpp:373:3:373:3 | call to operator* [post update] | vector.cpp:415:1:415:1 | v7 | |
|
||||
@@ -7283,6 +7447,7 @@
|
||||
| vector.cpp:373:9:373:14 | call to source | vector.cpp:373:3:373:16 | ... = ... | |
|
||||
| vector.cpp:374:8:374:9 | ref arg v7 | vector.cpp:379:7:379:8 | v7 | |
|
||||
| vector.cpp:374:8:374:9 | ref arg v7 | vector.cpp:415:1:415:1 | v7 | |
|
||||
| vector.cpp:376:3:376:3 | call to operator* [post update] | vector.cpp:376:4:376:5 | ref arg i7 | TAINT |
|
||||
| vector.cpp:376:3:376:3 | call to operator* [post update] | vector.cpp:377:8:377:9 | v7 | |
|
||||
| vector.cpp:376:3:376:3 | call to operator* [post update] | vector.cpp:379:7:379:8 | v7 | |
|
||||
| vector.cpp:376:3:376:3 | call to operator* [post update] | vector.cpp:415:1:415:1 | v7 | |
|
||||
@@ -7299,15 +7464,18 @@
|
||||
| vector.cpp:381:34:381:35 | v8 | vector.cpp:381:37:381:41 | call to begin | TAINT |
|
||||
| vector.cpp:381:37:381:41 | call to begin | vector.cpp:382:3:382:4 | i8 | |
|
||||
| vector.cpp:381:37:381:41 | call to begin | vector.cpp:384:3:384:4 | i8 | |
|
||||
| vector.cpp:382:2:382:2 | call to operator* [post update] | vector.cpp:382:3:382:4 | ref arg i8 | TAINT |
|
||||
| vector.cpp:382:2:382:2 | call to operator* [post update] | vector.cpp:383:7:383:8 | v8 | |
|
||||
| vector.cpp:382:2:382:2 | call to operator* [post update] | vector.cpp:385:7:385:8 | v8 | |
|
||||
| vector.cpp:382:2:382:2 | call to operator* [post update] | vector.cpp:415:1:415:1 | v8 | |
|
||||
| vector.cpp:382:2:382:15 | ... = ... | vector.cpp:382:2:382:2 | call to operator* [post update] | |
|
||||
| vector.cpp:382:3:382:4 | i8 | vector.cpp:382:2:382:2 | call to operator* | TAINT |
|
||||
| vector.cpp:382:3:382:4 | ref arg i8 | vector.cpp:384:3:384:4 | i8 | |
|
||||
| vector.cpp:382:8:382:13 | call to source | vector.cpp:382:2:382:2 | call to operator* [post update] | TAINT |
|
||||
| vector.cpp:382:8:382:13 | call to source | vector.cpp:382:2:382:15 | ... = ... | |
|
||||
| vector.cpp:383:7:383:8 | ref arg v8 | vector.cpp:385:7:385:8 | v8 | |
|
||||
| vector.cpp:383:7:383:8 | ref arg v8 | vector.cpp:415:1:415:1 | v8 | |
|
||||
| vector.cpp:384:2:384:2 | call to operator* [post update] | vector.cpp:384:3:384:4 | ref arg i8 | TAINT |
|
||||
| vector.cpp:384:2:384:2 | call to operator* [post update] | vector.cpp:385:7:385:8 | v8 | |
|
||||
| vector.cpp:384:2:384:2 | call to operator* [post update] | vector.cpp:415:1:415:1 | v8 | |
|
||||
| vector.cpp:384:2:384:8 | ... = ... | vector.cpp:384:2:384:2 | call to operator* [post update] | |
|
||||
@@ -7320,10 +7488,12 @@
|
||||
| vector.cpp:387:34:387:35 | v9 | vector.cpp:387:37:387:41 | call to begin | TAINT |
|
||||
| vector.cpp:387:37:387:41 | call to begin | vector.cpp:389:3:389:4 | i9 | |
|
||||
| vector.cpp:387:37:387:41 | call to begin | vector.cpp:390:31:390:32 | i9 | |
|
||||
| vector.cpp:389:2:389:2 | call to operator* [post update] | vector.cpp:389:3:389:4 | ref arg i9 | TAINT |
|
||||
| vector.cpp:389:2:389:2 | call to operator* [post update] | vector.cpp:392:7:392:8 | v9 | |
|
||||
| vector.cpp:389:2:389:2 | call to operator* [post update] | vector.cpp:415:1:415:1 | v9 | |
|
||||
| vector.cpp:389:2:389:15 | ... = ... | vector.cpp:389:2:389:2 | call to operator* [post update] | |
|
||||
| vector.cpp:389:3:389:4 | i9 | vector.cpp:389:2:389:2 | call to operator* | TAINT |
|
||||
| vector.cpp:389:3:389:4 | ref arg i9 | vector.cpp:390:31:390:32 | i9 | |
|
||||
| vector.cpp:389:8:389:13 | call to source | vector.cpp:389:2:389:2 | call to operator* [post update] | TAINT |
|
||||
| vector.cpp:389:8:389:13 | call to source | vector.cpp:389:2:389:15 | ... = ... | |
|
||||
| vector.cpp:390:31:390:32 | call to iterator [post update] | vector.cpp:392:7:392:8 | v9 | |
|
||||
@@ -7365,6 +7535,7 @@
|
||||
| vector.cpp:403:6:403:6 | call to operator++ | vector.cpp:403:2:403:2 | call to operator* | TAINT |
|
||||
| vector.cpp:403:11:403:11 | 0 | vector.cpp:403:2:403:2 | call to operator* [post update] | TAINT |
|
||||
| vector.cpp:403:11:403:11 | 0 | vector.cpp:403:2:403:11 | ... = ... | |
|
||||
| vector.cpp:404:2:404:2 | call to operator* [post update] | vector.cpp:404:3:404:5 | ref arg i12 | TAINT |
|
||||
| vector.cpp:404:2:404:2 | call to operator* [post update] | vector.cpp:405:7:405:9 | v12 | |
|
||||
| vector.cpp:404:2:404:2 | call to operator* [post update] | vector.cpp:415:1:415:1 | v12 | |
|
||||
| vector.cpp:404:2:404:16 | ... = ... | vector.cpp:404:2:404:2 | call to operator* [post update] | |
|
||||
@@ -7595,12 +7766,18 @@
|
||||
| vector.cpp:526:11:526:15 | call to begin | vector.cpp:530:3:530:4 | it | |
|
||||
| vector.cpp:526:11:526:15 | call to begin | vector.cpp:531:9:531:10 | it | |
|
||||
| vector.cpp:527:9:527:10 | it | vector.cpp:527:8:527:8 | call to operator* | TAINT |
|
||||
| vector.cpp:527:9:527:10 | ref arg it | vector.cpp:528:3:528:4 | it | |
|
||||
| vector.cpp:527:9:527:10 | ref arg it | vector.cpp:529:9:529:10 | it | |
|
||||
| vector.cpp:527:9:527:10 | ref arg it | vector.cpp:530:3:530:4 | it | |
|
||||
| vector.cpp:527:9:527:10 | ref arg it | vector.cpp:531:9:531:10 | it | |
|
||||
| vector.cpp:528:3:528:4 | it | vector.cpp:528:6:528:6 | call to operator+= | |
|
||||
| vector.cpp:528:3:528:4 | ref arg it | vector.cpp:529:9:529:10 | it | |
|
||||
| vector.cpp:528:3:528:4 | ref arg it | vector.cpp:530:3:530:4 | it | |
|
||||
| vector.cpp:528:3:528:4 | ref arg it | vector.cpp:531:9:531:10 | it | |
|
||||
| vector.cpp:528:9:528:9 | 1 | vector.cpp:528:3:528:4 | ref arg it | TAINT |
|
||||
| vector.cpp:529:9:529:10 | it | vector.cpp:529:8:529:8 | call to operator* | TAINT |
|
||||
| vector.cpp:529:9:529:10 | ref arg it | vector.cpp:530:3:530:4 | it | |
|
||||
| vector.cpp:529:9:529:10 | ref arg it | vector.cpp:531:9:531:10 | it | |
|
||||
| vector.cpp:530:3:530:4 | it | vector.cpp:530:6:530:6 | call to operator+= | |
|
||||
| vector.cpp:530:3:530:4 | ref arg it | vector.cpp:531:9:531:10 | it | |
|
||||
| vector.cpp:530:9:530:14 | call to source | vector.cpp:530:3:530:4 | ref arg it | TAINT |
|
||||
|
||||
@@ -655,5 +655,5 @@ public:
|
||||
void test_with_const_member(char* source) {
|
||||
C_const_member_function c;
|
||||
memcpy(c.data(), source, 16);
|
||||
sink(c.data()); // $ MISSING: ast, ir
|
||||
sink(c.data()); // $ ast MISSING: ir
|
||||
}
|
||||
4
csharp/change-notes/2021-02-12-with-expression.md
Normal file
4
csharp/change-notes/2021-02-12-with-expression.md
Normal file
@@ -0,0 +1,4 @@
|
||||
lgtm,codescanning
|
||||
* C# 9 `with` expressions are now extracted. Data flow support has been added to
|
||||
handle flow through `with` expressions and also from `record` constructor arguments
|
||||
to its properties.
|
||||
@@ -95,11 +95,11 @@ namespace Semmle.Extraction.CIL
|
||||
/// <param name="h">The handle of the entity.</param>
|
||||
/// <param name="genericContext">The generic context.</param>
|
||||
/// <returns></returns>
|
||||
public IExtractedEntity CreateGeneric(GenericContext genericContext, Handle h) => genericHandleFactory[genericContext, h];
|
||||
public IExtractedEntity CreateGeneric(IGenericContext genericContext, Handle h) => genericHandleFactory[genericContext, h];
|
||||
|
||||
private readonly GenericContext defaultGenericContext;
|
||||
private readonly IGenericContext defaultGenericContext;
|
||||
|
||||
private IExtractedEntity CreateGenericHandle(GenericContext gc, Handle handle)
|
||||
private IExtractedEntity CreateGenericHandle(IGenericContext gc, Handle handle)
|
||||
{
|
||||
IExtractedEntity entity;
|
||||
switch (handle.Kind)
|
||||
@@ -136,7 +136,7 @@ namespace Semmle.Extraction.CIL
|
||||
return entity;
|
||||
}
|
||||
|
||||
private IExtractedEntity Create(GenericContext gc, MemberReferenceHandle handle)
|
||||
private IExtractedEntity Create(IGenericContext gc, MemberReferenceHandle handle)
|
||||
{
|
||||
var mr = MdReader.GetMemberReference(handle);
|
||||
switch (mr.GetKind())
|
||||
@@ -228,7 +228,7 @@ namespace Semmle.Extraction.CIL
|
||||
|
||||
#endregion
|
||||
|
||||
private readonly CachedFunction<GenericContext, Handle, IExtractedEntity> genericHandleFactory;
|
||||
private readonly CachedFunction<IGenericContext, Handle, IExtractedEntity> genericHandleFactory;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the short name of a member, without the preceding interface qualifier.
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Semmle.Extraction.CIL
|
||||
|
||||
globalNamespace = new Lazy<Entities.Namespace>(() => Populate(new Entities.Namespace(this, "", null)));
|
||||
systemNamespace = new Lazy<Entities.Namespace>(() => Populate(new Entities.Namespace(this, "System")));
|
||||
genericHandleFactory = new CachedFunction<GenericContext, Handle, IExtractedEntity>(CreateGenericHandle);
|
||||
genericHandleFactory = new CachedFunction<IGenericContext, Handle, IExtractedEntity>(CreateGenericHandle);
|
||||
namespaceFactory = new CachedFunction<StringHandle, Entities.Namespace>(n => CreateNamespace(MdReader.GetString(n)));
|
||||
namespaceDefinitionFactory = new CachedFunction<NamespaceDefinitionHandle, Entities.Namespace>(CreateNamespace);
|
||||
sourceFiles = new CachedFunction<PDB.ISourceFile, Entities.PdbSourceFile>(path => new Entities.PdbSourceFile(this, path));
|
||||
|
||||
@@ -5,14 +5,18 @@ namespace Semmle.Extraction.CIL
|
||||
/// <summary>
|
||||
/// A generic context which does not contain any type parameters.
|
||||
/// </summary>
|
||||
public class EmptyContext : GenericContext
|
||||
public class EmptyContext : IGenericContext
|
||||
{
|
||||
public EmptyContext(Context cx) : base(cx)
|
||||
public EmptyContext(Context cx)
|
||||
{
|
||||
Cx = cx;
|
||||
}
|
||||
|
||||
public override IEnumerable<Entities.Type> TypeParameters { get { yield break; } }
|
||||
public Context Cx { get; }
|
||||
|
||||
public IEnumerable<Entities.Type> TypeParameters { get { yield break; } }
|
||||
|
||||
public IEnumerable<Entities.Type> MethodParameters { get { yield break; } }
|
||||
|
||||
public override IEnumerable<Entities.Type> MethodParameters { get { yield break; } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
trapFile.Write(FullName);
|
||||
trapFile.Write("#file:///");
|
||||
trapFile.Write(Cx.AssemblyPath.Replace("\\", "/"));
|
||||
trapFile.Write(";assembly");
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
@@ -49,8 +50,6 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
|
||||
public override int GetHashCode() => 7 * file.GetHashCode();
|
||||
|
||||
public override string IdSuffix => ";assembly";
|
||||
|
||||
private string FullName => assemblyName.GetPublicKey() is null ? assemblyName.FullName + ", PublicKeyToken=null" : assemblyName.FullName;
|
||||
|
||||
public override IEnumerable<IExtractionProduct> Contents
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
{
|
||||
private readonly CustomAttributeHandle handle;
|
||||
private readonly CustomAttribute attrib;
|
||||
private readonly IEntity @object;
|
||||
private readonly IExtractedEntity @object;
|
||||
|
||||
public Attribute(Context cx, IEntity @object, CustomAttributeHandle handle) : base(cx)
|
||||
public Attribute(Context cx, IExtractedEntity @object, CustomAttributeHandle handle) : base(cx)
|
||||
{
|
||||
attrib = cx.MdReader.GetCustomAttribute(handle);
|
||||
this.handle = handle;
|
||||
@@ -80,7 +80,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
return value?.ToString() ?? "null";
|
||||
}
|
||||
|
||||
public static IEnumerable<IExtractionProduct> Populate(Context cx, IEntity @object, CustomAttributeHandleCollection attributes)
|
||||
public static IEnumerable<IExtractionProduct> Populate(Context cx, IExtractedEntity @object, CustomAttributeHandleCollection attributes)
|
||||
{
|
||||
foreach (var attrib in attributes)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Semmle.Extraction.CIL
|
||||
{
|
||||
/// <summary>
|
||||
/// A CIL entity which has been extracted.
|
||||
/// </summary>
|
||||
public interface IExtractedEntity : IExtractionProduct, IEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// The contents of the entity.
|
||||
/// </summary>
|
||||
|
||||
IEnumerable<IExtractionProduct> Contents { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace Semmle.Extraction.CIL
|
||||
{
|
||||
/// <summary>
|
||||
/// Something that is extracted from an entity.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// The extraction algorithm proceeds as follows:
|
||||
/// - Construct entity
|
||||
/// - Call Extract()
|
||||
/// - IExtractedEntity check if already extracted
|
||||
/// - Enumerate Contents to produce more extraction products
|
||||
/// - Extract these until there is nothing left to extract
|
||||
/// </remarks>
|
||||
public interface IExtractionProduct
|
||||
{
|
||||
/// <summary>
|
||||
/// Perform further extraction/population of this item as necessary.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="cx">The extraction context.</param>
|
||||
void Extract(Context cx);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Semmle.Extraction.CIL
|
||||
{
|
||||
/// <summary>
|
||||
/// When we decode a type/method signature, we need access to
|
||||
/// generic parameters.
|
||||
/// </summary>
|
||||
public interface IGenericContext
|
||||
{
|
||||
Context Cx { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The list of generic type parameters/arguments, including type parameters/arguments of
|
||||
/// containing types.
|
||||
/// </summary>
|
||||
IEnumerable<Entities.Type> TypeParameters { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The list of generic method parameters/arguments.
|
||||
/// </summary>
|
||||
IEnumerable<Entities.Type> MethodParameters { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Semmle.Extraction.CIL
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity that needs to be populated during extraction.
|
||||
/// This assigns a key and optionally extracts its contents.
|
||||
/// </summary>
|
||||
public abstract class LabelledEntity : Extraction.LabelledEntity, IExtractedEntity
|
||||
{
|
||||
// todo: with .NET 5 this can override the base context, and change the return type.
|
||||
public Context Cx { get; }
|
||||
|
||||
protected LabelledEntity(Context cx) : base(cx.Cx)
|
||||
{
|
||||
this.Cx = cx;
|
||||
}
|
||||
|
||||
public override Microsoft.CodeAnalysis.Location ReportingLocation => throw new NotImplementedException();
|
||||
|
||||
public void Extract(Context cx2)
|
||||
{
|
||||
cx2.Populate(this);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
using var writer = new StringWriter();
|
||||
WriteQuotedId(writer);
|
||||
return writer.ToString();
|
||||
}
|
||||
|
||||
public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel;
|
||||
|
||||
public abstract IEnumerable<IExtractionProduct> Contents { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace Semmle.Extraction.CIL
|
||||
{
|
||||
/// <summary>
|
||||
/// A tuple that is an extraction product.
|
||||
/// </summary>
|
||||
internal class Tuple : IExtractionProduct
|
||||
{
|
||||
private readonly Extraction.Tuple tuple;
|
||||
|
||||
public Tuple(string name, params object[] args)
|
||||
{
|
||||
tuple = new Extraction.Tuple(name, args);
|
||||
}
|
||||
|
||||
public void Extract(Context cx)
|
||||
{
|
||||
cx.Cx.Emit(tuple);
|
||||
}
|
||||
|
||||
public override string ToString() => tuple.ToString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Semmle.Extraction.CIL
|
||||
{
|
||||
/// <summary>
|
||||
/// An entity that has contents to extract. There is no need to populate
|
||||
/// a key as it's done in the contructor.
|
||||
/// </summary>
|
||||
public abstract class UnlabelledEntity : Extraction.UnlabelledEntity, IExtractedEntity
|
||||
{
|
||||
// todo: with .NET 5 this can override the base context, and change the return type.
|
||||
public Context Cx { get; }
|
||||
|
||||
protected UnlabelledEntity(Context cx) : base(cx.Cx)
|
||||
{
|
||||
Cx = cx;
|
||||
}
|
||||
|
||||
public override Microsoft.CodeAnalysis.Location ReportingLocation => throw new NotImplementedException();
|
||||
|
||||
public void Extract(Context cx2)
|
||||
{
|
||||
cx2.Extract(this);
|
||||
}
|
||||
|
||||
public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel;
|
||||
|
||||
public abstract IEnumerable<IExtractionProduct> Contents { get; }
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
|
||||
public override IList<LocalVariable>? LocalVariables => locals;
|
||||
|
||||
public DefinitionMethod(GenericContext gc, MethodDefinitionHandle handle) : base(gc)
|
||||
public DefinitionMethod(IGenericContext gc, MethodDefinitionHandle handle) : base(gc)
|
||||
{
|
||||
md = Cx.MdReader.GetMethodDefinition(handle);
|
||||
this.gc = gc;
|
||||
|
||||
@@ -25,10 +25,9 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
parent.WriteId(trapFile);
|
||||
trapFile.Write('.');
|
||||
trapFile.Write(Cx.ShortName(ed.Name));
|
||||
trapFile.Write(";cil-event");
|
||||
}
|
||||
|
||||
public override string IdSuffix => ";cil-event";
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is Event e && handle.Equals(e.handle);
|
||||
|
||||
@@ -7,13 +7,13 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
/// </summary>
|
||||
internal class ExceptionRegion : UnlabelledEntity
|
||||
{
|
||||
private readonly GenericContext gc;
|
||||
private readonly IGenericContext gc;
|
||||
private readonly MethodImplementation method;
|
||||
private readonly int index;
|
||||
private readonly System.Reflection.Metadata.ExceptionRegion r;
|
||||
private readonly Dictionary<int, Instruction> jump_table;
|
||||
|
||||
public ExceptionRegion(GenericContext gc, MethodImplementation method, int index, System.Reflection.Metadata.ExceptionRegion r, Dictionary<int, Instruction> jump_table) : base(gc.Cx)
|
||||
public ExceptionRegion(IGenericContext gc, MethodImplementation method, int index, System.Reflection.Metadata.ExceptionRegion r, Dictionary<int, Instruction> jump_table) : base(gc.Cx)
|
||||
{
|
||||
this.gc = gc;
|
||||
this.method = method;
|
||||
|
||||
@@ -8,40 +8,27 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
/// <summary>
|
||||
/// An entity representing a field.
|
||||
/// </summary>
|
||||
internal abstract class Field : GenericContext, IMember, ICustomModifierReceiver
|
||||
internal abstract class Field : LabelledEntity, IGenericContext, IMember, ICustomModifierReceiver
|
||||
{
|
||||
protected Field(Context cx) : base(cx)
|
||||
{
|
||||
}
|
||||
|
||||
public Label Label { get; set; }
|
||||
|
||||
public void WriteId(TextWriter trapFile)
|
||||
public override void WriteId(TextWriter trapFile)
|
||||
{
|
||||
trapFile.WriteSubId(DeclaringType);
|
||||
trapFile.Write('.');
|
||||
trapFile.Write(Name);
|
||||
trapFile.Write(";cil-field");
|
||||
}
|
||||
|
||||
public void WriteQuotedId(TextWriter trapFile)
|
||||
{
|
||||
trapFile.Write("@\"");
|
||||
WriteId(trapFile);
|
||||
trapFile.Write(idSuffix);
|
||||
trapFile.Write('\"');
|
||||
}
|
||||
|
||||
private const string idSuffix = ";cil-field";
|
||||
|
||||
public abstract string Name { get; }
|
||||
|
||||
public abstract Type DeclaringType { get; }
|
||||
|
||||
public Location ReportingLocation => throw new NotImplementedException();
|
||||
|
||||
public abstract Type Type { get; }
|
||||
|
||||
public virtual IEnumerable<IExtractionProduct> Contents
|
||||
public override IEnumerable<IExtractionProduct> Contents
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -55,11 +42,8 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public void Extract(Context cx2)
|
||||
{
|
||||
cx2.Populate(this);
|
||||
}
|
||||
public abstract IEnumerable<Type> TypeParameters { get; }
|
||||
|
||||
TrapStackBehaviour IEntity.TrapStackBehaviour => TrapStackBehaviour.NoLabel;
|
||||
public abstract IEnumerable<Type> MethodParameters { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
public override void WriteId(TextWriter trapFile)
|
||||
{
|
||||
trapFile.Write(TransformedPath.DatabaseId);
|
||||
trapFile.Write(";sourcefile");
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
@@ -39,7 +40,5 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
yield return Tuples.files(this, TransformedPath.Value, TransformedPath.NameWithoutExtension, TransformedPath.Extension);
|
||||
}
|
||||
}
|
||||
|
||||
public override string IdSuffix => ";sourcefile";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,9 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
public override void WriteId(TextWriter trapFile)
|
||||
{
|
||||
trapFile.Write(transformedPath.DatabaseId);
|
||||
trapFile.Write(";folder");
|
||||
}
|
||||
|
||||
public override string IdSuffix => ";folder";
|
||||
|
||||
public override IEnumerable<IExtractionProduct> Contents
|
||||
{
|
||||
get
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
{
|
||||
internal interface ITypeSignature
|
||||
{
|
||||
void WriteId(TextWriter trapFile, GenericContext gc);
|
||||
void WriteId(TextWriter trapFile, IGenericContext gc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
/// <summary>
|
||||
/// A CIL instruction.
|
||||
/// </summary>
|
||||
internal class Instruction : UnlabelledEntity, IEntity
|
||||
internal class Instruction : UnlabelledEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// The additional data following the opcode, if any.
|
||||
@@ -289,11 +289,6 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
}
|
||||
}
|
||||
|
||||
Label IEntity.Label
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
private readonly byte[] data;
|
||||
|
||||
private int PayloadSize => payloadSizes[(int)PayloadType];
|
||||
|
||||
@@ -21,10 +21,9 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
trapFile.WriteSubId(method);
|
||||
trapFile.Write('_');
|
||||
trapFile.Write(index);
|
||||
trapFile.Write(";cil-local");
|
||||
}
|
||||
|
||||
public override string IdSuffix => ";cil-local";
|
||||
|
||||
public override IEnumerable<IExtractionProduct> Contents
|
||||
{
|
||||
get
|
||||
|
||||
@@ -8,10 +8,10 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
{
|
||||
private readonly MemberReferenceHandle handle;
|
||||
private readonly MemberReference mr;
|
||||
private readonly GenericContext gc;
|
||||
private readonly IGenericContext gc;
|
||||
private readonly Type declType;
|
||||
|
||||
public MemberReferenceField(GenericContext gc, MemberReferenceHandle handle) : base(gc.Cx)
|
||||
public MemberReferenceField(IGenericContext gc, MemberReferenceHandle handle) : base(gc.Cx)
|
||||
{
|
||||
this.handle = handle;
|
||||
this.gc = gc;
|
||||
|
||||
@@ -12,10 +12,10 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
private readonly MemberReferenceHandle handle;
|
||||
private readonly MemberReference mr;
|
||||
private readonly Type declaringType;
|
||||
private readonly GenericContext parent;
|
||||
private readonly IGenericContext parent;
|
||||
private readonly Method? sourceDeclaration;
|
||||
|
||||
public MemberReferenceMethod(GenericContext gc, MemberReferenceHandle handle) : base(gc)
|
||||
public MemberReferenceMethod(IGenericContext gc, MemberReferenceHandle handle) : base(gc)
|
||||
{
|
||||
this.handle = handle;
|
||||
this.gc = gc;
|
||||
@@ -23,7 +23,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
|
||||
signature = mr.DecodeMethodSignature(new SignatureDecoder(), gc);
|
||||
|
||||
parent = (GenericContext)Cx.CreateGeneric(gc, mr.Parent);
|
||||
parent = (IGenericContext)Cx.CreateGeneric(gc, mr.Parent);
|
||||
|
||||
var declType = parent is Method parentMethod
|
||||
? parentMethod.DeclaringType
|
||||
|
||||
@@ -12,10 +12,10 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
internal abstract class Method : TypeContainer, IMember, ICustomModifierReceiver, IParameterizable
|
||||
{
|
||||
protected MethodTypeParameter[]? genericParams;
|
||||
protected GenericContext gc;
|
||||
protected IGenericContext gc;
|
||||
protected MethodSignature<ITypeSignature> signature;
|
||||
|
||||
protected Method(GenericContext gc) : base(gc.Cx)
|
||||
protected Method(IGenericContext gc) : base(gc.Cx)
|
||||
{
|
||||
this.gc = gc;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
private readonly Method unboundMethod;
|
||||
private readonly ImmutableArray<Type> typeParams;
|
||||
|
||||
public MethodSpecificationMethod(GenericContext gc, MethodSpecificationHandle handle) : base(gc)
|
||||
public MethodSpecificationMethod(IGenericContext gc, MethodSpecificationHandle handle) : base(gc)
|
||||
{
|
||||
this.handle = handle;
|
||||
ms = Cx.MdReader.GetMethodSpecification(handle);
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
|
||||
public override string Name => "!" + index;
|
||||
|
||||
public MethodTypeParameter(GenericContext gc, Method m, int index) : base(gc)
|
||||
public MethodTypeParameter(IGenericContext gc, Method m, int index) : base(gc)
|
||||
{
|
||||
method = m;
|
||||
this.index = index;
|
||||
|
||||
@@ -14,9 +14,6 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
|
||||
public bool IsGlobalNamespace => ParentNamespace is null;
|
||||
|
||||
public override string IdSuffix => ";namespace";
|
||||
|
||||
|
||||
public override void WriteId(TextWriter trapFile)
|
||||
{
|
||||
if (ParentNamespace != null && !ParentNamespace.IsGlobalNamespace)
|
||||
@@ -27,6 +24,8 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
trapFile.Write(Name);
|
||||
}
|
||||
|
||||
public override string IdSuffix => ";namespacee";
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is Namespace ns && Name == ns.Name)
|
||||
|
||||
@@ -8,41 +8,40 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
/// </summary>
|
||||
internal sealed class Parameter : LabelledEntity
|
||||
{
|
||||
private readonly IParameterizable method;
|
||||
private readonly IParameterizable parameterizable;
|
||||
private readonly int index;
|
||||
private readonly Type type;
|
||||
|
||||
public Parameter(Context cx, IParameterizable m, int i, Type t) : base(cx)
|
||||
public Parameter(Context cx, IParameterizable p, int i, Type t) : base(cx)
|
||||
{
|
||||
method = m;
|
||||
parameterizable = p;
|
||||
index = i;
|
||||
type = t;
|
||||
}
|
||||
|
||||
public override void WriteId(TextWriter trapFile)
|
||||
{
|
||||
trapFile.WriteSubId(method);
|
||||
trapFile.WriteSubId(parameterizable);
|
||||
trapFile.Write('_');
|
||||
trapFile.Write(index);
|
||||
trapFile.Write(";cil-parameter");
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is Parameter param && method.Equals(param.method) && index == param.index;
|
||||
return obj is Parameter param && parameterizable.Equals(param.parameterizable) && index == param.index;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return 23 * method.GetHashCode() + index;
|
||||
return 23 * parameterizable.GetHashCode() + index;
|
||||
}
|
||||
|
||||
public override string IdSuffix => ";cil-parameter";
|
||||
|
||||
public override IEnumerable<IExtractionProduct> Contents
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return Tuples.cil_parameter(this, method, index, type);
|
||||
yield return Tuples.cil_parameter(this, parameterizable, index, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,9 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
private readonly Handle handle;
|
||||
private readonly Type type;
|
||||
private readonly PropertyDefinition pd;
|
||||
public override string IdSuffix => ";cil-property";
|
||||
private readonly GenericContext gc;
|
||||
private readonly IGenericContext gc;
|
||||
|
||||
public Property(GenericContext gc, Type type, PropertyDefinitionHandle handle) : base(gc.Cx)
|
||||
public Property(IGenericContext gc, Type type, PropertyDefinitionHandle handle) : base(gc.Cx)
|
||||
{
|
||||
this.gc = gc;
|
||||
this.handle = handle;
|
||||
@@ -38,6 +37,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
param.WriteId(trapFile, gc);
|
||||
}
|
||||
trapFile.Write(")");
|
||||
trapFile.Write(";cil-property");
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
this.shape = shape;
|
||||
}
|
||||
|
||||
public void WriteId(TextWriter trapFile, GenericContext gc)
|
||||
public void WriteId(TextWriter trapFile, IGenericContext gc)
|
||||
{
|
||||
elementType.WriteId(trapFile, gc);
|
||||
trapFile.Write('[');
|
||||
@@ -38,7 +38,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
this.elementType = elementType;
|
||||
}
|
||||
|
||||
public void WriteId(TextWriter trapFile, GenericContext gc)
|
||||
public void WriteId(TextWriter trapFile, IGenericContext gc)
|
||||
{
|
||||
elementType.WriteId(trapFile, gc);
|
||||
trapFile.Write('&');
|
||||
@@ -54,7 +54,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
this.signature = signature;
|
||||
}
|
||||
|
||||
public void WriteId(TextWriter trapFile, GenericContext gc)
|
||||
public void WriteId(TextWriter trapFile, IGenericContext gc)
|
||||
{
|
||||
FunctionPointerType.WriteName(
|
||||
trapFile.Write,
|
||||
@@ -84,7 +84,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
this.typeArguments = typeArguments;
|
||||
}
|
||||
|
||||
public void WriteId(TextWriter trapFile, GenericContext gc)
|
||||
public void WriteId(TextWriter trapFile, IGenericContext gc)
|
||||
{
|
||||
genericType.WriteId(trapFile, gc);
|
||||
trapFile.Write('<');
|
||||
@@ -112,7 +112,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public void WriteId(TextWriter trapFile, GenericContext outerGc)
|
||||
public void WriteId(TextWriter trapFile, IGenericContext outerGc)
|
||||
{
|
||||
if (!ReferenceEquals(innerGc, outerGc) && innerGc is Method method)
|
||||
{
|
||||
@@ -132,7 +132,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public void WriteId(TextWriter trapFile, GenericContext gc)
|
||||
public void WriteId(TextWriter trapFile, IGenericContext gc)
|
||||
{
|
||||
trapFile.Write("T!");
|
||||
trapFile.Write(index);
|
||||
@@ -158,7 +158,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
this.isRequired = isRequired;
|
||||
}
|
||||
|
||||
public void WriteId(TextWriter trapFile, GenericContext gc)
|
||||
public void WriteId(TextWriter trapFile, IGenericContext gc)
|
||||
{
|
||||
unmodifiedType.WriteId(trapFile, gc);
|
||||
trapFile.Write(isRequired ? " modreq(" : " modopt(");
|
||||
@@ -186,7 +186,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
this.elementType = elementType;
|
||||
}
|
||||
|
||||
public void WriteId(TextWriter trapFile, GenericContext gc)
|
||||
public void WriteId(TextWriter trapFile, IGenericContext gc)
|
||||
{
|
||||
elementType.WriteId(trapFile, gc);
|
||||
trapFile.Write('*');
|
||||
@@ -207,7 +207,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
this.typeCode = typeCode;
|
||||
}
|
||||
|
||||
public void WriteId(TextWriter trapFile, GenericContext gc)
|
||||
public void WriteId(TextWriter trapFile, IGenericContext gc)
|
||||
{
|
||||
trapFile.Write(typeCode.Id());
|
||||
}
|
||||
@@ -227,7 +227,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
this.elementType = elementType;
|
||||
}
|
||||
|
||||
public void WriteId(TextWriter trapFile, GenericContext gc)
|
||||
public void WriteId(TextWriter trapFile, IGenericContext gc)
|
||||
{
|
||||
elementType.WriteId(trapFile, gc);
|
||||
trapFile.Write("[]");
|
||||
@@ -248,7 +248,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
public void WriteId(TextWriter trapFile, GenericContext gc)
|
||||
public void WriteId(TextWriter trapFile, IGenericContext gc)
|
||||
{
|
||||
var type = (Type)gc.Cx.Create(handle);
|
||||
type.WriteId(trapFile);
|
||||
@@ -269,7 +269,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
public void WriteId(TextWriter trapFile, GenericContext gc)
|
||||
public void WriteId(TextWriter trapFile, IGenericContext gc)
|
||||
{
|
||||
var type = (Type)gc.Cx.Create(handle);
|
||||
type.WriteId(trapFile);
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
trapFile.Write(location.EndLine);
|
||||
trapFile.Write(',');
|
||||
trapFile.Write(location.EndColumn);
|
||||
trapFile.Write(";sourcelocation");
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
@@ -43,7 +44,5 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
yield return Tuples.locations_default(this, file, location.StartLine, location.StartColumn, location.EndLine, location.EndColumn);
|
||||
}
|
||||
}
|
||||
|
||||
public override string IdSuffix => ";sourcelocation";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
/// </summary>
|
||||
public abstract class Type : TypeContainer, IMember
|
||||
{
|
||||
public override string IdSuffix => ";cil-type";
|
||||
internal const string AssemblyTypeNameSeparator = "::";
|
||||
internal const string PrimitiveTypePrefix = "builtin" + AssemblyTypeNameSeparator + "System.";
|
||||
|
||||
@@ -48,6 +47,8 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
|
||||
public sealed override void WriteId(TextWriter trapFile) => WriteId(trapFile, false);
|
||||
|
||||
public override string IdSuffix => ";cil-type";
|
||||
|
||||
/// <summary>
|
||||
/// Returns the friendly qualified name of types, such as
|
||||
/// ``"System.Collection.Generic.List`1"`` or
|
||||
@@ -198,7 +199,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
|
||||
public sealed override IEnumerable<Type> MethodParameters => Enumerable.Empty<Type>();
|
||||
|
||||
public static Type DecodeType(GenericContext gc, TypeSpecificationHandle handle) =>
|
||||
public static Type DecodeType(IGenericContext gc, TypeSpecificationHandle handle) =>
|
||||
gc.Cx.MdReader.GetTypeSpecification(handle).DecodeSignature(gc.Cx.TypeSignatureDecoder, gc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using System;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
@@ -8,17 +6,15 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
/// <summary>
|
||||
/// Base class for all type containers (namespaces, types, methods).
|
||||
/// </summary>
|
||||
public abstract class TypeContainer : GenericContext, IExtractedEntity
|
||||
public abstract class TypeContainer : LabelledEntity, IGenericContext
|
||||
{
|
||||
protected TypeContainer(Context cx) : base(cx)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual Label Label { get; set; }
|
||||
public abstract string IdSuffix { get; }
|
||||
|
||||
public abstract void WriteId(TextWriter trapFile);
|
||||
|
||||
public void WriteQuotedId(TextWriter trapFile)
|
||||
public override void WriteQuotedId(TextWriter trapFile)
|
||||
{
|
||||
trapFile.Write("@\"");
|
||||
WriteId(trapFile);
|
||||
@@ -26,21 +22,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
trapFile.Write('\"');
|
||||
}
|
||||
|
||||
public abstract string IdSuffix { get; }
|
||||
|
||||
Location IEntity.ReportingLocation => throw new NotImplementedException();
|
||||
|
||||
public void Extract(Context cx2) { cx2.Populate(this); }
|
||||
|
||||
public abstract IEnumerable<IExtractionProduct> Contents { get; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
using var writer = new StringWriter();
|
||||
WriteQuotedId(writer);
|
||||
return writer.ToString();
|
||||
}
|
||||
|
||||
TrapStackBehaviour IEntity.TrapStackBehaviour => TrapStackBehaviour.NoLabel;
|
||||
public abstract IEnumerable<Type> MethodParameters { get; }
|
||||
public abstract IEnumerable<Type> TypeParameters { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
{
|
||||
internal abstract class TypeParameter : Type
|
||||
{
|
||||
protected readonly GenericContext gc;
|
||||
protected readonly IGenericContext gc;
|
||||
|
||||
protected TypeParameter(GenericContext gc) : base(gc.Cx)
|
||||
protected TypeParameter(IGenericContext gc) : base(gc.Cx)
|
||||
{
|
||||
this.gc = gc;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
using System;
|
||||
using System.Reflection.Metadata;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
|
||||
namespace Semmle.Extraction.CIL.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Decodes a type signature and produces a Type, for use by DecodeSignature() and friends.
|
||||
/// </summary>
|
||||
public class TypeSignatureDecoder : ISignatureTypeProvider<Type, GenericContext>
|
||||
public class TypeSignatureDecoder : ISignatureTypeProvider<Type, IGenericContext>
|
||||
{
|
||||
private readonly Context cx;
|
||||
|
||||
@@ -22,22 +23,22 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
Type IConstructedTypeProvider<Type>.GetByReferenceType(Type elementType) =>
|
||||
new ByRefType(cx, elementType);
|
||||
|
||||
Type ISignatureTypeProvider<Type, GenericContext>.GetFunctionPointerType(MethodSignature<Type> signature) =>
|
||||
Type ISignatureTypeProvider<Type, IGenericContext>.GetFunctionPointerType(MethodSignature<Type> signature) =>
|
||||
cx.Populate(new FunctionPointerType(cx, signature));
|
||||
|
||||
Type IConstructedTypeProvider<Type>.GetGenericInstantiation(Type genericType, ImmutableArray<Type> typeArguments) =>
|
||||
genericType.Construct(typeArguments);
|
||||
|
||||
Type ISignatureTypeProvider<Type, GenericContext>.GetGenericMethodParameter(GenericContext genericContext, int index) =>
|
||||
genericContext.GetGenericMethodParameter(index);
|
||||
Type ISignatureTypeProvider<Type, IGenericContext>.GetGenericMethodParameter(IGenericContext genericContext, int index) =>
|
||||
genericContext.MethodParameters.ElementAt(index);
|
||||
|
||||
Type ISignatureTypeProvider<Type, GenericContext>.GetGenericTypeParameter(GenericContext genericContext, int index) =>
|
||||
genericContext.GetGenericTypeParameter(index);
|
||||
Type ISignatureTypeProvider<Type, IGenericContext>.GetGenericTypeParameter(IGenericContext genericContext, int index) =>
|
||||
genericContext.TypeParameters.ElementAt(index);
|
||||
|
||||
Type ISignatureTypeProvider<Type, GenericContext>.GetModifiedType(Type modifier, Type unmodifiedType, bool isRequired) =>
|
||||
Type ISignatureTypeProvider<Type, IGenericContext>.GetModifiedType(Type modifier, Type unmodifiedType, bool isRequired) =>
|
||||
new ModifiedType(cx, unmodifiedType, modifier, isRequired);
|
||||
|
||||
Type ISignatureTypeProvider<Type, GenericContext>.GetPinnedType(Type elementType) => elementType;
|
||||
Type ISignatureTypeProvider<Type, IGenericContext>.GetPinnedType(Type elementType) => elementType;
|
||||
|
||||
Type IConstructedTypeProvider<Type>.GetPointerType(Type elementType) =>
|
||||
cx.Populate(new PointerType(cx, elementType));
|
||||
@@ -53,7 +54,7 @@ namespace Semmle.Extraction.CIL.Entities
|
||||
Type ISimpleTypeProvider<Type>.GetTypeFromReference(MetadataReader reader, TypeReferenceHandle handle, byte rawTypeKind) =>
|
||||
(Type)cx.Create(handle);
|
||||
|
||||
Type ISignatureTypeProvider<Type, GenericContext>.GetTypeFromSpecification(MetadataReader reader, GenericContext genericContext, TypeSpecificationHandle handle, byte rawTypeKind) =>
|
||||
Type ISignatureTypeProvider<Type, IGenericContext>.GetTypeFromSpecification(MetadataReader reader, IGenericContext genericContext, TypeSpecificationHandle handle, byte rawTypeKind) =>
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Semmle.Extraction.CIL
|
||||
{
|
||||
/// <summary>
|
||||
/// Something that is extracted from an entity.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// The extraction algorithm proceeds as follows:
|
||||
/// - Construct entity
|
||||
/// - Call Extract()
|
||||
/// - IExtractedEntity check if already extracted
|
||||
/// - Enumerate Contents to produce more extraction products
|
||||
/// - Extract these until there is nothing left to extract
|
||||
/// </remarks>
|
||||
public interface IExtractionProduct
|
||||
{
|
||||
/// <summary>
|
||||
/// Perform further extraction/population of this item as necessary.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="cx">The extraction context.</param>
|
||||
void Extract(Context cx);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An entity which has been extracted.
|
||||
/// </summary>
|
||||
public interface IExtractedEntity : IEntity, IExtractionProduct
|
||||
{
|
||||
/// <summary>
|
||||
/// The contents of the entity.
|
||||
/// </summary>
|
||||
IEnumerable<IExtractionProduct> Contents { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An entity that has contents to extract. There is no need to populate
|
||||
/// a key as it's done in the contructor.
|
||||
/// </summary>
|
||||
public abstract class UnlabelledEntity : IExtractedEntity
|
||||
{
|
||||
public abstract IEnumerable<IExtractionProduct> Contents { get; }
|
||||
public Label Label { get; set; }
|
||||
|
||||
public void WriteId(System.IO.TextWriter trapFile)
|
||||
{
|
||||
trapFile.Write('*');
|
||||
}
|
||||
|
||||
public void WriteQuotedId(TextWriter trapFile)
|
||||
{
|
||||
WriteId(trapFile);
|
||||
}
|
||||
|
||||
public Microsoft.CodeAnalysis.Location ReportingLocation => throw new NotImplementedException();
|
||||
|
||||
public virtual void Extract(Context cx2)
|
||||
{
|
||||
cx2.Extract(this);
|
||||
}
|
||||
|
||||
public Context Cx { get; }
|
||||
|
||||
protected UnlabelledEntity(Context cx)
|
||||
{
|
||||
this.Cx = cx;
|
||||
cx.Cx.AddFreshLabel(this);
|
||||
}
|
||||
|
||||
TrapStackBehaviour IEntity.TrapStackBehaviour => TrapStackBehaviour.NoLabel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An entity that needs to be populated during extraction.
|
||||
/// This assigns a key and optionally extracts its contents.
|
||||
/// </summary>
|
||||
public abstract class LabelledEntity : IExtractedEntity
|
||||
{
|
||||
public abstract IEnumerable<IExtractionProduct> Contents { get; }
|
||||
public Label Label { get; set; }
|
||||
public Microsoft.CodeAnalysis.Location ReportingLocation => throw new NotImplementedException();
|
||||
|
||||
public abstract void WriteId(System.IO.TextWriter trapFile);
|
||||
|
||||
public abstract string IdSuffix { get; }
|
||||
|
||||
public void WriteQuotedId(TextWriter trapFile)
|
||||
{
|
||||
trapFile.Write("@\"");
|
||||
WriteId(trapFile);
|
||||
trapFile.Write(IdSuffix);
|
||||
trapFile.Write('\"');
|
||||
}
|
||||
|
||||
public void Extract(Context cx2)
|
||||
{
|
||||
cx2.Populate(this);
|
||||
}
|
||||
|
||||
public Context Cx { get; }
|
||||
|
||||
protected LabelledEntity(Context cx)
|
||||
{
|
||||
this.Cx = cx;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
using var writer = new StringWriter();
|
||||
WriteQuotedId(writer);
|
||||
return writer.ToString();
|
||||
}
|
||||
|
||||
TrapStackBehaviour IEntity.TrapStackBehaviour => TrapStackBehaviour.NoLabel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A tuple that is an extraction product.
|
||||
/// </summary>
|
||||
internal class Tuple : IExtractionProduct
|
||||
{
|
||||
private readonly Extraction.Tuple tuple;
|
||||
|
||||
public Tuple(string name, params object[] args)
|
||||
{
|
||||
tuple = new Extraction.Tuple(name, args);
|
||||
}
|
||||
|
||||
public void Extract(Context cx)
|
||||
{
|
||||
cx.Cx.Emit(tuple);
|
||||
}
|
||||
|
||||
public override string ToString() => tuple.ToString();
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Semmle.Extraction.CIL
|
||||
{
|
||||
/// <summary>
|
||||
/// When we decode a type/method signature, we need access to
|
||||
/// generic parameters.
|
||||
/// </summary>
|
||||
public abstract class GenericContext
|
||||
{
|
||||
public Context Cx { get; }
|
||||
|
||||
protected GenericContext(Context cx)
|
||||
{
|
||||
this.Cx = cx;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The list of generic type parameters/arguments, including type parameters/arguments of
|
||||
/// containing types.
|
||||
/// </summary>
|
||||
public abstract IEnumerable<Entities.Type> TypeParameters { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The list of generic method parameters.
|
||||
/// </summary>
|
||||
public abstract IEnumerable<Entities.Type> MethodParameters { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the `p`th type parameter.
|
||||
/// </summary>
|
||||
/// <param name="p">The index of the parameter.</param>
|
||||
/// <returns>
|
||||
/// For constructed types, the supplied type.
|
||||
/// For unbound types, the type parameter.
|
||||
/// </returns>
|
||||
public Entities.Type GetGenericTypeParameter(int p)
|
||||
{
|
||||
return TypeParameters.ElementAt(p);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the `p`th method type parameter.
|
||||
/// </summary>
|
||||
/// <param name="p">The index of the parameter.</param>
|
||||
/// <returns>
|
||||
/// For constructed types, the supplied type.
|
||||
/// For unbound types, the type parameter.
|
||||
/// </returns>
|
||||
public Entities.Type GetGenericMethodParameter(int p)
|
||||
{
|
||||
return MethodParameters.ElementAt(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,10 @@ namespace Semmle.Extraction.CIL
|
||||
internal static Tuple cil_adder(Event member, Method method) =>
|
||||
new Tuple("cil_adder", member, method);
|
||||
|
||||
internal static Tuple cil_access(Instruction i, IEntity m) =>
|
||||
internal static Tuple cil_access(Instruction i, IExtractedEntity m) =>
|
||||
new Tuple("cil_access", i, m);
|
||||
|
||||
internal static Tuple cil_attribute(Attribute attribute, IEntity @object, Method constructor) =>
|
||||
internal static Tuple cil_attribute(Attribute attribute, IExtractedEntity @object, Method constructor) =>
|
||||
new Tuple("cil_attribute", attribute, @object, constructor);
|
||||
|
||||
internal static Tuple cil_attribute_named_argument(Attribute attribute, string name, string value) =>
|
||||
@@ -197,7 +197,7 @@ namespace Semmle.Extraction.CIL
|
||||
internal static Tuple cil_custom_modifiers(ICustomModifierReceiver receiver, Type modifier, bool isRequired) =>
|
||||
new Tuple("cil_custom_modifiers", receiver, modifier, isRequired ? 1 : 0);
|
||||
|
||||
internal static Tuple cil_type_annotation(IEntity receiver, TypeAnnotation annotation) =>
|
||||
internal static Tuple cil_type_annotation(IExtractedEntity receiver, TypeAnnotation annotation) =>
|
||||
new Tuple("cil_type_annotation", receiver, (int)annotation);
|
||||
|
||||
internal static Tuple containerparent(Folder parent, IFileOrFolder child) =>
|
||||
@@ -215,7 +215,7 @@ namespace Semmle.Extraction.CIL
|
||||
internal static Tuple locations_default(PdbSourceLocation label, File file, int startLine, int startCol, int endLine, int endCol) =>
|
||||
new Tuple("locations_default", label, file, startLine, startCol, endLine, endCol);
|
||||
|
||||
internal static Tuple metadata_handle(IEntity entity, Assembly assembly, int handleValue) =>
|
||||
internal static Tuple metadata_handle(IExtractedEntity entity, Assembly assembly, int handleValue) =>
|
||||
new Tuple("metadata_handle", entity, assembly, handleValue);
|
||||
|
||||
internal static Tuple namespaces(Namespace ns, string name) =>
|
||||
|
||||
@@ -29,9 +29,9 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
/// <summary>
|
||||
/// Gets the property symbol associated with this accessor.
|
||||
/// </summary>
|
||||
private IPropertySymbol PropertySymbol => GetPropertySymbol(symbol);
|
||||
private IPropertySymbol PropertySymbol => GetPropertySymbol(Symbol);
|
||||
|
||||
public new Accessor OriginalDefinition => Create(Context, symbol.OriginalDefinition);
|
||||
public new Accessor OriginalDefinition => Create(Context, Symbol.OriginalDefinition);
|
||||
|
||||
public override void Populate(TextWriter trapFile)
|
||||
{
|
||||
@@ -42,42 +42,42 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
var prop = PropertySymbol;
|
||||
if (prop == null)
|
||||
{
|
||||
Context.ModelError(symbol, "Unhandled accessor associated symbol");
|
||||
Context.ModelError(Symbol, "Unhandled accessor associated symbol");
|
||||
return;
|
||||
}
|
||||
|
||||
var parent = Property.Create(Context, prop);
|
||||
int kind;
|
||||
Accessor unboundAccessor;
|
||||
if (SymbolEqualityComparer.Default.Equals(symbol, prop.GetMethod))
|
||||
if (SymbolEqualityComparer.Default.Equals(Symbol, prop.GetMethod))
|
||||
{
|
||||
kind = 1;
|
||||
unboundAccessor = Create(Context, prop.OriginalDefinition.GetMethod);
|
||||
}
|
||||
else if (SymbolEqualityComparer.Default.Equals(symbol, prop.SetMethod))
|
||||
else if (SymbolEqualityComparer.Default.Equals(Symbol, prop.SetMethod))
|
||||
{
|
||||
kind = 2;
|
||||
unboundAccessor = Create(Context, prop.OriginalDefinition.SetMethod);
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.ModelError(symbol, "Unhandled accessor kind");
|
||||
Context.ModelError(Symbol, "Unhandled accessor kind");
|
||||
return;
|
||||
}
|
||||
|
||||
trapFile.accessors(this, kind, symbol.Name, parent, unboundAccessor);
|
||||
trapFile.accessors(this, kind, Symbol.Name, parent, unboundAccessor);
|
||||
|
||||
foreach (var l in Locations)
|
||||
trapFile.accessor_location(this, l);
|
||||
|
||||
Overrides(trapFile);
|
||||
|
||||
if (symbol.FromSource() && Block == null)
|
||||
if (Symbol.FromSource() && Block == null)
|
||||
{
|
||||
trapFile.compiler_generated(this);
|
||||
}
|
||||
|
||||
if (symbol.IsInitOnly)
|
||||
if (Symbol.IsInitOnly)
|
||||
{
|
||||
trapFile.init_only_accessors(this);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
|
||||
public override void Populate(TextWriter trapFile)
|
||||
{
|
||||
var type = Type.Create(Context, symbol.AttributeClass);
|
||||
var type = Type.Create(Context, Symbol.AttributeClass);
|
||||
trapFile.attributes(this, type.TypeRef, entity);
|
||||
trapFile.attribute_location(this, Location);
|
||||
|
||||
@@ -69,10 +69,10 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
var ctorArguments = attributeSyntax?.ArgumentList?.Arguments.Where(a => a.NameEquals == null).ToList();
|
||||
|
||||
var childIndex = 0;
|
||||
for (var i = 0; i < symbol.ConstructorArguments.Length; i++)
|
||||
for (var i = 0; i < Symbol.ConstructorArguments.Length; i++)
|
||||
{
|
||||
var constructorArgument = symbol.ConstructorArguments[i];
|
||||
var paramName = symbol.AttributeConstructor?.Parameters[i].Name;
|
||||
var constructorArgument = Symbol.ConstructorArguments[i];
|
||||
var paramName = Symbol.AttributeConstructor?.Parameters[i].Name;
|
||||
var argSyntax = ctorArguments?.SingleOrDefault(a => a.NameColon != null && a.NameColon.Name.Identifier.Text == paramName);
|
||||
|
||||
if (argSyntax == null && // couldn't find named argument
|
||||
@@ -89,7 +89,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
childIndex++);
|
||||
}
|
||||
|
||||
foreach (var namedArgument in symbol.NamedArguments)
|
||||
foreach (var namedArgument in Symbol.NamedArguments)
|
||||
{
|
||||
var expr = CreateExpressionFromArgument(
|
||||
namedArgument.Value,
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
{
|
||||
trapFile.commentblock(this);
|
||||
var child = 0;
|
||||
trapFile.commentblock_location(this, Context.CreateLocation(symbol.Location));
|
||||
foreach (var l in symbol.CommentLines)
|
||||
trapFile.commentblock_location(this, Context.CreateLocation(Symbol.Location));
|
||||
foreach (var l in Symbol.CommentLines)
|
||||
{
|
||||
trapFile.commentblock_child(this, (CommentLine)l, child++);
|
||||
}
|
||||
@@ -24,11 +24,11 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
|
||||
public override void WriteId(TextWriter trapFile)
|
||||
{
|
||||
trapFile.WriteSubId(Context.CreateLocation(symbol.Location));
|
||||
trapFile.WriteSubId(Context.CreateLocation(Symbol.Location));
|
||||
trapFile.Write(";commentblock");
|
||||
}
|
||||
|
||||
public override Microsoft.CodeAnalysis.Location ReportingLocation => symbol.Location;
|
||||
public override Microsoft.CodeAnalysis.Location ReportingLocation => Symbol.Location;
|
||||
|
||||
public void BindTo(Label entity, CommentBinding binding)
|
||||
{
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
RawText = raw;
|
||||
}
|
||||
|
||||
public Microsoft.CodeAnalysis.Location Location => symbol.Item1;
|
||||
public Microsoft.CodeAnalysis.Location Location => Symbol.Item1;
|
||||
public CommentLineType Type { get; private set; }
|
||||
|
||||
public string Text { get { return symbol.Item2; } }
|
||||
public string Text { get { return Symbol.Item2; } }
|
||||
public string RawText { get; private set; }
|
||||
|
||||
private Location location;
|
||||
@@ -28,7 +28,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
trapFile.commentline_location(this, location);
|
||||
}
|
||||
|
||||
public override Microsoft.CodeAnalysis.Location ReportingLocation => location.symbol;
|
||||
public override Microsoft.CodeAnalysis.Location ReportingLocation => location.Symbol;
|
||||
|
||||
public override bool NeedsPopulation => true;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
protected override void Populate(TextWriter trapFile)
|
||||
{
|
||||
trapFile.diagnostics(this, (int)diagnostic.Severity, diagnostic.Id, diagnostic.Descriptor.Title.ToString(),
|
||||
diagnostic.GetMessage(), cx.CreateLocation(diagnostic.Location));
|
||||
diagnostic.GetMessage(), Context.CreateLocation(diagnostic.Location));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
PopulateModifiers(trapFile);
|
||||
ContainingType.PopulateGenerics();
|
||||
|
||||
trapFile.constructors(this, symbol.ContainingType.Name, ContainingType, (Constructor)OriginalDefinition);
|
||||
trapFile.constructors(this, Symbol.ContainingType.Name, ContainingType, (Constructor)OriginalDefinition);
|
||||
trapFile.constructor_location(this, Location);
|
||||
|
||||
if (symbol.IsImplicitlyDeclared)
|
||||
if (Symbol.IsImplicitlyDeclared)
|
||||
{
|
||||
var lineCounts = new LineCounts() { Total = 2, Code = 1, Comment = 0 };
|
||||
trapFile.numlines(this, lineCounts);
|
||||
@@ -48,10 +48,10 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
switch (initializer.Kind())
|
||||
{
|
||||
case SyntaxKind.BaseConstructorInitializer:
|
||||
initializerType = symbol.ContainingType.BaseType;
|
||||
initializerType = Symbol.ContainingType.BaseType;
|
||||
break;
|
||||
case SyntaxKind.ThisConstructorInitializer:
|
||||
initializerType = symbol.ContainingType;
|
||||
initializerType = Symbol.ContainingType;
|
||||
break;
|
||||
default:
|
||||
Context.ModelError(initializer, "Unknown initializer");
|
||||
@@ -73,7 +73,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
Context.ModelError(symbol, "Unable to resolve call");
|
||||
Context.ModelError(Symbol, "Unable to resolve call");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
{
|
||||
get
|
||||
{
|
||||
return symbol.DeclaringSyntaxReferences
|
||||
return Symbol.DeclaringSyntaxReferences
|
||||
.Select(r => r.GetSyntax())
|
||||
.OfType<ConstructorDeclarationSyntax>()
|
||||
.FirstOrDefault();
|
||||
@@ -114,15 +114,15 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
|
||||
public override void WriteId(TextWriter trapFile)
|
||||
{
|
||||
if (symbol.IsStatic)
|
||||
if (Symbol.IsStatic)
|
||||
trapFile.Write("static");
|
||||
trapFile.WriteSubId(ContainingType);
|
||||
AddParametersToId(Context, trapFile, symbol);
|
||||
AddParametersToId(Context, trapFile, Symbol);
|
||||
trapFile.Write(";constructor");
|
||||
}
|
||||
|
||||
private ConstructorDeclarationSyntax GetSyntax() =>
|
||||
symbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<ConstructorDeclarationSyntax>().FirstOrDefault();
|
||||
Symbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<ConstructorDeclarationSyntax>().FirstOrDefault();
|
||||
|
||||
public override Microsoft.CodeAnalysis.Location FullLocation => ReportingLocation;
|
||||
|
||||
@@ -136,12 +136,12 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
return syn.Identifier.GetLocation();
|
||||
}
|
||||
|
||||
if (symbol.IsImplicitlyDeclared)
|
||||
if (Symbol.IsImplicitlyDeclared)
|
||||
{
|
||||
return ContainingType.ReportingLocation;
|
||||
}
|
||||
|
||||
return symbol.ContainingType.Locations.FirstOrDefault();
|
||||
return Symbol.ContainingType.Locations.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
{
|
||||
get
|
||||
{
|
||||
return symbol.DeclaringSyntaxReferences
|
||||
return Symbol.DeclaringSyntaxReferences
|
||||
.Select(r => r.GetSyntax())
|
||||
.OfType<ConversionOperatorDeclarationSyntax>()
|
||||
.Select(s => s.FixedLocation())
|
||||
.Concat(symbol.Locations)
|
||||
.Concat(Symbol.Locations)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
PopulateModifiers(trapFile);
|
||||
ContainingType.PopulateGenerics();
|
||||
|
||||
trapFile.destructors(this, string.Format("~{0}", symbol.ContainingType.Name), ContainingType, OriginalDefinition(Context, this, symbol));
|
||||
trapFile.destructors(this, string.Format("~{0}", Symbol.ContainingType.Name), ContainingType, OriginalDefinition(Context, this, Symbol));
|
||||
trapFile.destructor_location(this, Location);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,20 +14,20 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
{
|
||||
trapFile.WriteSubId(ContainingType);
|
||||
trapFile.Write('.');
|
||||
Method.AddExplicitInterfaceQualifierToId(Context, trapFile, symbol.ExplicitInterfaceImplementations);
|
||||
trapFile.Write(symbol.Name);
|
||||
Method.AddExplicitInterfaceQualifierToId(Context, trapFile, Symbol.ExplicitInterfaceImplementations);
|
||||
trapFile.Write(Symbol.Name);
|
||||
trapFile.Write(";event");
|
||||
}
|
||||
|
||||
public override void Populate(TextWriter trapFile)
|
||||
{
|
||||
PopulateNullability(trapFile, symbol.GetAnnotatedType());
|
||||
PopulateNullability(trapFile, Symbol.GetAnnotatedType());
|
||||
|
||||
var type = Type.Create(Context, symbol.Type);
|
||||
trapFile.events(this, symbol.GetName(), ContainingType, type.TypeRef, Create(Context, symbol.OriginalDefinition));
|
||||
var type = Type.Create(Context, Symbol.Type);
|
||||
trapFile.events(this, Symbol.GetName(), ContainingType, type.TypeRef, Create(Context, Symbol.OriginalDefinition));
|
||||
|
||||
var adder = symbol.AddMethod;
|
||||
var remover = symbol.RemoveMethod;
|
||||
var adder = Symbol.AddMethod;
|
||||
var remover = Symbol.RemoveMethod;
|
||||
|
||||
if (!(adder is null))
|
||||
Method.Create(Context, adder);
|
||||
@@ -39,10 +39,10 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
BindComments();
|
||||
|
||||
var declSyntaxReferences = IsSourceDeclaration
|
||||
? symbol.DeclaringSyntaxReferences.Select(d => d.GetSyntax()).ToArray()
|
||||
? Symbol.DeclaringSyntaxReferences.Select(d => d.GetSyntax()).ToArray()
|
||||
: Enumerable.Empty<SyntaxNode>();
|
||||
|
||||
foreach (var explicitInterface in symbol.ExplicitInterfaceImplementations.Select(impl => Type.Create(Context, impl.ContainingType)))
|
||||
foreach (var explicitInterface in Symbol.ExplicitInterfaceImplementations.Select(impl => Type.Create(Context, impl.ContainingType)))
|
||||
{
|
||||
trapFile.explicitly_implements(this, explicitInterface.TypeRef);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
/// <summary>
|
||||
/// Gets the event symbol associated with this accessor.
|
||||
/// </summary>
|
||||
private IEventSymbol EventSymbol => symbol.AssociatedSymbol as IEventSymbol;
|
||||
private IEventSymbol EventSymbol => Symbol.AssociatedSymbol as IEventSymbol;
|
||||
|
||||
public override void Populate(TextWriter trapFile)
|
||||
{
|
||||
@@ -21,30 +21,30 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
var @event = EventSymbol;
|
||||
if (@event == null)
|
||||
{
|
||||
Context.ModelError(symbol, "Unhandled event accessor associated symbol");
|
||||
Context.ModelError(Symbol, "Unhandled event accessor associated symbol");
|
||||
return;
|
||||
}
|
||||
|
||||
var parent = Event.Create(Context, @event);
|
||||
int kind;
|
||||
EventAccessor unboundAccessor;
|
||||
if (SymbolEqualityComparer.Default.Equals(symbol, @event.AddMethod))
|
||||
if (SymbolEqualityComparer.Default.Equals(Symbol, @event.AddMethod))
|
||||
{
|
||||
kind = 1;
|
||||
unboundAccessor = Create(Context, @event.OriginalDefinition.AddMethod);
|
||||
}
|
||||
else if (SymbolEqualityComparer.Default.Equals(symbol, @event.RemoveMethod))
|
||||
else if (SymbolEqualityComparer.Default.Equals(Symbol, @event.RemoveMethod))
|
||||
{
|
||||
kind = 2;
|
||||
unboundAccessor = Create(Context, @event.OriginalDefinition.RemoveMethod);
|
||||
}
|
||||
else
|
||||
{
|
||||
Context.ModelError(symbol, "Undhandled event accessor kind");
|
||||
Context.ModelError(Symbol, "Undhandled event accessor kind");
|
||||
return;
|
||||
}
|
||||
|
||||
trapFile.event_accessors(this, kind, symbol.Name, parent, unboundAccessor);
|
||||
trapFile.event_accessors(this, kind, Symbol.Name, parent, unboundAccessor);
|
||||
|
||||
foreach (var l in Locations)
|
||||
trapFile.event_accessor_location(this, l);
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
|
||||
protected sealed override void Populate(TextWriter trapFile)
|
||||
{
|
||||
var type = Type.HasValue ? Entities.Type.Create(cx, Type.Value) : NullType.Create(cx);
|
||||
var type = Type.HasValue ? Entities.Type.Create(Context, Type.Value) : NullType.Create(Context);
|
||||
trapFile.expressions(this, Kind, type.TypeRef);
|
||||
if (info.Parent.IsTopLevelParent)
|
||||
trapFile.expr_parent_top_level(this, info.Child, info.Parent);
|
||||
@@ -39,7 +39,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
|
||||
if (Type.HasValue && !Type.Value.HasObliviousNullability())
|
||||
{
|
||||
var n = NullabilityEntity.Create(cx, Nullability.Create(Type.Value));
|
||||
var n = NullabilityEntity.Create(Context, Nullability.Create(Type.Value));
|
||||
trapFile.type_nullability(this, n);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
type.PopulateGenerics();
|
||||
}
|
||||
|
||||
public override Microsoft.CodeAnalysis.Location ReportingLocation => Location.symbol;
|
||||
public override Microsoft.CodeAnalysis.Location ReportingLocation => Location.Symbol;
|
||||
|
||||
bool IExpressionParentEntity.IsTopLevelParent => false;
|
||||
|
||||
@@ -170,10 +170,10 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
/// <param name="node">The expression.</param>
|
||||
public void OperatorCall(TextWriter trapFile, ExpressionSyntax node)
|
||||
{
|
||||
var @operator = cx.GetSymbolInfo(node);
|
||||
var @operator = Context.GetSymbolInfo(node);
|
||||
if (@operator.Symbol is IMethodSymbol method)
|
||||
{
|
||||
var callType = GetCallType(cx, node);
|
||||
var callType = GetCallType(Context, node);
|
||||
if (callType == CallType.Dynamic)
|
||||
{
|
||||
UserOperator.OperatorSymbol(method.Name, out var operatorName);
|
||||
@@ -181,7 +181,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
return;
|
||||
}
|
||||
|
||||
trapFile.expr_call(this, Method.Create(cx, method));
|
||||
trapFile.expr_call(this, Method.Create(Context, method));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
|
||||
private void PopulateArgument(TextWriter trapFile, ArgumentSyntax arg, int child)
|
||||
{
|
||||
var expr = Create(cx, arg.Expression, this, child);
|
||||
var expr = Create(Context, arg.Expression, this, child);
|
||||
int mode;
|
||||
switch (arg.RefOrOutKeyword.Kind())
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Semmle.Extraction.CSharp.Entities
|
||||
|
||||
protected new Expression TryPopulate()
|
||||
{
|
||||
cx.Try(Syntax, null, () => PopulateExpression(cx.TrapWriter.Writer));
|
||||
Context.Try(Syntax, null, () => PopulateExpression(Context.TrapWriter.Writer));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,12 +47,12 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
{
|
||||
if (!(target is null))
|
||||
{
|
||||
cx.TrapWriter.Writer.expr_access(this, target);
|
||||
Context.TrapWriter.Writer.expr_access(this, target);
|
||||
}
|
||||
|
||||
if (implicitThis && !symbol.IsStatic)
|
||||
{
|
||||
This.CreateImplicit(cx, symbol.ContainingType, Location, this, -1);
|
||||
This.CreateImplicit(Context, symbol.ContainingType, Location, this, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
if (TypeSyntax is null)
|
||||
{
|
||||
cx.ModelError(Syntax, "Array has unexpected type syntax");
|
||||
Context.ModelError(Syntax, "Array has unexpected type syntax");
|
||||
}
|
||||
|
||||
var firstLevelSizes = TypeSyntax.RankSpecifiers.First()?.Sizes ?? SyntaxFactory.SeparatedList<ExpressionSyntax>();
|
||||
@@ -44,20 +44,20 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
{
|
||||
for (var sizeIndex = 0; sizeIndex < firstLevelSizes.Count; sizeIndex++)
|
||||
{
|
||||
Create(cx, firstLevelSizes[sizeIndex], this, sizeIndex);
|
||||
Create(Context, firstLevelSizes[sizeIndex], this, sizeIndex);
|
||||
}
|
||||
explicitlySized = true;
|
||||
}
|
||||
|
||||
if (!(Initializer is null))
|
||||
{
|
||||
ArrayInitializer.Create(new ExpressionNodeInfo(cx, Initializer, this, InitializerIndex));
|
||||
ArrayInitializer.Create(new ExpressionNodeInfo(Context, Initializer, this, InitializerIndex));
|
||||
}
|
||||
|
||||
if (explicitlySized)
|
||||
trapFile.explicitly_sized_array_creation(this);
|
||||
|
||||
TypeMention.Create(cx, TypeSyntax, this, Type);
|
||||
TypeMention.Create(Context, TypeSyntax, this, Type);
|
||||
}
|
||||
|
||||
private void SetArraySizes(InitializerExpressionSyntax initializer, int rank)
|
||||
@@ -69,7 +69,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
return;
|
||||
}
|
||||
|
||||
Literal.CreateGenerated(cx, this, level, cx.Compilation.GetSpecialType(SpecialType.System_Int32), initializer.Expressions.Count, Location);
|
||||
Literal.CreateGenerated(Context, this, level, Context.Compilation.GetSpecialType(SpecialType.System_Int32), initializer.Expressions.Count, Location);
|
||||
|
||||
initializer = initializer.Expressions.FirstOrDefault() as InitializerExpressionSyntax;
|
||||
}
|
||||
@@ -143,7 +143,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
ArrayInitializer.Create(new ExpressionNodeInfo(cx, Syntax.Initializer, this, InitializerIndex));
|
||||
ArrayInitializer.Create(new ExpressionNodeInfo(Context, Syntax.Initializer, this, InitializerIndex));
|
||||
trapFile.implicitly_typed_array_creation(this);
|
||||
trapFile.stackalloc_array_creation(this);
|
||||
}
|
||||
@@ -159,7 +159,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
{
|
||||
if (Syntax.Initializer != null)
|
||||
{
|
||||
ArrayInitializer.Create(new ExpressionNodeInfo(cx, Syntax.Initializer, this, InitializerIndex));
|
||||
ArrayInitializer.Create(new ExpressionNodeInfo(Context, Syntax.Initializer, this, InitializerIndex));
|
||||
}
|
||||
|
||||
trapFile.implicitly_typed_array_creation(this);
|
||||
|
||||
@@ -26,17 +26,17 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
if (operatorKind.HasValue)
|
||||
{
|
||||
// Convert assignment such as `a += b` into `a = a + b`.
|
||||
var simpleAssignExpr = new Expression(new ExpressionInfo(cx, Type, Location, ExprKind.SIMPLE_ASSIGN, this, 2, false, null));
|
||||
Create(cx, Syntax.Left, simpleAssignExpr, 1);
|
||||
var opexpr = new Expression(new ExpressionInfo(cx, Type, Location, operatorKind.Value, simpleAssignExpr, 0, false, null));
|
||||
Create(cx, Syntax.Left, opexpr, 0);
|
||||
Create(cx, Syntax.Right, opexpr, 1);
|
||||
var simpleAssignExpr = new Expression(new ExpressionInfo(Context, Type, Location, ExprKind.SIMPLE_ASSIGN, this, 2, false, null));
|
||||
Create(Context, Syntax.Left, simpleAssignExpr, 1);
|
||||
var opexpr = new Expression(new ExpressionInfo(Context, Type, Location, operatorKind.Value, simpleAssignExpr, 0, false, null));
|
||||
Create(Context, Syntax.Left, opexpr, 0);
|
||||
Create(Context, Syntax.Right, opexpr, 1);
|
||||
opexpr.OperatorCall(trapFile, Syntax);
|
||||
}
|
||||
else
|
||||
{
|
||||
Create(cx, Syntax.Left, this, 1);
|
||||
Create(cx, Syntax.Right, this, 0);
|
||||
Create(Context, Syntax.Left, this, 1);
|
||||
Create(Context, Syntax.Right, this, 0);
|
||||
|
||||
if (Kind == ExprKind.ADD_EVENT || Kind == ExprKind.REMOVE_EVENT)
|
||||
{
|
||||
@@ -148,12 +148,12 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
case ExprKind.ASSIGN_COALESCE:
|
||||
return ExprKind.NULL_COALESCING;
|
||||
default:
|
||||
cx.ModelError(Syntax, "Couldn't unfold assignment of type " + kind);
|
||||
Context.ModelError(Syntax, "Couldn't unfold assignment of type " + kind);
|
||||
return ExprKind.UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public new CallType CallType => GetCallType(cx, Syntax);
|
||||
public new CallType CallType => GetCallType(Context, Syntax);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
Create(cx, Syntax.Expression, this, 0);
|
||||
Create(Context, Syntax.Expression, this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
OperatorCall(trapFile, Syntax);
|
||||
CreateDeferred(cx, Syntax.Left, this, 0);
|
||||
CreateDeferred(cx, Syntax.Right, this, 1);
|
||||
CreateDeferred(Context, Syntax.Left, this, 0);
|
||||
CreateDeferred(Context, Syntax.Right, this, 1);
|
||||
}
|
||||
|
||||
private static ExprKind GetKind(Context cx, BinaryExpressionSyntax node)
|
||||
|
||||
@@ -16,17 +16,17 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
Create(cx, Syntax.Expression, this, ExpressionIndex);
|
||||
Create(Context, Syntax.Expression, this, ExpressionIndex);
|
||||
|
||||
if (Kind == ExprKind.CAST)
|
||||
{ // Type cast
|
||||
TypeAccess.Create(new ExpressionNodeInfo(cx, Syntax.Type, this, TypeAccessIndex));
|
||||
TypeAccess.Create(new ExpressionNodeInfo(Context, Syntax.Type, this, TypeAccessIndex));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Type conversion
|
||||
OperatorCall(trapFile, Syntax);
|
||||
TypeMention.Create(cx, Syntax.Type, this, Type);
|
||||
TypeMention.Create(Context, Syntax.Type, this, Type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
Create(cx, Syntax.Expression, this, 0);
|
||||
Create(Context, Syntax.Expression, this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
Create(cx, Syntax.Condition, this, 0);
|
||||
Create(cx, Syntax.WhenTrue, this, 1);
|
||||
Create(cx, Syntax.WhenFalse, this, 2);
|
||||
Create(Context, Syntax.Condition, this, 0);
|
||||
Create(Context, Syntax.WhenTrue, this, 1);
|
||||
Create(Context, Syntax.WhenFalse, this, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
TypeAccess.Create(cx, Syntax.Type, this, 0);
|
||||
TypeAccess.Create(Context, Syntax.Type, this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,22 +22,22 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
{
|
||||
if (Kind == ExprKind.POINTER_INDIRECTION)
|
||||
{
|
||||
var qualifierInfo = new ExpressionNodeInfo(cx, qualifier, this, 0);
|
||||
var add = new Expression(new ExpressionInfo(cx, qualifierInfo.Type, Location, ExprKind.ADD, this, 0, false, null));
|
||||
var qualifierInfo = new ExpressionNodeInfo(Context, qualifier, this, 0);
|
||||
var add = new Expression(new ExpressionInfo(Context, qualifierInfo.Type, Location, ExprKind.ADD, this, 0, false, null));
|
||||
qualifierInfo.SetParent(add, 0);
|
||||
CreateFromNode(qualifierInfo);
|
||||
PopulateArguments(trapFile, argumentList, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Create(cx, qualifier, this, -1);
|
||||
Create(Context, qualifier, this, -1);
|
||||
PopulateArguments(trapFile, argumentList, 0);
|
||||
|
||||
var symbolInfo = cx.GetSymbolInfo(base.Syntax);
|
||||
var symbolInfo = Context.GetSymbolInfo(base.Syntax);
|
||||
|
||||
if (symbolInfo.Symbol is IPropertySymbol indexer)
|
||||
{
|
||||
trapFile.expr_access(this, Indexer.Create(cx, indexer));
|
||||
trapFile.expr_access(this, Indexer.Create(Context, indexer));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,6 +250,9 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
case SyntaxKind.SuppressNullableWarningExpression:
|
||||
return PostfixUnary.Create(info.SetKind(ExprKind.SUPPRESS_NULLABLE_WARNING), ((PostfixUnaryExpressionSyntax)info.Node).Operand);
|
||||
|
||||
case SyntaxKind.WithExpression:
|
||||
return WithExpression.Create(info);
|
||||
|
||||
default:
|
||||
info.Context.ModelError(info.Node, $"Unhandled expression '{info.Node}' of kind '{info.Node.Kind()}'");
|
||||
return new Unknown(info);
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
public ImplicitCast(ExpressionNodeInfo info)
|
||||
: base(new ExpressionInfo(info.Context, info.ConvertedType, info.Location, ExprKind.CAST, info.Parent, info.Child, true, info.ExprValue))
|
||||
{
|
||||
Expr = Factory.Create(new ExpressionNodeInfo(cx, info.Node, this, 0));
|
||||
Expr = Factory.Create(new ExpressionNodeInfo(Context, info.Node, this, 0));
|
||||
}
|
||||
|
||||
public ImplicitCast(ExpressionNodeInfo info, IMethodSymbol method)
|
||||
@@ -22,11 +22,11 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
{
|
||||
Expr = Factory.Create(info.SetParent(this, 0));
|
||||
|
||||
var target = Method.Create(cx, method);
|
||||
var target = Method.Create(Context, method);
|
||||
if (target != null)
|
||||
cx.TrapWriter.Writer.expr_call(this, target);
|
||||
Context.TrapWriter.Writer.expr_call(this, target);
|
||||
else
|
||||
cx.ModelError(info.Node, "Failed to resolve target for operator invocation");
|
||||
Context.ModelError(info.Node, "Failed to resolve target for operator invocation");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
protected Initializer(ExpressionNodeInfo info) : base(info) { }
|
||||
}
|
||||
|
||||
internal class ArrayInitializer : Expression<InitializerExpressionSyntax>
|
||||
internal class ArrayInitializer : Initializer
|
||||
{
|
||||
private ArrayInitializer(ExpressionNodeInfo info) : base(info.SetType(null).SetKind(ExprKind.ARRAY_INIT)) { }
|
||||
|
||||
@@ -26,12 +26,12 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
if (e.Kind() == SyntaxKind.ArrayInitializerExpression)
|
||||
{
|
||||
// Recursively create another array initializer
|
||||
Create(new ExpressionNodeInfo(cx, (InitializerExpressionSyntax)e, this, child++));
|
||||
Create(new ExpressionNodeInfo(Context, (InitializerExpressionSyntax)e, this, child++));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create the expression normally.
|
||||
Create(cx, e, this, child++);
|
||||
Create(Context, e, this, child++);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
ArrayInitializer.Create(new ExpressionNodeInfo(cx, Syntax, this, -1));
|
||||
ArrayInitializer.Create(new ExpressionNodeInfo(Context, Syntax, this, -1));
|
||||
trapFile.implicitly_typed_array_creation(this);
|
||||
}
|
||||
}
|
||||
@@ -81,9 +81,9 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
{
|
||||
if (init is AssignmentExpressionSyntax assignment)
|
||||
{
|
||||
var assignmentInfo = new ExpressionNodeInfo(cx, init, this, child++).SetKind(ExprKind.SIMPLE_ASSIGN);
|
||||
var assignmentInfo = new ExpressionNodeInfo(Context, init, this, child++).SetKind(ExprKind.SIMPLE_ASSIGN);
|
||||
var assignmentEntity = new Expression(assignmentInfo);
|
||||
var typeInfoRight = cx.GetTypeInfo(assignment.Right);
|
||||
var typeInfoRight = Context.GetTypeInfo(assignment.Right);
|
||||
if (typeInfoRight.Type is null)
|
||||
// The type may be null for nested initializers such as
|
||||
// ```csharp
|
||||
@@ -92,15 +92,15 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
// In this case we take the type from the assignment
|
||||
// `As = { [0] = a }` instead
|
||||
typeInfoRight = assignmentInfo.TypeInfo;
|
||||
CreateFromNode(new ExpressionNodeInfo(cx, assignment.Right, assignmentEntity, 0, typeInfoRight));
|
||||
CreateFromNode(new ExpressionNodeInfo(Context, assignment.Right, assignmentEntity, 0, typeInfoRight));
|
||||
|
||||
var target = cx.GetSymbolInfo(assignment.Left);
|
||||
var target = Context.GetSymbolInfo(assignment.Left);
|
||||
|
||||
// If the target is null, then assume that this is an array initializer (of the form `[...] = ...`)
|
||||
|
||||
var access = target.Symbol is null ?
|
||||
new Expression(new ExpressionNodeInfo(cx, assignment.Left, assignmentEntity, 1).SetKind(ExprKind.ARRAY_ACCESS)) :
|
||||
Access.Create(new ExpressionNodeInfo(cx, assignment.Left, assignmentEntity, 1), target.Symbol, false, cx.CreateEntity(target.Symbol));
|
||||
new Expression(new ExpressionNodeInfo(Context, assignment.Left, assignmentEntity, 1).SetKind(ExprKind.ARRAY_ACCESS)) :
|
||||
Access.Create(new ExpressionNodeInfo(Context, assignment.Left, assignmentEntity, 1), target.Symbol, false, Context.CreateEntity(target.Symbol));
|
||||
|
||||
if (assignment.Left is ImplicitElementAccessSyntax iea)
|
||||
{
|
||||
@@ -109,14 +109,14 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
var indexChild = 0;
|
||||
foreach (var arg in iea.ArgumentList.Arguments)
|
||||
{
|
||||
Expression.Create(cx, arg.Expression, access, indexChild++);
|
||||
Expression.Create(Context, arg.Expression, access, indexChild++);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cx.ModelError(init, "Unexpected object initialization");
|
||||
Create(cx, init, this, child++);
|
||||
Context.ModelError(init, "Unexpected object initialization");
|
||||
Create(Context, init, this, child++);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,16 +133,16 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
var child = 0;
|
||||
foreach (var i in Syntax.Expressions)
|
||||
{
|
||||
var collectionInfo = cx.GetModel(Syntax).GetCollectionInitializerSymbolInfo(i);
|
||||
var addMethod = Method.Create(cx, collectionInfo.Symbol as IMethodSymbol);
|
||||
var voidType = AnnotatedTypeSymbol.CreateNotAnnotated(cx.Compilation.GetSpecialType(SpecialType.System_Void));
|
||||
var collectionInfo = Context.GetModel(Syntax).GetCollectionInitializerSymbolInfo(i);
|
||||
var addMethod = Method.Create(Context, collectionInfo.Symbol as IMethodSymbol);
|
||||
var voidType = AnnotatedTypeSymbol.CreateNotAnnotated(Context.Compilation.GetSpecialType(SpecialType.System_Void));
|
||||
|
||||
var invocation = new Expression(new ExpressionInfo(cx, voidType, cx.CreateLocation(i.GetLocation()), ExprKind.METHOD_INVOCATION, this, child++, false, null));
|
||||
var invocation = new Expression(new ExpressionInfo(Context, voidType, Context.CreateLocation(i.GetLocation()), ExprKind.METHOD_INVOCATION, this, child++, false, null));
|
||||
|
||||
if (addMethod != null)
|
||||
trapFile.expr_call(invocation, addMethod);
|
||||
else
|
||||
cx.ModelError(Syntax, "Unable to find an Add() method for collection initializer");
|
||||
Context.ModelError(Syntax, "Unable to find an Add() method for collection initializer");
|
||||
|
||||
if (i.Kind() == SyntaxKind.ComplexElementInitializerExpression)
|
||||
{
|
||||
@@ -154,12 +154,12 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
var addChild = 0;
|
||||
foreach (var arg in init.Expressions)
|
||||
{
|
||||
Create(cx, arg, invocation, addChild++);
|
||||
Create(Context, arg, invocation, addChild++);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Create(cx, i, invocation, 0);
|
||||
Create(Context, i, invocation, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,12 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
{
|
||||
case SyntaxKind.Interpolation:
|
||||
var interpolation = (InterpolationSyntax)c;
|
||||
Create(cx, interpolation.Expression, this, child++);
|
||||
Create(Context, interpolation.Expression, this, child++);
|
||||
break;
|
||||
case SyntaxKind.InterpolatedStringText:
|
||||
// Create a string literal
|
||||
var interpolatedText = (InterpolatedStringTextSyntax)c;
|
||||
new Expression(new ExpressionInfo(cx, Type, cx.CreateLocation(c.GetLocation()), ExprKind.STRING_LITERAL, this, child++, false, interpolatedText.TextToken.Text));
|
||||
new Expression(new ExpressionInfo(Context, Type, Context.CreateLocation(c.GetLocation()), ExprKind.STRING_LITERAL, this, child++, false, interpolatedText.TextToken.Text));
|
||||
break;
|
||||
default:
|
||||
throw new InternalError(c, $"Unhandled interpolation kind {c.Kind()}");
|
||||
|
||||
@@ -37,15 +37,15 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
memberName = memberAccess.Name.Identifier.Text;
|
||||
if (Syntax.Expression.Kind() == SyntaxKind.SimpleMemberAccessExpression)
|
||||
// Qualified method call; `x.M()`
|
||||
Create(cx, memberAccess.Expression, this, child++);
|
||||
Create(Context, memberAccess.Expression, this, child++);
|
||||
else
|
||||
// Pointer member access; `x->M()`
|
||||
Create(cx, Syntax.Expression, this, child++);
|
||||
Create(Context, Syntax.Expression, this, child++);
|
||||
break;
|
||||
case MemberBindingExpressionSyntax memberBinding:
|
||||
// Conditionally qualified method call; `x?.M()`
|
||||
memberName = memberBinding.Name.Identifier.Text;
|
||||
Create(cx, FindConditionalQualifier(memberBinding), this, child++);
|
||||
Create(Context, FindConditionalQualifier(memberBinding), this, child++);
|
||||
MakeConditional(trapFile);
|
||||
break;
|
||||
case SimpleNameSyntax simpleName when (Kind == ExprKind.METHOD_INVOCATION):
|
||||
@@ -55,10 +55,10 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
{
|
||||
// Implicit `this` qualifier; add explicitly
|
||||
|
||||
if (cx.GetModel(Syntax).GetEnclosingSymbol(Location.symbol.SourceSpan.Start) is IMethodSymbol callingMethod)
|
||||
This.CreateImplicit(cx, callingMethod.ContainingType, Location, this, child++);
|
||||
if (Context.GetModel(Syntax).GetEnclosingSymbol(Location.Symbol.SourceSpan.Start) is IMethodSymbol callingMethod)
|
||||
This.CreateImplicit(Context, callingMethod.ContainingType, Location, this, child++);
|
||||
else
|
||||
cx.ModelError(Syntax, "Couldn't determine implicit this type");
|
||||
Context.ModelError(Syntax, "Couldn't determine implicit this type");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -68,7 +68,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
break;
|
||||
default:
|
||||
// Delegate or function pointer call; `d()`
|
||||
Create(cx, Syntax.Expression, this, child++);
|
||||
Create(Context, Syntax.Expression, this, child++);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
if (memberName != null)
|
||||
trapFile.dynamic_member_name(this, memberName);
|
||||
else
|
||||
cx.ModelError(Syntax, "Unable to get name for dynamic call.");
|
||||
Context.ModelError(Syntax, "Unable to get name for dynamic call.");
|
||||
}
|
||||
|
||||
PopulateArguments(trapFile, Syntax.ArgumentList, child);
|
||||
@@ -86,11 +86,11 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
if (target == null)
|
||||
{
|
||||
if (!isDynamicCall && !IsDelegateLikeCall(info))
|
||||
cx.ModelError(Syntax, "Unable to resolve target for call. (Compilation error?)");
|
||||
Context.ModelError(Syntax, "Unable to resolve target for call. (Compilation error?)");
|
||||
return;
|
||||
}
|
||||
|
||||
var targetKey = Method.Create(cx, target);
|
||||
var targetKey = Method.Create(Context, target);
|
||||
trapFile.expr_call(this, targetKey);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
.Where(method => method.Parameters.Length >= Syntax.ArgumentList.Arguments.Count)
|
||||
.Where(method => method.Parameters.Count(p => !p.HasExplicitDefaultValue) <= Syntax.ArgumentList.Arguments.Count);
|
||||
|
||||
return cx.Extractor.Standalone ?
|
||||
return Context.Extractor.Standalone ?
|
||||
candidates.FirstOrDefault() :
|
||||
candidates.SingleOrDefault();
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
Create(cx, Syntax.Expression, this, 0);
|
||||
Expressions.Pattern.Create(cx, Syntax.Pattern, this, 1);
|
||||
Create(Context, Syntax.Expression, this, 0);
|
||||
Expressions.Pattern.Create(Context, Syntax.Pattern, this, 1);
|
||||
}
|
||||
|
||||
public static Expression Create(ExpressionNodeInfo info) => new IsPattern(info).TryPopulate();
|
||||
|
||||
@@ -17,34 +17,34 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
private void VisitParameter(ParameterSyntax p)
|
||||
{
|
||||
var symbol = cx.GetModel(p).GetDeclaredSymbol(p);
|
||||
Parameter.Create(cx, symbol, this);
|
||||
var symbol = Context.GetModel(p).GetDeclaredSymbol(p);
|
||||
Parameter.Create(Context, symbol, this);
|
||||
}
|
||||
|
||||
private Lambda(ExpressionNodeInfo info, CSharpSyntaxNode body, IEnumerable<ParameterSyntax> @params)
|
||||
: base(info)
|
||||
{
|
||||
if (cx.GetModel(info.Node).GetSymbolInfo(info.Node).Symbol is IMethodSymbol symbol)
|
||||
if (Context.GetModel(info.Node).GetSymbolInfo(info.Node).Symbol is IMethodSymbol symbol)
|
||||
{
|
||||
Modifier.ExtractModifiers(cx, info.Context.TrapWriter.Writer, this, symbol);
|
||||
Modifier.ExtractModifiers(Context, info.Context.TrapWriter.Writer, this, symbol);
|
||||
}
|
||||
else
|
||||
{
|
||||
cx.ModelError(info.Node, "Unknown declared symbol");
|
||||
Context.ModelError(info.Node, "Unknown declared symbol");
|
||||
}
|
||||
|
||||
// No need to use `Populate` as the population happens later
|
||||
cx.PopulateLater(() =>
|
||||
Context.PopulateLater(() =>
|
||||
{
|
||||
foreach (var param in @params)
|
||||
VisitParameter(param);
|
||||
|
||||
if (body is ExpressionSyntax exprBody)
|
||||
Create(cx, exprBody, this, 0);
|
||||
Create(Context, exprBody, this, 0);
|
||||
else if (body is BlockSyntax blockBody)
|
||||
Statements.Block.Create(cx, blockBody, this, 0);
|
||||
Statements.Block.Create(Context, blockBody, this, 0);
|
||||
else
|
||||
cx.ModelError(body, "Unhandled lambda body");
|
||||
Context.ModelError(body, "Unhandled lambda body");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
Create(cx, Syntax.Expression, this, 0);
|
||||
Create(Context, Syntax.Expression, this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,16 +9,16 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
private MemberAccess(ExpressionNodeInfo info, ExpressionSyntax qualifier, ISymbol target) : base(info)
|
||||
{
|
||||
var trapFile = info.Context.TrapWriter.Writer;
|
||||
Qualifier = Create(cx, qualifier, this, -1);
|
||||
Qualifier = Create(Context, qualifier, this, -1);
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
if (info.Kind != ExprKind.DYNAMIC_MEMBER_ACCESS)
|
||||
cx.ModelError(info.Node, "Could not determine target for member access");
|
||||
Context.ModelError(info.Node, "Could not determine target for member access");
|
||||
}
|
||||
else
|
||||
{
|
||||
var t = cx.CreateEntity(target);
|
||||
var t = Context.CreateEntity(target);
|
||||
trapFile.expr_access(this, t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,32 +17,32 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
var target = cx.GetSymbolInfo(Syntax);
|
||||
var target = Context.GetSymbolInfo(Syntax);
|
||||
var method = (IMethodSymbol)target.Symbol;
|
||||
|
||||
if (method != null)
|
||||
{
|
||||
trapFile.expr_call(this, Method.Create(cx, method));
|
||||
trapFile.expr_call(this, Method.Create(Context, method));
|
||||
}
|
||||
var child = 0;
|
||||
|
||||
var objectInitializer = Syntax.Initializers.Any() ?
|
||||
new Expression(new ExpressionInfo(cx, Type, Location, ExprKind.OBJECT_INIT, this, -1, false, null)) :
|
||||
new Expression(new ExpressionInfo(Context, Type, Location, ExprKind.OBJECT_INIT, this, -1, false, null)) :
|
||||
null;
|
||||
|
||||
foreach (var init in Syntax.Initializers)
|
||||
{
|
||||
// Create an "assignment"
|
||||
var property = cx.GetModel(init).GetDeclaredSymbol(init);
|
||||
var propEntity = Property.Create(cx, property);
|
||||
var property = Context.GetModel(init).GetDeclaredSymbol(init);
|
||||
var propEntity = Property.Create(Context, property);
|
||||
var type = property.GetAnnotatedType();
|
||||
var loc = cx.CreateLocation(init.GetLocation());
|
||||
var loc = Context.CreateLocation(init.GetLocation());
|
||||
|
||||
var assignment = new Expression(new ExpressionInfo(cx, type, loc, ExprKind.SIMPLE_ASSIGN, objectInitializer, child++, false, null));
|
||||
Create(cx, init.Expression, assignment, 0);
|
||||
Property.Create(cx, property);
|
||||
var assignment = new Expression(new ExpressionInfo(Context, type, loc, ExprKind.SIMPLE_ASSIGN, objectInitializer, child++, false, null));
|
||||
Create(Context, init.Expression, assignment, 0);
|
||||
Property.Create(Context, property);
|
||||
|
||||
var access = new Expression(new ExpressionInfo(cx, type, loc, ExprKind.PROPERTY_ACCESS, assignment, 1, false, null));
|
||||
var access = new Expression(new ExpressionInfo(Context, type, loc, ExprKind.PROPERTY_ACCESS, assignment, 1, false, null));
|
||||
trapFile.expr_access(access, propEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,22 +22,22 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
PopulateArguments(trapFile, Syntax.ArgumentList, 0);
|
||||
}
|
||||
|
||||
var target = cx.GetModel(Syntax).GetSymbolInfo(Syntax);
|
||||
var target = Context.GetModel(Syntax).GetSymbolInfo(Syntax);
|
||||
if (target.Symbol is IMethodSymbol method)
|
||||
{
|
||||
trapFile.expr_call(this, Method.Create(cx, method));
|
||||
trapFile.expr_call(this, Method.Create(Context, method));
|
||||
}
|
||||
|
||||
if (IsDynamicObjectCreation(cx, Syntax))
|
||||
if (IsDynamicObjectCreation(Context, Syntax))
|
||||
{
|
||||
if (cx.GetModel(Syntax).GetTypeInfo(Syntax).Type is INamedTypeSymbol type &&
|
||||
if (Context.GetModel(Syntax).GetTypeInfo(Syntax).Type is INamedTypeSymbol type &&
|
||||
!string.IsNullOrEmpty(type.Name))
|
||||
{
|
||||
trapFile.dynamic_member_name(this, type.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
cx.ModelError(Syntax, "Unable to get name for dynamic object creation.");
|
||||
Context.ModelError(Syntax, "Unable to get name for dynamic object creation.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,13 +46,13 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
switch (Syntax.Initializer.Kind())
|
||||
{
|
||||
case SyntaxKind.CollectionInitializerExpression:
|
||||
CollectionInitializer.Create(new ExpressionNodeInfo(cx, Syntax.Initializer, this, -1).SetType(Type));
|
||||
CollectionInitializer.Create(new ExpressionNodeInfo(Context, Syntax.Initializer, this, -1).SetType(Type));
|
||||
break;
|
||||
case SyntaxKind.ObjectInitializerExpression:
|
||||
ObjectInitializer.Create(new ExpressionNodeInfo(cx, Syntax.Initializer, this, -1).SetType(Type));
|
||||
ObjectInitializer.Create(new ExpressionNodeInfo(Context, Syntax.Initializer, this, -1).SetType(Type));
|
||||
break;
|
||||
default:
|
||||
cx.ModelError("Unhandled initializer in object creation");
|
||||
Context.ModelError("Unhandled initializer in object creation");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
{
|
||||
base.PopulateExpression(trapFile);
|
||||
|
||||
TypeMention.Create(cx, Syntax.Type, this, Type);
|
||||
TypeMention.Create(Context, Syntax.Type, this, Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
Create(cx, Syntax.Expression, this, 0);
|
||||
Create(Context, Syntax.Expression, this, 0);
|
||||
|
||||
// !! We do not currently look at the member (or store the member name).
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
Create(cx, operand, this, 0);
|
||||
Create(Context, operand, this, 0);
|
||||
OperatorCall(trapFile, Syntax);
|
||||
|
||||
if ((operatorKind == ExprKind.POST_INCR || operatorKind == ExprKind.POST_DECR) &&
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
if (!(Syntax.LeftOperand is null))
|
||||
Expression.Create(cx, Syntax.LeftOperand, this, 0);
|
||||
Expression.Create(Context, Syntax.LeftOperand, this, 0);
|
||||
if (!(Syntax.RightOperand is null))
|
||||
Expression.Create(cx, Syntax.RightOperand, this, 1);
|
||||
Expression.Create(Context, Syntax.RightOperand, this, 1);
|
||||
}
|
||||
|
||||
public static Expression Create(ExpressionNodeInfo info) => new RangeExpression(info).TryPopulate();
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
Create(cx, Syntax.Expression, this, 0);
|
||||
Create(Context, Syntax.Expression, this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
Create(cx, Syntax.Expression, this, 0);
|
||||
Create(Context, Syntax.Expression, this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
Create(cx, Syntax.Expression, this, 0);
|
||||
Create(cx, Syntax.Type, this, 1); // A type-access
|
||||
Create(Context, Syntax.Expression, this, 0);
|
||||
Create(Context, Syntax.Type, this, 1); // A type-access
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
TypeAccess.Create(cx, Syntax.Type, this, 0);
|
||||
TypeAccess.Create(Context, Syntax.Type, this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
SwitchedExpr = Expression.Create(cx, Syntax.GoverningExpression, this, -1);
|
||||
SwitchedExpr = Expression.Create(Context, Syntax.GoverningExpression, this, -1);
|
||||
for (var i = 0; i < Syntax.Arms.Count; i++)
|
||||
{
|
||||
new SwitchCase(cx, Syntax.Arms[i], this, i);
|
||||
new SwitchCase(Context, Syntax.Arms[i], this, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
|
||||
protected override void PopulateExpression(TextWriter trapFile)
|
||||
{
|
||||
Create(cx, Syntax.Expression, this, 0);
|
||||
Create(Context, Syntax.Expression, this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
|
||||
var child = 0;
|
||||
foreach (var argument in Syntax.Arguments.Select(a => a.Expression))
|
||||
{
|
||||
Expression.Create(cx, argument, this, child++);
|
||||
Expression.Create(Context, argument, this, child++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user