https://bugs.llvm.org/show_bug.cgi?id=44481

            Bug ID: 44481
           Summary: Please add an option to treat for-blocks as blocks.
                    (Regarding '{'-attaching.)
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

$ clang-format -version
clang-format version 8.0.0-3 (tags/RELEASE_800/final)

$ cat k.c
   {
      if (A) {
         blah(1);
      } else if (B) {
         blah(2);
      } else for (;;) {
         blah(3);
      }
   }

clang-format does this:

$ clang-format -style=file k.c
{
   if (A) {
      blah(1);
   } else if (B) {
      blah(2);
   } else
      for (;;) {
         blah(3);
      }
}

I would prefer doing (via an option) this:

{
   if (A) {
      blah(1);
   } else if (B) {
      blah(2);
   } else for (;;) {
      blah(3);
   }
}

I have not found yet any option to achieve this.

My example is the for-block, but there are (at least two) similar block
constructs: while-block and do(-while)-block. Do not forget them (for
consistency).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to