summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2018-06-10 08:24:49 +0300
committerOrgad Shaneh <orgads@gmail.com>2018-06-11 11:38:10 +0000
commitc62daf9cda6a36d5434dfbcd6ca3dbb3537a935b (patch)
tree042a228088dc131352d07d3c852e357fc86f538e /src/plugins/cpptools
parentcab82a94c75d36cd63f705e5ee59c9391f3e23ae (diff)
downloadqt-creator-c62daf9cda6a36d5434dfbcd6ca3dbb3537a935b.tar.gz
CppTools: Do not use -isystem for header paths in the repository
Clang uses mmap for system headers. This locks the header files on Windows. If the project file is not in the root directory of the repository, and it uses header files that are outside its directory, but in the repository, Git operations like checkout, rebase etc. can fail because the header files are locked. Change-Id: If8a258234479fc70ca0a8384bf24c68d767dbeaa Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/cpptools')
-rw-r--r--src/plugins/cpptools/compileroptionsbuilder.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp
index a2ed615894..1188075a2a 100644
--- a/src/plugins/cpptools/compileroptionsbuilder.cpp
+++ b/src/plugins/cpptools/compileroptionsbuilder.cpp
@@ -26,6 +26,7 @@
#include "compileroptionsbuilder.h"
#include <coreplugin/icore.h>
+#include <coreplugin/vcsmanager.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
@@ -137,7 +138,12 @@ static Utils::FileName projectTopLevelDirectory(const ProjectPart &projectPart)
{
if (!projectPart.project)
return Utils::FileName();
- return projectPart.project->projectDirectory();
+ const Utils::FileName result = projectPart.project->projectDirectory();
+ const Utils::FileName vcsTopLevel = Utils::FileName::fromString(
+ Core::VcsManager::findTopLevelForDirectory(result.toString()));
+ if (result.isChildOf(vcsTopLevel))
+ return vcsTopLevel;
+ return result;
}
void CompilerOptionsBuilder::addHeaderPathOptions()
@@ -165,10 +171,13 @@ void CompilerOptionsBuilder::addHeaderPathOptions()
// intentional fall-through:
case HeaderPath::IncludePath:
path = absoluteDirectory(headerPath.path);
- if (path == projectDirectory || path.isChildOf(projectDirectory))
+ if (projectDirectory.isEmpty()
+ || path == projectDirectory
+ || path.isChildOf(projectDirectory)) {
prefix = defaultPrefix;
- else
+ } else {
prefix = SYSTEM_INCLUDE_PREFIX;
+ }
break;
}