MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / tryload

Method tryload

externals/simplecpp/simplecpp.cpp:3093–3117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3091}
3092
3093std::pair<simplecpp::FileData *, bool> simplecpp::FileDataCache::tryload(FileDataCache::name_map_type::iterator &name_it, const simplecpp::DUI &dui, std::vector<std::string> &filenames, simplecpp::OutputList *outputList)
3094{
3095 const std::string &path = name_it->first;
3096 FileID fileId;
3097
3098 if (!getFileId(path, fileId))
3099 return {nullptr, false};
3100
3101 const auto id_it = mIdMap.find(fileId);
3102 if (id_it != mIdMap.end()) {
3103 name_it->second = id_it->second;
3104 return {id_it->second, false};
3105 }
3106
3107 auto *const data = new FileData {path, TokenList(path, filenames, outputList)};
3108
3109 if (dui.removeComments)
3110 data->tokens.removeComments();
3111
3112 name_it->second = data;
3113 mIdMap.emplace(fileId, data);
3114 mData.emplace_back(data);
3115
3116 return {data, true};
3117}
3118
3119std::pair<simplecpp::FileData *, bool> simplecpp::FileDataCache::get(const std::string &sourcefile, const std::string &header, const simplecpp::DUI &dui, bool systemheader, std::vector<std::string> &filenames, simplecpp::OutputList *outputList)
3120{

Callers

nothing calls this directly

Calls 4

TokenListFunction · 0.70
findMethod · 0.45
endMethod · 0.45
removeCommentsMethod · 0.45

Tested by

no test coverage detected