summaryrefslogtreecommitdiffstats
path: root/include/llvm/ADT
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r--include/llvm/ADT/ArrayRef.h9
-rw-r--r--include/llvm/ADT/DenseMap.h2
-rw-r--r--include/llvm/ADT/Hashing.h4
-rw-r--r--include/llvm/ADT/InMemoryStruct.h77
-rw-r--r--include/llvm/ADT/PointerIntPair.h52
-rw-r--r--include/llvm/ADT/StringRef.h20
-rw-r--r--include/llvm/ADT/Triple.h3
-rw-r--r--include/llvm/ADT/Twine.h2
8 files changed, 50 insertions, 119 deletions
diff --git a/include/llvm/ADT/ArrayRef.h b/include/llvm/ADT/ArrayRef.h
index c555c1c..d4152ec 100644
--- a/include/llvm/ADT/ArrayRef.h
+++ b/include/llvm/ADT/ArrayRef.h
@@ -10,6 +10,7 @@
#ifndef LLVM_ADT_ARRAYREF_H
#define LLVM_ADT_ARRAYREF_H
+#include "llvm/ADT/None.h"
#include "llvm/ADT/SmallVector.h"
#include <vector>
@@ -49,6 +50,9 @@ namespace llvm {
/// Construct an empty ArrayRef.
/*implicit*/ ArrayRef() : Data(0), Length(0) {}
+ /// Construct an empty ArrayRef from None.
+ /*implicit*/ ArrayRef(NoneType) : Data(0), Length(0) {}
+
/// Construct an ArrayRef from a single element.
/*implicit*/ ArrayRef(const T &OneElt)
: Data(&OneElt), Length(1) {}
@@ -174,9 +178,12 @@ namespace llvm {
public:
typedef T *iterator;
- /// Construct an empty ArrayRef.
+ /// Construct an empty MutableArrayRef.
/*implicit*/ MutableArrayRef() : ArrayRef<T>() {}
+ /// Construct an empty MutableArrayRef from None.
+ /*implicit*/ MutableArrayRef(NoneType) : ArrayRef<T>() {}
+
/// Construct an MutableArrayRef from a single element.
/*implicit*/ MutableArrayRef(T &OneElt) : ArrayRef<T>(OneElt) {}
diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h
index d410619..31fd6d8 100644
--- a/include/llvm/ADT/DenseMap.h
+++ b/include/llvm/ADT/DenseMap.h
@@ -618,7 +618,7 @@ public:
unsigned OldNumBuckets = NumBuckets;
BucketT *OldBuckets = Buckets;
- allocateBuckets(std::max<unsigned>(64, NextPowerOf2(AtLeast-1)));
+ allocateBuckets(std::max<unsigned>(64, static_cast<unsigned>(NextPowerOf2(AtLeast-1))));
assert(Buckets);
if (!OldBuckets) {
this->BaseT::initEmpty();
diff --git a/include/llvm/ADT/Hashing.h b/include/llvm/ADT/Hashing.h
index cda31a2..e434417 100644
--- a/include/llvm/ADT/Hashing.h
+++ b/include/llvm/ADT/Hashing.h
@@ -151,7 +151,7 @@ namespace detail {
inline uint64_t fetch64(const char *p) {
uint64_t result;
memcpy(&result, p, sizeof(result));
- if (sys::isBigEndianHost())
+ if (sys::IsBigEndianHost)
return sys::SwapByteOrder(result);
return result;
}
@@ -159,7 +159,7 @@ inline uint64_t fetch64(const char *p) {
inline uint32_t fetch32(const char *p) {
uint32_t result;
memcpy(&result, p, sizeof(result));
- if (sys::isBigEndianHost())
+ if (sys::IsBigEndianHost)
return sys::SwapByteOrder(result);
return result;
}
diff --git a/include/llvm/ADT/InMemoryStruct.h b/include/llvm/ADT/InMemoryStruct.h
deleted file mode 100644
index a560845..0000000
--- a/include/llvm/ADT/InMemoryStruct.h
+++ /dev/null
@@ -1,77 +0,0 @@
-//===- InMemoryStruct.h - Indirect Struct Access Smart Pointer --*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ADT_INMEMORYSTRUCT_H
-#define LLVM_ADT_INMEMORYSTRUCT_H
-
-#include <cassert>
-
-namespace llvm {
-
-/// \brief Helper object for abstracting access to an in-memory structure which
-/// may require some kind of temporary storage.
-///
-/// This class is designed to be used for accessing file data structures which
-/// in the common case can be accessed from a direct pointer to a memory mapped
-/// object, but which in some cases may require indirect access to a temporary
-/// structure (which, for example, may have undergone endianness translation).
-template<typename T>
-class InMemoryStruct {
- typedef T value_type;
- typedef value_type &reference;
- typedef value_type *pointer;
- typedef const value_type &const_reference;
- typedef const value_type *const_pointer;
-
- /// \brief The smart pointer target.
- value_type *Target;
-
- /// \brief A temporary object which can be used as a target of the smart
- /// pointer.
- value_type Contents;
-
-private:
-
-public:
- InMemoryStruct() : Target(0) {}
- InMemoryStruct(reference Value) : Target(&Contents), Contents(Value) {}
- InMemoryStruct(pointer Value) : Target(Value) {}
- InMemoryStruct(const InMemoryStruct<T> &Value) { *this = Value; }
-
- void operator=(const InMemoryStruct<T> &Value) {
- if (Value.Target != &Value.Contents) {
- Target = Value.Target;
- } else {
- Target = &Contents;
- Contents = Value.Contents;
- }
- }
-
- const_reference operator*() const {
- assert(Target && "Cannot dereference null pointer");
- return *Target;
- }
- reference operator*() {
- assert(Target && "Cannot dereference null pointer");
- return *Target;
- }
-
- const_pointer operator->() const {
- return Target;
- }
- pointer operator->() {
- return Target;
- }
-
- operator bool() const { return Target != 0; }
-};
-
-}
-
-#endif
diff --git a/include/llvm/ADT/PointerIntPair.h b/include/llvm/ADT/PointerIntPair.h
index cce2efb..0299a83 100644
--- a/include/llvm/ADT/PointerIntPair.h
+++ b/include/llvm/ADT/PointerIntPair.h
@@ -29,7 +29,7 @@ struct DenseMapInfo;
/// on the number of bits available according to PointerLikeTypeTraits for the
/// type.
///
-/// Note that PointerIntPair always puts the Int part in the highest bits
+/// Note that PointerIntPair always puts the IntVal part in the highest bits
/// possible. For example, PointerIntPair<void*, 1, bool> will put the bit for
/// the bool into bit #2, not bit #0, which allows the low two bits to be used
/// for something else. For example, this allows:
@@ -57,13 +57,13 @@ class PointerIntPair {
};
public:
PointerIntPair() : Value(0) {}
- PointerIntPair(PointerTy Ptr, IntType Int) {
+ PointerIntPair(PointerTy PtrVal, IntType IntVal) {
assert(IntBits <= PtrTraits::NumLowBitsAvailable &&
"PointerIntPair formed with integer size too large for pointer");
- setPointerAndInt(Ptr, Int);
+ setPointerAndInt(PtrVal, IntVal);
}
- explicit PointerIntPair(PointerTy Ptr) {
- initWithPointer(Ptr);
+ explicit PointerIntPair(PointerTy PtrVal) {
+ initWithPointer(PtrVal);
}
PointerTy getPointer() const {
@@ -75,41 +75,41 @@ public:
return (IntType)((Value >> IntShift) & IntMask);
}
- void setPointer(PointerTy Ptr) {
- intptr_t PtrVal
- = reinterpret_cast<intptr_t>(PtrTraits::getAsVoidPointer(Ptr));
- assert((PtrVal & ((1 << PtrTraits::NumLowBitsAvailable)-1)) == 0 &&
+ void setPointer(PointerTy PtrVal) {
+ intptr_t PtrWord
+ = reinterpret_cast<intptr_t>(PtrTraits::getAsVoidPointer(PtrVal));
+ assert((PtrWord & ((1 << PtrTraits::NumLowBitsAvailable)-1)) == 0 &&
"Pointer is not sufficiently aligned");
// Preserve all low bits, just update the pointer.
- Value = PtrVal | (Value & ~PointerBitMask);
+ Value = PtrWord | (Value & ~PointerBitMask);
}
- void setInt(IntType Int) {
- intptr_t IntVal = Int;
- assert(IntVal < (1 << IntBits) && "Integer too large for field");
+ void setInt(IntType IntVal) {
+ intptr_t IntWord = static_cast<intptr_t>(IntVal);
+ assert(IntWord < (1 << IntBits) && "Integer too large for field");
// Preserve all bits other than the ones we are updating.
Value &= ~ShiftedIntMask; // Remove integer field.
- Value |= IntVal << IntShift; // Set new integer.
+ Value |= IntWord << IntShift; // Set new integer.
}
- void initWithPointer(PointerTy Ptr) {
- intptr_t PtrVal
- = reinterpret_cast<intptr_t>(PtrTraits::getAsVoidPointer(Ptr));
- assert((PtrVal & ((1 << PtrTraits::NumLowBitsAvailable)-1)) == 0 &&
+ void initWithPointer(PointerTy PtrVal) {
+ intptr_t PtrWord
+ = reinterpret_cast<intptr_t>(PtrTraits::getAsVoidPointer(PtrVal));
+ assert((PtrWord & ((1 << PtrTraits::NumLowBitsAvailable)-1)) == 0 &&
"Pointer is not sufficiently aligned");
- Value = PtrVal;
+ Value = PtrWord;
}
- void setPointerAndInt(PointerTy Ptr, IntType Int) {
- intptr_t PtrVal
- = reinterpret_cast<intptr_t>(PtrTraits::getAsVoidPointer(Ptr));
- assert((PtrVal & ((1 << PtrTraits::NumLowBitsAvailable)-1)) == 0 &&
+ void setPointerAndInt(PointerTy PtrVal, IntType IntVal) {
+ intptr_t PtrWord
+ = reinterpret_cast<intptr_t>(PtrTraits::getAsVoidPointer(PtrVal));
+ assert((PtrWord & ((1 << PtrTraits::NumLowBitsAvailable)-1)) == 0 &&
"Pointer is not sufficiently aligned");
- intptr_t IntVal = Int;
- assert(IntVal < (1 << IntBits) && "Integer too large for field");
+ intptr_t IntWord = static_cast<intptr_t>(IntVal);
+ assert(IntWord < (1 << IntBits) && "Integer too large for field");
- Value = PtrVal | (IntVal << IntShift);
+ Value = PtrWord | (IntWord << IntShift);
}
PointerTy const *getAddrOfPointer() const {
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h
index 224855e..d013d05 100644
--- a/include/llvm/ADT/StringRef.h
+++ b/include/llvm/ADT/StringRef.h
@@ -260,7 +260,7 @@ namespace llvm {
/// Find the first character in the string that is \p C, or npos if not
/// found. Same as find.
- size_type find_first_of(char C, size_t From = 0) const {
+ size_t find_first_of(char C, size_t From = 0) const {
return find(C, From);
}
@@ -268,21 +268,21 @@ namespace llvm {
/// not found.
///
/// Complexity: O(size() + Chars.size())
- size_type find_first_of(StringRef Chars, size_t From = 0) const;
+ size_t find_first_of(StringRef Chars, size_t From = 0) const;
/// Find the first character in the string that is not \p C or npos if not
/// found.
- size_type find_first_not_of(char C, size_t From = 0) const;
+ size_t find_first_not_of(char C, size_t From = 0) const;
/// Find the first character in the string that is not in the string
/// \p Chars, or npos if not found.
///
/// Complexity: O(size() + Chars.size())
- size_type find_first_not_of(StringRef Chars, size_t From = 0) const;
+ size_t find_first_not_of(StringRef Chars, size_t From = 0) const;
/// Find the last character in the string that is \p C, or npos if not
/// found.
- size_type find_last_of(char C, size_t From = npos) const {
+ size_t find_last_of(char C, size_t From = npos) const {
return rfind(C, From);
}
@@ -290,17 +290,17 @@ namespace llvm {
/// found.
///
/// Complexity: O(size() + Chars.size())
- size_type find_last_of(StringRef Chars, size_t From = npos) const;
+ size_t find_last_of(StringRef Chars, size_t From = npos) const;
/// Find the last character in the string that is not \p C, or npos if not
/// found.
- size_type find_last_not_of(char C, size_t From = npos) const;
+ size_t find_last_not_of(char C, size_t From = npos) const;
/// Find the last character in the string that is not in \p Chars, or
/// npos if not found.
///
/// Complexity: O(size() + Chars.size())
- size_type find_last_not_of(StringRef Chars, size_t From = npos) const;
+ size_t find_last_not_of(StringRef Chars, size_t From = npos) const;
/// @}
/// @name Helpful Algorithms
@@ -390,14 +390,14 @@ namespace llvm {
/// Return a StringRef equal to 'this' but with the first \p N elements
/// dropped.
- StringRef drop_front(unsigned N = 1) const {
+ StringRef drop_front(size_t N = 1) const {
assert(size() >= N && "Dropping more elements than exist");
return substr(N);
}
/// Return a StringRef equal to 'this' but with the last \p N elements
/// dropped.
- StringRef drop_back(unsigned N = 1) const {
+ StringRef drop_back(size_t N = 1) const {
assert(size() >= N && "Dropping more elements than exist");
return substr(0, size()-N);
}
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h
index 8fac222..3a72e87 100644
--- a/include/llvm/ADT/Triple.h
+++ b/include/llvm/ADT/Triple.h
@@ -43,7 +43,7 @@ public:
enum ArchType {
UnknownArch,
- arm, // ARM; arm, armv.*, xscale
+ arm, // ARM: arm, armv.*, xscale
aarch64, // AArch64: aarch64
hexagon, // Hexagon: hexagon
mips, // MIPS: mips, mipsallegrex
@@ -56,6 +56,7 @@ public:
r600, // R600: AMD GPUs HD2XXX - HD6XXX
sparc, // Sparc: sparc
sparcv9, // Sparcv9: Sparcv9
+ systemz, // SystemZ: s390x
tce, // TCE (http://tce.cs.tut.fi/): tce
thumb, // Thumb: thumb, thumbv.*
x86, // X86: i[3-9]86
diff --git a/include/llvm/ADT/Twine.h b/include/llvm/ADT/Twine.h
index cc290d5..e16c6b4 100644
--- a/include/llvm/ADT/Twine.h
+++ b/include/llvm/ADT/Twine.h
@@ -236,7 +236,7 @@ namespace llvm {
/// getLHSKind - Get the NodeKind of the left-hand side.
NodeKind getLHSKind() const { return (NodeKind) LHSKind; }
- /// getRHSKind - Get the NodeKind of the left-hand side.
+ /// getRHSKind - Get the NodeKind of the right-hand side.
NodeKind getRHSKind() const { return (NodeKind) RHSKind; }
/// printOneChild - Print one child from a twine.
OpenPOWER on IntegriCloud