summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/store
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-26 15:36:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-01 12:49:42 +0000
commit994e38e336beeacbd983faafac480afc94d3947e (patch)
treef6dd4fc3427d9051701637d2d052a9a51bb76c88 /compilerplugins/clang/store
parenteb6c18dfbeb7d2ad20ba7221d156969bd754faed (diff)
loplugin: use TypeCheck instead of getQualifiedNameAsString
since the latter is rather slow Change-Id: Ib73cdb923585580777c2265b561c1808e93b2baa Reviewed-on: https://gerrit.libreoffice.org/33585 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/store')
-rw-r--r--compilerplugins/clang/store/changefunctioncalls.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/compilerplugins/clang/store/changefunctioncalls.cxx b/compilerplugins/clang/store/changefunctioncalls.cxx
index abc8ce62ceba..a728ad5a310a 100644
--- a/compilerplugins/clang/store/changefunctioncalls.cxx
+++ b/compilerplugins/clang/store/changefunctioncalls.cxx
@@ -27,6 +27,7 @@ This can be easily adjusted for different modifications to a function:
*/
#include "plugin.hxx"
+#include "check.hxx"
namespace loplugin
{
@@ -61,15 +62,14 @@ bool ChangeFunctionCalls::VisitCallExpr( const CallExpr* call )
// if( const FunctionDecl* func = dyn_cast_or_null< FunctionDecl >( call->getCalleeDecl()))
if( const FunctionDecl* func = call->getDirectCallee())
{
- // Optimize, getQualifiedNameAsString() is reportedly expensive,
// 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" ))
{
- string qualifiedName = func->getQualifiedNameAsString();
- if( qualifiedName == "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.