[PATCH] D45082: [RFC][unittests] ADT: silence -Wself-assign diagnostics

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 30 13:30:53 PDT 2018


dblaikie added a subscriber: lebedev.ri.
dblaikie added a comment.

Comment might need to be reworded, but might not even need a comment - if
we build with the warning on by default anyone who attempts to remove it
will find out...

& maybe "x = *&x" might be a shorter way to subvert the warning? Not sure
if it's any better.

Alternatively, perhaps a function:

template<typename T>
const T&launder(const T& x) { return x; }

& write a comment on that function explaining why that function exists - to
thwart the -Wself-assign warning.

& then test with: x = launder(x);

or the like...


Repository:
  rL LLVM

https://reviews.llvm.org/D45082





More information about the llvm-commits mailing list