diff options
Diffstat (limited to 'clang/lib/AST/StmtPrinter.cpp')
-rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 2e15c81cccd7..d5b7e1083952 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -1642,26 +1642,24 @@ void StmtPrinter::VisitParenListExpr(ParenListExpr* Node) { void StmtPrinter::VisitDesignatedInitExpr(DesignatedInitExpr *Node) { bool NeedsEquals = true; - for (DesignatedInitExpr::designators_iterator D = Node->designators_begin(), - DEnd = Node->designators_end(); - D != DEnd; ++D) { - if (D->isFieldDesignator()) { - if (D->getDotLoc().isInvalid()) { - if (IdentifierInfo *II = D->getFieldName()) { + for (const DesignatedInitExpr::Designator &D : Node->designators()) { + if (D.isFieldDesignator()) { + if (D.getDotLoc().isInvalid()) { + if (IdentifierInfo *II = D.getFieldName()) { OS << II->getName() << ":"; NeedsEquals = false; } } else { - OS << "." << D->getFieldName()->getName(); + OS << "." << D.getFieldName()->getName(); } } else { OS << "["; - if (D->isArrayDesignator()) { - PrintExpr(Node->getArrayIndex(*D)); + if (D.isArrayDesignator()) { + PrintExpr(Node->getArrayIndex(D)); } else { - PrintExpr(Node->getArrayRangeStart(*D)); + PrintExpr(Node->getArrayRangeStart(D)); OS << " ... "; - PrintExpr(Node->getArrayRangeEnd(*D)); + PrintExpr(Node->getArrayRangeEnd(D)); } OS << "]"; } |