[llvm] r328803 - [ADT] NFC: Fix bogus StringSwitch rule-of-five boilerplate
David Zarzycki via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 29 09:51:29 PDT 2018
Author: davezarzycki
Date: Thu Mar 29 09:51:28 2018
New Revision: 328803
URL: http://llvm.org/viewvc/llvm-project?rev=328803&view=rev
Log:
[ADT] NFC: Fix bogus StringSwitch rule-of-five boilerplate
Now that 'Str' is constant, the rule-of-file logic needs updating.
Reported by: vit9696 at avp.su
Reviewed by: jordan_rose at apple.com
Modified:
llvm/trunk/include/llvm/ADT/StringSwitch.h
Modified: llvm/trunk/include/llvm/ADT/StringSwitch.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringSwitch.h?rev=328803&r1=328802&r2=328803&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringSwitch.h (original)
+++ llvm/trunk/include/llvm/ADT/StringSwitch.h Thu Mar 29 09:51:28 2018
@@ -55,16 +55,13 @@ public:
// StringSwitch is not copyable.
StringSwitch(const StringSwitch &) = delete;
+
+ // StringSwitch is not assignable due to 'Str' being 'const'.
void operator=(const StringSwitch &) = delete;
+ void operator=(StringSwitch &&other) = delete;
- StringSwitch(StringSwitch &&other) {
- *this = std::move(other);
- }
- StringSwitch &operator=(StringSwitch &&other) {
- Str = std::move(other.Str);
- Result = std::move(other.Result);
- return *this;
- }
+ StringSwitch(StringSwitch &&other)
+ : Str(other.Str), Result(std::move(other.Result)) { }
~StringSwitch() = default;
More information about the llvm-commits
mailing list