Skip to content

Commit 25cc561

Browse files
committed
Go: Sync files and make manual adjustments.
1 parent 764581c commit 25cc561

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

go/ql/lib/semmle/go/dataflow/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
}

go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImplSpecific.qll

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@ private module FlowSummaries {
1515
private import semmle.go.dataflow.FlowSummary as F
1616
}
1717

18+
/**
19+
* A class of callables that are candidates for flow summary modeling.
20+
*/
1821
class SummarizedCallableBase = Callable;
1922

23+
/**
24+
* A class of callables that are candidates for neutral modeling.
25+
*/
26+
class NeutralCallableBase = Callable;
27+
2028
DataFlowCallable inject(SummarizedCallable c) { result.asSummarizedCallable() = c or none() }
2129

2230
/** Gets the parameter position of the instance parameter. */
@@ -73,11 +81,11 @@ predicate summaryElement(
7381
}
7482

7583
/**
76-
* Holds if a neutral summary model exists for `c` with provenance `provenance`,
77-
* which means that there is no flow through `c`.
84+
* Holds if a neutral model exists for `c` of kind `kind`
85+
* and with provenance `provenance`.
7886
* Note. Neutral models have not been implemented for Go.
7987
*/
80-
predicate neutralSummaryElement(SummarizedCallable c, string provenance) { none() }
88+
predicate neutralElement(NeutralCallableBase c, string kind, string provenance) { none() }
8189

8290
/** Gets the summary component for specification component `c`, if any. */
8391
bindingset[c]

0 commit comments

Comments
 (0)