mirror of
https://github.com/github/codeql.git
synced 2026-05-25 00:27:09 +02:00
PS: Easier debugging with strings for child indices.
This commit is contained in:
@@ -46,6 +46,67 @@ int synthPipelineParameterChildIndex(Raw::ScriptBlock sb) {
|
||||
)
|
||||
}
|
||||
|
||||
string stringOfChildIndex(ChildIndex i) {
|
||||
exists(Raw::ChildIndex rawIndex |
|
||||
i = RawChildIndex(rawIndex) and
|
||||
result = Raw::stringOfChildIndex(rawIndex)
|
||||
)
|
||||
or
|
||||
i = ParamPipeline() and
|
||||
result = "ParamPipeline"
|
||||
or
|
||||
i = ParamDefaultVal() and
|
||||
result = "ParamDefaultVal"
|
||||
or
|
||||
i = FunParam(_) and
|
||||
result = "FunParam"
|
||||
or
|
||||
i = CmdArgument(_) and
|
||||
result = "CmdArgument"
|
||||
or
|
||||
i = ExprStmtExpr() and
|
||||
result = "ExprStmtExpr"
|
||||
or
|
||||
i = MethodBody() and
|
||||
result = "MethodBody"
|
||||
or
|
||||
i = ThisVar() and
|
||||
result = "ThisVar"
|
||||
or
|
||||
i = PipelineParamVar() and
|
||||
result = "PipelineParamVar"
|
||||
or
|
||||
i = PipelineIteratorVar() and
|
||||
result = "PipelineIteratorVar"
|
||||
or
|
||||
i = PipelineByPropertyNameIteratorVar(_) and
|
||||
result = "PipelineByPropertyNameIteratorVar"
|
||||
or
|
||||
i = RealVar(_) and
|
||||
result = "RealVar"
|
||||
or
|
||||
i = ExprRedirection(_) and
|
||||
result = "ExprRedirection"
|
||||
or
|
||||
i = FunDefFun() and
|
||||
result = "FunDefFun"
|
||||
or
|
||||
i = TypeDefType() and
|
||||
result = "TypeDefType"
|
||||
or
|
||||
i = TypeMember(_) and
|
||||
result = "TypeMember"
|
||||
or
|
||||
i = ScriptBlockAttr(_) and
|
||||
result = "ScriptBlockAttr"
|
||||
or
|
||||
i = ParamAttr(_) and
|
||||
result = "ParamAttr"
|
||||
or
|
||||
i = FunctionBody() and
|
||||
result = "FunctionBody"
|
||||
}
|
||||
|
||||
Raw::ChildIndex toRawChildIndex(ChildIndex i) { i = RawChildIndex(result) }
|
||||
|
||||
ChildIndex arrayExprStmtBlock() { result = RawChildIndex(Raw::ArrayExprStmtBlock()) }
|
||||
|
||||
@@ -99,3 +99,201 @@ newtype ChildIndex =
|
||||
UsingExprExpr() or
|
||||
WhileStmtCond() or
|
||||
WhileStmtBody()
|
||||
|
||||
string stringOfChildIndex(ChildIndex i) {
|
||||
i = ArrayExprStmtBlock() and result = "ArrayExprStmtBlock"
|
||||
or
|
||||
i = ArrayLiteralExpr(_) and result = "ArrayLiteralExpr"
|
||||
or
|
||||
i = AssignStmtLeftHandSide() and result = "AssignStmtLeftHandSide"
|
||||
or
|
||||
i = AssignStmtRightHandSide() and result = "AssignStmtRightHandSide"
|
||||
or
|
||||
i = AttributeNamedArg(_) and result = "AttributeNamedArg"
|
||||
or
|
||||
i = AttributePosArg(_) and result = "AttributePosArg"
|
||||
or
|
||||
i = AttributedExprExpr() and result = "AttributedExprExpr"
|
||||
or
|
||||
i = AttributedExprAttr() and result = "AttributedExprAttr"
|
||||
or
|
||||
i = BinaryExprLeft() and result = "BinaryExprLeft"
|
||||
or
|
||||
i = BinaryExprRight() and result = "BinaryExprRight"
|
||||
or
|
||||
i = CatchClauseBody() and result = "CatchClauseBody"
|
||||
or
|
||||
i = CatchClauseType(_) and result = "CatchClauseType"
|
||||
or
|
||||
i = CmdElement_(_) and result = "CmdElement"
|
||||
or
|
||||
i = CmdCallee() and result = "CmdCallee"
|
||||
or
|
||||
i = CmdRedirection(_) and result = "CmdRedirection"
|
||||
or
|
||||
i = CmdExprExpr() and result = "CmdExprExpr"
|
||||
or
|
||||
i = ConfigurationName() and result = "ConfigurationName"
|
||||
or
|
||||
i = ConfigurationBody() and result = "ConfigurationBody"
|
||||
or
|
||||
i = ConvertExprExpr() and result = "ConvertExprExpr"
|
||||
or
|
||||
i = ConvertExprType() and result = "ConvertExprType"
|
||||
or
|
||||
i = ConvertExprAttr() and result = "ConvertExprAttr"
|
||||
or
|
||||
i = DataStmtBody() and result = "DataStmtBody"
|
||||
or
|
||||
i = DataStmtCmdAllowed(_) and result = "DataStmtCmdAllowed"
|
||||
or
|
||||
i = DoUntilStmtCond() and result = "DoUntilStmtCond"
|
||||
or
|
||||
i = DoUntilStmtBody() and result = "DoUntilStmtBody"
|
||||
or
|
||||
i = DoWhileStmtCond() and result = "DoWhileStmtCond"
|
||||
or
|
||||
i = DoWhileStmtBody() and result = "DoWhileStmtBody"
|
||||
or
|
||||
i = DynamicStmtName() and result = "DynamicStmtName"
|
||||
or
|
||||
i = DynamicStmtBody() and result = "DynamicStmtBody"
|
||||
or
|
||||
i = ExitStmtPipeline() and result = "ExitStmtPipeline"
|
||||
or
|
||||
i = ExpandableStringExprExpr(_) and result = "ExpandableStringExprExpr"
|
||||
or
|
||||
i = ForEachStmtVar() and result = "ForEachStmtVar"
|
||||
or
|
||||
i = ForEachStmtIter() and result = "ForEachStmtIter"
|
||||
or
|
||||
i = ForEachStmtBody() and result = "ForEachStmtBody"
|
||||
or
|
||||
i = ForStmtInit() and result = "ForStmtInit"
|
||||
or
|
||||
i = ForStmtCond() and result = "ForStmtCond"
|
||||
or
|
||||
i = ForStmtIter() and result = "ForStmtIter"
|
||||
or
|
||||
i = ForStmtBody() and result = "ForStmtBody"
|
||||
or
|
||||
i = FunDefStmtBody() and result = "FunDefStmtBody"
|
||||
or
|
||||
i = FunDefStmtParam(_) and result = "FunDefStmtParam"
|
||||
or
|
||||
i = GotoStmtLabel() and result = "GotoStmtLabel"
|
||||
or
|
||||
i = HashTableExprKey(_) and result = "HashTableExprKey"
|
||||
or
|
||||
i = HashTableExprStmt(_) and result = "HashTableExprStmt"
|
||||
or
|
||||
i = IfStmtElse() and result = "IfStmtElse"
|
||||
or
|
||||
i = IfStmtCond(_) and result = "IfStmtCond"
|
||||
or
|
||||
i = IfStmtThen(_) and result = "IfStmtThen"
|
||||
or
|
||||
i = IndexExprIndex() and result = "IndexExprIndex"
|
||||
or
|
||||
i = IndexExprBase() and result = "IndexExprBase"
|
||||
or
|
||||
i = InvokeMemberExprQual() and result = "InvokeMemberExprQual"
|
||||
or
|
||||
i = InvokeMemberExprCallee() and result = "InvokeMemberExprCallee"
|
||||
or
|
||||
i = InvokeMemberExprArg(_) and result = "InvokeMemberExprArg"
|
||||
or
|
||||
i = MemberExprQual() and result = "MemberExprQual"
|
||||
or
|
||||
i = MemberExprMember() and result = "MemberExprMember"
|
||||
or
|
||||
i = NamedAttributeArgVal() and result = "NamedAttributeArgVal"
|
||||
or
|
||||
i = MemberAttr(_) and result = "MemberAttr"
|
||||
or
|
||||
i = MemberTypeConstraint() and result = "MemberTypeConstraint"
|
||||
or
|
||||
i = NamedBlockStmt(_) and result = "NamedBlockStmt"
|
||||
or
|
||||
i = NamedBlockTrap(_) and result = "NamedBlockTrap"
|
||||
or
|
||||
i = ParamBlockAttr(_) and result = "ParamBlockAttr"
|
||||
or
|
||||
i = ParamBlockParam(_) and result = "ParamBlockParam"
|
||||
or
|
||||
i = ParamAttr(_) and result = "ParamAttr"
|
||||
or
|
||||
i = ParamDefaultVal() and result = "ParamDefaultVal"
|
||||
or
|
||||
i = ParenExprExpr() and result = "ParenExprExpr"
|
||||
or
|
||||
i = PipelineComp(_) and result = "PipelineComp"
|
||||
or
|
||||
i = PipelineChainLeft() and result = "PipelineChainLeft"
|
||||
or
|
||||
i = PipelineChainRight() and result = "PipelineChainRight"
|
||||
or
|
||||
i = ReturnStmtPipeline() and result = "ReturnStmtPipeline"
|
||||
or
|
||||
i = RedirectionExpr() and result = "RedirectionExpr"
|
||||
or
|
||||
i = ScriptBlockUsing(_) and result = "ScriptBlockUsing"
|
||||
or
|
||||
i = ScriptBlockParamBlock() and result = "ScriptBlockParamBlock"
|
||||
or
|
||||
i = ScriptBlockBeginBlock() and result = "ScriptBlockBeginBlock"
|
||||
or
|
||||
i = ScriptBlockCleanBlock() and result = "ScriptBlockCleanBlock"
|
||||
or
|
||||
i = ScriptBlockDynParamBlock() and result = "ScriptBlockDynParamBlock"
|
||||
or
|
||||
i = ScriptBlockEndBlock() and result = "ScriptBlockEndBlock"
|
||||
or
|
||||
i = ScriptBlockProcessBlock() and result = "ScriptBlockProcessBlock"
|
||||
or
|
||||
i = ScriptBlockExprBody() and result = "ScriptBlockExprBody"
|
||||
or
|
||||
i = StmtBlockStmt(_) and result = "StmtBlockStmt"
|
||||
or
|
||||
i = StmtBlockTrapStmt(_) and result = "StmtBlockTrapStmt"
|
||||
or
|
||||
i = ExpandableSubExprExpr() and result = "ExpandableSubExprExpr"
|
||||
or
|
||||
i = SwitchStmtCond() and result = "SwitchStmtCond"
|
||||
or
|
||||
i = SwitchStmtDefault() and result = "SwitchStmtDefault"
|
||||
or
|
||||
i = SwitchStmtCase(_) and result = "SwitchStmtCase"
|
||||
or
|
||||
i = SwitchStmtPat(_) and result = "SwitchStmtPat"
|
||||
or
|
||||
i = CondExprCond() and result = "CondExprCond"
|
||||
or
|
||||
i = CondExprTrue() and result = "CondExprTrue"
|
||||
or
|
||||
i = CondExprFalse() and result = "CondExprFalse"
|
||||
or
|
||||
i = ThrowStmtPipeline() and result = "ThrowStmtPipeline"
|
||||
or
|
||||
i = TryStmtBody() and result = "TryStmtBody"
|
||||
or
|
||||
i = TryStmtCatchClause(_) and result = "TryStmtCatchClause"
|
||||
or
|
||||
i = TryStmtFinally() and result = "TryStmtFinally"
|
||||
or
|
||||
i = TypeStmtMember(_) and result = "TypeStmtMember"
|
||||
or
|
||||
i = TypeStmtBaseType(_) and result = "TypeStmtBaseType"
|
||||
or
|
||||
i = TrapStmtBody() and result = "TrapStmtBody"
|
||||
or
|
||||
i = TrapStmtTypeConstraint() and result = "TrapStmtTypeConstraint"
|
||||
or
|
||||
i = UnaryExprOp() and result = "UnaryExprOp"
|
||||
or
|
||||
i = UsingExprExpr() and result = "UsingExprExpr"
|
||||
or
|
||||
i = WhileStmtCond() and result = "WhileStmtCond"
|
||||
or
|
||||
i = WhileStmtBody() and result = "WhileStmtBody"
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class PipelineParameter extends Parameter {
|
||||
this.getAnAttribute().(Attribute).getANamedArgument() = namedAttribute and
|
||||
namedAttribute.getName().toLowerCase() = "valuefrompipeline"
|
||||
|
|
||||
namedAttribute.getValue().(ConstExpr).getValue().getValue() = "true"
|
||||
namedAttribute.getValue().(ConstExpr).getValue().getValue().toLowerCase() = "true"
|
||||
or
|
||||
not exists(namedAttribute.getValue().(ConstExpr).getValue().getValue())
|
||||
)
|
||||
@@ -50,7 +50,7 @@ class PipelineByPropertyNameParameter extends Parameter {
|
||||
this.getAnAttribute().(Attribute).getANamedArgument() = namedAttribute and
|
||||
namedAttribute.getName().toLowerCase() = "valuefrompipelinebypropertyname"
|
||||
|
|
||||
namedAttribute.getValue().(ConstExpr).getValue().getValue() = "true"
|
||||
namedAttribute.getValue().(ConstExpr).getValue().getValue().toLowerCase() = "true"
|
||||
or
|
||||
not exists(namedAttribute.getValue().(ConstExpr).getValue().getValue())
|
||||
)
|
||||
|
||||
@@ -100,7 +100,7 @@ module Private {
|
||||
|
||||
final override Variable getVariableImpl() { access(va, result) }
|
||||
|
||||
final override string toString() { result = va.getUserPath() }
|
||||
final override string toString() { result = "access to " + va.getUserPath() }
|
||||
}
|
||||
|
||||
class VarAccessSynth extends VarAccessImpl, TVarAccessSynth {
|
||||
@@ -111,7 +111,7 @@ module Private {
|
||||
|
||||
final override Variable getVariableImpl() { any(Synthesis s).getAnAccess(this, result) }
|
||||
|
||||
final override string toString() { result = this.getVariableImpl().getName() }
|
||||
final override string toString() { result = "access to " + this.getVariableImpl().getName() }
|
||||
|
||||
final override Location getLocation() { result = parent.getLocation() }
|
||||
}
|
||||
|
||||
@@ -282,6 +282,14 @@ class ProcessBlockCfgNode extends NamedBlockCfgNode {
|
||||
override ProcessBlock getBlock() { result = block }
|
||||
|
||||
ScriptBlockCfgNode getScriptBlock() { result.getProcessBlock() = this }
|
||||
|
||||
PipelineVariable getPipelineVariable() {
|
||||
result.getScriptBlock() = this.getScriptBlock().getAstNode()
|
||||
}
|
||||
|
||||
PipelineIteratorVariable getPipelineIteratorVariable() {
|
||||
result.getProcessBlock().getScriptBlock() = this.getScriptBlock().getAstNode()
|
||||
}
|
||||
}
|
||||
|
||||
private class CatchClauseChildMapping extends NonExprChildMapping, CatchClause {
|
||||
|
||||
Reference in New Issue
Block a user