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: unassignedclangb...@nondot.org
          Reporter: fhan...@nevelex.com
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to