C++: Remove NoThrowAllocator and inline its (corrected) definition in ThrowingAllocator.

This commit is contained in:
Mathias Vorreiter Pedersen
2021-05-06 18:02:05 +02:00
parent 5437bd7a41
commit 7c1720a1d1

View File

@@ -147,19 +147,14 @@ predicate exprMayThrow(Expr e) {
)
}
/** An allocator that will not throw an exception. */
class NoThrowAllocator extends Function {
NoThrowAllocator() {
exists(NewOrNewArrayExpr newExpr |
newExpr.getAllocator() = this and
not functionMayThrow(this)
)
}
}
/** An allocator that might throw an exception. */
class ThrowingAllocator extends Function {
ThrowingAllocator() { not this instanceof NoThrowAllocator }
ThrowingAllocator() {
exists(NewOrNewArrayExpr newExpr |
newExpr.getAllocator() = this and
functionMayThrow(this)
)
}
}
/** The `std::bad_alloc` exception and its `bsl` variant. */