[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
|
|
|
//===-- OptionValueUInt64.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/OptionValueUInt64.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;
|
|
|
|
|
2016-09-24 01:48:13 +08:00
|
|
|
lldb::OptionValueSP OptionValueUInt64::Create(llvm::StringRef value_str,
|
2017-05-12 12:51:55 +08:00
|
|
|
Status &error) {
|
2012-08-23 01:17:09 +08:00
|
|
|
lldb::OptionValueSP value_sp(new OptionValueUInt64());
|
2016-09-24 01:48:13 +08:00
|
|
|
error = value_sp->SetValueFromString(value_str);
|
2012-08-23 01:17:09 +08:00
|
|
|
if (error.Fail())
|
|
|
|
value_sp.reset();
|
|
|
|
return value_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OptionValueUInt64::DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
|
|
|
|
uint32_t dump_mask) {
|
|
|
|
if (dump_mask & eDumpOptionType)
|
|
|
|
strm.Printf("(%s)", GetTypeAsCString());
|
|
|
|
if (dump_mask & eDumpOptionValue) {
|
|
|
|
if (dump_mask & eDumpOptionType)
|
|
|
|
strm.PutCString(" = ");
|
2012-11-30 05:49:15 +08:00
|
|
|
strm.Printf("%" PRIu64, m_current_value);
|
2012-08-23 01:17:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status OptionValueUInt64::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();
|
|
|
|
uint64_t value;
|
|
|
|
if (llvm::to_integer(value_trimmed, value)) {
|
2012-08-23 01:17:09 +08:00
|
|
|
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 {
|
2015-02-20 19:14:59 +08:00
|
|
|
error.SetErrorStringWithFormat("invalid uint64_t string value: '%s'",
|
2021-09-25 05:36:49 +08:00
|
|
|
value_ref.str().c_str());
|
2012-08-23 01:17:09 +08:00
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case eVarSetOperationInsertBefore:
|
|
|
|
case eVarSetOperationInsertAfter:
|
|
|
|
case eVarSetOperationRemove:
|
|
|
|
case eVarSetOperationAppend:
|
|
|
|
case eVarSetOperationInvalid:
|
|
|
|
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;
|
|
|
|
}
|