<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - Fix ordering of function attributes under MSVCFormatting policy in DeclPrinter"
href="https://llvm.org/bugs/show_bug.cgi?id=28615">28615</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Fix ordering of function attributes under MSVCFormatting policy in DeclPrinter
</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>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>keyboardsmoke@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>This fix would place the attributes at the beginning of a function (but after
specifiers).
Ideally, I'd like them to be after the return type is declared, but this is
acceptable by MSVC standards.
I am not intimately familiar with clang's rules regarding just jamming in space
characters like that, but since other strings are being appended to out in a
similar fashion I thought it would be acceptable.
Index: DeclPrinter.cpp
===================================================================
--- DeclPrinter.cpp (revision 275612)
+++ DeclPrinter.cpp (working copy)
@@ -474,6 +474,13 @@
SubPolicy.SuppressSpecifiers = false;
std::string Proto = D->getNameInfo().getAsString();
+ if (Policy.MSVCFormatting) {
+ prettyPrintAttributes(D);
+
+ if (D->attr_begin() != D->attr_end())
+ Out << " ";
+ }
+
QualType Ty = D->getType();
while (const ParenType *PT = dyn_cast<ParenType>(Ty)) {
Proto = '(' + Proto + ')';
@@ -628,7 +635,8 @@
Ty.print(Out, Policy, Proto);
}
- prettyPrintAttributes(D);
+ if (!Policy.MSVCFormatting)
+ prettyPrintAttributes(D);
if (D->isPure())
Out << " = 0";</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>