Fixed file completion for paths that start with '~'.

We didn't add the remaining path behind the '~' to the completion string,
causing it to just complete directories inside the user home directory. This
patch just adds the directory of the remaining path if there is one.

Fixes rdar://problem/40147002

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@334978 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandCompletions.cpp b/source/Commands/CommandCompletions.cpp
index b141833..dbb0b7e 100644
--- a/source/Commands/CommandCompletions.cpp
+++ b/source/Commands/CommandCompletions.cpp
@@ -164,6 +164,12 @@
     // search in the fully resolved directory, but CompletionBuffer keeps the
     // unmodified form that the user typed.
     Storage = Resolved;
+    llvm::StringRef RemainderDir = path::parent_path(Remainder.str());
+    if (!RemainderDir.empty()) {
+      // Append the remaining path to the resolved directory.
+      Storage.append(path::get_separator());
+      Storage.append(RemainderDir);
+    }
     SearchDir = Storage;
   } else {
     SearchDir = path::parent_path(CompletionBuffer);