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 char ToChar(llvm::StringRef s, char fail_value, bool *success_ptr);
33
34 static int64_t ToOptionEnum(llvm::StringRef s,
35 const OptionEnumValues &enum_values,
36 int32_t fail_value, Status &error);
37
38 static lldb::ScriptLanguage ToScriptLanguage(llvm::StringRef s,
39 lldb::ScriptLanguage fail_value,
40 bool *success_ptr);
41
42 // TODO: Use StringRef
43 static Status ToFormat(const char *s, lldb::Format &format,
44 size_t *byte_size_ptr); // If non-NULL, then a
45 // byte size can precede
46 // the format character
47
48private:
49 static std::optional<lldb::addr_t>
50 DoToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s,
51 Status *error);
52};
53
54} // namespace lldb_private
55
56#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.
Definition: SBAttachInfo.h:14
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues
ScriptLanguage
Script interpreter types.
Format
Display format definitions.
uint64_t addr_t
Definition: lldb-types.h:79
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)