mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
Add asserts to SmallVector so that calls to front() and back() only succeed
if the vector is not empty. This will ensure that calls to these functions will reference elements in the vector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173321 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8453b3f66a
commit
0ac7e6f293
@ -145,16 +145,20 @@ public:
|
||||
}
|
||||
|
||||
reference front() {
|
||||
assert(!empty());
|
||||
return begin()[0];
|
||||
}
|
||||
const_reference front() const {
|
||||
assert(!empty());
|
||||
return begin()[0];
|
||||
}
|
||||
|
||||
reference back() {
|
||||
assert(!empty());
|
||||
return end()[-1];
|
||||
}
|
||||
const_reference back() const {
|
||||
assert(!empty());
|
||||
return end()[-1];
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user