-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Shared: Generalize the number of columns in a generated MaD row #18612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,13 @@ | ||
| private import csharp as CS | ||
| private import codeql.mad.modelgenerator.internal.ModelPrinting | ||
| private import semmle.code.csharp.dataflow.internal.ExternalFlow as ExternalFlow | ||
| private import CaptureModels::ModelGeneratorInput as ModelGeneratorInput | ||
|
|
||
| private module ModelPrintingLang implements ModelPrintingLangSig { | ||
| class Callable = CS::Callable; | ||
|
|
||
| predicate partialModel = ExternalFlow::partialModel/6; | ||
| predicate partialModelRow = ModelGeneratorInput::partialModelRow/2; | ||
|
|
||
| predicate partialNeutralModelRow = ModelGeneratorInput::partialNeutralModelRow/2; | ||
| } | ||
|
|
||
| import ModelPrintingImpl<ModelPrintingLang> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,13 +5,14 @@ signature module ModelPrintingLangSig { | |
| class Callable; | ||
|
|
||
| /** | ||
| * Holds if `container`, `type`, `name`, and `parameters` contain the type signature of `api` | ||
| * and `extensible` is the string representation of a boolean that is true, if | ||
| * `api` can be overridden (otherwise false). | ||
| * Gets the string representation for the `i`th column in the MaD row for `api`. | ||
| */ | ||
| predicate partialModel( | ||
| Callable api, string container, string type, string extensible, string name, string parameters | ||
| ); | ||
| string partialModelRow(Callable api, int i); | ||
|
|
||
| /** | ||
| * Gets the string representation for the `i`th column in the neutral MaD row for `api`. | ||
| */ | ||
| string partialNeutralModelRow(Callable api, int i); | ||
| } | ||
|
|
||
| module ModelPrintingImpl<ModelPrintingLangSig Lang> { | ||
|
|
@@ -33,33 +34,17 @@ module ModelPrintingImpl<ModelPrintingLangSig Lang> { | |
|
|
||
| module ModelPrinting<ModelPrintingSig Printing> { | ||
| /** | ||
| * Computes the first 6 columns for MaD rows used for summaries, sources and sinks. | ||
| * Computes the first columns for MaD rows used for summaries, sources and sinks. | ||
| */ | ||
| private string asPartialModel(Lang::Callable api) { | ||
| exists(string container, string type, string extensible, string name, string parameters | | ||
| Lang::partialModel(api, container, type, extensible, name, parameters) and | ||
| result = | ||
| container + ";" // | ||
| + type + ";" // | ||
| + extensible + ";" // | ||
| + name + ";" // | ||
| + parameters + ";" // | ||
| + /* ext + */ ";" // | ||
| ) | ||
| result = concat(int i | | Lang::partialModelRow(api, i), ";" order by i) + ";" | ||
|
||
| } | ||
|
|
||
| /** | ||
| * Computes the first 4 columns for neutral MaD rows. | ||
| * Computes the first columns for neutral MaD rows. | ||
| */ | ||
| private string asPartialNeutralModel(Printing::SummaryApi api) { | ||
| exists(string container, string type, string name, string parameters | | ||
| Lang::partialModel(api, container, type, _, name, parameters) and | ||
| result = | ||
| container + ";" // | ||
| + type + ";" // | ||
| + name + ";" // | ||
| + parameters + ";" // | ||
| ) | ||
| result = concat(int i | | Lang::partialNeutralModelRow(api, i), ";" order by i) + ";" | ||
|
||
| } | ||
|
|
||
| /** | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.