[llvm-bugs] [Bug 36643] New: clang-format fails to recognise wxT similarly to _T and formats it badly

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 8 01:09:21 PST 2018


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

            Bug ID: 36643
           Summary: clang-format fails to recognise wxT similarly to _T
                    and formats it badly
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: fuscated at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Created attachment 20018
  --> https://bugs.llvm.org/attachment.cgi?id=20018&action=edit
Patch with a fix

This file:

$ test_format_wxt.cpp
void test()
{
        wxString s = wxT("test11 test12 test13 test14 test15 test16")
                 wxT("test21 test22 test23 test24 test25 test26");

    wxString s2 = wxT("test11 test12 test13 test14")
                          wxT("test21 test22 test23 test24")
                          wxT("test31 test32 test33 test34")
                          wxT("test41 test42 test43 test44");

        wxString s3 = _T("test11 test12 test13 test14")
                          _T("test21 test22 test23 test24")
                          _T("test31 test32 test33 test34")
                          _T("test41 test42 test43 test44");
}

Is formatted as:
$ clang-format -style=llvm /tmp/test_format_wxt.cpp
void test() {
  wxString s = wxT("test11 test12 test13 test14 test15 test16")
      wxT("test21 test22 test23 test24 test25 test26");

  wxString s2 =
      wxT("test11 test12 test13 test14") wxT("test21 test22 test23 test24")
          wxT("test31 test32 test33 test34") wxT("test41 test42 test43
test44");

  wxString s3 = _T("test11 test12 test13 test14")
                _T("test21 test22 test23 test24")
                _T("test31 test32 test33 test34")
                _T("test41 test42 test43 test44");
}

Which is not too good. Ideally the behaviour for wxT should be the same as for
_T.

See the attached patch for a variant of a fix.

-- 
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/20180308/f28dca73/attachment.html>


More information about the llvm-bugs mailing list