diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 17d07a90c..f35caf5c5 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -338,6 +338,9 @@ void CppCheck::checkFile(const std::string &code, const char FileName[]) return; } + // Update the _dependencies.. + _dependencies.insert( _tokenizer.getFiles()->begin()+1, _tokenizer.getFiles()->end() ); + // call all "runChecks" in all registered Check classes for (std::list::iterator it = Check::instances().begin(); it != Check::instances().end(); ++it) { if (_settings.terminated()) diff --git a/lib/cppcheck.h b/lib/cppcheck.h index e39f92d5e..3b20665bd 100644 --- a/lib/cppcheck.h +++ b/lib/cppcheck.h @@ -131,6 +131,13 @@ public: */ void analyseFile(std::istream &f, const std::string &filename); + /** + * @brief Get dependencies. Use this after calling 'check'. + */ + std::set dependencies() const { + return _dependencies; + } + private: /** @brief Process one file. */ @@ -175,6 +182,7 @@ private: bool _useGlobalSuppressions; std::string _filename; std::string _fileContent; + std::set _dependencies; void reportProgress(const std::string &filename, const char stage[], const unsigned int value);