-Werror=unused-function
Change-Id: I2858c6cb74b96ffe6a799dc2ab02cbbe1c56abc7
This commit is contained in:
@@ -186,73 +186,6 @@ bool Plugin::isInUnoIncludeFile(const FunctionDecl* functionDecl) const
|
|||||||
functionDecl->getCanonicalDecl()->getNameInfo().getLoc()));
|
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 )
|
SourceLocation Plugin::locationAfterToken( SourceLocation location )
|
||||||
{
|
{
|
||||||
return Lexer::getLocForEndOfToken( location, 0, compiler.getSourceManager(), compiler.getLangOpts());
|
return Lexer::getLocForEndOfToken( location, 0, compiler.getSourceManager(), compiler.getLangOpts());
|
||||||
|
Reference in New Issue
Block a user