summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-07-25 18:41:58 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-07-26 08:45:51 +0200
commit07ad18ed6d90773a1e8120057929fa3a1dff2665 (patch)
tree64e3d9642070a305ca642eacc1c0a2a0d3b98c14 /compilerplugins
parentebdb7b7c92a84bc8be1159648b86c5202e315ae8 (diff)
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 <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/staticaccess.cxx16
1 files changed, 16 insertions, 0 deletions
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"