summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2013-07-02 14:00:01 +0200
committerLuboš Luňák <l.lunak@suse.cz>2013-08-05 15:10:40 +0200
commitc352f340c26fad1550bfe76adc49ed14742ec9ce (patch)
tree9bb6b458c6e5b63901b051440b38f25d6309b76b
parent015d9327354bdd6a7495285eb35105c08e536a45 (diff)
note about getDirectCallee() vs getCallee()
Change-Id: I0a4cfd0ddb0c03b0db95d003004195df29a3f6df
-rw-r--r--compilerplugins/clang/store/changefunctioncalls.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/compilerplugins/clang/store/changefunctioncalls.cxx b/compilerplugins/clang/store/changefunctioncalls.cxx
index 2d0ae91e702c..8d79d622056b 100644
--- a/compilerplugins/clang/store/changefunctioncalls.cxx
+++ b/compilerplugins/clang/store/changefunctioncalls.cxx
@@ -21,6 +21,7 @@ complex expression, operator precedence may mean the result is actually differen
This can be easily adjusted for different modifications to a function:
- replace CallExpr with CXXOperatorCallExpr or CXXMemberCallExpr
- check different names or arguments
+- change getDirectCallee() to getCallee()
- etc.
*/
@@ -53,6 +54,10 @@ bool ChangeFunctionCalls::VisitCallExpr( const CallExpr* call )
{
if( ignoreLocation( call ))
return true;
+ // 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())
{
// Optimize, getQualifiedNameAsString() is reportedly expensive,