Skip to content

Commit 75b6855

Browse files
committed
C++: Move useful predicates from the old IPA type for the 'DefinitionExt' type.
1 parent f597ea9 commit 75b6855

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternals.qll

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,45 @@ class DefinitionExt extends SsaImpl::DefinitionExt {
11301130
not result instanceof PhiNode
11311131
}
11321132

1133+
/** INTERNAL: Do not use. */
1134+
DefImpl getImpl() {
1135+
exists(SourceVariable sv, IRBlock bb, int i |
1136+
this.definesAt(sv, bb, i, _) and
1137+
result.hasIndexInBlock(bb, i, sv)
1138+
)
1139+
}
1140+
1141+
/**
1142+
* INTERNAL: Do not use.
1143+
*/
1144+
Node0Impl getValue() { result = this.getImpl().getValue() }
1145+
1146+
/** Gets the indirection index of this definition. */
1147+
int getIndirectionIndex() { result = this.getImpl().getIndirectionIndex() }
1148+
1149+
/** Gets the indirection of this definition. */
1150+
int getIndirection() { result = this.getImpl().getIndirection() }
1151+
1152+
/**
1153+
* Holds if this definition is guaranteed to totally overwrite the buffer
1154+
* being written to.
1155+
*/
1156+
predicate isCertain() { this.getImpl().isCertain() }
1157+
1158+
/**
1159+
* Gets the enclosing declaration of this definition.
1160+
*
1161+
* Note that this may be a variable when this definition defines a global, or
1162+
* a static local, variable.
1163+
*/
1164+
Declaration getFunction() { result = this.getImpl().getBlock().getEnclosingFunction() }
1165+
1166+
/** Gets the underlying type of the variable being defined by this definition. */
1167+
Type getUnderlyingType() { result = this.getSourceVariable().getType() }
1168+
1169+
/** Gets the unspecified type of the variable being defined by this definition. */
1170+
Type getUnspecifiedType() { result = this.getUnderlyingType().getUnspecifiedType() }
1171+
11331172
/** Gets a node that represents a read of this SSA definition. */
11341173
pragma[nomagic]
11351174
Node getARead() {

0 commit comments

Comments
 (0)