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

            Bug ID: 33946
           Summary: Clang-format crashes on file with UCS-2 LE BOM
                    encoding   Assertion failed: getClient() &&
                    "DiagnosticClient not set!"
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

Created attachment 18849
  --> https://bugs.llvm.org/attachment.cgi?id=18849&action=edit
Reproduction files

Found on clang-format 4.0.1 when trying to use on Windows.
A file created via
 clang-format test.cpp > test.formatted.cpp
will be in in UCS-2 LE BOM (according to notepad++) by default on Windows.
(Note that we don't use -i as this touches the file when no formatting needs to
occur)

If we than run:
 clang-format test.formatted.cpp
We get: Assertion failed: getClient() && "DiagnosticClient not set!"


In attachment you can test.cpp (no _clang-format file needed for reproduction),
which crashes the executable when ran as:
 clang-format test.cpp

If converted to UTF-8/Ascii we don't get a crash


Using clang-format version 4.0.1 (tags/RELEASE_401/final)
(from the 64-bit installer)

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

Reply via email to