Commit 82cf0e60 authored by Nikolai Kosjar's avatar Nikolai Kosjar

Clang: Fix include paths for MSVC toolchains

Prevent libclang from using any builtin includes paths or any standard system
directories. The project manager provides us all the necessary information.

Task-number: QTCREATORBUG-15345
Change-Id: I70e2dafea8d049a9b7a32b24ce2d4ce3dac2cd3b
Reviewed-by: default avatarMarco Bubke <marco.bubke@theqtcompany.com>
parent 10e947f6
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
#include <cpptools/cppprojects.h> #include <cpptools/cppprojects.h>
#include <cpptools/cppworkingcopy.h> #include <cpptools/cppworkingcopy.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDir> #include <QDir>
...@@ -122,7 +124,7 @@ public: ...@@ -122,7 +124,7 @@ public:
optionsBuilder.addToolchainAndProjectDefines(); optionsBuilder.addToolchainAndProjectDefines();
optionsBuilder.addResourceDirOptions(); optionsBuilder.addPredefinedMacrosAndHeaderPathsOptions();
optionsBuilder.addWrappedQtHeadersIncludePath(); optionsBuilder.addWrappedQtHeadersIncludePath();
optionsBuilder.addHeaderPathOptions(); optionsBuilder.addHeaderPathOptions();
optionsBuilder.addProjectConfigFileInclude(); optionsBuilder.addProjectConfigFileInclude();
...@@ -154,7 +156,21 @@ private: ...@@ -154,7 +156,21 @@ private:
return false; return false;
} }
void addResourceDirOptions() void addPredefinedMacrosAndHeaderPathsOptions()
{
if (m_projectPart.toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID)
addPredefinedMacrosAndHeaderPathsOptionsForMsvc();
else
addPredefinedMacrosAndHeaderPathsOptionsForNonMsvc();
}
void addPredefinedMacrosAndHeaderPathsOptionsForMsvc()
{
add(QLatin1String("-nostdinc"));
add(QLatin1String("-undef"));
}
void addPredefinedMacrosAndHeaderPathsOptionsForNonMsvc()
{ {
static const QString resourceDir = getResourceDir(); static const QString resourceDir = getResourceDir();
if (!resourceDir.isEmpty()) { if (!resourceDir.isEmpty()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment