Skip to content

Commit 42c7006

Browse files
committed
Python: Sync files and make manual changes.
1 parent 25cc561 commit 42c7006

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

python/ql/lib/semmle/python/dataflow/new/internal/FlowSummaryImpl.qll

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,21 @@ module Public {
296296
predicate hasProvenance(Provenance provenance) { provenance = "manual" }
297297
}
298298

299-
/** A callable where there is no flow via the callable. */
300-
class NeutralCallable extends SummarizedCallableBase {
299+
/**
300+
* A callable where there is no flow via the callable.
301+
*/
302+
class NeutralSummaryCallable extends NeutralCallable {
303+
NeutralSummaryCallable() { this.getKind() = "summary" }
304+
}
305+
306+
/**
307+
* A callable that has a neutral model.
308+
*/
309+
class NeutralCallable extends NeutralCallableBase {
310+
private string kind;
301311
private Provenance provenance;
302312

303-
NeutralCallable() { neutralSummaryElement(this, provenance) }
313+
NeutralCallable() { neutralElement(this, kind, provenance) }
304314

305315
/**
306316
* Holds if the neutral is auto generated.
@@ -316,6 +326,11 @@ module Public {
316326
* Holds if the neutral has provenance `p`.
317327
*/
318328
predicate hasProvenance(Provenance p) { p = provenance }
329+
330+
/**
331+
* Gets the kind of the neutral.
332+
*/
333+
string getKind() { result = kind }
319334
}
320335
}
321336

@@ -1318,6 +1333,8 @@ module Private {
13181333
/** Gets the string representation of this callable used by `neutral/1`. */
13191334
abstract string getCallableCsv();
13201335

1336+
string getKind() { result = super.getKind() }
1337+
13211338
string toString() { result = super.toString() }
13221339
}
13231340

@@ -1364,6 +1381,7 @@ module Private {
13641381
exists(RelevantNeutralCallable c |
13651382
csv =
13661383
c.getCallableCsv() // Callable information
1384+
+ c.getKind() + ";" // kind
13671385
+ renderProvenanceNeutral(c) // provenance
13681386
)
13691387
}

python/ql/lib/semmle/python/dataflow/new/internal/FlowSummaryImplSpecific.qll

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,16 @@ private import FlowSummaryImpl::Private
3939
private import FlowSummaryImpl::Public
4040
private import semmle.python.dataflow.new.FlowSummary as FlowSummary
4141

42+
/**
43+
* A class of callables that are candidates for flow summary modeling.
44+
*/
4245
class SummarizedCallableBase = string;
4346

47+
/**
48+
* A class of callables that are candidates for neutral modeling.
49+
*/
50+
class NeutralCallableBase = string;
51+
4452
/** View a `SummarizedCallable` as a `DataFlowCallable`. */
4553
DataFlowCallable inject(SummarizedCallable c) { result.asLibraryCallable() = c }
4654

@@ -91,11 +99,11 @@ predicate summaryElement(
9199
}
92100

93101
/**
94-
* Holds if a neutral summary model exists for `c` with provenance `provenance`,
95-
* which means that there is no flow through `c`.
102+
* Holds if a neutral model exists for `c` of kind `kind`
103+
* and with provenance `provenance`.
96104
* Note. Neutral models have not been implemented for Python.
97105
*/
98-
predicate neutralSummaryElement(FlowSummary::SummarizedCallable c, string provenance) { none() }
106+
predicate neutralElement(NeutralCallableBase c, string kind, string provenance) { none() }
99107

100108
/**
101109
* Gets the summary component for specification component `c`, if any.

0 commit comments

Comments
 (0)