diff options
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r-- | include/llvm/ADT/APInt.h | 6 | ||||
-rw-r--r-- | include/llvm/ADT/ArrayRef.h | 5 | ||||
-rw-r--r-- | include/llvm/ADT/ImmutableIntervalMap.h | 2 | ||||
-rw-r--r-- | include/llvm/ADT/ImmutableMap.h | 2 |
4 files changed, 12 insertions, 3 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index b91d5dc..d1fd3e5 100644 --- a/include/llvm/ADT/APInt.h +++ b/include/llvm/ADT/APInt.h @@ -1193,6 +1193,12 @@ public: /// @brief Count the number of leading one bits. unsigned countLeadingOnes() const; + /// Computes the number of leading bits of this APInt that are equal to its + /// sign bit. + unsigned getNumSignBits() const { + return isNegative() ? countLeadingOnes() : countLeadingZeros(); + } + /// countTrailingZeros - This function is an APInt version of the /// countTrailingZeros_{32,64} functions in MathExtras.h. It counts /// the number of zeros from the least significant bit to the first set bit. diff --git a/include/llvm/ADT/ArrayRef.h b/include/llvm/ADT/ArrayRef.h index 1c5470d..d3ea9c0 100644 --- a/include/llvm/ADT/ArrayRef.h +++ b/include/llvm/ADT/ArrayRef.h @@ -64,7 +64,10 @@ namespace llvm { /*implicit*/ ArrayRef(const std::vector<T> &Vec) : Data(Vec.empty() ? (T*)0 : &Vec[0]), Length(Vec.size()) {} - // TODO: C arrays. + /// Construct an ArrayRef from a C array. + template <size_t N> + /*implicit*/ ArrayRef(const T (&Arr)[N]) + : Data(Arr), Length(N) {} /// @} /// @name Simple Operations diff --git a/include/llvm/ADT/ImmutableIntervalMap.h b/include/llvm/ADT/ImmutableIntervalMap.h index d3196ca..0d8fcf3 100644 --- a/include/llvm/ADT/ImmutableIntervalMap.h +++ b/include/llvm/ADT/ImmutableIntervalMap.h @@ -215,7 +215,7 @@ public: ImmutableIntervalMap add(ImmutableIntervalMap Old, key_type_ref K, data_type_ref D) { - TreeTy *T = F.add(Old.Root, std::make_pair<key_type, data_type>(K, D)); + TreeTy *T = F.add(Old.Root, std::pair<key_type, data_type>(K, D)); return ImmutableIntervalMap(F.getCanonicalTree(T)); } diff --git a/include/llvm/ADT/ImmutableMap.h b/include/llvm/ADT/ImmutableMap.h index e439a09..d6cce7c 100644 --- a/include/llvm/ADT/ImmutableMap.h +++ b/include/llvm/ADT/ImmutableMap.h @@ -108,7 +108,7 @@ public: ImmutableMap getEmptyMap() { return ImmutableMap(F.getEmptyTree()); } ImmutableMap add(ImmutableMap Old, key_type_ref K, data_type_ref D) { - TreeTy *T = F.add(Old.Root, std::make_pair<key_type,data_type>(K,D)); + TreeTy *T = F.add(Old.Root, std::pair<key_type,data_type>(K,D)); return ImmutableMap(Canonicalize ? F.getCanonicalTree(T): T); } |