<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - clang-format 7 and later cannot read RawStringFormats from 6.0"
href="https://bugs.llvm.org/show_bug.cgi?id=45337">45337</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-format 7 and later cannot read RawStringFormats from 6.0
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Formatter
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rondom@rondom.de
</td>
</tr>
<tr>
<th>CC</th>
<td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=23282" name="attach_23282" title="clang-format-file that works fine with 6.0 but not with later versions">attachment 23282</a> <a href="attachment.cgi?id=23282&action=edit" title="clang-format-file that works fine with 6.0 but not with later versions">[details]</a></span>
clang-format-file that works fine with 6.0 but not with later versions
Between clang-format 6.0 and 7.0, the format of the RawStringFormats property
has changed. Instead of taking a string of one delimiter per list item (key
"Delimiter") it takes multiple delimiters as a list (key "Delimiters") per list
item in later versions of clang-format.
My expectation is that later versions of clang-format can process a
.clang-format file produced with an earlier version of clang-format using the
--dump-config switch without any manual changes.
<a href="https://releases.llvm.org/6.0.0/tools/clang/docs/ClangFormatStyleOptions.html#configurable-format-style-options">https://releases.llvm.org/6.0.0/tools/clang/docs/ClangFormatStyleOptions.html#configurable-format-style-options</a>
<a href="https://releases.llvm.org/7.0.0/tools/clang/docs/ClangFormatStyleOptions.html#configurable-format-style-options">https://releases.llvm.org/7.0.0/tools/clang/docs/ClangFormatStyleOptions.html#configurable-format-style-options</a>
To reproduce:
=============
1. Either
a. Produce a .clang-format file using clang-format-6.0 --dump-config
b. Create a .clang-format file with the following content (also attached)
---
Language: Cpp
RawStringFormats:
- Delimiter: pb
Language: TextProto
BasedOnStyle: google
...
2. Run latest clang-format on some file, e.g. clang-format -i main.cpp
Actual behaviour:
=================
~/clang-format-test
❯ clang-format-6.0 -i main.cpp
~/clang-format-test
❯ clang-format-10 -i main.cpp
YAML:4:16: error: unknown key 'Delimiter'
- Delimiter: pb
^~
Error reading /home/tobii.intra/ag3512/clang-format-test/.clang-format: Invalid
argument
~/clang-format-test
Expected behaviour:
===================
The latest versionof clang-format should be able to format files just fine
using the old .clang-format file.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>