1 //===-- GoAST.h -------------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 // Generated by gen_go_ast.py
13 #ifndef liblldb_GoAST_h
14 #define liblldb_GoAST_h
16 #include "lldb/lldb-forward.h"
17 #include "lldb/lldb-private.h"
18 #include "llvm/Support/Casting.h"
19 #include "Plugins/ExpressionParser/Go/GoLexer.h"
21 namespace lldb_private
27 typedef GoLexer::TokenType TokenType;
28 typedef GoLexer::Token Token;
90 virtual ~GoASTNode() = default;
98 virtual const char *GetKindName() const = 0;
100 template <typename V> void WalkChildren(V &v);
103 explicit GoASTNode(NodeKind kind) : m_kind(kind) { }
106 const NodeKind m_kind;
108 GoASTNode(const GoASTNode &) = delete;
109 const GoASTNode &operator=(const GoASTNode &) = delete;
113 class GoASTDecl : public GoASTNode
116 template <typename R, typename V> R Visit(V *v) const;
119 classof(const GoASTNode *n)
121 return n->GetKind() >= eBadDecl && n->GetKind() <= eGenDecl;
125 explicit GoASTDecl(NodeKind kind) : GoASTNode(kind) { }
128 GoASTDecl(const GoASTDecl &) = delete;
129 const GoASTDecl &operator=(const GoASTDecl &) = delete;
132 class GoASTExpr : public GoASTNode
135 template <typename R, typename V> R Visit(V *v) const;
138 classof(const GoASTNode *n)
140 return n->GetKind() >= eArrayType && n->GetKind() <= eUnaryExpr;
144 explicit GoASTExpr(NodeKind kind) : GoASTNode(kind) { }
147 GoASTExpr(const GoASTExpr &) = delete;
148 const GoASTExpr &operator=(const GoASTExpr &) = delete;
151 class GoASTSpec : public GoASTNode
154 template <typename R, typename V> R Visit(V *v) const;
157 classof(const GoASTNode *n)
159 return n->GetKind() >= eImportSpec && n->GetKind() <= eValueSpec;
163 explicit GoASTSpec(NodeKind kind) : GoASTNode(kind) { }
166 GoASTSpec(const GoASTSpec &) = delete;
167 const GoASTSpec &operator=(const GoASTSpec &) = delete;
170 class GoASTStmt : public GoASTNode
173 template <typename R, typename V> R Visit(V *v) const;
176 classof(const GoASTNode *n)
178 return n->GetKind() >= eAssignStmt && n->GetKind() <= eTypeSwitchStmt;
182 explicit GoASTStmt(NodeKind kind) : GoASTNode(kind) { }
185 GoASTStmt(const GoASTStmt &) = delete;
186 const GoASTStmt &operator=(const GoASTStmt &) = delete;
190 class GoASTArrayType : public GoASTExpr
193 GoASTArrayType(GoASTExpr *len, GoASTExpr *elt) : GoASTExpr(eArrayType), m_len_up(len), m_elt_up(elt) {}
194 ~GoASTArrayType() override = default;
197 GetKindName() const override
203 classof(const GoASTNode *n)
205 return n->GetKind() == eArrayType;
211 return m_len_up.get();
214 SetLen(GoASTExpr *len)
222 return m_elt_up.get();
225 SetElt(GoASTExpr *elt)
231 friend class GoASTNode;
232 std::unique_ptr<GoASTExpr> m_len_up;
233 std::unique_ptr<GoASTExpr> m_elt_up;
235 GoASTArrayType(const GoASTArrayType &) = delete;
236 const GoASTArrayType &operator=(const GoASTArrayType &) = delete;
239 class GoASTAssignStmt : public GoASTStmt
242 explicit GoASTAssignStmt(bool define) : GoASTStmt(eAssignStmt), m_define(define) {}
243 ~GoASTAssignStmt() override = default;
246 GetKindName() const override
252 classof(const GoASTNode *n)
254 return n->GetKind() == eAssignStmt;
265 return m_lhs[i].get();
268 AddLhs(GoASTExpr *lhs)
270 m_lhs.push_back(std::unique_ptr<GoASTExpr>(lhs));
281 return m_rhs[i].get();
284 AddRhs(GoASTExpr *rhs)
286 m_rhs.push_back(std::unique_ptr<GoASTExpr>(rhs));
295 SetDefine(bool define)
301 friend class GoASTNode;
302 std::vector<std::unique_ptr<GoASTExpr> > m_lhs;
303 std::vector<std::unique_ptr<GoASTExpr> > m_rhs;
306 GoASTAssignStmt(const GoASTAssignStmt &) = delete;
307 const GoASTAssignStmt &operator=(const GoASTAssignStmt &) = delete;
310 class GoASTBadDecl : public GoASTDecl
313 GoASTBadDecl() : GoASTDecl(eBadDecl) {}
314 ~GoASTBadDecl() override = default;
317 GetKindName() const override
323 classof(const GoASTNode *n)
325 return n->GetKind() == eBadDecl;
328 GoASTBadDecl(const GoASTBadDecl &) = delete;
329 const GoASTBadDecl &operator=(const GoASTBadDecl &) = delete;
332 class GoASTBadExpr : public GoASTExpr
335 GoASTBadExpr() : GoASTExpr(eBadExpr) {}
336 ~GoASTBadExpr() override = default;
339 GetKindName() const override
345 classof(const GoASTNode *n)
347 return n->GetKind() == eBadExpr;
350 GoASTBadExpr(const GoASTBadExpr &) = delete;
351 const GoASTBadExpr &operator=(const GoASTBadExpr &) = delete;
354 class GoASTBadStmt : public GoASTStmt
357 GoASTBadStmt() : GoASTStmt(eBadStmt) {}
358 ~GoASTBadStmt() override = default;
361 GetKindName() const override
367 classof(const GoASTNode *n)
369 return n->GetKind() == eBadStmt;
372 GoASTBadStmt(const GoASTBadStmt &) = delete;
373 const GoASTBadStmt &operator=(const GoASTBadStmt &) = delete;
376 class GoASTBasicLit : public GoASTExpr
379 explicit GoASTBasicLit(Token value) : GoASTExpr(eBasicLit), m_value(value) {}
380 ~GoASTBasicLit() override = default;
383 GetKindName() const override
389 classof(const GoASTNode *n)
391 return n->GetKind() == eBasicLit;
400 SetValue(Token value)
406 friend class GoASTNode;
409 GoASTBasicLit(const GoASTBasicLit &) = delete;
410 const GoASTBasicLit &operator=(const GoASTBasicLit &) = delete;
413 class GoASTBinaryExpr : public GoASTExpr
416 GoASTBinaryExpr(GoASTExpr *x, GoASTExpr *y, TokenType op) : GoASTExpr(eBinaryExpr), m_x_up(x), m_y_up(y), m_op(op) {}
417 ~GoASTBinaryExpr() override = default;
420 GetKindName() const override
426 classof(const GoASTNode *n)
428 return n->GetKind() == eBinaryExpr;
465 friend class GoASTNode;
466 std::unique_ptr<GoASTExpr> m_x_up;
467 std::unique_ptr<GoASTExpr> m_y_up;
470 GoASTBinaryExpr(const GoASTBinaryExpr &) = delete;
471 const GoASTBinaryExpr &operator=(const GoASTBinaryExpr &) = delete;
474 class GoASTBlockStmt : public GoASTStmt
477 GoASTBlockStmt() : GoASTStmt(eBlockStmt) {}
478 ~GoASTBlockStmt() override = default;
481 GetKindName() const override
487 classof(const GoASTNode *n)
489 return n->GetKind() == eBlockStmt;
495 return m_list.size();
500 return m_list[i].get();
503 AddList(GoASTStmt *list)
505 m_list.push_back(std::unique_ptr<GoASTStmt>(list));
509 friend class GoASTNode;
510 std::vector<std::unique_ptr<GoASTStmt> > m_list;
512 GoASTBlockStmt(const GoASTBlockStmt &) = delete;
513 const GoASTBlockStmt &operator=(const GoASTBlockStmt &) = delete;
516 class GoASTIdent : public GoASTExpr
519 explicit GoASTIdent(Token name) : GoASTExpr(eIdent), m_name(name) {}
520 ~GoASTIdent() override = default;
523 GetKindName() const override
529 classof(const GoASTNode *n)
531 return n->GetKind() == eIdent;
546 friend class GoASTNode;
549 GoASTIdent(const GoASTIdent &) = delete;
550 const GoASTIdent &operator=(const GoASTIdent &) = delete;
553 class GoASTBranchStmt : public GoASTStmt
556 GoASTBranchStmt(GoASTIdent *label, TokenType tok) : GoASTStmt(eBranchStmt), m_label_up(label), m_tok(tok) {}
557 ~GoASTBranchStmt() override = default;
560 GetKindName() const override
566 classof(const GoASTNode *n)
568 return n->GetKind() == eBranchStmt;
574 return m_label_up.get();
577 SetLabel(GoASTIdent *label)
579 m_label_up.reset(label);
588 SetTok(TokenType tok)
594 friend class GoASTNode;
595 std::unique_ptr<GoASTIdent> m_label_up;
598 GoASTBranchStmt(const GoASTBranchStmt &) = delete;
599 const GoASTBranchStmt &operator=(const GoASTBranchStmt &) = delete;
602 class GoASTCallExpr : public GoASTExpr
605 explicit GoASTCallExpr(bool ellipsis) : GoASTExpr(eCallExpr), m_ellipsis(ellipsis) {}
606 ~GoASTCallExpr() override = default;
609 GetKindName() const override
615 classof(const GoASTNode *n)
617 return n->GetKind() == eCallExpr;
623 return m_fun_up.get();
626 SetFun(GoASTExpr *fun)
634 return m_args.size();
639 return m_args[i].get();
642 AddArgs(GoASTExpr *args)
644 m_args.push_back(std::unique_ptr<GoASTExpr>(args));
653 SetEllipsis(bool ellipsis)
655 m_ellipsis = ellipsis;
659 friend class GoASTNode;
660 std::unique_ptr<GoASTExpr> m_fun_up;
661 std::vector<std::unique_ptr<GoASTExpr> > m_args;
664 GoASTCallExpr(const GoASTCallExpr &) = delete;
665 const GoASTCallExpr &operator=(const GoASTCallExpr &) = delete;
668 class GoASTCaseClause : public GoASTStmt
671 GoASTCaseClause() : GoASTStmt(eCaseClause) {}
672 ~GoASTCaseClause() override = default;
675 GetKindName() const override
681 classof(const GoASTNode *n)
683 return n->GetKind() == eCaseClause;
689 return m_list.size();
694 return m_list[i].get();
697 AddList(GoASTExpr *list)
699 m_list.push_back(std::unique_ptr<GoASTExpr>(list));
705 return m_body.size();
710 return m_body[i].get();
713 AddBody(GoASTStmt *body)
715 m_body.push_back(std::unique_ptr<GoASTStmt>(body));
719 friend class GoASTNode;
720 std::vector<std::unique_ptr<GoASTExpr> > m_list;
721 std::vector<std::unique_ptr<GoASTStmt> > m_body;
723 GoASTCaseClause(const GoASTCaseClause &) = delete;
724 const GoASTCaseClause &operator=(const GoASTCaseClause &) = delete;
727 class GoASTChanType : public GoASTExpr
730 GoASTChanType(ChanDir dir, GoASTExpr *value) : GoASTExpr(eChanType), m_dir(dir), m_value_up(value) {}
731 ~GoASTChanType() override = default;
734 GetKindName() const override
740 classof(const GoASTNode *n)
742 return n->GetKind() == eChanType;
759 return m_value_up.get();
762 SetValue(GoASTExpr *value)
764 m_value_up.reset(value);
768 friend class GoASTNode;
770 std::unique_ptr<GoASTExpr> m_value_up;
772 GoASTChanType(const GoASTChanType &) = delete;
773 const GoASTChanType &operator=(const GoASTChanType &) = delete;
776 class GoASTCommClause : public GoASTStmt
779 GoASTCommClause() : GoASTStmt(eCommClause) {}
780 ~GoASTCommClause() override = default;
783 GetKindName() const override
789 classof(const GoASTNode *n)
791 return n->GetKind() == eCommClause;
797 return m_comm_up.get();
800 SetComm(GoASTStmt *comm)
802 m_comm_up.reset(comm);
808 return m_body.size();
813 return m_body[i].get();
816 AddBody(GoASTStmt *body)
818 m_body.push_back(std::unique_ptr<GoASTStmt>(body));
822 friend class GoASTNode;
823 std::unique_ptr<GoASTStmt> m_comm_up;
824 std::vector<std::unique_ptr<GoASTStmt> > m_body;
826 GoASTCommClause(const GoASTCommClause &) = delete;
827 const GoASTCommClause &operator=(const GoASTCommClause &) = delete;
830 class GoASTCompositeLit : public GoASTExpr
833 GoASTCompositeLit() : GoASTExpr(eCompositeLit) {}
834 ~GoASTCompositeLit() override = default;
837 GetKindName() const override
839 return "CompositeLit";
843 classof(const GoASTNode *n)
845 return n->GetKind() == eCompositeLit;
851 return m_type_up.get();
854 SetType(GoASTExpr *type)
856 m_type_up.reset(type);
862 return m_elts.size();
867 return m_elts[i].get();
870 AddElts(GoASTExpr *elts)
872 m_elts.push_back(std::unique_ptr<GoASTExpr>(elts));
876 friend class GoASTNode;
877 std::unique_ptr<GoASTExpr> m_type_up;
878 std::vector<std::unique_ptr<GoASTExpr> > m_elts;
880 GoASTCompositeLit(const GoASTCompositeLit &) = delete;
881 const GoASTCompositeLit &operator=(const GoASTCompositeLit &) = delete;
884 class GoASTDeclStmt : public GoASTStmt
887 explicit GoASTDeclStmt(GoASTDecl *decl) : GoASTStmt(eDeclStmt), m_decl_up(decl) {}
888 ~GoASTDeclStmt() override = default;
891 GetKindName() const override
897 classof(const GoASTNode *n)
899 return n->GetKind() == eDeclStmt;
905 return m_decl_up.get();
908 SetDecl(GoASTDecl *decl)
910 m_decl_up.reset(decl);
914 friend class GoASTNode;
915 std::unique_ptr<GoASTDecl> m_decl_up;
917 GoASTDeclStmt(const GoASTDeclStmt &) = delete;
918 const GoASTDeclStmt &operator=(const GoASTDeclStmt &) = delete;
921 class GoASTDeferStmt : public GoASTStmt
924 explicit GoASTDeferStmt(GoASTCallExpr *call) : GoASTStmt(eDeferStmt), m_call_up(call) {}
925 ~GoASTDeferStmt() override = default;
928 GetKindName() const override
934 classof(const GoASTNode *n)
936 return n->GetKind() == eDeferStmt;
939 const GoASTCallExpr *
942 return m_call_up.get();
945 SetCall(GoASTCallExpr *call)
947 m_call_up.reset(call);
951 friend class GoASTNode;
952 std::unique_ptr<GoASTCallExpr> m_call_up;
954 GoASTDeferStmt(const GoASTDeferStmt &) = delete;
955 const GoASTDeferStmt &operator=(const GoASTDeferStmt &) = delete;
958 class GoASTEllipsis : public GoASTExpr
961 explicit GoASTEllipsis(GoASTExpr *elt) : GoASTExpr(eEllipsis), m_elt_up(elt) {}
962 ~GoASTEllipsis() override = default;
965 GetKindName() const override
971 classof(const GoASTNode *n)
973 return n->GetKind() == eEllipsis;
979 return m_elt_up.get();
982 SetElt(GoASTExpr *elt)
988 friend class GoASTNode;
989 std::unique_ptr<GoASTExpr> m_elt_up;
991 GoASTEllipsis(const GoASTEllipsis &) = delete;
992 const GoASTEllipsis &operator=(const GoASTEllipsis &) = delete;
995 class GoASTEmptyStmt : public GoASTStmt
998 GoASTEmptyStmt() : GoASTStmt(eEmptyStmt) {}
999 ~GoASTEmptyStmt() override = default;
1002 GetKindName() const override
1008 classof(const GoASTNode *n)
1010 return n->GetKind() == eEmptyStmt;
1013 GoASTEmptyStmt(const GoASTEmptyStmt &) = delete;
1014 const GoASTEmptyStmt &operator=(const GoASTEmptyStmt &) = delete;
1017 class GoASTExprStmt : public GoASTStmt
1020 explicit GoASTExprStmt(GoASTExpr *x) : GoASTStmt(eExprStmt), m_x_up(x) {}
1021 ~GoASTExprStmt() override = default;
1024 GetKindName() const override
1030 classof(const GoASTNode *n)
1032 return n->GetKind() == eExprStmt;
1038 return m_x_up.get();
1047 friend class GoASTNode;
1048 std::unique_ptr<GoASTExpr> m_x_up;
1050 GoASTExprStmt(const GoASTExprStmt &) = delete;
1051 const GoASTExprStmt &operator=(const GoASTExprStmt &) = delete;
1054 class GoASTField : public GoASTNode
1057 GoASTField() : GoASTNode(eField) {}
1058 ~GoASTField() override = default;
1061 GetKindName() const override
1067 classof(const GoASTNode *n)
1069 return n->GetKind() == eField;
1075 return m_names.size();
1078 GetNames(int i) const
1080 return m_names[i].get();
1083 AddNames(GoASTIdent *names)
1085 m_names.push_back(std::unique_ptr<GoASTIdent>(names));
1091 return m_type_up.get();
1094 SetType(GoASTExpr *type)
1096 m_type_up.reset(type);
1099 const GoASTBasicLit *
1102 return m_tag_up.get();
1105 SetTag(GoASTBasicLit *tag)
1107 m_tag_up.reset(tag);
1111 friend class GoASTNode;
1112 std::vector<std::unique_ptr<GoASTIdent> > m_names;
1113 std::unique_ptr<GoASTExpr> m_type_up;
1114 std::unique_ptr<GoASTBasicLit> m_tag_up;
1116 GoASTField(const GoASTField &) = delete;
1117 const GoASTField &operator=(const GoASTField &) = delete;
1120 class GoASTFieldList : public GoASTNode
1123 GoASTFieldList() : GoASTNode(eFieldList) {}
1124 ~GoASTFieldList() override = default;
1127 GetKindName() const override
1133 classof(const GoASTNode *n)
1135 return n->GetKind() == eFieldList;
1141 return m_list.size();
1144 GetList(int i) const
1146 return m_list[i].get();
1149 AddList(GoASTField *list)
1151 m_list.push_back(std::unique_ptr<GoASTField>(list));
1155 friend class GoASTNode;
1156 std::vector<std::unique_ptr<GoASTField> > m_list;
1158 GoASTFieldList(const GoASTFieldList &) = delete;
1159 const GoASTFieldList &operator=(const GoASTFieldList &) = delete;
1162 class GoASTForStmt : public GoASTStmt
1165 GoASTForStmt(GoASTStmt *init, GoASTExpr *cond, GoASTStmt *post, GoASTBlockStmt *body) : GoASTStmt(eForStmt), m_init_up(init), m_cond_up(cond), m_post_up(post), m_body_up(body) {}
1166 ~GoASTForStmt() override = default;
1169 GetKindName() const override
1175 classof(const GoASTNode *n)
1177 return n->GetKind() == eForStmt;
1183 return m_init_up.get();
1186 SetInit(GoASTStmt *init)
1188 m_init_up.reset(init);
1194 return m_cond_up.get();
1197 SetCond(GoASTExpr *cond)
1199 m_cond_up.reset(cond);
1205 return m_post_up.get();
1208 SetPost(GoASTStmt *post)
1210 m_post_up.reset(post);
1213 const GoASTBlockStmt *
1216 return m_body_up.get();
1219 SetBody(GoASTBlockStmt *body)
1221 m_body_up.reset(body);
1225 friend class GoASTNode;
1226 std::unique_ptr<GoASTStmt> m_init_up;
1227 std::unique_ptr<GoASTExpr> m_cond_up;
1228 std::unique_ptr<GoASTStmt> m_post_up;
1229 std::unique_ptr<GoASTBlockStmt> m_body_up;
1231 GoASTForStmt(const GoASTForStmt &) = delete;
1232 const GoASTForStmt &operator=(const GoASTForStmt &) = delete;
1235 class GoASTFuncType : public GoASTExpr
1238 GoASTFuncType(GoASTFieldList *params, GoASTFieldList *results) : GoASTExpr(eFuncType), m_params_up(params), m_results_up(results) {}
1239 ~GoASTFuncType() override = default;
1242 GetKindName() const override
1248 classof(const GoASTNode *n)
1250 return n->GetKind() == eFuncType;
1253 const GoASTFieldList *
1256 return m_params_up.get();
1259 SetParams(GoASTFieldList *params)
1261 m_params_up.reset(params);
1264 const GoASTFieldList *
1267 return m_results_up.get();
1270 SetResults(GoASTFieldList *results)
1272 m_results_up.reset(results);
1276 friend class GoASTNode;
1277 std::unique_ptr<GoASTFieldList> m_params_up;
1278 std::unique_ptr<GoASTFieldList> m_results_up;
1280 GoASTFuncType(const GoASTFuncType &) = delete;
1281 const GoASTFuncType &operator=(const GoASTFuncType &) = delete;
1284 class GoASTFuncDecl : public GoASTDecl
1287 GoASTFuncDecl(GoASTFieldList *recv, GoASTIdent *name, GoASTFuncType *type, GoASTBlockStmt *body) : GoASTDecl(eFuncDecl), m_recv_up(recv), m_name_up(name), m_type_up(type), m_body_up(body) {}
1288 ~GoASTFuncDecl() override = default;
1291 GetKindName() const override
1297 classof(const GoASTNode *n)
1299 return n->GetKind() == eFuncDecl;
1302 const GoASTFieldList *
1305 return m_recv_up.get();
1308 SetRecv(GoASTFieldList *recv)
1310 m_recv_up.reset(recv);
1316 return m_name_up.get();
1319 SetName(GoASTIdent *name)
1321 m_name_up.reset(name);
1324 const GoASTFuncType *
1327 return m_type_up.get();
1330 SetType(GoASTFuncType *type)
1332 m_type_up.reset(type);
1335 const GoASTBlockStmt *
1338 return m_body_up.get();
1341 SetBody(GoASTBlockStmt *body)
1343 m_body_up.reset(body);
1347 friend class GoASTNode;
1348 std::unique_ptr<GoASTFieldList> m_recv_up;
1349 std::unique_ptr<GoASTIdent> m_name_up;
1350 std::unique_ptr<GoASTFuncType> m_type_up;
1351 std::unique_ptr<GoASTBlockStmt> m_body_up;
1353 GoASTFuncDecl(const GoASTFuncDecl &) = delete;
1354 const GoASTFuncDecl &operator=(const GoASTFuncDecl &) = delete;
1357 class GoASTFuncLit : public GoASTExpr
1360 GoASTFuncLit(GoASTFuncType *type, GoASTBlockStmt *body) : GoASTExpr(eFuncLit), m_type_up(type), m_body_up(body) {}
1361 ~GoASTFuncLit() override = default;
1364 GetKindName() const override
1370 classof(const GoASTNode *n)
1372 return n->GetKind() == eFuncLit;
1375 const GoASTFuncType *
1378 return m_type_up.get();
1381 SetType(GoASTFuncType *type)
1383 m_type_up.reset(type);
1386 const GoASTBlockStmt *
1389 return m_body_up.get();
1392 SetBody(GoASTBlockStmt *body)
1394 m_body_up.reset(body);
1398 friend class GoASTNode;
1399 std::unique_ptr<GoASTFuncType> m_type_up;
1400 std::unique_ptr<GoASTBlockStmt> m_body_up;
1402 GoASTFuncLit(const GoASTFuncLit &) = delete;
1403 const GoASTFuncLit &operator=(const GoASTFuncLit &) = delete;
1406 class GoASTGenDecl : public GoASTDecl
1409 explicit GoASTGenDecl(TokenType tok) : GoASTDecl(eGenDecl), m_tok(tok) {}
1410 ~GoASTGenDecl() override = default;
1413 GetKindName() const override
1419 classof(const GoASTNode *n)
1421 return n->GetKind() == eGenDecl;
1430 SetTok(TokenType tok)
1438 return m_specs.size();
1441 GetSpecs(int i) const
1443 return m_specs[i].get();
1446 AddSpecs(GoASTSpec *specs)
1448 m_specs.push_back(std::unique_ptr<GoASTSpec>(specs));
1452 friend class GoASTNode;
1454 std::vector<std::unique_ptr<GoASTSpec> > m_specs;
1456 GoASTGenDecl(const GoASTGenDecl &) = delete;
1457 const GoASTGenDecl &operator=(const GoASTGenDecl &) = delete;
1460 class GoASTGoStmt : public GoASTStmt
1463 explicit GoASTGoStmt(GoASTCallExpr *call) : GoASTStmt(eGoStmt), m_call_up(call) {}
1464 ~GoASTGoStmt() override = default;
1467 GetKindName() const override
1473 classof(const GoASTNode *n)
1475 return n->GetKind() == eGoStmt;
1478 const GoASTCallExpr *
1481 return m_call_up.get();
1484 SetCall(GoASTCallExpr *call)
1486 m_call_up.reset(call);
1490 friend class GoASTNode;
1491 std::unique_ptr<GoASTCallExpr> m_call_up;
1493 GoASTGoStmt(const GoASTGoStmt &) = delete;
1494 const GoASTGoStmt &operator=(const GoASTGoStmt &) = delete;
1497 class GoASTIfStmt : public GoASTStmt
1500 GoASTIfStmt(GoASTStmt *init, GoASTExpr *cond, GoASTBlockStmt *body, GoASTStmt *els) : GoASTStmt(eIfStmt), m_init_up(init), m_cond_up(cond), m_body_up(body), m_els_up(els) {}
1501 ~GoASTIfStmt() override = default;
1504 GetKindName() const override
1510 classof(const GoASTNode *n)
1512 return n->GetKind() == eIfStmt;
1518 return m_init_up.get();
1521 SetInit(GoASTStmt *init)
1523 m_init_up.reset(init);
1529 return m_cond_up.get();
1532 SetCond(GoASTExpr *cond)
1534 m_cond_up.reset(cond);
1537 const GoASTBlockStmt *
1540 return m_body_up.get();
1543 SetBody(GoASTBlockStmt *body)
1545 m_body_up.reset(body);
1551 return m_els_up.get();
1554 SetEls(GoASTStmt *els)
1556 m_els_up.reset(els);
1560 friend class GoASTNode;
1561 std::unique_ptr<GoASTStmt> m_init_up;
1562 std::unique_ptr<GoASTExpr> m_cond_up;
1563 std::unique_ptr<GoASTBlockStmt> m_body_up;
1564 std::unique_ptr<GoASTStmt> m_els_up;
1566 GoASTIfStmt(const GoASTIfStmt &) = delete;
1567 const GoASTIfStmt &operator=(const GoASTIfStmt &) = delete;
1570 class GoASTImportSpec : public GoASTSpec
1573 GoASTImportSpec(GoASTIdent *name, GoASTBasicLit *path) : GoASTSpec(eImportSpec), m_name_up(name), m_path_up(path) {}
1574 ~GoASTImportSpec() override = default;
1577 GetKindName() const override
1579 return "ImportSpec";
1583 classof(const GoASTNode *n)
1585 return n->GetKind() == eImportSpec;
1591 return m_name_up.get();
1594 SetName(GoASTIdent *name)
1596 m_name_up.reset(name);
1599 const GoASTBasicLit *
1602 return m_path_up.get();
1605 SetPath(GoASTBasicLit *path)
1607 m_path_up.reset(path);
1611 friend class GoASTNode;
1612 std::unique_ptr<GoASTIdent> m_name_up;
1613 std::unique_ptr<GoASTBasicLit> m_path_up;
1615 GoASTImportSpec(const GoASTImportSpec &) = delete;
1616 const GoASTImportSpec &operator=(const GoASTImportSpec &) = delete;
1619 class GoASTIncDecStmt : public GoASTStmt
1622 GoASTIncDecStmt(GoASTExpr *x, TokenType tok) : GoASTStmt(eIncDecStmt), m_x_up(x), m_tok(tok) {}
1623 ~GoASTIncDecStmt() override = default;
1626 GetKindName() const override
1628 return "IncDecStmt";
1632 classof(const GoASTNode *n)
1634 return n->GetKind() == eIncDecStmt;
1640 return m_x_up.get();
1654 SetTok(TokenType tok)
1660 friend class GoASTNode;
1661 std::unique_ptr<GoASTExpr> m_x_up;
1664 GoASTIncDecStmt(const GoASTIncDecStmt &) = delete;
1665 const GoASTIncDecStmt &operator=(const GoASTIncDecStmt &) = delete;
1668 class GoASTIndexExpr : public GoASTExpr
1671 GoASTIndexExpr(GoASTExpr *x, GoASTExpr *index) : GoASTExpr(eIndexExpr), m_x_up(x), m_index_up(index) {}
1672 ~GoASTIndexExpr() override = default;
1675 GetKindName() const override
1681 classof(const GoASTNode *n)
1683 return n->GetKind() == eIndexExpr;
1689 return m_x_up.get();
1700 return m_index_up.get();
1703 SetIndex(GoASTExpr *index)
1705 m_index_up.reset(index);
1709 friend class GoASTNode;
1710 std::unique_ptr<GoASTExpr> m_x_up;
1711 std::unique_ptr<GoASTExpr> m_index_up;
1713 GoASTIndexExpr(const GoASTIndexExpr &) = delete;
1714 const GoASTIndexExpr &operator=(const GoASTIndexExpr &) = delete;
1717 class GoASTInterfaceType : public GoASTExpr
1720 explicit GoASTInterfaceType(GoASTFieldList *methods) : GoASTExpr(eInterfaceType), m_methods_up(methods) {}
1721 ~GoASTInterfaceType() override = default;
1724 GetKindName() const override
1726 return "InterfaceType";
1730 classof(const GoASTNode *n)
1732 return n->GetKind() == eInterfaceType;
1735 const GoASTFieldList *
1738 return m_methods_up.get();
1741 SetMethods(GoASTFieldList *methods)
1743 m_methods_up.reset(methods);
1747 friend class GoASTNode;
1748 std::unique_ptr<GoASTFieldList> m_methods_up;
1750 GoASTInterfaceType(const GoASTInterfaceType &) = delete;
1751 const GoASTInterfaceType &operator=(const GoASTInterfaceType &) = delete;
1754 class GoASTKeyValueExpr : public GoASTExpr
1757 GoASTKeyValueExpr(GoASTExpr *key, GoASTExpr *value) : GoASTExpr(eKeyValueExpr), m_key_up(key), m_value_up(value) {}
1758 ~GoASTKeyValueExpr() override = default;
1761 GetKindName() const override
1763 return "KeyValueExpr";
1767 classof(const GoASTNode *n)
1769 return n->GetKind() == eKeyValueExpr;
1775 return m_key_up.get();
1778 SetKey(GoASTExpr *key)
1780 m_key_up.reset(key);
1786 return m_value_up.get();
1789 SetValue(GoASTExpr *value)
1791 m_value_up.reset(value);
1795 friend class GoASTNode;
1796 std::unique_ptr<GoASTExpr> m_key_up;
1797 std::unique_ptr<GoASTExpr> m_value_up;
1799 GoASTKeyValueExpr(const GoASTKeyValueExpr &) = delete;
1800 const GoASTKeyValueExpr &operator=(const GoASTKeyValueExpr &) = delete;
1803 class GoASTLabeledStmt : public GoASTStmt
1806 GoASTLabeledStmt(GoASTIdent *label, GoASTStmt *stmt) : GoASTStmt(eLabeledStmt), m_label_up(label), m_stmt_up(stmt) {}
1807 ~GoASTLabeledStmt() override = default;
1810 GetKindName() const override
1812 return "LabeledStmt";
1816 classof(const GoASTNode *n)
1818 return n->GetKind() == eLabeledStmt;
1824 return m_label_up.get();
1827 SetLabel(GoASTIdent *label)
1829 m_label_up.reset(label);
1835 return m_stmt_up.get();
1838 SetStmt(GoASTStmt *stmt)
1840 m_stmt_up.reset(stmt);
1844 friend class GoASTNode;
1845 std::unique_ptr<GoASTIdent> m_label_up;
1846 std::unique_ptr<GoASTStmt> m_stmt_up;
1848 GoASTLabeledStmt(const GoASTLabeledStmt &) = delete;
1849 const GoASTLabeledStmt &operator=(const GoASTLabeledStmt &) = delete;
1852 class GoASTMapType : public GoASTExpr
1855 GoASTMapType(GoASTExpr *key, GoASTExpr *value) : GoASTExpr(eMapType), m_key_up(key), m_value_up(value) {}
1856 ~GoASTMapType() override = default;
1859 GetKindName() const override
1865 classof(const GoASTNode *n)
1867 return n->GetKind() == eMapType;
1873 return m_key_up.get();
1876 SetKey(GoASTExpr *key)
1878 m_key_up.reset(key);
1884 return m_value_up.get();
1887 SetValue(GoASTExpr *value)
1889 m_value_up.reset(value);
1893 friend class GoASTNode;
1894 std::unique_ptr<GoASTExpr> m_key_up;
1895 std::unique_ptr<GoASTExpr> m_value_up;
1897 GoASTMapType(const GoASTMapType &) = delete;
1898 const GoASTMapType &operator=(const GoASTMapType &) = delete;
1901 class GoASTParenExpr : public GoASTExpr
1904 explicit GoASTParenExpr(GoASTExpr *x) : GoASTExpr(eParenExpr), m_x_up(x) {}
1905 ~GoASTParenExpr() override = default;
1908 GetKindName() const override
1914 classof(const GoASTNode *n)
1916 return n->GetKind() == eParenExpr;
1922 return m_x_up.get();
1931 friend class GoASTNode;
1932 std::unique_ptr<GoASTExpr> m_x_up;
1934 GoASTParenExpr(const GoASTParenExpr &) = delete;
1935 const GoASTParenExpr &operator=(const GoASTParenExpr &) = delete;
1938 class GoASTRangeStmt : public GoASTStmt
1941 GoASTRangeStmt(GoASTExpr *key, GoASTExpr *value, bool define, GoASTExpr *x, GoASTBlockStmt *body) : GoASTStmt(eRangeStmt), m_key_up(key), m_value_up(value), m_define(define), m_x_up(x), m_body_up(body) {}
1942 ~GoASTRangeStmt() override = default;
1945 GetKindName() const override
1951 classof(const GoASTNode *n)
1953 return n->GetKind() == eRangeStmt;
1959 return m_key_up.get();
1962 SetKey(GoASTExpr *key)
1964 m_key_up.reset(key);
1970 return m_value_up.get();
1973 SetValue(GoASTExpr *value)
1975 m_value_up.reset(value);
1984 SetDefine(bool define)
1992 return m_x_up.get();
2000 const GoASTBlockStmt *
2003 return m_body_up.get();
2006 SetBody(GoASTBlockStmt *body)
2008 m_body_up.reset(body);
2012 friend class GoASTNode;
2013 std::unique_ptr<GoASTExpr> m_key_up;
2014 std::unique_ptr<GoASTExpr> m_value_up;
2016 std::unique_ptr<GoASTExpr> m_x_up;
2017 std::unique_ptr<GoASTBlockStmt> m_body_up;
2019 GoASTRangeStmt(const GoASTRangeStmt &) = delete;
2020 const GoASTRangeStmt &operator=(const GoASTRangeStmt &) = delete;
2023 class GoASTReturnStmt : public GoASTStmt
2026 GoASTReturnStmt() : GoASTStmt(eReturnStmt) {}
2027 ~GoASTReturnStmt() override = default;
2030 GetKindName() const override
2032 return "ReturnStmt";
2036 classof(const GoASTNode *n)
2038 return n->GetKind() == eReturnStmt;
2044 return m_results.size();
2047 GetResults(int i) const
2049 return m_results[i].get();
2052 AddResults(GoASTExpr *results)
2054 m_results.push_back(std::unique_ptr<GoASTExpr>(results));
2058 friend class GoASTNode;
2059 std::vector<std::unique_ptr<GoASTExpr> > m_results;
2061 GoASTReturnStmt(const GoASTReturnStmt &) = delete;
2062 const GoASTReturnStmt &operator=(const GoASTReturnStmt &) = delete;
2065 class GoASTSelectStmt : public GoASTStmt
2068 explicit GoASTSelectStmt(GoASTBlockStmt *body) : GoASTStmt(eSelectStmt), m_body_up(body) {}
2069 ~GoASTSelectStmt() override = default;
2072 GetKindName() const override
2074 return "SelectStmt";
2078 classof(const GoASTNode *n)
2080 return n->GetKind() == eSelectStmt;
2083 const GoASTBlockStmt *
2086 return m_body_up.get();
2089 SetBody(GoASTBlockStmt *body)
2091 m_body_up.reset(body);
2095 friend class GoASTNode;
2096 std::unique_ptr<GoASTBlockStmt> m_body_up;
2098 GoASTSelectStmt(const GoASTSelectStmt &) = delete;
2099 const GoASTSelectStmt &operator=(const GoASTSelectStmt &) = delete;
2102 class GoASTSelectorExpr : public GoASTExpr
2105 GoASTSelectorExpr(GoASTExpr *x, GoASTIdent *sel) : GoASTExpr(eSelectorExpr), m_x_up(x), m_sel_up(sel) {}
2106 ~GoASTSelectorExpr() override = default;
2109 GetKindName() const override
2111 return "SelectorExpr";
2115 classof(const GoASTNode *n)
2117 return n->GetKind() == eSelectorExpr;
2123 return m_x_up.get();
2134 return m_sel_up.get();
2137 SetSel(GoASTIdent *sel)
2139 m_sel_up.reset(sel);
2143 friend class GoASTNode;
2144 std::unique_ptr<GoASTExpr> m_x_up;
2145 std::unique_ptr<GoASTIdent> m_sel_up;
2147 GoASTSelectorExpr(const GoASTSelectorExpr &) = delete;
2148 const GoASTSelectorExpr &operator=(const GoASTSelectorExpr &) = delete;
2151 class GoASTSendStmt : public GoASTStmt
2154 GoASTSendStmt(GoASTExpr *chan, GoASTExpr *value) : GoASTStmt(eSendStmt), m_chan_up(chan), m_value_up(value) {}
2155 ~GoASTSendStmt() override = default;
2158 GetKindName() const override
2164 classof(const GoASTNode *n)
2166 return n->GetKind() == eSendStmt;
2172 return m_chan_up.get();
2175 SetChan(GoASTExpr *chan)
2177 m_chan_up.reset(chan);
2183 return m_value_up.get();
2186 SetValue(GoASTExpr *value)
2188 m_value_up.reset(value);
2192 friend class GoASTNode;
2193 std::unique_ptr<GoASTExpr> m_chan_up;
2194 std::unique_ptr<GoASTExpr> m_value_up;
2196 GoASTSendStmt(const GoASTSendStmt &) = delete;
2197 const GoASTSendStmt &operator=(const GoASTSendStmt &) = delete;
2200 class GoASTSliceExpr : public GoASTExpr
2203 GoASTSliceExpr(GoASTExpr *x, GoASTExpr *low, GoASTExpr *high, GoASTExpr *max, bool slice3) : GoASTExpr(eSliceExpr), m_x_up(x), m_low_up(low), m_high_up(high), m_max_up(max), m_slice3(slice3) {}
2204 ~GoASTSliceExpr() override = default;
2207 GetKindName() const override
2213 classof(const GoASTNode *n)
2215 return n->GetKind() == eSliceExpr;
2221 return m_x_up.get();
2232 return m_low_up.get();
2235 SetLow(GoASTExpr *low)
2237 m_low_up.reset(low);
2243 return m_high_up.get();
2246 SetHigh(GoASTExpr *high)
2248 m_high_up.reset(high);
2254 return m_max_up.get();
2257 SetMax(GoASTExpr *max)
2259 m_max_up.reset(max);
2268 SetSlice3(bool slice3)
2274 friend class GoASTNode;
2275 std::unique_ptr<GoASTExpr> m_x_up;
2276 std::unique_ptr<GoASTExpr> m_low_up;
2277 std::unique_ptr<GoASTExpr> m_high_up;
2278 std::unique_ptr<GoASTExpr> m_max_up;
2281 GoASTSliceExpr(const GoASTSliceExpr &) = delete;
2282 const GoASTSliceExpr &operator=(const GoASTSliceExpr &) = delete;
2285 class GoASTStarExpr : public GoASTExpr
2288 explicit GoASTStarExpr(GoASTExpr *x) : GoASTExpr(eStarExpr), m_x_up(x) {}
2289 ~GoASTStarExpr() override = default;
2292 GetKindName() const override
2298 classof(const GoASTNode *n)
2300 return n->GetKind() == eStarExpr;
2306 return m_x_up.get();
2315 friend class GoASTNode;
2316 std::unique_ptr<GoASTExpr> m_x_up;
2318 GoASTStarExpr(const GoASTStarExpr &) = delete;
2319 const GoASTStarExpr &operator=(const GoASTStarExpr &) = delete;
2322 class GoASTStructType : public GoASTExpr
2325 explicit GoASTStructType(GoASTFieldList *fields) : GoASTExpr(eStructType), m_fields_up(fields) {}
2326 ~GoASTStructType() override = default;
2329 GetKindName() const override
2331 return "StructType";
2335 classof(const GoASTNode *n)
2337 return n->GetKind() == eStructType;
2340 const GoASTFieldList *
2343 return m_fields_up.get();
2346 SetFields(GoASTFieldList *fields)
2348 m_fields_up.reset(fields);
2352 friend class GoASTNode;
2353 std::unique_ptr<GoASTFieldList> m_fields_up;
2355 GoASTStructType(const GoASTStructType &) = delete;
2356 const GoASTStructType &operator=(const GoASTStructType &) = delete;
2359 class GoASTSwitchStmt : public GoASTStmt
2362 GoASTSwitchStmt(GoASTStmt *init, GoASTExpr *tag, GoASTBlockStmt *body) : GoASTStmt(eSwitchStmt), m_init_up(init), m_tag_up(tag), m_body_up(body) {}
2363 ~GoASTSwitchStmt() override = default;
2366 GetKindName() const override
2368 return "SwitchStmt";
2372 classof(const GoASTNode *n)
2374 return n->GetKind() == eSwitchStmt;
2380 return m_init_up.get();
2383 SetInit(GoASTStmt *init)
2385 m_init_up.reset(init);
2391 return m_tag_up.get();
2394 SetTag(GoASTExpr *tag)
2396 m_tag_up.reset(tag);
2399 const GoASTBlockStmt *
2402 return m_body_up.get();
2405 SetBody(GoASTBlockStmt *body)
2407 m_body_up.reset(body);
2411 friend class GoASTNode;
2412 std::unique_ptr<GoASTStmt> m_init_up;
2413 std::unique_ptr<GoASTExpr> m_tag_up;
2414 std::unique_ptr<GoASTBlockStmt> m_body_up;
2416 GoASTSwitchStmt(const GoASTSwitchStmt &) = delete;
2417 const GoASTSwitchStmt &operator=(const GoASTSwitchStmt &) = delete;
2420 class GoASTTypeAssertExpr : public GoASTExpr
2423 GoASTTypeAssertExpr(GoASTExpr *x, GoASTExpr *type) : GoASTExpr(eTypeAssertExpr), m_x_up(x), m_type_up(type) {}
2424 ~GoASTTypeAssertExpr() override = default;
2427 GetKindName() const override
2429 return "TypeAssertExpr";
2433 classof(const GoASTNode *n)
2435 return n->GetKind() == eTypeAssertExpr;
2441 return m_x_up.get();
2452 return m_type_up.get();
2455 SetType(GoASTExpr *type)
2457 m_type_up.reset(type);
2461 friend class GoASTNode;
2462 std::unique_ptr<GoASTExpr> m_x_up;
2463 std::unique_ptr<GoASTExpr> m_type_up;
2465 GoASTTypeAssertExpr(const GoASTTypeAssertExpr &) = delete;
2466 const GoASTTypeAssertExpr &operator=(const GoASTTypeAssertExpr &) = delete;
2469 class GoASTTypeSpec : public GoASTSpec
2472 GoASTTypeSpec(GoASTIdent *name, GoASTExpr *type) : GoASTSpec(eTypeSpec), m_name_up(name), m_type_up(type) {}
2473 ~GoASTTypeSpec() override = default;
2476 GetKindName() const override
2482 classof(const GoASTNode *n)
2484 return n->GetKind() == eTypeSpec;
2490 return m_name_up.get();
2493 SetName(GoASTIdent *name)
2495 m_name_up.reset(name);
2501 return m_type_up.get();
2504 SetType(GoASTExpr *type)
2506 m_type_up.reset(type);
2510 friend class GoASTNode;
2511 std::unique_ptr<GoASTIdent> m_name_up;
2512 std::unique_ptr<GoASTExpr> m_type_up;
2514 GoASTTypeSpec(const GoASTTypeSpec &) = delete;
2515 const GoASTTypeSpec &operator=(const GoASTTypeSpec &) = delete;
2518 class GoASTTypeSwitchStmt : public GoASTStmt
2521 GoASTTypeSwitchStmt(GoASTStmt *init, GoASTStmt *assign, GoASTBlockStmt *body) : GoASTStmt(eTypeSwitchStmt), m_init_up(init), m_assign_up(assign), m_body_up(body) {}
2522 ~GoASTTypeSwitchStmt() override = default;
2525 GetKindName() const override
2527 return "TypeSwitchStmt";
2531 classof(const GoASTNode *n)
2533 return n->GetKind() == eTypeSwitchStmt;
2539 return m_init_up.get();
2542 SetInit(GoASTStmt *init)
2544 m_init_up.reset(init);
2550 return m_assign_up.get();
2553 SetAssign(GoASTStmt *assign)
2555 m_assign_up.reset(assign);
2558 const GoASTBlockStmt *
2561 return m_body_up.get();
2564 SetBody(GoASTBlockStmt *body)
2566 m_body_up.reset(body);
2570 friend class GoASTNode;
2571 std::unique_ptr<GoASTStmt> m_init_up;
2572 std::unique_ptr<GoASTStmt> m_assign_up;
2573 std::unique_ptr<GoASTBlockStmt> m_body_up;
2575 GoASTTypeSwitchStmt(const GoASTTypeSwitchStmt &) = delete;
2576 const GoASTTypeSwitchStmt &operator=(const GoASTTypeSwitchStmt &) = delete;
2579 class GoASTUnaryExpr : public GoASTExpr
2582 GoASTUnaryExpr(TokenType op, GoASTExpr *x) : GoASTExpr(eUnaryExpr), m_op(op), m_x_up(x) {}
2583 ~GoASTUnaryExpr() override = default;
2586 GetKindName() const override
2592 classof(const GoASTNode *n)
2594 return n->GetKind() == eUnaryExpr;
2611 return m_x_up.get();
2620 friend class GoASTNode;
2622 std::unique_ptr<GoASTExpr> m_x_up;
2624 GoASTUnaryExpr(const GoASTUnaryExpr &) = delete;
2625 const GoASTUnaryExpr &operator=(const GoASTUnaryExpr &) = delete;
2628 class GoASTValueSpec : public GoASTSpec
2631 GoASTValueSpec() : GoASTSpec(eValueSpec) {}
2632 ~GoASTValueSpec() override = default;
2635 GetKindName() const override
2641 classof(const GoASTNode *n)
2643 return n->GetKind() == eValueSpec;
2649 return m_names.size();
2652 GetNames(int i) const
2654 return m_names[i].get();
2657 AddNames(GoASTIdent *names)
2659 m_names.push_back(std::unique_ptr<GoASTIdent>(names));
2665 return m_type_up.get();
2668 SetType(GoASTExpr *type)
2670 m_type_up.reset(type);
2676 return m_values.size();
2679 GetValues(int i) const
2681 return m_values[i].get();
2684 AddValues(GoASTExpr *values)
2686 m_values.push_back(std::unique_ptr<GoASTExpr>(values));
2690 friend class GoASTNode;
2691 std::vector<std::unique_ptr<GoASTIdent> > m_names;
2692 std::unique_ptr<GoASTExpr> m_type_up;
2693 std::vector<std::unique_ptr<GoASTExpr> > m_values;
2695 GoASTValueSpec(const GoASTValueSpec &) = delete;
2696 const GoASTValueSpec &operator=(const GoASTValueSpec &) = delete;
2700 template <typename R, typename V>
2701 R GoASTDecl::Visit(V* v) const
2706 return v->VisitBadDecl(llvm::cast<const GoASTBadDecl>(this));
2708 return v->VisitFuncDecl(llvm::cast<const GoASTFuncDecl>(this));
2710 return v->VisitGenDecl(llvm::cast<const GoASTGenDecl>(this));
2712 assert(false && "Invalid kind");
2716 template <typename R, typename V>
2717 R GoASTExpr::Visit(V* v) const
2722 return v->VisitArrayType(llvm::cast<const GoASTArrayType>(this));
2724 return v->VisitBadExpr(llvm::cast<const GoASTBadExpr>(this));
2726 return v->VisitBasicLit(llvm::cast<const GoASTBasicLit>(this));
2728 return v->VisitBinaryExpr(llvm::cast<const GoASTBinaryExpr>(this));
2730 return v->VisitIdent(llvm::cast<const GoASTIdent>(this));
2732 return v->VisitCallExpr(llvm::cast<const GoASTCallExpr>(this));
2734 return v->VisitChanType(llvm::cast<const GoASTChanType>(this));
2736 return v->VisitCompositeLit(llvm::cast<const GoASTCompositeLit>(this));
2738 return v->VisitEllipsis(llvm::cast<const GoASTEllipsis>(this));
2740 return v->VisitFuncType(llvm::cast<const GoASTFuncType>(this));
2742 return v->VisitFuncLit(llvm::cast<const GoASTFuncLit>(this));
2744 return v->VisitIndexExpr(llvm::cast<const GoASTIndexExpr>(this));
2745 case eInterfaceType:
2746 return v->VisitInterfaceType(llvm::cast<const GoASTInterfaceType>(this));
2748 return v->VisitKeyValueExpr(llvm::cast<const GoASTKeyValueExpr>(this));
2750 return v->VisitMapType(llvm::cast<const GoASTMapType>(this));
2752 return v->VisitParenExpr(llvm::cast<const GoASTParenExpr>(this));
2754 return v->VisitSelectorExpr(llvm::cast<const GoASTSelectorExpr>(this));
2756 return v->VisitSliceExpr(llvm::cast<const GoASTSliceExpr>(this));
2758 return v->VisitStarExpr(llvm::cast<const GoASTStarExpr>(this));
2760 return v->VisitStructType(llvm::cast<const GoASTStructType>(this));
2761 case eTypeAssertExpr:
2762 return v->VisitTypeAssertExpr(llvm::cast<const GoASTTypeAssertExpr>(this));
2764 return v->VisitUnaryExpr(llvm::cast<const GoASTUnaryExpr>(this));
2766 assert(false && "Invalid kind");
2770 template <typename R, typename V>
2771 R GoASTSpec::Visit(V* v) const
2776 return v->VisitImportSpec(llvm::cast<const GoASTImportSpec>(this));
2778 return v->VisitTypeSpec(llvm::cast<const GoASTTypeSpec>(this));
2780 return v->VisitValueSpec(llvm::cast<const GoASTValueSpec>(this));
2782 assert(false && "Invalid kind");
2786 template <typename R, typename V>
2787 R GoASTStmt::Visit(V* v) const
2792 return v->VisitAssignStmt(llvm::cast<const GoASTAssignStmt>(this));
2794 return v->VisitBadStmt(llvm::cast<const GoASTBadStmt>(this));
2796 return v->VisitBlockStmt(llvm::cast<const GoASTBlockStmt>(this));
2798 return v->VisitBranchStmt(llvm::cast<const GoASTBranchStmt>(this));
2800 return v->VisitCaseClause(llvm::cast<const GoASTCaseClause>(this));
2802 return v->VisitCommClause(llvm::cast<const GoASTCommClause>(this));
2804 return v->VisitDeclStmt(llvm::cast<const GoASTDeclStmt>(this));
2806 return v->VisitDeferStmt(llvm::cast<const GoASTDeferStmt>(this));
2808 return v->VisitEmptyStmt(llvm::cast<const GoASTEmptyStmt>(this));
2810 return v->VisitExprStmt(llvm::cast<const GoASTExprStmt>(this));
2812 return v->VisitForStmt(llvm::cast<const GoASTForStmt>(this));
2814 return v->VisitGoStmt(llvm::cast<const GoASTGoStmt>(this));
2816 return v->VisitIfStmt(llvm::cast<const GoASTIfStmt>(this));
2818 return v->VisitIncDecStmt(llvm::cast<const GoASTIncDecStmt>(this));
2820 return v->VisitLabeledStmt(llvm::cast<const GoASTLabeledStmt>(this));
2822 return v->VisitRangeStmt(llvm::cast<const GoASTRangeStmt>(this));
2824 return v->VisitReturnStmt(llvm::cast<const GoASTReturnStmt>(this));
2826 return v->VisitSelectStmt(llvm::cast<const GoASTSelectStmt>(this));
2828 return v->VisitSendStmt(llvm::cast<const GoASTSendStmt>(this));
2830 return v->VisitSwitchStmt(llvm::cast<const GoASTSwitchStmt>(this));
2831 case eTypeSwitchStmt:
2832 return v->VisitTypeSwitchStmt(llvm::cast<const GoASTTypeSwitchStmt>(this));
2834 assert(false && "Invalid kind");
2838 template <typename V>
2839 void GoASTNode::WalkChildren(V &v)
2847 GoASTArrayType *n = llvm::cast<GoASTArrayType>(this);
2849 v(n->m_len_up.get());
2850 v(n->m_elt_up.get());
2855 GoASTAssignStmt *n = llvm::cast<GoASTAssignStmt>(this);
2857 for (auto& e : n->m_lhs) { v(e.get()); }
2858 for (auto& e : n->m_rhs) { v(e.get()); }
2863 GoASTBasicLit *n = llvm::cast<GoASTBasicLit>(this);
2869 GoASTBinaryExpr *n = llvm::cast<GoASTBinaryExpr>(this);
2877 GoASTBlockStmt *n = llvm::cast<GoASTBlockStmt>(this);
2879 for (auto& e : n->m_list) { v(e.get()); }
2884 GoASTIdent *n = llvm::cast<GoASTIdent>(this);
2890 GoASTBranchStmt *n = llvm::cast<GoASTBranchStmt>(this);
2892 v(n->m_label_up.get());
2897 GoASTCallExpr *n = llvm::cast<GoASTCallExpr>(this);
2899 v(n->m_fun_up.get());
2900 for (auto& e : n->m_args) { v(e.get()); }
2905 GoASTCaseClause *n = llvm::cast<GoASTCaseClause>(this);
2907 for (auto& e : n->m_list) { v(e.get()); }
2908 for (auto& e : n->m_body) { v(e.get()); }
2913 GoASTChanType *n = llvm::cast<GoASTChanType>(this);
2915 v(n->m_value_up.get());
2920 GoASTCommClause *n = llvm::cast<GoASTCommClause>(this);
2922 v(n->m_comm_up.get());
2923 for (auto& e : n->m_body) { v(e.get()); }
2928 GoASTCompositeLit *n = llvm::cast<GoASTCompositeLit>(this);
2930 v(n->m_type_up.get());
2931 for (auto& e : n->m_elts) { v(e.get()); }
2936 GoASTDeclStmt *n = llvm::cast<GoASTDeclStmt>(this);
2938 v(n->m_decl_up.get());
2943 GoASTDeferStmt *n = llvm::cast<GoASTDeferStmt>(this);
2945 v(n->m_call_up.get());
2950 GoASTEllipsis *n = llvm::cast<GoASTEllipsis>(this);
2952 v(n->m_elt_up.get());
2957 GoASTExprStmt *n = llvm::cast<GoASTExprStmt>(this);
2964 GoASTField *n = llvm::cast<GoASTField>(this);
2966 for (auto& e : n->m_names) { v(e.get()); }
2967 v(n->m_type_up.get());
2968 v(n->m_tag_up.get());
2973 GoASTFieldList *n = llvm::cast<GoASTFieldList>(this);
2975 for (auto& e : n->m_list) { v(e.get()); }
2980 GoASTForStmt *n = llvm::cast<GoASTForStmt>(this);
2982 v(n->m_init_up.get());
2983 v(n->m_cond_up.get());
2984 v(n->m_post_up.get());
2985 v(n->m_body_up.get());
2990 GoASTFuncType *n = llvm::cast<GoASTFuncType>(this);
2992 v(n->m_params_up.get());
2993 v(n->m_results_up.get());
2998 GoASTFuncDecl *n = llvm::cast<GoASTFuncDecl>(this);
3000 v(n->m_recv_up.get());
3001 v(n->m_name_up.get());
3002 v(n->m_type_up.get());
3003 v(n->m_body_up.get());
3008 GoASTFuncLit *n = llvm::cast<GoASTFuncLit>(this);
3010 v(n->m_type_up.get());
3011 v(n->m_body_up.get());
3016 GoASTGenDecl *n = llvm::cast<GoASTGenDecl>(this);
3018 for (auto& e : n->m_specs) { v(e.get()); }
3023 GoASTGoStmt *n = llvm::cast<GoASTGoStmt>(this);
3025 v(n->m_call_up.get());
3030 GoASTIfStmt *n = llvm::cast<GoASTIfStmt>(this);
3032 v(n->m_init_up.get());
3033 v(n->m_cond_up.get());
3034 v(n->m_body_up.get());
3035 v(n->m_els_up.get());
3040 GoASTImportSpec *n = llvm::cast<GoASTImportSpec>(this);
3042 v(n->m_name_up.get());
3043 v(n->m_path_up.get());
3048 GoASTIncDecStmt *n = llvm::cast<GoASTIncDecStmt>(this);
3055 GoASTIndexExpr *n = llvm::cast<GoASTIndexExpr>(this);
3058 v(n->m_index_up.get());
3061 case eInterfaceType:
3063 GoASTInterfaceType *n = llvm::cast<GoASTInterfaceType>(this);
3065 v(n->m_methods_up.get());
3070 GoASTKeyValueExpr *n = llvm::cast<GoASTKeyValueExpr>(this);
3072 v(n->m_key_up.get());
3073 v(n->m_value_up.get());
3078 GoASTLabeledStmt *n = llvm::cast<GoASTLabeledStmt>(this);
3080 v(n->m_label_up.get());
3081 v(n->m_stmt_up.get());
3086 GoASTMapType *n = llvm::cast<GoASTMapType>(this);
3088 v(n->m_key_up.get());
3089 v(n->m_value_up.get());
3094 GoASTParenExpr *n = llvm::cast<GoASTParenExpr>(this);
3101 GoASTRangeStmt *n = llvm::cast<GoASTRangeStmt>(this);
3103 v(n->m_key_up.get());
3104 v(n->m_value_up.get());
3106 v(n->m_body_up.get());
3111 GoASTReturnStmt *n = llvm::cast<GoASTReturnStmt>(this);
3113 for (auto& e : n->m_results) { v(e.get()); }
3118 GoASTSelectStmt *n = llvm::cast<GoASTSelectStmt>(this);
3120 v(n->m_body_up.get());
3125 GoASTSelectorExpr *n = llvm::cast<GoASTSelectorExpr>(this);
3128 v(n->m_sel_up.get());
3133 GoASTSendStmt *n = llvm::cast<GoASTSendStmt>(this);
3135 v(n->m_chan_up.get());
3136 v(n->m_value_up.get());
3141 GoASTSliceExpr *n = llvm::cast<GoASTSliceExpr>(this);
3144 v(n->m_low_up.get());
3145 v(n->m_high_up.get());
3146 v(n->m_max_up.get());
3151 GoASTStarExpr *n = llvm::cast<GoASTStarExpr>(this);
3158 GoASTStructType *n = llvm::cast<GoASTStructType>(this);
3160 v(n->m_fields_up.get());
3165 GoASTSwitchStmt *n = llvm::cast<GoASTSwitchStmt>(this);
3167 v(n->m_init_up.get());
3168 v(n->m_tag_up.get());
3169 v(n->m_body_up.get());
3172 case eTypeAssertExpr:
3174 GoASTTypeAssertExpr *n = llvm::cast<GoASTTypeAssertExpr>(this);
3177 v(n->m_type_up.get());
3182 GoASTTypeSpec *n = llvm::cast<GoASTTypeSpec>(this);
3184 v(n->m_name_up.get());
3185 v(n->m_type_up.get());
3188 case eTypeSwitchStmt:
3190 GoASTTypeSwitchStmt *n = llvm::cast<GoASTTypeSwitchStmt>(this);
3192 v(n->m_init_up.get());
3193 v(n->m_assign_up.get());
3194 v(n->m_body_up.get());
3199 GoASTUnaryExpr *n = llvm::cast<GoASTUnaryExpr>(this);
3206 GoASTValueSpec *n = llvm::cast<GoASTValueSpec>(this);
3208 for (auto& e : n->m_names) { v(e.get()); }
3209 v(n->m_type_up.get());
3210 for (auto& e : n->m_values) { v(e.get()); }
3222 } // namespace lldb_private