diff options
Diffstat (limited to 'src/shared/cplusplus')
-rw-r--r-- | src/shared/cplusplus/AST.cpp | 16 | ||||
-rw-r--r-- | src/shared/cplusplus/AST.h | 289 | ||||
-rw-r--r-- | src/shared/cplusplus/ASTClone.cpp | 1480 | ||||
-rw-r--r-- | src/shared/cplusplus/Parser.cpp | 10 | ||||
-rw-r--r-- | src/shared/cplusplus/cplusplus.pri | 1 |
5 files changed, 1773 insertions, 23 deletions
diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp index 5252c2d051..62871bbfd2 100644 --- a/src/shared/cplusplus/AST.cpp +++ b/src/shared/cplusplus/AST.cpp @@ -2030,8 +2030,8 @@ unsigned ObjCTypeNameAST::lastToken() const if (type_id) return type_id->lastToken(); - if (type_qualifier) - return type_qualifier + 1; + if (type_qualifier_token) + return type_qualifier_token + 1; return lparen_token + 1; } @@ -2214,22 +2214,22 @@ unsigned ObjCMethodDeclarationAST::lastToken() const unsigned ObjCSynthesizedPropertyAST::firstToken() const { - if (property_identifier) - return property_identifier; + if (property_identifier_token) + return property_identifier_token; else if (equals_token) return equals_token; else - return property_alias_identifier; + return alias_identifier_token; } unsigned ObjCSynthesizedPropertyAST::lastToken() const { - if (property_alias_identifier) - return property_alias_identifier + 1; + if (alias_identifier_token) + return alias_identifier_token + 1; else if (equals_token) return equals_token + 1; else - return property_identifier + 1; + return property_identifier_token + 1; } unsigned ObjCSynthesizedPropertiesDeclarationAST::firstToken() const diff --git a/src/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h index 8bbd9fe989..4d20094e9c 100644 --- a/src/shared/cplusplus/AST.h +++ b/src/shared/cplusplus/AST.h @@ -94,7 +94,7 @@ public: // ### assert(0); return 0; } - + _Tp value; List *next; }; @@ -143,15 +143,11 @@ public: virtual unsigned firstToken() const = 0; virtual unsigned lastToken() const = 0; + virtual AST *clone(MemoryPool *pool) const = 0; + virtual AccessDeclarationAST *asAccessDeclaration() { return 0; } virtual ArrayAccessAST *asArrayAccess() { return 0; } virtual ArrayDeclaratorAST *asArrayDeclarator() { return 0; } -#ifdef ICHECK_BUILD - virtual QPropertyDeclarationAST *asQPropertyDeclarationAST() { return 0; } - virtual QEnumDeclarationAST *asQEnumDeclarationAST() { return 0; } - virtual QFlagsDeclarationAST *asQFlagsDeclarationAST() { return 0; } - virtual QDeclareFlagsDeclarationAST *asQDeclareFlagsDeclarationAST() { return 0; } -#endif virtual ArrayInitializerAST *asArrayInitializer() { return 0; } virtual AsmDefinitionAST *asAsmDefinition() { return 0; } virtual AttributeAST *asAttribute() { return 0; } @@ -282,6 +278,12 @@ public: virtual UsingAST *asUsing() { return 0; } virtual UsingDirectiveAST *asUsingDirective() { return 0; } virtual WhileStatementAST *asWhileStatement() { return 0; } +#ifdef ICHECK_BUILD + virtual QPropertyDeclarationAST *asQPropertyDeclarationAST() { return 0; } + virtual QEnumDeclarationAST *asQEnumDeclarationAST() { return 0; } + virtual QFlagsDeclarationAST *asQFlagsDeclarationAST() { return 0; } + virtual QDeclareFlagsDeclarationAST *asQDeclareFlagsDeclarationAST() { return 0; } +#endif protected: virtual void accept0(ASTVisitor *visitor) = 0; @@ -292,18 +294,25 @@ class CPLUSPLUS_EXPORT StatementAST: public AST { public: virtual StatementAST *asStatement() { return this; } + + virtual StatementAST *clone(MemoryPool *pool) const = 0; }; class CPLUSPLUS_EXPORT ExpressionAST: public AST { public: virtual ExpressionAST *asExpression() { return this; } + + virtual ExpressionAST *clone(MemoryPool *pool) const = 0; }; class CPLUSPLUS_EXPORT DeclarationAST: public AST { public: virtual DeclarationAST *asDeclaration() { return this; } + + virtual DeclarationAST *clone(MemoryPool *pool) const = 0; + #ifdef ICHECK_BUILD unsigned invoke_token; #endif @@ -316,36 +325,48 @@ public: // annotations public: virtual NameAST *asName() { return this; } + + virtual NameAST *clone(MemoryPool *pool) const = 0; }; class CPLUSPLUS_EXPORT SpecifierAST: public AST { public: virtual SpecifierAST *asSpecifier() { return this; } + + virtual SpecifierAST *clone(MemoryPool *pool) const = 0; }; class CPLUSPLUS_EXPORT PtrOperatorAST: public AST { public: virtual PtrOperatorAST *asPtrOperator() { return this; } + + virtual PtrOperatorAST *clone(MemoryPool *pool) const = 0; }; class CPLUSPLUS_EXPORT PostfixAST: public AST { public: virtual PostfixAST *asPostfix() { return this; } + + virtual PostfixAST *clone(MemoryPool *pool) const = 0; }; class CPLUSPLUS_EXPORT CoreDeclaratorAST: public AST { public: virtual CoreDeclaratorAST *asCoreDeclarator() { return this; } + + virtual CoreDeclaratorAST *clone(MemoryPool *pool) const = 0; }; class CPLUSPLUS_EXPORT PostfixDeclaratorAST: public AST { public: virtual PostfixDeclaratorAST *asPostfixDeclarator() { return this; } + + virtual PostfixDeclaratorAST *clone(MemoryPool *pool) const = 0; }; class CPLUSPLUS_EXPORT ObjCSelectorAST: public AST @@ -355,6 +376,8 @@ public: // annotation public: virtual ObjCSelectorAST *asObjCSelector() { return this; } + + virtual ObjCSelectorAST *clone(MemoryPool *pool) const = 0; }; class CPLUSPLUS_EXPORT SimpleSpecifierAST: public SpecifierAST @@ -368,6 +391,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual SimpleSpecifierAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -389,6 +414,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual AttributeSpecifierAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -409,6 +436,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual AttributeAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -428,6 +457,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual TypeofSpecifierAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -450,6 +481,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual DeclaratorAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -472,6 +505,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual SimpleDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -488,6 +523,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual EmptyDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -506,6 +543,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual AccessDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -631,6 +670,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual AsmDefinitionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -652,6 +693,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual BaseSpecifierAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -671,6 +714,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual CompoundLiteralAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -690,6 +735,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual QtMethodAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -709,6 +756,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual QtMemberDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -727,6 +776,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual BinaryExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -746,6 +797,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual CastExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -772,6 +825,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ClassSpecifierAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -791,6 +846,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual CaseStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -812,6 +869,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual CompoundStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -829,6 +888,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ConditionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -849,6 +910,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ConditionalExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -871,6 +934,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual CppCastExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -888,6 +953,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual CtorInitializerAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -904,6 +971,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual DeclarationStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -920,6 +989,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual DeclaratorIdAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -938,6 +1009,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual NestedDeclaratorAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -962,6 +1035,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual FunctionDeclaratorAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -980,6 +1055,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ArrayDeclaratorAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1000,6 +1077,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual DeleteExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1022,6 +1101,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual DoStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1038,6 +1119,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual NamedTypeSpecifierAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1055,6 +1138,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ElaboratedTypeSpecifierAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1075,6 +1160,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual EnumSpecifierAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1093,6 +1180,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual EnumeratorAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1111,6 +1200,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ExceptionDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1131,6 +1222,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ExceptionSpecificationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1148,6 +1241,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ExpressionOrDeclarationStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1165,6 +1260,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ExpressionStatementAST *clone(MemoryPool *pool) const;; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1188,6 +1285,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual FunctionDefinitionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1217,6 +1316,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ForeachStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1243,6 +1344,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ForStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1268,6 +1371,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual IfStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1286,6 +1391,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ArrayInitializerAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1304,6 +1411,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual LabeledStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1321,6 +1430,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual LinkageBodyAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1339,6 +1450,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual LinkageSpecificationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1358,6 +1471,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual MemInitializerAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1375,6 +1490,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual NestedNameSpecifierAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1393,6 +1510,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual QualifiedNameAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1410,6 +1529,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual OperatorFunctionIdAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1428,6 +1549,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ConversionFunctionIdAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1444,6 +1567,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual SimpleNameAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1461,6 +1586,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual DestructorNameAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1480,6 +1607,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual TemplateIdAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1502,6 +1631,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual NamespaceAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1522,6 +1653,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual NamespaceAliasDefinitionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1540,6 +1673,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual NewPlacementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1558,6 +1693,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual NewArrayDeclaratorAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1584,6 +1721,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual NewExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1602,6 +1741,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual NewInitializerAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1620,6 +1761,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual NewTypeIdAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1638,6 +1781,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual OperatorAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1660,6 +1805,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ParameterDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1677,6 +1824,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ParameterDeclarationClauseAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1695,6 +1844,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual CallAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1713,6 +1864,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ArrayAccessAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1729,6 +1882,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual PostIncrDecrAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1747,6 +1902,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual MemberAccessAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1766,6 +1923,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual TypeidExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1786,6 +1945,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual TypenameCallExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1805,6 +1966,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual TypeConstructorCallAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1822,6 +1985,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual PostfixExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1841,6 +2006,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual PointerToMemberAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1858,6 +2025,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual PointerAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1874,6 +2043,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ReferenceAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1891,6 +2062,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual BreakStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1908,6 +2081,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ContinueStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1926,6 +2101,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual GotoStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1944,6 +2121,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ReturnStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1963,6 +2142,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual SizeofExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1979,6 +2160,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual NumericLiteralAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -1995,6 +2178,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual BoolLiteralAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2011,6 +2196,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ThisExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2029,6 +2216,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual NestedExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2046,6 +2235,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual StringLiteralAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2069,6 +2260,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual SwitchStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2090,6 +2283,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual TemplateDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2107,6 +2302,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ThrowExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2123,6 +2320,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual TranslationUnitAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2141,6 +2340,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual TryBlockStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2164,6 +2365,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual CatchClauseAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2181,6 +2384,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual TypeIdAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2203,6 +2408,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual TypenameTypeParameterAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2229,6 +2436,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual TemplateTypeParameterAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2246,6 +2455,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual UnaryExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2268,6 +2479,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual UsingAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2290,6 +2503,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual UsingDirectiveAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2313,6 +2528,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual WhileStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2335,6 +2552,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCClassForwardDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2366,6 +2585,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCClassDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2388,6 +2609,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCProtocolForwardDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2412,6 +2635,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCProtocolDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2430,6 +2655,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCProtocolRefsAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2446,6 +2673,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCMessageArgumentAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2466,6 +2695,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCMessageExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2485,6 +2716,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCProtocolExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2494,7 +2727,7 @@ class CPLUSPLUS_EXPORT ObjCTypeNameAST: public AST { public: unsigned lparen_token; - unsigned type_qualifier; + unsigned type_qualifier_token; ExpressionAST *type_id; unsigned rparen_token; @@ -2504,6 +2737,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCTypeNameAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2521,6 +2756,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCEncodeExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2537,6 +2774,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCSelectorWithoutArgumentsAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2554,6 +2793,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCSelectorArgumentAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2570,6 +2811,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCSelectorWithArgumentsAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2589,6 +2832,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCSelectorExpressionAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2607,6 +2852,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCInstanceVariablesDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2623,6 +2870,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCVisibilityDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2641,6 +2890,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCPropertyAttributeAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2665,6 +2916,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCPropertyDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2686,6 +2939,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCMessageArgumentDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2710,6 +2965,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCMethodPrototypeAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2728,6 +2985,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCMethodDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2736,9 +2995,9 @@ protected: class CPLUSPLUS_EXPORT ObjCSynthesizedPropertyAST: public AST { public: - unsigned property_identifier; + unsigned property_identifier_token; unsigned equals_token; - unsigned property_alias_identifier; + unsigned alias_identifier_token; public: virtual ObjCSynthesizedPropertyAST *asObjCSynthesizedProperty() { return this; } @@ -2746,6 +3005,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCSynthesizedPropertyAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2764,6 +3025,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCSynthesizedPropertiesDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2782,6 +3045,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCDynamicPropertiesDeclarationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2813,6 +3078,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCFastEnumerationAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); @@ -2833,6 +3100,8 @@ public: virtual unsigned firstToken() const; virtual unsigned lastToken() const; + virtual ObjCSynchronizedStatementAST *clone(MemoryPool *pool) const; + protected: virtual void accept0(ASTVisitor *visitor); virtual bool match0(AST *, ASTMatcher *); diff --git a/src/shared/cplusplus/ASTClone.cpp b/src/shared/cplusplus/ASTClone.cpp new file mode 100644 index 0000000000..c8ab87895a --- /dev/null +++ b/src/shared/cplusplus/ASTClone.cpp @@ -0,0 +1,1480 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is automatically generated. +// Changes will be lost. +// + +#include "AST.h" +#include "MemoryPool.h" + +using namespace CPlusPlus; + +SimpleSpecifierAST *SimpleSpecifierAST::clone(MemoryPool *pool) const +{ + SimpleSpecifierAST *ast = new (pool) SimpleSpecifierAST; + ast->specifier_token = specifier_token; + return ast; +} + +AttributeSpecifierAST *AttributeSpecifierAST::clone(MemoryPool *pool) const +{ + AttributeSpecifierAST *ast = new (pool) AttributeSpecifierAST; + ast->attribute_token = attribute_token; + ast->first_lparen_token = first_lparen_token; + ast->second_lparen_token = second_lparen_token; + for (AttributeListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) AttributeListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->first_rparen_token = first_rparen_token; + ast->second_rparen_token = second_rparen_token; + return ast; +} + +AttributeAST *AttributeAST::clone(MemoryPool *pool) const +{ + AttributeAST *ast = new (pool) AttributeAST; + ast->identifier_token = identifier_token; + ast->lparen_token = lparen_token; + ast->tag_token = tag_token; + for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->rparen_token = rparen_token; + return ast; +} + +TypeofSpecifierAST *TypeofSpecifierAST::clone(MemoryPool *pool) const +{ + TypeofSpecifierAST *ast = new (pool) TypeofSpecifierAST; + ast->typeof_token = typeof_token; + ast->lparen_token = lparen_token; + if (expression) + ast->expression = expression->clone(pool); + ast->rparen_token = rparen_token; + return ast; +} + +DeclaratorAST *DeclaratorAST::clone(MemoryPool *pool) const +{ + DeclaratorAST *ast = new (pool) DeclaratorAST; + for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + for (PtrOperatorListAST *iter = ptr_operator_list, **ast_iter = &ast->ptr_operator_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) PtrOperatorListAST((iter->value) ? iter->value->clone(pool) : 0); + if (core_declarator) + ast->core_declarator = core_declarator->clone(pool); + for (PostfixDeclaratorListAST *iter = postfix_declarator_list, **ast_iter = &ast->postfix_declarator_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) PostfixDeclaratorListAST((iter->value) ? iter->value->clone(pool) : 0); + for (SpecifierListAST *iter = post_attribute_list, **ast_iter = &ast->post_attribute_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->equals_token = equals_token; + if (initializer) + ast->initializer = initializer->clone(pool); + return ast; +} + +SimpleDeclarationAST *SimpleDeclarationAST::clone(MemoryPool *pool) const +{ + SimpleDeclarationAST *ast = new (pool) SimpleDeclarationAST; + ast->qt_invokable_token = qt_invokable_token; + for (SpecifierListAST *iter = decl_specifier_list, **ast_iter = &ast->decl_specifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + for (DeclaratorListAST *iter = declarator_list, **ast_iter = &ast->declarator_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) DeclaratorListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->semicolon_token = semicolon_token; + return ast; +} + +EmptyDeclarationAST *EmptyDeclarationAST::clone(MemoryPool *pool) const +{ + EmptyDeclarationAST *ast = new (pool) EmptyDeclarationAST; + ast->semicolon_token = semicolon_token; + return ast; +} + +AccessDeclarationAST *AccessDeclarationAST::clone(MemoryPool *pool) const +{ + AccessDeclarationAST *ast = new (pool) AccessDeclarationAST; + ast->access_specifier_token = access_specifier_token; + ast->slots_token = slots_token; + ast->colon_token = colon_token; + return ast; +} + +AsmDefinitionAST *AsmDefinitionAST::clone(MemoryPool *pool) const +{ + AsmDefinitionAST *ast = new (pool) AsmDefinitionAST; + ast->asm_token = asm_token; + ast->volatile_token = volatile_token; + ast->lparen_token = lparen_token; + ast->rparen_token = rparen_token; + ast->semicolon_token = semicolon_token; + return ast; +} + +BaseSpecifierAST *BaseSpecifierAST::clone(MemoryPool *pool) const +{ + BaseSpecifierAST *ast = new (pool) BaseSpecifierAST; + ast->virtual_token = virtual_token; + ast->access_specifier_token = access_specifier_token; + if (name) + ast->name = name->clone(pool); + return ast; +} + +CompoundLiteralAST *CompoundLiteralAST::clone(MemoryPool *pool) const +{ + CompoundLiteralAST *ast = new (pool) CompoundLiteralAST; + ast->lparen_token = lparen_token; + if (type_id) + ast->type_id = type_id->clone(pool); + ast->rparen_token = rparen_token; + if (initializer) + ast->initializer = initializer->clone(pool); + return ast; +} + +QtMethodAST *QtMethodAST::clone(MemoryPool *pool) const +{ + QtMethodAST *ast = new (pool) QtMethodAST; + ast->method_token = method_token; + ast->lparen_token = lparen_token; + if (declarator) + ast->declarator = declarator->clone(pool); + ast->rparen_token = rparen_token; + return ast; +} + +QtMemberDeclarationAST *QtMemberDeclarationAST::clone(MemoryPool *pool) const +{ + QtMemberDeclarationAST *ast = new (pool) QtMemberDeclarationAST; + ast->q_token = q_token; + ast->lparen_token = lparen_token; + if (type_id) + ast->type_id = type_id->clone(pool); + ast->rparen_token = rparen_token; + return ast; +} + +BinaryExpressionAST *BinaryExpressionAST::clone(MemoryPool *pool) const +{ + BinaryExpressionAST *ast = new (pool) BinaryExpressionAST; + if (left_expression) + ast->left_expression = left_expression->clone(pool); + ast->binary_op_token = binary_op_token; + if (right_expression) + ast->right_expression = right_expression->clone(pool); + return ast; +} + +CastExpressionAST *CastExpressionAST::clone(MemoryPool *pool) const +{ + CastExpressionAST *ast = new (pool) CastExpressionAST; + ast->lparen_token = lparen_token; + if (type_id) + ast->type_id = type_id->clone(pool); + ast->rparen_token = rparen_token; + if (expression) + ast->expression = expression->clone(pool); + return ast; +} + +ClassSpecifierAST *ClassSpecifierAST::clone(MemoryPool *pool) const +{ + ClassSpecifierAST *ast = new (pool) ClassSpecifierAST; + ast->classkey_token = classkey_token; + for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + if (name) + ast->name = name->clone(pool); + ast->colon_token = colon_token; + for (BaseSpecifierListAST *iter = base_clause_list, **ast_iter = &ast->base_clause_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) BaseSpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->lbrace_token = lbrace_token; + for (DeclarationListAST *iter = member_specifier_list, **ast_iter = &ast->member_specifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->rbrace_token = rbrace_token; + return ast; +} + +CaseStatementAST *CaseStatementAST::clone(MemoryPool *pool) const +{ + CaseStatementAST *ast = new (pool) CaseStatementAST; + ast->case_token = case_token; + if (expression) + ast->expression = expression->clone(pool); + ast->colon_token = colon_token; + if (statement) + ast->statement = statement->clone(pool); + return ast; +} + +CompoundStatementAST *CompoundStatementAST::clone(MemoryPool *pool) const +{ + CompoundStatementAST *ast = new (pool) CompoundStatementAST; + ast->lbrace_token = lbrace_token; + for (StatementListAST *iter = statement_list, **ast_iter = &ast->statement_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) StatementListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->rbrace_token = rbrace_token; + return ast; +} + +ConditionAST *ConditionAST::clone(MemoryPool *pool) const +{ + ConditionAST *ast = new (pool) ConditionAST; + for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + if (declarator) + ast->declarator = declarator->clone(pool); + return ast; +} + +ConditionalExpressionAST *ConditionalExpressionAST::clone(MemoryPool *pool) const +{ + ConditionalExpressionAST *ast = new (pool) ConditionalExpressionAST; + if (condition) + ast->condition = condition->clone(pool); + ast->question_token = question_token; + if (left_expression) + ast->left_expression = left_expression->clone(pool); + ast->colon_token = colon_token; + if (right_expression) + ast->right_expression = right_expression->clone(pool); + return ast; +} + +CppCastExpressionAST *CppCastExpressionAST::clone(MemoryPool *pool) const +{ + CppCastExpressionAST *ast = new (pool) CppCastExpressionAST; + ast->cast_token = cast_token; + ast->less_token = less_token; + if (type_id) + ast->type_id = type_id->clone(pool); + ast->greater_token = greater_token; + ast->lparen_token = lparen_token; + if (expression) + ast->expression = expression->clone(pool); + ast->rparen_token = rparen_token; + return ast; +} + +CtorInitializerAST *CtorInitializerAST::clone(MemoryPool *pool) const +{ + CtorInitializerAST *ast = new (pool) CtorInitializerAST; + ast->colon_token = colon_token; + for (MemInitializerListAST *iter = member_initializer_list, **ast_iter = &ast->member_initializer_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) MemInitializerListAST((iter->value) ? iter->value->clone(pool) : 0); + return ast; +} + +DeclarationStatementAST *DeclarationStatementAST::clone(MemoryPool *pool) const +{ + DeclarationStatementAST *ast = new (pool) DeclarationStatementAST; + if (declaration) + ast->declaration = declaration->clone(pool); + return ast; +} + +DeclaratorIdAST *DeclaratorIdAST::clone(MemoryPool *pool) const +{ + DeclaratorIdAST *ast = new (pool) DeclaratorIdAST; + if (name) + ast->name = name->clone(pool); + return ast; +} + +NestedDeclaratorAST *NestedDeclaratorAST::clone(MemoryPool *pool) const +{ + NestedDeclaratorAST *ast = new (pool) NestedDeclaratorAST; + ast->lparen_token = lparen_token; + if (declarator) + ast->declarator = declarator->clone(pool); + ast->rparen_token = rparen_token; + return ast; +} + +FunctionDeclaratorAST *FunctionDeclaratorAST::clone(MemoryPool *pool) const +{ + FunctionDeclaratorAST *ast = new (pool) FunctionDeclaratorAST; + ast->lparen_token = lparen_token; + if (parameters) + ast->parameters = parameters->clone(pool); + ast->rparen_token = rparen_token; + for (SpecifierListAST *iter = cv_qualifier_list, **ast_iter = &ast->cv_qualifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + if (exception_specification) + ast->exception_specification = exception_specification->clone(pool); + if (as_cpp_initializer) + ast->as_cpp_initializer = as_cpp_initializer->clone(pool); + return ast; +} + +ArrayDeclaratorAST *ArrayDeclaratorAST::clone(MemoryPool *pool) const +{ + ArrayDeclaratorAST *ast = new (pool) ArrayDeclaratorAST; + ast->lbracket_token = lbracket_token; + if (expression) + ast->expression = expression->clone(pool); + ast->rbracket_token = rbracket_token; + return ast; +} + +DeleteExpressionAST *DeleteExpressionAST::clone(MemoryPool *pool) const +{ + DeleteExpressionAST *ast = new (pool) DeleteExpressionAST; + ast->scope_token = scope_token; + ast->delete_token = delete_token; + ast->lbracket_token = lbracket_token; + ast->rbracket_token = rbracket_token; + if (expression) + ast->expression = expression->clone(pool); + return ast; +} + +DoStatementAST *DoStatementAST::clone(MemoryPool *pool) const +{ + DoStatementAST *ast = new (pool) DoStatementAST; + ast->do_token = do_token; + if (statement) + ast->statement = statement->clone(pool); + ast->while_token = while_token; + ast->lparen_token = lparen_token; + if (expression) + ast->expression = expression->clone(pool); + ast->rparen_token = rparen_token; + ast->semicolon_token = semicolon_token; + return ast; +} + +NamedTypeSpecifierAST *NamedTypeSpecifierAST::clone(MemoryPool *pool) const +{ + NamedTypeSpecifierAST *ast = new (pool) NamedTypeSpecifierAST; + if (name) + ast->name = name->clone(pool); + return ast; +} + +ElaboratedTypeSpecifierAST *ElaboratedTypeSpecifierAST::clone(MemoryPool *pool) const +{ + ElaboratedTypeSpecifierAST *ast = new (pool) ElaboratedTypeSpecifierAST; + ast->classkey_token = classkey_token; + if (name) + ast->name = name->clone(pool); + return ast; +} + +EnumSpecifierAST *EnumSpecifierAST::clone(MemoryPool *pool) const +{ + EnumSpecifierAST *ast = new (pool) EnumSpecifierAST; + ast->enum_token = enum_token; + if (name) + ast->name = name->clone(pool); + ast->lbrace_token = lbrace_token; + for (EnumeratorListAST *iter = enumerator_list, **ast_iter = &ast->enumerator_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) EnumeratorListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->rbrace_token = rbrace_token; + return ast; +} + +EnumeratorAST *EnumeratorAST::clone(MemoryPool *pool) const +{ + EnumeratorAST *ast = new (pool) EnumeratorAST; + ast->identifier_token = identifier_token; + ast->equal_token = equal_token; + if (expression) + ast->expression = expression->clone(pool); + return ast; +} + +ExceptionDeclarationAST *ExceptionDeclarationAST::clone(MemoryPool *pool) const +{ + ExceptionDeclarationAST *ast = new (pool) ExceptionDeclarationAST; + for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + if (declarator) + ast->declarator = declarator->clone(pool); + ast->dot_dot_dot_token = dot_dot_dot_token; + return ast; +} + +ExceptionSpecificationAST *ExceptionSpecificationAST::clone(MemoryPool *pool) const +{ + ExceptionSpecificationAST *ast = new (pool) ExceptionSpecificationAST; + ast->throw_token = throw_token; + ast->lparen_token = lparen_token; + ast->dot_dot_dot_token = dot_dot_dot_token; + for (ExpressionListAST *iter = type_id_list, **ast_iter = &ast->type_id_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->rparen_token = rparen_token; + return ast; +} + +ExpressionOrDeclarationStatementAST *ExpressionOrDeclarationStatementAST::clone(MemoryPool *pool) const +{ + ExpressionOrDeclarationStatementAST *ast = new (pool) ExpressionOrDeclarationStatementAST; + if (expression) + ast->expression = expression->clone(pool); + if (declaration) + ast->declaration = declaration->clone(pool); + return ast; +} + +ExpressionStatementAST *ExpressionStatementAST::clone(MemoryPool *pool) const +{ + ExpressionStatementAST *ast = new (pool) ExpressionStatementAST; + if (expression) + ast->expression = expression->clone(pool); + ast->semicolon_token = semicolon_token; + return ast; +} + +FunctionDefinitionAST *FunctionDefinitionAST::clone(MemoryPool *pool) const +{ + FunctionDefinitionAST *ast = new (pool) FunctionDefinitionAST; + ast->qt_invokable_token = qt_invokable_token; + for (SpecifierListAST *iter = decl_specifier_list, **ast_iter = &ast->decl_specifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + if (declarator) + ast->declarator = declarator->clone(pool); + if (ctor_initializer) + ast->ctor_initializer = ctor_initializer->clone(pool); + if (function_body) + ast->function_body = function_body->clone(pool); + return ast; +} + +ForeachStatementAST *ForeachStatementAST::clone(MemoryPool *pool) const +{ + ForeachStatementAST *ast = new (pool) ForeachStatementAST; + ast->foreach_token = foreach_token; + ast->lparen_token = lparen_token; + for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + if (declarator) + ast->declarator = declarator->clone(pool); + if (initializer) + ast->initializer = initializer->clone(pool); + ast->comma_token = comma_token; + if (expression) + ast->expression = expression->clone(pool); + ast->rparen_token = rparen_token; + if (statement) + ast->statement = statement->clone(pool); + return ast; +} + +ForStatementAST *ForStatementAST::clone(MemoryPool *pool) const +{ + ForStatementAST *ast = new (pool) ForStatementAST; + ast->for_token = for_token; + ast->lparen_token = lparen_token; + if (initializer) + ast->initializer = initializer->clone(pool); + if (condition) + ast->condition = condition->clone(pool); + ast->semicolon_token = semicolon_token; + if (expression) + ast->expression = expression->clone(pool); + ast->rparen_token = rparen_token; + if (statement) + ast->statement = statement->clone(pool); + return ast; +} + +IfStatementAST *IfStatementAST::clone(MemoryPool *pool) const +{ + IfStatementAST *ast = new (pool) IfStatementAST; + ast->if_token = if_token; + ast->lparen_token = lparen_token; + if (condition) + ast->condition = condition->clone(pool); + ast->rparen_token = rparen_token; + if (statement) + ast->statement = statement->clone(pool); + ast->else_token = else_token; + if (else_statement) + ast->else_statement = else_statement->clone(pool); + return ast; +} + +ArrayInitializerAST *ArrayInitializerAST::clone(MemoryPool *pool) const +{ + ArrayInitializerAST *ast = new (pool) ArrayInitializerAST; + ast->lbrace_token = lbrace_token; + for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->rbrace_token = rbrace_token; + return ast; +} + +LabeledStatementAST *LabeledStatementAST::clone(MemoryPool *pool) const +{ + LabeledStatementAST *ast = new (pool) LabeledStatementAST; + ast->label_token = label_token; + ast->colon_token = colon_token; + if (statement) + ast->statement = statement->clone(pool); + return ast; +} + +LinkageBodyAST *LinkageBodyAST::clone(MemoryPool *pool) const +{ + LinkageBodyAST *ast = new (pool) LinkageBodyAST; + ast->lbrace_token = lbrace_token; + for (DeclarationListAST *iter = declaration_list, **ast_iter = &ast->declaration_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->rbrace_token = rbrace_token; + return ast; +} + +LinkageSpecificationAST *LinkageSpecificationAST::clone(MemoryPool *pool) const +{ + LinkageSpecificationAST *ast = new (pool) LinkageSpecificationAST; + ast->extern_token = extern_token; + ast->extern_type_token = extern_type_token; + if (declaration) + ast->declaration = declaration->clone(pool); + return ast; +} + +MemInitializerAST *MemInitializerAST::clone(MemoryPool *pool) const +{ + MemInitializerAST *ast = new (pool) MemInitializerAST; + if (name) + ast->name = name->clone(pool); + ast->lparen_token = lparen_token; + for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->rparen_token = rparen_token; + return ast; +} + +NestedNameSpecifierAST *NestedNameSpecifierAST::clone(MemoryPool *pool) const +{ + NestedNameSpecifierAST *ast = new (pool) NestedNameSpecifierAST; + if (class_or_namespace_name) + ast->class_or_namespace_name = class_or_namespace_name->clone(pool); + ast->scope_token = scope_token; + return ast; +} + +QualifiedNameAST *QualifiedNameAST::clone(MemoryPool *pool) const +{ + QualifiedNameAST *ast = new (pool) QualifiedNameAST; + ast->global_scope_token = global_scope_token; + for (NestedNameSpecifierListAST *iter = nested_name_specifier_list, **ast_iter = &ast->nested_name_specifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) NestedNameSpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + if (unqualified_name) + ast->unqualified_name = unqualified_name->clone(pool); + return ast; +} + +OperatorFunctionIdAST *OperatorFunctionIdAST::clone(MemoryPool *pool) const +{ + OperatorFunctionIdAST *ast = new (pool) OperatorFunctionIdAST; + ast->operator_token = operator_token; + if (op) + ast->op = op->clone(pool); + return ast; +} + +ConversionFunctionIdAST *ConversionFunctionIdAST::clone(MemoryPool *pool) const +{ + ConversionFunctionIdAST *ast = new (pool) ConversionFunctionIdAST; + ast->operator_token = operator_token; + for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + for (PtrOperatorListAST *iter = ptr_operator_list, **ast_iter = &ast->ptr_operator_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) PtrOperatorListAST((iter->value) ? iter->value->clone(pool) : 0); + return ast; +} + +SimpleNameAST *SimpleNameAST::clone(MemoryPool *pool) const +{ + SimpleNameAST *ast = new (pool) SimpleNameAST; + ast->identifier_token = identifier_token; + return ast; +} + +DestructorNameAST *DestructorNameAST::clone(MemoryPool *pool) const +{ + DestructorNameAST *ast = new (pool) DestructorNameAST; + ast->tilde_token = tilde_token; + ast->identifier_token = identifier_token; + return ast; +} + +TemplateIdAST *TemplateIdAST::clone(MemoryPool *pool) const +{ + TemplateIdAST *ast = new (pool) TemplateIdAST; + ast->identifier_token = identifier_token; + ast->less_token = less_token; + for (TemplateArgumentListAST *iter = template_argument_list, **ast_iter = &ast->template_argument_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) TemplateArgumentListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->greater_token = greater_token; + return ast; +} + +NamespaceAST *NamespaceAST::clone(MemoryPool *pool) const +{ + NamespaceAST *ast = new (pool) NamespaceAST; + ast->namespace_token = namespace_token; + ast->identifier_token = identifier_token; + for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + if (linkage_body) + ast->linkage_body = linkage_body->clone(pool); + return ast; +} + +NamespaceAliasDefinitionAST *NamespaceAliasDefinitionAST::clone(MemoryPool *pool) const +{ + NamespaceAliasDefinitionAST *ast = new (pool) NamespaceAliasDefinitionAST; + ast->namespace_token = namespace_token; + ast->namespace_name_token = namespace_name_token; + ast->equal_token = equal_token; + if (name) + ast->name = name->clone(pool); + ast->semicolon_token = semicolon_token; + return ast; +} + +NewPlacementAST *NewPlacementAST::clone(MemoryPool *pool) const +{ + NewPlacementAST *ast = new (pool) NewPlacementAST; + ast->lparen_token = lparen_token; + for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->rparen_token = rparen_token; + return ast; +} + +NewArrayDeclaratorAST *NewArrayDeclaratorAST::clone(MemoryPool *pool) const +{ + NewArrayDeclaratorAST *ast = new (pool) NewArrayDeclaratorAST; + ast->lbracket_token = lbracket_token; + if (expression) + ast->expression = expression->clone(pool); + ast->rbracket_token = rbracket_token; + return ast; +} + +NewExpressionAST *NewExpressionAST::clone(MemoryPool *pool) const +{ + NewExpressionAST *ast = new (pool) NewExpressionAST; + ast->scope_token = scope_token; + ast->new_token = new_token; + if (new_placement) + ast->new_placement = new_placement->clone(pool); + ast->lparen_token = lparen_token; + if (type_id) + ast->type_id = type_id->clone(pool); + ast->rparen_token = rparen_token; + if (new_type_id) + ast->new_type_id = new_type_id->clone(pool); + if (new_initializer) + ast->new_initializer = new_initializer->clone(pool); + return ast; +} + +NewInitializerAST *NewInitializerAST::clone(MemoryPool *pool) const +{ + NewInitializerAST *ast = new (pool) NewInitializerAST; + ast->lparen_token = lparen_token; + if (expression) + ast->expression = expression->clone(pool); + ast->rparen_token = rparen_token; + return ast; +} + +NewTypeIdAST *NewTypeIdAST::clone(MemoryPool *pool) const +{ + NewTypeIdAST *ast = new (pool) NewTypeIdAST; + for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + for (PtrOperatorListAST *iter = ptr_operator_list, **ast_iter = &ast->ptr_operator_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) PtrOperatorListAST((iter->value) ? iter->value->clone(pool) : 0); + for (NewArrayDeclaratorListAST *iter = new_array_declarator_list, **ast_iter = &ast->new_array_declarator_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) NewArrayDeclaratorListAST((iter->value) ? iter->value->clone(pool) : 0); + return ast; +} + +OperatorAST *OperatorAST::clone(MemoryPool *pool) const +{ + OperatorAST *ast = new (pool) OperatorAST; + ast->op_token = op_token; + ast->open_token = open_token; + ast->close_token = close_token; + return ast; +} + +ParameterDeclarationAST *ParameterDeclarationAST::clone(MemoryPool *pool) const +{ + ParameterDeclarationAST *ast = new (pool) ParameterDeclarationAST; + for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + if (declarator) + ast->declarator = declarator->clone(pool); + ast->equal_token = equal_token; + if (expression) + ast->expression = expression->clone(pool); + return ast; +} + +ParameterDeclarationClauseAST *ParameterDeclarationClauseAST::clone(MemoryPool *pool) const +{ + ParameterDeclarationClauseAST *ast = new (pool) ParameterDeclarationClauseAST; + for (DeclarationListAST *iter = parameter_declaration_list, **ast_iter = &ast->parameter_declaration_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->dot_dot_dot_token = dot_dot_dot_token; + return ast; +} + +CallAST *CallAST::clone(MemoryPool *pool) const +{ + CallAST *ast = new (pool) CallAST; + ast->lparen_token = lparen_token; + for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->rparen_token = rparen_token; + return ast; +} + +ArrayAccessAST *ArrayAccessAST::clone(MemoryPool *pool) const +{ + ArrayAccessAST *ast = new (pool) ArrayAccessAST; + ast->lbracket_token = lbracket_token; + if (expression) + ast->expression = expression->clone(pool); + ast->rbracket_token = rbracket_token; + return ast; +} + +PostIncrDecrAST *PostIncrDecrAST::clone(MemoryPool *pool) const +{ + PostIncrDecrAST *ast = new (pool) PostIncrDecrAST; + ast->incr_decr_token = incr_decr_token; + return ast; +} + +MemberAccessAST *MemberAccessAST::clone(MemoryPool *pool) const +{ + MemberAccessAST *ast = new (pool) MemberAccessAST; + ast->access_token = access_token; + ast->template_token = template_token; + if (member_name) + ast->member_name = member_name->clone(pool); + return ast; +} + +TypeidExpressionAST *TypeidExpressionAST::clone(MemoryPool *pool) const +{ + TypeidExpressionAST *ast = new (pool) TypeidExpressionAST; + ast->typeid_token = typeid_token; + ast->lparen_token = lparen_token; + if (expression) + ast->expression = expression->clone(pool); + ast->rparen_token = rparen_token; + return ast; +} + +TypenameCallExpressionAST *TypenameCallExpressionAST::clone(MemoryPool *pool) const +{ + TypenameCallExpressionAST *ast = new (pool) TypenameCallExpressionAST; + ast->typename_token = typename_token; + if (name) + ast->name = name->clone(pool); + ast->lparen_token = lparen_token; + for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->rparen_token = rparen_token; + return ast; +} + +TypeConstructorCallAST *TypeConstructorCallAST::clone(MemoryPool *pool) const +{ + TypeConstructorCallAST *ast = new (pool) TypeConstructorCallAST; + for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->lparen_token = lparen_token; + for (ExpressionListAST *iter = expression_list, **ast_iter = &ast->expression_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ExpressionListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->rparen_token = rparen_token; + return ast; +} + +PostfixExpressionAST *PostfixExpressionAST::clone(MemoryPool *pool) const +{ + PostfixExpressionAST *ast = new (pool) PostfixExpressionAST; + if (base_expression) + ast->base_expression = base_expression->clone(pool); + for (PostfixListAST *iter = postfix_expression_list, **ast_iter = &ast->postfix_expression_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) PostfixListAST((iter->value) ? iter->value->clone(pool) : 0); + return ast; +} + +PointerToMemberAST *PointerToMemberAST::clone(MemoryPool *pool) const +{ + PointerToMemberAST *ast = new (pool) PointerToMemberAST; + ast->global_scope_token = global_scope_token; + for (NestedNameSpecifierListAST *iter = nested_name_specifier_list, **ast_iter = &ast->nested_name_specifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) NestedNameSpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->star_token = star_token; + for (SpecifierListAST *iter = cv_qualifier_list, **ast_iter = &ast->cv_qualifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + return ast; +} + +PointerAST *PointerAST::clone(MemoryPool *pool) const +{ + PointerAST *ast = new (pool) PointerAST; + ast->star_token = star_token; + for (SpecifierListAST *iter = cv_qualifier_list, **ast_iter = &ast->cv_qualifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + return ast; +} + +ReferenceAST *ReferenceAST::clone(MemoryPool *pool) const +{ + ReferenceAST *ast = new (pool) ReferenceAST; + ast->amp_token = amp_token; + return ast; +} + +BreakStatementAST *BreakStatementAST::clone(MemoryPool *pool) const +{ + BreakStatementAST *ast = new (pool) BreakStatementAST; + ast->break_token = break_token; + ast->semicolon_token = semicolon_token; + return ast; +} + +ContinueStatementAST *ContinueStatementAST::clone(MemoryPool *pool) const +{ + ContinueStatementAST *ast = new (pool) ContinueStatementAST; + ast->continue_token = continue_token; + ast->semicolon_token = semicolon_token; + return ast; +} + +GotoStatementAST *GotoStatementAST::clone(MemoryPool *pool) const +{ + GotoStatementAST *ast = new (pool) GotoStatementAST; + ast->goto_token = goto_token; + ast->identifier_token = identifier_token; + ast->semicolon_token = semicolon_token; + return ast; +} + +ReturnStatementAST *ReturnStatementAST::clone(MemoryPool *pool) const +{ + ReturnStatementAST *ast = new (pool) ReturnStatementAST; + ast->return_token = return_token; + if (expression) + ast->expression = expression->clone(pool); + ast->semicolon_token = semicolon_token; + return ast; +} + +SizeofExpressionAST *SizeofExpressionAST::clone(MemoryPool *pool) const +{ + SizeofExpressionAST *ast = new (pool) SizeofExpressionAST; + ast->sizeof_token = sizeof_token; + ast->lparen_token = lparen_token; + if (expression) + ast->expression = expression->clone(pool); + ast->rparen_token = rparen_token; + return ast; +} + +NumericLiteralAST *NumericLiteralAST::clone(MemoryPool *pool) const +{ + NumericLiteralAST *ast = new (pool) NumericLiteralAST; + ast->literal_token = literal_token; + return ast; +} + +BoolLiteralAST *BoolLiteralAST::clone(MemoryPool *pool) const +{ + BoolLiteralAST *ast = new (pool) BoolLiteralAST; + ast->literal_token = literal_token; + return ast; +} + +ThisExpressionAST *ThisExpressionAST::clone(MemoryPool *pool) const +{ + ThisExpressionAST *ast = new (pool) ThisExpressionAST; + ast->this_token = this_token; + return ast; +} + +NestedExpressionAST *NestedExpressionAST::clone(MemoryPool *pool) const +{ + NestedExpressionAST *ast = new (pool) NestedExpressionAST; + ast->lparen_token = lparen_token; + if (expression) + ast->expression = expression->clone(pool); + ast->rparen_token = rparen_token; + return ast; +} + +StringLiteralAST *StringLiteralAST::clone(MemoryPool *pool) const +{ + StringLiteralAST *ast = new (pool) StringLiteralAST; + ast->literal_token = literal_token; + if (next) + ast->next = next->clone(pool); + return ast; +} + +SwitchStatementAST *SwitchStatementAST::clone(MemoryPool *pool) const +{ + SwitchStatementAST *ast = new (pool) SwitchStatementAST; + ast->switch_token = switch_token; + ast->lparen_token = lparen_token; + if (condition) + ast->condition = condition->clone(pool); + ast->rparen_token = rparen_token; + if (statement) + ast->statement = statement->clone(pool); + return ast; +} + +TemplateDeclarationAST *TemplateDeclarationAST::clone(MemoryPool *pool) const +{ + TemplateDeclarationAST *ast = new (pool) TemplateDeclarationAST; + ast->export_token = export_token; + ast->template_token = template_token; + ast->less_token = less_token; + for (DeclarationListAST *iter = template_parameter_list, **ast_iter = &ast->template_parameter_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->greater_token = greater_token; + if (declaration) + ast->declaration = declaration->clone(pool); + return ast; +} + +ThrowExpressionAST *ThrowExpressionAST::clone(MemoryPool *pool) const +{ + ThrowExpressionAST *ast = new (pool) ThrowExpressionAST; + ast->throw_token = throw_token; + if (expression) + ast->expression = expression->clone(pool); + return ast; +} + +TranslationUnitAST *TranslationUnitAST::clone(MemoryPool *pool) const +{ + TranslationUnitAST *ast = new (pool) TranslationUnitAST; + for (DeclarationListAST *iter = declaration_list, **ast_iter = &ast->declaration_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0); + return ast; +} + +TryBlockStatementAST *TryBlockStatementAST::clone(MemoryPool *pool) const +{ + TryBlockStatementAST *ast = new (pool) TryBlockStatementAST; + ast->try_token = try_token; + if (statement) + ast->statement = statement->clone(pool); + for (CatchClauseListAST *iter = catch_clause_list, **ast_iter = &ast->catch_clause_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) CatchClauseListAST((iter->value) ? iter->value->clone(pool) : 0); + return ast; +} + +CatchClauseAST *CatchClauseAST::clone(MemoryPool *pool) const +{ + CatchClauseAST *ast = new (pool) CatchClauseAST; + ast->catch_token = catch_token; + ast->lparen_token = lparen_token; + if (exception_declaration) + ast->exception_declaration = exception_declaration->clone(pool); + ast->rparen_token = rparen_token; + if (statement) + ast->statement = statement->clone(pool); + return ast; +} + +TypeIdAST *TypeIdAST::clone(MemoryPool *pool) const +{ + TypeIdAST *ast = new (pool) TypeIdAST; + for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + if (declarator) + ast->declarator = declarator->clone(pool); + return ast; +} + +TypenameTypeParameterAST *TypenameTypeParameterAST::clone(MemoryPool *pool) const +{ + TypenameTypeParameterAST *ast = new (pool) TypenameTypeParameterAST; + ast->classkey_token = classkey_token; + if (name) + ast->name = name->clone(pool); + ast->equal_token = equal_token; + if (type_id) + ast->type_id = type_id->clone(pool); + return ast; +} + +TemplateTypeParameterAST *TemplateTypeParameterAST::clone(MemoryPool *pool) const +{ + TemplateTypeParameterAST *ast = new (pool) TemplateTypeParameterAST; + ast->template_token = template_token; + ast->less_token = less_token; + for (DeclarationListAST *iter = template_parameter_list, **ast_iter = &ast->template_parameter_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->greater_token = greater_token; + ast->class_token = class_token; + if (name) + ast->name = name->clone(pool); + ast->equal_token = equal_token; + if (type_id) + ast->type_id = type_id->clone(pool); + return ast; +} + +UnaryExpressionAST *UnaryExpressionAST::clone(MemoryPool *pool) const +{ + UnaryExpressionAST *ast = new (pool) UnaryExpressionAST; + ast->unary_op_token = unary_op_token; + if (expression) + ast->expression = expression->clone(pool); + return ast; +} + +UsingAST *UsingAST::clone(MemoryPool *pool) const +{ + UsingAST *ast = new (pool) UsingAST; + ast->using_token = using_token; + ast->typename_token = typename_token; + if (name) + ast->name = name->clone(pool); + ast->semicolon_token = semicolon_token; + return ast; +} + +UsingDirectiveAST *UsingDirectiveAST::clone(MemoryPool *pool) const +{ + UsingDirectiveAST *ast = new (pool) UsingDirectiveAST; + ast->using_token = using_token; + ast->namespace_token = namespace_token; + if (name) + ast->name = name->clone(pool); + ast->semicolon_token = semicolon_token; + return ast; +} + +WhileStatementAST *WhileStatementAST::clone(MemoryPool *pool) const +{ + WhileStatementAST *ast = new (pool) WhileStatementAST; + ast->while_token = while_token; + ast->lparen_token = lparen_token; + if (condition) + ast->condition = condition->clone(pool); + ast->rparen_token = rparen_token; + if (statement) + ast->statement = statement->clone(pool); + return ast; +} + +ObjCClassForwardDeclarationAST *ObjCClassForwardDeclarationAST::clone(MemoryPool *pool) const +{ + ObjCClassForwardDeclarationAST *ast = new (pool) ObjCClassForwardDeclarationAST; + for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->class_token = class_token; + for (ObjCIdentifierListAST *iter = identifier_list, **ast_iter = &ast->identifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ObjCIdentifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->semicolon_token = semicolon_token; + return ast; +} + +ObjCClassDeclarationAST *ObjCClassDeclarationAST::clone(MemoryPool *pool) const +{ + ObjCClassDeclarationAST *ast = new (pool) ObjCClassDeclarationAST; + for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->interface_token = interface_token; + ast->implementation_token = implementation_token; + if (class_name) + ast->class_name = class_name->clone(pool); + ast->lparen_token = lparen_token; + if (category_name) + ast->category_name = category_name->clone(pool); + ast->rparen_token = rparen_token; + ast->colon_token = colon_token; + if (superclass) + ast->superclass = superclass->clone(pool); + if (protocol_refs) + ast->protocol_refs = protocol_refs->clone(pool); + if (inst_vars_decl) + ast->inst_vars_decl = inst_vars_decl->clone(pool); + for (DeclarationListAST *iter = member_declaration_list, **ast_iter = &ast->member_declaration_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->end_token = end_token; + return ast; +} + +ObjCProtocolForwardDeclarationAST *ObjCProtocolForwardDeclarationAST::clone(MemoryPool *pool) const +{ + ObjCProtocolForwardDeclarationAST *ast = new (pool) ObjCProtocolForwardDeclarationAST; + for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->protocol_token = protocol_token; + for (ObjCIdentifierListAST *iter = identifier_list, **ast_iter = &ast->identifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ObjCIdentifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->semicolon_token = semicolon_token; + return ast; +} + +ObjCProtocolDeclarationAST *ObjCProtocolDeclarationAST::clone(MemoryPool *pool) const +{ + ObjCProtocolDeclarationAST *ast = new (pool) ObjCProtocolDeclarationAST; + for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->protocol_token = protocol_token; + if (name) + ast->name = name->clone(pool); + if (protocol_refs) + ast->protocol_refs = protocol_refs->clone(pool); + for (DeclarationListAST *iter = member_declaration_list, **ast_iter = &ast->member_declaration_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->end_token = end_token; + return ast; +} + +ObjCProtocolRefsAST *ObjCProtocolRefsAST::clone(MemoryPool *pool) const +{ + ObjCProtocolRefsAST *ast = new (pool) ObjCProtocolRefsAST; + ast->less_token = less_token; + for (ObjCIdentifierListAST *iter = identifier_list, **ast_iter = &ast->identifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ObjCIdentifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->greater_token = greater_token; + return ast; +} + +ObjCMessageArgumentAST *ObjCMessageArgumentAST::clone(MemoryPool *pool) const +{ + ObjCMessageArgumentAST *ast = new (pool) ObjCMessageArgumentAST; + if (parameter_value_expression) + ast->parameter_value_expression = parameter_value_expression->clone(pool); + return ast; +} + +ObjCMessageExpressionAST *ObjCMessageExpressionAST::clone(MemoryPool *pool) const +{ + ObjCMessageExpressionAST *ast = new (pool) ObjCMessageExpressionAST; + ast->lbracket_token = lbracket_token; + if (receiver_expression) + ast->receiver_expression = receiver_expression->clone(pool); + if (selector) + ast->selector = selector->clone(pool); + for (ObjCMessageArgumentListAST *iter = argument_list, **ast_iter = &ast->argument_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ObjCMessageArgumentListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->rbracket_token = rbracket_token; + return ast; +} + +ObjCProtocolExpressionAST *ObjCProtocolExpressionAST::clone(MemoryPool *pool) const +{ + ObjCProtocolExpressionAST *ast = new (pool) ObjCProtocolExpressionAST; + ast->protocol_token = protocol_token; + ast->lparen_token = lparen_token; + ast->identifier_token = identifier_token; + ast->rparen_token = rparen_token; + return ast; +} + +ObjCTypeNameAST *ObjCTypeNameAST::clone(MemoryPool *pool) const +{ + ObjCTypeNameAST *ast = new (pool) ObjCTypeNameAST; + ast->lparen_token = lparen_token; + ast->type_qualifier_token = type_qualifier_token; + if (type_id) + ast->type_id = type_id->clone(pool); + ast->rparen_token = rparen_token; + return ast; +} + +ObjCEncodeExpressionAST *ObjCEncodeExpressionAST::clone(MemoryPool *pool) const +{ + ObjCEncodeExpressionAST *ast = new (pool) ObjCEncodeExpressionAST; + ast->encode_token = encode_token; + if (type_name) + ast->type_name = type_name->clone(pool); + return ast; +} + +ObjCSelectorWithoutArgumentsAST *ObjCSelectorWithoutArgumentsAST::clone(MemoryPool *pool) const +{ + ObjCSelectorWithoutArgumentsAST *ast = new (pool) ObjCSelectorWithoutArgumentsAST; + ast->name_token = name_token; + return ast; +} + +ObjCSelectorArgumentAST *ObjCSelectorArgumentAST::clone(MemoryPool *pool) const +{ + ObjCSelectorArgumentAST *ast = new (pool) ObjCSelectorArgumentAST; + ast->name_token = name_token; + ast->colon_token = colon_token; + return ast; +} + +ObjCSelectorWithArgumentsAST *ObjCSelectorWithArgumentsAST::clone(MemoryPool *pool) const +{ + ObjCSelectorWithArgumentsAST *ast = new (pool) ObjCSelectorWithArgumentsAST; + for (ObjCSelectorArgumentListAST *iter = selector_argument_list, **ast_iter = &ast->selector_argument_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ObjCSelectorArgumentListAST((iter->value) ? iter->value->clone(pool) : 0); + return ast; +} + +ObjCSelectorExpressionAST *ObjCSelectorExpressionAST::clone(MemoryPool *pool) const +{ + ObjCSelectorExpressionAST *ast = new (pool) ObjCSelectorExpressionAST; + ast->selector_token = selector_token; + ast->lparen_token = lparen_token; + if (selector) + ast->selector = selector->clone(pool); + ast->rparen_token = rparen_token; + return ast; +} + +ObjCInstanceVariablesDeclarationAST *ObjCInstanceVariablesDeclarationAST::clone(MemoryPool *pool) const +{ + ObjCInstanceVariablesDeclarationAST *ast = new (pool) ObjCInstanceVariablesDeclarationAST; + ast->lbrace_token = lbrace_token; + for (DeclarationListAST *iter = instance_variable_list, **ast_iter = &ast->instance_variable_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) DeclarationListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->rbrace_token = rbrace_token; + return ast; +} + +ObjCVisibilityDeclarationAST *ObjCVisibilityDeclarationAST::clone(MemoryPool *pool) const +{ + ObjCVisibilityDeclarationAST *ast = new (pool) ObjCVisibilityDeclarationAST; + ast->visibility_token = visibility_token; + return ast; +} + +ObjCPropertyAttributeAST *ObjCPropertyAttributeAST::clone(MemoryPool *pool) const +{ + ObjCPropertyAttributeAST *ast = new (pool) ObjCPropertyAttributeAST; + ast->attribute_identifier_token = attribute_identifier_token; + ast->equals_token = equals_token; + if (method_selector) + ast->method_selector = method_selector->clone(pool); + return ast; +} + +ObjCPropertyDeclarationAST *ObjCPropertyDeclarationAST::clone(MemoryPool *pool) const +{ + ObjCPropertyDeclarationAST *ast = new (pool) ObjCPropertyDeclarationAST; + for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->property_token = property_token; + ast->lparen_token = lparen_token; + for (ObjCPropertyAttributeListAST *iter = property_attribute_list, **ast_iter = &ast->property_attribute_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ObjCPropertyAttributeListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->rparen_token = rparen_token; + if (simple_declaration) + ast->simple_declaration = simple_declaration->clone(pool); + return ast; +} + +ObjCMessageArgumentDeclarationAST *ObjCMessageArgumentDeclarationAST::clone(MemoryPool *pool) const +{ + ObjCMessageArgumentDeclarationAST *ast = new (pool) ObjCMessageArgumentDeclarationAST; + if (type_name) + ast->type_name = type_name->clone(pool); + for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->param_name_token = param_name_token; + return ast; +} + +ObjCMethodPrototypeAST *ObjCMethodPrototypeAST::clone(MemoryPool *pool) const +{ + ObjCMethodPrototypeAST *ast = new (pool) ObjCMethodPrototypeAST; + ast->method_type_token = method_type_token; + if (type_name) + ast->type_name = type_name->clone(pool); + if (selector) + ast->selector = selector->clone(pool); + for (ObjCMessageArgumentDeclarationListAST *iter = argument_list, **ast_iter = &ast->argument_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ObjCMessageArgumentDeclarationListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->dot_dot_dot_token = dot_dot_dot_token; + for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + return ast; +} + +ObjCMethodDeclarationAST *ObjCMethodDeclarationAST::clone(MemoryPool *pool) const +{ + ObjCMethodDeclarationAST *ast = new (pool) ObjCMethodDeclarationAST; + if (method_prototype) + ast->method_prototype = method_prototype->clone(pool); + if (function_body) + ast->function_body = function_body->clone(pool); + ast->semicolon_token = semicolon_token; + return ast; +} + +ObjCSynthesizedPropertyAST *ObjCSynthesizedPropertyAST::clone(MemoryPool *pool) const +{ + ObjCSynthesizedPropertyAST *ast = new (pool) ObjCSynthesizedPropertyAST; + ast->property_identifier_token = property_identifier_token; + ast->equals_token = equals_token; + ast->alias_identifier_token = alias_identifier_token; + return ast; +} + +ObjCSynthesizedPropertiesDeclarationAST *ObjCSynthesizedPropertiesDeclarationAST::clone(MemoryPool *pool) const +{ + ObjCSynthesizedPropertiesDeclarationAST *ast = new (pool) ObjCSynthesizedPropertiesDeclarationAST; + ast->synthesized_token = synthesized_token; + for (ObjCSynthesizedPropertyListAST *iter = property_identifier_list, **ast_iter = &ast->property_identifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ObjCSynthesizedPropertyListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->semicolon_token = semicolon_token; + return ast; +} + +ObjCDynamicPropertiesDeclarationAST *ObjCDynamicPropertiesDeclarationAST::clone(MemoryPool *pool) const +{ + ObjCDynamicPropertiesDeclarationAST *ast = new (pool) ObjCDynamicPropertiesDeclarationAST; + ast->dynamic_token = dynamic_token; + for (ObjCIdentifierListAST *iter = property_identifier_list, **ast_iter = &ast->property_identifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) ObjCIdentifierListAST((iter->value) ? iter->value->clone(pool) : 0); + ast->semicolon_token = semicolon_token; + return ast; +} + +ObjCFastEnumerationAST *ObjCFastEnumerationAST::clone(MemoryPool *pool) const +{ + ObjCFastEnumerationAST *ast = new (pool) ObjCFastEnumerationAST; + ast->for_token = for_token; + ast->lparen_token = lparen_token; + for (SpecifierListAST *iter = type_specifier_list, **ast_iter = &ast->type_specifier_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); + if (declarator) + ast->declarator = declarator->clone(pool); + if (initializer) + ast->initializer = initializer->clone(pool); + ast->in_token = in_token; + if (fast_enumeratable_expression) + ast->fast_enumeratable_expression = fast_enumeratable_expression->clone(pool); + ast->rparen_token = rparen_token; + if (statement) + ast->statement = statement->clone(pool); + return ast; +} + +ObjCSynchronizedStatementAST *ObjCSynchronizedStatementAST::clone(MemoryPool *pool) const +{ + ObjCSynchronizedStatementAST *ast = new (pool) ObjCSynchronizedStatementAST; + ast->synchronized_token = synchronized_token; + ast->lparen_token = lparen_token; + if (synchronized_object) + ast->synchronized_object = synchronized_object->clone(pool); + ast->rparen_token = rparen_token; + if (statement) + ast->statement = statement->clone(pool); + return ast; +} + diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index 7cb2c8ae86..556341d4ba 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -4753,12 +4753,12 @@ bool Parser::parseObjCMethodDefinitionList(DeclarationListAST *&node) ObjCSynthesizedPropertyListAST *last = new (_pool) ObjCSynthesizedPropertyListAST; ast->property_identifier_list = last; last->value = new (_pool) ObjCSynthesizedPropertyAST; - match(T_IDENTIFIER, &(last->value->property_identifier)); + match(T_IDENTIFIER, &(last->value->property_identifier_token)); if (LA() == T_EQUAL) { last->value->equals_token = consumeToken(); - match(T_IDENTIFIER, &(last->value->property_alias_identifier)); + match(T_IDENTIFIER, &(last->value->alias_identifier_token)); } while (LA() == T_COMMA) { @@ -4768,12 +4768,12 @@ bool Parser::parseObjCMethodDefinitionList(DeclarationListAST *&node) last = last->next; last->value = new (_pool) ObjCSynthesizedPropertyAST; - match(T_IDENTIFIER, &(last->value->property_identifier)); + match(T_IDENTIFIER, &(last->value->property_identifier_token)); if (LA() == T_EQUAL) { last->value->equals_token = consumeToken(); - match(T_IDENTIFIER, &(last->value->property_alias_identifier)); + match(T_IDENTIFIER, &(last->value->alias_identifier_token)); } } @@ -5179,7 +5179,7 @@ bool Parser::parseObjCTypeName(ObjCTypeNameAST *&node) ObjCTypeNameAST *ast = new (_pool) ObjCTypeNameAST; match(T_LPAREN, &(ast->lparen_token)); - parseObjCTypeQualifiers(ast->type_qualifier); + parseObjCTypeQualifiers(ast->type_qualifier_token); parseTypeId(ast->type_id); match(T_RPAREN, &(ast->rparen_token)); node = ast; diff --git a/src/shared/cplusplus/cplusplus.pri b/src/shared/cplusplus/cplusplus.pri index 4f1f30e7d5..1634115e23 100644 --- a/src/shared/cplusplus/cplusplus.pri +++ b/src/shared/cplusplus/cplusplus.pri @@ -46,6 +46,7 @@ SOURCES += \ $$PWD/ASTVisit.cpp \ $$PWD/ASTMatch0.cpp \ $$PWD/ASTVisitor.cpp \ + $$PWD/ASTClone.cpp \ $$PWD/ASTPatternBuilder.cpp \ $$PWD/ASTMatcher.cpp \ $$PWD/TypeMatcher.cpp \ |