diff options
Diffstat (limited to 'clang/lib/AST/StmtPrinter.cpp')
| -rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 297de5e09ab..1daab32e5b7 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -168,8 +168,22 @@ void StmtPrinter::VisitLabelStmt(LabelStmt *Node) { } void StmtPrinter::VisitAttributedStmt(AttributedStmt *Node) { - for (const auto *Attr : Node->getAttrs()) - Attr->printPretty(OS, Policy); + std::string raw_attr_os; + llvm::raw_string_ostream AttrOS(raw_attr_os); + for (const auto *Attr : Node->getAttrs()) { + // FIXME: This hack will be removed when printPretty + // has been modified to print pretty pragmas + if (const LoopHintAttr *LHA = dyn_cast<LoopHintAttr>(Attr)) { + LHA->print(OS, Policy); + } else + Attr->printPretty(AttrOS, Policy); + } + + // Print attributes after pragmas. + StringRef AttrStr = AttrOS.str(); + if (!AttrStr.empty()) + OS << AttrStr; + PrintStmt(Node->getSubStmt(), 0); } |

