pass around CompilerInstance rather than ASTContext

It's possible to get the latter from the former, and the former
is useful for other things too (access to the preprocessor, for example).

Change-Id: I708d709129fd3a35bf7c63da4de09c2e696b382d
This commit is contained in:
Luboš Luňák
2013-03-21 16:42:10 +01:00
parent 9ab15ecc4f
commit 153a69cad2
15 changed files with 67 additions and 65 deletions

View File

@@ -28,14 +28,14 @@ For example:
Here either both statements should be inside {} or the second statement in indented wrong. Here either both statements should be inside {} or the second statement in indented wrong.
*/ */
BodyNotInBlock::BodyNotInBlock( ASTContext& context ) BodyNotInBlock::BodyNotInBlock( CompilerInstance& compiler )
: Plugin( context ) : Plugin( compiler )
{ {
} }
void BodyNotInBlock::run() void BodyNotInBlock::run()
{ {
TraverseDecl( context.getTranslationUnitDecl()); TraverseDecl( compiler.getASTContext().getTranslationUnitDecl());
} }
bool BodyNotInBlock::VisitFunctionDecl( FunctionDecl* declaration ) bool BodyNotInBlock::VisitFunctionDecl( FunctionDecl* declaration )
@@ -110,9 +110,9 @@ void BodyNotInBlock::checkBody( const Stmt* body, SourceLocation stmtLocation, c
if( it != parents[ parent_pos ]->child_end()) if( it != parents[ parent_pos ]->child_end())
{ {
bool invalid1, invalid2; bool invalid1, invalid2;
unsigned bodyColumn = context.getSourceManager() unsigned bodyColumn = compiler.getSourceManager()
.getPresumedColumnNumber( body->getLocStart(), &invalid1 ); .getPresumedColumnNumber( body->getLocStart(), &invalid1 );
unsigned nextStatementColumn = context.getSourceManager() unsigned nextStatementColumn = compiler.getSourceManager()
.getPresumedColumnNumber( (*it)->getLocStart(), &invalid2 ); .getPresumedColumnNumber( (*it)->getLocStart(), &invalid2 );
if( invalid1 || invalid2 ) if( invalid1 || invalid2 )
return; return;

View File

@@ -21,7 +21,7 @@ class BodyNotInBlock
, public Plugin , public Plugin
{ {
public: public:
explicit BodyNotInBlock( ASTContext& context ); explicit BodyNotInBlock( CompilerInstance& compiler );
virtual void run(); virtual void run();
bool VisitFunctionDecl( FunctionDecl* declaration ); bool VisitFunctionDecl( FunctionDecl* declaration );
private: private:

View File

@@ -21,9 +21,9 @@ class LiteralAlternative:
public RecursiveASTVisitor<LiteralAlternative>, public loplugin::Plugin public RecursiveASTVisitor<LiteralAlternative>, public loplugin::Plugin
{ {
public: public:
explicit LiteralAlternative(ASTContext & context): Plugin(context) {} explicit LiteralAlternative(CompilerInstance & compiler): Plugin(compiler) {}
virtual void run() { TraverseDecl(context.getTranslationUnitDecl()); } virtual void run() { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
bool VisitCallExpr(CallExpr * expr); bool VisitCallExpr(CallExpr * expr);
}; };
@@ -65,7 +65,7 @@ bool LiteralAlternative::VisitCallExpr(CallExpr * expr) {
// better to handle that at the level of non-expanded macros instead, // better to handle that at the level of non-expanded macros instead,
// but I have not found out how to do that yet anyway): // but I have not found out how to do that yet anyway):
APSInt res; APSInt res;
if (expr->getArg(1)->isIntegerConstantExpr(res, context)) { if (expr->getArg(1)->isIntegerConstantExpr(res, compiler.getASTContext())) {
Expr const * arg0 = expr->getArg(0)->IgnoreParenImpCasts(); Expr const * arg0 = expr->getArg(0)->IgnoreParenImpCasts();
StringLiteral const * lit = dyn_cast<StringLiteral>(arg0); StringLiteral const * lit = dyn_cast<StringLiteral>(arg0);
bool match = false; bool match = false;
@@ -82,7 +82,7 @@ bool LiteralAlternative::VisitCallExpr(CallExpr * expr) {
subs->getBase()->IgnoreParenImpCasts()); subs->getBase()->IgnoreParenImpCasts());
match = lit != nullptr match = lit != nullptr
&& subs->getIdx()->isIntegerConstantExpr( && subs->getIdx()->isIntegerConstantExpr(
res, context) res, compiler.getASTContext())
&& res == 0; && res == 0;
} }
} }

View File

@@ -20,20 +20,20 @@ Base classes for plugin actions.
namespace loplugin namespace loplugin
{ {
Plugin::Plugin( ASTContext& context ) Plugin::Plugin( CompilerInstance& compiler )
: context( context ) : compiler( compiler )
{ {
} }
DiagnosticBuilder Plugin::report( DiagnosticsEngine::Level level, StringRef message, SourceLocation loc ) DiagnosticBuilder Plugin::report( DiagnosticsEngine::Level level, StringRef message, SourceLocation loc )
{ {
return report( level, message, context, loc ); return report( level, message, compiler, loc );
} }
DiagnosticBuilder Plugin::report( DiagnosticsEngine::Level level, StringRef message, ASTContext& context, DiagnosticBuilder Plugin::report( DiagnosticsEngine::Level level, StringRef message, CompilerInstance& compiler,
SourceLocation loc ) SourceLocation loc )
{ {
DiagnosticsEngine& diag = context.getDiagnostics(); DiagnosticsEngine& diag = compiler.getDiagnostics();
#if 0 #if 0
// Do some mappings (e.g. for -Werror) that clang does not do for custom messages for some reason. // Do some mappings (e.g. for -Werror) that clang does not do for custom messages for some reason.
if( level == DiagnosticsEngine::Warning && diag.getWarningsAsErrors()) if( level == DiagnosticsEngine::Warning && diag.getWarningsAsErrors())
@@ -50,10 +50,10 @@ DiagnosticBuilder Plugin::report( DiagnosticsEngine::Level level, StringRef mess
bool Plugin::ignoreLocation( SourceLocation loc ) bool Plugin::ignoreLocation( SourceLocation loc )
{ {
SourceLocation expansionLoc = context.getSourceManager().getExpansionLoc( loc ); SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( loc );
if( context.getSourceManager().isInSystemHeader( expansionLoc )) if( compiler.getSourceManager().isInSystemHeader( expansionLoc ))
return true; return true;
const char* bufferName = context.getSourceManager().getPresumedLoc( expansionLoc ).getFilename(); const char* bufferName = compiler.getSourceManager().getPresumedLoc( expansionLoc ).getFilename();
if( bufferName == NULL ) if( bufferName == NULL )
return true; return true;
if( strncmp( bufferName, OUTDIR, strlen( OUTDIR )) == 0 if( strncmp( bufferName, OUTDIR, strlen( OUTDIR )) == 0
@@ -64,15 +64,15 @@ bool Plugin::ignoreLocation( SourceLocation loc )
return true; return true;
} }
void Plugin::registerPlugin( Plugin* (*create)( ASTContext&, Rewriter& ), const char* optionName, bool isRewriter ) void Plugin::registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter )
{ {
PluginHandler::registerPlugin( create, optionName, isRewriter ); PluginHandler::registerPlugin( create, optionName, isRewriter );
} }
///// /////
RewritePlugin::RewritePlugin( ASTContext& context, Rewriter& rewriter ) RewritePlugin::RewritePlugin( CompilerInstance& compiler, Rewriter& rewriter )
: Plugin( context ) : Plugin( compiler )
, rewriter( rewriter ) , rewriter( rewriter )
{ {
} }

View File

@@ -17,6 +17,7 @@
#include <clang/AST/RecursiveASTVisitor.h> #include <clang/AST/RecursiveASTVisitor.h>
#include <clang/Basic/FileManager.h> #include <clang/Basic/FileManager.h>
#include <clang/Basic/SourceManager.h> #include <clang/Basic/SourceManager.h>
#include <clang/Frontend/CompilerInstance.h>
#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2 #if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
#include <clang/Rewrite/Rewriter.h> #include <clang/Rewrite/Rewriter.h>
@@ -40,21 +41,21 @@ namespace loplugin
class Plugin class Plugin
{ {
public: public:
explicit Plugin( ASTContext& context ); explicit Plugin( CompilerInstance& compiler );
virtual ~Plugin(); virtual ~Plugin();
virtual void run() = 0; virtual void run() = 0;
template< typename T > class Registration; template< typename T > class Registration;
DiagnosticBuilder report( DiagnosticsEngine::Level level, StringRef message, SourceLocation loc = SourceLocation()); DiagnosticBuilder report( DiagnosticsEngine::Level level, StringRef message, SourceLocation loc = SourceLocation());
static DiagnosticBuilder report( DiagnosticsEngine::Level level, StringRef message, static DiagnosticBuilder report( DiagnosticsEngine::Level level, StringRef message,
ASTContext& context, SourceLocation loc = SourceLocation()); CompilerInstance& compiler, SourceLocation loc = SourceLocation());
protected: protected:
bool ignoreLocation( SourceLocation loc ); bool ignoreLocation( SourceLocation loc );
bool ignoreLocation( const Decl* decl ); bool ignoreLocation( const Decl* decl );
bool ignoreLocation( const Stmt* stmt ); bool ignoreLocation( const Stmt* stmt );
ASTContext& context; CompilerInstance& compiler;
private: private:
static void registerPlugin( Plugin* (*create)( ASTContext&, Rewriter& ), const char* optionName, bool isRewriter ); static void registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter );
template< typename T > static Plugin* createHelper( ASTContext& context, Rewriter& rewriter ); template< typename T > static Plugin* createHelper( CompilerInstance& compiler, Rewriter& rewriter );
enum { isRewriter = false }; enum { isRewriter = false };
}; };
@@ -67,7 +68,7 @@ class RewritePlugin
: public Plugin : public Plugin
{ {
public: public:
explicit RewritePlugin( ASTContext& context, Rewriter& rewriter ); explicit RewritePlugin( CompilerInstance& compiler, Rewriter& rewriter );
protected: protected:
// This enum allows passing just 'RemoveLineIfEmpty' to functions below. // This enum allows passing just 'RemoveLineIfEmpty' to functions below.
enum RemoveLineIfEmpty_t { RemoveLineIfEmpty }; enum RemoveLineIfEmpty_t { RemoveLineIfEmpty };
@@ -109,7 +110,7 @@ class RewritePlugin
Rewriter& rewriter; Rewriter& rewriter;
private: private:
template< typename T > friend class Plugin::Registration; template< typename T > friend class Plugin::Registration;
template< typename T > static Plugin* createHelper( ASTContext& context, Rewriter& rewriter ); template< typename T > static Plugin* createHelper( CompilerInstance& compiler, Rewriter& rewriter );
enum { isRewriter = true }; enum { isRewriter = true };
bool reportEditFailure( SourceLocation loc ); bool reportEditFailure( SourceLocation loc );
bool adjustForWholeStatement( SourceRange* range ); bool adjustForWholeStatement( SourceRange* range );
@@ -136,7 +137,7 @@ class Plugin::Registration
class RegistrationCreate class RegistrationCreate
{ {
public: public:
template< typename T, bool > static T* create( ASTContext& context, Rewriter& rewriter ); template< typename T, bool > static T* create( CompilerInstance& compiler, Rewriter& rewriter );
}; };
///// /////
@@ -159,15 +160,15 @@ bool Plugin::ignoreLocation( const Stmt* stmt )
} }
template< typename T > template< typename T >
Plugin* Plugin::createHelper( ASTContext& context, Rewriter& ) Plugin* Plugin::createHelper( CompilerInstance& compiler, Rewriter& )
{ {
return new T( context ); return new T( compiler );
} }
template< typename T > template< typename T >
Plugin* RewritePlugin::createHelper( ASTContext& context, Rewriter& rewriter ) Plugin* RewritePlugin::createHelper( CompilerInstance& compiler, Rewriter& rewriter )
{ {
return new T( context, rewriter ); return new T( compiler, rewriter );
} }
template< typename T > template< typename T >

View File

@@ -25,7 +25,7 @@ namespace loplugin
struct PluginData struct PluginData
{ {
Plugin* (*create)( ASTContext&, Rewriter& ); Plugin* (*create)( CompilerInstance&, Rewriter& );
Plugin* object; Plugin* object;
const char* optionName; const char* optionName;
bool isRewriter; bool isRewriter;
@@ -36,9 +36,9 @@ static PluginData plugins[ MAX_PLUGINS ];
static int pluginCount = 0; static int pluginCount = 0;
static bool pluginObjectsCreated = false; static bool pluginObjectsCreated = false;
PluginHandler::PluginHandler( ASTContext& context, const vector< string >& args ) PluginHandler::PluginHandler( CompilerInstance& compiler, const vector< string >& args )
: context( context ) : compiler( compiler )
, rewriter( context.getSourceManager(), context.getLangOpts()) , rewriter( compiler.getSourceManager(), compiler.getLangOpts())
, scope( "mainfile" ) , scope( "mainfile" )
{ {
bool wasPlugin = false; bool wasPlugin = false;
@@ -95,11 +95,11 @@ void PluginHandler::createPlugin( const string& name )
if( name.empty()) // no plugin given -> create non-writer plugins if( name.empty()) // no plugin given -> create non-writer plugins
{ {
if( !plugins[ i ].isRewriter ) if( !plugins[ i ].isRewriter )
plugins[ i ].object = plugins[ i ].create( context, rewriter ); plugins[ i ].object = plugins[ i ].create( compiler, rewriter );
} }
else if( plugins[ i ].optionName == name ) else if( plugins[ i ].optionName == name )
{ {
plugins[ i ].object = plugins[ i ].create( context, rewriter ); plugins[ i ].object = plugins[ i ].create( compiler, rewriter );
return; return;
} }
} }
@@ -107,7 +107,7 @@ void PluginHandler::createPlugin( const string& name )
report( DiagnosticsEngine::Fatal, "unknown plugin tool %0" ) << name; report( DiagnosticsEngine::Fatal, "unknown plugin tool %0" ) << name;
} }
void PluginHandler::registerPlugin( Plugin* (*create)( ASTContext&, Rewriter& ), const char* optionName, bool isRewriter ) void PluginHandler::registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter )
{ {
assert( !pluginObjectsCreated ); assert( !pluginObjectsCreated );
assert( pluginCount < MAX_PLUGINS ); assert( pluginCount < MAX_PLUGINS );
@@ -120,7 +120,7 @@ void PluginHandler::registerPlugin( Plugin* (*create)( ASTContext&, Rewriter& ),
DiagnosticBuilder PluginHandler::report( DiagnosticsEngine::Level level, StringRef message, SourceLocation loc ) DiagnosticBuilder PluginHandler::report( DiagnosticsEngine::Level level, StringRef message, SourceLocation loc )
{ {
return Plugin::report( level, message, context, loc ); return Plugin::report( level, message, compiler, loc );
} }
void PluginHandler::HandleTranslationUnit( ASTContext& context ) void PluginHandler::HandleTranslationUnit( ASTContext& context )
@@ -218,7 +218,7 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context )
ASTConsumer* LibreOfficeAction::CreateASTConsumer( CompilerInstance& Compiler, StringRef ) ASTConsumer* LibreOfficeAction::CreateASTConsumer( CompilerInstance& Compiler, StringRef )
{ {
return new PluginHandler( Compiler.getASTContext(), _args ); return new PluginHandler( Compiler, _args );
} }
bool LibreOfficeAction::ParseArgs( const CompilerInstance&, const vector< string >& args ) bool LibreOfficeAction::ParseArgs( const CompilerInstance&, const vector< string >& args )

View File

@@ -26,15 +26,15 @@ class PluginHandler
: public ASTConsumer : public ASTConsumer
{ {
public: public:
PluginHandler( ASTContext& context, const vector< string >& args ); PluginHandler( CompilerInstance& compiler, const vector< string >& args );
virtual ~PluginHandler(); virtual ~PluginHandler();
virtual void HandleTranslationUnit( ASTContext& context ); virtual void HandleTranslationUnit( ASTContext& context );
static void registerPlugin( Plugin* (*create)( ASTContext&, Rewriter& ), const char* optionName, bool isRewriter ); static void registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter );
private: private:
void handleOption( const string& option ); void handleOption( const string& option );
void createPlugin( const string& name ); void createPlugin( const string& name );
DiagnosticBuilder report( DiagnosticsEngine::Level level, StringRef message, SourceLocation loc = SourceLocation()); DiagnosticBuilder report( DiagnosticsEngine::Level level, StringRef message, SourceLocation loc = SourceLocation());
ASTContext& context; CompilerInstance& compiler;
Rewriter rewriter; Rewriter rewriter;
string scope; string scope;
}; };

View File

@@ -19,14 +19,14 @@ Change all postfix ++ operators of non-trivial types to prefix if possible.
namespace loplugin namespace loplugin
{ {
PostfixIncrementFix::PostfixIncrementFix( ASTContext& context, Rewriter& rewriter ) PostfixIncrementFix::PostfixIncrementFix( CompilerInstance& compiler, Rewriter& rewriter )
: RewritePlugin( context, rewriter ) : RewritePlugin( compiler, rewriter )
{ {
} }
void PostfixIncrementFix::run() void PostfixIncrementFix::run()
{ {
TraverseDecl( context.getTranslationUnitDecl()); TraverseDecl( compiler.getASTContext().getTranslationUnitDecl());
} }
bool PostfixIncrementFix::VisitFunctionDecl( FunctionDecl* declaration ) bool PostfixIncrementFix::VisitFunctionDecl( FunctionDecl* declaration )

View File

@@ -21,7 +21,7 @@ class PostfixIncrementFix
, public RewritePlugin , public RewritePlugin
{ {
public: public:
explicit PostfixIncrementFix( ASTContext& context, Rewriter& rewriter ); explicit PostfixIncrementFix( CompilerInstance& compiler, Rewriter& rewriter );
virtual void run(); virtual void run();
bool VisitFunctionDecl( FunctionDecl* declaration ); bool VisitFunctionDecl( FunctionDecl* declaration );
private: private:

View File

@@ -19,14 +19,14 @@ Remove all forward declarations of rtl strings. I.e. 'namespace rtl { class OUSt
namespace loplugin namespace loplugin
{ {
RemoveForwardStringDecl::RemoveForwardStringDecl( ASTContext& context, Rewriter& rewriter ) RemoveForwardStringDecl::RemoveForwardStringDecl( CompilerInstance& compiler, Rewriter& rewriter )
: RewritePlugin( context, rewriter ) : RewritePlugin( compiler, rewriter )
{ {
} }
void RemoveForwardStringDecl::run() void RemoveForwardStringDecl::run()
{ {
TraverseDecl( context.getTranslationUnitDecl()); TraverseDecl( compiler.getASTContext().getTranslationUnitDecl());
} }
bool RemoveForwardStringDecl::VisitNamespaceDecl( NamespaceDecl* declaration ) bool RemoveForwardStringDecl::VisitNamespaceDecl( NamespaceDecl* declaration )

View File

@@ -21,7 +21,7 @@ class RemoveForwardStringDecl
, public RewritePlugin , public RewritePlugin
{ {
public: public:
explicit RemoveForwardStringDecl( ASTContext& context, Rewriter& rewriter ); explicit RemoveForwardStringDecl( CompilerInstance& compiler, Rewriter& rewriter );
virtual void run(); virtual void run();
bool VisitNamespaceDecl( NamespaceDecl* declaration ); bool VisitNamespaceDecl( NamespaceDecl* declaration );
private: private:

View File

@@ -25,8 +25,8 @@ report if the area is not listed there. The fix is either use a proper area or a
if appropriate. if appropriate.
*/ */
SalLogAreas::SalLogAreas( ASTContext& context ) SalLogAreas::SalLogAreas( CompilerInstance& compiler )
: Plugin( context ) : Plugin( compiler )
{ {
} }
@@ -34,7 +34,7 @@ void SalLogAreas::run()
{ {
inFunction = NULL; inFunction = NULL;
lastSalDetailLogStreamMacro = SourceLocation(); lastSalDetailLogStreamMacro = SourceLocation();
TraverseDecl( context.getTranslationUnitDecl()); TraverseDecl( compiler.getASTContext().getTranslationUnitDecl());
} }
bool SalLogAreas::VisitFunctionDecl( FunctionDecl* function ) bool SalLogAreas::VisitFunctionDecl( FunctionDecl* function )
@@ -59,7 +59,7 @@ bool SalLogAreas::VisitCallExpr( CallExpr* call )
// The SAL_DETAIL_LOG_STREAM macro expands to two calls to sal::detail::log(), // The SAL_DETAIL_LOG_STREAM macro expands to two calls to sal::detail::log(),
// so do not warn repeatedly about the same macro (the area->getLocStart() of all the calls // so do not warn repeatedly about the same macro (the area->getLocStart() of all the calls
// from the same macro should be the same). // from the same macro should be the same).
SourceLocation expansionLocation = context.getSourceManager().getExpansionLoc( call->getLocStart()); SourceLocation expansionLocation = compiler.getSourceManager().getExpansionLoc( call->getLocStart());
if( expansionLocation == lastSalDetailLogStreamMacro ) if( expansionLocation == lastSalDetailLogStreamMacro )
return true; return true;
lastSalDetailLogStreamMacro = expansionLocation; lastSalDetailLogStreamMacro = expansionLocation;
@@ -74,14 +74,15 @@ bool SalLogAreas::VisitCallExpr( CallExpr* call )
} }
if( inFunction->getQualifiedNameAsString() == "sal::detail::log" ) if( inFunction->getQualifiedNameAsString() == "sal::detail::log" )
return true; // This function only forwards to sal_detail_log, so ok. return true; // This function only forwards to sal_detail_log, so ok.
if( call->getArg( 1 )->isNullPointerConstant( context, Expr::NPC_ValueDependentIsNotNull ) != Expr::NPCK_NotNull ) if( call->getArg( 1 )->isNullPointerConstant( compiler.getASTContext(),
Expr::NPC_ValueDependentIsNotNull ) != Expr::NPCK_NotNull )
{ // If the area argument is a null pointer, that is allowed only for SAL_DEBUG. { // If the area argument is a null pointer, that is allowed only for SAL_DEBUG.
const SourceManager& source = context.getSourceManager(); const SourceManager& source = compiler.getSourceManager();
for( SourceLocation loc = call->getLocStart(); for( SourceLocation loc = call->getLocStart();
loc.isMacroID(); loc.isMacroID();
loc = source.getImmediateExpansionRange( loc ).first ) loc = source.getImmediateExpansionRange( loc ).first )
{ {
StringRef inMacro = Lexer::getImmediateMacroName( loc, source, context.getLangOpts()); StringRef inMacro = Lexer::getImmediateMacroName( loc, source, compiler.getLangOpts());
if( inMacro == "SAL_DEBUG" ) if( inMacro == "SAL_DEBUG" )
return true; // ok return true; // ok
} }

View File

@@ -23,7 +23,7 @@ class SalLogAreas
, public Plugin , public Plugin
{ {
public: public:
explicit SalLogAreas( ASTContext& context ); explicit SalLogAreas( CompilerInstance& compiler );
virtual void run(); virtual void run();
bool VisitFunctionDecl( FunctionDecl* function ); bool VisitFunctionDecl( FunctionDecl* function );
bool VisitCallExpr( CallExpr* call ); bool VisitCallExpr( CallExpr* call );

View File

@@ -30,14 +30,14 @@ SAL_WARN_UNUSED (see e.g. OUString). For external classes such as std::vector
that cannot be edited there is a manual list below. that cannot be edited there is a manual list below.
*/ */
UnusedVariableCheck::UnusedVariableCheck( ASTContext& context ) UnusedVariableCheck::UnusedVariableCheck( CompilerInstance& compiler )
: Plugin( context ) : Plugin( compiler )
{ {
} }
void UnusedVariableCheck::run() void UnusedVariableCheck::run()
{ {
TraverseDecl( context.getTranslationUnitDecl()); TraverseDecl( compiler.getASTContext().getTranslationUnitDecl());
} }
bool UnusedVariableCheck::VisitVarDecl( VarDecl* var ) bool UnusedVariableCheck::VisitVarDecl( VarDecl* var )

View File

@@ -21,7 +21,7 @@ class UnusedVariableCheck
, public Plugin , public Plugin
{ {
public: public:
explicit UnusedVariableCheck( ASTContext& context ); explicit UnusedVariableCheck( CompilerInstance& compiler );
virtual void run(); virtual void run();
bool VisitVarDecl( VarDecl* var ); bool VisitVarDecl( VarDecl* var );
}; };