| 3069 | } |
| 3070 | |
| 3071 | static std::string openHeader(std::ifstream &f, const simplecpp::DUI &dui, const std::string &sourcefile, const std::string &header, bool systemheader) |
| 3072 | { |
| 3073 | if (simplecpp::isAbsolutePath(header)) |
| 3074 | return openHeaderDirect(f, simplecpp::simplifyPath(header)); |
| 3075 | |
| 3076 | // prefer first to search the header relatively to source file if found, when not a system header |
| 3077 | if (!systemheader) { |
| 3078 | std::string path = openHeaderDirect(f, simplecpp::simplifyPath(dirPath(sourcefile) + header)); |
| 3079 | if (!path.empty()) { |
| 3080 | return path; |
| 3081 | } |
| 3082 | } |
| 3083 | |
| 3084 | // search the header on the include paths (provided by the flags "-I...") |
| 3085 | for (const auto &includePath : dui.includePaths) { |
| 3086 | std::string path = openHeaderDirect(f, simplecpp::simplifyPath(includePath + "/" + header)); |
| 3087 | if (!path.empty()) |
| 3088 | return path; |
| 3089 | } |
| 3090 | return ""; |
| 3091 | } |
| 3092 | |
| 3093 | std::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 | { |
no test coverage detected