mirror of
https://github.com/RPCSX/llvm.git
synced 2025-04-02 08:11:54 +00:00
Avoid undefined behavior when vector is empty.
Found by ubsan. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255258 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f3ba0560c0
commit
4d1332c4e7
@ -58,6 +58,8 @@ public:
|
||||
insert(Start, End);
|
||||
}
|
||||
|
||||
ArrayRef<T> getArrayRef() const { return vector_; }
|
||||
|
||||
/// \brief Determine if the SetVector is empty or not.
|
||||
bool empty() const {
|
||||
return vector_.empty();
|
||||
|
@ -772,8 +772,7 @@ bool ModuleLinker::run() {
|
||||
Internalize.insert(GV->getName());
|
||||
}
|
||||
|
||||
if (Mover.move(SrcM,
|
||||
makeArrayRef(&*ValuesToLink.begin(), ValuesToLink.size()),
|
||||
if (Mover.move(SrcM, ValuesToLink.getArrayRef(),
|
||||
[this](GlobalValue &GV, IRMover::ValueAdder Add) {
|
||||
addLazyFor(GV, Add);
|
||||
}))
|
||||
|
Loading…
x
Reference in New Issue
Block a user