clang-format C++ files

Forgot to run this after the wcstring_list_t -> std::vector<wcstring> rename.
This commit is contained in:
Johannes Altmanninger 2023-04-19 22:39:38 +02:00
parent 564039093b
commit e4f6169a01
18 changed files with 37 additions and 24 deletions

View file

@ -189,7 +189,8 @@ maybe_t<wcstring> autoload_t::resolve_command(const wcstring &cmd, const environ
}
}
maybe_t<wcstring> autoload_t::resolve_command(const wcstring &cmd, const std::vector<wcstring> &paths) {
maybe_t<wcstring> autoload_t::resolve_command(const wcstring &cmd,
const std::vector<wcstring> &paths) {
// Are we currently in the process of autoloading this?
if (current_autoloading_.count(cmd) > 0) return none();

View file

@ -433,7 +433,8 @@ static const wchar_t *const help_builtins[] = {L"for", L"while", L"function", L
static bool cmd_needs_help(const wcstring &cmd) { return contains(help_builtins, cmd); }
/// Execute a builtin command
proc_status_t builtin_run(parser_t &parser, const std::vector<wcstring> &argv, io_streams_t &streams) {
proc_status_t builtin_run(parser_t &parser, const std::vector<wcstring> &argv,
io_streams_t &streams) {
if (argv.empty()) return proc_status_t::from_exit_code(STATUS_INVALID_ARGS);
const wcstring &cmdname = argv.front();

View file

@ -80,7 +80,8 @@ struct builtin_data_t {
bool builtin_exists(const wcstring &cmd);
proc_status_t builtin_run(parser_t &parser, const std::vector<wcstring> &argv, io_streams_t &streams);
proc_status_t builtin_run(parser_t &parser, const std::vector<wcstring> &argv,
io_streams_t &streams);
std::vector<wcstring> builtin_get_names();
wcstring_list_ffi_t builtin_get_names_ffi();

View file

@ -172,7 +172,8 @@ bool is_windows_subsystem_for_linux() {
#ifdef HAVE_BACKTRACE_SYMBOLS
// This function produces a stack backtrace with demangled function & method names. It is based on
// https://gist.github.com/fmela/591333 but adapted to the style of the fish project.
[[gnu::noinline]] static std::vector<wcstring> demangled_backtrace(int max_frames, int skip_levels) {
[[gnu::noinline]] static std::vector<wcstring> demangled_backtrace(int max_frames,
int skip_levels) {
void *callstack[128];
const int n_max_frames = sizeof(callstack) / sizeof(callstack[0]);
int n_frames = backtrace(callstack, n_max_frames);

View file

@ -380,7 +380,9 @@ class completer_t {
// Bag of data to support expanding a command's arguments using custom completions, including
// the wrap chain.
struct custom_arg_data_t {
explicit custom_arg_data_t(std::vector<wcstring> *vars) : var_assignments(vars) { assert(vars); }
explicit custom_arg_data_t(std::vector<wcstring> *vars) : var_assignments(vars) {
assert(vars);
}
// The unescaped argument before the argument which is being completed, or empty if none.
wcstring previous_argument{};

View file

@ -1018,7 +1018,8 @@ class env_stack_impl_t final : public env_scoped_impl_t {
/// Try setting\p key as an electric or readonly variable.
/// \return an error code, or none() if not an electric or readonly variable.
/// \p val will not be modified upon a none() return.
maybe_t<int> try_set_electric(const wcstring &key, const query_t &query, std::vector<wcstring> &val);
maybe_t<int> try_set_electric(const wcstring &key, const query_t &query,
std::vector<wcstring> &val);
/// Set a universal value.
void set_universal(const wcstring &key, std::vector<wcstring> val, const query_t &query);

View file

@ -172,9 +172,7 @@ wcstring function_get_definition_file(const function_properties_t &props) {
wcstring function_get_copy_definition_file(const function_properties_t &props) {
return props.copy_definition_file ? *props.copy_definition_file : L"";
}
bool function_is_copy(const function_properties_t &props) {
return props.is_copy;
}
bool function_is_copy(const function_properties_t &props) { return props.is_copy; }
int function_get_definition_lineno(const function_properties_t &props) {
return props.definition_lineno();
}
@ -182,7 +180,8 @@ int function_get_copy_definition_lineno(const function_properties_t &props) {
return props.copy_definition_lineno;
}
wcstring function_get_annotated_definition(const function_properties_t &props, const wcstring &name) {
wcstring function_get_annotated_definition(const function_properties_t &props,
const wcstring &name) {
return props.annotated_definition(name);
}

View file

@ -86,7 +86,8 @@ wcstring function_get_copy_definition_file(const function_properties_t &props);
bool function_is_copy(const function_properties_t &props);
int function_get_definition_lineno(const function_properties_t &props);
int function_get_copy_definition_lineno(const function_properties_t &props);
wcstring function_get_annotated_definition(const function_properties_t &props, const wcstring &name);
wcstring function_get_annotated_definition(const function_properties_t &props,
const wcstring &name);
/// \return the properties for a function, or nullptr if none, perhaps triggering autoloading.
function_properties_ref_t function_get_props_autoload(const wcstring &name, parser_t &parser);

View file

@ -115,7 +115,6 @@ void highlight_shell(const wcstring &buffstr, std::vector<highlight_spec_t> &col
const operation_context_t &ctx, bool io_ok = false,
maybe_t<size_t> cursor = {});
class parser_t;
/// Wrapper around colorize(highlight_shell)
wcstring colorize_shell(const wcstring &text, parser_t &parser);

View file

@ -825,7 +825,8 @@ bool input_mapping_set_t::erase(const wcstring &sequence, const wcstring &mode,
}
bool input_mapping_set_t::get(const wcstring &sequence, const wcstring &mode,
std::vector<wcstring> *out_cmds, bool user, wcstring *out_sets_mode) const {
std::vector<wcstring> *out_cmds, bool user,
wcstring *out_sets_mode) const {
bool result = false;
const auto &ml = user ? mapping_list_ : preset_mapping_list_;
for (const input_mapping_t &m : ml) {

View file

@ -114,8 +114,8 @@ class input_mapping_set_t {
/// Gets the command bound to the specified key sequence in the specified mode. Returns true if
/// it exists, false if not.
bool get(const wcstring &sequence, const wcstring &mode, std::vector<wcstring> *out_cmds, bool user,
wcstring *out_sets_mode) const;
bool get(const wcstring &sequence, const wcstring &mode, std::vector<wcstring> *out_cmds,
bool user, wcstring *out_sets_mode) const;
/// Returns all mapping names and modes.
std::vector<input_mapping_name_t> get_names(bool user = true) const;

View file

@ -465,7 +465,8 @@ end_execution_reason_t parse_execution_context_t::run_for_statement(
auto &vars = parser->vars();
int retval;
retval = vars.set(for_var_name, ENV_LOCAL | ENV_USER, var ? var->as_list() : std::vector<wcstring>{});
retval = vars.set(for_var_name, ENV_LOCAL | ENV_USER,
var ? var->as_list() : std::vector<wcstring>{});
assert(retval == ENV_OK);
trace_if_enabled(*parser, L"for", arguments);

View file

@ -70,7 +70,8 @@ rust::Box<WaitHandleStoreFFI> &parser_t::get_wait_handles_ffi() { return wait_ha
const rust::Box<WaitHandleStoreFFI> &parser_t::get_wait_handles_ffi() const { return wait_handles; }
int parser_t::set_var_and_fire(const wcstring &key, env_mode_flags_t mode, std::vector<wcstring> vals) {
int parser_t::set_var_and_fire(const wcstring &key, env_mode_flags_t mode,
std::vector<wcstring> vals) {
int res = vars().set(key, mode, std::move(vals));
if (res == ENV_OK) {
event_fire(*this, *new_event_variable_set(key));

View file

@ -28,7 +28,8 @@
// PREFIX is defined at build time.
static const std::vector<wcstring> kDefaultPath({L"/bin", L"/usr/bin", PREFIX L"/bin"});
static get_path_result_t path_get_path_core(const wcstring &cmd, const std::vector<wcstring> &pathsv) {
static get_path_result_t path_get_path_core(const wcstring &cmd,
const std::vector<wcstring> &pathsv) {
const get_path_result_t noent_res{ENOENT, wcstring{}};
get_path_result_t result{};

View file

@ -1214,7 +1214,8 @@ void reader_data_t::paint_layout(const wchar_t *reason) {
// Apply any selection.
if (data.selection.has_value()) {
highlight_spec_t selection_color = {highlight_role_t::selection, highlight_role_t::selection};
highlight_spec_t selection_color = {highlight_role_t::selection,
highlight_role_t::selection};
auto end = std::min(selection->stop, colors.size());
for (size_t i = data.selection->start; i < end; i++) {
colors.at(i) = selection_color;

View file

@ -259,7 +259,8 @@ std::vector<wcstring> split_string(const wcstring &val, wchar_t sep) {
return out;
}
std::vector<wcstring> split_string_tok(const wcstring &val, const wcstring &seps, size_t max_results) {
std::vector<wcstring> split_string_tok(const wcstring &val, const wcstring &seps,
size_t max_results) {
std::vector<wcstring> out;
size_t end = val.size();
size_t pos = 0;
@ -286,7 +287,8 @@ std::vector<wcstring> split_string_tok(const wcstring &val, const wcstring &seps
return out;
}
static wcstring join_strings_impl(const std::vector<wcstring> &vals, const wchar_t *sep, size_t seplen) {
static wcstring join_strings_impl(const std::vector<wcstring> &vals, const wchar_t *sep,
size_t seplen) {
if (vals.empty()) return wcstring{};
// Reserve the size we will need.