C++: Remove TThisVar

There's no need to model `this` as a variable because it's never
reassigned.
This commit is contained in:
Jonas Jensen
2019-08-07 15:32:07 +02:00
parent 6a3f5efc1b
commit 5370e7d693

View File

@@ -220,11 +220,6 @@ module FlowVar_internal {
or
blockVarDefinedByVariable(sbb, v)
)
} or
TThisVar(SubBasicBlock sbb, ThisExpr t) {
reachable(sbb) and
sbb = any(PartialDefinitions::PartialDefinition p | p.partiallyDefinesThis(t))
.getSubBasicBlockStart()
}
/**
@@ -374,34 +369,6 @@ module FlowVar_internal {
override Location getLocation() { result = sbb.getStart().getLocation() }
}
class ThisVar extends TThisVar, FlowVar {
SubBasicBlock sbb;
ThisExpr t;
PartialDefinitions::PartialDefinition pd;
ThisVar() { this = TThisVar(sbb, t) and pd.partiallyDefinesThis(t) }
override VariableAccess getAnAccess() {
none() // TODO: Widen type to `Expr`.
}
override predicate definedByExpr(Expr e, ControlFlowNode node) { none() }
override predicate definedByReference(Expr arg) { none() }
override predicate definedPartiallyAt(Expr arg) {
none() // TODO
}
override predicate definedByInitialValue(LocalScopeVariable param) { none() }
override string toString() { result = pd.toString() }
override Location getLocation() { result = pd.getLocation() }
}
/** Type-specialized version of `getEnclosingElement`. */
private ControlFlowNode getCFNParent(ControlFlowNode node) {
result = node.getEnclosingElement()