diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/rangeanalysis/Bound.qll b/cpp/ql/lib/experimental/semmle/code/cpp/rangeanalysis/Bound.qll index bdd0e39f9b7..eba5c9b4464 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/rangeanalysis/Bound.qll +++ b/cpp/ql/lib/experimental/semmle/code/cpp/rangeanalysis/Bound.qll @@ -73,7 +73,7 @@ class ValueNumberBound extends Bound, TBoundValueNumber { this = TBoundValueNumber(valueNumber(result)) and delta = 0 } - override string toString() { result = vn.getExampleInstruction().toString() } + override string toString() { result = "ValueNumberBound" } override Location getLocation() { result = vn.getLocation() } diff --git a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticExprSpecific.qll b/cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticExprSpecific.qll index c72c9163af6..dc178f77547 100644 --- a/cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticExprSpecific.qll +++ b/cpp/ql/lib/experimental/semmle/code/cpp/semantic/SemanticExprSpecific.qll @@ -112,12 +112,11 @@ module SemanticExprConfig { predicate hasDominanceInformation(BasicBlock block) { any() } - int getBasicBlockUniqueId(BasicBlock block) { - // REVIEW: `getDisplayIndex()` is not intended for use in real queries, but for now it's the - // best we can do because `equivalentRelation` won't accept a predicate whose parameters are IPA - // types. - result = block.getDisplayIndex() - } + private predicate id(Cpp::Locatable x, Cpp::Locatable y) { x = y } + + private predicate idOf(Cpp::Locatable x, int y) = equivalenceRelation(id/2)(x, y) + + int getBasicBlockUniqueId(BasicBlock block) { idOf(block.getFirstInstruction().getAst(), result) } newtype TSsaVariable = TSsaInstruction(IR::Instruction instr) { instr.hasMemoryResult() } or @@ -267,17 +266,7 @@ module SemanticExprConfig { ValueNumberBound() { bound = this } - override string toString() { - result = - min(SsaVariable v | - v.asInstruction() = bound.getValueNumber().getAnInstruction() - | - v - order by - v.asInstruction().getBlock().getDisplayIndex(), - v.asInstruction().getDisplayIndexInBlock() - ).toString() - } + override string toString() { result = bound.toString() } } predicate zeroBound(Bound bound) { bound instanceof IRBound::ZeroBound }