summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/compileroptionsbuilder.cpp
diff options
context:
space:
mode:
authorIvan Donchevskii <ivan.donchevskii@qt.io>2019-01-17 15:27:36 +0100
committerIvan Donchevskii <ivan.donchevskii@qt.io>2019-01-23 12:04:40 +0000
commit093673e9cf2a7b5c99b93e2c2cb8a94514eee86d (patch)
tree48e46260df6055391cdf66bd8ed72af4a4a46e02 /src/plugins/cpptools/compileroptionsbuilder.cpp
parent87746b590639f9d63dc389847c4b795025a277d7 (diff)
downloadqt-creator-093673e9cf2a7b5c99b93e2c2cb8a94514eee86d.tar.gz
Clang: Fix how tweaked header paths work
We need to provide built-in includes only when we use tweaked headers. Also let's require Clang resource directory because it has to be placed on the specific position inside the built-in header paths. Change-Id: Id581238660c680725201de759216cf33f69f6cc7 Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/cpptools/compileroptionsbuilder.cpp')
-rw-r--r--src/plugins/cpptools/compileroptionsbuilder.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp
index c3b8f115f2..f60434f7a4 100644
--- a/src/plugins/cpptools/compileroptionsbuilder.cpp
+++ b/src/plugins/cpptools/compileroptionsbuilder.cpp
@@ -296,27 +296,22 @@ void CompilerOptionsBuilder::addHeaderPathOptions()
using ProjectExplorer::HeaderPath;
using ProjectExplorer::HeaderPathType;
+ for (const HeaderPath &headerPath : filter.userHeaderPaths)
+ addIncludeDirOptionForPath(headerPath);
+ for (const HeaderPath &headerPath : filter.systemHeaderPaths)
+ addIncludeDirOptionForPath(headerPath);
+
if (m_useTweakedHeaderPaths == UseTweakedHeaderPaths::Yes) {
- // Exclude all built-in includes except Clang resource directory.
+ QTC_CHECK(!m_clangVersion.isEmpty()
+ && "Clang resource directory is required with UseTweakedHeaderPaths::Yes.");
- if (!isClStyle()) // MSVC does not have such include directories - ignore it for cl driver.
- m_options.prepend("-nostdlibinc");
+ // Exclude all built-in includes and Clang resource directory.
+ m_options.prepend("-nostdinc++");
+ m_options.prepend("-nostdinc");
- if (!m_clangVersion.isEmpty()) {
- // Exclude all built-in includes and Clang resource directory.
- m_options.prepend("-nostdinc");
- }
+ for (const HeaderPath &headerPath : filter.builtInHeaderPaths)
+ addIncludeDirOptionForPath(headerPath);
}
-
-
- for (const HeaderPath &headerPath : qAsConst(filter.userHeaderPaths))
- addIncludeDirOptionForPath(headerPath);
-
- for (const HeaderPath &headerPath : qAsConst(filter.systemHeaderPaths))
- addIncludeDirOptionForPath(headerPath);
-
- for (const HeaderPath &headerPath : qAsConst(filter.builtInHeaderPaths))
- addIncludeDirOptionForPath(headerPath);
}
void CompilerOptionsBuilder::addPrecompiledHeaderOptions(UsePrecompiledHeaders usePrecompiledHeaders)