Bump simplecpp

This commit is contained in:
Daniel Marjamäki 2020-09-11 18:28:37 +02:00
parent 600538a325
commit b5cd823080
1 changed files with 30 additions and 17 deletions

View File

@ -2363,13 +2363,8 @@ static std::string _openHeader(std::ifstream &f, const std::string &path)
#endif
}
static std::string openHeader(std::ifstream &f, const simplecpp::DUI &dui, const std::string &sourcefile, const std::string &header, bool systemheader)
static std::string openHeaderRelative(std::ifstream &f, const std::string &sourcefile, const std::string &header)
{
if (isAbsolutePath(header)) {
return _openHeader(f, header);
}
if (!systemheader) {
if (sourcefile.find_first_of("\\/") != std::string::npos) {
const std::string s = sourcefile.substr(0, sourcefile.find_last_of("\\/") + 1U) + header;
std::string simplePath = _openHeader(f, s);
@ -2380,8 +2375,11 @@ static std::string openHeader(std::ifstream &f, const simplecpp::DUI &dui, const
if (!simplePath.empty())
return simplePath;
}
}
return "";
}
static std::string openHeaderIncludePath(std::ifstream &f, const simplecpp::DUI &dui, const std::string &header)
{
for (std::list<std::string>::const_iterator it = dui.includePaths.begin(); it != dui.includePaths.end(); ++it) {
std::string s = *it;
if (!s.empty() && s[s.size()-1U]!='/' && s[s.size()-1U]!='\\')
@ -2392,10 +2390,25 @@ static std::string openHeader(std::ifstream &f, const simplecpp::DUI &dui, const
if (!simplePath.empty())
return simplePath;
}
return "";
}
static std::string openHeader(std::ifstream &f, const simplecpp::DUI &dui, const std::string &sourcefile, const std::string &header, bool systemheader)
{
if (isAbsolutePath(header))
return _openHeader(f, header);
std::string ret;
if (systemheader) {
ret = openHeaderIncludePath(f, dui, header);
return ret.empty() ? openHeaderRelative(f, sourcefile, header) : ret;
}
ret = openHeaderRelative(f, sourcefile, header);
return ret.empty() ? openHeaderIncludePath(f, dui, header) : ret;
}
static std::string getFileName(const std::map<std::string, simplecpp::TokenList *> &filedata, const std::string &sourcefile, const std::string &header, const simplecpp::DUI &dui, bool systemheader)
{
if (filedata.empty()) {