Reformat headers in ADT and Support partially.

Note, I didn't reformat entirely, but partially where I touched in previous commits.

llvm-svn: 244432
This commit is contained in:
NAKAMURA Takumi 2015-08-10 04:22:36 +00:00
parent addd30e2ea
commit 499a56f784
16 changed files with 85 additions and 95 deletions

View File

@ -247,7 +247,7 @@ public:
return this->operator|(RHS);
}
APSInt operator^(const APSInt& RHS) const {
APSInt operator^(const APSInt &RHS) const {
assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
return APSInt(static_cast<const APInt&>(*this) ^ RHS, IsUnsigned);
}

View File

@ -75,13 +75,13 @@ class df_iterator : public std::iterator<std::forward_iterator_tag,
// VisitStack - Used to maintain the ordering. Top = current block
// First element is node pointer, second is the 'next child' to visit
// if the int in PointerIntTy is 0, the 'next child' to visit is invalid
std::vector<std::pair<PointerIntTy, ChildItTy> > VisitStack;
std::vector<std::pair<PointerIntTy, ChildItTy>> VisitStack;
private:
inline df_iterator(NodeType *Node) {
this->Visited.insert(Node);
VisitStack.push_back(std::make_pair(PointerIntTy(Node, 0),
GT::child_begin(Node)));
VisitStack.push_back(
std::make_pair(PointerIntTy(Node, 0), GT::child_begin(Node)));
}
inline df_iterator() {
// End is when stack is empty
@ -89,8 +89,8 @@ private:
inline df_iterator(NodeType *Node, SetType &S)
: df_iterator_storage<SetType, ExtStorage>(S) {
if (!S.count(Node)) {
VisitStack.push_back(std::make_pair(PointerIntTy(Node, 0),
GT::child_begin(Node)));
VisitStack.push_back(
std::make_pair(PointerIntTy(Node, 0), GT::child_begin(Node)));
this->Visited.insert(Node);
}
}
@ -115,8 +115,8 @@ private:
// Has our next sibling been visited?
if (Next && this->Visited.insert(Next).second) {
// No, do it now.
VisitStack.push_back(std::make_pair(PointerIntTy(Next, 0),
GT::child_begin(Next)));
VisitStack.push_back(
std::make_pair(PointerIntTy(Next, 0), GT::child_begin(Next)));
return;
}
}

View File

@ -611,8 +611,7 @@ public:
}
};
template<class T>
class FoldingSetIterator : public FoldingSetIteratorImpl {
template <class T> class FoldingSetIterator : public FoldingSetIteratorImpl {
public:
explicit FoldingSetIterator(void **Bucket) : FoldingSetIteratorImpl(Bucket) {}
@ -662,7 +661,7 @@ public:
}
};
template<class T>
template <class T>
class FoldingSetBucketIterator : public FoldingSetBucketIteratorImpl {
public:
explicit FoldingSetBucketIterator(void **Bucket) :
@ -717,9 +716,7 @@ protected:
explicit FastFoldingSetNode(const FoldingSetNodeID &ID) : FastID(ID) {}
public:
void Profile(FoldingSetNodeID &ID) const {
ID.AddNodeID(FastID);
}
void Profile(FoldingSetNodeID &ID) const { ID.AddNodeID(FastID); }
};
//===----------------------------------------------------------------------===//

View File

