Skip to content

Commit 85a8280

Browse files
committed
C++: Replace getResultType() with getResultIRType() in IR dataflow
1 parent 7029739 commit 85a8280

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,20 +234,20 @@ predicate clearsContent(Node n, Content c) {
234234
}
235235

236236
/** Gets the type of `n` used for type pruning. */
237-
Type getNodeType(Node n) {
237+
IRType getNodeType(Node n) {
238238
suppressUnusedNode(n) and
239-
result instanceof VoidType // stub implementation
239+
result instanceof IRVoidType // stub implementation
240240
}
241241

242242
/** Gets a string representation of a type returned by `getNodeType`. */
243-
string ppReprType(Type t) { none() } // stub implementation
243+
string ppReprType(IRType t) { none() } // stub implementation
244244

245245
/**
246246
* Holds if `t1` and `t2` are compatible, that is, whether data can flow from
247247
* a node of type `t1` to a node of type `t2`.
248248
*/
249249
pragma[inline]
250-
predicate compatibleTypes(Type t1, Type t2) {
250+
predicate compatibleTypes(IRType t1, IRType t2) {
251251
any() // stub implementation
252252
}
253253

@@ -271,7 +271,7 @@ class DataFlowCallable = Declaration;
271271

272272
class DataFlowExpr = Expr;
273273

274-
class DataFlowType = Type;
274+
class DataFlowType = IRType;
275275

276276
/** A function call relevant for data flow. */
277277
class DataFlowCall extends CallInstruction {

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Node extends TIRDataFlowNode {
3333
Function getFunction() { none() } // overridden in subclasses
3434

3535
/** Gets the type of this node. */
36-
Type getType() { none() } // overridden in subclasses
36+
IRType getType() { none() } // overridden in subclasses
3737

3838
/** Gets the instruction corresponding to this node, if any. */
3939
Instruction asInstruction() { result = this.(InstructionNode).getInstruction() }
@@ -88,7 +88,7 @@ class Node extends TIRDataFlowNode {
8888
/**
8989
* Gets an upper bound on the type of this node.
9090
*/
91-
Type getTypeBound() { result = getType() }
91+
IRType getTypeBound() { result = getType() }
9292

9393
/** Gets the location of this element. */
9494
Location getLocation() { none() } // overridden by subclasses
@@ -125,7 +125,7 @@ class InstructionNode extends Node, TInstructionNode {
125125

126126
override Function getFunction() { result = instr.getEnclosingFunction() }
127127

128-
override Type getType() { result = instr.getResultType() }
128+
override IRType getType() { result = instr.getResultIRType() }
129129

130130
override Location getLocation() { result = instr.getLocation() }
131131

@@ -151,7 +151,7 @@ class OperandNode extends Node, TOperandNode {
151151

152152
override Function getFunction() { result = op.getUse().getEnclosingFunction() }
153153

154-
override Type getType() { result = op.getType() }
154+
override IRType getType() { result = op.getIRType() }
155155

156156
override Location getLocation() { result = op.getLocation() }
157157

@@ -449,7 +449,7 @@ class VariableNode extends Node, TVariableNode {
449449
result = v
450450
}
451451

452-
override Type getType() { result = v.getType() }
452+
override IRType getType() { result.getCanonicalLanguageType().hasUnspecifiedType(v.getType(), _) }
453453

454454
override Location getLocation() { result = v.getLocation() }
455455

0 commit comments

Comments
 (0)