summaryrefslogtreecommitdiffstats
path: root/clang/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
commit7ec1ec10c97fd299169ecc2b8dca58a4f7959438 (patch)
tree705f769acaefcce1bd5499ec50e98e91e06e1f6e /clang/lib/Tooling/JSONCompilationDatabase.cpp
parentf3342311768443f4e95f7e67206cbbb9f7ac8882 (diff)
downloadbcm5719-llvm-7ec1ec10c97fd299169ecc2b8dca58a4f7959438.tar.gz
bcm5719-llvm-7ec1ec10c97fd299169ecc2b8dca58a4f7959438.zip
[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 llvm-svn: 355678
Diffstat (limited to 'clang/lib/Tooling/JSONCompilationDatabase.cpp')
-rw-r--r--clang/lib/Tooling/JSONCompilationDatabase.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Tooling/JSONCompilationDatabase.cpp b/clang/lib/Tooling/JSONCompilationDatabase.cpp
index 23bb1355c2c..3414f7db58a 100644
--- a/clang/lib/Tooling/JSONCompilationDatabase.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud