1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Style: Enforce braces around if blocks and loops

Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
This commit is contained in:
Rémi Verschelde
2021-05-05 12:44:11 +02:00
parent b8d198eeed
commit 140350d767
694 changed files with 23283 additions and 12499 deletions

View File

@@ -406,8 +406,9 @@ public:
bool set_variable(const StringName &p_variable, const Variant &p_value) {
Map<StringName, Variant>::Element *E = variables.find(p_variable);
if (!E)
if (!E) {
return false;
}
E->get() = p_value;
return true;
@@ -415,8 +416,9 @@ public:
bool get_variable(const StringName &p_variable, Variant *r_variable) const {
const Map<StringName, Variant>::Element *E = variables.find(p_variable);
if (!E)
if (!E) {
return false;
}
*r_variable = E->get();
return true;
@@ -500,11 +502,13 @@ public:
bool debug_break_parse(const String &p_file, int p_node, const String &p_error);
_FORCE_INLINE_ void enter_function(VisualScriptInstance *p_instance, const StringName *p_function, Variant *p_stack, Variant **p_work_mem, int *current_id) {
if (Thread::get_main_id() != Thread::get_caller_id())
if (Thread::get_main_id() != Thread::get_caller_id()) {
return; //no support for other threads than main for now
}
if (ScriptDebugger::get_singleton()->get_lines_left() > 0 && ScriptDebugger::get_singleton()->get_depth() >= 0)
if (ScriptDebugger::get_singleton()->get_lines_left() > 0 && ScriptDebugger::get_singleton()->get_depth() >= 0) {
ScriptDebugger::get_singleton()->set_depth(ScriptDebugger::get_singleton()->get_depth() + 1);
}
if (_debug_call_stack_pos >= _debug_max_call_stack) {
//stack overflow
@@ -522,11 +526,13 @@ public:
}
_FORCE_INLINE_ void exit_function() {
if (Thread::get_main_id() != Thread::get_caller_id())
if (Thread::get_main_id() != Thread::get_caller_id()) {
return; //no support for other threads than main for now
}
if (ScriptDebugger::get_singleton()->get_lines_left() > 0 && ScriptDebugger::get_singleton()->get_depth() >= 0)
if (ScriptDebugger::get_singleton()->get_lines_left() > 0 && ScriptDebugger::get_singleton()->get_depth() >= 0) {
ScriptDebugger::get_singleton()->set_depth(ScriptDebugger::get_singleton()->get_depth() - 1);
}
if (_debug_call_stack_pos == 0) {
_debug_error = "Stack Underflow (Engine Bug)";