summaryrefslogtreecommitdiff
path: root/lib/Tooling/JSONCompilationDatabase.cpp
diff options
context:
space:
mode:
authorKadir Cetinkaya <kadircet@google.com>2019-03-08 09:42:04 +0000
committerKadir Cetinkaya <kadircet@google.com>2019-03-08 09:42:04 +0000
commit2df582cdb843b237cf5085730e85c5f5338d0c9d (patch)
tree2434c3ce3c08dc7d87d186ed268335f125257b9d /lib/Tooling/JSONCompilationDatabase.cpp
parent8352604262c26081960a1ed157aeb6cfeabdf5e9 (diff)
downloadclang-2df582cdb843b237cf5085730e85c5f5338d0c9d.tar.gz
[clang][Tooling] Delete dots and dotdots when generating absolute paths
Summary: GetAllFiles interface returns absolute paths, but keeps dots and dot dots. This patch makes those paths canonical by deleting them. Reviewers: hokein Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59079 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Tooling/JSONCompilationDatabase.cpp')
-rw-r--r--lib/Tooling/JSONCompilationDatabase.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Tooling/JSONCompilationDatabase.cpp b/lib/Tooling/JSONCompilationDatabase.cpp
index 23bb1355c2..3414f7db58 100644
--- a/lib/Tooling/JSONCompilationDatabase.cpp
+++ b/lib/Tooling/JSONCompilationDatabase.cpp
@@ -370,6 +370,7 @@ bool JSONCompilationDatabase::parse(std::string &ErrorMessage) {
SmallString<128> AbsolutePath(
Directory->getValue(DirectoryStorage));
llvm::sys::path::append(AbsolutePath, FileName);
+ llvm::sys::path::remove_dots(AbsolutePath, /*remove_dot_dot=*/ true);
llvm::sys::path::native(AbsolutePath, NativeFilePath);
} else {
llvm::sys::path::native(FileName, NativeFilePath);