summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-10-12 12:59:31 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-10-12 13:10:55 +0200
commit9c0304f5a725ad0a58afecb96862ecd298ffec06 (patch)
treef359889010b4b4b0117f0f7b2890b238eb418a2f /compilerplugins
parent49ebf4f91d14af51bc3772c675de19b5891e3d36 (diff)
do not report unnamed parameters as unused
Change-Id: I0cc44354085fbee15aa94d23c29830fd40e8d939
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/unusedvariablecheck.cxx2
1 files changed, 2 insertions, 0 deletions
diff --git a/compilerplugins/clang/unusedvariablecheck.cxx b/compilerplugins/clang/unusedvariablecheck.cxx
index f2916320718d..65cac7573588 100644
--- a/compilerplugins/clang/unusedvariablecheck.cxx
+++ b/compilerplugins/clang/unusedvariablecheck.cxx
@@ -79,6 +79,8 @@ bool UnusedVariableCheck::VisitNamedDecl( NamedDecl* declaration )
{
if( const ParmVarDecl* param = dyn_cast< ParmVarDecl >( var ))
{
+ if( !param->getDeclName())
+ return true; // unnamed parameter -> unused
// If this declaration does not have a body, then the parameter is indeed not used,
// so ignore.
if( const FunctionDecl* func = dyn_cast< FunctionDecl >( param->getParentFunctionOrMethod()))