[PATCH] D59079: [clang][Tooling] Delete dots and dotdots when generating absolute paths
Kadir Cetinkaya via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 8 01:41:52 PST 2019
This revision was automatically updated to reflect the committed changes.
kadircet marked an inline comment as done.
Closed by commit rL355678: [clang][Tooling] Delete dots and dotdots when generating absolute paths (authored by kadircet, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D59079?vs=189663&id=189829#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59079/new/
https://reviews.llvm.org/D59079
Files:
cfe/trunk/lib/Tooling/JSONCompilationDatabase.cpp
cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp
Index: cfe/trunk/lib/Tooling/JSONCompilationDatabase.cpp
===================================================================
--- cfe/trunk/lib/Tooling/JSONCompilationDatabase.cpp
+++ cfe/trunk/lib/Tooling/JSONCompilationDatabase.cpp
@@ -370,6 +370,7 @@
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);
Index: cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp
===================================================================
--- cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp
+++ cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp
@@ -88,12 +88,17 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59079.189829.patch
Type: text/x-patch
Size: 1739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190308/7d3c9729/attachment.bin>
More information about the llvm-commits
mailing list