mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
C++: Skip children we cannot translate when translating builtin operations.
This commit is contained in:
@@ -3208,9 +3208,13 @@ class TranslatedBuiltInOperation extends TranslatedNonConstantExpr {
|
|||||||
|
|
||||||
final override Instruction getResult() { result = this.getInstruction(OnlyInstructionTag()) }
|
final override Instruction getResult() { result = this.getInstruction(OnlyInstructionTag()) }
|
||||||
|
|
||||||
|
private TranslatedElement getRankedChild(int rnk) {
|
||||||
|
result = rank[rnk + 1](int id, TranslatedElement te | te = this.getChild(id) | te order by id)
|
||||||
|
}
|
||||||
|
|
||||||
final override Instruction getFirstInstruction(EdgeKind kind) {
|
final override Instruction getFirstInstruction(EdgeKind kind) {
|
||||||
if exists(this.getChild(0))
|
if exists(this.getRankedChild(0))
|
||||||
then result = this.getChild(0).getFirstInstruction(kind)
|
then result = this.getRankedChild(0).getFirstInstruction(kind)
|
||||||
else (
|
else (
|
||||||
kind instanceof GotoEdge and result = this.getInstruction(OnlyInstructionTag())
|
kind instanceof GotoEdge and result = this.getInstruction(OnlyInstructionTag())
|
||||||
)
|
)
|
||||||
@@ -3230,11 +3234,11 @@ class TranslatedBuiltInOperation extends TranslatedNonConstantExpr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
|
final override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
|
||||||
exists(int id | child = this.getChild(id) |
|
exists(int id | child = this.getRankedChild(id) |
|
||||||
result = this.getChild(id + 1).getFirstInstruction(kind)
|
result = this.getRankedChild(id + 1).getFirstInstruction(kind)
|
||||||
or
|
or
|
||||||
kind instanceof GotoEdge and
|
kind instanceof GotoEdge and
|
||||||
not exists(this.getChild(id + 1)) and
|
not exists(this.getRankedChild(id + 1)) and
|
||||||
result = this.getInstruction(OnlyInstructionTag())
|
result = this.getInstruction(OnlyInstructionTag())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3249,7 +3253,7 @@ class TranslatedBuiltInOperation extends TranslatedNonConstantExpr {
|
|||||||
tag = OnlyInstructionTag() and
|
tag = OnlyInstructionTag() and
|
||||||
exists(int index |
|
exists(int index |
|
||||||
operandTag = positionalArgumentOperand(index) and
|
operandTag = positionalArgumentOperand(index) and
|
||||||
result = this.getChild(index).(TranslatedExpr).getResult()
|
result = this.getRankedChild(index).(TranslatedExpr).getResult()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user