summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-09-14 12:44:14 +0200
committerStephan Bergmann <sbergman@redhat.com>2023-09-14 13:56:45 +0200
commiteb2e7483727c060b0aa735f401aaa89cc0505200 (patch)
treefbde76694015bc7c7a02ec9c7d75ea2b4cffcb29 /compilerplugins
parent2b9f5a7929910951a72372c8d56fcae605146477 (diff)
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 <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/plugin.cxx4
1 files changed, 4 insertions, 0 deletions
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