[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
|
|
|
//===-- UserSettingsController.cpp ----------------------------------------===//
|
2010-09-04 08:03:46 +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
|
2010-09-04 08:03:46 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/Core/UserSettingsController.h"
|
2017-04-07 05:28:29 +08:00
|
|
|
|
2015-03-04 09:58:01 +08:00
|
|
|
#include "lldb/Interpreter/OptionValueProperties.h"
|
2017-05-12 12:51:55 +08:00
|
|
|
#include "lldb/Utility/Status.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/Stream.h"
|
2017-04-07 05:28:29 +08:00
|
|
|
|
2018-11-12 07:16:43 +08:00
|
|
|
#include <memory>
|
2017-04-07 05:28:29 +08:00
|
|
|
|
|
|
|
namespace lldb_private {
|
|
|
|
class CommandInterpreter;
|
|
|
|
}
|
|
|
|
namespace lldb_private {
|
|
|
|
class ConstString;
|
|
|
|
}
|
|
|
|
namespace lldb_private {
|
|
|
|
class ExecutionContext;
|
|
|
|
}
|
|
|
|
namespace lldb_private {
|
|
|
|
class Property;
|
|
|
|
}
|
2010-09-04 08:03:46 +08:00
|
|
|
|
2011-02-18 09:44:25 +08:00
|
|
|
using namespace lldb;
|
2010-09-04 08:03:46 +08:00
|
|
|
using namespace lldb_private;
|
|
|
|
|
2012-08-23 01:17:09 +08:00
|
|
|
lldb::OptionValueSP
|
2017-05-12 12:51:55 +08:00
|
|
|
Properties::GetPropertyValue(const ExecutionContext *exe_ctx,
|
|
|
|
llvm::StringRef path, bool will_modify,
|
|
|
|
Status &error) const {
|
2012-08-23 01:17:09 +08:00
|
|
|
OptionValuePropertiesSP properties_sp(GetValueProperties());
|
|
|
|
if (properties_sp)
|
|
|
|
return properties_sp->GetSubValue(exe_ctx, path, will_modify, error);
|
|
|
|
return lldb::OptionValueSP();
|
2011-04-23 10:04:55 +08:00
|
|
|
}
|
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status Properties::SetPropertyValue(const ExecutionContext *exe_ctx,
|
|
|
|
VarSetOperationType op,
|
|
|
|
llvm::StringRef path,
|
|
|
|
llvm::StringRef value) {
|
2012-08-23 01:17:09 +08:00
|
|
|
OptionValuePropertiesSP properties_sp(GetValueProperties());
|
|
|
|
if (properties_sp)
|
|
|
|
return properties_sp->SetSubValue(exe_ctx, op, path, value);
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error;
|
2012-08-23 01:17:09 +08:00
|
|
|
error.SetErrorString("no properties");
|
2011-04-23 10:04:55 +08:00
|
|
|
return error;
|
|
|
|
}
|
2010-09-04 08:03:46 +08:00
|
|
|
|
2012-08-23 01:17:09 +08:00
|
|
|
void Properties::DumpAllPropertyValues(const ExecutionContext *exe_ctx,
|
|
|
|
Stream &strm, uint32_t dump_mask) {
|
|
|
|
OptionValuePropertiesSP properties_sp(GetValueProperties());
|
|
|
|
if (properties_sp)
|
|
|
|
return properties_sp->DumpValue(exe_ctx, strm, dump_mask);
|
2010-09-04 08:03:46 +08:00
|
|
|
}
|
|
|
|
|
2012-08-23 01:17:09 +08:00
|
|
|
void Properties::DumpAllDescriptions(CommandInterpreter &interpreter,
|
|
|
|
Stream &strm) const {
|
|
|
|
strm.PutCString("Top level variables:\n\n");
|
2010-09-04 08:03:46 +08:00
|
|
|
|
2012-08-23 01:17:09 +08:00
|
|
|
OptionValuePropertiesSP properties_sp(GetValueProperties());
|
|
|
|
if (properties_sp)
|
|
|
|
return properties_sp->DumpAllDescriptions(interpreter, strm);
|
2010-09-04 08:03:46 +08:00
|
|
|
}
|
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status Properties::DumpPropertyValue(const ExecutionContext *exe_ctx,
|
|
|
|
Stream &strm,
|
|
|
|
llvm::StringRef property_path,
|
|
|
|
uint32_t dump_mask) {
|
2012-08-23 01:17:09 +08:00
|
|
|
OptionValuePropertiesSP properties_sp(GetValueProperties());
|
|
|
|
if (properties_sp) {
|
|
|
|
return properties_sp->DumpPropertyValue(exe_ctx, strm, property_path,
|
|
|
|
dump_mask);
|
2010-09-15 13:35:14 +08:00
|
|
|
}
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error;
|
2012-08-23 01:17:09 +08:00
|
|
|
error.SetErrorString("empty property list");
|
|
|
|
return error;
|
2010-09-15 13:35:14 +08:00
|
|
|
}
|
|
|
|
|
2012-08-23 01:17:09 +08:00
|
|
|
size_t
|
2016-11-17 05:45:04 +08:00
|
|
|
Properties::Apropos(llvm::StringRef keyword,
|
2012-08-23 01:17:09 +08:00
|
|
|
std::vector<const Property *> &matching_properties) const {
|
|
|
|
OptionValuePropertiesSP properties_sp(GetValueProperties());
|
|
|
|
if (properties_sp) {
|
|
|
|
properties_sp->Apropos(keyword, matching_properties);
|
2012-01-30 15:41:31 +08:00
|
|
|
}
|
2012-08-23 01:17:09 +08:00
|
|
|
return matching_properties.size();
|
2012-01-28 05:27:39 +08:00
|
|
|
}
|
2012-10-20 02:02:49 +08:00
|
|
|
|
|
|
|
lldb::OptionValuePropertiesSP
|
|
|
|
Properties::GetSubProperty(const ExecutionContext *exe_ctx,
|
2019-03-07 05:22:25 +08:00
|
|
|
ConstString name) {
|
2012-10-20 02:02:49 +08:00
|
|
|
OptionValuePropertiesSP properties_sp(GetValueProperties());
|
|
|
|
if (properties_sp)
|
|
|
|
return properties_sp->GetSubProperty(exe_ctx, name);
|
|
|
|
return lldb::OptionValuePropertiesSP();
|
|
|
|
}
|
|
|
|
|
2016-07-06 09:27:33 +08:00
|
|
|
const char *Properties::GetExperimentalSettingsName() { return "experimental"; }
|
|
|
|
|
2016-11-18 02:08:12 +08:00
|
|
|
bool Properties::IsSettingExperimental(llvm::StringRef setting) {
|
|
|
|
if (setting.empty())
|
2016-07-06 09:27:33 +08:00
|
|
|
return false;
|
|
|
|
|
2016-11-18 02:08:12 +08:00
|
|
|
llvm::StringRef experimental = GetExperimentalSettingsName();
|
|
|
|
size_t dot_pos = setting.find_first_of('.');
|
|
|
|
return setting.take_front(dot_pos) == experimental;
|
2016-07-06 09:27:33 +08:00
|
|
|
}
|