[PATCH] D13546: [ATTR] Automatic line feed after pragma-like attribute, NFC.

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 8 00:16:34 PDT 2015


ABataev created this revision.
ABataev added a reviewer: aaron.ballman.
ABataev added a subscriber: cfe-commits.

Automatically insert line feed after pretty printing of all pragma-like attributes.

http://reviews.llvm.org/D13546

Files:
  include/clang/Basic/Attr.td
  utils/TableGen/ClangAttrEmitter.cpp

Index: utils/TableGen/ClangAttrEmitter.cpp
===================================================================
--- utils/TableGen/ClangAttrEmitter.cpp
+++ utils/TableGen/ClangAttrEmitter.cpp
@@ -1180,6 +1180,7 @@
     if (Variety == "Pragma") {
       OS << " \";\n";
       OS << "    printPrettyPragma(OS, Policy);\n";
+      OS << "    OS << \"\\n\";";
       OS << "    break;\n";
       OS << "  }\n";
       continue;
Index: include/clang/Basic/Attr.td
===================================================================
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -2048,17 +2048,15 @@
     unsigned SpellingIndex = getSpellingListIndex();
     // For "#pragma unroll" and "#pragma nounroll" the string "unroll" or
     // "nounroll" is already emitted as the pragma name.
-    if (SpellingIndex == Pragma_nounroll) {
-      OS << "\n";
+    if (SpellingIndex == Pragma_nounroll)
       return;
-    }
     else if (SpellingIndex == Pragma_unroll) {
-      OS << getValueString(Policy) << "\n";
+      OS << getValueString(Policy);
       return;
     }
 
     assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling");
-    OS << getOptionName(option) << getValueString(Policy) << "\n";
+    OS << getOptionName(option) << getValueString(Policy);
   }
 
   // Return a string containing the loop hint argument including the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13546.36828.patch
Type: text/x-patch
Size: 1364 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151008/c853a0ae/attachment.bin>


More information about the cfe-commits mailing list