summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/compileroptionsbuilder.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2016-07-01 15:07:32 +0200
committerNikolai Kosjar <nikolai.kosjar@qt.io>2016-07-04 13:08:03 +0000
commit36e7f4541f071a1cce21c8ad12cf6e580f026674 (patch)
tree20d15cae73238bb106e7cdaeed7d4f82f3e66f66 /src/plugins/cpptools/compileroptionsbuilder.cpp
parenta12184ea32752fc002965d27a513d3e4df47ca83 (diff)
downloadqt-creator-36e7f4541f071a1cce21c8ad12cf6e580f026674.tar.gz
Clang: Pass on file paths with native separators
libclang 3.8 seems to be sensitive to file paths separators [1]. On Windows, this led to not updated document annotations and/or crashes after reparsing. When passing file paths to libclang, convert to native separators. When getting file paths from libclang, convert back. This handles: * main file path * file paths of the unsaved files * -I<DIR> arguments, the resource path (for builtins) and the paths to the wrapped qt headers * included header files from libclang * source locations from libclang Also, minimize the conversion in SourceLocation to a minimum by making filePath() lazy. [1] https://llvm.org/bugs/show_bug.cgi?id=28381 Change-Id: If5866f34a6fdc6b34b16c022d3988e8e6eae2a0a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/cpptools/compileroptionsbuilder.cpp')
-rw-r--r--src/plugins/cpptools/compileroptionsbuilder.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp
index 43605a075b..faf78f925d 100644
--- a/src/plugins/cpptools/compileroptionsbuilder.cpp
+++ b/src/plugins/cpptools/compileroptionsbuilder.cpp
@@ -27,6 +27,8 @@
#include <projectexplorer/projectexplorerconstants.h>
+#include <QDir>
+
namespace CppTools {
CompilerOptionsBuilder::CompilerOptionsBuilder(const ProjectPart &projectPart)
@@ -98,7 +100,7 @@ void CompilerOptionsBuilder::enableExceptions()
add(QLatin1String("-fexceptions"));
}
-void CompilerOptionsBuilder::addHeaderPathOptions()
+void CompilerOptionsBuilder::addHeaderPathOptions(bool addAsNativePath)
{
typedef ProjectPartHeaderPath HeaderPath;
const QString defaultPrefix = includeOption();
@@ -124,7 +126,10 @@ void CompilerOptionsBuilder::addHeaderPathOptions()
break;
}
- result.append(prefix + headerPath.path);
+ QString path = prefix + headerPath.path;
+ path = addAsNativePath ? QDir::toNativeSeparators(path) : path;
+
+ result.append(path);
}
m_options.append(result);