summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/test/stringconstant.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-04-30 09:26:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-04-30 09:28:40 +0200
commite02b9ccf58e9eda01f8588868ec2f367f7075dcf (patch)
treeb70be51bbafd7adb8515dbd4c89570dd60bbfc46 /compilerplugins/clang/test/stringconstant.cxx
parentcd08835d1bd9274412c7326db32fb3752bc94fb3 (diff)
revert part of "improve loplugin:stringconstant"
Revert part of commit dd8d5e5795358d732a9f7a8af7c35f662321e332 Date: Mon Apr 29 11:18:21 2019 +0200 improve loplugin:stringconstant sberg's original gerrit comment: but there can also be other problematic overloads for parameters like `void const *` or `std::string_view`. I'm not sure this change is worth the potential false positives. and continuing IRC discussion: <noelgrandin> I'll revert the compilerplugins/ part <sberg> noelgrandin, my main concern is that /if/ somebody eventually runs into such an overload situation, it's really hard to get the warnings/errors fixed for those people, short of going into the plugin itself Change-Id: I4916ce8943c4319d7ef9084e22d6a0eeb430b15c
Diffstat (limited to 'compilerplugins/clang/test/stringconstant.cxx')
-rw-r--r--compilerplugins/clang/test/stringconstant.cxx16
1 files changed, 2 insertions, 14 deletions
diff --git a/compilerplugins/clang/test/stringconstant.cxx b/compilerplugins/clang/test/stringconstant.cxx
index 1eda24580ab2..49ae3b68d035 100644
--- a/compilerplugins/clang/test/stringconstant.cxx
+++ b/compilerplugins/clang/test/stringconstant.cxx
@@ -17,7 +17,6 @@
extern void foo(OUString const &);
struct Foo {
- Foo(int, const OUString &) {}
Foo(OUString const &, int) {}
Foo(OUString const &) {}
void foo(OUString const &) const {}
@@ -29,11 +28,6 @@ struct Foo2 {
void foo(OString const &) const {}
};
-struct NegativeFoo {
- NegativeFoo(const OString&, const OString& ) {}
- NegativeFoo(const OString&, const OUString& ) {}
-};
-
int main() {
char const s1[] = "foo";
char const * const s2 = "foo";
@@ -73,15 +67,9 @@ int main() {
(void)aFoo;
Foo aFoo2(OUString("xxx")); // expected-error {{in call of 'Foo::Foo', replace 'OUString' constructed from a string literal directly with the string literal}}
aFoo2.foo(OUString("xxx")); // expected-error {{in call of 'Foo::foo', replace 'OUString' constructed from a string literal directly with the string literal}}
- Foo aFoo3(1, OUString("xxx")); // expected-error {{in call of 'Foo::Foo', replace 'OUString' constructed from a string literal directly with the string literal}}
- (void)aFoo3;
-
- Foo2 aFoo4(OString("xxx")); // expected-error {{in call of 'Foo2::Foo2', replace 'OUString' constructed from a string literal directly with the string literal}}
- aFoo4.foo(OString("xxx")); // expected-error {{in call of 'Foo2::foo', replace 'OUString' constructed from a string literal directly with the string literal}}
- // no warning expected
- NegativeFoo aNegativeFoo(OString("xxx"), OUString("1"));
- (void)aNegativeFoo;
+ Foo2 aFoo3(OString("xxx")); // expected-error {{in call of 'Foo2::Foo2', replace 'OUString' constructed from a string literal directly with the string literal}}
+ aFoo3.foo(OString("xxx")); // expected-error {{in call of 'Foo2::foo', replace 'OUString' constructed from a string literal directly with the string literal}}
(void) OUString("xxx", 3, RTL_TEXTENCODING_ASCII_US); // expected-error {{simplify construction of 'OUString' with string constant argument [loplugin:stringconstant]}}
(void) OUString("xxx", 3, RTL_TEXTENCODING_ISO_8859_1); // expected-error {{suspicious 'rtl::OUString' constructor with text encoding 12 but plain ASCII content; use 'RTL_TEXTENCODING_ASCII_US' instead [loplugin:stringconstant]}}