Skip to content

Commit 3862f8e

Browse files
committed
C#: Expose synthetic globals for use in C#, allow printing of summaries that uses synthetic globals.
1 parent 4497aa5 commit 3862f8e

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/FlowSummary.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ module SummaryComponent {
7272
jrk.getTargetReturnKind() instanceof DataFlowDispatch::NormalReturnKind
7373
))
7474
}
75+
76+
predicate syntheticGlobal = SummaryComponentInternal::syntheticGlobal/1;
77+
78+
class SyntheticGlobal = SummaryComponentInternal::SyntheticGlobal;
7579
}
7680

7781
class SummaryComponentStack = Impl::Public::SummaryComponentStack;

csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ module Public {
180180
result = "Argument[" + getParameterPosition(pos) + "]"
181181
)
182182
or
183+
exists(string synthetic |
184+
sc = TSyntheticGlobalSummaryComponent(synthetic) and
185+
result = "SyntheticGlobal[" + synthetic + "]"
186+
)
187+
or
183188
sc = TReturnSummaryComponent(getReturnValueKind()) and result = "ReturnValue"
184189
}
185190

csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImplSpecific.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ class SummarizedCallableBase extends Callable {
1919
SummarizedCallableBase() { this.isUnboundDeclaration() }
2020
}
2121

22+
/**
23+
* A module for importing frameworks that define synthetic globals.
24+
*/
25+
private module SyntheticGlobals {
26+
private import semmle.code.csharp.frameworks.EntityFramework
27+
}
28+
2229
DataFlowCallable inject(SummarizedCallable c) { result.asSummarizedCallable() = c }
2330

2431
/** Gets the parameter position of the instance parameter. */

0 commit comments

Comments
 (0)