llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.41k stars 12.15k forks source link

readability-braces-around-statements: automatically remove unneeded braces #33326

Open LebedevRI opened 7 years ago

LebedevRI commented 7 years ago
Bugzilla Link 33979
Version unspecified
OS Linux
CC @JonasToth,@mydeveloperday

Extended Description

Given readability-braces-around-statements.ShortStatementLines = 3 For the code like

if (foo()) {
  bar();
}

no braces are needed, so i would be awesome if it could drop unnecessary braces in such cases, like:

if (foo())
  bar();
JonasToth commented 5 years ago

I want to make explicit that this should be in readability-braces-around-statements as a configuration option to avoid emitting conflicting fixits for users just enabling readability-*.