Add braces to C++ single-line loops and conditionals (NFC) (#2973)

This makes code easier to read and more consistent between C++ and Java.
Also update clang-format settings to always add a line break (even if no braces are used).
This commit is contained in:
Peter Johnson
2020-12-28 12:58:06 -08:00
committed by GitHub
parent 0291a3ff56
commit 2aed432b4b
634 changed files with 10716 additions and 3938 deletions

View File

@@ -44,21 +44,29 @@ void HALProvider::Update() {
// check for visible windows that need displays (typically this is due to
// file loading)
for (auto&& window : m_windows) {
if (!window->IsVisible() || window->HasView()) continue;
if (!window->IsVisible() || window->HasView()) {
continue;
}
auto id = window->GetId();
auto it = FindViewEntry(id);
if (it == m_viewEntries.end() || (*it)->name != id) continue;
if (it == m_viewEntries.end() || (*it)->name != id) {
continue;
}
Show(it->get(), window.get());
}
}
glass::Model* HALProvider::GetModel(wpi::StringRef name) {
auto it = FindModelEntry(name);
if (it == m_modelEntries.end() || (*it)->name != name) return nullptr;
if (it == m_modelEntries.end() || (*it)->name != name) {
return nullptr;
}
auto entry = it->get();
// get or create model
if (!entry->model) entry->model = entry->createModel();
if (!entry->model) {
entry->model = entry->createModel();
}
return entry->model.get();
}
@@ -70,18 +78,27 @@ void HALProvider::Show(ViewEntry* entry, glass::Window* window) {
}
// get or create model
if (!entry->modelEntry->model)
if (!entry->modelEntry->model) {
entry->modelEntry->model = entry->modelEntry->createModel();
if (!entry->modelEntry->model) return;
}
if (!entry->modelEntry->model) {
return;
}
// the window might exist and we're just not associated to it yet
if (!window) window = GetOrAddWindow(entry->name, true);
if (!window) return;
if (!window) {
window = GetOrAddWindow(entry->name, true);
}
if (!window) {
return;
}
entry->window = window;
// create view
auto view = entry->createView(window, entry->modelEntry->model.get());
if (!view) return;
if (!view) {
return;
}
window->SetView(std::move(view));
entry->window->SetVisible(true);