summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/test')
-rw-r--r--compilerplugins/clang/test/ostr.cxx40
-rw-r--r--compilerplugins/clang/test/stringconstant.cxx2
-rw-r--r--compilerplugins/clang/test/stringliteralvar.cxx6
-rw-r--r--compilerplugins/clang/test/stringstatic.cxx7
-rw-r--r--compilerplugins/clang/test/stringview.cxx2
5 files changed, 4 insertions, 53 deletions
diff --git a/compilerplugins/clang/test/ostr.cxx b/compilerplugins/clang/test/ostr.cxx
index 8f705a8f7215..6a09728f3ff6 100644
--- a/compilerplugins/clang/test/ostr.cxx
+++ b/compilerplugins/clang/test/ostr.cxx
@@ -49,50 +49,10 @@ void f()
// expected-error-re@+1 {{use a _ustr user-defined string literal instead of constructing an instance of '{{(rtl::)?}}OUString' from an ordinary string literal [loplugin:ostr]}}
f((("foo")));
- // expected-error-re@+1 {{use a _ustr user-defined string literal instead of constructing an instance of '{{(rtl::)?}}OUString' from a UTF-16 string literal [loplugin:ostr]}}
- OUString s5 = u"foo";
- (void)s5;
- // expected-error-re@+1 {{use a _ustr user-defined string literal instead of constructing an instance of '{{(rtl::)?}}OUString' from a UTF-16 string literal [loplugin:ostr]}}
- OUString s6 = ((u"foo"));
- (void)s6;
- // expected-error-re@+1 {{use a _ustr user-defined string literal instead of constructing an instance of '{{(rtl::)?}}OUString' from a UTF-16 string literal [loplugin:ostr]}}
- OUString s7(u"foo");
- (void)s7;
- // expected-error-re@+1 {{use a _ustr user-defined string literal instead of constructing an instance of '{{(rtl::)?}}OUString' from a UTF-16 string literal [loplugin:ostr]}}
- OUString s8(((u"foo")));
- (void)s8;
- // expected-error-re@+1 {{use a _ustr user-defined string literal instead of constructing an instance of '{{(rtl::)?}}OUString' from a UTF-16 string literal [loplugin:ostr]}}
- f(OUString(u"foo"));
- // expected-error-re@+1 {{use a _ustr user-defined string literal instead of constructing an instance of '{{(rtl::)?}}OUString' from a UTF-16 string literal [loplugin:ostr]}}
- f(((OUString(((u"foo"))))));
- // expected-error-re@+1 {{use a _ustr user-defined string literal instead of constructing an instance of '{{(rtl::)?}}OUString' from a UTF-16 string literal [loplugin:ostr]}}
- f(OUString(u"foo", rtl::libreoffice_internal::Dummy()));
- // expected-error-re@+1 {{use a _ustr user-defined string literal instead of constructing an instance of '{{(rtl::)?}}OUString' from a UTF-16 string literal [loplugin:ostr]}}
- f(((OUString(((u"foo")), rtl::libreoffice_internal::Dummy()))));
- // expected-error-re@+1 {{use a _ustr user-defined string literal instead of constructing an instance of '{{(rtl::)?}}OUString' from a UTF-16 string literal [loplugin:ostr]}}
- f(u"foo");
- // expected-error-re@+1 {{use a _ustr user-defined string literal instead of constructing an instance of '{{(rtl::)?}}OUString' from a UTF-16 string literal [loplugin:ostr]}}
- f(((u"foo")));
-
- OUString s9;
- // expected-error@+1 {{use a _ustr user-defined string literal instead of assigning from a UTF-16 string literal [loplugin:ostr]}}
- s9 = u"foo";
- // expected-error@+1 {{use a _ustr user-defined string literal instead of assigning from a UTF-16 string literal [loplugin:ostr]}}
- s9 = ((u"foo"));
- // expected-error@+1 {{use a _ustr user-defined string literal instead of assigning from a UTF-16 string literal [loplugin:ostr]}}
- s9.operator=(u"foo");
- // expected-error@+1 {{use a _ustr user-defined string literal instead of assigning from a UTF-16 string literal [loplugin:ostr]}}
- s9.operator=(((u"foo")));
-
- // expected-error-re@+1 {{use a _ustr user-defined string literal instead of constructing an instance of '{{(rtl::)?}}OUString' from a UTF-16 string literal [loplugin:ostr]}}
- S s10 = { u"foo" };
-
// Only generate one warning here, not two, for a macro argument used twice in the macro's
// expansion:
// expected-error-re@+1 {{use a _ustr user-defined string literal instead of constructing an instance of '{{(rtl::)?}}OUString' from an ordinary string literal [loplugin:ostr]}}
M("foo");
- // expected-error-re@+1 {{use a _ustr user-defined string literal instead of constructing an instance of '{{(rtl::)?}}OUString' from a UTF-16 string literal [loplugin:ostr]}}
- M(u"foo");
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/test/stringconstant.cxx b/compilerplugins/clang/test/stringconstant.cxx
index ada901b877ce..1c9fbf192f6d 100644
--- a/compilerplugins/clang/test/stringconstant.cxx
+++ b/compilerplugins/clang/test/stringconstant.cxx
@@ -139,8 +139,6 @@ int main() {
OUString().getStr();
// expected-error-re@+1 {{in call of 'rtl::OUString::getStr', replace '{{(rtl::)?}}OUString' constructed from a string literal directly with a UTF-16 string literal}}
OUString("foo").getStr();
- // expected-error-re@+1 {{in call of 'rtl::OUString::getStr', replace '{{(rtl::)?}}OUString' constructed from a string literal directly with the string literal}}
- OUString(u"foo").getStr();
}
diff --git a/compilerplugins/clang/test/stringliteralvar.cxx b/compilerplugins/clang/test/stringliteralvar.cxx
index d0fdcedb0668..6ea7c184c644 100644
--- a/compilerplugins/clang/test/stringliteralvar.cxx
+++ b/compilerplugins/clang/test/stringliteralvar.cxx
@@ -39,15 +39,15 @@ struct S3
void f3()
{
// expected-note-re@+1 {{first passed into a '{{(rtl::)?}}OUString' constructor here [loplugin:stringliteralvar]}}
- f(S3::literal);
+ f(OUString(S3::literal, 3));
}
std::vector<OUString> f4()
{
// expected-error-re@+1 {{change type of variable 'literal' from constant character array ('const char16_t{{ ?}}[4]') to OUStringLiteral [loplugin:stringliteralvar]}}
static constexpr char16_t literal[] = u"foo";
- // expected-note@+1 {{first passed into a 'rtl::OUString' constructor here [loplugin:stringliteralvar]}}
- return { literal };
+ // expected-note-re@+1 {{first passed into a '{{(rtl::)?}}OUString' constructor here [loplugin:stringliteralvar]}}
+ return { OUString(literal, 3) };
}
void f5()
diff --git a/compilerplugins/clang/test/stringstatic.cxx b/compilerplugins/clang/test/stringstatic.cxx
index 20326101dc79..bfe92b69f598 100644
--- a/compilerplugins/clang/test/stringstatic.cxx
+++ b/compilerplugins/clang/test/stringstatic.cxx
@@ -28,10 +28,3 @@ void test2()
static const OUString DATA = "xxx";
f(DATA.pData);
}
-
-void test3()
-{
- // expected-error@+1 {{rather declare this using OUStringLiteral/OStringLiteral/char[] [loplugin:stringstatic]}}
- OUString const literal = u"foo";
- f(literal);
-}
diff --git a/compilerplugins/clang/test/stringview.cxx b/compilerplugins/clang/test/stringview.cxx
index b7284cd5ed57..a8df9dd6b179 100644
--- a/compilerplugins/clang/test/stringview.cxx
+++ b/compilerplugins/clang/test/stringview.cxx
@@ -173,7 +173,7 @@ void f5(char const* s1, sal_Int32 n1, char16_t const* s2, sal_Int32 n2, OString
// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed from a 'const char{{ ?}}[4]', pass a 'std::u16string_view' [loplugin:stringview]}}
call_view(OUString("foo"));
// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed from a 'const char16_t{{ ?}}[4]', pass a 'std::u16string_view' [loplugin:stringview]}}
- call_view(OUString(u"foo"));
+ call_view(OUString(u"foo", 3));
// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed from a 'const char', pass a 'std::u16string_view' (or an 'rtl::OUStringChar') [loplugin:stringview]}}
call_view(OUString(*s1));
// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed from a 'const char16_t', pass a 'std::u16string_view' (or an 'rtl::OUStringChar') [loplugin:stringview]}}