summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/test/simplifybool.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-11-22 13:13:09 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-11-23 10:03:16 +0100
commit52dbe0c99b58bf306004e3e7f7d0d98adb16193b (patch)
treeac8e72205c1b95417488f175b76df95c07fa80ae /compilerplugins/clang/test/simplifybool.cxx
parentb26012ef159bd420ac3bb9275607d3a1622422f7 (diff)
Make not warning about !! in loplugin:simplifybool consistent
...so that 640e03da110d76b2c7d5ed5b8b8ba3b4367865ba "loplugin:simplifybool re- activate the !! warning", which did not warn about !!( nAttribs & ucb::ContentInfoAttribute::KIND_FOLDER ) in ucb/source/core/ucbcmds.cxx (involving sal_Int32 and sal_Int16), would not have warned about !!(nMode & nUpdateMode) in sfx2/source/appl/workwin.cxx (ivolving o3tl::typed_flags<SfxVisibilityFlags>) either. Change-Id: Ibe955592951a04b1bd9a9b4e8cc502024bc1d460 Reviewed-on: https://gerrit.libreoffice.org/45083 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/test/simplifybool.cxx')
-rw-r--r--compilerplugins/clang/test/simplifybool.cxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/simplifybool.cxx b/compilerplugins/clang/test/simplifybool.cxx
index 383e513b25e2..e6b52c33f3b6 100644
--- a/compilerplugins/clang/test/simplifybool.cxx
+++ b/compilerplugins/clang/test/simplifybool.cxx
@@ -15,4 +15,36 @@ void f1(int a, int b)
}
};
+// Consitently either warn about all or none of the below occurrences of "!!":
+
+enum E1
+{
+ E1_1 = 1
+};
+
+enum E2
+{
+ E2_1 = 1
+};
+E2 operator&(E2 e1, E2 e2);
+bool operator!(E2 e);
+
+enum class E3
+{
+ E1 = 1
+};
+struct W
+{
+ operator bool();
+};
+W operator&(E3 e1, E3 e2);
+
+bool f0(int n) { return !!(n & 1); }
+
+bool f1(E1 e) { return !!(e & E1_1); }
+
+bool f2(E2 e) { return !!(e & E2_1); }
+
+bool f3(E3 e) { return !!(e & E3::E1); }
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */