<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 - Constructor annotations are moved on a newline for classes with uppercase names"
href="https://bugs.llvm.org/show_bug.cgi?id=48899">48899</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Constructor annotations are moved on a newline for classes with uppercase names
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>marius@dreamer-ge.com
</td>
</tr>
<tr>
<th>CC</th>
<td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>There seems to be a difference in the behavior for constructor annotations when
then class name is fully uppercase vs mixed case.
Style:
---
Language: Cpp
ColumnLimit: 0
...
Example:
class AABB
{
AABB(const Vector&) noexcept;
};
class Aabb
{
Aabb(const Vector&) noexcept;
};
Formatted:
class AABB
{
AABB(const Vector&)
noexcept; // <- annotation got moved to the next line
};
class Aabb
{
Aabb(const Vector&) noexcept; //<- annotation remained in place
};
Upon investigating I reached two code locations:
<a href="https://github.com/llvm/llvm-project/blob/3e206a5922c18392353ba24e80339301183f679d/clang/lib/Format/UnwrappedLineParser.cpp#L1464">https://github.com/llvm/llvm-project/blob/3e206a5922c18392353ba24e80339301183f679d/clang/lib/Format/UnwrappedLineParser.cpp#L1464</a>
UnwrappedLineParser.cpp#L1464 - seems to treat all uppercase function names as
macros and adds an unwrapped line before processing of annotations
<a href="https://github.com/llvm/llvm-project/blob/412ac0e53688364fe1295e864abd53e104eeb554/clang/lib/Format/TokenAnnotator.cpp#L1686">https://github.com/llvm/llvm-project/blob/412ac0e53688364fe1295e864abd53e104eeb554/clang/lib/Format/TokenAnnotator.cpp#L1686</a>
TokenAnnotator.cpp#L1686 - for some reason the logic here is reversed and tags
annotation are only processed when the function name is uppercase</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>