[llvm] [RFC][Docs] Clarify brace omission for single-line bodies (PR #195985)

Erich Keane via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 07:52:56 PDT 2026


erichkeane wrote:

> > where the definition of that is a mixture of author and reviewer opinions
> 
> That is exactly what we want to clarify here. IMHO, having a vague standard isn't really better than having no standard at all. The phrase "simple statement" is too vague in this context.
> 
> To me, a single-line statement is "simple", but to others, a multi-line statement can still be considered simple. It also depends on how the statement is written. For example, a function call with many scalar arguments may need comments for each argument, which turns a single simple function call into multiple lines. Would that still count as simple?
> 
> We've had back-and-forth discussions, if not arguments, several times in the past over this exact definition of "simple". IMO, having something concrete would definitely help and save both authors and reviewers a lot of time.

TBH, as someone who has updated this document a few times in an effort to clarify for the above, I'm very sympathetic.  That said, any time we've attempted to be more concrete than this, its a 'devil is in the details' type situation, where folks keep trying to come up with examples, and we argue over those too :) 

In Clang, we typically just expect the authors to do what the reviewers/maintainers request, and hope they realize it isn't worth the fight.

As far as a stricter rule its a bit "I know it when I see it"?  I've definitely seen 1 liners be too complicated, and multiliners not cause problems, so I'm not sure the single line is a perfect heuristic, but perhaps it isn't bad?  But you've obviously already upset others by proposing it :) 

https://github.com/llvm/llvm-project/pull/195985


More information about the llvm-commits mailing list