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

Stephan Bergmann sbergman at redhat.com
Sat Dec 23 23:19:42 UTC 2017


 compilerplugins/clang/passstuffbyref.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit c926a1e34672afaa5b7de0e3b08b1537e88fbb6f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Dec 23 22:43:45 2017 +0100

    Fix compilerplugins/clang/test/passstuffbyref.cxx
    
    ...after 2a1fb4401da16f6a18c0bd05fe4b460a3048f9b5 "loplugin:passstuffbyref
    improved returns", where compiling as C++17 causes a false positive for
    S2::set1, whose return statement consists of
    
    > `-ReturnStmt 0x9ef8d78 <col:23, col:44>
    >   `-ExprWithCleanups 0x9ef8d60 <col:30, col:44> 'class rtl::OUString'
    >     `-CXXFunctionalCastExpr 0x9ef8d38 <col:30, col:44> 'class rtl::OUString' functional cast to class rtl::OUString <ConstructorConversion>
    >       `-CXXBindTemporaryExpr 0x9ef8d18 <col:30, col:44> 'class rtl::OUString' (CXXTemporary 0x9ef8d10)
    >         `-CXXConstructExpr 0x9ef8cd0 <col:30, col:44> 'class rtl::OUString' 'void (char const &[4], typename libreoffice_internal::ConstCharArrayDetector<char const[4], libreoffice_internal::Dummy>::Type)'
    >           |-StringLiteral 0x9ef7160 <col:39> 'const char [4]' lvalue "xxx"
    >           `-CXXDefaultArgExpr 0x9ef8cb0 <<invalid sloc>> 'libreoffice_internal::Dummy':'struct rtl::libreoffice_internal::Dummy'
    
    Change-Id: I7b9de7ce6b5604c7d686c8a4a7034019cd1d75c4
    Reviewed-on: https://gerrit.libreoffice.org/47029
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx
index 5901a587594e..98b75abac960 100644
--- a/compilerplugins/clang/passstuffbyref.cxx
+++ b/compilerplugins/clang/passstuffbyref.cxx
@@ -332,6 +332,9 @@ bool PassStuffByRef::isReturnExprDisqualified(const Expr* expr)
             else
                 return true;
         }
+        if (isa<CXXFunctionalCastExpr>(expr)) {
+            return true;
+        }
         if (isa<MaterializeTemporaryExpr>(expr)) {
             return true;
         }


More information about the Libreoffice-commits mailing list