[Libreoffice-commits] core.git: compilerplugins/clang

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jul 26 06:46:15 UTC 2018


 compilerplugins/clang/staticaccess.cxx |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

New commits:
commit 07ad18ed6d90773a1e8120057929fa3a1dff2665
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Jul 25 18:41:58 2018 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Jul 26 08:45:51 2018 +0200

    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 at redhat.com>

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"


More information about the Libreoffice-commits mailing list