forked from OSchip/llvm-project
Teach AST printing to not print whitespace inside {} and () for initialization,
to match LLVM's preferred style. llvm-svn: 227545
This commit is contained in:
parent
4d365250ec
commit
d0e102fece
|
@ -1373,24 +1373,24 @@ void StmtPrinter::VisitInitListExpr(InitListExpr* Node) {
|
|||
return;
|
||||
}
|
||||
|
||||
OS << "{ ";
|
||||
OS << "{";
|
||||
for (unsigned i = 0, e = Node->getNumInits(); i != e; ++i) {
|
||||
if (i) OS << ", ";
|
||||
if (Node->getInit(i))
|
||||
PrintExpr(Node->getInit(i));
|
||||
else
|
||||
OS << "0";
|
||||
OS << "{}";
|
||||
}
|
||||
OS << " }";
|
||||
OS << "}";
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitParenListExpr(ParenListExpr* Node) {
|
||||
OS << "( ";
|
||||
OS << "(";
|
||||
for (unsigned i = 0, e = Node->getNumExprs(); i != e; ++i) {
|
||||
if (i) OS << ", ";
|
||||
PrintExpr(Node->getExpr(i));
|
||||
}
|
||||
OS << " )";
|
||||
OS << ")";
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitDesignatedInitExpr(DesignatedInitExpr *Node) {
|
||||
|
@ -1877,7 +1877,7 @@ void StmtPrinter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {
|
|||
|
||||
void StmtPrinter::VisitCXXConstructExpr(CXXConstructExpr *E) {
|
||||
if (E->isListInitialization())
|
||||
OS << "{ ";
|
||||
OS << "{";
|
||||
|
||||
for (unsigned i = 0, e = E->getNumArgs(); i != e; ++i) {
|
||||
if (isa<CXXDefaultArgExpr>(E->getArg(i))) {
|
||||
|
@ -1890,7 +1890,7 @@ void StmtPrinter::VisitCXXConstructExpr(CXXConstructExpr *E) {
|
|||
}
|
||||
|
||||
if (E->isListInitialization())
|
||||
OS << " }";
|
||||
OS << "}";
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) {
|
||||
|
|
|
@ -52,6 +52,6 @@ int add(int x, int y) {
|
|||
// CHECK-PRINT: lambda = [&] (int z)
|
||||
|
||||
// CHECK-PRINT: init_capture
|
||||
// CHECK-PRINT: [&, x( t )]
|
||||
// CHECK-PRINT: [&, x(t)]
|
||||
|
||||
#endif
|
||||
|
|
|
@ -53,6 +53,6 @@ int add(int x, int y) {
|
|||
// CHECK-PRINT: lambda = [] (type-parameter-0-0 z
|
||||
|
||||
// CHECK-PRINT: init_capture
|
||||
// CHECK-PRINT: [&, x( t )]
|
||||
// CHECK-PRINT: [&, x(t)]
|
||||
|
||||
#endif
|
||||
|
|
|
@ -53,7 +53,7 @@ void test6() {
|
|||
test6fn((int&)y);
|
||||
}
|
||||
|
||||
// CHECK: S s( 1, 2 );
|
||||
// CHECK: S s(1, 2);
|
||||
|
||||
template <class S> void test7()
|
||||
{
|
||||
|
@ -214,7 +214,7 @@ namespace {
|
|||
struct [[gnu::visibility("hidden")]] S;
|
||||
}
|
||||
|
||||
// CHECK: struct CXXFunctionalCastExprPrint fce = CXXFunctionalCastExprPrint{ };
|
||||
// CHECK: struct CXXFunctionalCastExprPrint fce = CXXFunctionalCastExprPrint{};
|
||||
struct CXXFunctionalCastExprPrint {} fce = CXXFunctionalCastExprPrint{};
|
||||
|
||||
// CHECK: struct CXXTemporaryObjectExprPrint toe = CXXTemporaryObjectExprPrint{};
|
||||
|
|
Loading…
Reference in New Issue