[llvm] 3c3071d - [ADT][NFC] Silence some misc-unconventional-assign-operator warnings
Nathan James via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 30 03:57:41 PDT 2020
Author: Nathan James
Date: 2020-10-30T10:57:25Z
New Revision: 3c3071d5e7dd259022d4f5e879fdf9824b9e490c
URL: https://github.com/llvm/llvm-project/commit/3c3071d5e7dd259022d4f5e879fdf9824b9e490c
DIFF: https://github.com/llvm/llvm-project/commit/3c3071d5e7dd259022d4f5e879fdf9824b9e490c.diff
LOG: [ADT][NFC] Silence some misc-unconventional-assign-operator warnings
Added:
Modified:
llvm/include/llvm/ADT/SmallString.h
llvm/include/llvm/ADT/SmallVector.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/SmallString.h b/llvm/include/llvm/ADT/SmallString.h
index 2fa47c7f4e23..c0e8fcd29461 100644
--- a/llvm/include/llvm/ADT/SmallString.h
+++ b/llvm/include/llvm/ADT/SmallString.h
@@ -306,9 +306,9 @@ class SmallString : public SmallVector<char, InternalLen> {
}
// Extra operators.
- const SmallString &operator=(StringRef RHS) {
- this->clear();
- return *this += RHS;
+ SmallString &operator=(StringRef RHS) {
+ this->assign(RHS);
+ return *this;
}
SmallString &operator+=(StringRef RHS) {
diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
index dd5cd9531ded..bb008af25f96 100644
--- a/llvm/include/llvm/ADT/SmallVector.h
+++ b/llvm/include/llvm/ADT/SmallVector.h
@@ -925,7 +925,7 @@ class LLVM_GSL_OWNER SmallVector : public SmallVectorImpl<T>,
SmallVectorImpl<T>::operator=(RHS);
}
- const SmallVector &operator=(const SmallVector &RHS) {
+ SmallVector &operator=(const SmallVector &RHS) {
SmallVectorImpl<T>::operator=(RHS);
return *this;
}
@@ -940,17 +940,17 @@ class LLVM_GSL_OWNER SmallVector : public SmallVectorImpl<T>,
SmallVectorImpl<T>::operator=(::std::move(RHS));
}
- const SmallVector &operator=(SmallVector &&RHS) {
+ SmallVector &operator=(SmallVector &&RHS) {
SmallVectorImpl<T>::operator=(::std::move(RHS));
return *this;
}
- const SmallVector &operator=(SmallVectorImpl<T> &&RHS) {
+ SmallVector &operator=(SmallVectorImpl<T> &&RHS) {
SmallVectorImpl<T>::operator=(::std::move(RHS));
return *this;
}
- const SmallVector &operator=(std::initializer_list<T> IL) {
+ SmallVector &operator=(std::initializer_list<T> IL) {
this->assign(IL);
return *this;
}
More information about the llvm-commits
mailing list