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

New commits:
commit eb2e7483727c060b0aa735f401aaa89cc0505200
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Thu Sep 14 12:44:14 2023 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Thu Sep 14 13:56:45 2023 +0200

    Improve Plugin::checkIdenticalDefaultArguments
    
    ...to avoid
    
    > In file included from 
/home/sbergman/lo/core/cui/source/factory/cuiexp.cxx:20:
    > /home/sbergman/lo/core/cui/source/factory/dlgfact.hxx:524:116: fatal 
error: TODO: Unexpected 'IdenticalDefaultArgumentsResult::Maybe' 
[loplugin:overrideparam]
    >   524 |                                             const OUString& 
rName, const OUString& rDesc, const OUString& rTitle = "") override;
    >       |                                                                   
                                                 ^~
    > /home/sbergman/lo/core/include/svx/svxdlg.hxx:380:116: note: TODO: second 
argument is here [loplugin:overrideparam]
    >   380 |                                             const OUString& 
rName, const OUString& rDesc, const OUString& rTitle = "" ) = 0;
    >       |                                                                   
                                                 ^~
    > MaterializeTemporaryExpr 0x7f6fd76d4218 'const OUString':'const class 
rtl::OUString' lvalue
    > `-CXXBindTemporaryExpr 0x7f6fd76d41f8 'const OUString':'const class 
rtl::OUString' (CXXTemporary 0x7f6fd76d41f8)
    >   `-CXXConstructExpr 0x7f6fd76d41b8 'const OUString':'const class 
rtl::OUString' 'void (const char &[1], typename 
libreoffice_internal::ConstCharArrayDetector<const char[1], 
libreoffice_internal::Dummy>::Type)'
    >     |-StringLiteral 0x7f6fd76d3e48 'const char[1]' lvalue ""
    >     `-CXXDefaultArgExpr 0x7f6fd76d4170 
'libreoffice_internal::Dummy':'struct rtl::libreoffice_internal::Dummy'
    > MaterializeTemporaryExpr 0x7f6fe30b5f58 'const OUString':'const class 
rtl::OUString' lvalue
    > `-CXXBindTemporaryExpr 0x7f6fe30b5f38 'const OUString':'const class 
rtl::OUString' (CXXTemporary 0x7f6fe30b5f38)
    >   `-CXXConstructExpr 0x7f6fe30b5ef8 'const OUString':'const class 
rtl::OUString' 'void (const char &[1], typename 
libreoffice_internal::ConstCharArrayDetector<const char[1], 
libreoffice_internal::Dummy>::Type)'
    >     |-StringLiteral 0x7f6fe30b48f8 'const char[1]' lvalue ""
    >     `-CXXDefaultArgExpr 0x7f6fe30b5ea8 
'libreoffice_internal::Dummy':'struct rtl::libreoffice_internal::Dummy'
    
    after c7a608a6691c790783c63f504010bc796c36af25 "tdf#155503 Add title to 
document
    title dialog" in an --enable-compiler-plugins=debug build.
    
    (Instead of trying to inspect deeper into the code that compares two
    StringLiteral directly in Plugin::checkIdenticalDefaultArguments, it looked
    simpler to just extend structurallyIdentical.)
    
    Change-Id: Ie1eecff210413f0a29213d867aad249420c1c278
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156916
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index 94c5809ab730..e2d4d7fbf0a4 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -94,10 +94,14 @@ bool structurallyIdentical(Stmt const * stmt1, Stmt const * 
stmt2) {
         break;
     case Stmt::MaterializeTemporaryExprClass:
     case Stmt::CXXBindTemporaryExprClass:
+    case Stmt::CXXDefaultArgExprClass:
     case Stmt::ParenExprClass:
         break;
     case Stmt::CXXNullPtrLiteralExprClass:
         return true;
+    case Stmt::StringLiteralClass:
+        return cast<clang::StringLiteral>(stmt1)->getBytes()
+            == cast<clang::StringLiteral>(stmt2)->getBytes();
     default:
         // Conservatively assume non-identical for expressions that don't 
happen for us in practice
         // when compiling the LO code base (and for which the above set of 
supported classes would

Reply via email to