mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Address review comments
This commit is contained in:
@@ -54,6 +54,8 @@ def _parse_args() -> argparse.Namespace:
|
||||
"generated qll file importing every class file"),
|
||||
p.add_argument("--ql-test-output",
|
||||
help="output directory for QL generated extractor test files"),
|
||||
p.add_argument("--ql-cfg-output",
|
||||
help="output directory for QL CFG layer (optional)."),
|
||||
p.add_argument("--cpp-output",
|
||||
help="output directory for generated C++ files, required if trap or cpp is provided to "
|
||||
"--generate"),
|
||||
@@ -64,8 +66,6 @@ def _parse_args() -> argparse.Namespace:
|
||||
help="registry file containing information about checked-in generated code. A .gitattributes"
|
||||
"file is generated besides it to mark those files with linguist-generated=true. Must"
|
||||
"be in a directory containing all generated code."),
|
||||
p.add_argument("--ql-cfg-output",
|
||||
help="output directory for QL CFG layer (optional)."),
|
||||
]
|
||||
p.add_argument("--script-name",
|
||||
help="script name to put in header comments of generated files. By default, the path of this "
|
||||
|
||||
2
rust/ql/.generated.list
generated
2
rust/ql/.generated.list
generated
@@ -1,4 +1,4 @@
|
||||
lib/codeql/rust/controlflow/internal/generated/CfgNodes.qll 55c20303ad50f17ddea728eb840304e0a634821adb7b13471a9ce55b71ed3886 13509512ffb59a9634ed2dc3c4969af26d5ba2d1502d98dc0c107a99392ce892
|
||||
lib/codeql/rust/controlflow/internal/generated/CfgNodes.qll 438e0b2d6e2dd5f137c1d5791c2f9bc97876acacadc09d56876567c8e6b197ce 8b967df7a91ec767faa2daf142db3bb0e276270789f81d1d887db9fcfd05ad88
|
||||
lib/codeql/rust/elements/Abi.qll 4c973d28b6d628f5959d1f1cc793704572fd0acaae9a97dfce82ff9d73f73476 250f68350180af080f904cd34cb2af481c5c688dc93edf7365fd0ae99855e893
|
||||
lib/codeql/rust/elements/ArgList.qll 661f5100f5d3ef8351452d9058b663a2a5c720eea8cf11bedd628969741486a2 28e424aac01a90fb58cd6f9f83c7e4cf379eea39e636bc0ba07efc818be71c71
|
||||
lib/codeql/rust/elements/ArrayExpr.qll a3e6e122632f4011644ec31b37f88b32fe3f2b7e388e7e878a6883309937049f 12ccb5873d95c433da5606fd371d182ef2f71b78d0c53c2d6dec10fa45852bdc
|
||||
|
||||
@@ -65,11 +65,12 @@ query predicate missingCfgChild(CfgNode parent, string pred, int i, AstNode chil
|
||||
CfgNodes::missingCfgChild(parent, pred, i, child) and
|
||||
successfullyExtractedFile(child.getLocation().getFile()) and
|
||||
not exists(AstNode last, CfgImpl::Completion c | CfgImpl::last(child, last, c) |
|
||||
// In for example `if (a && true) ...` there is no RHS CFG node going into the
|
||||
// `[false] a && true` operation
|
||||
// In for example `if (a && true) ...`, there is no edge from the CFG node
|
||||
// for `true` into the `[false] a && true` node.
|
||||
strictcount(ConditionalSuccessor cs | exists(last.getACfgNode().getASuccessor(cs)) | cs) = 1
|
||||
or
|
||||
// In for example `x && return`, there is no RHS CFG node going into the `&&` operation
|
||||
// In for example `x && return`, there is no edge from the node for
|
||||
// `return` into the `&&` node.
|
||||
not c instanceof CfgImpl::NormalCompletion
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2575,6 +2575,75 @@ module MakeCfgNodes<LocationSig Loc, InputSig<Loc> Input> {
|
||||
predicate hasExpr() { exists(this.getExpr()) }
|
||||
}
|
||||
|
||||
final private class ParentSelfParam extends ParentAstNode, SelfParam {
|
||||
override predicate relevantChild(AstNode child) { none() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A SelfParam. For example:
|
||||
* ```rust
|
||||
* todo!()
|
||||
* ```
|
||||
*/
|
||||
final class SelfParamCfgNode extends CfgNodeFinal {
|
||||
private SelfParam node;
|
||||
|
||||
SelfParamCfgNode() { node = this.getAstNode() }
|
||||
|
||||
/** Gets the underlying `SelfParam`. */
|
||||
SelfParam getSelfParam() { result = node }
|
||||
|
||||
/**
|
||||
* Gets the `index`th attr of this self parameter (0-based).
|
||||
*/
|
||||
Attr getAttr(int index) { result = node.getAttr(index) }
|
||||
|
||||
/**
|
||||
* Gets any of the attrs of this self parameter.
|
||||
*/
|
||||
Attr getAnAttr() { result = this.getAttr(_) }
|
||||
|
||||
/**
|
||||
* Gets the number of attrs of this self parameter.
|
||||
*/
|
||||
int getNumberOfAttrs() { result = count(int i | exists(this.getAttr(i))) }
|
||||
|
||||
/**
|
||||
* Holds if this self parameter is mut.
|
||||
*/
|
||||
predicate isMut() { node.isMut() }
|
||||
|
||||
/**
|
||||
* Gets the lifetime of this self parameter, if it exists.
|
||||
*/
|
||||
Lifetime getLifetime() { result = node.getLifetime() }
|
||||
|
||||
/**
|
||||
* Holds if `getLifetime()` exists.
|
||||
*/
|
||||
predicate hasLifetime() { exists(this.getLifetime()) }
|
||||
|
||||
/**
|
||||
* Gets the name of this self parameter, if it exists.
|
||||
*/
|
||||
Name getName() { result = node.getName() }
|
||||
|
||||
/**
|
||||
* Holds if `getName()` exists.
|
||||
*/
|
||||
predicate hasName() { exists(this.getName()) }
|
||||
|
||||
/**
|
||||
* Gets the ty of this self parameter, if it exists.
|
||||
*/
|
||||
TypeRef getTy() { result = node.getTy() }
|
||||
|
||||
/**
|
||||
* Holds if `getTy()` exists.
|
||||
*/
|
||||
predicate hasTy() { exists(this.getTy()) }
|
||||
}
|
||||
|
||||
final private class ParentSlicePat extends ParentAstNode, SlicePat {
|
||||
override predicate relevantChild(AstNode child) {
|
||||
none()
|
||||
|
||||
@@ -158,7 +158,7 @@ module Node {
|
||||
|
||||
ParameterNode() { this = TParameterNode(n) }
|
||||
|
||||
/** Gets the parameter in the AST that this node corresponds to. */
|
||||
/** Gets the parameter in the CFG that this node corresponds to. */
|
||||
ParamCfgNode getParameter() { result = n }
|
||||
}
|
||||
|
||||
|
||||
@@ -1467,7 +1467,7 @@ class _:
|
||||
"""
|
||||
|
||||
|
||||
@annotate(SelfParam)
|
||||
@annotate(SelfParam, cfg = True)
|
||||
class _:
|
||||
"""
|
||||
A SelfParam. For example:
|
||||
|
||||
Reference in New Issue
Block a user