summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility/TildeExpressionResolver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Utility/TildeExpressionResolver.cpp')
-rw-r--r--lldb/source/Utility/TildeExpressionResolver.cpp66
1 files changed, 0 insertions, 66 deletions
diff --git a/lldb/source/Utility/TildeExpressionResolver.cpp b/lldb/source/Utility/TildeExpressionResolver.cpp
deleted file mode 100644
index c33f0bf806f..00000000000
--- a/lldb/source/Utility/TildeExpressionResolver.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-//===--------------------- TildeExpressionResolver.cpp ----------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Utility/TildeExpressionResolver.h"
-
-#include "llvm/ADT/SmallString.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/Path.h"
-
-using namespace lldb_private;
-using namespace llvm;
-
-namespace fs = llvm::sys::fs;
-namespace path = llvm::sys::path;
-
-TildeExpressionResolver::~TildeExpressionResolver() {}
-
-bool StandardTildeExpressionResolver::ResolveExact(
- StringRef Expr, SmallVectorImpl<char> &Output) {
- // We expect the tilde expression to be ONLY the expression itself, and
- // contain
- // no separators.
- assert(!llvm::any_of(Expr, path::is_separator));
- assert(Expr.empty() || Expr[0] == '~');
-
- return !fs::real_path(Expr, Output, true);
-}
-
-bool StandardTildeExpressionResolver::ResolvePartial(StringRef Expr,
- StringSet<> &Output) {
- // We expect the tilde expression to be ONLY the expression itself, and
- // contain no separators.
- assert(!llvm::any_of(Expr, path::is_separator));
- assert(Expr.empty() || Expr[0] == '~');
-
- Output.clear();
-#if defined(LLVM_ON_WIN32)
- return false;
-#else
- if (Expr.empty())
- return false;
-
- SmallString<32> Buffer = "~";
- setpwent();
- struct passwd *user_entry;
- Expr = Expr.drop_front();
-
- while ((user_entry = getpwent()) != NULL) {
- StringRef ThisName(user_entry->pw_name);
- if (!ThisName.startswith(Expr))
- continue;
-
- Buffer.resize(1);
- Buffer.append(ThisName);
- Buffer.append(path::get_separator()) Output.insert(Buffer);
- }
-
- return true;
-#endif
-}
OpenPOWER on IntegriCloud