/// \brief Destructor.
~APInt() {
- if (!isSingleWord())
+ if (needsCleanup())
delete[] pVal;
}
/// method Read).
explicit APInt() : BitWidth(1) {}
+ /// \brief Returns whether this instance allocated memory.
+ bool needsCleanup() const { return !isSingleWord(); }
+
/// Used to insert APInt objects, or objects that contain APInt objects, into
/// FoldingSets.
void Profile(FoldingSetNodeID &id) const;