summaryrefslogtreecommitdiff
path: root/src/tools/clangrefactoringbackend/source/sourcelocationsutils.h
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@qt.io>2017-07-03 11:12:00 +0200
committerTim Jenssen <tim.jenssen@qt.io>2017-07-03 09:27:05 +0000
commitdae4477cd367d115e2011cfedae6b1d5dbc22cb7 (patch)
tree5fa0ebf3db5cfe9f946c70e8c82f4bd09fca77db /src/tools/clangrefactoringbackend/source/sourcelocationsutils.h
parent35ca318d187eb1356f36dce86946f12a530dfd6f (diff)
downloadqt-creator-dae4477cd367d115e2011cfedae6b1d5dbc22cb7.tar.gz
Clang: Make file ids unique
Clang file ids are only unique for one query. Because we query in parallel we have to manage our own unique ids. Change-Id: I67d57d8b1766cab75ad252a14e57bbf9dc5fdb79 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/tools/clangrefactoringbackend/source/sourcelocationsutils.h')
-rw-r--r--src/tools/clangrefactoringbackend/source/sourcelocationsutils.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/tools/clangrefactoringbackend/source/sourcelocationsutils.h b/src/tools/clangrefactoringbackend/source/sourcelocationsutils.h
index 78076f5f2b..df07b42daa 100644
--- a/src/tools/clangrefactoringbackend/source/sourcelocationsutils.h
+++ b/src/tools/clangrefactoringbackend/source/sourcelocationsutils.h
@@ -53,7 +53,7 @@
namespace ClangBackEnd {
inline
-llvm::SmallString<256> absolutePath(const llvm::StringRef &path)
+llvm::SmallString<256> absolutePath(clang::StringRef path)
{
llvm::SmallString<256> absolutePath(path);
@@ -64,9 +64,9 @@ llvm::SmallString<256> absolutePath(const llvm::StringRef &path)
}
template <typename Container>
-Utils::SmallString fromNativePath(Container container)
+Utils::PathString fromNativePath(Container container)
{
- Utils::SmallString path(container.data(), container.size());
+ Utils::PathString path(container.data(), container.size());
#ifdef _WIN32
std::replace(path.begin(), path.end(), '\\', '/');
@@ -89,13 +89,9 @@ void appendSourceLocationsToSourceLocationsContainer(
const auto fileId = decomposedLoction.first;
const auto offset = decomposedLoction.second;
const auto fileEntry = sourceManager.getFileEntryForID(fileId);
- auto filePath = absolutePath(fileEntry->getName());
- const auto fileName = llvm::sys::path::filename(filePath);
- llvm::sys::path::remove_filename(filePath);
sourceLocationsContainer.insertFilePath(fileId.getHashValue(),
- fromNativePath(filePath),
- fromNativePath(fileName));
+ fromNativePath(fileEntry->tryGetRealPathName()));
sourceLocationsContainer.insertSourceLocation(fileId.getHashValue(),
fullSourceLocation.getSpellingLineNumber(),
fullSourceLocation.getSpellingColumnNumber(),