-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C#/Java: Re-factor the model generator to be a parameterized module. #17509
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
Conversation
12b2877
to
75508d6
Compare
csharp/ql/src/utils/modelgenerator/internal/CaptureModels.qll
Dismissed
Show dismissed
Hide dismissed
117287d
to
d09948f
Compare
d09948f
to
faf6fea
Compare
faf6fea
to
f142af5
Compare
DCA looks good! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice refactor, some minor comments.
/** | ||
* A node. | ||
*/ | ||
class NodeExtended extends Lang::Node { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just call it Node
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That will cause a compilation error since both Lang
and ModelGeneratorInput
are imported (even though Lang
is imported inside the DataFlow
module).
@@ -89,5 +89,5 @@ string captureFlow(DataFlowSummaryTargetApi api) { | |||
string captureNoFlow(DataFlowSummaryTargetApi api) { | |||
not exists(DataFlowSummaryTargetApi api0 | exists(captureFlow(api0)) and api0.lift() = api.lift()) and | |||
api.isRelevant() and | |||
result = Printing::asNeutralSummaryModel(api) | |||
result = ModelPrinting::asNeutralSummaryModel(api) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the contents of this query can also be fully shared?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The historical reason for not doing so, is because of the language specific examples in the comments. Maybe we should just consider scrapping those as this is now captured in a more readable way in the tests.
@@ -0,0 +1,909 @@ | |||
/** | |||
* INTERNAL: Do not use. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that's the case, then better to put this file inside an internal
folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea :-D
result = ModelPrinting::asLiftedValueModel(api, qualifierString(), "ReturnValue") | ||
} | ||
|
||
private int accessPathLimit0() { result = 2 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nice to put all logic related to content-sensitive model generation inside a nested module, say ContentSensitive
.
In this PR we replace the "pyrameterised" module of the model generator with a parameterised module.
The comments used in the signature module are mostly taken from the C#/Java specific implementation.