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;
private module ModelPrintingInput implements ModelPrintingSig {
class Api = TargetApiBase;
class SummaryApi = DataFlowSummaryTargetApi;
class SourceOrSinkApi = SourceOrSinkTargetApi;
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
* neutral models.
* A class of callables that are potentially relevant for generating source or
* sink models.
*/
class SummaryTargetApi extends TargetApiBase {
SummaryTargetApi() { not hasManualSummaryModel(this.lift()) }
class SourceOrSinkTargetApi extends Callable {
SourceOrSinkTargetApi() { relevant(this) }
}
/**
* A class of callables that are potentially relevant for generating sink models.
*/
class SinkTargetApi extends TargetApiBase {
SinkTargetApi() { not hasManualSinkModel(this.lift()) }
class SinkTargetApi extends SourceOrSinkTargetApi {
SinkTargetApi() { not hasManualSinkModel(this) }
}
/**
* A class of callables that are potentially relevant for generating source models.
*/
class SourceTargetApi extends TargetApiBase {
SourceTargetApi() { not hasManualSourceModel(this.lift()) }
class SourceTargetApi extends SourceOrSinkTargetApi {
SourceTargetApi() { not hasManualSourceModel(this) }
}
/**
@@ -112,16 +112,19 @@ class SourceTargetApi extends TargetApiBase {
predicate isUninterestingForTypeBasedFlowModels(Callable api) { none() }
/**
* A class of callables that are potentially relevant for generating summary, source, sink
* and neutral models.
* A class of callables that are potentially relevant for generating summary or
* neutral models.
*
* 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.
*/
class TargetApiBase extends Callable {
class SummaryTargetApi extends Callable {
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.

View File

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