[Libreoffice-commits] core.git: compilerplugins/clang
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Mon Dec 7 09:21:09 UTC 2020
compilerplugins/clang/unusedvariablecheck.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit ec4daaea9012077246d4b935001848a8ab94f164
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Dec 7 08:53:15 2020 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
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 <sbergman at redhat.com>
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();
More information about the Libreoffice-commits
mailing list