[Lldb-commits] [lldb] 99614d4 - [lldb-vscode] NFC: clang format
Walter Erquinigo via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 17 09:18:40 PDT 2020
Author: Walter Erquinigo
Date: 2020-08-17T09:18:01-07:00
New Revision: 99614d410cefeb4606232e78cdcf8cf7b2620f79
URL: https://github.com/llvm/llvm-project/commit/99614d410cefeb4606232e78cdcf8cf7b2620f79
DIFF: https://github.com/llvm/llvm-project/commit/99614d410cefeb4606232e78cdcf8cf7b2620f79.diff
LOG: [lldb-vscode] NFC: clang format
Run clang-format on all the c++ file of this project.
Added:
Modified:
lldb/tools/lldb-vscode/ExceptionBreakpoint.h
lldb/tools/lldb-vscode/FunctionBreakpoint.cpp
lldb/tools/lldb-vscode/JSONUtils.h
lldb/tools/lldb-vscode/SourceBreakpoint.h
lldb/tools/lldb-vscode/VSCode.cpp
lldb/tools/lldb-vscode/VSCode.h
lldb/tools/lldb-vscode/lldb-vscode.cpp
Removed:
################################################################################
diff --git a/lldb/tools/lldb-vscode/ExceptionBreakpoint.h b/lldb/tools/lldb-vscode/ExceptionBreakpoint.h
index 75c617832e08..203630ccf40a 100644
--- a/lldb/tools/lldb-vscode/ExceptionBreakpoint.h
+++ b/lldb/tools/lldb-vscode/ExceptionBreakpoint.h
@@ -21,12 +21,9 @@ struct ExceptionBreakpoint {
lldb::LanguageType language;
bool default_value;
lldb::SBBreakpoint bp;
- ExceptionBreakpoint(std::string f, std::string l, lldb::LanguageType lang) :
- filter(std::move(f)),
- label(std::move(l)),
- language(lang),
- default_value(false),
- bp() {}
+ ExceptionBreakpoint(std::string f, std::string l, lldb::LanguageType lang)
+ : filter(std::move(f)), label(std::move(l)), language(lang),
+ default_value(false), bp() {}
void SetBreakpoint();
void ClearBreakpoint();
diff --git a/lldb/tools/lldb-vscode/FunctionBreakpoint.cpp b/lldb/tools/lldb-vscode/FunctionBreakpoint.cpp
index 9dd97e7b79e0..e7720a1bc849 100644
--- a/lldb/tools/lldb-vscode/FunctionBreakpoint.cpp
+++ b/lldb/tools/lldb-vscode/FunctionBreakpoint.cpp
@@ -27,4 +27,4 @@ void FunctionBreakpoint::SetBreakpoint() {
SetHitCondition();
}
-}
+} // namespace lldb_vscode
diff --git a/lldb/tools/lldb-vscode/JSONUtils.h b/lldb/tools/lldb-vscode/JSONUtils.h
index e2ccfdb1fb2b..df4428f390ba 100644
--- a/lldb/tools/lldb-vscode/JSONUtils.h
+++ b/lldb/tools/lldb-vscode/JSONUtils.h
@@ -9,11 +9,11 @@
#ifndef LLDB_TOOLS_LLDB_VSCODE_JSONUTILS_H
#define LLDB_TOOLS_LLDB_VSCODE_JSONUTILS_H
-#include <stdint.h>
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/JSON.h"
#include "VSCodeForward.h"
#include "lldb/API/SBModule.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/JSON.h"
+#include <stdint.h>
namespace lldb_vscode {
diff --git a/lldb/tools/lldb-vscode/SourceBreakpoint.h b/lldb/tools/lldb-vscode/SourceBreakpoint.h
index 95f192beff81..2891d57ee8ad 100644
--- a/lldb/tools/lldb-vscode/SourceBreakpoint.h
+++ b/lldb/tools/lldb-vscode/SourceBreakpoint.h
@@ -9,8 +9,8 @@
#ifndef LLDB_TOOLS_LLDB_VSCODE_SOURCEBREAKPOINT_H
#define LLDB_TOOLS_LLDB_VSCODE_SOURCEBREAKPOINT_H
-#include "llvm/ADT/StringRef.h"
#include "BreakpointBase.h"
+#include "llvm/ADT/StringRef.h"
namespace lldb_vscode {
diff --git a/lldb/tools/lldb-vscode/VSCode.cpp b/lldb/tools/lldb-vscode/VSCode.cpp
index 4a30aef3a6db..537cae786863 100644
--- a/lldb/tools/lldb-vscode/VSCode.cpp
+++ b/lldb/tools/lldb-vscode/VSCode.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
-#include <stdarg.h>
#include <fstream>
#include <mutex>
+#include <stdarg.h>
#include "LLDBUtils.h"
#include "VSCode.h"
@@ -16,9 +16,9 @@
#if defined(_WIN32)
#define NOMINMAX
-#include <windows.h>
#include <fcntl.h>
#include <io.h>
+#include <windows.h>
#endif
using namespace lldb_vscode;
@@ -41,9 +41,9 @@ VSCode::VSCode()
stop_at_entry(false), is_attach(false) {
const char *log_file_path = getenv("LLDBVSCODE_LOG");
#if defined(_WIN32)
-// Windows opens stdout and stdin in text mode which converts \n to 13,10
-// while the value is just 10 on Darwin/Linux. Setting the file mode to binary
-// fixes this.
+ // Windows opens stdout and stdin in text mode which converts \n to 13,10
+ // while the value is just 10 on Darwin/Linux. Setting the file mode to binary
+ // fixes this.
int result = _setmode(fileno(stdout), _O_BINARY);
assert(result);
result = _setmode(fileno(stdin), _O_BINARY);
@@ -54,8 +54,7 @@ VSCode::VSCode()
log.reset(new std::ofstream(log_file_path));
}
-VSCode::~VSCode() {
-}
+VSCode::~VSCode() {}
int64_t VSCode::GetLineForPC(int64_t sourceReference, lldb::addr_t pc) const {
auto pos = source_map.find(sourceReference);
@@ -232,8 +231,8 @@ VSCode::SendFormattedOutput(OutputType o, const char *format, ...) {
va_start(args, format);
int actual_length = vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
- SendOutput(o, llvm::StringRef(buffer,
- std::min<int>(actual_length, sizeof(buffer))));
+ SendOutput(
+ o, llvm::StringRef(buffer, std::min<int>(actual_length, sizeof(buffer))));
}
int64_t VSCode::GetNextSourceReference() {
@@ -313,9 +312,9 @@ void VSCode::RunTerminateCommands() {
RunLLDBCommands("Running terminateCommands:", terminate_commands);
}
-lldb::SBTarget VSCode::CreateTargetFromArguments(
- const llvm::json::Object &arguments,
- lldb::SBError &error) {
+lldb::SBTarget
+VSCode::CreateTargetFromArguments(const llvm::json::Object &arguments,
+ lldb::SBError &error) {
// Grab the name of the program we need to debug and create a target using
// the given program as an argument. Executable file can be a source of target
// architecture and platform, if they
diff er from the host. Setting exe path
@@ -330,18 +329,15 @@ lldb::SBTarget VSCode::CreateTargetFromArguments(
llvm::StringRef platform_name = GetString(arguments, "platformName");
llvm::StringRef program = GetString(arguments, "program");
auto target = this->debugger.CreateTarget(
- program.data(),
- target_triple.data(),
- platform_name.data(),
- true, // Add dependent modules.
- error
- );
+ program.data(), target_triple.data(), platform_name.data(),
+ true, // Add dependent modules.
+ error);
if (error.Fail()) {
// Update message if there was an error.
error.SetErrorStringWithFormat(
- "Could not create a target for a program '%s': %s.",
- program.data(), error.GetCString());
+ "Could not create a target for a program '%s': %s.", program.data(),
+ error.GetCString());
}
return target;
@@ -359,10 +355,10 @@ void VSCode::SetTarget(const lldb::SBTarget target) {
listener.StartListeningForEvents(this->broadcaster,
eBroadcastBitStopEventThread);
listener.StartListeningForEvents(
- this->target.GetBroadcaster(),
- lldb::SBTarget::eBroadcastBitModulesLoaded |
- lldb::SBTarget::eBroadcastBitModulesUnloaded |
- lldb::SBTarget::eBroadcastBitSymbolsLoaded);
+ this->target.GetBroadcaster(),
+ lldb::SBTarget::eBroadcastBitModulesLoaded |
+ lldb::SBTarget::eBroadcastBitModulesUnloaded |
+ lldb::SBTarget::eBroadcastBitSymbolsLoaded);
}
}
diff --git a/lldb/tools/lldb-vscode/VSCode.h b/lldb/tools/lldb-vscode/VSCode.h
index ddb4c09a4174..88a0c08de245 100644
--- a/lldb/tools/lldb-vscode/VSCode.h
+++ b/lldb/tools/lldb-vscode/VSCode.h
@@ -146,9 +146,8 @@ struct VSCode {
///
/// \return
/// An SBTarget object.
- lldb::SBTarget CreateTargetFromArguments(
- const llvm::json::Object &arguments,
- lldb::SBError &error);
+ lldb::SBTarget CreateTargetFromArguments(const llvm::json::Object &arguments,
+ lldb::SBError &error);
/// Set given target object as a current target for lldb-vscode and start
/// listeing for its breakpoint events.
diff --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp
index 355a5ebf356b..54f2e653d069 100644
--- a/lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -343,7 +343,7 @@ void SendStdOutStdErr(lldb::SBProcess &process) {
char buffer[1024];
size_t count;
while ((count = process.GetSTDOUT(buffer, sizeof(buffer))) > 0)
- g_vsc.SendOutput(OutputType::Stdout, llvm::StringRef(buffer, count));
+ g_vsc.SendOutput(OutputType::Stdout, llvm::StringRef(buffer, count));
while ((count = process.GetSTDERR(buffer, sizeof(buffer))) > 0)
g_vsc.SendOutput(OutputType::Stderr, llvm::StringRef(buffer, count));
}
@@ -448,10 +448,10 @@ void EventThreadFunction() {
if (event_mask & lldb::SBTarget::eBroadcastBitModulesLoaded) {
body.try_emplace("reason", "new");
} else if (event_mask &
- lldb::SBTarget::eBroadcastBitModulesUnloaded) {
+ lldb::SBTarget::eBroadcastBitModulesUnloaded) {
body.try_emplace("reason", "removed");
} else if (event_mask &
- lldb::SBTarget::eBroadcastBitSymbolsLoaded) {
+ lldb::SBTarget::eBroadcastBitSymbolsLoaded) {
body.try_emplace("reason", "changed");
}
body.try_emplace("module", module_value);
@@ -873,7 +873,9 @@ void request_exceptionInfo(const llvm::json::Object &request) {
// "CompletionsRequest": {
// "allOf": [ { "$ref": "#/definitions/Request" }, {
// "type": "object",
-// "description": "Returns a list of possible completions for a given caret position and text.\nThe CompletionsRequest may only be called if the 'supportsCompletionsRequest' capability exists and is true.",
+// "description": "Returns a list of possible completions for a given caret
+// position and text.\nThe CompletionsRequest may only be called if the
+// 'supportsCompletionsRequest' capability exists and is true.",
// "properties": {
// "command": {
// "type": "string",
@@ -892,19 +894,23 @@ void request_exceptionInfo(const llvm::json::Object &request) {
// "properties": {
// "frameId": {
// "type": "integer",
-// "description": "Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope."
+// "description": "Returns completions in the scope of this stack frame.
+// If not specified, the completions are returned for the global scope."
// },
// "text": {
// "type": "string",
-// "description": "One or more source lines. Typically this is the text a user has typed into the debug console before he asked for completion."
+// "description": "One or more source lines. Typically this is the text a
+// user has typed into the debug console before he asked for completion."
// },
// "column": {
// "type": "integer",
-// "description": "The character position for which to determine the completion proposals."
+// "description": "The character position for which to determine the
+// completion proposals."
// },
// "line": {
// "type": "integer",
-// "description": "An optional line for which to determine the completion proposals. If missing the first line of the text is assumed."
+// "description": "An optional line for which to determine the completion
+// proposals. If missing the first line of the text is assumed."
// }
// },
// "required": [ "text", "column" ]
@@ -933,39 +939,51 @@ void request_exceptionInfo(const llvm::json::Object &request) {
// },
// "CompletionItem": {
// "type": "object",
-// "description": "CompletionItems are the suggestions returned from the CompletionsRequest.",
-// "properties": {
+// "description": "CompletionItems are the suggestions returned from the
+// CompletionsRequest.", "properties": {
// "label": {
// "type": "string",
-// "description": "The label of this completion item. By default this is also the text that is inserted when selecting this completion."
+// "description": "The label of this completion item. By default this is
+// also the text that is inserted when selecting this completion."
// },
// "text": {
// "type": "string",
-// "description": "If text is not falsy then it is inserted instead of the label."
+// "description": "If text is not falsy then it is inserted instead of the
+// label."
// },
// "sortText": {
// "type": "string",
-// "description": "A string that should be used when comparing this item with other items. When `falsy` the label is used."
+// "description": "A string that should be used when comparing this item
+// with other items. When `falsy` the label is used."
// },
// "type": {
// "$ref": "#/definitions/CompletionItemType",
-// "description": "The item's type. Typically the client uses this information to render the item in the UI with an icon."
+// "description": "The item's type. Typically the client uses this
+// information to render the item in the UI with an icon."
// },
// "start": {
// "type": "integer",
-// "description": "This value determines the location (in the CompletionsRequest's 'text' attribute) where the completion text is added.\nIf missing the text is added at the location specified by the CompletionsRequest's 'column' attribute."
+// "description": "This value determines the location (in the
+// CompletionsRequest's 'text' attribute) where the completion text is
+// added.\nIf missing the text is added at the location specified by the
+// CompletionsRequest's 'column' attribute."
// },
// "length": {
// "type": "integer",
-// "description": "This value determines how many characters are overwritten by the completion text.\nIf missing the value 0 is assumed which results in the completion text being inserted."
+// "description": "This value determines how many characters are
+// overwritten by the completion text.\nIf missing the value 0 is assumed
+// which results in the completion text being inserted."
// }
// },
// "required": [ "label" ]
// },
// "CompletionItemType": {
// "type": "string",
-// "description": "Some predefined types for the CompletionItem. Please note that not all clients have specific icons for all of them.",
-// "enum": [ "method", "function", "constructor", "field", "variable", "class", "interface", "module", "property", "unit", "value", "enum", "keyword", "snippet", "text", "color", "file", "reference", "customcolor" ]
+// "description": "Some predefined types for the CompletionItem. Please note
+// that not all clients have specific icons for all of them.", "enum": [
+// "method", "function", "constructor", "field", "variable", "class",
+// "interface", "module", "property", "unit", "value", "enum", "keyword",
+// "snippet", "text", "color", "file", "reference", "customcolor" ]
// }
void request_completions(const llvm::json::Object &request) {
llvm::json::Object response;
@@ -992,9 +1010,7 @@ void request_completions(const llvm::json::Object &request) {
lldb::SBStringList matches;
lldb::SBStringList descriptions;
g_vsc.debugger.GetCommandInterpreter().HandleCompletionWithDescriptions(
- text.c_str(),
- actual_column,
- 0, -1, matches, descriptions);
+ text.c_str(), actual_column, 0, -1, matches, descriptions);
size_t count = std::min((uint32_t)100, matches.GetSize());
targets.reserve(count);
for (size_t i = 0; i < count; i++) {
@@ -1004,8 +1020,8 @@ void request_completions(const llvm::json::Object &request) {
llvm::json::Object item;
llvm::StringRef match_ref = match;
- for(llvm::StringRef commit_point: {".", "->"}) {
- if (match_ref.contains(commit_point)){
+ for (llvm::StringRef commit_point : {".", "->"}) {
+ if (match_ref.contains(commit_point)) {
match_ref = match_ref.rsplit(commit_point).second;
}
}
@@ -1160,7 +1176,8 @@ void request_evaluate(const llvm::json::Object &request) {
} else {
SetValueForKey(value, body, "result");
auto value_typename = value.GetType().GetDisplayTypeName();
- EmplaceSafeString(body, "type", value_typename ? value_typename : NO_TYPENAME);
+ EmplaceSafeString(body, "type",
+ value_typename ? value_typename : NO_TYPENAME);
if (value.MightHaveChildren()) {
auto variablesReference = VARIDX_TO_VARREF(g_vsc.variables.GetSize());
g_vsc.variables.Append(value);
@@ -1229,8 +1246,8 @@ void request_getCompileUnits(const llvm::json::Object &request) {
if (module_id == curr_module.GetUUIDString()) {
int num_units = curr_module.GetNumCompileUnits();
for (int j = 0; j < num_units; j++) {
- auto curr_unit = curr_module.GetCompileUnitAtIndex(j);\
- units.emplace_back(CreateCompileUnit(curr_unit));\
+ auto curr_unit = curr_module.GetCompileUnitAtIndex(j);
+ units.emplace_back(CreateCompileUnit(curr_unit));
}
body.try_emplace("compileUnits", std::move(units));
break;
@@ -2080,7 +2097,7 @@ void request_setFunctionBreakpoints(const llvm::json::Object &request) {
// Disable any function breakpoints that aren't in the request_bps.
// There is no call to remove function breakpoints other than calling this
// function with a smaller or empty "breakpoints" list.
- for (auto &pair: g_vsc.function_breakpoints) {
+ for (auto &pair : g_vsc.function_breakpoints) {
auto request_pos = request_bps.find(pair.first());
if (request_pos == request_bps.end()) {
// This function breakpoint no longer exists delete it from LLDB
@@ -2098,7 +2115,7 @@ void request_setFunctionBreakpoints(const llvm::json::Object &request) {
}
}
// Remove any breakpoints that are no longer in our list
- for (const auto &name: remove_names)
+ for (const auto &name : remove_names)
g_vsc.function_breakpoints.erase(name);
// Any breakpoints that are left in "request_bps" are breakpoints that
@@ -2958,7 +2975,8 @@ int main(int argc, char *argv[]) {
handler_pos->second(*object);
} else {
if (g_vsc.log)
- *g_vsc.log << "error: unhandled command \"" << command.data() << std::endl;
+ *g_vsc.log << "error: unhandled command \"" << command.data()
+ << std::endl;
return 1;
}
}
More information about the lldb-commits
mailing list