aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Tooling/CompilationDatabaseTest.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/unittests/Tooling/CompilationDatabaseTest.cpp
parentf3342311768443f4e95f7e67206cbbb9f7ac8882 (diff)
downloadllvm-7ec1ec10c97fd299169ecc2b8dca58a4f7959438.zip
llvm-7ec1ec10c97fd299169ecc2b8dca58a4f7959438.tar.gz
llvm-7ec1ec10c97fd299169ecc2b8dca58a4f7959438.tar.bz2
[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/unittests/Tooling/CompilationDatabaseTest.cpp')
-rw-r--r--clang/unittests/Tooling/CompilationDatabaseTest.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp b/clang/unittests/Tooling/CompilationDatabaseTest.cpp
index 3f67606..83fceba8 100644
--- a/clang/unittests/Tooling/CompilationDatabaseTest.cpp
+++ b/clang/unittests/Tooling/CompilationDatabaseTest.cpp
@@ -88,12 +88,17 @@ TEST(JSONCompilationDatabase, GetAllFiles) {
expected_files.push_back(PathStorage.str());
llvm::sys::path::native("//net/dir/file2", PathStorage);
expected_files.push_back(PathStorage.str());
+ llvm::sys::path::native("//net/file1", PathStorage);
+ expected_files.push_back(PathStorage.str());
EXPECT_EQ(expected_files,
getAllFiles("[{\"directory\":\"//net/dir\","
"\"command\":\"command\","
"\"file\":\"file1\"},"
" {\"directory\":\"//net/dir\","
"\"command\":\"command\","
+ "\"file\":\"../file1\"},"
+ " {\"directory\":\"//net/dir\","
+ "\"command\":\"command\","
"\"file\":\"file2\"}]",
ErrorMessage, JSONCommandLineSyntax::Gnu))
<< ErrorMessage;