From 499a56f784d277b85bc1efec5809f571900df030 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 10 Aug 2015 04:22:36 +0000 Subject: [PATCH] Reformat headers in ADT and Support partially. Note, I didn't reformat entirely, but partially where I touched in previous commits. llvm-svn: 244432 --- llvm/include/llvm/ADT/APSInt.h | 2 +- llvm/include/llvm/ADT/DepthFirstIterator.h | 14 ++++---- llvm/include/llvm/ADT/FoldingSet.h | 9 ++--- llvm/include/llvm/ADT/ImmutableMap.h | 41 +++++++++++----------- llvm/include/llvm/ADT/PackedVector.h | 11 +++--- llvm/include/llvm/ADT/PointerIntPair.h | 8 +++-- llvm/include/llvm/ADT/ScopedHashTable.h | 13 ++++--- llvm/include/llvm/ADT/SmallPtrSet.h | 2 +- llvm/include/llvm/ADT/StringMap.h | 3 +- llvm/include/llvm/Support/CrashRecoveryContext.h | 14 ++++---- llvm/include/llvm/Support/ErrorHandling.h | 32 ++++++++--------- llvm/include/llvm/Support/FileSystem.h | 12 +++---- .../llvm/Support/GenericDomTreeConstruction.h | 6 ++-- llvm/include/llvm/Support/PointerLikeTypeTraits.h | 6 ++-- llvm/include/llvm/Support/Timer.h | 4 +-- llvm/include/llvm/Support/circular_raw_ostream.h | 3 +- 16 files changed, 85 insertions(+), 95 deletions(-) diff --git a/llvm/include/llvm/ADT/APSInt.h b/llvm/include/llvm/ADT/APSInt.h index 0e08836..a6552d0 100644 --- a/llvm/include/llvm/ADT/APSInt.h +++ b/llvm/include/llvm/ADT/APSInt.h @@ -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(*this) ^ RHS, IsUnsigned); } diff --git a/llvm/include/llvm/ADT/DepthFirstIterator.h b/llvm/include/llvm/ADT/DepthFirstIterator.h index 19e2ff3..c9317b8 100644 --- a/llvm/include/llvm/ADT/DepthFirstIterator.h +++ b/llvm/include/llvm/ADT/DepthFirstIterator.h @@ -75,13 +75,13 @@ class df_iterator : public std::iterator > VisitStack; + std::vector> 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(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; } } diff --git a/llvm/include/llvm/ADT/FoldingSet.h b/llvm/include/llvm/ADT/FoldingSet.h index e61580d..42e2e61 100644 --- a/llvm/include/llvm/ADT/FoldingSet.h +++ b/llvm/include/llvm/ADT/FoldingSet.h @@ -611,8 +611,7 @@ public: } }; -template -class FoldingSetIterator : public FoldingSetIteratorImpl { +template class FoldingSetIterator : public FoldingSetIteratorImpl { public: explicit FoldingSetIterator(void **Bucket) : FoldingSetIteratorImpl(Bucket) {} @@ -662,7 +661,7 @@ public: } }; -template +template 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); } }; //===----------------------------------------------------------------------===// diff --git a/llvm/include/llvm/ADT/ImmutableMap.h b/llvm/include/llvm/ADT/ImmutableMap.h index c8221a8..c5b8dcc 100644 --- a/llvm/include/llvm/ADT/ImmutableMap.h +++ b/llvm/include/llvm/ADT/ImmutableMap.h @@ -98,11 +98,10 @@ public: const bool Canonicalize; public: - Factory(bool canonicalize = true) - : Canonicalize(canonicalize) {} + Factory(bool canonicalize = true) : Canonicalize(canonicalize) {} - Factory(BumpPtrAllocator& Alloc, bool canonicalize = true) - : F(Alloc), Canonicalize(canonicalize) {} + 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(R)), - Factory(F) { - if (Root) { Root->retain(); } + explicit ImmutableMapRef(const TreeTy *R, FactoryTy *F) + : Root(const_cast(R)), Factory(F) { + if (Root) { + Root->retain(); + } } explicit ImmutableMapRef(const ImmutableMap &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 diff --git a/llvm/include/llvm/ADT/PackedVector.h b/llvm/include/llvm/ADT/PackedVector.h index 7345d82..2341e89 100644 --- a/llvm/include/llvm/ADT/PackedVector.h +++ b/llvm/include/llvm/ADT/PackedVector.h @@ -83,9 +83,9 @@ public: PackedVector &Vec; const unsigned Idx; - reference(); // Undefined + 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 -class PackedVector; +template class PackedVector; } // end llvm namespace diff --git a/llvm/include/llvm/ADT/PointerIntPair.h b/llvm/include/llvm/ADT/PointerIntPair.h index b723864..66d4b1e 100644 --- a/llvm/include/llvm/ADT/PointerIntPair.h +++ b/llvm/include/llvm/ADT/PointerIntPair.h @@ -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(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 diff --git a/llvm/include/llvm/ADT/ScopedHashTable.h b/llvm/include/llvm/ADT/ScopedHashTable.h index 5bcc56e..6b0c299 100644 --- a/llvm/include/llvm/ADT/ScopedHashTable.h +++ b/llvm/include/llvm/ADT/ScopedHashTable.h @@ -70,8 +70,7 @@ public: return New; } - template - void Destroy(AllocatorTy &Allocator) { + template 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 *LastValInScope; - void operator=(ScopedHashTableScope&) = delete; - ScopedHashTableScope(ScopedHashTableScope&) = delete; + void operator=(ScopedHashTableScope &) = delete; + ScopedHashTableScope(ScopedHashTableScope &) = delete; public: ScopedHashTableScope(ScopedHashTable &HT); @@ -110,7 +109,7 @@ private: } }; -template > +template > class ScopedHashTableIterator { ScopedHashTableVal *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; public: diff --git a/llvm/include/llvm/ADT/SmallPtrSet.h b/llvm/include/llvm/ADT/SmallPtrSet.h index 29be3ed..3d98e8f 100644 --- a/llvm/include/llvm/ADT/SmallPtrSet.h +++ b/llvm/include/llvm/ADT/SmallPtrSet.h @@ -244,7 +244,7 @@ template class SmallPtrSetImpl : public SmallPtrSetImplBase { typedef PointerLikeTypeTraits PtrTraits; - SmallPtrSetImpl(const SmallPtrSetImpl&) = delete; + SmallPtrSetImpl(const SmallPtrSetImpl &) = delete; protected: // Constructors that forward to the base. diff --git a/llvm/include/llvm/ADT/StringMap.h b/llvm/include/llvm/ADT/StringMap.h index c6d610c..194235f 100644 --- a/llvm/include/llvm/ADT/StringMap.h +++ b/llvm/include/llvm/ADT/StringMap.h @@ -391,8 +391,7 @@ public: } }; -template -class StringMapConstIterator { +template class StringMapConstIterator { protected: StringMapEntryBase **Ptr; diff --git a/llvm/include/llvm/Support/CrashRecoveryContext.h b/llvm/include/llvm/Support/CrashRecoveryContext.h index ec965cb..e83695a 100644 --- a/llvm/include/llvm/Support/CrashRecoveryContext.h +++ b/llvm/include/llvm/Support/CrashRecoveryContext.h @@ -107,7 +107,7 @@ class CrashRecoveryContextCleanup { protected: CrashRecoveryContext *context; CrashRecoveryContextCleanup(CrashRecoveryContext *context) - : context(context), cleanupFired(false) {} + : context(context), cleanupFired(false) {} public: bool cleanupFired; @@ -128,8 +128,8 @@ template class CrashRecoveryContextCleanupBase : public CrashRecoveryContextCleanup { protected: T *resource; - CrashRecoveryContextCleanupBase(CrashRecoveryContext *context, T* resource) - : CrashRecoveryContextCleanup(context), resource(resource) {} + CrashRecoveryContextCleanupBase(CrashRecoveryContext *context, T *resource) + : CrashRecoveryContextCleanup(context), resource(resource) {} public: static DERIVED *create(T *x) { @@ -147,8 +147,8 @@ class CrashRecoveryContextDestructorCleanup : public public: CrashRecoveryContextDestructorCleanup(CrashRecoveryContext *context, T *resource) - : CrashRecoveryContextCleanupBase< - CrashRecoveryContextDestructorCleanup, T>(context, resource) {} + : CrashRecoveryContextCleanupBase< + CrashRecoveryContextDestructorCleanup, T>(context, resource) {} virtual void recoverResources() { this->resource->~T(); @@ -190,9 +190,7 @@ public: cleanup->getContext()->registerCleanup(cleanup); } - ~CrashRecoveryContextCleanupRegistrar() { - unregister(); - } + ~CrashRecoveryContextCleanupRegistrar() { unregister(); } void unregister() { if (cleanup && !cleanup->cleanupFired) diff --git a/llvm/include/llvm/Support/ErrorHandling.h b/llvm/include/llvm/Support/ErrorHandling.h index fc0997e..32f05e0 100644 --- a/llvm/include/llvm/Support/ErrorHandling.h +++ b/llvm/include/llvm/Support/ErrorHandling.h @@ -61,22 +61,22 @@ 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, - bool gen_crash_diag = true); - 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, - bool gen_crash_diag = true); - LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const Twine &reason, - bool gen_crash_diag = true); +/// 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, + bool gen_crash_diag = true); +LLVM_ATTRIBUTE_NORETURN void report_fatal_error(StringRef reason, + bool gen_crash_diag = true); +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. /// Use the llvm_unreachable macro (that adds location info), instead of diff --git a/llvm/include/llvm/Support/FileSystem.h b/llvm/include/llvm/Support/FileSystem.h index 2296c6d..f0b74da 100644 --- a/llvm/include/llvm/Support/FileSystem.h +++ b/llvm/include/llvm/Support/FileSystem.h @@ -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( - static_cast(l) | static_cast(r)); +inline perms operator|(perms l, perms r) { + return static_cast(static_cast(l) | + static_cast(r)); } -inline perms operator&(perms l , perms r) { - return static_cast( - static_cast(l) & static_cast(r)); +inline perms operator&(perms l, perms r) { + return static_cast(static_cast(l) & + static_cast(r)); } inline perms &operator|=(perms &l, perms r) { l = l | r; diff --git a/llvm/include/llvm/Support/GenericDomTreeConstruction.h b/llvm/include/llvm/Support/GenericDomTreeConstruction.h index ccf5d88..3e867dc 100644 --- a/llvm/include/llvm/Support/GenericDomTreeConstruction.h +++ b/llvm/include/llvm/Support/GenericDomTreeConstruction.h @@ -102,9 +102,9 @@ unsigned DFSPass(DominatorTreeBase& DT, return N; } -template -typename GraphT::NodeType* -Eval(DominatorTreeBase& DT, +template +typename GraphT::NodeType * +Eval(DominatorTreeBase &DT, typename GraphT::NodeType *VIn, unsigned LastLinked) { typename DominatorTreeBase::InfoRec &VInInfo = DT.Info[VIn]; diff --git a/llvm/include/llvm/Support/PointerLikeTypeTraits.h b/llvm/include/llvm/Support/PointerLikeTypeTraits.h index 6b88458..8e6659c 100644 --- a/llvm/include/llvm/Support/PointerLikeTypeTraits.h +++ b/llvm/include/llvm/Support/PointerLikeTypeTraits.h @@ -33,10 +33,8 @@ class PointerLikeTypeTraits { template class PointerLikeTypeTraits { public: - static inline void *getAsVoidPointer(T* P) { return P; } - static inline T *getFromVoidPointer(void *P) { - return static_cast(P); - } + static inline void *getAsVoidPointer(T *P) { return P; } + static inline T *getFromVoidPointer(void *P) { return static_cast(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 diff --git a/llvm/include/llvm/Support/Timer.h b/llvm/include/llvm/Support/Timer.h index b4bf954..2d9b0e2 100644 --- a/llvm/include/llvm/Support/Timer.h +++ b/llvm/include/llvm/Support/Timer.h @@ -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 > TimersToPrint; + std::vector> TimersToPrint; TimerGroup **Prev, *Next; // Doubly linked list of TimerGroup's. TimerGroup(const TimerGroup &TG) = delete; diff --git a/llvm/include/llvm/Support/circular_raw_ostream.h b/llvm/include/llvm/Support/circular_raw_ostream.h index 13900d0..b46fd7f 100644 --- a/llvm/include/llvm/Support/circular_raw_ostream.h +++ b/llvm/include/llvm/Support/circular_raw_ostream.h @@ -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. -- 2.7.4