diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-12-07 08:53:15 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-12-07 10:20:25 +0100 |
commit | ec4daaea9012077246d4b935001848a8ab94f164 (patch) | |
tree | 2eab38d2f090e42ae521bc6720c89c906710dafe /compilerplugins | |
parent | 5080bb930de3ecfce8ab78bbd23a9d48c2f2bfa0 (diff) |
Ignore unparsed function template bodies in loplugin:unusedvariablecheck
Otherwise, clang-cl would have reported a false positive at
> In file included from C:/lo-clang/core/vcl/source/window/builder.cxx:74:
> C:/lo-clang/core/vcl/inc\jsdialog/jsdialogbuilder.hxx(176,26): error: unused parameter 'sTypeOfJSON' [loplugin:unusedvariablecheck]
> std::string sTypeOfJSON)
> ^
Change-Id: I14420cf6712a6a18e0d341a5b00e38dff5f6c92e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107330
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/unusedvariablecheck.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compilerplugins/clang/unusedvariablecheck.cxx b/compilerplugins/clang/unusedvariablecheck.cxx index 07e5fe0b2ace..10354192d6f3 100644 --- a/compilerplugins/clang/unusedvariablecheck.cxx +++ b/compilerplugins/clang/unusedvariablecheck.cxx @@ -76,7 +76,7 @@ bool UnusedVariableCheck::VisitVarDecl( const VarDecl* var ) // If this declaration does not have a body, then the parameter is indeed not used, // so ignore. if( const FunctionDecl* func = dyn_cast_or_null< FunctionDecl >( param->getParentFunctionOrMethod())) - if( !func->doesThisDeclarationHaveABody()) + if( !func->doesThisDeclarationHaveABody() || func->getBody() == nullptr) return true; report( DiagnosticsEngine::Warning, "unused parameter %0", var->getLocation()) << var->getDeclName(); |