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

            Bug ID: 35262
           Summary: Clang-Format fails with multi-line comments
           Product: clang
           Version: 5.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: a...@grundis.de
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@lists.llvm.org

Created attachment 19392
  --> https://bugs.llvm.org/attachment.cgi?id=19392&action=edit
File to test

Clang-format fails when using multi-line comments in a define where it should
align the escaped newlines.

There are 2 possible failures: 

- It fails to format the code in question completely (mostly untouched)
- It adds another escaped newline. And again on next format, and again, and
again...

Testcase that triggers both:

        #define FOO \
         /* \
         * Multi-line-comment: \
         */

#define BAR \
/*\
* Multi-line-comment\
*/


Save as clangFormat.cpp (see attachment) and run `clang-format.exe
-style="{AlignEscapedNewlines: Left}" clangFormat.cpp`

Result:

#define FOO                \
  /* \                     \
   * Multi-line-comment: \ \
   */

#define BAR \
/*\
* Multi-line-comment\
*/


On a related note: It will also add an extra newline before an opening brace in
a define and again fail to align the escaped newlines:

#define BAR \
{\
}

->

#define BAR \
  \
{\
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to