diff options
| author | Ted Kremenek <kremenek@apple.com> | 2013-12-11 23:44:02 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2013-12-11 23:44:02 +0000 |
| commit | 88446606418e8c47b4f985859b87e92cae47ab94 (patch) | |
| tree | 9d2ab6e915d60e121b9de612a240e3ae7977639b /clang/lib/AST | |
| parent | cda4b6dd007c4726f36f4cd24271b49cc19f1f5a (diff) | |
| download | bcm5719-llvm-88446606418e8c47b4f985859b87e92cae47ab94.tar.gz bcm5719-llvm-88446606418e8c47b4f985859b87e92cae47ab94.zip | |
Add new PrintingPolicy entry to trim number of newlines. Useful for the CFG printer.
The change isn't completely comprehensive. This can be filled in
lazily as needed. There is one consumer right now.
llvm-svn: 197093
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 0016b25f2fa..abbc3d89aaa 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -330,7 +330,8 @@ void StmtPrinter::VisitCXXForRangeStmt(CXXForRangeStmt *Node) { PrintExpr(Node->getRangeInit()); OS << ") {\n"; PrintStmt(Node->getBody()); - Indent() << "}\n"; + Indent() << "}"; + if (Policy.IncludeNewlines) OS << "\n"; } void StmtPrinter::VisitMSDependentExistsStmt(MSDependentExistsStmt *Node) { @@ -350,21 +351,25 @@ void StmtPrinter::VisitMSDependentExistsStmt(MSDependentExistsStmt *Node) { } void StmtPrinter::VisitGotoStmt(GotoStmt *Node) { - Indent() << "goto " << Node->getLabel()->getName() << ";\n"; + Indent() << "goto " << Node->getLabel()->getName() << ";"; + if (Policy.IncludeNewlines) OS << "\n"; } void StmtPrinter::VisitIndirectGotoStmt(IndirectGotoStmt *Node) { Indent() << "goto *"; PrintExpr(Node->getTarget()); - OS << ";\n"; + OS << ";"; + if (Policy.IncludeNewlines) OS << "\n"; } void StmtPrinter::VisitContinueStmt(ContinueStmt *Node) { - Indent() << "continue;\n"; + Indent() << "continue;"; + if (Policy.IncludeNewlines) OS << "\n"; } void StmtPrinter::VisitBreakStmt(BreakStmt *Node) { - Indent() << "break;\n"; + Indent() << "break;"; + if (Policy.IncludeNewlines) OS << "\n"; } @@ -374,7 +379,8 @@ void StmtPrinter::VisitReturnStmt(ReturnStmt *Node) { OS << " "; PrintExpr(Node->getRetValue()); } - OS << ";\n"; + OS << ";"; + if (Policy.IncludeNewlines) OS << "\n"; } @@ -437,7 +443,8 @@ void StmtPrinter::VisitGCCAsmStmt(GCCAsmStmt *Node) { VisitStringLiteral(Node->getClobberStringLiteral(i)); } - OS << ");\n"; + OS << ");"; + if (Policy.IncludeNewlines) OS << "\n"; } void StmtPrinter::VisitMSAsmStmt(MSAsmStmt *Node) { |

