[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
|
|
|
//===-- OptionGroupUUID.cpp -----------------------------------------------===//
|
2011-05-04 06:09:39 +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
|
2011-05-04 06:09:39 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2011-05-14 04:21:08 +08:00
|
|
|
#include "lldb/Interpreter/OptionGroupUUID.h"
|
2011-05-04 06:09:39 +08:00
|
|
|
|
2017-03-23 07:33:16 +08:00
|
|
|
#include "lldb/Host/OptionParser.h"
|
2011-05-04 06:09:39 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2018-09-27 02:50:19 +08:00
|
|
|
static constexpr OptionDefinition g_option_table[] = {
|
2014-07-10 00:31:49 +08:00
|
|
|
{LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eRequiredArgument,
|
2020-08-11 18:29:25 +08:00
|
|
|
nullptr, {}, 0, eArgTypeModuleUUID, "A module UUID value."},
|
2011-05-04 06:09:39 +08:00
|
|
|
};
|
|
|
|
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
llvm::ArrayRef<OptionDefinition> OptionGroupUUID::GetDefinitions() {
|
2016-09-23 05:06:13 +08:00
|
|
|
return llvm::makeArrayRef(g_option_table);
|
2011-05-04 06:09:39 +08:00
|
|
|
}
|
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status OptionGroupUUID::SetOptionValue(uint32_t option_idx,
|
|
|
|
llvm::StringRef option_arg,
|
|
|
|
ExecutionContext *execution_context) {
|
|
|
|
Status error;
|
2012-12-04 08:32:51 +08:00
|
|
|
const int short_option = g_option_table[option_idx].short_option;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-05-04 06:09:39 +08:00
|
|
|
switch (short_option) {
|
|
|
|
case 'u':
|
2015-02-20 19:14:59 +08:00
|
|
|
error = m_uuid.SetValueFromString(option_arg);
|
2011-09-30 09:05:23 +08:00
|
|
|
if (error.Success())
|
|
|
|
m_uuid.SetOptionWasSet();
|
2011-05-04 06:09:39 +08:00
|
|
|
break;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-05-04 06:09:39 +08:00
|
|
|
default:
|
2019-08-22 16:08:05 +08:00
|
|
|
llvm_unreachable("Unimplemented option");
|
2011-05-04 06:09:39 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-05-04 06:09:39 +08:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2016-08-12 07:51:28 +08:00
|
|
|
void OptionGroupUUID::OptionParsingStarting(
|
|
|
|
ExecutionContext *execution_context) {
|
2011-05-04 06:09:39 +08:00
|
|
|
m_uuid.Clear();
|
|
|
|
}
|