Kaydet (Commit) 8136a87d authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:constantparam was not always using canonical location for function

Change-Id: I8a15da534ba2cf9968cba0ee1f1bb74d7e3a0d54
üst 8a39134d
......@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment