various cleanups noticed by Frits

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135396 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2011-07-18 16:35:57 +00:00
parent 1419f9206e
commit 22e522e086

View File

@ -37,9 +37,9 @@ public:
delete V; delete V;
} }
/// empty() - This vector can be empty if it contains no element, or if it
/// contains a pointer to an empty vector.
bool empty() const { bool empty() const {
// This vector can be empty if it contains no element, or if it
// contains a pointer to an empty vector.
if (Val.isNull()) return true; if (Val.isNull()) return true;
if (VecTy *Vec = Val.template dyn_cast<VecTy*>()) if (VecTy *Vec = Val.template dyn_cast<VecTy*>())
return Vec->empty(); return Vec->empty();
@ -49,9 +49,9 @@ public:
unsigned size() const { unsigned size() const {
if (empty()) if (empty())
return 0; return 0;
if (Val. template is<EltTy>()) if (Val.template is<EltTy>())
return 1; return 1;
return Val. template get<VecTy*>()->size(); return Val.template get<VecTy*>()->size();
} }
typedef const EltTy *iterator; typedef const EltTy *iterator;
@ -83,9 +83,9 @@ public:
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 {
@ -105,7 +105,7 @@ public:
} }
// 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);
} }