From 07ad18ed6d90773a1e8120057929fa3a1dff2665 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 25 Jul 2018 18:41:58 +0200 Subject: Silence loplugin:staticaccess in Windows ATL macros (clang-cl) Change-Id: I18cde30e132b8209d189e9438b49a1c3e5a36672 Reviewed-on: https://gerrit.libreoffice.org/57997 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- compilerplugins/clang/staticaccess.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/compilerplugins/clang/staticaccess.cxx b/compilerplugins/clang/staticaccess.cxx index dd8e3b4c5dec..3fce436a80d5 100644 --- a/compilerplugins/clang/staticaccess.cxx +++ b/compilerplugins/clang/staticaccess.cxx @@ -64,6 +64,22 @@ bool StaticAccess::VisitMemberExpr(MemberExpr const * expr) { if (!isStatic(decl, &me)) { return true; } + auto const loc = expr->getExprLoc(); + if (compiler.getSourceManager().isMacroBodyExpansion(loc)) { + auto const name = Lexer::getImmediateMacroName( + loc, compiler.getSourceManager(), compiler.getLangOpts()); + if (name == "BEGIN_COM_MAP" || name == "DEFAULT_REFLECTION_HANDLER") { + // .../VC/Tools/MSVC/14.14.26428/atlmfc/include\atlcom.h(2226,10): note: expanded from + // macro 'BEGIN_COM_MAP' + // return this->InternalQueryInterface(this, _GetEntries(), iid, ppvObject); + // ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // .../VC/Tools/MSVC/14.14.26428/atlmfc/include\atlwin.h(2890,5): note: expanded from + // macro 'DEFAULT_REFLECTION_HANDLER' + // if(this->DefaultReflectionHandler(hWnd, uMsg, wParam, lParam, lResult)) + // ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + return true; + } + } report( DiagnosticsEngine::Warning, ("accessing %select{static class member|member enumerator}0 through" -- cgit