llvm.org GIT mirror llvm / 4d1332c
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 Rafael Espindola 4 years ago
2 changed file(s) with 3 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
5757 insert(Start, End);
5858 }
5959
60 ArrayRef getArrayRef() const { return vector_; }
61
6062 /// \brief Determine if the SetVector is empty or not.
6163 bool empty() const {
6264 return vector_.empty();
771771 Internalize.insert(GV->getName());
772772 }
773773
774 if (Mover.move(SrcM,
775 makeArrayRef(&*ValuesToLink.begin(), ValuesToLink.size()),
774 if (Mover.move(SrcM, ValuesToLink.getArrayRef(),
776775 [this](GlobalValue &GV, IRMover::ValueAdder Add) {
777776 addLazyFor(GV, Add);
778777 }))