[PATCH] D24424: Delete dead code in PBQP (NFC)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 12 14:04:35 PDT 2016
dblaikie added a subscriber: dblaikie.
================
Comment at: include/llvm/CodeGen/PBQP/Math.h:65-85
@@ -64,23 +64,2 @@
- /// \brief Copy-assignment operator.
- Vector& operator=(const Vector &V) {
- // llvm::dbgs() << "Assigning to PBQP::Vector " << this
- // << " from PBQP::Vector " << &V << "\n";
- delete[] Data;
- Length = V.Length;
- Data = new PBQPNum[Length];
- std::copy(V.Data, V.Data + Length, Data);
- return *this;
- }
-
- /// \brief Move-assignment operator.
- Vector& operator=(Vector &&V) {
- delete[] Data;
- Length = V.Length;
- Data = V.Data;
- V.Length = 0;
- V.Data = nullptr;
- return *this;
- }
-
/// \brief Comparison operator.
----------------
Looks like this (& other parts of this class) could be simplified by making it use unique_ptr<PBQPNum[]> for Data. There's still be some explicit code for the assignment operator (I'd suggest the copy-and-swap idiom) and while this code might not be used right now, it's probably generically useful enough (& once the change is made, simple enough) to keep around, but might deserve a unit test or two if it doesn't have any.
(same goes for similar Matrix changes - and probably for the various operator overloads too (eg: they're probably of sufficient general utility, but should have unit tests))
But I leave the final decisions up to Lang.
https://reviews.llvm.org/D24424
More information about the llvm-commits
mailing list