[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 25 13:07:22 UTC 2020


 compilerplugins/clang/stringviewparam.cxx |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit e4c841f7999538522e9453dde9a2d021df5cf149
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Nov 25 10:16:40 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Nov 25 14:06:35 2020 +0100

    Ignore unparsed function template bodies in loplugin:stringviewparam
    
    Otherwise, clang-cl would have reported a false positive at
    
    > In file included from C:/lo-clang/core/canvas/source/directx/dx_bitmapcanvashelper.cxx:36:
    > C:/lo-clang/core/include\canvas/canvastools.hxx(501,42): error: replace function parameter of type 'const rtl::OUString &' with 'std::u16string_view' [loplugin:stringviewparam]
    >             bool lookup( const OUString& rName,
    >                          ~~~~~~~~~~~~~~~~^~~~~
    
    Change-Id: Iee71ad721ebe891f51ad1dd6eba50162e40fd998
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106574
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/stringviewparam.cxx b/compilerplugins/clang/stringviewparam.cxx
index c359c1a9dc82..3056b6412930 100644
--- a/compilerplugins/clang/stringviewparam.cxx
+++ b/compilerplugins/clang/stringviewparam.cxx
@@ -454,6 +454,10 @@ private:
         {
             return false;
         }
+        if (decl->getBody() == nullptr) // unparsed template
+        {
+            return false;
+        }
         if (auto const d = dyn_cast<CXXMethodDecl>(decl))
         {
             if (d->isVirtual())


More information about the Libreoffice-commits mailing list