Skip to content

Commit 3ea8f34

Browse files
njames93memfrob
authored andcommitted
[ADT][NFC] Silence some misc-unconventional-assign-operator warnings
1 parent 6533ae1 commit 3ea8f34

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

llvm/include/llvm/ADT/SmallString.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,9 @@ class SmallString : public SmallVector<char, InternalLen> {
306306
}
307307

308308
// Extra operators.
309-
const SmallString &operator=(StringRef RHS) {
310-
this->clear();
311-
return *this += RHS;
309+
SmallString &operator=(StringRef RHS) {
310+
this->assign(RHS);
311+
return *this;
312312
}
313313

314314
SmallString &operator+=(StringRef RHS) {

llvm/include/llvm/ADT/SmallVector.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ class LLVM_GSL_OWNER SmallVector : public SmallVectorImpl<T>,
925925
SmallVectorImpl<T>::operator=(RHS);
926926
}
927927

928-
const SmallVector &operator=(const SmallVector &RHS) {
928+
SmallVector &operator=(const SmallVector &RHS) {
929929
SmallVectorImpl<T>::operator=(RHS);
930930
return *this;
931931
}
@@ -940,17 +940,17 @@ class LLVM_GSL_OWNER SmallVector : public SmallVectorImpl<T>,
940940
SmallVectorImpl<T>::operator=(::std::move(RHS));
941941
}
942942

943-
const SmallVector &operator=(SmallVector &&RHS) {
943+
SmallVector &operator=(SmallVector &&RHS) {
944944
SmallVectorImpl<T>::operator=(::std::move(RHS));
945945
return *this;
946946
}
947947

948-
const SmallVector &operator=(SmallVectorImpl<T> &&RHS) {
948+
SmallVector &operator=(SmallVectorImpl<T> &&RHS) {
949949
SmallVectorImpl<T>::operator=(::std::move(RHS));
950950
return *this;
951951
}
952952

953-
const SmallVector &operator=(std::initializer_list<T> IL) {
953+
SmallVector &operator=(std::initializer_list<T> IL) {
954954
this->assign(IL);
955955
return *this;
956956
}

0 commit comments

Comments
 (0)