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

@@ -22,14 +22,15 @@ static void def_log_func(unsigned int level, const char* file,
}
wpi::StringRef levelmsg;
if (level >= 50)
if (level >= 50) {
levelmsg = "CRITICAL: ";
else if (level >= 40)
} else if (level >= 40) {
levelmsg = "ERROR: ";
else if (level >= 30)
} else if (level >= 30) {
levelmsg = "WARNING: ";
else
} else {
return;
}
oss << "CS: " << levelmsg << msg << " (" << wpi::sys::path::filename(file)
<< ':' << line << ")\n";
wpi::errs() << oss.str();
@@ -55,7 +56,9 @@ void Instance::Shutdown() {
notifier.Stop();
}
void Instance::SetDefaultLogger() { logger.SetLogger(def_log_func); }
void Instance::SetDefaultLogger() {
logger.SetLogger(def_log_func);
}
std::pair<CS_Source, std::shared_ptr<SourceData>> Instance::FindSource(
const SourceImpl& source) {
@@ -84,11 +87,13 @@ CS_Sink Instance::CreateSink(CS_SinkKind kind, std::shared_ptr<SinkImpl> sink) {
}
void Instance::DestroySource(CS_Source handle) {
if (auto data = m_sources.Free(handle))
if (auto data = m_sources.Free(handle)) {
notifier.NotifySource(data->source->GetName(), handle, CS_SOURCE_DESTROYED);
}
}
void Instance::DestroySink(CS_Sink handle) {
if (auto data = m_sinks.Free(handle))
if (auto data = m_sinks.Free(handle)) {
notifier.NotifySink(data->sink->GetName(), handle, CS_SINK_DESTROYED);
}
}