mirror of
https://github.com/github/codeql.git
synced 2026-04-24 16:25:15 +02:00
C++: Add an 'EdgeKind' column to 'getInitializationSuccessor'.
This commit is contained in:
@@ -67,8 +67,8 @@ abstract class TranslatedLocalVariableDeclaration extends TranslatedVariableInit
|
||||
getTranslatedInitialization(this.getVariable().getInitializer().getExpr().getFullyConverted())
|
||||
}
|
||||
|
||||
final override Instruction getInitializationSuccessor() {
|
||||
result = this.getParent().getChildSuccessor(this, any(GotoEdge edge))
|
||||
final override Instruction getInitializationSuccessor(EdgeKind kind) {
|
||||
result = this.getParent().getChildSuccessor(this, kind)
|
||||
}
|
||||
|
||||
final override IRVariable getIRVariable() {
|
||||
|
||||
@@ -2544,8 +2544,8 @@ class TranslatedTemporaryObjectExpr extends TranslatedNonConstantExpr,
|
||||
result = getIRTempVariable(expr, TempObjectTempVar())
|
||||
}
|
||||
|
||||
final override Instruction getInitializationSuccessor() {
|
||||
result = this.getParent().getChildSuccessor(this, any(GotoEdge edge))
|
||||
final override Instruction getInitializationSuccessor(EdgeKind kind) {
|
||||
result = this.getParent().getChildSuccessor(this, kind)
|
||||
}
|
||||
|
||||
final override Instruction getResult() { result = this.getTargetAddress() }
|
||||
@@ -2593,8 +2593,9 @@ class TranslatedThrowValueExpr extends TranslatedThrowExpr, TranslatedVariableIn
|
||||
result = TranslatedVariableInitialization.super.getInstructionSuccessor(tag, kind)
|
||||
}
|
||||
|
||||
final override Instruction getInitializationSuccessor() {
|
||||
result = this.getInstruction(ThrowTag())
|
||||
final override Instruction getInitializationSuccessor(EdgeKind kind) {
|
||||
result = this.getInstruction(ThrowTag()) and
|
||||
kind instanceof GotoEdge
|
||||
}
|
||||
|
||||
final override predicate hasTempVariable(TempVariableTag tag, CppType type) {
|
||||
|
||||
@@ -674,7 +674,7 @@ class TranslatedDestructorDestructionList extends TranslatedElement,
|
||||
override Instruction getFirstInstruction(EdgeKind kind) {
|
||||
if exists(this.getChild(0))
|
||||
then result = this.getChild(0).getFirstInstruction(kind)
|
||||
else result = this.getParent().getChildSuccessor(this, any(GotoEdge edge))
|
||||
else result = this.getParent().getChildSuccessor(this, kind)
|
||||
}
|
||||
|
||||
override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) {
|
||||
|
||||
@@ -66,16 +66,14 @@ abstract class TranslatedVariableInitialization extends TranslatedElement, Initi
|
||||
(
|
||||
result = this.getInitialization().getFirstInstruction(kind)
|
||||
or
|
||||
kind instanceof GotoEdge and
|
||||
not exists(this.getInitialization()) and
|
||||
result = this.getInitializationSuccessor()
|
||||
result = this.getInitializationSuccessor(kind)
|
||||
)
|
||||
}
|
||||
|
||||
final override Instruction getChildSuccessor(TranslatedElement child, EdgeKind kind) {
|
||||
child = this.getInitialization() and
|
||||
result = this.getInitializationSuccessor() and
|
||||
kind instanceof GotoEdge
|
||||
result = this.getInitializationSuccessor(kind)
|
||||
}
|
||||
|
||||
override Instruction getInstructionRegisterOperand(InstructionTag tag, OperandTag operandTag) {
|
||||
@@ -110,8 +108,9 @@ abstract class TranslatedVariableInitialization extends TranslatedElement, Initi
|
||||
|
||||
/**
|
||||
* Gets the `Instruction` to be executed immediately after the initialization.
|
||||
* The successor edge kind is specified by `kind`.
|
||||
*/
|
||||
abstract Instruction getInitializationSuccessor();
|
||||
abstract Instruction getInitializationSuccessor(EdgeKind kind);
|
||||
|
||||
/**
|
||||
* Holds if this initialization requires an `Uninitialized` instruction to be emitted before
|
||||
|
||||
@@ -367,8 +367,8 @@ abstract class TranslatedReturnStmt extends TranslatedStmt {
|
||||
class TranslatedReturnValueStmt extends TranslatedReturnStmt, TranslatedVariableInitialization {
|
||||
TranslatedReturnValueStmt() { stmt.hasExpr() and hasReturnValue(stmt.getEnclosingFunction()) }
|
||||
|
||||
final override Instruction getInitializationSuccessor() {
|
||||
result = this.getEnclosingFunction().getReturnSuccessorInstruction(any(GotoEdge edge))
|
||||
final override Instruction getInitializationSuccessor(EdgeKind kind) {
|
||||
result = this.getEnclosingFunction().getReturnSuccessorInstruction(kind)
|
||||
}
|
||||
|
||||
final override Type getTargetType() { result = this.getEnclosingFunction().getReturnType() }
|
||||
@@ -460,8 +460,8 @@ class TranslatedNoValueReturnStmt extends TranslatedReturnStmt, TranslatedVariab
|
||||
not stmt.hasExpr() and hasReturnValue(stmt.getEnclosingFunction())
|
||||
}
|
||||
|
||||
final override Instruction getInitializationSuccessor() {
|
||||
result = this.getEnclosingFunction().getReturnSuccessorInstruction(any(GotoEdge edge))
|
||||
final override Instruction getInitializationSuccessor(EdgeKind kind) {
|
||||
result = this.getEnclosingFunction().getReturnSuccessorInstruction(kind)
|
||||
}
|
||||
|
||||
final override Type getTargetType() { result = this.getEnclosingFunction().getReturnType() }
|
||||
|
||||
Reference in New Issue
Block a user