[llvm-dev] Codifying our Brace rules-
Philip Reames via llvm-dev
llvm-dev at lists.llvm.org
Tue Jun 16 14:35:26 PDT 2020
On 6/15/20 6:25 PM, Chris Lattner via llvm-dev wrote:
>
>
>> On Jun 15, 2020, at 4:13 PM, River Riddle via llvm-dev
>> <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>>
>>
>>
>> On Mon, Jun 15, 2020 at 4:08 PM David Blaikie via llvm-dev
>> <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>>
>> On Mon, Jun 15, 2020 at 4:05 PM Mehdi AMINI via llvm-dev
>> <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>> >
>> > As another data point, the MLIR part of the codebase is pretty
>> consistent on this: never use braces for trivial (single
>> statement) if/else/for, but always put it on every branch if
>> needed on any side of the if/else.
>>
>> Any opinion/stance policy/practice on the "one line, or one statement
>> (& possibly comments, etc)" issue?
>>
>>
>> Generally, any time there is a comment within the body I don't really
>> see it as "trivial" anymore.
>>
>> Prefer:
>> if (...) {
>> // Some comment.
>> single statement;
>> }
>> // Some comment.
>> If (...)
>> single statement;
>>
>> Over:
>> if (...)
>> // Some comment
>> single statement;
>
> +1
>
> -Chris
+1
Philip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200616/7f84b835/attachment.html>
More information about the llvm-dev
mailing list