Don't use keyword "this" in constructor

This commit is contained in:
Reijo Tomperi 2008-12-19 19:31:12 +00:00
parent 347068b672
commit a86b07ed17
3 changed files with 14 additions and 2 deletions

View File

@ -40,6 +40,10 @@ CheckFunctionUsage::~CheckFunctionUsage()
} }
void CheckFunctionUsage::setErrorLogger( ErrorLogger *errorLogger )
{
_errorLogger = errorLogger;
}
void CheckFunctionUsage::parseTokens( const Tokenizer &tokenizer ) void CheckFunctionUsage::parseTokens( const Tokenizer &tokenizer )
{ {

View File

@ -28,9 +28,16 @@
class CheckFunctionUsage class CheckFunctionUsage
{ {
public: public:
CheckFunctionUsage( ErrorLogger *errorLogger ); CheckFunctionUsage( ErrorLogger *errorLogger = 0 );
~CheckFunctionUsage(); ~CheckFunctionUsage();
/**
* Errors found by this class are forwarded to the given
* errorlogger.
* @param errorLogger The errorlogger to be used.
*/
void setErrorLogger( ErrorLogger *errorLogger );
// Parse current tokens and determine.. // Parse current tokens and determine..
// * Check what functions are used // * Check what functions are used
// * What functions are declared // * What functions are declared

View File

@ -36,7 +36,7 @@
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
CppCheck::CppCheck( ErrorLogger &errorLogger ) : _checkFunctionUsage( this ) CppCheck::CppCheck( ErrorLogger &errorLogger )
{ {
_errorLogger = &errorLogger; _errorLogger = &errorLogger;
} }
@ -137,6 +137,7 @@ std::string CppCheck::parseFromArgs( int argc, const char* const argv[] )
void CppCheck::check() void CppCheck::check()
{ {
_checkFunctionUsage.setErrorLogger( this );
std::sort( _filenames.begin(), _filenames.end() ); std::sort( _filenames.begin(), _filenames.end() );
for (unsigned int c = 0; c < _filenames.size(); c++) for (unsigned int c = 0; c < _filenames.size(); c++)
{ {