Clean up trailing whitespace and unnecessary blank lines.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161025 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chandler Carruth 2012-07-31 04:13:57 +00:00
parent 40dab1059e
commit b4c28fc93f

View File

@ -30,7 +30,7 @@ public:
typedef typename VecTy::value_type value_type; typedef typename VecTy::value_type value_type;
llvm::PointerUnion<EltTy, VecTy*> Val; llvm::PointerUnion<EltTy, VecTy*> Val;
TinyPtrVector() {} TinyPtrVector() {}
TinyPtrVector(const TinyPtrVector &RHS) : Val(RHS.Val) { TinyPtrVector(const TinyPtrVector &RHS) : Val(RHS.Val) {
if (VecTy *V = Val.template dyn_cast<VecTy*>()) if (VecTy *V = Val.template dyn_cast<VecTy*>())
@ -45,7 +45,7 @@ public:
if (VecTy *V = Val.template dyn_cast<VecTy*>()) if (VecTy *V = Val.template dyn_cast<VecTy*>())
delete V; delete V;
} }
// implicit conversion operator to ArrayRef. // implicit conversion operator to ArrayRef.
operator ArrayRef<EltTy>() const { operator ArrayRef<EltTy>() const {
if (Val.isNull()) if (Val.isNull())
@ -54,7 +54,7 @@ public:
return *Val.getAddrOfPtr1(); return *Val.getAddrOfPtr1();
return *Val.template get<VecTy*>(); return *Val.template get<VecTy*>();
} }
bool empty() const { bool empty() const {
// This vector can be empty if it contains no element, or if it // This vector can be empty if it contains no element, or if it
// contains a pointer to an empty vector. // contains a pointer to an empty vector.
@ -63,7 +63,7 @@ public:
return Vec->empty(); return Vec->empty();
return false; return false;
} }
unsigned size() const { unsigned size() const {
if (empty()) if (empty())
return 0; return 0;
@ -71,21 +71,21 @@ public:
return 1; return 1;
return Val.template get<VecTy*>()->size(); return Val.template get<VecTy*>()->size();
} }
typedef const EltTy *const_iterator; typedef const EltTy *const_iterator;
typedef EltTy *iterator; typedef EltTy *iterator;
iterator begin() { iterator begin() {
if (Val.template is<EltTy>()) if (Val.template is<EltTy>())
return Val.getAddrOfPtr1(); return Val.getAddrOfPtr1();
return Val.template get<VecTy *>()->begin(); return Val.template get<VecTy *>()->begin();
} }
iterator end() { iterator end() {
if (Val.template is<EltTy>()) if (Val.template is<EltTy>())
return begin() + (Val.isNull() ? 0 : 1); return begin() + (Val.isNull() ? 0 : 1);
return Val.template get<VecTy *>()->end(); return Val.template get<VecTy *>()->end();
} }
@ -103,19 +103,19 @@ public:
assert(i == 0 && "tinyvector index out of range"); assert(i == 0 && "tinyvector index out of range");
return V; return V;
} }
assert(i < Val.template get<VecTy*>()->size() && assert(i < Val.template get<VecTy*>()->size() &&
"tinyvector index out of range"); "tinyvector index out of range");
return (*Val.template get<VecTy*>())[i]; return (*Val.template get<VecTy*>())[i];
} }
EltTy front() const { EltTy front() const {
assert(!empty() && "vector empty"); assert(!empty() && "vector empty");
if (EltTy V = Val.template dyn_cast<EltTy>()) if (EltTy V = Val.template dyn_cast<EltTy>())
return V; return V;
return Val.template get<VecTy*>()->front(); return Val.template get<VecTy*>()->front();
} }
EltTy back() const { EltTy back() const {
assert(!empty() && "vector empty"); assert(!empty() && "vector empty");
if (EltTy V = Val.template dyn_cast<EltTy>()) if (EltTy V = Val.template dyn_cast<EltTy>())
@ -123,26 +123,25 @@ public:
return Val.template get<VecTy*>()->back(); return Val.template get<VecTy*>()->back();
} }
void push_back(EltTy NewVal) { void push_back(EltTy NewVal) {
assert(NewVal != 0 && "Can't add a null value"); assert(NewVal != 0 && "Can't add a null value");
// If we have nothing, add something. // If we have nothing, add something.
if (Val.isNull()) { if (Val.isNull()) {
Val = NewVal; Val = NewVal;
return; return;
} }
// If we have a single value, convert to a vector. // If we have a single value, convert to a vector.
if (EltTy V = Val.template dyn_cast<EltTy>()) { if (EltTy V = Val.template dyn_cast<EltTy>()) {
Val = new VecTy(); Val = new VecTy();
Val.template get<VecTy*>()->push_back(V); Val.template get<VecTy*>()->push_back(V);
} }
// Add the new value, we know we have a vector. // Add the new value, we know we have a vector.
Val.template get<VecTy*>()->push_back(NewVal); Val.template get<VecTy*>()->push_back(NewVal);
} }
void pop_back() { void pop_back() {
// If we have a single value, convert to empty. // If we have a single value, convert to empty.
if (Val.template is<EltTy>()) if (Val.template is<EltTy>())
@ -151,7 +150,6 @@ public:
Vec->pop_back(); Vec->pop_back();
} }
void clear() { void clear() {
// If we have a single value, convert to empty. // If we have a single value, convert to empty.
if (Val.template is<EltTy>()) { if (Val.template is<EltTy>()) {
@ -175,7 +173,7 @@ public:
} }
return end(); return end();
} }
private: private:
void operator=(const TinyPtrVector&); // NOT IMPLEMENTED YET. void operator=(const TinyPtrVector&); // NOT IMPLEMENTED YET.
#if LLVM_USE_RVALUE_REFERENCES #if LLVM_USE_RVALUE_REFERENCES