aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/include/llvm/ADT/APSInt.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/include/llvm/ADT/APSInt.h')
-rw-r--r--contrib/llvm-project/llvm/include/llvm/ADT/APSInt.h25
1 files changed, 20 insertions, 5 deletions
diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/APSInt.h b/contrib/llvm-project/llvm/include/llvm/ADT/APSInt.h
index 82e9ba81141f..1509d472f131 100644
--- a/contrib/llvm-project/llvm/include/llvm/ADT/APSInt.h
+++ b/contrib/llvm-project/llvm/include/llvm/ADT/APSInt.h
@@ -82,11 +82,6 @@ public:
void toString(SmallVectorImpl<char> &Str, unsigned Radix = 10) const {
APInt::toString(Str, Radix, isSigned());
}
- /// Converts an APInt to a std::string. This is an inefficient
- /// method; you should prefer passing in a SmallString instead.
- std::string toString(unsigned Radix) const {
- return APInt::toString(Radix, isSigned());
- }
using APInt::toString;
/// Get the correctly-extended \c int64_t value.
@@ -348,6 +343,26 @@ inline raw_ostream &operator<<(raw_ostream &OS, const APSInt &I) {
return OS;
}
+/// Provide DenseMapInfo for APSInt, using the DenseMapInfo for APInt.
+template <> struct DenseMapInfo<APSInt> {
+ static inline APSInt getEmptyKey() {
+ return APSInt(DenseMapInfo<APInt>::getEmptyKey());
+ }
+
+ static inline APSInt getTombstoneKey() {
+ return APSInt(DenseMapInfo<APInt>::getTombstoneKey());
+ }
+
+ static unsigned getHashValue(const APSInt &Key) {
+ return DenseMapInfo<APInt>::getHashValue(Key);
+ }
+
+ static bool isEqual(const APSInt &LHS, const APSInt &RHS) {
+ return LHS.getBitWidth() == RHS.getBitWidth() &&
+ LHS.isUnsigned() == RHS.isUnsigned() && LHS == RHS;
+ }
+};
+
} // end namespace llvm
#endif