bool ChangeFunctionCalls::VisitCallExpr( const CallExpr* call )
{ if( ignoreLocation( call )) returntrue; // Using getDirectCallee() here means that we find only calls // that call the function directly (i.e. not using a pointer, for example). // Use getCallee() to include also those : // if( const FunctionDecl* func = dyn_cast_or_null< FunctionDecl >( call->getCalleeDecl())) if( const FunctionDecl* func = call->getDirectCallee())
{ // so first check fast details like number of arguments or the (unqualified) // name before checking the fully qualified name. // See FunctionDecl for all the API about the function. if( func->getNumParams() == 1 && func->getIdentifier() != NULL
&& ( func->getName() == "bar" ))
{ auto qt = loplugin::DeclCheck(func); if( qt.Function("bar").GlobalNamespace() )
{ // Further checks about arguments. Check mainly ParmVarDecl, VarDecl, // ValueDecl and QualType for Clang API details.
string arg0 = func->getParamDecl( 0 )->getType().getAsString(); if( arg0 == "unsigned int" )
{
insertTextAfterToken( call->getArg( 0 )->getLocEnd(), " + 10" );
report( DiagnosticsEngine::Warning, "found", call->getLocStart());
}
}
}
} returntrue;
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.8Bemerkung:
(vorverarbeitet am 2026-09-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.