-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Java: Base the model printing on the shared implementation.
- Loading branch information
1 parent
17f4372
commit 8edc3d3
Showing
5 changed files
with
26 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 7 additions & 68 deletions
75
java/ql/src/utils/modelgenerator/internal/CaptureModelsPrinting.qll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,11 @@ | ||
private import CaptureModelsSpecific | ||
private import java as J | ||
private import codeql.mad.modelgenerator.ModelPrinting | ||
private import CaptureModelsSpecific as Specific | ||
|
||
signature module PrintingSig { | ||
/** | ||
* The class of APIs relevant for model generation. | ||
*/ | ||
class Api extends TargetApiSpecific; | ||
private module ModelPrintingLang implements ModelPrintingLangSig { | ||
class Callable = J::Callable; | ||
|
||
/** | ||
* Gets the string representation of the provenance of the models. | ||
*/ | ||
string getProvenance(); | ||
predicate partialModel = Specific::partialModel/6; | ||
} | ||
|
||
module PrintingImpl<PrintingSig Printing> { | ||
/** | ||
* Gets the summary model for `api` with `input`, `output` and `kind`. | ||
*/ | ||
bindingset[input, output, kind] | ||
private string asSummaryModel(Printing::Api api, string input, string output, string kind) { | ||
result = | ||
asPartialModel(api) + input + ";" // | ||
+ output + ";" // | ||
+ kind + ";" // | ||
+ Printing::getProvenance() | ||
} | ||
|
||
string asNeutralSummaryModel(Printing::Api api) { | ||
result = | ||
asPartialNeutralModel(api) // | ||
+ "summary" + ";" // | ||
+ Printing::getProvenance() | ||
} | ||
|
||
/** | ||
* Gets the value summary model for `api` with `input` and `output`. | ||
*/ | ||
bindingset[input, output] | ||
string asValueModel(Printing::Api api, string input, string output) { | ||
result = asSummaryModel(api, input, output, "value") | ||
} | ||
|
||
/** | ||
* Gets the taint summary model for `api` with `input` and `output`. | ||
*/ | ||
bindingset[input, output] | ||
string asTaintModel(Printing::Api api, string input, string output) { | ||
result = asSummaryModel(api, input, output, "taint") | ||
} | ||
|
||
/** | ||
* Gets the sink model for `api` with `input` and `kind`. | ||
*/ | ||
bindingset[input, kind] | ||
string asSinkModel(Printing::Api api, string input, string kind) { | ||
result = | ||
asPartialModel(api) + input + ";" // | ||
+ kind + ";" // | ||
+ Printing::getProvenance() | ||
} | ||
|
||
/** | ||
* Gets the source model for `api` with `output` and `kind`. | ||
*/ | ||
bindingset[output, kind] | ||
string asSourceModel(Printing::Api api, string output, string kind) { | ||
result = | ||
asPartialModel(api) + output + ";" // | ||
+ kind + ";" // | ||
+ Printing::getProvenance() | ||
} | ||
} | ||
import ModelPrintingImpl<ModelPrintingLang> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters