Skip to content

Commit e23ff3e

Browse files
committed
Java: Sync files and make language specific implementation.
1 parent 22e9ae2 commit e23ff3e

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

java/ql/src/utils/modelgenerator/internal/CaptureModels.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ class DataFlowSourceTargetApi = SourceTargetApi;
3838
class DataFlowSinkTargetApi = SinkTargetApi;
3939

4040
private module ModelPrintingInput implements ModelPrintingSig {
41-
class Api = TargetApiBase;
41+
class SummaryApi = DataFlowSummaryTargetApi;
42+
43+
class SourceOrSinkApi = SourceOrSinkTargetApi;
4244

4345
string getProvenance() { result = "df-generated" }
4446
}

java/ql/src/utils/modelgenerator/internal/CaptureModelsSpecific.qll

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,25 +83,25 @@ predicate isUninterestingForDataFlowModels(Callable api) {
8383
}
8484

8585
/**
86-
* A class of callables that are potentially relevant for generating summary and
87-
* neutral models.
86+
* A class of callables that are potentially relevant for generating source or
87+
* sink models.
8888
*/
89-
class SummaryTargetApi extends TargetApiBase {
90-
SummaryTargetApi() { not hasManualSummaryModel(this.lift()) }
89+
class SourceOrSinkTargetApi extends Callable {
90+
SourceOrSinkTargetApi() { relevant(this) }
9191
}
9292

9393
/**
9494
* A class of callables that are potentially relevant for generating sink models.
9595
*/
96-
class SinkTargetApi extends TargetApiBase {
97-
SinkTargetApi() { not hasManualSinkModel(this.lift()) }
96+
class SinkTargetApi extends SourceOrSinkTargetApi {
97+
SinkTargetApi() { not hasManualSinkModel(this) }
9898
}
9999

100100
/**
101101
* A class of callables that are potentially relevant for generating source models.
102102
*/
103-
class SourceTargetApi extends TargetApiBase {
104-
SourceTargetApi() { not hasManualSourceModel(this.lift()) }
103+
class SourceTargetApi extends SourceOrSinkTargetApi {
104+
SourceTargetApi() { not hasManualSourceModel(this) }
105105
}
106106

107107
/**
@@ -112,16 +112,19 @@ class SourceTargetApi extends TargetApiBase {
112112
predicate isUninterestingForTypeBasedFlowModels(Callable api) { none() }
113113

114114
/**
115-
* A class of callables that are potentially relevant for generating summary, source, sink
116-
* and neutral models.
115+
* A class of callables that are potentially relevant for generating summary or
116+
* neutral models.
117117
*
118118
* In the Standard library and 3rd party libraries it is the callables (or callables that have a
119119
* super implementation) that can be called from outside the library itself.
120120
*/
121-
class TargetApiBase extends Callable {
121+
class SummaryTargetApi extends Callable {
122122
private Callable lift;
123123

124-
TargetApiBase() { lift = liftedImpl(this) }
124+
SummaryTargetApi() {
125+
lift = liftedImpl(this) and
126+
not hasManualSummaryModel(lift)
127+
}
125128

126129
/**
127130
* Gets the callable that a model will be lifted to.

java/ql/src/utils/modelgenerator/internal/CaptureTypeBasedSummaryModels.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,9 @@ private predicate output(Callable callable, TypeVariable tv, string output) {
284284
}
285285

286286
module ModelPrintingInput implements ModelPrintingSig {
287-
class Api = TypeBasedFlowTargetApi;
287+
class SummaryApi = TypeBasedFlowTargetApi;
288+
289+
class SourceOrSinkApi = Specific::SourceOrSinkTargetApi;
288290

289291
string getProvenance() { result = "tb-generated" }
290292
}

0 commit comments

Comments
 (0)