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
15#include "lldb/Utility/Args.h"
16#include "lldb/Utility/Stream.h"
17
18using namespace lldb;
19using namespace lldb_private;
20
22 Stream &strm, uint32_t dump_mask) {
23 if (dump_mask & eDumpOptionType)
24 strm.Printf("(%s)", GetTypeAsCString());
25 if (dump_mask & eDumpOptionValue) {
26 if (dump_mask & eDumpOptionType)
27 strm.PutCString(" = ");
30 if (dump_mask & eDumpOptionDefaultValue &&
33 DefaultValueFormat label(strm);
35 }
36 }
37}
38
39llvm::json::Value
43
47 switch (op) {
49 Clear();
50 break;
51
56 if (new_type && languages_for_types[new_type]) {
57 m_value_was_set = true;
58 m_current_value = new_type;
59 } else {
60 StreamString error_strm;
61 error_strm.Printf("invalid language type '%s', ", value.str().c_str());
62 error_strm.Printf("valid values are:\n");
63 for (int bit : languages_for_types.bitvector.set_bits()) {
64 auto language = (LanguageType)bit;
65 error_strm.Printf(" %s\n",
67 }
68 error = Status(error_strm.GetString().str());
69 }
70 } break;
71
78 break;
79 }
80 return error;
81}
static llvm::raw_ostream & error(Stream &strm)
"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) const 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:89
An error handling class.
Definition Status.h:118
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.
static uint32_t bit(const uint32_t val, const uint32_t msbit)
Definition ARMUtils.h:270
VarSetOperationType
Settable state variable types.
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