this->Size = this->Capacity = 0; // FIXME: Setting Capacity to 0 is suspect.
}
+ void assertSafeToPush(const void *Elt) {
+ assert(
+ (Elt < begin() || Elt >= end() || this->size() < this->capacity()) &&
+ "Attempting to push_back to the vector an element of the vector without"
+ " enough space reserved");
+ }
+
public:
using size_type = size_t;
using difference_type = ptrdiff_t;
public:
void push_back(const T &Elt) {
+ this->assertSafeToPush(&Elt);
if (LLVM_UNLIKELY(this->size() >= this->capacity()))
this->grow();
::new ((void*) this->end()) T(Elt);
}
void push_back(T &&Elt) {
+ this->assertSafeToPush(&Elt);
if (LLVM_UNLIKELY(this->size() >= this->capacity()))
this->grow();
::new ((void*) this->end()) T(::std::move(Elt));
public:
void push_back(const T &Elt) {
+ this->assertSafeToPush(&Elt);
if (LLVM_UNLIKELY(this->size() >= this->capacity()))
this->grow();
memcpy(reinterpret_cast<void *>(this->end()), &Elt, sizeof(T));
MCOperand &getOperand(unsigned i) { return Operands[i]; }
unsigned getNumOperands() const { return Operands.size(); }
- void addOperand(const MCOperand &Op) { Operands.push_back(Op); }
+ void addOperand(const MCOperand Op) { Operands.push_back(Op); }
using iterator = SmallVectorImpl<MCOperand>::iterator;
using const_iterator = SmallVectorImpl<MCOperand>::const_iterator;