/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef LO_CLANG_SHARED_PLUGINS #include #include #include "plugin.hxx" #include "check.hxx" /* Find overridden methods that : (a) declare default params in different places to their super-method(s) Still TODO (b) Find places where the values of the default parameters are different (c) Find places where the names of the parameters differ */ namespace { class OverrideParam: public loplugin::FilteringPlugin { public: explicit OverrideParam(loplugin::InstantiationData const & data): FilteringPlugin(data) {} virtual void run() override; bool VisitCXXMethodDecl(const CXXMethodDecl *); private: bool hasSameDefaultParams(const ParmVarDecl * parmVarDecl, const ParmVarDecl * superParmVarDecl); }; void OverrideParam::run() { if (preRun()) TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); } bool OverrideParam::VisitCXXMethodDecl(const CXXMethodDecl * methodDecl) { if (ignoreLocation(methodDecl)) { return true; } if (methodDecl->isThisDeclarationADefinition() || methodDecl->size_overridden_methods() == 0) { return true; } loplugin::DeclCheck dc(methodDecl); // This class is overriding ShowCursor(bool) AND declaring a ShowCursor() method. // Adding a default param causes 'ambiguous override'. if (dc.Function("ShowCursor").Class("ScTabViewShell").GlobalNamespace()) { return true; } for(auto superMethodIt = methodDecl->begin_overridden_methods(); superMethodIt != methodDecl->end_overridden_methods(); ++superMethodIt) { const CXXMethodDecl * superMethodDecl = *superMethodIt; if (ignoreLocation(superMethodDecl)) { continue; } int i = 0; for (const ParmVarDecl *superParmVarDecl : superMethodDecl->parameters()) { const ParmVarDecl *parmVarDecl = methodDecl->getParamDecl(i); if (parmVarDecl->hasDefaultArg() && !superParmVarDecl->hasDefaultArg()) { report( DiagnosticsEngine::Warning, "overridden method declaration has default arg, but super-method does not", parmVarDecl->getSourceRange().getBegin()) << parmVarDecl->getSourceRange(); report( DiagnosticsEngine::Note, "original param here", superParmVarDecl->getSourceRange().getBegin()) << superParmVarDecl->getSourceRange(); } else if (!parmVarDecl->hasDefaultArg() && superParmVarDecl->hasDefaultArg()) { report( DiagnosticsEngine::Warning, "overridden method declaration has no default arg, but super-method does", parmVarDecl->getSourceRange().getBegin()) << parmVarDecl->getSourceRange(); report( DiagnosticsEngine::Note, "original param here", superParmVarDecl->getSourceRange().getBegin()) << superParmVarDecl->getSourceRange(); } else if (parmVarDecl->hasDefaultArg() && superParmVarDecl->hasDefaultArg() && !hasSameDefaultParams(parmVarDecl, superParmVarDecl)) { report( DiagnosticsEngine::Warning, "overridden method declaration has different default param to super-method", parmVarDecl->getSourceRange().getBegin()) << parmVarDecl->getSourceRange(); report( DiagnosticsEngine::Note, "original param here", superParmVarDecl->getSourceRange().getBegin()) << superParmVarDecl->getSourceRange(); } /* do nothing for now, will enable this in a later commit if (methodDecl->isThisDeclarationADefinition() && parmVarDecl->getName().empty()) { // ignore this - means the param is unused } else if (superParmVarDecl->getName().empty()) { // ignore, nothing reasonable I can do } else if (superParmVarDecl->getName() != parmVarDecl->getName()) { report( DiagnosticsEngine::Warning, "overridden method declaration uses different name for parameter", parmVarDecl->getSourceRange().getBegin()) << parmVarDecl->getSourceRange(); report( DiagnosticsEngine::Note, "original param here", superParmVarDecl->getSourceRange().getBegin()) << superParmVarDecl->getSourceRange(); }*/ ++i; } } return true; } bool OverrideParam::hasSameDefaultParams(const ParmVarDecl * parmVarDecl, const ParmVarDecl * superParmVarDecl) { // don't know what this means, but it prevents a clang crash if (parmVarDecl->hasUninstantiatedDefaultArg() || superParmVarDecl->hasUninstantiatedDefaultArg()) { return true; } return checkIdenticalDefaultArguments( parmVarDecl->getDefaultArg(), superParmVarDecl->getDefaultArg()) != IdenticalDefaultArgumentsResult::No; // for one, Clang 3.8 doesn't have EvaluateAsFloat; for another, since // // "PR23135: Don't instantiate constexpr functions referenced in // unevaluated operands where possible", default args are not // necessarily evaluated, so the above calls to EvaluateAsInt etc. may // fail (as they do e.g. for SfxViewShell::SetPrinter and derived // classes' 'SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL' arg, // include/sfx2/viewsh.hxx; what appears would help is to call // 'compiler.getSema().MarkDeclarationsReferencedInExpr()' on // defaultArgExpr and superDefaultArgExpr before any of the calls to // EvaluateAsInt etc., cf. the implementation of // Sema::CheckCXXDefaultArgExpr in Clang's lib/Sema/SemaExpr.cpp, but // that would probably have unwanted side-effects) } loplugin::Plugin::Registration< OverrideParam > overrideparam("overrideparam"); } // namespace #endif // LO_CLANG_SHARED_PLUGINS /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +backports'>distro/lhm/libreoffice-7-4+backports LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-02-22Karasa Jaga: tdf#133038 change some formatting icons for CatalanRizal Muttaqin
Change-Id: I4146e0afbc7bd1aa95d2029a0618e02b168b33ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111304 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <riz_17_oke@yahoo.co.id>
tdf#153465 & tdf#153344 Sukapura Dark with 16px status bar iconsRizal Muttaqin
Change-Id: If255495c43f4606b7931b86901449453189e9994 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148551 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <rizmut@libreoffice.org>
2023-03-05tdf#153465 Simplify Sukapura's light variant to make easier forRizal Muttaqin
generating dark variant Change-Id: I7d4d961b970be3ccdc261505b5ad4ab7ae982a6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148017 Tested-by: Rizal Muttaqin <rizmut@libreoffice.org> Reviewed-by: Rizal Muttaqin <rizmut@libreoffice.org>
2023-02-28tdf#153848 Update Sukapura icons in Start Center to match new brandingRizal Muttaqin
Change-Id: I6be2739b551f1dd26265a26d4476658e5a85b3cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147965 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <rizmut@libreoffice.org>
2023-02-28Sukapura: Add initial preparation for dark mode supportRizal Muttaqin
Change-Id: Ida7c68864c0ecb3bbd00cb6b87e4657b29447ec0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147870 Tested-by: Rizal Muttaqin <rizmut@libreoffice.org> Reviewed-by: Rizal Muttaqin <rizmut@libreoffice.org>
2022-10-11tdf#151016 Fix paint hamburger icons in Start Center (Sukapura)Rizal Muttaqin
Change-Id: Ibe49b50f23a560ad2635d835d4e204a5efd06439 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141209 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <rizmut@libreoffice.org>
2020-08-13Sukapura: Update MIME types and document folder iconsRizal Muttaqin
Change-Id: If55b75c4af523e2cd1440d0546e7ae38d578af93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100634 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <riz_17_oke@yahoo.co.id>
2020-07-18Update folder to match macOS Big Sur design updateRizal Muttaqin
- Update template and save related icons - Update Impress object place holder - Update Impress Presenter View/Console UI Change-Id: Ia4f23b5aee581c96e315e1a2117b3714b46c43a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98983 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <riz_17_oke@yahoo.co.id>
2020-06-07All icons: Update MIME typeRizal Muttaqin
Change-Id: I961f5dc02d51049f3d88411541d85c02be7e1a60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95662 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <riz_17_oke@yahoo.co.id>
2020-06-06tdf#128743 remove completely Start Center's sidebar motifRizal Muttaqin
Change-Id: Ib4e7f9ea30e67787ea199629a863e8085dd5cc94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95648 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <riz_17_oke@yahoo.co.id>
2020-05-14Sukapura:tdf#133008 File actions icons in Start Center have no enough contrastRizal Muttaqin
Change-Id: I13aef4afdebdc97fe41aeee839903f48c274818a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94164 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <riz_17_oke@yahoo.co.id>
2020-05-13tdf#130778 remove old 6.x centered logo in the Star CenterRizal Muttaqin
Change-Id: I8bf2ac1344249042e8846c22abc1346c7d08d538 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94066 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <riz_17_oke@yahoo.co.id>
2020-04-21Sukapura: Update indentation iconsRizal Muttaqin
Change-Id: I9d676e6b554e96b0422c1b0e7c9e59087db5482b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92604 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <riz_17_oke@yahoo.co.id>
2020-04-20Sukapura: Fix for tdf#128689 Add more Korean iconsRizal Muttaqin
Change-Id: I084be3cfefe3b7fb6a113b162bdce39915f734bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92563 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <riz_17_oke@yahoo.co.id>
2020-04-15Related tdf#130778: New About dialogHeiko Tietze
More flexible dialog logo & about images as SVGs Change-Id: Icefa035893e241a7dee6aa28236e6b89b38477de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91908 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2020-03-31Sukapura: Update gallery folder icons, DB Query & Table iconsRizal Muttaqin
Change-Id: I991bbe9ea6780d6114f75fb5484af43be53b3a8f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91384 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <riz_17_oke@yahoo.co.id>
2020-03-21Sukapura: Fix for tdf#131454: Wrong icons for Valid SignatureRizal Muttaqin
Change-Id: Icde23ff3bd0002be401e612673e6ee3d85066b0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90853 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <riz_17_oke@yahoo.co.id>
2020-03-11Sukapura: Add shadow to icons, add many more icons:rizmut
- QR code, Apply Style, Zoom 200% - Delete wrong placed SVG icons in PNG dir - Update Index Entry, Show Formatting, Toggle Extrusion, DB Sorting & Grouping - Update/add slide related icons - etc Change-Id: I29a05e1b39cee5972299f21d083021cb1ef54b62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90342 Tested-by: Jenkins Reviewed-by: Rizal Muttaqin <riz_17_oke@yahoo.co.id>
2020-02-26Resolves tdf#130500 - Sukapura icon themeHeiko Tietze
Added to core and made default on macOS Change-Id: I1c1e8caab514198717cf6cd7e8c00a1c1d5c15da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89183 Tested-by: Jenkins Tested-by: Rizal Muttaqin <riz_17_oke@yahoo.co.id> Reviewed-by: Rizal Muttaqin <riz_17_oke@yahoo.co.id> Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>