[llvm-bugs] [Bug 27092] New: two errors when clang-format.exe handle comments

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 28 00:33:22 PDT 2016


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

            Bug ID: 27092
           Summary: two errors when clang-format.exe handle comments
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: akkaa at 139.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

Format this code ten times use inplace format(-i) 
 use clang-format.exe in LLVM-3.9.0-r264047-win32.exe on Windows 7,
If the file is DOS mode(line end with \r\n), 
we will not get the same result.
If the file is Unix mode(line end with \n), it is ok.

// save to DOS file mode (line end with \r\n)
// install LLVM-3.9.0-r264047-win32.exe on Windows 7.
// command: clang-format.exe -style=llvm -i a.cpp

/*
 comment
*/      /* block comment end and begin at same line.
This line will move to right by 1 in each clang-format.exe process.
*/

#define MM() \
  foo(); \
  /* block comment line larger than 80 in macro, block comment line larger than
80 in macro, block comment line larger than 80 in macro */ \
  bar();

we will get:

// save to DOS file mode (line end with \r\n)
// install LLVM-3.9.0-r264047-win32.exe on Windows 7.
// command: clang-format.exe -style=llvm -i a.cpp

/*
 comment
*/ /* block comment end and begin at same line.
         This line will move to right by 1 in each clang-format.exe process.
         */

#define MM()                                                                  
\
  foo();                                                                      
\
  /* block comment line larger than 80 in macro, block comment line larger \ \
\
   * \                                                                        
\
   * \ \                                                                       
     \
   * \ \ \                                                                     
       \
   * \ \ \ \                                                                   
         \
   * \ \ \ \ \                                                                 
           \
   * \ \ \ \ \ \                                                               
             \
   * \ \ \ \ \ \ \                                                             
               \
   * than 80 in macro, block comment line larger than 80 in macro */          
\
  bar();

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160328/25beff51/attachment.html>


More information about the llvm-bugs mailing list