Kaydet (Commit) 5670f65c authored tarafından Stephan Bergmann's avatar Stephan Bergmann

-Werror=unused-function

Change-Id: I2858c6cb74b96ffe6a799dc2ab02cbbe1c56abc7
üst bb72ef2a
......@@ -186,73 +186,6 @@ bool Plugin::isInUnoIncludeFile(const FunctionDecl* functionDecl) const
functionDecl->getCanonicalDecl()->getNameInfo().getLoc()));
}
namespace
{
class ParentBuilder
: public RecursiveASTVisitor< ParentBuilder >
{
public:
bool VisitFunctionDecl( const FunctionDecl* function );
bool VisitObjCMethodDecl( const ObjCMethodDecl* method );
void walk( const Stmt* stmt );
bool shouldVisitTemplateInstantiations () const { return true; }
std::unordered_map< const Stmt*, const Stmt* >* parents;
};
bool ParentBuilder::VisitFunctionDecl( const FunctionDecl* function )
{
// if( ignoreLocation( declaration ))
// return true; ???
if( function->doesThisDeclarationHaveABody()
&& !function->isLateTemplateParsed())
{
const Stmt* body = function->getBody();
(*parents)[ body ] = NULL; // no parent
walk( body );
}
if( const CXXConstructorDecl* ctor = dyn_cast< CXXConstructorDecl >( function ))
{
for( CXXConstructorDecl::init_const_iterator it = ctor->init_begin();
it != ctor->init_end();
++it )
{
const Expr* init_expression = (*it)->getInit();
(*parents)[ init_expression ] = NULL;
walk( init_expression );
}
}
return true;
}
bool ParentBuilder::VisitObjCMethodDecl( const ObjCMethodDecl* method )
{
// if( ignoreLocation( declaration ))
// return true; ???
if( method->hasBody())
{
const Stmt* body = method->getBody();
(*parents)[ body ] = NULL; // no parent
walk( body );
}
return true;
}
void ParentBuilder::walk( const Stmt* stmt )
{
for( ConstStmtIterator it = stmt->child_begin();
it != stmt->child_end();
++it )
{
if( *it != NULL )
{
(*parents)[ *it ] = stmt;
walk( *it );
}
}
}
} // namespace
SourceLocation Plugin::locationAfterToken( SourceLocation location )
{
return Lexer::getLocForEndOfToken( location, 0, compiler.getSourceManager(), compiler.getLangOpts());
......
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