[lldb][NFC] Fix all formatting errors in .cpp file headers
Summary:
A *.cpp file header in LLDB (and in LLDB) should like this:
```
//===-- TestUtilities.cpp -------------------------------------------------===//
```
However in LLDB most of our source files have arbitrary changes to this format and
these changes are spreading through LLDB as folks usually just use the existing
source files as templates for their new files (most notably the unnecessary
editor language indicator `-*- C++ -*-` is spreading and in every review
someone is pointing out that this is wrong, resulting in people pointing out that this
is done in the same way in other files).
This patch removes most of these inconsistencies including the editor language indicators,
all the different missing/additional '-' characters, files that center the file name, missing
trailing `===//` (mostly caused by clang-format breaking the line).
Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73258
2020-01-24 15:23:27 +08:00
|
|
|
//===-- OptionValueSInt64.cpp ---------------------------------------------===//
|
2012-08-23 01:17:09 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2012-08-23 01:17:09 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/Interpreter/OptionValueSInt64.h"
|
|
|
|
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/Stream.h"
|
2012-08-23 01:17:09 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
void OptionValueSInt64::DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
|
|
|
|
uint32_t dump_mask) {
|
2018-05-01 00:49:04 +08:00
|
|
|
// printf ("%p: DumpValue (exe_ctx=%p, strm, mask) m_current_value = %"
|
|
|
|
// PRIi64
|
2012-11-30 05:49:15 +08:00
|
|
|
// "\n", this, exe_ctx, m_current_value);
|
2012-08-23 01:17:09 +08:00
|
|
|
if (dump_mask & eDumpOptionType)
|
|
|
|
strm.Printf("(%s)", GetTypeAsCString());
|
|
|
|
// if (dump_mask & eDumpOptionName)
|
|
|
|
// DumpQualifiedName (strm);
|
|
|
|
if (dump_mask & eDumpOptionValue) {
|
|
|
|
if (dump_mask & eDumpOptionType)
|
|
|
|
strm.PutCString(" = ");
|
2012-11-30 05:49:15 +08:00
|
|
|
strm.Printf("%" PRIi64, m_current_value);
|
2012-08-23 01:17:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status OptionValueSInt64::SetValueFromString(llvm::StringRef value_ref,
|
|
|
|
VarSetOperationType op) {
|
|
|
|
Status error;
|
2012-08-23 01:17:09 +08:00
|
|
|
switch (op) {
|
|
|
|
case eVarSetOperationClear:
|
|
|
|
Clear();
|
2015-01-14 05:13:08 +08:00
|
|
|
NotifyValueChanged();
|
2012-08-23 01:17:09 +08:00
|
|
|
break;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-08-23 01:17:09 +08:00
|
|
|
case eVarSetOperationReplace:
|
|
|
|
case eVarSetOperationAssign: {
|
2021-09-25 05:36:49 +08:00
|
|
|
llvm::StringRef value_trimmed = value_ref.trim();
|
|
|
|
int64_t value;
|
|
|
|
if (llvm::to_integer(value_trimmed, value)) {
|
2012-08-23 01:17:09 +08:00
|
|
|
if (value >= m_min_value && value <= m_max_value) {
|
|
|
|
m_value_was_set = true;
|
|
|
|
m_current_value = value;
|
2015-01-14 05:13:08 +08:00
|
|
|
NotifyValueChanged();
|
2012-08-23 01:17:09 +08:00
|
|
|
} else
|
2012-11-30 05:49:15 +08:00
|
|
|
error.SetErrorStringWithFormat(
|
|
|
|
"%" PRIi64 " is out of range, valid values must be between %" PRIi64
|
2012-08-23 01:17:09 +08:00
|
|
|
" and %" PRIi64 ".",
|
|
|
|
value, m_min_value, m_max_value);
|
|
|
|
} else {
|
2015-02-20 19:14:59 +08:00
|
|
|
error.SetErrorStringWithFormat("invalid int64_t string value: '%s'",
|
|
|
|
value_ref.str().c_str());
|
2012-08-23 01:17:09 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
} break;
|
|
|
|
|
2012-08-23 01:17:09 +08:00
|
|
|
case eVarSetOperationInsertBefore:
|
|
|
|
case eVarSetOperationInsertAfter:
|
|
|
|
case eVarSetOperationRemove:
|
|
|
|
case eVarSetOperationAppend:
|
|
|
|
case eVarSetOperationInvalid:
|
2015-02-20 19:14:59 +08:00
|
|
|
error = OptionValue::SetValueFromString(value_ref, op);
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
}
|
2012-08-23 01:17:09 +08:00
|
|
|
return error;
|
|
|
|
}
|