aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/VirtualFileSystem.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-10-12 13:30:38 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-10-12 13:30:38 +0000
commit4ad1c43edd7108f7d8578f994e76be045987bae2 (patch)
tree15743dfa2db8b50712544e4d3851e499ec050039 /clang/lib/Basic/VirtualFileSystem.cpp
parent939724cd020b6172435a207e0e4d59dcab90048b (diff)
downloadllvm-4ad1c43edd7108f7d8578f994e76be045987bae2.zip
llvm-4ad1c43edd7108f7d8578f994e76be045987bae2.tar.gz
llvm-4ad1c43edd7108f7d8578f994e76be045987bae2.tar.bz2
[VFS] Don't try to be heroic with '.' in paths.
Actually the only special path we have to handle is ./foo, the rest is tricky to get right so do the same thing as the existing YAML vfs here. llvm-svn: 250036
Diffstat (limited to 'clang/lib/Basic/VirtualFileSystem.cpp')
-rw-r--r--clang/lib/Basic/VirtualFileSystem.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/clang/lib/Basic/VirtualFileSystem.cpp b/clang/lib/Basic/VirtualFileSystem.cpp
index cb09e2e..1b75fbe 100644
--- a/clang/lib/Basic/VirtualFileSystem.cpp
+++ b/clang/lib/Basic/VirtualFileSystem.cpp
@@ -10,7 +10,6 @@
//===----------------------------------------------------------------------===//
#include "clang/Basic/VirtualFileSystem.h"
-#include "clang/Basic/FileManager.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
@@ -497,12 +496,14 @@ void InMemoryFileSystem::addFile(const Twine &P, time_t ModificationTime,
assert(!EC);
(void)EC;
- FileManager::removeDotPaths(Path, /*RemoveDotDot=*/false);
- if (Path.empty())
- return;
-
detail::InMemoryDirectory *Dir = Root.get();
auto I = llvm::sys::path::begin(Path), E = llvm::sys::path::end(Path);
+ if (*I == ".")
+ ++I;
+
+ if (I == E)
+ return;
+
while (true) {
StringRef Name = *I;
detail::InMemoryNode *Node = Dir->getChild(Name);
@@ -556,11 +557,13 @@ lookupInMemoryNode(const InMemoryFileSystem &FS, detail::InMemoryDirectory *Dir,
assert(!EC);
(void)EC;
- FileManager::removeDotPaths(Path, /*RemoveDotDot=*/false);
- if (Path.empty())
+ auto I = llvm::sys::path::begin(Path), E = llvm::sys::path::end(Path);
+ if (*I == ".")
+ ++I;
+
+ if (I == E)
return Dir;
- auto I = llvm::sys::path::begin(Path), E = llvm::sys::path::end(Path);
while (true) {
detail::InMemoryNode *Node = Dir->getChild(*I);
++I;