C++: Prepare for model generation adoption#19274
Conversation
…It is implemented in all subclasses anyway.
4e4ae32 to
3bb249f
Compare
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
Files not reviewed (4)
- cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll: Language not supported
- cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll: Language not supported
- cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll: Language not supported
- cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/TaintTrackingUtil.qll: Language not supported
tausbn
left a comment
There was a problem hiding this comment.
Two typos, otherwise this looks okay to my (relatively untrained on this codebase) eyes.
cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll
Outdated
Show resolved
Hide resolved
cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll
Outdated
Show resolved
Hide resolved
| bindingset[f] | ||
| pragma[inline_late] | ||
| string getParameterTypeWithoutTemplateArguments(Function f, int n) { | ||
| string getParameterTypeWithoutTemplateArguments(Function f, int n, boolean canonical) { |
There was a problem hiding this comment.
Where/how will canonical be used? I only see this predicate used with a wildcard argument for that parameter in this PR.
There was a problem hiding this comment.
Your observation is correct! Currently, we're fairly lenient in with the parameter names we accept when mapping a MaD representation to the targeted function. For example:
using MyIntType = int;
void f(MyIntType t);will both match the parameter list (int) and (MyIntType) (because, annoyingly, some implementations of the C++ standard library differ on whether they use an internal typedef'd name, and what that internal typedef is even called).
However when we want to generate a MaD row (i.e., what model generation will be doing) we don't want to map a function to many parameter lists. So:
- When we consume MaD rows we will always use
_for the canonical parameter (because we want to accept many possible names for the parameter type), but - When we produce MaD rows we need to pick 1 parameter type name. So when this PR is merged I'll open the PR that actually adds the model generation, and this library will use
trueforcanonical.
…e.qll Co-authored-by: Taus <tausbn@github.com>
…e.qll Co-authored-by: Taus <tausbn@github.com>
This PR does the necessary changes to existing C++ code required for model generation. It should be a no-opt in terms of results and performance.
DCA was uneventful (as expected).