2019-05-13 12:42:32 +08:00
|
|
|
//===-- MockTildeExpressionResolver.h ---------------------------*- C++ -*-===//
|
2017-03-23 01:33:23 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2017-03-23 01:33:23 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLDB_UNITTESTS_UTILITY_MOCKS_MOCK_TILDE_EXPRESSION_RESOLVER_H
|
|
|
|
#define LLDB_UNITTESTS_UTILITY_MOCKS_MOCK_TILDE_EXPRESSION_RESOLVER_H
|
|
|
|
|
|
|
|
#include "lldb/Utility/TildeExpressionResolver.h"
|
|
|
|
|
|
|
|
#include "llvm/ADT/SmallString.h"
|
|
|
|
#include "llvm/ADT/StringMap.h"
|
|
|
|
|
|
|
|
namespace lldb_private {
|
|
|
|
class MockTildeExpressionResolver : public TildeExpressionResolver {
|
|
|
|
llvm::StringRef CurrentUser;
|
|
|
|
llvm::StringMap<llvm::StringRef> UserDirectories;
|
|
|
|
|
|
|
|
public:
|
2018-11-09 09:59:28 +08:00
|
|
|
MockTildeExpressionResolver(llvm::StringRef CurrentUser,
|
2017-03-23 01:33:23 +08:00
|
|
|
llvm::StringRef HomeDir);
|
|
|
|
|
|
|
|
void AddKnownUser(llvm::StringRef User, llvm::StringRef HomeDir);
|
|
|
|
void Clear();
|
|
|
|
void SetCurrentUser(llvm::StringRef User);
|
|
|
|
|
|
|
|
bool ResolveExact(llvm::StringRef Expr,
|
|
|
|
llvm::SmallVectorImpl<char> &Output) override;
|
|
|
|
bool ResolvePartial(llvm::StringRef Expr, llvm::StringSet<> &Output) override;
|
|
|
|
};
|
2017-06-29 21:02:11 +08:00
|
|
|
} // namespace lldb_private
|
2017-03-23 01:33:23 +08:00
|
|
|
|
|
|
|
#endif
|