LLDB mainline
OptionValueLanguage.cpp
Go to the documentation of this file.
1//===-- OptionValueLanguage.cpp -------------------------------------------===//
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
10
14#include "lldb/Utility/Args.h"
15#include "lldb/Utility/Stream.h"
16
17using namespace lldb;
18using namespace lldb_private;
19
21 Stream &strm, uint32_t dump_mask) {
22 if (dump_mask & eDumpOptionType)
23 strm.Printf("(%s)", GetTypeAsCString());
24 if (dump_mask & eDumpOptionValue) {
25 if (dump_mask & eDumpOptionType)
26 strm.PutCString(" = ");
29 }
30}
31
32llvm::json::Value OptionValueLanguage::ToJSON(const ExecutionContext *exe_ctx) {
34}
35
39 switch (op) {
41 Clear();
42 break;
43
48 if (new_type && languages_for_types[new_type]) {
49 m_value_was_set = true;
50 m_current_value = new_type;
51 } else {
52 StreamString error_strm;
53 error_strm.Printf("invalid language type '%s', ", value.str().c_str());
54 error_strm.Printf("valid values are:\n");
55 for (int bit : languages_for_types.bitvector.set_bits()) {
56 auto language = (LanguageType)bit;
57 error_strm.Printf(" %s\n",
59 }
60 error.SetErrorString(error_strm.GetString());
61 }
62 } break;
63
70 break;
71 }
72 return error;
73}
static llvm::raw_ostream & error(Stream &strm)
#define bit
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
static LanguageSet GetLanguagesSupportingTypeSystems()
Definition: Language.cpp:424
static const char * GetNameForLanguageType(lldb::LanguageType language)
Definition: Language.cpp:266
static lldb::LanguageType GetLanguageTypeFromString(const char *string)=delete
llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
virtual Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign)
virtual const char * GetTypeAsCString() const
Definition: OptionValue.h:87
An error handling class.
Definition: Status.h:44
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:134
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:65
A class that represents a running process on the host machine.
VarSetOperationType
Settable state variable types.
Definition: SBAddress.h:15
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition: Type.h:38
llvm::SmallBitVector bitvector
Definition: Type.h:39