summaryrefslogtreecommitdiffstats
path: root/src/qdoc/clangcodeparser.cpp
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@qt.io>2019-05-31 13:25:47 +0200
committerMartin Smith <martin.smith@qt.io>2019-05-31 13:31:46 +0200
commite33ac6f1b1ebb882684f24f7d026267584d9393a (patch)
treea70368983a80855b7c4df96659ae0b9f46c41f0c /src/qdoc/clangcodeparser.cpp
parentfec8712ce58e0739cb49845b5783d7f9af0ffa0e (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>
Diffstat (limited to 'src/qdoc/clangcodeparser.cpp')
-rw-r--r--src/qdoc/clangcodeparser.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp
index 5bda5296b..add84b9a9 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);