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

            Bug ID: 28615
           Summary: Fix ordering of function attributes under
                    MSVCFormatting policy in DeclPrinter
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

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";

-- 
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