[PATCH] D24424: Delete dead code in PBQP (NFC)
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 10 18:21:51 PDT 2016
vsk added a comment.
@lhames ping?
================
Comment at: include/llvm/CodeGen/PBQP/Math.h:65-85
- /// \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];
----------------
dblaikie wrote:
> 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.
>
Thanks for the note, using a unique_ptr for Data sounds like a good idea.
https://reviews.llvm.org/D24424
More information about the llvm-commits
mailing list