lib: allow that file dependencies are taken from Cppcheck after a check

This commit is contained in:
Daniel Marjamäki 2012-02-15 08:08:28 +01:00
parent 87a118cd16
commit 8f3d511871
2 changed files with 11 additions and 0 deletions

View File

@ -338,6 +338,9 @@ void CppCheck::checkFile(const std::string &code, const char FileName[])
return; return;
} }
// Update the _dependencies..
_dependencies.insert( _tokenizer.getFiles()->begin()+1, _tokenizer.getFiles()->end() );
// call all "runChecks" in all registered Check classes // call all "runChecks" in all registered Check classes
for (std::list<Check *>::iterator it = Check::instances().begin(); it != Check::instances().end(); ++it) { for (std::list<Check *>::iterator it = Check::instances().begin(); it != Check::instances().end(); ++it) {
if (_settings.terminated()) if (_settings.terminated())

View File

@ -131,6 +131,13 @@ public:
*/ */
void analyseFile(std::istream &f, const std::string &filename); void analyseFile(std::istream &f, const std::string &filename);
/**
* @brief Get dependencies. Use this after calling 'check'.
*/
std::set<std::string> dependencies() const {
return _dependencies;
}
private: private:
/** @brief Process one file. */ /** @brief Process one file. */
@ -175,6 +182,7 @@ private:
bool _useGlobalSuppressions; bool _useGlobalSuppressions;
std::string _filename; std::string _filename;
std::string _fileContent; std::string _fileContent;
std::set<std::string> _dependencies;
void reportProgress(const std::string &filename, const char stage[], const unsigned int value); void reportProgress(const std::string &filename, const char stage[], const unsigned int value);