summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/Expr.cpp28
-rw-r--r--clang/lib/AST/StmtPrinter.cpp9
-rw-r--r--clang/lib/AST/StmtProfile.cpp4
3 files changed, 41 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 2c07de6c79a..ce8bb516c09 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -1784,6 +1784,26 @@ void DesignatedInitExpr::DoDestroy(ASTContext &C) {
Expr::DoDestroy(C);
}
+ParenListExpr::ParenListExpr(ASTContext& C, SourceLocation lparenloc,
+ Expr **exprs, unsigned nexprs,
+ SourceLocation rparenloc)
+: Expr(ParenListExprClass, QualType(),
+ hasAnyTypeDependentArguments(exprs, nexprs),
+ hasAnyValueDependentArguments(exprs, nexprs)),
+ NumExprs(nexprs), LParenLoc(lparenloc), RParenLoc(rparenloc) {
+
+ Exprs = new (C) Stmt*[nexprs];
+ for (unsigned i = 0; i != nexprs; ++i)
+ Exprs[i] = exprs[i];
+}
+
+void ParenListExpr::DoDestroy(ASTContext& C) {
+ DestroyChildren(C);
+ if (Exprs) C.Deallocate(Exprs);
+ this->~ParenListExpr();
+ C.Deallocate(this);
+}
+
//===----------------------------------------------------------------------===//
// ExprIterator.
//===----------------------------------------------------------------------===//
@@ -1988,6 +2008,14 @@ Stmt::child_iterator ImplicitValueInitExpr::child_end() {
return child_iterator();
}
+// ParenListExpr
+Stmt::child_iterator ParenListExpr::child_begin() {
+ return &Exprs[0];
+}
+Stmt::child_iterator ParenListExpr::child_end() {
+ return &Exprs[0]+NumExprs;
+}
+
// ObjCStringLiteral
Stmt::child_iterator ObjCStringLiteral::child_begin() {
return &String;
diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp
index a5b0df8e45c..a2c04978b03 100644
--- a/clang/lib/AST/StmtPrinter.cpp
+++ b/clang/lib/AST/StmtPrinter.cpp
@@ -850,6 +850,15 @@ void StmtPrinter::VisitInitListExpr(InitListExpr* Node) {
OS << " }";
}
+void StmtPrinter::VisitParenListExpr(ParenListExpr* Node) {
+ OS << "( ";
+ for (unsigned i = 0, e = Node->getNumExprs(); i != e; ++i) {
+ if (i) OS << ", ";
+ PrintExpr(Node->getExpr(i));
+ }
+ OS << " )";
+}
+
void StmtPrinter::VisitDesignatedInitExpr(DesignatedInitExpr *Node) {
for (DesignatedInitExpr::designators_iterator D = Node->designators_begin(),
DEnd = Node->designators_end();
diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp
index d0f02ae95bc..5d9b8bc7bbc 100644
--- a/clang/lib/AST/StmtProfile.cpp
+++ b/clang/lib/AST/StmtProfile.cpp
@@ -245,6 +245,10 @@ void StmtProfiler::VisitParenExpr(ParenExpr *S) {
VisitExpr(S);
}
+void StmtProfiler::VisitParenListExpr(ParenListExpr *S) {
+ VisitExpr(S);
+}
+
void StmtProfiler::VisitUnaryOperator(UnaryOperator *S) {
VisitExpr(S);
ID.AddInteger(S->getOpcode());
OpenPOWER on IntegriCloud