summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-08-05 09:58:34 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-08-05 11:30:20 +0200
commit2e12d210cac8d031c21cdda9c37c1551f967ddc4 (patch)
treefc65a051484b7eab2ad5132f18aa88187206cefa /compilerplugins
parented3ccdbde9ace7d2e3d67a9cc83a189cfaf1cad9 (diff)
Silence loplugin:staticmethods when the definition involves preprocessing
...to help avoid false positives. (Another option to silence such warnings is to add (void) this; to false-positive function bodies, but this new approach may be more natural in certain cases.) Change-Id: Ie6ea908730c596dbfb62ff42ae60dbd0a00a8fc9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100152 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/staticmethods.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/compilerplugins/clang/staticmethods.cxx b/compilerplugins/clang/staticmethods.cxx
index 9b631c7eb659..86206022496f 100644
--- a/compilerplugins/clang/staticmethods.cxx
+++ b/compilerplugins/clang/staticmethods.cxx
@@ -218,6 +218,10 @@ bool StaticMethods::TraverseCXXMethodDecl(const CXXMethodDecl * pCXXMethodDecl)
return true;
}
+ if (containsPreprocessingConditionalInclusion((pCXXMethodDecl->getSourceRange()))) {
+ return true;
+ }
+
report(
DiagnosticsEngine::Warning,
"this member function can be declared static",