Kaydet (Commit) 9d8d2e07 authored tarafından Noel Grandin's avatar Noel Grandin

simplify inlineablemethods loplugin

Change-Id: I72750a14664aa042da232c35cca3373ce367cfb0
üst a8b2bfdc
...@@ -103,7 +103,6 @@ private: ...@@ -103,7 +103,6 @@ private:
std::string toString(SourceLocation loc); std::string toString(SourceLocation loc);
void functionTouchedFromExpr( const FunctionDecl* calleeFunctionDecl, const Expr* expr ); void functionTouchedFromExpr( const FunctionDecl* calleeFunctionDecl, const Expr* expr );
bool isCalleeFunctionInteresting( const FunctionDecl* ); bool isCalleeFunctionInteresting( const FunctionDecl* );
void logCalledFrom(SourceLocation calleeSite, const FunctionDecl* functionDecl);
// I use traverse and a member variable because I cannot find a reliable way of walking back up the AST tree using the parentStmt() stuff // I use traverse and a member variable because I cannot find a reliable way of walking back up the AST tree using the parentStmt() stuff
// TODO doesn't cope with nested functions // TODO doesn't cope with nested functions
...@@ -274,7 +273,7 @@ void InlineableMethods::functionTouchedFromExpr( const FunctionDecl* calleeFunct ...@@ -274,7 +273,7 @@ void InlineableMethods::functionTouchedFromExpr( const FunctionDecl* calleeFunct
return; return;
} }
logCalledFrom(expr->getLocStart(), canonicalFunctionDecl); calledFromMap.emplace(toString(expr->getLocStart()), niceName(canonicalFunctionDecl));
if (const UnaryOperator* unaryOp = dyn_cast_or_null<UnaryOperator>(parentStmt(expr))) { if (const UnaryOperator* unaryOp = dyn_cast_or_null<UnaryOperator>(parentStmt(expr))) {
if (unaryOp->getOpcode() == UO_AddrOf) { if (unaryOp->getOpcode() == UO_AddrOf) {
...@@ -291,14 +290,6 @@ void InlineableMethods::functionTouchedFromExpr( const FunctionDecl* calleeFunct ...@@ -291,14 +290,6 @@ void InlineableMethods::functionTouchedFromExpr( const FunctionDecl* calleeFunct
} }
} }
void InlineableMethods::logCalledFrom(SourceLocation calleeLoc, const FunctionDecl* functionDecl)
{
functionDecl = functionDecl->getCanonicalDecl();
while (functionDecl->getTemplateInstantiationPattern())
functionDecl = functionDecl->getTemplateInstantiationPattern();
calledFromMap.emplace(toString(calleeLoc), niceName(functionDecl));
}
bool InlineableMethods::isCalleeFunctionInteresting(const FunctionDecl* functionDecl) bool InlineableMethods::isCalleeFunctionInteresting(const FunctionDecl* functionDecl)
{ {
// ignore stuff that forms part of the stable URE interface // ignore stuff that forms part of the stable URE interface
......
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