diff options
author | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2019-01-17 15:27:36 +0100 |
---|---|---|
committer | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2019-01-23 12:04:40 +0000 |
commit | 093673e9cf2a7b5c99b93e2c2cb8a94514eee86d (patch) | |
tree | 48e46260df6055391cdf66bd8ed72af4a4a46e02 /src/plugins/cpptools/compileroptionsbuilder.cpp | |
parent | 87746b590639f9d63dc389847c4b795025a277d7 (diff) | |
download | qt-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.cpp | 29 |
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) |