mirror of
https://github.com/github/codeql.git
synced 2026-05-05 21:55:19 +02:00
Merge pull request #10339 from MathiasVP/dont-use-get-unique-id-in-range-analysis
C++: Don't use `getUniqueId` in range analysis
This commit is contained in:
@@ -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() }
|
||||
|
||||
|
||||
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user