C++: Speed up Expr.getFullyConverted slightly

This change cuts around 15% of the run time off this predicate. It's a
workaround for QL-796.
This commit is contained in:
Jonas Jensen
2019-01-14 15:27:44 +01:00
parent 371c09d4e5
commit d252a40853

View File

@@ -335,10 +335,10 @@ class Expr extends StmtParent, @expr {
/** Gets the fully converted form of this expression, including all type casts and other conversions. */
cached
Expr getFullyConverted() {
if this.hasConversion() then
result = this.getConversion().getFullyConverted()
else
result = this
hasNoConversions(this) and
result = this
or
result = this.getConversion().getFullyConverted()
}
/**
@@ -977,3 +977,6 @@ private predicate isStandardPlacementNewAllocator(Function operatorNew) {
operatorNew.getNumberOfParameters() = 2 and
operatorNew.getParameter(1).getType() instanceof VoidPointerType
}
// Pulled out for performance. See QL-796.
private predicate hasNoConversions(Expr e) { not e.hasConversion() }