Skip to content

Commit a9f7994

Browse files
committed
Swift: Sync files and make manual changes.
1 parent 4c06fbd commit a9f7994

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

swift/ql/lib/codeql/swift/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
}

swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImplSpecific.qll

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,16 @@ private import codeql.swift.dataflow.ExternalFlow
1313
private import codeql.swift.dataflow.FlowSummary as FlowSummary
1414
private import codeql.swift.controlflow.CfgNodes
1515

16+
/**
17+
* A class of callables that are candidates for flow summary modeling.
18+
*/
1619
class SummarizedCallableBase = Function;
1720

21+
/**
22+
* A class of callables that are candidates for neutral modeling.
23+
*/
24+
class NeutralCallableBase = Function;
25+
1826
DataFlowCallable inject(SummarizedCallable c) { result.getUnderlyingCallable() = c }
1927

2028
/** Gets the parameter position of the instance parameter. */
@@ -62,10 +70,11 @@ predicate summaryElement(Function c, string input, string output, string kind, s
6270
}
6371

6472
/**
65-
* Holds if a neutral summary model exists for `c` with provenance `provenance`,
66-
* which means that there is no flow through `c`.
73+
* Holds if a neutral model exists for `c` of kind `kind`
74+
* and with provenance `provenance`.
75+
* Note. Neutral models have not been implemented for Swift.
6776
*/
68-
predicate neutralSummaryElement(Function c, string provenance) { none() }
77+
predicate neutralElement(NeutralCallableBase c, string kind, string provenance) { none() }
6978

7079
/**
7180
* Holds if an external source specification exists for `e` with output specification

0 commit comments

Comments
 (0)