LLDB mainline
OptionArgParser.h
Go to the documentation of this file.
1//===-- OptionArgParser.h ---------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_INTERPRETER_OPTIONARGPARSER_H
10#define LLDB_INTERPRETER_OPTIONARGPARSER_H
11
13
14#include <optional>
15
16namespace lldb_private {
17
19 /// Try to parse an address. If it succeeds return the address with the
20 /// non-address bits removed.
21 static lldb::addr_t ToAddress(const ExecutionContext *exe_ctx,
22 llvm::StringRef s, lldb::addr_t fail_value,
23 Status *error_ptr);
24
25 /// As for ToAddress but do not remove non-address bits from the result.
26 static lldb::addr_t ToRawAddress(const ExecutionContext *exe_ctx,
27 llvm::StringRef s, lldb::addr_t fail_value,
28 Status *error_ptr);
29
30 static bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr);
31
32 static llvm::Expected<bool> ToBoolean(llvm::StringRef option_name,
33 llvm::StringRef option_arg);
34
35 static char ToChar(llvm::StringRef s, char fail_value, bool *success_ptr);
36
37 static int64_t ToOptionEnum(llvm::StringRef s,
38 const OptionEnumValues &enum_values,
39 int32_t fail_value, Status &error);
40
41 static lldb::ScriptLanguage ToScriptLanguage(llvm::StringRef s,
42 lldb::ScriptLanguage fail_value,
43 bool *success_ptr);
44
45 // TODO: Use StringRef
46 static Status ToFormat(const char *s, lldb::Format &format,
47 size_t *byte_size_ptr); // If non-NULL, then a
48 // byte size can precede
49 // the format character
50
51private:
52 static std::optional<lldb::addr_t>
53 DoToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s,
54 Status *error);
55};
56
57} // namespace lldb_private
58
59#endif // LLDB_INTERPRETER_OPTIONARGPARSER_H
static llvm::raw_ostream & error(Stream &strm)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
An error handling class.
Definition: Status.h:44
A class that represents a running process on the host machine.
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues
ScriptLanguage
Script interpreter types.
Format
Display format definitions.
uint64_t addr_t
Definition: lldb-types.h:80
static int64_t ToOptionEnum(llvm::StringRef s, const OptionEnumValues &enum_values, int32_t fail_value, Status &error)
static lldb::ScriptLanguage ToScriptLanguage(llvm::StringRef s, lldb::ScriptLanguage fail_value, bool *success_ptr)
static char ToChar(llvm::StringRef s, char fail_value, bool *success_ptr)
static lldb::addr_t ToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, lldb::addr_t fail_value, Status *error_ptr)
Try to parse an address.
static lldb::addr_t ToRawAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, lldb::addr_t fail_value, Status *error_ptr)
As for ToAddress but do not remove non-address bits from the result.
static std::optional< lldb::addr_t > DoToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, Status *error)
static Status ToFormat(const char *s, lldb::Format &format, size_t *byte_size_ptr)
static bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr)