Skip to content

Commit 3570137

Browse files
committed
C++: more semantic range analysis perf tweaks
1 parent b1de54e commit 3570137

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

cpp/ql/lib/experimental/semmle/code/cpp/semantic/analysis/SignAnalysisCommon.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ private class BinarySignExpr extends FlowSignExpr {
204204
}
205205
}
206206

207+
pragma[noinline]
207208
private predicate binaryExprOperands(SemBinaryExpr binary, SemExpr left, SemExpr right) {
208209
binary.getLeftOperand() = left and binary.getRightOperand() = right
209210
}

cpp/ql/src/experimental/Likely Bugs/ArrayAccessProductFlow.ql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,21 @@ import experimental.semmle.code.cpp.semantic.SemanticExprSpecific
66
import semmle.code.cpp.ir.IR
77
import semmle.code.cpp.valuenumbering.GlobalValueNumbering
88
import semmle.code.cpp.models.interfaces.Allocation
9+
import semmle.code.cpp.ir.IRConfiguration
10+
11+
class RangeAnalysisIRConfig extends IRConfiguration {
12+
override predicate shouldCreateIRForFunction(Declaration decl) {
13+
not exists(DeclStmt stmt |
14+
stmt.getEnclosingFunction() = decl and
15+
(
16+
not exists(stmt.getADeclaration())
17+
or
18+
not exists(stmt.getADeclarationEntry())
19+
)
20+
)
21+
}
22+
}
23+
924

1025
predicate bounded(Instruction i, Bound b, int delta, boolean upper) {
1126
// TODO: reason

0 commit comments

Comments
 (0)