[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 07:23:27 +00:00
|
|
|
//===-- OptionValueRegex.cpp ----------------------------------------------===//
|
2012-08-22 17:17:09 +00:00
|
|
|
//
|
2019-01-19 08:50:56 +00: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-22 17:17:09 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/Interpreter/OptionValueRegex.h"
|
|
|
|
|
2017-02-02 21:39:50 +00:00
|
|
|
#include "lldb/Utility/Stream.h"
|
2012-08-22 17:17:09 +00:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
void OptionValueRegex::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(" = ");
|
|
|
|
if (m_regex.IsValid()) {
|
2016-09-21 16:01:28 +00:00
|
|
|
llvm::StringRef regex_text = m_regex.GetText();
|
|
|
|
strm.Printf("%s", regex_text.str().c_str());
|
2012-08-22 17:17:09 +00:00
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2012-08-22 17:17:09 +00:00
|
|
|
}
|
|
|
|
|
2017-05-12 04:51:55 +00:00
|
|
|
Status OptionValueRegex::SetValueFromString(llvm::StringRef value,
|
|
|
|
VarSetOperationType op) {
|
|
|
|
Status error;
|
2012-08-22 17:17:09 +00:00
|
|
|
switch (op) {
|
|
|
|
case eVarSetOperationInvalid:
|
|
|
|
case eVarSetOperationInsertBefore:
|
|
|
|
case eVarSetOperationInsertAfter:
|
|
|
|
case eVarSetOperationRemove:
|
|
|
|
case eVarSetOperationAppend:
|
2015-02-20 11:14:59 +00:00
|
|
|
error = OptionValue::SetValueFromString(value, op);
|
2012-08-22 17:17:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case eVarSetOperationClear:
|
|
|
|
Clear();
|
2015-01-13 21:13:08 +00:00
|
|
|
NotifyValueChanged();
|
2012-08-22 17:17:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case eVarSetOperationReplace:
|
|
|
|
case eVarSetOperationAssign:
|
2019-08-20 09:24:20 +00:00
|
|
|
m_regex = RegularExpression(value);
|
|
|
|
if (m_regex.IsValid()) {
|
2012-08-22 17:17:09 +00:00
|
|
|
m_value_was_set = true;
|
2015-01-13 21:13:08 +00:00
|
|
|
NotifyValueChanged();
|
2019-08-16 21:25:36 +00:00
|
|
|
} else if (llvm::Error err = m_regex.GetError()) {
|
|
|
|
error.SetErrorString(llvm::toString(std::move(err)));
|
2012-08-22 17:17:09 +00:00
|
|
|
} else {
|
2019-08-16 21:25:36 +00:00
|
|
|
error.SetErrorString("regex error");
|
2012-08-22 17:17:09 +00:00
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-08-22 17:17:09 +00:00
|
|
|
return error;
|
|
|
|
}
|