C++: QLDoc and naming updates for implicit destructors in IR

This commit is contained in:
Robert Marsh
2024-02-05 19:14:56 +00:00
parent bbabf1dfcc
commit 8013c2a074
9 changed files with 173 additions and 140 deletions

View File

@@ -47,8 +47,8 @@ abstract class TranslatedCall extends TranslatedExpr {
else result = this.getFirstCallTargetInstruction(kind)
}
override Instruction getLastInstructionInternal() {
result = this.getSideEffects().getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getSideEffects().getALastInstruction()
}
override TranslatedElement getLastChild() { result = this.getSideEffects() }
@@ -94,7 +94,6 @@ abstract class TranslatedCall extends TranslatedExpr {
}
override Instruction getInstructionSuccessorInternal(InstructionTag tag, EdgeKind kind) {
kind instanceof GotoEdge and
tag = CallTag() and
result = this.getSideEffects().getFirstInstruction(kind)
}
@@ -257,9 +256,9 @@ abstract class TranslatedSideEffects extends TranslatedElement {
result = this.getParent().getChildSuccessor(this, kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
if exists(this.getAChild())
then result = this.getChild(max(int i | exists(this.getChild(i)))).getLastInstruction()
then result = this.getChild(max(int i | exists(this.getChild(i)))).getALastInstruction()
else
// If there are no side effects, the "last" instruction should be the parent call's last
// instruction, so that implicit destructors can be inserted in the right place.
@@ -455,7 +454,7 @@ abstract class TranslatedSideEffect extends TranslatedElement {
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}

View File

@@ -58,8 +58,8 @@ abstract class TranslatedFlexibleCondition extends TranslatedCondition, Conditio
result = this.getOperand().getFirstInstruction(kind)
}
final override Instruction getLastInstructionInternal() {
result = this.getOperand().getLastInstruction()
final override Instruction getALastInstructionInternal() {
result = this.getOperand().getALastInstruction()
}
final override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) {
@@ -70,7 +70,7 @@ abstract class TranslatedFlexibleCondition extends TranslatedCondition, Conditio
none()
}
final override Instruction getChildSuccessor(TranslatedElement child, EdgeKind kind) { none() }
final override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) { none() }
abstract TranslatedCondition getOperand();
}
@@ -96,7 +96,7 @@ class TranslatedParenthesisCondition extends TranslatedFlexibleCondition {
abstract class TranslatedNativeCondition extends TranslatedCondition, TTranslatedNativeCondition {
TranslatedNativeCondition() { this = TTranslatedNativeCondition(expr) }
final override Instruction getChildSuccessor(TranslatedElement child, EdgeKind kind) { none() }
final override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) { none() }
}
abstract class TranslatedBinaryLogicalOperation extends TranslatedNativeCondition, ConditionContext {
@@ -114,10 +114,10 @@ abstract class TranslatedBinaryLogicalOperation extends TranslatedNativeConditio
result = this.getLeftOperand().getFirstInstruction(kind)
}
final override Instruction getLastInstructionInternal() {
result = this.getLeftOperand().getLastInstruction()
final override Instruction getALastInstructionInternal() {
result = this.getLeftOperand().getALastInstruction()
or
result = this.getRightOperand().getLastInstruction()
result = this.getRightOperand().getALastInstruction()
}
final override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) {
@@ -180,7 +180,7 @@ class TranslatedValueCondition extends TranslatedCondition, TTranslatedValueCond
result = this.getValueExpr().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(ValueConditionConditionalBranchTag())
}
@@ -192,7 +192,7 @@ class TranslatedValueCondition extends TranslatedCondition, TTranslatedValueCond
resultType = getVoidType()
}
override Instruction getChildSuccessor(TranslatedElement child, EdgeKind kind) {
override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
child = this.getValueExpr() and
result = this.getInstruction(ValueConditionConditionalBranchTag()) and
kind instanceof GotoEdge

View File

@@ -156,7 +156,7 @@ class TranslatedStaticLocalVariableDeclarationEntry extends TranslatedDeclaratio
kind instanceof GotoEdge
}
final override Instruction getLastInstructionInternal() {
final override Instruction getALastInstructionInternal() {
result = this.getInstruction(DynamicInitializationConditionalBranchTag())
or
result = this.getInstruction(DynamicInitializationFlagStoreTag())
@@ -188,7 +188,7 @@ class TranslatedStaticLocalVariableDeclarationEntry extends TranslatedDeclaratio
result = this.getParent().getChildSuccessor(this, kind)
}
final override Instruction getChildSuccessor(TranslatedElement child, EdgeKind kind) {
final override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
child = this.getInitialization() and
result = this.getInstruction(DynamicInitializationFlagConstantTag()) and
kind instanceof GotoEdge

View File

@@ -23,15 +23,6 @@ private import SideEffects
Element getRealParent(Expr expr) {
result = expr.getParentWithConversions()
or
/*
* exists(Stmt destructorParent, DestructorCall dc |
* destructorParent.getAnImplicitDestructorCall() = dc and
* dc.getQualifier() = expr and
* result = dc
* )
* or
*/
result.(Destructor).getADestruction() = expr
or
result.(Expr).getAnImplicitDestructorCall() = expr
@@ -873,12 +864,18 @@ abstract class TranslatedElement extends TTranslatedElement {
/**
* Holds if this element has implicit destructor calls that should follow it.
*/
predicate hasImplicitDestructorCalls() { none() }
predicate hasAnImplicitDestructorCall() { none() }
/**
* Gets the child index of the first destructor call that should be executed after this `TranslatedElement`
*/
int getFirstDestructorCallIndex() { none() }
/**
* Holds if this `TranslatedElement` includes any destructor calls that must be performed after
* it in its `getChildSuccessorInternal`, `getInstructionSuccessorInternal`, and
* `getALastInstructionInternal` relations, rather than needing them inserted.
*/
predicate handlesDestructorsExplicitly() { none() }
private int getUniqueId() {
@@ -916,13 +913,19 @@ abstract class TranslatedElement extends TTranslatedElement {
/**
* Gets the successor instruction of the instruction that was generated by
* this element for tag `tag`. The successor edge kind is specified by `kind`.
* This predicate does not usually include destructors, which are inserted as
* part of `getInstructionSuccessor` unless `handlesDestructorsExplicitly`
* holds.
*/
abstract Instruction getInstructionSuccessorInternal(InstructionTag tag, EdgeKind kind);
Instruction getInstructionSuccessor(InstructionTag tag, EdgeKind kind) {
/**
* Gets the successor instruction of the instruction that was generated by
* this element for tag `tag`. The successor edge kind is specified by `kind`.
*/
final Instruction getInstructionSuccessor(InstructionTag tag, EdgeKind kind) {
if
this.hasImplicitDestructorCalls() and
this.getInstruction(tag) = this.getLastInstructionInternal() and
this.hasAnImplicitDestructorCall() and
this.getInstruction(tag) = this.getALastInstructionInternal() and
not this.handlesDestructorsExplicitly()
then
result = this.getChild(this.getFirstDestructorCallIndex()).getFirstInstruction(kind) and
@@ -930,13 +933,23 @@ abstract class TranslatedElement extends TTranslatedElement {
else result = this.getInstructionSuccessorInternal(tag, kind)
}
final Instruction getLastInstruction() {
if this.hasImplicitDestructorCalls() and not this.handlesDestructorsExplicitly()
then result = this.getChild(max(int n | exists(this.getChild(n)))).getLastInstruction() // last destructor
else result = this.getLastInstructionInternal()
/**
* Gets an instruction within this `TranslatedElement` (including its transitive children) which
* will be followed by an instruction outside the `TranslatedElement`.
*/
final Instruction getALastInstruction() {
if this.hasAnImplicitDestructorCall() and not this.handlesDestructorsExplicitly()
then result = this.getChild(max(int n | exists(this.getChild(n)))).getALastInstruction() // last destructor
else result = this.getALastInstructionInternal()
}
abstract Instruction getLastInstructionInternal();
/**
* Gets an instruction within this `TranslatedElement` (including its transitive children) which
* will be followed by an instruction outside the `TranslatedElement`.
* This predicate does not usually include destructors, which are inserted as
* part of `getALastInstruction` unless `handlesDestructorsExplicitly` holds.
*/
abstract Instruction getALastInstructionInternal();
TranslatedElement getLastChild() { none() }
@@ -944,14 +957,21 @@ abstract class TranslatedElement extends TTranslatedElement {
* Gets the successor instruction to which control should flow after the
* child element specified by `child` has finished execution. The successor
* edge kind is specified by `kind`.
* This predicate does not usually include destructors, which are inserted as
* part of `getChildSuccessor` unless `handlesDestructorsExplicitly` holds.
*/
Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) { none() }
Instruction getChildSuccessor(TranslatedElement child, EdgeKind kind) {
/**
* Gets the successor instruction to which control should flow after the
* child element specified by `child` has finished execution. The successor
* edge kind is specified by `kind`.
*/
final Instruction getChildSuccessor(TranslatedElement child, EdgeKind kind) {
(
if
// this is the last child and we need to handle destructors for it
this.hasImplicitDestructorCalls() and
this.hasAnImplicitDestructorCall() and
not this.handlesDestructorsExplicitly() and
child = this.getLastChild()
then result = this.getChild(this.getFirstDestructorCallIndex()).getFirstInstruction(kind)

View File

@@ -76,6 +76,15 @@ abstract class TranslatedExpr extends TranslatedElement {
expr.isGLValueCategory()
}
/**
* Gets the immediate child element of this element. The `id` is unique
* among all children of this element, but the values are not necessarily
* consecutive.
*
* This predicate does not usually include destructors, which are inserted as
* part of `getChild` unless `handlesDestructorsExplicitly`
* holds.
*/
abstract TranslatedElement getChildInternal(int id);
final override TranslatedElement getChild(int id) {
@@ -88,14 +97,17 @@ abstract class TranslatedExpr extends TranslatedElement {
)
}
final override predicate hasImplicitDestructorCalls() {
final override predicate hasAnImplicitDestructorCall() {
exists(expr.getAnImplicitDestructorCall())
}
final override int getFirstDestructorCallIndex() {
result = max(int childId | exists(this.getChildInternal(childId))) + 1
or
not exists(this.getChildInternal(_)) and result = 0
not this.handlesDestructorsExplicitly() and
(
result = max(int childId | exists(this.getChildInternal(childId))) + 1
or
not exists(this.getChildInternal(_)) and result = 0
)
}
final override Locatable getAst() { result = expr }
@@ -207,7 +219,7 @@ class TranslatedConditionValue extends TranslatedCoreExpr, ConditionContext,
result = this.getCondition().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(ConditionValueResultLoadTag())
}
@@ -385,7 +397,7 @@ class TranslatedLoad extends TranslatedValueCategoryAdjustment, TTranslatedLoad
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() { result = this.getInstruction(LoadTag()) }
override Instruction getALastInstructionInternal() { result = this.getInstruction(LoadTag()) }
override Instruction getResult() { result = this.getInstruction(LoadTag()) }
@@ -433,7 +445,7 @@ class TranslatedSyntheticTemporaryObject extends TranslatedValueCategoryAdjustme
result = this.getParent().getChildSuccessor(this, kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(InitializerStoreTag())
}
@@ -494,7 +506,7 @@ class TranslatedResultCopy extends TranslatedExpr, TTranslatedResultCopy {
result = this.getParent().getChildSuccessor(this, kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(ResultCopyTag())
}
@@ -524,8 +536,8 @@ class TranslatedCommaExpr extends TranslatedNonConstantExpr {
result = this.getLeftOperand().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
result = this.getRightOperand().getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getRightOperand().getALastInstruction()
}
override TranslatedElement getChildInternal(int id) {
@@ -639,7 +651,7 @@ abstract class TranslatedCrementOperation extends TranslatedNonConstantExpr {
result = this.getLoadedOperand().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(CrementStoreTag())
}
@@ -746,7 +758,7 @@ class TranslatedArrayExpr extends TranslatedNonConstantExpr {
result = this.getBaseOperand().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -808,8 +820,8 @@ abstract class TranslatedTransparentExpr extends TranslatedNonConstantExpr {
result = this.getOperand().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
result = this.getOperand().getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getOperand().getALastInstruction()
}
final override TranslatedElement getChildInternal(int id) {
@@ -894,7 +906,7 @@ class TranslatedThisExpr extends TranslatedNonConstantExpr {
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() { result = this.getInstruction(ThisLoadTag()) }
override Instruction getALastInstructionInternal() { result = this.getInstruction(ThisLoadTag()) }
final override Instruction getInstructionSuccessorInternal(InstructionTag tag, EdgeKind kind) {
kind instanceof GotoEdge and
@@ -959,7 +971,7 @@ class TranslatedNonFieldVariableAccess extends TranslatedVariableAccess {
)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -997,7 +1009,7 @@ class TranslatedFieldAccess extends TranslatedVariableAccess {
result = this.getQualifier().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -1039,7 +1051,7 @@ class TranslatedStructuredBindingVariableAccess extends TranslatedNonConstantExp
result = this.getInstruction(StructuredBindingAccessTag())
}
override Instruction getLastInstructionInternal() { result = this.getInstruction(LoadTag()) }
override Instruction getALastInstructionInternal() { result = this.getInstruction(LoadTag()) }
override TranslatedElement getChildInternal(int id) {
// Structured bindings cannot be qualified.
@@ -1105,7 +1117,7 @@ class TranslatedFunctionAccess extends TranslatedNonConstantExpr {
)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -1160,7 +1172,7 @@ abstract class TranslatedConstantExpr extends TranslatedCoreExpr, TTranslatedVal
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -1243,7 +1255,7 @@ class TranslatedUnaryExpr extends TranslatedSingleInstructionExpr {
result = this.getOperand().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -1307,7 +1319,7 @@ abstract class TranslatedSingleInstructionConversion extends TranslatedConversio
result = this.getParent().getChildSuccessor(this, kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -1408,7 +1420,7 @@ class TranslatedInheritanceConversion extends TranslatedSingleInstructionConvers
class TranslatedBoolConversion extends TranslatedConversion {
override BoolConversion expr;
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(BoolConversionCompareTag())
}
@@ -1537,7 +1549,7 @@ class TranslatedBinaryOperation extends TranslatedSingleInstructionExpr {
result = this.getLeftOperand().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -1638,7 +1650,7 @@ class TranslatedAssignExpr extends TranslatedNonConstantExpr {
result = this.getRightOperand().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(AssignmentStoreTag())
}
@@ -1716,7 +1728,7 @@ class TranslatedBlockAssignExpr extends TranslatedNonConstantExpr {
result = this.getLeftOperand().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(AssignmentStoreTag())
}
@@ -1789,7 +1801,7 @@ class TranslatedAssignOperation extends TranslatedNonConstantExpr {
result = this.getRightOperand().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(AssignmentStoreTag())
}
@@ -2021,7 +2033,7 @@ class TranslatedConstantAllocationSize extends TranslatedAllocationSize {
result = this.getInstruction(AllocationSizeTag())
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(AllocationSizeTag())
}
@@ -2064,7 +2076,7 @@ class TranslatedNonConstantAllocationSize extends TranslatedAllocationSize {
result = this.getExtent().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(AllocationSizeTag())
}
@@ -2327,7 +2339,7 @@ class TranslatedDestructorFieldDestruction extends TranslatedNonConstantExpr, St
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -2355,9 +2367,9 @@ class TranslatedDestructorFieldDestruction extends TranslatedNonConstantExpr, St
abstract class TranslatedConditionalExpr extends TranslatedNonConstantExpr {
override ConditionalExpr expr;
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
if this.elseIsVoid()
then result = this.getElse().getLastInstruction()
then result = this.getElse().getALastInstruction()
else
if exists(this.getInstruction(ConditionValueResultLoadTag()))
then result = this.getInstruction(ConditionValueResultLoadTag())
@@ -2833,7 +2845,7 @@ class TranslatedReThrowExpr extends TranslatedThrowExpr {
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() { result = this.getInstruction(ThrowTag()) }
override Instruction getALastInstructionInternal() { result = this.getInstruction(ThrowTag()) }
override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) { none() }
@@ -2866,7 +2878,7 @@ class TranslatedBuiltInOperation extends TranslatedNonConstantExpr {
)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -2984,7 +2996,7 @@ class TranslatedVarArgsStart extends TranslatedNonConstantExpr {
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(VarArgsVAListStoreTag())
}
@@ -3061,7 +3073,7 @@ class TranslatedVarArg extends TranslatedNonConstantExpr {
result = this.getVAList().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(VarArgsVAListStoreTag())
}
@@ -3137,7 +3149,7 @@ class TranslatedVarArgsEnd extends TranslatedNonConstantExpr {
result = this.getVAList().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -3187,7 +3199,7 @@ class TranslatedVarArgCopy extends TranslatedNonConstantExpr {
result = this.getSourceVAList().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(VarArgsVAListStoreTag())
}
@@ -3265,9 +3277,9 @@ abstract class TranslatedNewOrNewArrayExpr extends TranslatedNonConstantExpr, In
result = this.getAllocatorCall().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
if exists(this.getInitialization())
then result = this.getInitialization().getLastInstruction()
then result = this.getInitialization().getALastInstruction()
else result = this.getInstruction(OnlyInstructionTag())
}
@@ -3347,8 +3359,8 @@ class TranslatedConditionDeclExpr extends TranslatedNonConstantExpr {
result = this.getDecl().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
result = this.getConditionExpr().getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getConditionExpr().getALastInstruction()
}
final override TranslatedElement getChildInternal(int id) {
@@ -3393,7 +3405,7 @@ class TranslatedLambdaExpr extends TranslatedNonConstantExpr, InitializationCont
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() { result = this.getInstruction(LoadTag()) }
override Instruction getALastInstructionInternal() { result = this.getInstruction(LoadTag()) }
final override TranslatedElement getChildInternal(int id) {
id = 0 and result = this.getInitialization()
@@ -3488,7 +3500,9 @@ class TranslatedStmtExpr extends TranslatedNonConstantExpr {
result = this.getStmt().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() { result = this.getStmt().getLastInstruction() }
override Instruction getALastInstructionInternal() {
result = this.getStmt().getALastInstruction()
}
final override TranslatedElement getChildInternal(int id) { id = 0 and result = this.getStmt() }
@@ -3530,7 +3544,7 @@ class TranslatedErrorExpr extends TranslatedSingleInstructionExpr {
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -3630,7 +3644,7 @@ class TranslatedAssumeExpr extends TranslatedSingleInstructionExpr {
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}

View File

@@ -114,7 +114,7 @@ class TranslatedFunction extends TranslatedRootElement, TTranslatedFunction {
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(ExitFunctionTag())
}
@@ -383,7 +383,7 @@ abstract class TranslatedParameter extends TranslatedElement {
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
if this.hasIndirection()
then result = this.getInstruction(InitializerIndirectStoreTag())
else result = this.getInstruction(InitializerStoreTag())
@@ -621,8 +621,8 @@ class TranslatedConstructorInitList extends TranslatedElement, InitializationCon
else result = this.getParent().getChildSuccessor(this, kind)
}
override Instruction getLastInstructionInternal() {
result = this.getLastChild().getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getLastChild().getALastInstruction()
}
override TranslatedElement getLastChild() {
@@ -696,8 +696,8 @@ class TranslatedDestructorDestructionList extends TranslatedElement,
else result = this.getParent().getChildSuccessor(this, kind)
}
override Instruction getLastInstructionInternal() {
result = this.getChild(max(int id | exists(this.getChild(id)))).getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getChild(max(int id | exists(this.getChild(id)))).getALastInstruction()
}
override TranslatedElement getLastChild() {
@@ -754,7 +754,7 @@ class TranslatedReadEffects extends TranslatedElement, TTranslatedReadEffects {
else result = this.getParent().getChildSuccessor(this, kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
if exists(this.getAChild())
then
result =
@@ -811,7 +811,7 @@ abstract class TranslatedReadEffect extends TranslatedElement {
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}

View File

@@ -27,7 +27,7 @@ class TranslatedStaticStorageDurationVarInit extends TranslatedRootElement,
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() { result = this.getInstruction(ExitFunctionTag()) }
override Instruction getALastInstructionInternal() { result = this.getInstruction(ExitFunctionTag()) }
override TranslatedElement getChild(int n) {
n = 1 and
@@ -83,7 +83,7 @@ class TranslatedStaticStorageDurationVarInit extends TranslatedRootElement,
)
}
override Instruction getChildSuccessor(TranslatedElement child, EdgeKind kind) {
override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
child = this.getChild(1) and
result = this.getInstruction(ReturnTag()) and
kind instanceof GotoEdge

View File

@@ -42,8 +42,8 @@ abstract class TranslatedVariableInitialization extends TranslatedElement, Initi
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
result = this.getInitialization().getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getInitialization().getALastInstruction()
or
not exists(this.getInitialization()) and result = this.getInstruction(OnlyInstructionTag())
}
@@ -183,8 +183,8 @@ abstract class TranslatedListInitialization extends TranslatedInitialization, In
result = this.getParent().getChildSuccessor(this, kind)
}
override Instruction getLastInstructionInternal() {
result = this.getChild(max(int i | exists(this.getChild(i)))).getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getChild(max(int i | exists(this.getChild(i)))).getALastInstruction()
}
override Instruction getChildSuccessorInternal(TranslatedElement child, EdgeKind kind) {
@@ -272,7 +272,7 @@ class TranslatedSimpleDirectInitialization extends TranslatedDirectInitializatio
not expr instanceof StringLiteral
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(InitializerStoreTag())
}
@@ -312,7 +312,7 @@ class TranslatedSimpleDirectInitialization extends TranslatedDirectInitializatio
class TranslatedStringLiteralInitialization extends TranslatedDirectInitialization {
override StringLiteral expr;
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
if this.zeroInitRange(_, _)
then result = this.getInstruction(ZeroPadStringStoreTag())
else result = this.getInstruction(InitializerStoreTag())
@@ -479,8 +479,8 @@ class TranslatedConstructorInitialization extends TranslatedDirectInitialization
{
override ConstructorCall expr;
override Instruction getLastInstructionInternal() {
result = this.getInitializer().getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getInitializer().getALastInstruction()
}
override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) {
@@ -586,8 +586,8 @@ class TranslatedExplicitFieldInitialization extends TranslatedFieldInitializatio
this = TTranslatedExplicitFieldInitialization(ast, field, expr, position)
}
override Instruction getLastInstructionInternal() {
result = this.getInitialization().getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getInitialization().getALastInstruction()
}
override Instruction getTargetAddress() {
@@ -629,7 +629,7 @@ class TranslatedFieldValueInitialization extends TranslatedFieldInitialization,
{
TranslatedFieldValueInitialization() { this = TTranslatedFieldValueInitialization(ast, field) }
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(this.getFieldDefaultValueStoreTag())
}
@@ -781,8 +781,8 @@ class TranslatedExplicitElementInitialization extends TranslatedElementInitializ
this = TTranslatedExplicitElementInitialization(initList, elementIndex, position)
}
override Instruction getLastInstructionInternal() {
result = this.getInitialization().getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getInitialization().getALastInstruction()
}
override Instruction getTargetAddress() {
@@ -830,7 +830,7 @@ class TranslatedElementValueInitialization extends TranslatedElementInitializati
this = TTranslatedElementValueInitialization(initList, elementIndex, elementCount)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(this.getElementDefaultValueStoreTag())
}
@@ -942,8 +942,8 @@ abstract class TranslatedBaseStructorCall extends TranslatedStructorCallFromStru
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
result = this.getStructorCall().getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getStructorCall().getALastInstruction()
}
final override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) {
@@ -999,8 +999,8 @@ class TranslatedConstructorDelegationInit extends TranslatedConstructorCallFromC
result = this.getStructorCall().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
result = this.getStructorCall().getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getStructorCall().getALastInstruction()
}
final override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) {
@@ -1067,7 +1067,7 @@ class TranslatedConstructorBareInit extends TranslatedElement, TTranslatedConstr
result = this.getParent().getChildSuccessor(this, kind)
}
override Instruction getLastInstructionInternal() { none() } // FIXME: does this need to be filled in?
override Instruction getALastInstructionInternal() { none() } // FIXME: does this need to be filled in?
override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) {
none()

View File

@@ -213,8 +213,8 @@ class TranslatedMicrosoftTryExceptHandler extends TranslatedElement,
override TranslatedElement getLastChild() { result = this.getTranslatedHandler() }
override Instruction getLastInstructionInternal() {
result = this.getTranslatedHandler().getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getTranslatedHandler().getALastInstruction()
or
result = this.getInstruction(UnwindTag())
}
@@ -260,7 +260,7 @@ abstract class TranslatedStmt extends TranslatedElement, TTranslatedStmt {
not exists(this.getChildInternal(_)) and result = 0
}
final override predicate hasImplicitDestructorCalls() {
final override predicate hasAnImplicitDestructorCall() {
exists(stmt.getAnImplicitDestructorCall())
}
@@ -288,7 +288,7 @@ class TranslatedEmptyStmt extends TranslatedStmt {
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -327,8 +327,8 @@ class TranslatedDeclStmt extends TranslatedStmt {
result = this.getParent().getChildSuccessor(this, kind)
}
override Instruction getLastInstructionInternal() {
result = this.getChild(this.getChildCount() - 1).getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getChild(this.getChildCount() - 1).getALastInstruction()
}
override TranslatedElement getLastChild() { result = this.getChild(this.getChildCount() - 1) }
@@ -384,7 +384,7 @@ class TranslatedExprStmt extends TranslatedStmt {
result = this.getExpr().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() { result = this.getExpr().getLastInstruction() }
override Instruction getALastInstructionInternal() { result = this.getExpr().getALastInstruction() }
override TranslatedElement getLastChild() { result = this.getExpr() }
@@ -446,7 +446,7 @@ class TranslatedReturnVoidExpressionStmt extends TranslatedReturnStmt {
result = this.getExpr().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -486,7 +486,7 @@ class TranslatedReturnVoidStmt extends TranslatedReturnStmt {
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -596,8 +596,8 @@ class TranslatedTryStmt extends TranslatedStmt {
result = this.getBody().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
result = this.getLastChild().getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getLastChild().getALastInstruction()
}
override TranslatedElement getLastChild() {
@@ -665,7 +665,7 @@ class TranslatedBlock extends TranslatedStmt {
else result = this.getStmt(0).getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
if this.isEmpty()
then result = this.getInstruction(OnlyInstructionTag())
else result = this.getStmt(this.getStmtCount() - 1).getFirstInstruction(any(GotoEdge goto))
@@ -709,8 +709,8 @@ abstract class TranslatedHandler extends TranslatedStmt {
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
result = this.getBlock().getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getBlock().getALastInstruction()
}
override TranslatedElement getLastChild() { result = this.getBlock() }
@@ -802,8 +802,8 @@ class TranslatedIfStmt extends TranslatedStmt, ConditionContext {
else result = this.getFirstConditionInstruction(kind)
}
override Instruction getLastInstructionInternal() {
result = this.getElse().getLastInstruction() or result = this.getThen().getLastInstruction() // FIXME: how do we handle the CFG merge here
override Instruction getALastInstructionInternal() {
result = this.getElse().getALastInstruction() or result = this.getThen().getALastInstruction() // FIXME: how do we handle the CFG merge here
}
override TranslatedElement getLastChild() {
@@ -870,8 +870,8 @@ class TranslatedIfStmt extends TranslatedStmt, ConditionContext {
abstract class TranslatedLoop extends TranslatedStmt, ConditionContext {
override Loop stmt;
override Instruction getLastInstructionInternal() {
result = this.getCondition().getLastInstruction() // FIXME: how do we handle the branch here
override Instruction getALastInstructionInternal() {
result = this.getCondition().getALastInstruction() // FIXME: how do we handle the branch here
}
override TranslatedElement getLastChild() { result = this.getCondition() }
@@ -947,7 +947,7 @@ class TranslatedForStmt extends TranslatedLoop {
final override Instruction getChildFalseSuccessor(TranslatedCondition child, EdgeKind kind) {
child = this.getCondition() and
if this.hasImplicitDestructorCalls()
if this.hasAnImplicitDestructorCall()
then result = this.getChild(this.getFirstDestructorCallIndex()).getFirstInstruction(kind)
else result = this.getParent().getChildSuccessor(this, kind)
}
@@ -1033,8 +1033,8 @@ class TranslatedRangeBasedForStmt extends TranslatedStmt, ConditionContext {
result = this.getRangeVariableDeclStmt().getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
result = this.getCondition().getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getCondition().getALastInstruction()
}
override TranslatedElement getLastChild() { result = this.getCondition() }
@@ -1114,7 +1114,7 @@ class TranslatedJumpStmt extends TranslatedStmt {
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}
@@ -1162,7 +1162,7 @@ class TranslatedSwitchStmt extends TranslatedStmt {
else result = this.getFirstExprInstruction(kind)
}
override Instruction getLastInstructionInternal() { result = this.getBody().getLastInstruction() }
override Instruction getALastInstructionInternal() { result = this.getBody().getALastInstruction() }
override TranslatedElement getLastChild() { result = this.getBody() }
@@ -1233,7 +1233,7 @@ class TranslatedAsmStmt extends TranslatedStmt {
)
}
override Instruction getLastInstructionInternal() { result = this.getInstruction(AsmTag()) }
override Instruction getALastInstructionInternal() { result = this.getInstruction(AsmTag()) }
override predicate hasInstruction(Opcode opcode, InstructionTag tag, CppType resultType) {
tag = AsmTag() and
@@ -1286,8 +1286,8 @@ class TranslatedVlaDimensionStmt extends TranslatedStmt {
result = this.getChild(0).getFirstInstruction(kind)
}
override Instruction getLastInstructionInternal() {
result = this.getChild(0).getLastInstruction()
override Instruction getALastInstructionInternal() {
result = this.getChild(0).getALastInstruction()
}
override TranslatedElement getLastChild() { result = this.getChild(0) }
@@ -1314,7 +1314,7 @@ class TranslatedVlaDeclarationStmt extends TranslatedStmt {
kind instanceof GotoEdge
}
override Instruction getLastInstructionInternal() {
override Instruction getALastInstructionInternal() {
result = this.getInstruction(OnlyInstructionTag())
}