diff --git a/checkfunctionusage.cpp b/checkfunctionusage.cpp index ea866fda6..2c7fd09f8 100644 --- a/checkfunctionusage.cpp +++ b/checkfunctionusage.cpp @@ -40,6 +40,10 @@ CheckFunctionUsage::~CheckFunctionUsage() } +void CheckFunctionUsage::setErrorLogger( ErrorLogger *errorLogger ) +{ + _errorLogger = errorLogger; +} void CheckFunctionUsage::parseTokens( const Tokenizer &tokenizer ) { diff --git a/checkfunctionusage.h b/checkfunctionusage.h index 49b49cbc7..c3083b7f3 100644 --- a/checkfunctionusage.h +++ b/checkfunctionusage.h @@ -28,9 +28,16 @@ class CheckFunctionUsage { public: - CheckFunctionUsage( ErrorLogger *errorLogger ); + CheckFunctionUsage( ErrorLogger *errorLogger = 0 ); ~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.. // * Check what functions are used // * What functions are declared diff --git a/cppcheck.cpp b/cppcheck.cpp index da446d6a7..1cc0fd75d 100644 --- a/cppcheck.cpp +++ b/cppcheck.cpp @@ -36,7 +36,7 @@ //--------------------------------------------------------------------------- -CppCheck::CppCheck( ErrorLogger &errorLogger ) : _checkFunctionUsage( this ) +CppCheck::CppCheck( ErrorLogger &errorLogger ) { _errorLogger = &errorLogger; } @@ -137,6 +137,7 @@ std::string CppCheck::parseFromArgs( int argc, const char* const argv[] ) void CppCheck::check() { + _checkFunctionUsage.setErrorLogger( this ); std::sort( _filenames.begin(), _filenames.end() ); for (unsigned int c = 0; c < _filenames.size(); c++) {