[lldb][dwarf] Compute fully qualified names on simplified template names with DWARFT...
[llvm-project.git] / lldb / source / Interpreter / OptionValueSInt64.cpp
blobdf7aee99e212c546a8f46087c6124bb75adcbce1
1 //===-- OptionValueSInt64.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 //===----------------------------------------------------------------------===//
9 #include "lldb/Interpreter/OptionValueSInt64.h"
11 #include "lldb/Utility/Stream.h"
13 using namespace lldb;
14 using namespace lldb_private;
16 void OptionValueSInt64::DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
17 uint32_t dump_mask) {
18 // printf ("%p: DumpValue (exe_ctx=%p, strm, mask) m_current_value = %"
19 // PRIi64
20 // "\n", this, exe_ctx, m_current_value);
21 if (dump_mask & eDumpOptionType)
22 strm.Printf("(%s)", GetTypeAsCString());
23 // if (dump_mask & eDumpOptionName)
24 // DumpQualifiedName (strm);
25 if (dump_mask & eDumpOptionValue) {
26 if (dump_mask & eDumpOptionType)
27 strm.PutCString(" = ");
28 strm.Printf("%" PRIi64, m_current_value);
32 Status OptionValueSInt64::SetValueFromString(llvm::StringRef value_ref,
33 VarSetOperationType op) {
34 Status error;
35 switch (op) {
36 case eVarSetOperationClear:
37 Clear();
38 NotifyValueChanged();
39 break;
41 case eVarSetOperationReplace:
42 case eVarSetOperationAssign: {
43 llvm::StringRef value_trimmed = value_ref.trim();
44 int64_t value;
45 if (llvm::to_integer(value_trimmed, value)) {
46 if (value >= m_min_value && value <= m_max_value) {
47 m_value_was_set = true;
48 m_current_value = value;
49 NotifyValueChanged();
50 } else
51 error = Status::FromErrorStringWithFormat(
52 "%" PRIi64 " is out of range, valid values must be between %" PRIi64
53 " and %" PRIi64 ".",
54 value, m_min_value, m_max_value);
55 } else {
56 error = Status::FromErrorStringWithFormat(
57 "invalid int64_t string value: '%s'", value_ref.str().c_str());
59 } break;
61 case eVarSetOperationInsertBefore:
62 case eVarSetOperationInsertAfter:
63 case eVarSetOperationRemove:
64 case eVarSetOperationAppend:
65 case eVarSetOperationInvalid:
66 error = OptionValue::SetValueFromString(value_ref, op);
67 break;
69 return error;