aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/FileCollector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/FileCollector.cpp')
-rw-r--r--llvm/lib/Support/FileCollector.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Support/FileCollector.cpp b/llvm/lib/Support/FileCollector.cpp
index d0471ac..cb53878 100644
--- a/llvm/lib/Support/FileCollector.cpp
+++ b/llvm/lib/Support/FileCollector.cpp
@@ -86,17 +86,18 @@ void FileCollector::addFileImpl(StringRef SrcPath) {
sys::path::native(AbsoluteSrc);
// Remove redundant leading "./" pieces and consecutive separators.
- AbsoluteSrc = sys::path::remove_leading_dotslash(AbsoluteSrc);
+ StringRef TrimmedAbsoluteSrc =
+ sys::path::remove_leading_dotslash(AbsoluteSrc);
// Canonicalize the source path by removing "..", "." components.
- SmallString<256> VirtualPath = AbsoluteSrc;
+ SmallString<256> VirtualPath = TrimmedAbsoluteSrc;
sys::path::remove_dots(VirtualPath, /*remove_dot_dot=*/true);
// If a ".." component is present after a symlink component, remove_dots may
// lead to the wrong real destination path. Let the source be canonicalized
// like that but make sure we always use the real path for the destination.
SmallString<256> CopyFrom;
- if (!getRealPath(AbsoluteSrc, CopyFrom))
+ if (!getRealPath(TrimmedAbsoluteSrc, CopyFrom))
CopyFrom = VirtualPath;
SmallString<256> DstPath = StringRef(Root);