Java: Sync files and make language specific implementation.

This commit is contained in:
Michael Nebel
2024-06-27 11:27:08 +02:00
parent 22e9ae2793
commit e23ff3e499
3 changed files with 21 additions and 14 deletions

View File

@@ -38,7 +38,9 @@ class DataFlowSourceTargetApi = SourceTargetApi;
class DataFlowSinkTargetApi = SinkTargetApi; class DataFlowSinkTargetApi = SinkTargetApi;
private module ModelPrintingInput implements ModelPrintingSig { private module ModelPrintingInput implements ModelPrintingSig {
class Api = TargetApiBase; class SummaryApi = DataFlowSummaryTargetApi;
class SourceOrSinkApi = SourceOrSinkTargetApi;
string getProvenance() { result = "df-generated" } string getProvenance() { result = "df-generated" }
} }

View File

@@ -83,25 +83,25 @@ predicate isUninterestingForDataFlowModels(Callable api) {
} }
/** /**
* A class of callables that are potentially relevant for generating summary and * A class of callables that are potentially relevant for generating source or
* neutral models. * sink models.
*/ */
class SummaryTargetApi extends TargetApiBase { class SourceOrSinkTargetApi extends Callable {
SummaryTargetApi() { not hasManualSummaryModel(this.lift()) } SourceOrSinkTargetApi() { relevant(this) }
} }
/** /**
* A class of callables that are potentially relevant for generating sink models. * A class of callables that are potentially relevant for generating sink models.
*/ */
class SinkTargetApi extends TargetApiBase { class SinkTargetApi extends SourceOrSinkTargetApi {
SinkTargetApi() { not hasManualSinkModel(this.lift()) } SinkTargetApi() { not hasManualSinkModel(this) }
} }
/** /**
* A class of callables that are potentially relevant for generating source models. * A class of callables that are potentially relevant for generating source models.
*/ */
class SourceTargetApi extends TargetApiBase { class SourceTargetApi extends SourceOrSinkTargetApi {
SourceTargetApi() { not hasManualSourceModel(this.lift()) } SourceTargetApi() { not hasManualSourceModel(this) }
} }
/** /**
@@ -112,16 +112,19 @@ class SourceTargetApi extends TargetApiBase {
predicate isUninterestingForTypeBasedFlowModels(Callable api) { none() } predicate isUninterestingForTypeBasedFlowModels(Callable api) { none() }
/** /**
* A class of callables that are potentially relevant for generating summary, source, sink * A class of callables that are potentially relevant for generating summary or
* and neutral models. * neutral models.
* *
* In the Standard library and 3rd party libraries it is the callables (or callables that have a * In the Standard library and 3rd party libraries it is the callables (or callables that have a
* super implementation) that can be called from outside the library itself. * super implementation) that can be called from outside the library itself.
*/ */
class TargetApiBase extends Callable { class SummaryTargetApi extends Callable {
private Callable lift; private Callable lift;
TargetApiBase() { lift = liftedImpl(this) } SummaryTargetApi() {
lift = liftedImpl(this) and
not hasManualSummaryModel(lift)
}
/** /**
* Gets the callable that a model will be lifted to. * Gets the callable that a model will be lifted to.

View File

@@ -284,7 +284,9 @@ private predicate output(Callable callable, TypeVariable tv, string output) {
} }
module ModelPrintingInput implements ModelPrintingSig { module ModelPrintingInput implements ModelPrintingSig {
class Api = TypeBasedFlowTargetApi; class SummaryApi = TypeBasedFlowTargetApi;
class SourceOrSinkApi = Specific::SourceOrSinkTargetApi;
string getProvenance() { result = "tb-generated" } string getProvenance() { result = "tb-generated" }
} }