diff options
author | Martin Smith <martin.smith@qt.io> | 2019-05-31 13:25:47 +0200 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2019-06-04 12:01:29 +0300 |
commit | 50a172f8ad2891fe2e00e3d2ccd4f4536a73f9e4 (patch) | |
tree | 20a8b021a684aac9b3b2cd94e24f816608b794bd | |
parent | 326463142b42b03c0e4c59069e099d6fd27212ce (diff) |
qdoc: Accept include paths without -I
This update lets qdoc accept include paths with or without the -I
and with or without a space between the -I and the path. Without
the space is preferred.
Task-number: QTBUG-74675
Change-Id: I4a1dcc04a3c9a6586e24b50bccf0f1f37d02ed4c
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit e33ac6f1b1ebb882684f24f7d026267584d9393a)
-rw-r--r-- | src/qdoc/clangcodeparser.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp index 87c9282ce..407f67604 100644 --- a/src/qdoc/clangcodeparser.cpp +++ b/src/qdoc/clangcodeparser.cpp @@ -1021,8 +1021,19 @@ void ClangCodeParser::initializeParser(const Config &config) printParsingErrors_ = 1; version_ = config.getString(CONFIG_VERSION); const auto args = config.getStringList(CONFIG_INCLUDEPATHS); - includePaths_.resize(args.size()); - std::transform(args.begin(), args.end(), includePaths_.begin(), + QStringList squeezedArgs; + int i = 0; + while (i < args.size()) { + if (args.at(i) != QLatin1String("-I")) { + if (args.at(i).startsWith(QLatin1String("-I"))) + squeezedArgs << args.at(i); + else + squeezedArgs << QLatin1String("-I") + args.at(i); + } + i++; + } + includePaths_.resize(squeezedArgs.size()); + std::transform(squeezedArgs.begin(), squeezedArgs.end(), includePaths_.begin(), [](const QString &s) { return s.toUtf8(); }); CppCodeParser::initializeParser(config); pchFileDir_.reset(nullptr); |