summaryrefslogtreecommitdiff
path: root/src/tools/clangrefactoringbackend/source/sourcelocationsutils.h
diff options
context:
space:
mode:
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(),