1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00
llvm-mirror/unittests
Roman Lebedev f69ee08c94 [unittests] ADT: silence -Wself-assign diagnostics
Summary:
D44883 extends -Wself-assign to also work on C++ classes.
In it's current state (as suggested by @rjmccall), it is not under it's own sub-group.
Since that diag is enabled by `-Wall`, stage2 testing showed that:
* It does not fire on any llvm code
* It does fire for these 3 unittests
* It does fire for libc++ tests

This diff simply silences those new warnings in llvm's unittests.
A similar diff will be needed for libcxx. (`libcxx/test/std/language.support/support.types/byteops/`, maybe something else)

Since i don't think we want to repeat rL322901, let's talk about it.
I've subscribed everyone who i think might be interested...

There are several ways forward:
* Not extend -Wself-assign, close D44883. Not very productive outcome i'd say.
* Keep D44883 in it's current state.
  Unless your custom overloaded operators do something unusual for when self-assigning,
  the warning is no less of a false-positive than the current -Wself-assign.
  Except for tests of course, there you'd want to silence it. The current suggestion is:
  ```
  S a;
  a = (S &)a;
  ```
* Split the diagnostic in two - `-Wself-assign-builtin` (i.e. what is `-Wself-assign` in trunk),
  and `-Wself-assign-overloaded` - the new part in D44883.
  Since, as i said, i'm not really sure why it would be less of a error than the current `-Wself-assign`,
  both would still be in `-Wall`. That way one could simply pass `-Wno-self-assign-overloaded` for all the tests.
  Pretty simple to do, and will surely work.
* Split the diagnostic in two - `-Wself-assign-trivial`, and `-Wself-assign-nontrivial`.
  The choice of which diag to emit would depend on trivial-ness of that particular operator.
  The current `-Wself-assign` would be `-Wself-assign-trivial`.
  https://godbolt.org/g/gwDASe - `A`, `B` and `C` case would be treated as trivial, and `D`, `E` and `F` as non-trivial.
  Will be the most complicated to implement.

Thoughts?

Reviewers: aaron.ballman, rsmith, rtrieu, rjmccall, dblaikie, atrick, gottesmm

Reviewed By: dblaikie

Subscribers: lebedev.ri, phosek, vsk, rnk, thakis, sammccall, mclow.lists, llvm-commits, rjmccall

Differential Revision: https://reviews.llvm.org/D45082

llvm-svn: 329491
2018-04-07 10:37:18 +00:00
..
ADT [unittests] ADT: silence -Wself-assign diagnostics 2018-04-07 10:37:18 +00:00
Analysis [unittests] Change std::sort to llvm::sort in response to r327219 2018-04-07 01:29:45 +00:00
AsmParser
BinaryFormat [dwarf] Unify unknown dwarf enum formatting code 2018-03-21 11:46:37 +00:00
Bitcode Pass a reference to a module to the bitcode writer. 2018-02-14 19:11:32 +00:00
CodeGen [IR][CodeGen] Remove dependency on EVT from IR/Function.cpp. Move EVT to CodeGen layer. 2018-03-29 17:21:10 +00:00
DebugInfo Style update. NFC. 2018-03-29 23:32:54 +00:00
ExecutionEngine [ORC] Create a new SymbolStringPool by default in ExecutionSession constructor. 2018-04-02 20:57:56 +00:00
FuzzMutate [FuzzMutate] Inst deleter doesn't work with PhiNodes 2018-01-25 09:22:18 +00:00
IR allow custom OptBisect classes set to LLVMContext 2018-04-05 10:29:37 +00:00
LineEditor
Linker Fix build for LLVM unittests 2017-09-15 21:12:13 +00:00
MC Move Object format code to lib/BinaryFormat. 2017-06-07 03:48:56 +00:00
MI [LiveIntervals] Handle moving up dead partial write 2018-02-26 14:42:13 +00:00
Object
ObjectYAML
Option [Option] For typo '-foo', suggest '--foo' 2018-01-09 19:38:04 +00:00
Passes Followup for r329293: Temporarily disable the breaking test on windows. 2018-04-06 13:39:16 +00:00
ProfileData [unittests] Change std::sort to llvm::sort in response to r327219 2018-04-07 01:29:45 +00:00
Support Fix stack-use-after-scope in test previously hidden by -fmerge-all-constants 2018-04-07 09:46:00 +00:00
Target Reapply "[GlobalISel] Remove the GISelAccessor API." 2017-08-15 22:31:51 +00:00
tools llvm-exegesis: Fix unittests include dirs when llvm is a part of another project 2018-04-05 18:16:02 +00:00
Transforms Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
XRay
CMakeLists.txt Re-land r329273: [Plugins] Add a slim plugin API to work together with the new PM 2018-04-05 15:04:13 +00:00