| 273 | } |
| 274 | |
| 275 | void ImportProject::fsSetIncludePaths(FileSettings& fs, const std::string &basepath, const std::list<std::string> &in, std::map<std::string, std::string, cppcheck::stricmp> &variables) |
| 276 | { |
| 277 | std::set<std::string> found; |
| 278 | // NOLINTNEXTLINE(performance-unnecessary-copy-initialization) |
| 279 | const std::list<std::string> copyIn(in); |
| 280 | fs.includePaths.clear(); |
| 281 | for (const std::string &ipath : copyIn) { |
| 282 | if (ipath.empty()) |
| 283 | continue; |
| 284 | if (startsWith(ipath,"%(")) |
| 285 | continue; |
| 286 | std::string s(Path::fromNativeSeparators(ipath)); |
| 287 | if (!found.insert(s).second) |
| 288 | continue; |
| 289 | if (s[0] == '/' || (s.size() > 1U && s.compare(1,2,":/") == 0)) { |
| 290 | if (!endsWith(s,'/')) |
| 291 | s += '/'; |
| 292 | fs.includePaths.push_back(std::move(s)); |
| 293 | continue; |
| 294 | } |
| 295 | |
| 296 | if (endsWith(s,'/')) // this is a temporary hack, simplifyPath can crash if path ends with '/' |
| 297 | s.pop_back(); |
| 298 | |
| 299 | if (s.find("$(") == std::string::npos) { |
| 300 | s = Path::simplifyPath(basepath + s); |
| 301 | } else { |
| 302 | if (!simplifyPathWithVariables(s, variables)) |
| 303 | continue; |
| 304 | } |
| 305 | if (s.empty()) |
| 306 | continue; |
| 307 | fs.includePaths.push_back(s.back() == '/' ? s : (s + '/')); |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | ImportProject::Type ImportProject::import(const std::string &filename, Settings *settings, Suppressions *supprs) |
| 312 | { |
nothing calls this directly
no test coverage detected