From 7ec1ec10c97fd299169ecc2b8dca58a4f7959438 Mon Sep 17 00:00:00 2001 From: Kadir Cetinkaya Date: Fri, 8 Mar 2019 09:42:04 +0000 Subject: [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 --- clang/unittests/Tooling/CompilationDatabaseTest.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/unittests/Tooling/CompilationDatabaseTest.cpp') diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp b/clang/unittests/Tooling/CompilationDatabaseTest.cpp index 3f67606cd5e..83fceba802f 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; -- cgit v1.2.3