added `DUI::clearIncludeCache` to clear the non-existing files cache by firewave · Pull Request #287 · cppcheck-opensource/simplecpp
void clear() { ScopedLock lock(m_criticalSection); m_pathSet.clear(); }
private: std::set<std::string> m_pathSet; CRITICAL_SECTION m_criticalSection;
static std::string openHeader(std::ifstream &f, const std::string &path) { #ifdef SIMPLECPP_WINDOWS std::string simplePath = simplecpp::simplifyPath(path); #ifdef SIMPLECPP_WINDOWS if (nonExistingFilesCache.contains(simplePath)) return ""; // file is known not to exist, skip expensive file open call
#endif f.open(simplePath.c_str()); if (f.is_open()) return simplePath; else { nonExistingFilesCache.add(simplePath); return ""; } #else f.open(path.c_str()); return f.is_open() ? simplecpp::simplifyPath(path) : ""; #ifdef SIMPLECPP_WINDOWS nonExistingFilesCache.add(simplePath); #endif return ""; }
static std::string getRelativeFileName(const std::string &sourcefile, const std::string &header)
std::map<std::string, simplecpp::TokenList*> simplecpp::load(const simplecpp::TokenList &rawtokens, std::vector<std::string> &filenames, const simplecpp::DUI &dui, simplecpp::OutputList *outputList) { #ifdef SIMPLECPP_WINDOWS if (dui.clearIncludeCache) nonExistingFilesCache .clear(); #endif
std::map<std::string, simplecpp::TokenList*> ret;
std::list<const Token *> filelist;
void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenList &rawtokens, std::vector<std::string> &files, std::map<std::string, simplecpp::TokenList *> &filedata, const simplecpp::DUI &dui, simplecpp::OutputList *outputList, std::list<simplecpp::MacroUsage> *macroUsage, std::list<simplecpp::IfCond> *ifCond) { #ifdef SIMPLECPP_WINDOWS if (dui.clearIncludeCache) nonExistingFilesCache.clear(); #endif
std::map<std::string, std::size_t> sizeOfType(rawtokens.sizeOfType); sizeOfType.insert(std::make_pair("char", sizeof(char))); sizeOfType.insert(std::make_pair("short", sizeof(short)));