diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-10-16 06:01:44 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-10-16 06:01:44 +0000 |
commit | 778986856c42cdc87d2bae29e4079f772ed9192d (patch) | |
tree | aeb06a616e3598db6ff246fd585fbebac101714c /lib/VMCore | |
parent | 925bcb132a79f0bdd22c207adea0a01e80d2218a (diff) | |
download | external_llvm-778986856c42cdc87d2bae29e4079f772ed9192d.zip external_llvm-778986856c42cdc87d2bae29e4079f772ed9192d.tar.gz external_llvm-778986856c42cdc87d2bae29e4079f772ed9192d.tar.bz2 |
Cleanup whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166013 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Attributes.cpp | 72 |
1 files changed, 35 insertions, 37 deletions
diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp index cf8a895..c79d000 100644 --- a/lib/VMCore/Attributes.cpp +++ b/lib/VMCore/Attributes.cpp @@ -93,12 +93,12 @@ uint64_t Attributes::Raw() const { Attributes Attributes::typeIncompatible(Type *Ty) { AttrBuilder Incompatible; - + if (!Ty->isIntegerTy()) // Attributes that only apply to integers. Incompatible.addAttribute(Attributes::SExt) .addAttribute(Attributes::ZExt); - + if (!Ty->isPointerTy()) // Attributes that only apply to pointers. Incompatible.addAttribute(Attributes::ByVal) @@ -106,7 +106,7 @@ Attributes Attributes::typeIncompatible(Type *Ty) { .addAttribute(Attributes::NoAlias) .addAttribute(Attributes::NoCapture) .addAttribute(Attributes::StructRet); - + return Attributes::get(Ty->getContext(), Incompatible); } @@ -362,19 +362,19 @@ static ManagedStatic<sys::SmartMutex<true> > ALMutex; class AttributeListImpl : public FoldingSetNode { sys::cas_flag RefCount; - + // AttributesList is uniqued, these should not be publicly available. void operator=(const AttributeListImpl &) LLVM_DELETED_FUNCTION; AttributeListImpl(const AttributeListImpl &) LLVM_DELETED_FUNCTION; ~AttributeListImpl(); // Private implementation public: SmallVector<AttributeWithIndex, 4> Attrs; - + AttributeListImpl(ArrayRef<AttributeWithIndex> attrs) : Attrs(attrs.begin(), attrs.end()) { RefCount = 0; } - + void AddRef() { sys::SmartScopedLock<true> Lock(*ALMutex); ++RefCount; @@ -387,7 +387,7 @@ public: if (new_val == 0) delete this; } - + void Profile(FoldingSetNodeID &ID) const { Profile(ID, Attrs); } @@ -398,50 +398,49 @@ public: } } }; -} + +} // end llvm namespace AttributeListImpl::~AttributeListImpl() { // NOTE: Lock must be acquired by caller. AttributesLists->RemoveNode(this); } - AttrListPtr AttrListPtr::get(ArrayRef<AttributeWithIndex> Attrs) { // If there are no attributes then return a null AttributesList pointer. if (Attrs.empty()) return AttrListPtr(); - + #ifndef NDEBUG for (unsigned i = 0, e = Attrs.size(); i != e; ++i) { - assert(Attrs[i].Attrs.hasAttributes() && + assert(Attrs[i].Attrs.hasAttributes() && "Pointless attribute!"); assert((!i || Attrs[i-1].Index < Attrs[i].Index) && "Misordered AttributesList!"); } #endif - + // Otherwise, build a key to look up the existing attributes. FoldingSetNodeID ID; AttributeListImpl::Profile(ID, Attrs); void *InsertPos; - + sys::SmartScopedLock<true> Lock(*ALMutex); - + AttributeListImpl *PAL = AttributesLists->FindNodeOrInsertPos(ID, InsertPos); - + // If we didn't find any existing attributes of the same shape then // create a new one and insert it. if (!PAL) { PAL = new AttributeListImpl(Attrs); AttributesLists->InsertNode(PAL, InsertPos); } - + // Return the AttributesList that we found or created. return AttrListPtr(PAL); } - //===----------------------------------------------------------------------===// // AttrListPtr Method Implementations //===----------------------------------------------------------------------===// @@ -451,7 +450,7 @@ AttrListPtr::AttrListPtr(AttributeListImpl *LI) : AttrList(LI) { } AttrListPtr::AttrListPtr(const AttrListPtr &P) : AttrList(P.AttrList) { - if (AttrList) AttrList->AddRef(); + if (AttrList) AttrList->AddRef(); } const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) { @@ -467,7 +466,7 @@ AttrListPtr::~AttrListPtr() { if (AttrList) AttrList->DropRef(); } -/// getNumSlots - Return the number of slots used in this attribute list. +/// getNumSlots - Return the number of slots used in this attribute list. /// This is the number of arguments that have an attribute set on them /// (including the function itself). unsigned AttrListPtr::getNumSlots() const { @@ -481,13 +480,12 @@ const AttributeWithIndex &AttrListPtr::getSlot(unsigned Slot) const { return AttrList->Attrs[Slot]; } - -/// getAttributes - The attributes for the specified index are -/// returned. Attributes for the result are denoted with Idx = 0. -/// Function notes are denoted with idx = ~0. +/// getAttributes - The attributes for the specified index are returned. +/// Attributes for the result are denoted with Idx = 0. Function notes are +/// denoted with idx = ~0. Attributes AttrListPtr::getAttributes(unsigned Idx) const { if (AttrList == 0) return Attributes(); - + const SmallVector<AttributeWithIndex, 4> &Attrs = AttrList->Attrs; for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i) if (Attrs[i].Index == Idx) @@ -529,12 +527,12 @@ AttrListPtr AttrListPtr::addAttr(LLVMContext &C, unsigned Idx, assert((!OldAlign || !NewAlign || OldAlign == NewAlign) && "Attempt to change alignment!"); #endif - + AttrBuilder NewAttrs = AttrBuilder(OldAttrs).addAttributes(Attrs); if (NewAttrs == AttrBuilder(OldAttrs)) return *this; - + SmallVector<AttributeWithIndex, 8> NewAttrList; if (AttrList == 0) NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs)); @@ -552,14 +550,14 @@ AttrListPtr AttrListPtr::addAttr(LLVMContext &C, unsigned Idx, addAttributes(OldAttrList[i].Attrs)); ++i; } - + NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs)); - + // Copy attributes for arguments after this one. - NewAttrList.insert(NewAttrList.end(), + NewAttrList.insert(NewAttrList.end(), OldAttrList.begin()+i, OldAttrList.end()); } - + return get(NewAttrList); } @@ -572,7 +570,7 @@ AttrListPtr AttrListPtr::removeAttr(LLVMContext &C, unsigned Idx, "Attempt to exclude alignment!"); #endif if (AttrList == 0) return AttrListPtr(); - + Attributes OldAttrs = getAttributes(Idx); AttrBuilder NewAttrs = AttrBuilder(OldAttrs).removeAttributes(Attrs); @@ -582,11 +580,11 @@ AttrListPtr AttrListPtr::removeAttr(LLVMContext &C, unsigned Idx, SmallVector<AttributeWithIndex, 8> NewAttrList; const SmallVector<AttributeWithIndex, 4> &OldAttrList = AttrList->Attrs; unsigned i = 0, e = OldAttrList.size(); - + // Copy attributes for arguments before this one. for (; i != e && OldAttrList[i].Index < Idx; ++i) NewAttrList.push_back(OldAttrList[i]); - + // If there are attributes already at this index, merge them in. assert(OldAttrList[i].Index == Idx && "Attribute isn't set?"); Attrs = Attributes::get(C, AttrBuilder(OldAttrList[i].Attrs). @@ -594,11 +592,11 @@ AttrListPtr AttrListPtr::removeAttr(LLVMContext &C, unsigned Idx, ++i; if (Attrs.hasAttributes()) // If any attributes left for this param, add them. NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs)); - + // Copy attributes for arguments after this one. - NewAttrList.insert(NewAttrList.end(), + NewAttrList.insert(NewAttrList.end(), OldAttrList.begin()+i, OldAttrList.end()); - + return get(NewAttrList); } @@ -608,6 +606,6 @@ void AttrListPtr::dump() const { const AttributeWithIndex &PAWI = getSlot(i); dbgs() << "{" << PAWI.Index << "," << PAWI.Attrs.getAsString() << "} "; } - + dbgs() << "]\n"; } |