From e33ac6f1b1ebb882684f24f7d026267584d9393a Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 31 May 2019 13:25:47 +0200 Subject: 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 --- src/qdoc/clangcodeparser.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/qdoc/clangcodeparser.cpp') 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); -- cgit v1.2.3