summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/APSInt.h
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-03-02 20:56:28 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-03-02 20:56:28 +0000
commit3efb8b2c0f95003acfb32b08c3ecc09dcdc9990f (patch)
tree33122279158cbbca9826970f06527acc8447ff51 /include/llvm/ADT/APSInt.h
parent833687be0e2c3f38086abcaf1b9fb46d972c97b0 (diff)
downloadllvm-3efb8b2c0f95003acfb32b08c3ecc09dcdc9990f.tar.gz
llvm-3efb8b2c0f95003acfb32b08c3ecc09dcdc9990f.tar.bz2
llvm-3efb8b2c0f95003acfb32b08c3ecc09dcdc9990f.tar.xz
Give APInt move semantics.
The interaction between defaulted operators and move elision isn't totally obvious, add a unit test so it doesn't break unintentionally. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202662 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/APSInt.h')
-rw-r--r--include/llvm/ADT/APSInt.h14
1 files changed, 4 insertions, 10 deletions
diff --git a/include/llvm/ADT/APSInt.h b/include/llvm/ADT/APSInt.h
index ad035a7c30..053defff52 100644
--- a/include/llvm/ADT/APSInt.h
+++ b/include/llvm/ADT/APSInt.h
@@ -30,18 +30,12 @@ public:
explicit APSInt(uint32_t BitWidth, bool isUnsigned = true)
: APInt(BitWidth, 0), IsUnsigned(isUnsigned) {}
- explicit APSInt(const APInt &I, bool isUnsigned = true)
- : APInt(I), IsUnsigned(isUnsigned) {}
+ explicit APSInt(APInt I, bool isUnsigned = true)
+ : APInt(std::move(I)), IsUnsigned(isUnsigned) {}
- APSInt &operator=(const APSInt &RHS) {
- APInt::operator=(RHS);
- IsUnsigned = RHS.IsUnsigned;
- return *this;
- }
-
- APSInt &operator=(const APInt &RHS) {
+ APSInt &operator=(APInt RHS) {
// Retain our current sign.
- APInt::operator=(RHS);
+ APInt::operator=(std::move(RHS));
return *this;
}