compilerplugins/clang/unusedvariablecheck.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
New commits: commit ec4daaea9012077246d4b935001848a8ab94f164 Author: Stephan Bergmann <[email protected]> AuthorDate: Mon Dec 7 08:53:15 2020 +0100 Commit: Stephan Bergmann <[email protected]> CommitDate: Mon Dec 7 10:20:25 2020 +0100 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 <[email protected]> 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(); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