@ -98,10 +98,9 @@ public:
const bool Canonicalize;
public:
Factory(bool canonicalize = true)
: Canonicalize(canonicalize) {}
Factory(bool canonicalize = true) : Canonicalize(canonicalize) {}
Factory(BumpPtrAllocator& Alloc, bool canonicalize = true)
Factory(BumpPtrAllocator &Alloc, bool canonicalize = true)
: F(Alloc), Canonicalize(canonicalize) {}
ImmutableMap getEmptyMap() { return ImmutableMap(F.getEmptyTree()); }
@ -142,9 +141,7 @@ public:
return Root;
}
TreeTy *getRootWithoutRetain() const {
return Root;
}
TreeTy *getRootWithoutRetain() const { return Root; }
void manualRetain() {
if (Root) Root->retain();
@ -269,10 +266,11 @@ public:
/// should use a Factory object to create maps instead of directly
/// invoking the constructor, but there are cases where make this
/// constructor public is useful.
explicit ImmutableMapRef(const TreeTy* R, FactoryTy *F)
: Root(const_cast<TreeTy*>(R)),
Factory(F) {
if (Root) { Root->retain(); }
explicit ImmutableMapRef(const TreeTy *R, FactoryTy *F)
: Root(const_cast<TreeTy *>(R)), Factory(F) {
if (Root) {
Root->retain();
}
}
explicit ImmutableMapRef(const ImmutableMap<KeyT, ValT> &X,
@ -282,10 +280,10 @@ public:
if (Root) { Root->retain(); }
}
ImmutableMapRef(const ImmutableMapRef &X)
: Root(X.Root),
Factory(X.Factory) {
if (Root) { Root->retain(); }
ImmutableMapRef(const ImmutableMapRef &X) : Root(X.Root), Factory(X.Factory) {
if (Root) {
Root->retain();
}
}
ImmutableMapRef &operator=(const ImmutableMapRef &X) {
@ -351,7 +349,10 @@ public:
// For testing.
//===--------------------------------------------------===//
void verify() const { if (Root) Root->verify(); }
void verify() const {
if (Root)
Root->verify();
}
//===--------------------------------------------------===//
// Iterators.
@ -370,7 +371,7 @@ public:
iterator begin() const { return iterator(Root); }
iterator end() const { return iterator(); }
data_type* lookup(key_type_ref K) const {
data_type *lookup(key_type_ref K) const {
if (Root) {
TreeTy* T = Root->find(K);
if (T) return &T->getValue().second;
@ -392,13 +393,11 @@ public:
unsigned getHeight() const { return Root ? Root->getHeight() : 0; }
static inline void Profile(FoldingSetNodeID& ID, const ImmutableMapRef &M) {
static inline void Profile(FoldingSetNodeID &ID, const ImmutableMapRef &M) {
ID.AddPointer(M.Root);
}
inline void Profile(FoldingSetNodeID& ID) const {
return Profile(ID, *this);
}
inline void Profile(FoldingSetNodeID &ID) const { return Profile(ID, *this); }
};
} // end namespace llvm

View File

@ -85,7 +85,7 @@ public:
reference(); // Undefined
public:
reference(PackedVector &vec, unsigned idx) : Vec(vec), Idx(idx) { }
reference(PackedVector &vec, unsigned idx) : Vec(vec), Idx(idx) {}
reference &operator=(T val) {
Vec.setValue(Vec.Bits, Idx, val);
@ -101,11 +101,11 @@ public:
bool empty() const { return Bits.empty(); }
unsigned size() const { return Bits.size() >> (BitNum-1); }
unsigned size() const { return Bits.size() >> (BitNum - 1); }
void clear() { Bits.clear(); }
void resize(unsigned N) { Bits.resize(N << (BitNum-1)); }
void resize(unsigned N) { Bits.resize(N << (BitNum - 1)); }
void reserve(unsigned N) { Bits.reserve(N << (BitNum-1)); }
@ -151,8 +151,7 @@ public:
};
// Leave BitNum=0 undefined.
template <typename T>
class PackedVector<T, 0>;
template <typename T> class PackedVector<T, 0>;
} // end llvm namespace

View File

@ -54,10 +54,10 @@ class PointerIntPair {
/// IntShift - The number of low bits that we reserve for other uses, and
/// keep zero.
IntShift = (uintptr_t)PtrTraits::NumLowBitsAvailable-IntBits,
IntShift = (uintptr_t)PtrTraits::NumLowBitsAvailable - IntBits,
/// IntMask - This is the unshifted mask for valid bits of the int type.
IntMask = (uintptr_t)(((intptr_t)1 << IntBits)-1),
IntMask = (uintptr_t)(((intptr_t)1 << IntBits) - 1),
// ShiftedIntMask - This is the bits for the integer shifted in place.
ShiftedIntMask = (uintptr_t)(IntMask << IntShift)
@ -133,7 +133,9 @@ public:
void setFromOpaqueValue(void *Val) { Value = reinterpret_cast<intptr_t>(Val);}
static PointerIntPair getFromOpaqueValue(void *V) {
PointerIntPair P; P.setFromOpaqueValue(V); return P;
PointerIntPair P;
P.setFromOpaqueValue(V);
return P;
}
// Allow PointerIntPairs to be created from const void * if and only if the

View File

@ -70,8 +70,7 @@ public:
return New;
}
template <typename AllocatorTy>
void Destroy(AllocatorTy &Allocator) {
template <typename AllocatorTy> void Destroy(AllocatorTy &Allocator) {
// Free memory referenced by the item.
this->~ScopedHashTableVal();
Allocator.Deallocate(this);
@ -90,8 +89,8 @@ class ScopedHashTableScope {
/// LastValInScope - This is the last value that was inserted for this scope
/// or null if none have been inserted yet.
ScopedHashTableVal<K, V> *LastValInScope;
void operator=(ScopedHashTableScope&) = delete;
ScopedHashTableScope(ScopedHashTableScope&) = delete;
void operator=(ScopedHashTableScope &) = delete;
ScopedHashTableScope(ScopedHashTableScope &) = delete;
public:
ScopedHashTableScope(ScopedHashTable<K, V, KInfo, AllocatorTy> &HT);
@ -110,7 +109,7 @@ private:
}
};
template <typename K, typename V, typename KInfo = DenseMapInfo<K> >
template <typename K, typename V, typename KInfo = DenseMapInfo<K>>
class ScopedHashTableIterator {
ScopedHashTableVal<K, V> *Node;
@ -157,8 +156,8 @@ private:
AllocatorTy Allocator;
ScopedHashTable(const ScopedHashTable&); // NOT YET IMPLEMENTED
void operator=(const ScopedHashTable&); // NOT YET IMPLEMENTED
ScopedHashTable(const ScopedHashTable &); // NOT YET IMPLEMENTED
void operator=(const ScopedHashTable &); // NOT YET IMPLEMENTED
friend class ScopedHashTableScope<K, V, KInfo, AllocatorTy>;
public:

View File

@ -244,7 +244,7 @@ template <typename PtrType>
class SmallPtrSetImpl : public SmallPtrSetImplBase {
typedef PointerLikeTypeTraits<PtrType> PtrTraits;
SmallPtrSetImpl(const SmallPtrSetImpl&) = delete;
SmallPtrSetImpl(const SmallPtrSetImpl &) = delete;
protected:
// Constructors that forward to the base.

View File

@ -391,8 +391,7 @@ public:
}
};
template<typename ValueTy>
class StringMapConstIterator {
template <typename ValueTy> class StringMapConstIterator {
protected:
StringMapEntryBase **Ptr;

View File

@ -128,7 +128,7 @@ template<typename DERIVED, typename T>
class CrashRecoveryContextCleanupBase : public CrashRecoveryContextCleanup {
protected:
T *resource;
CrashRecoveryContextCleanupBase(CrashRecoveryContext *context, T* resource)
CrashRecoveryContextCleanupBase(CrashRecoveryContext *context, T *resource)
: CrashRecoveryContextCleanup(context), resource(resource) {}
public:
@ -190,9 +190,7 @@ public:
cleanup->getContext()->registerCleanup(cleanup);
}
~CrashRecoveryContextCleanupRegistrar() {
unregister();
}
~CrashRecoveryContextCleanupRegistrar() { unregister(); }
void unregister() {
if (cleanup && !cleanup->cleanupFired)

View File

@ -61,21 +61,21 @@ namespace llvm {
~ScopedFatalErrorHandler() { remove_fatal_error_handler(); }
};
/// Reports a serious error, calling any installed error handler. These
/// functions are intended to be used for error conditions which are outside
/// the control of the compiler (I/O errors, invalid user input, etc.)
///
/// If no error handler is installed the default is to print the message to
/// standard error, followed by a newline.
/// After the error handler is called this function will call exit(1), it
/// does not return.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason,
/// Reports a serious error, calling any installed error handler. These
/// functions are intended to be used for error conditions which are outside
/// the control of the compiler (I/O errors, invalid user input, etc.)
///
/// If no error handler is installed the default is to print the message to
/// standard error, followed by a newline.
/// After the error handler is called this function will call exit(1), it
/// does not return.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason,
bool gen_crash_diag = true);
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const std::string &reason,
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const std::string &reason,
bool gen_crash_diag = true);
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(StringRef reason,
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(StringRef reason,
bool gen_crash_diag = true);
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const Twine &reason,
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const Twine &reason,
bool gen_crash_diag = true);
/// This function calls abort(), and prints the optional message to stderr.

View File

@ -95,13 +95,13 @@ enum perms {
};
// Helper functions so that you can use & and | to manipulate perms bits:
inline perms operator|(perms l , perms r) {
return static_cast<perms>(
static_cast<unsigned short>(l) | static_cast<unsigned short>(r));
inline perms operator|(perms l, perms r) {
return static_cast<perms>(static_cast<unsigned short>(l) |
static_cast<unsigned short>(r));
}
inline perms operator&(perms l , perms r) {
return static_cast<perms>(
static_cast<unsigned short>(l) & static_cast<unsigned short>(r));
inline perms operator&(perms l, perms r) {
return static_cast<perms>(static_cast<unsigned short>(l) &
static_cast<unsigned short>(r));
}
inline perms &operator|=(perms &l, perms r) {
l = l | r;

View File

@ -102,9 +102,9 @@ unsigned DFSPass(DominatorTreeBase<typename GraphT::NodeType>& DT,
return N;
}
template<class GraphT>
typename GraphT::NodeType*
Eval(DominatorTreeBase<typename GraphT::NodeType>& DT,
template <class GraphT>
typename GraphT::NodeType *
Eval(DominatorTreeBase<typename GraphT::NodeType> &DT,
typename GraphT::NodeType *VIn, unsigned LastLinked) {
typename DominatorTreeBase<typename GraphT::NodeType>::InfoRec &VInInfo =
DT.Info[VIn];

View File

@ -33,10 +33,8 @@ class PointerLikeTypeTraits {
template<typename T>
class PointerLikeTypeTraits<T*> {
public:
static inline void *getAsVoidPointer(T* P) { return P; }
static inline T *getFromVoidPointer(void *P) {
return static_cast<T*>(P);
}
static inline void *getAsVoidPointer(T *P) { return P; }
static inline T *getFromVoidPointer(void *P) { return static_cast<T *>(P); }
/// Note, we assume here that malloc returns objects at least 4-byte aligned.
/// However, this may be wrong, or pointers may be from something other than

View File

@ -37,7 +37,7 @@ public:
/// significant and shouldn't be counted as part of a duration.
static TimeRecord getCurrentTime(bool Start = true);
double getProcessTime() const { return UserTime+SystemTime; }
double getProcessTime() const { return UserTime + SystemTime; }
double getUserTime() const { return UserTime; }
double getSystemTime() const { return SystemTime; }
double getWallTime() const { return WallTime; }
@ -157,7 +157,7 @@ struct NamedRegionTimer : public TimeRegion {
class TimerGroup {
std::string Name;
Timer *FirstTimer; // First timer in the group.
std::vector<std::pair<TimeRecord, std::string> > TimersToPrint;
std::vector<std::pair<TimeRecord, std::string>> TimersToPrint;
TimerGroup **Prev, *Next; // Doubly linked list of TimerGroup's.
TimerGroup(const TimerGroup &TG) = delete;

View File

@ -17,8 +17,7 @@
#include "llvm/Support/raw_ostream.h"
namespace llvm
{
namespace llvm {
/// circular_raw_ostream - A raw_ostream which *can* save its data
/// to a circular buffer, or can pass it through directly to an
/// underlying stream if specified with a buffer of zero.