diff options
author | Liang Qi <liang.qi@qt.io> | 2020-03-24 14:26:40 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2020-03-24 14:27:03 +0100 |
commit | 4e35093ea7f6be6caf34b0627fbaffab984a5e0f (patch) | |
tree | d27a3c95fa5c4138122ef683b885787da6243fea /src/qdoc/clangcodeparser.cpp | |
parent | 02265f9bbc213d219afc345594307affb900e07e (diff) | |
parent | c35cd309f480d76e44e3bd806c40f96f0384e576 (diff) | |
download | qttools-4e35093ea7f6be6caf34b0627fbaffab984a5e0f.tar.gz |
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
src/qdoc/clangcodeparser.cpp
Change-Id: I2ba822fde6c50ea782839de7d5cb155354c33b52
Diffstat (limited to 'src/qdoc/clangcodeparser.cpp')
-rw-r--r-- | src/qdoc/clangcodeparser.cpp | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp index 3948bbf72..db9c2ed07 100644 --- a/src/qdoc/clangcodeparser.cpp +++ b/src/qdoc/clangcodeparser.cpp @@ -1106,25 +1106,32 @@ void ClangCodeParser::initializeParser() printParsingErrors_ = 1; version_ = config.getString(CONFIG_VERSION); const auto args = config.getStringList(CONFIG_INCLUDEPATHS); - QStringList squeezedArgs; + QSet<QString> seen; + includePaths_.clear(); + // Remove empty paths and duplicates and add -I and canonicalize if necessary for (const auto &p : args) { - if (p.startsWith(QLatin1String("-I"))) - squeezedArgs << p.mid(2).trimmed(); - else - squeezedArgs << p; + QByteArray option; + QString rawpath; + if (p.startsWith(QLatin1String("-I")) || p.startsWith(QLatin1String("-F"))) { + rawpath = p.mid(2).trimmed(); + option = p.left(2).toUtf8(); + } else if (p.startsWith(QLatin1String("-isystem"))) { + rawpath = p.mid(8).trimmed(); + option = "-isystem"; + } else { + rawpath = p; + option = "-I"; + } + if (rawpath.isEmpty() || seen.contains(rawpath)) + continue; + seen.insert(rawpath); + QByteArray path(rawpath.toUtf8()); + QFileInfo fi(QDir::current(), rawpath); + if (fi.exists()) + path = fi.canonicalFilePath().toUtf8(); + path.prepend(option); + includePaths_.append(path); } - // Remove empty paths and duplicates - squeezedArgs.removeAll({}); - squeezedArgs.removeDuplicates(); - includePaths_.resize(squeezedArgs.size()); - std::transform(squeezedArgs.begin(), squeezedArgs.end(), includePaths_.begin(), - [](const QString &s) { - QByteArray path(s.toUtf8()); - QFileInfo fi(QDir::current(), s); - if (fi.exists()) - path = fi.canonicalFilePath().toUtf8(); - return path.prepend("-I"); - }); CppCodeParser::initializeParser(); pchFileDir_.reset(nullptr); allHeaders_.clear(); |