summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-10-27 10:15:59 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-10-27 10:31:42 +0200
commit8136a87d9af2cb6b7aecc6cf450d13904e155de8 (patch)
tree6b24c3e72460a95763a947775d221bbc99439d44 /compilerplugins
parent8a39134d5c177ea9735424a8e9f40bfd8986a1c6 (diff)
loplugin:constantparam was not always using canonical location for function
Change-Id: I8a15da534ba2cf9968cba0ee1f1bb74d7e3a0d54
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/constantparam.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/compilerplugins/clang/constantparam.cxx b/compilerplugins/clang/constantparam.cxx
index 376d9df9731d..426e86995040 100644
--- a/compilerplugins/clang/constantparam.cxx
+++ b/compilerplugins/clang/constantparam.cxx
@@ -236,9 +236,8 @@ bool ConstantParam::VisitCallExpr(const CallExpr * callExpr) {
else {
functionDecl = callExpr->getDirectCallee();
}
- if (functionDecl == nullptr) {
+ if (!functionDecl)
return true;
- }
functionDecl = functionDecl->getCanonicalDecl();
// method overrides don't always specify the same default params (although they probably should)
// so we need to work our way up to the root method
@@ -282,10 +281,10 @@ bool ConstantParam::VisitCallExpr(const CallExpr * callExpr) {
bool ConstantParam::VisitDeclRefExpr( const DeclRefExpr* declRefExpr )
{
const Decl* decl = declRefExpr->getDecl();
- if (!isa<FunctionDecl>(decl)) {
- return true;
- }
const FunctionDecl* functionDecl = dyn_cast<FunctionDecl>(decl);
+ if (!functionDecl)
+ return true;
+ functionDecl = functionDecl->getCanonicalDecl();
for (unsigned i = 0; i < functionDecl->getNumParams(); ++i)
{
addToCallSet(functionDecl, i, functionDecl->getParamDecl(i)->getName(), "unknown3");