summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/VirtualFileSystem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Basic/VirtualFileSystem.cpp')
-rw-r--r--clang/lib/Basic/VirtualFileSystem.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Basic/VirtualFileSystem.cpp b/clang/lib/Basic/VirtualFileSystem.cpp
index 3864b19767f..5486331d4af 100644
--- a/clang/lib/Basic/VirtualFileSystem.cpp
+++ b/clang/lib/Basic/VirtualFileSystem.cpp
@@ -528,6 +528,13 @@ void InMemoryFileSystem::addFile(const Twine &P, time_t ModificationTime,
}
}
+void InMemoryFileSystem::addFileNoOwn(const Twine &P, time_t ModificationTime,
+ llvm::MemoryBuffer *Buffer) {
+ return addFile(P, ModificationTime,
+ llvm::MemoryBuffer::getMemBuffer(
+ Buffer->getBuffer(), Buffer->getBufferIdentifier()));
+}
+
static ErrorOr<detail::InMemoryNode *>
lookupInMemoryNode(const InMemoryFileSystem &FS, detail::InMemoryDirectory *Dir,
const Twine &P) {
@@ -541,6 +548,15 @@ lookupInMemoryNode(const InMemoryFileSystem &FS, detail::InMemoryDirectory *Dir,
auto I = llvm::sys::path::begin(Path), E = llvm::sys::path::end(Path);
while (true) {
+ // Skip over ".".
+ // FIXME: Also handle "..".
+ if (*I == ".") {
+ ++I;
+ if (I == E)
+ return Dir;
+ continue;
+ }
+
detail::InMemoryNode *Node = Dir->getChild(*I);
++I;
if (!Node)
OpenPOWER on IntegriCloud