[llvm-bugs] [Bug 41213] New: clang-format of a C/C++ comment including a word that starts with a '/' may lead to a premature termination of comment

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 23 11:25:42 PDT 2019


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

            Bug ID: 41213
           Summary: clang-format of a C/C++ comment including a word that
                    starts with a '/' may lead to a premature termination
                    of comment
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: fhansen at nevelex.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Created attachment 21656
  --> https://bugs.llvm.org/attachment.cgi?id=21656&action=edit
Test file that reproduces the problem

Formatting this comment with clang-format -style=LLVM

---
/*
 *      If the character before 'If' is a tab, the next line will start
/immediately after the asterisk on the next line.
 *      If that word starts with a '/', the comment is terminated prematurely
and
 *      we get a compilation error.
 */
---

produces

---
/*
 *      If the character before 'If' is a tab, the next line will start
 */immediately after the asterisk on the next line. If that word starts with a
 *'/', the comment is terminated prematurely and we get a compilation error.
 */
---

The example is self-explanatory, but the problem is that we wind up with '*/'
before the real end of the comment.

The problem happens only if the character before 'If' is a tab. It does _not_
happen if the character(s) before 'If' are spaces.

-- 
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/20190323/6bacc37c/attachment.html>


More information about the llvm-bugs mailing list