diff options
author | Michele Calgaro <[email protected]> | 2024-01-23 12:47:15 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2024-02-07 00:27:18 +0900 |
commit | 43fd0a38af0135396d52cc9ace6900269824deae (patch) | |
tree | 89b4d12e7194a5f4223b2269d14f7d685d475b28 /lib/cppparser/ast.cpp | |
parent | c891bb5d0682b26c64cee49cbdbfe398285c4c1b (diff) | |
download | tdevelop-43fd0a38af0135396d52cc9ace6900269824deae.tar.gz tdevelop-43fd0a38af0135396d52cc9ace6900269824deae.zip |
Replace auto_ptr
Signed-off-by: Michele Calgaro <[email protected]>
(cherry picked from commit 12c95f5db577785d29c51643f20fe2c8700af7cb)
Diffstat (limited to 'lib/cppparser/ast.cpp')
-rw-r--r-- | lib/cppparser/ast.cpp | 404 |
1 files changed, 202 insertions, 202 deletions
diff --git a/lib/cppparser/ast.cpp b/lib/cppparser/ast.cpp index f0cc848c..21c7f375 100644 --- a/lib/cppparser/ast.cpp +++ b/lib/cppparser/ast.cpp @@ -219,13 +219,13 @@ void NameAST::setGlobal( bool b ) void NameAST::setUnqualifiedName( ClassOrNamespaceNameAST::Node& unqualifiedName ) { - m_unqualifiedName = unqualifiedName; - if( m_unqualifiedName.get() ) m_unqualifiedName->setParent( this ); + m_unqualifiedName = std::move(unqualifiedName); + if( m_unqualifiedName ) m_unqualifiedName->setParent( this ); } void NameAST::addClassOrNamespaceName( ClassOrNamespaceNameAST::Node& classOrNamespaceName ) { - if( !classOrNamespaceName.get() ) + if( !classOrNamespaceName ) return; classOrNamespaceName->setParent( this ); @@ -234,7 +234,7 @@ void NameAST::addClassOrNamespaceName( ClassOrNamespaceNameAST::Node& classOrNam TQString NameAST::text() const { - if( !m_unqualifiedName.get() ) + if( !m_unqualifiedName ) return TQString(); TQString str; @@ -249,7 +249,7 @@ TQString NameAST::text() const ++it; } - if( m_unqualifiedName.get() ) + if( m_unqualifiedName ) str += m_unqualifiedName->text(); return str; @@ -268,7 +268,7 @@ LinkageBodyAST::LinkageBodyAST() void LinkageBodyAST::addDeclaration( DeclarationAST::Node& ast ) { - if( !ast.get() ) + if( !ast ) return; ast->setParent( this ); @@ -282,32 +282,32 @@ LinkageSpecificationAST::LinkageSpecificationAST() void LinkageSpecificationAST::setExternType( AST::Node& externType ) { - m_externType = externType; - if( m_externType.get() ) m_externType->setParent( this ); + m_externType = std::move(externType); + if( m_externType ) m_externType->setParent( this ); } void LinkageSpecificationAST::setLinkageBody( LinkageBodyAST::Node& linkageBody ) { - m_linkageBody = linkageBody; - if( m_linkageBody.get() ) m_linkageBody->setParent( this ); + m_linkageBody = std::move(linkageBody); + if( m_linkageBody ) m_linkageBody->setParent( this ); } void LinkageSpecificationAST::setDeclaration( DeclarationAST::Node& decl ) { - m_declaration = decl; - if( m_declaration.get() ) m_declaration->setParent( this ); + m_declaration = std::move(decl); + if( m_declaration ) m_declaration->setParent( this ); } // ------------------------------------------------------------------------ TranslationUnitAST::TranslationUnitAST() { - ////kdDebug(9007) << "++ TranslationUnitAST::TranslationUnitAST()" << endl; + //kdDebug(9007) << "++ TranslationUnitAST::TranslationUnitAST()" << endl; m_declarationList.setAutoDelete( true ); } void TranslationUnitAST::addDeclaration( DeclarationAST::Node& ast ) { - if( !ast.get() ) + if( !ast ) return; ast->setParent( this ); @@ -321,14 +321,14 @@ NamespaceAST::NamespaceAST() void NamespaceAST::setNamespaceName( AST::Node& namespaceName ) { - m_namespaceName = namespaceName; - if( m_namespaceName.get() ) m_namespaceName->setParent( this ); + m_namespaceName = std::move(namespaceName); + if( m_namespaceName ) m_namespaceName->setParent( this ); } void NamespaceAST::setLinkageBody( LinkageBodyAST::Node& linkageBody ) { - m_linkageBody = linkageBody; - if( m_linkageBody.get() ) m_linkageBody->setParent( this ); + m_linkageBody = std::move(linkageBody); + if( m_linkageBody ) m_linkageBody->setParent( this ); } @@ -339,14 +339,14 @@ NamespaceAliasAST::NamespaceAliasAST() void NamespaceAliasAST::setNamespaceName( AST::Node& namespaceName ) { - m_namespaceName = namespaceName; - if( m_namespaceName.get() ) m_namespaceName->setParent( this ); + m_namespaceName = std::move(namespaceName); + if( m_namespaceName ) m_namespaceName->setParent( this ); } void NamespaceAliasAST::setAliasName( NameAST::Node& name ) { - m_aliasName = name; - if( m_aliasName.get() ) m_aliasName->setParent( this ); + m_aliasName = std::move(name); + if( m_aliasName ) m_aliasName->setParent( this ); } // ------------------------------------------------------------------------ @@ -356,14 +356,14 @@ UsingAST::UsingAST() void UsingAST::setTypeName( AST::Node& typeName ) { - m_typeName = typeName; - if( m_typeName.get() ) m_typeName->setParent( this ); + m_typeName = std::move(typeName); + if( m_typeName ) m_typeName->setParent( this ); } void UsingAST::setName( NameAST::Node& name ) { - m_name = name; - if( m_name.get() ) m_name->setParent( this ); + m_name = std::move(name); + if( m_name ) m_name->setParent( this ); } // ------------------------------------------------------------------------ @@ -373,8 +373,8 @@ UsingDirectiveAST::UsingDirectiveAST() void UsingDirectiveAST::setName( NameAST::Node& name ) { - m_name = name; - if( m_name.get() ) m_name->setParent( this ); + m_name = std::move(name); + if( m_name ) m_name->setParent( this ); } TypedefAST::TypedefAST() @@ -383,20 +383,20 @@ TypedefAST::TypedefAST() void TypeSpecifierAST::setName( NameAST::Node& name ) { - m_name = name; - if( m_name.get() ) m_name->setParent( this ); + m_name = std::move(name); + if( m_name ) m_name->setParent( this ); } void TypedefAST::setTypeSpec( TypeSpecifierAST::Node& typeSpec ) { - m_typeSpec = typeSpec; - if( m_typeSpec.get() ) m_typeSpec->setParent( this ); + m_typeSpec = std::move(typeSpec); + if( m_typeSpec ) m_typeSpec->setParent( this ); } void TypedefAST::setInitDeclaratorList( InitDeclaratorListAST::Node& initDeclaratorList ) { - m_initDeclaratorList = initDeclaratorList; - if( m_initDeclaratorList.get() ) m_initDeclaratorList->setParent( this ); + m_initDeclaratorList = std::move(initDeclaratorList); + if( m_initDeclaratorList ) m_initDeclaratorList->setParent( this ); } // ------------------------------------------------------------------------ @@ -407,7 +407,7 @@ TemplateArgumentListAST::TemplateArgumentListAST() void TemplateArgumentListAST::addArgument( AST::Node& arg ) { - if( !arg.get() ) + if( !arg ) return; arg->setParent( this ); @@ -434,20 +434,20 @@ TemplateDeclarationAST::TemplateDeclarationAST() void TemplateDeclarationAST::setExported( AST::Node& exported ) { - m_exported = exported; - if( m_exported.get() ) m_exported->setParent( this ); + m_exported = std::move(exported); + if( m_exported ) m_exported->setParent( this ); } void TemplateDeclarationAST::setTemplateParameterList( TemplateParameterListAST::Node& templateParameterList ) { - m_templateParameterList = templateParameterList; - if( m_templateParameterList.get() ) m_templateParameterList->setParent( this ); + m_templateParameterList = std::move(templateParameterList); + if( m_templateParameterList ) m_templateParameterList->setParent( this ); } void TemplateDeclarationAST::setDeclaration( DeclarationAST::Node& declaration ) { - m_declaration = declaration; - if( m_declaration.get() ) m_declaration->setParent( this ); + m_declaration = std::move(declaration); + if( m_declaration ) m_declaration->setParent( this ); } // ------------------------------------------------------------------------ @@ -457,23 +457,23 @@ ClassOrNamespaceNameAST::ClassOrNamespaceNameAST() void ClassOrNamespaceNameAST::setName( AST::Node& name ) { - m_name = name; - if( m_name.get() ) m_name->setParent( this ); + m_name = std::move(name); + if( m_name ) m_name->setParent( this ); } void ClassOrNamespaceNameAST::setTemplateArgumentList( TemplateArgumentListAST::Node& templateArgumentList ) { - m_templateArgumentList = templateArgumentList; - if( m_templateArgumentList.get() ) m_templateArgumentList->setParent( this ); + m_templateArgumentList = std::move(templateArgumentList); + if( m_templateArgumentList ) m_templateArgumentList->setParent( this ); } TQString ClassOrNamespaceNameAST::text() const { - if( !m_name.get() ) + if( !m_name ) return TQString(); TQString str = m_name->text(); - if( m_templateArgumentList.get() ) + if( m_templateArgumentList ) str += TQString::fromLatin1("< ") + m_templateArgumentList->text() + TQString::fromLatin1(" >"); return str; @@ -486,27 +486,27 @@ TypeSpecifierAST::TypeSpecifierAST() void TypeSpecifierAST::setCvQualify( GroupAST::Node& cvQualify ) { - m_cvQualify = cvQualify; - if( m_cvQualify.get() ) m_cvQualify->setParent( this ); + m_cvQualify = std::move(cvQualify); + if( m_cvQualify ) m_cvQualify->setParent( this ); } void TypeSpecifierAST::setCv2Qualify( GroupAST::Node& cv2Qualify ) { - m_cv2Qualify = cv2Qualify; - if( m_cv2Qualify.get() ) m_cv2Qualify->setParent( this ); + m_cv2Qualify = std::move(cv2Qualify); + if( m_cv2Qualify ) m_cv2Qualify->setParent( this ); } TQString TypeSpecifierAST::text() const { TQString str; - if( m_cvQualify.get() ) + if( m_cvQualify ) str += m_cvQualify->text() + " "; - if( m_name.get() ) + if( m_name ) str += m_name->text(); - if( m_cv2Qualify.get() ) + if( m_cv2Qualify ) str += TQString(" ") + m_cv2Qualify->text(); return str; @@ -520,13 +520,13 @@ ClassSpecifierAST::ClassSpecifierAST() void ClassSpecifierAST::setClassKey( AST::Node& classKey ) { - m_classKey = classKey; - if( m_classKey.get() ) m_classKey->setParent( this ); + m_classKey = std::move(classKey); + if( m_classKey ) m_classKey->setParent( this ); } void ClassSpecifierAST::addDeclaration( DeclarationAST::Node& declaration ) { - if( !declaration.get() ) + if( !declaration ) return; declaration->setParent( this ); @@ -535,8 +535,8 @@ void ClassSpecifierAST::addDeclaration( DeclarationAST::Node& declaration ) void ClassSpecifierAST::setBaseClause( BaseClauseAST::Node& baseClause ) { - m_baseClause = baseClause; - if( m_baseClause.get() ) m_baseClause->setParent( this ); + m_baseClause = std::move(baseClause); + if( m_baseClause ) m_baseClause->setParent( this ); } // ------------------------------------------------------------------------ @@ -547,7 +547,7 @@ EnumSpecifierAST::EnumSpecifierAST() void EnumSpecifierAST::addEnumerator( EnumeratorAST::Node& enumerator ) { - if( !enumerator.get() ) + if( !enumerator ) return; enumerator->setParent( this ); @@ -562,13 +562,13 @@ ElaboratedTypeSpecifierAST::ElaboratedTypeSpecifierAST() void ElaboratedTypeSpecifierAST::setKind( AST::Node& kind ) { - m_kind = kind; - if( m_kind.get() ) m_kind->setParent( this ); + m_kind = std::move(kind); + if( m_kind ) m_kind->setParent( this ); } TQString ElaboratedTypeSpecifierAST::text() const { - if( m_kind.get() ) + if( m_kind ) return m_kind->text() + " " + TypeSpecifierAST::text(); return TypeSpecifierAST::text(); @@ -586,14 +586,14 @@ EnumeratorAST::EnumeratorAST() void EnumeratorAST::setId( AST::Node& id ) { - m_id = id; - if( m_id.get() ) m_id->setParent( this ); + m_id = std::move(id); + if( m_id ) m_id->setParent( this ); } void EnumeratorAST::setExpr( AST::Node& expr ) { - m_expr = expr; - if( m_expr.get() ) m_expr->setParent( this ); + m_expr = std::move(expr); + if( m_expr ) m_expr->setParent( this ); } // ------------------------------------------------------------------------ @@ -604,7 +604,7 @@ BaseClauseAST::BaseClauseAST() void BaseClauseAST::addBaseSpecifier( BaseSpecifierAST::Node& baseSpecifier ) { - if( !baseSpecifier.get() ) + if( !baseSpecifier ) return; baseSpecifier->setParent( this ); @@ -618,20 +618,20 @@ BaseSpecifierAST::BaseSpecifierAST() void BaseSpecifierAST::setIsVirtual( AST::Node& isVirtual ) { - m_isVirtual = isVirtual; - if( m_isVirtual.get() ) m_isVirtual->setParent( this ); + m_isVirtual = std::move(isVirtual); + if( m_isVirtual ) m_isVirtual->setParent( this ); } void BaseSpecifierAST::setAccess( AST::Node& access ) { - m_access = access; - if( m_access.get() ) m_access->setParent( this ); + m_access = std::move(access); + if( m_access ) m_access->setParent( this ); } void BaseSpecifierAST::setName( NameAST::Node& name ) { - m_name = name; - if( m_name.get() ) m_name->setParent( this ); + m_name = std::move(name); + if( m_name ) m_name->setParent( this ); } // ------------------------------------------------------------------------ @@ -641,32 +641,32 @@ SimpleDeclarationAST::SimpleDeclarationAST() void SimpleDeclarationAST::setFunctionSpecifier( GroupAST::Node& functionSpecifier ) { - m_functionSpecifier = functionSpecifier; - if( m_functionSpecifier.get() ) m_functionSpecifier->setParent( this ); + m_functionSpecifier = std::move(functionSpecifier); + if( m_functionSpecifier ) m_functionSpecifier->setParent( this ); } void SimpleDeclarationAST::setStorageSpecifier( GroupAST::Node& storageSpecifier ) { - m_storageSpecifier = storageSpecifier; - if( m_storageSpecifier.get() ) m_storageSpecifier->setParent( this ); + m_storageSpecifier = std::move(storageSpecifier); + if( m_storageSpecifier ) m_storageSpecifier->setParent( this ); } void SimpleDeclarationAST::setTypeSpec( TypeSpecifierAST::Node& typeSpec ) { - m_typeSpec = typeSpec; - if( m_typeSpec.get() ) m_typeSpec->setParent( this ); + m_typeSpec = std::move(typeSpec); + if( m_typeSpec ) m_typeSpec->setParent( this ); } void SimpleDeclarationAST::setInitDeclaratorList( InitDeclaratorListAST::Node& initDeclaratorList ) { - m_initDeclaratorList = initDeclaratorList; - if( m_initDeclaratorList.get() ) m_initDeclaratorList->setParent( this ); + m_initDeclaratorList = std::move(initDeclaratorList); + if( m_initDeclaratorList ) m_initDeclaratorList->setParent( this ); } void SimpleDeclarationAST::setWinDeclSpec( GroupAST::Node& winDeclSpec ) { - m_winDeclSpec = winDeclSpec; - if( m_winDeclSpec.get() ) m_winDeclSpec->setParent( this ); + m_winDeclSpec = std::move(winDeclSpec); + if( m_winDeclSpec ) m_winDeclSpec->setParent( this ); } @@ -678,7 +678,7 @@ InitDeclaratorListAST::InitDeclaratorListAST() void InitDeclaratorListAST::addInitDeclarator( InitDeclaratorAST::Node& decl ) { - if( !decl.get() ) + if( !decl ) return; decl->setParent( this ); @@ -694,52 +694,52 @@ DeclaratorAST::DeclaratorAST() void DeclaratorAST::setSubDeclarator( DeclaratorAST::Node& subDeclarator ) { - m_subDeclarator = subDeclarator; - if( m_subDeclarator.get() ) m_subDeclarator->setParent( this ); + m_subDeclarator = std::move(subDeclarator); + if( m_subDeclarator ) m_subDeclarator->setParent( this ); } void DeclaratorAST::setDeclaratorId( NameAST::Node& declaratorId ) { - m_declaratorId = declaratorId; - if( m_declaratorId.get() ) m_declaratorId->setParent( this ); + m_declaratorId = std::move(declaratorId); + if( m_declaratorId ) m_declaratorId->setParent( this ); } void DeclaratorAST::setBitfieldInitialization( AST::Node& bitfieldInitialization ) { - m_bitfieldInitialization = bitfieldInitialization; - if( m_bitfieldInitialization.get() ) m_bitfieldInitialization->setParent( this ); + m_bitfieldInitialization = std::move(bitfieldInitialization); + if( m_bitfieldInitialization ) m_bitfieldInitialization->setParent( this ); } void DeclaratorAST::addArrayDimension( AST::Node& arrayDimension ) { - if( !arrayDimension.get() ) + if( !arrayDimension ) return; arrayDimension->setParent( this ); m_arrayDimensionList.append( arrayDimension.release() ); } -void DeclaratorAST::setParameterDeclarationClause( ParameterDeclarationClauseAST::Node& parameterDeclarationClause ) +void DeclaratorAST::setParameterDeclarationClause( std::unique_ptr<class ParameterDeclarationClauseAST>& parameterDeclarationClause ) { - m_parameterDeclarationClause = parameterDeclarationClause; - if( m_parameterDeclarationClause.get() ) m_parameterDeclarationClause->setParent( this ); + m_parameterDeclarationClause = std::move(parameterDeclarationClause); + if( m_parameterDeclarationClause ) m_parameterDeclarationClause->setParent( this ); } void DeclaratorAST::setConstant( AST::Node& constant ) { - m_constant = constant; - if( m_constant.get() ) m_constant->setParent( this ); + m_constant = std::move(constant); + if( m_constant ) m_constant->setParent( this ); } void DeclaratorAST::setExceptionSpecification( GroupAST::Node& exceptionSpecification ) { - m_exceptionSpecification = exceptionSpecification; - if( m_exceptionSpecification.get() ) m_exceptionSpecification->setParent( this ); + m_exceptionSpecification = std::move(exceptionSpecification); + if( m_exceptionSpecification ) m_exceptionSpecification->setParent( this ); } void DeclaratorAST::addPtrOp( AST::Node& ptrOp ) { - if( !ptrOp.get() ) + if( !ptrOp ) return; ptrOp->setParent( this ); @@ -753,14 +753,14 @@ InitDeclaratorAST::InitDeclaratorAST() void InitDeclaratorAST::setDeclarator( DeclaratorAST::Node& declarator ) { - m_declarator = declarator; - if( m_declarator.get() ) m_declarator->setParent( this ); + m_declarator = std::move(declarator); + if( m_declarator ) m_declarator->setParent( this ); } void InitDeclaratorAST::setInitializer( AST::Node& initializer ) { - m_initializer = initializer; - if( m_initializer.get() ) m_initializer->setParent( this ); + m_initializer = std::move(initializer); + if( m_initializer ) m_initializer->setParent( this ); } // -------------------------------------------------------------------------- @@ -770,38 +770,38 @@ FunctionDefinitionAST::FunctionDefinitionAST() void FunctionDefinitionAST::setFunctionSpecifier( GroupAST::Node& functionSpecifier ) { - m_functionSpecifier = functionSpecifier; - if( m_functionSpecifier.get() ) m_functionSpecifier->setParent( this ); + m_functionSpecifier = std::move(functionSpecifier); + if( m_functionSpecifier ) m_functionSpecifier->setParent( this ); } void FunctionDefinitionAST::setStorageSpecifier( GroupAST::Node& storageSpecifier ) { - m_storageSpecifier = storageSpecifier; - if( m_storageSpecifier.get() ) m_storageSpecifier->setParent( this ); + m_storageSpecifier = std::move(storageSpecifier); + if( m_storageSpecifier ) m_storageSpecifier->setParent( this ); } void FunctionDefinitionAST::setTypeSpec( TypeSpecifierAST::Node& typeSpec ) { - m_typeSpec = typeSpec; - if( m_typeSpec.get() ) m_typeSpec->setParent( this ); + m_typeSpec = std::move(typeSpec); + if( m_typeSpec ) m_typeSpec->setParent( this ); } void FunctionDefinitionAST::setInitDeclarator( InitDeclaratorAST::Node& initDeclarator ) { - m_initDeclarator = initDeclarator; - if( m_initDeclarator.get() ) m_initDeclarator->setParent( this ); + m_initDeclarator = std::move(initDeclarator); + if( m_initDeclarator ) m_initDeclarator->setParent( this ); } void FunctionDefinitionAST::setFunctionBody( StatementListAST::Node& functionBody ) { - m_functionBody = functionBody; - if( m_functionBody.get() ) m_functionBody->setParent( this ); + m_functionBody = std::move(functionBody); + if( m_functionBody ) m_functionBody->setParent( this ); } void FunctionDefinitionAST::setWinDeclSpec( GroupAST::Node& winDeclSpec ) { - m_winDeclSpec = winDeclSpec; - if( m_winDeclSpec.get() ) m_winDeclSpec->setParent( this ); + m_winDeclSpec = std::move(winDeclSpec); + if( m_winDeclSpec ) m_winDeclSpec->setParent( this ); } // -------------------------------------------------------------------------- @@ -812,7 +812,7 @@ StatementListAST::StatementListAST() void StatementListAST::addStatement( StatementAST::Node& statement ) { - if( !statement.get() ) + if( !statement ) return; statement->setParent( this ); @@ -826,20 +826,20 @@ IfStatementAST::IfStatementAST() void IfStatementAST::setCondition( ConditionAST::Node& condition ) { - m_condition = condition; - if( m_condition.get() ) m_condition->setParent( this ); + m_condition = std::move(condition); + if( m_condition ) m_condition->setParent( this ); } void IfStatementAST::setStatement( StatementAST::Node& statement ) { - m_statement = statement; - if( m_statement.get() ) m_statement->setParent( this ); + m_statement = std::move(statement); + if( m_statement ) m_statement->setParent( this ); } void IfStatementAST::setElseStatement( StatementAST::Node& elseStatement ) { - m_elseStatement = elseStatement; - if( m_elseStatement.get() ) m_elseStatement->setParent( this ); + m_elseStatement = std::move(elseStatement); + if( m_elseStatement ) m_elseStatement->setParent( this ); } // -------------------------------------------------------------------------- @@ -849,14 +849,14 @@ WhileStatementAST::WhileStatementAST() void WhileStatementAST::setCondition( ConditionAST::Node& condition ) { - m_condition = condition; - if( m_condition.get() ) m_condition->setParent( this ); + m_condition = std::move(condition); + if( m_condition ) m_condition->setParent( this ); } void WhileStatementAST::setStatement( StatementAST::Node& statement ) { - m_statement = statement; - if( m_statement.get() ) m_statement->setParent( this ); + m_statement = std::move(statement); + if( m_statement ) m_statement->setParent( this ); } // -------------------------------------------------------------------------- @@ -866,14 +866,14 @@ DoStatementAST::DoStatementAST() void DoStatementAST::setCondition( ConditionAST::Node& condition ) { - m_condition = condition; - if( m_condition.get() ) m_condition->setParent( this ); + m_condition = std::move(condition); + if( m_condition ) m_condition->setParent( this ); } void DoStatementAST::setStatement( StatementAST::Node& statement ) { - m_statement = statement; - if( m_statement.get() ) m_statement->setParent( this ); + m_statement = std::move(statement); + if( m_statement ) m_statement->setParent( this ); } // -------------------------------------------------------------------------- @@ -883,26 +883,26 @@ ForStatementAST::ForStatementAST() void ForStatementAST::setCondition( ConditionAST::Node& condition ) { - m_condition = condition; - if( m_condition.get() ) m_condition->setParent( this ); + m_condition = std::move(condition); + if( m_condition ) m_condition->setParent( this ); } void ForStatementAST::setExpression( AST::Node& expression ) { - m_expression = expression; - if( m_expression.get() ) m_expression->setParent( this ); + m_expression = std::move(expression); + if( m_expression ) m_expression->setParent( this ); } void ForStatementAST::setStatement( StatementAST::Node& statement ) { - m_statement = statement; - if( m_statement.get() ) m_statement->setParent( this ); + m_statement = std::move(statement); + if( m_statement ) m_statement->setParent( this ); } void ForStatementAST::setInitStatement( StatementAST::Node& initStatement ) { - m_initStatement = initStatement; - if( m_initStatement.get() ) m_initStatement->setParent( this ); + m_initStatement = std::move(initStatement); + if( m_initStatement ) m_initStatement->setParent( this ); } // -------------------------------------------------------------------------- @@ -912,20 +912,20 @@ ForEachStatementAST::ForEachStatementAST() void ForEachStatementAST::setExpression( AST::Node& expression ) { - m_expression = expression; - if( m_expression.get() ) m_expression->setParent( this ); + m_expression = std::move(expression); + if( m_expression ) m_expression->setParent( this ); } void ForEachStatementAST::setStatement( StatementAST::Node& statement ) { - m_statement = statement; - if( m_statement.get() ) m_statement->setParent( this ); + m_statement = std::move(statement); + if( m_statement ) m_statement->setParent( this ); } void ForEachStatementAST::setInitStatement( StatementAST::Node& initStatement ) { - m_initStatement = initStatement; - if( m_initStatement.get() ) m_initStatement->setParent( this ); + m_initStatement = std::move(initStatement); + if( m_initStatement ) m_initStatement->setParent( this ); } // -------------------------------------------------------------------------- @@ -935,14 +935,14 @@ SwitchStatementAST::SwitchStatementAST() void SwitchStatementAST::setCondition( ConditionAST::Node& condition ) { - m_condition = condition; - if( m_condition.get() ) m_condition->setParent( this ); + m_condition = std::move(condition); + if( m_condition ) m_condition->setParent( this ); } void SwitchStatementAST::setStatement( StatementAST::Node& statement ) { - m_statement = statement; - if( m_statement.get() ) m_statement->setParent( this ); + m_statement = std::move(statement); + if( m_statement ) m_statement->setParent( this ); } // -------------------------------------------------------------------------- @@ -953,7 +953,7 @@ CatchStatementListAST::CatchStatementListAST() void CatchStatementListAST::addStatement( CatchStatementAST::Node& statement ) { - if( !statement.get() ) + if( !statement ) return; statement->setParent( this ); @@ -967,14 +967,14 @@ CatchStatementAST::CatchStatementAST() void CatchStatementAST::setCondition( ConditionAST::Node& condition ) { - m_condition = condition; - if( m_condition.get() ) m_condition->setParent( this ); + m_condition = std::move(condition); + if( m_condition ) m_condition->setParent( this ); } void CatchStatementAST::setStatement( StatementAST::Node& statement ) { - m_statement = statement; - if( m_statement.get() ) m_statement->setParent( this ); + m_statement = std::move(statement); + if( m_statement ) m_statement->setParent( this ); } // -------------------------------------------------------------------------- @@ -984,14 +984,14 @@ TryBlockStatementAST::TryBlockStatementAST() void TryBlockStatementAST::setStatement( StatementAST::Node& statement ) { - m_statement = statement; - if( m_statement.get() ) m_statement->setParent( this ); + m_statement = std::move(statement); + if( m_statement ) m_statement->setParent( this ); } void TryBlockStatementAST::setCatchStatementList( CatchStatementListAST::Node& statementList ) { - m_catchStatementList = statementList; - if( m_catchStatementList.get() ) m_catchStatementList->setParent( this ); + m_catchStatementList = std::move(statementList); + if( m_catchStatementList ) m_catchStatementList->setParent( this ); } // -------------------------------------------------------------------------- @@ -1001,8 +1001,8 @@ DeclarationStatementAST::DeclarationStatementAST() void DeclarationStatementAST::setDeclaration( DeclarationAST::Node& declaration ) { - m_declaration = declaration; - if( m_declaration.get() ) m_declaration->setParent( this ); + m_declaration = std::move(declaration); + if( m_declaration ) m_declaration->setParent( this ); } // -------------------------------------------------------------------------- @@ -1012,8 +1012,8 @@ ExpressionStatementAST::ExpressionStatementAST() void ExpressionStatementAST::setExpression( AST::Node& expression ) { - m_expression = expression; - if( m_expression.get() ) m_expression->setParent( this ); + m_expression = std::move(expression); + if( m_expression ) m_expression->setParent( this ); } @@ -1024,32 +1024,32 @@ ParameterDeclarationAST::ParameterDeclarationAST() void ParameterDeclarationAST::setTypeSpec( TypeSpecifierAST::Node& typeSpec ) { - m_typeSpec = typeSpec; - if( m_typeSpec.get() ) m_typeSpec->setParent( this ); + m_typeSpec = std::move(typeSpec); + if( m_typeSpec ) m_typeSpec->setParent( this ); } void ParameterDeclarationAST::setDeclarator( DeclaratorAST::Node& declarator ) { - m_declarator = declarator; - if( m_declarator.get() ) m_declarator->setParent( this ); + m_declarator = std::move(declarator); + if( m_declarator ) m_declarator->setParent( this ); } void ParameterDeclarationAST::setExpression( AST::Node& expression ) { - m_expression = expression; - if( m_expression.get() ) m_expression->setParent( this ); + m_expression = std::move(expression); + if( m_expression ) m_expression->setParent( this ); } TQString ParameterDeclarationAST::text() const { TQString str; - if( m_typeSpec.get() ) + if( m_typeSpec ) str += m_typeSpec->text() + " "; - if( m_declarator.get() ) + if( m_declarator ) str += m_declarator->text(); - if( m_expression.get() ) + if( m_expression ) str += TQString( " = " ) + m_expression->text(); return str; @@ -1063,7 +1063,7 @@ ParameterDeclarationListAST::ParameterDeclarationListAST() void ParameterDeclarationListAST::addParameter( ParameterDeclarationAST::Node& parameter ) { - if( !parameter.get() ) + if( !parameter ) return; parameter->setParent( this ); @@ -1091,24 +1091,24 @@ ParameterDeclarationClauseAST::ParameterDeclarationClauseAST() void ParameterDeclarationClauseAST::setParameterDeclarationList( ParameterDeclarationListAST::Node& parameterDeclarationList ) { - m_parameterDeclarationList = parameterDeclarationList; - if( m_parameterDeclarationList.get() ) m_parameterDeclarationList->setParent( this ); + m_parameterDeclarationList = std::move(parameterDeclarationList); + if( m_parameterDeclarationList ) m_parameterDeclarationList->setParent( this ); } void ParameterDeclarationClauseAST::setEllipsis( AST::Node& ellipsis ) { - m_ellipsis = ellipsis; - if( m_ellipsis.get() ) m_ellipsis->setParent( this ); + m_ellipsis = std::move(ellipsis); + if( m_ellipsis ) m_ellipsis->setParent( this ); } TQString ParameterDeclarationClauseAST::text() const { TQString str; - if( m_parameterDeclarationList.get() ) + if( m_parameterDeclarationList ) str += m_parameterDeclarationList->text(); - if( m_ellipsis.get() ) + if( m_ellipsis ) str += " ..."; return str; @@ -1123,7 +1123,7 @@ GroupAST::GroupAST() void GroupAST::addNode( AST::Node& node ) { - if( !node.get() ) + if( !node ) return; node->setParent( this ); @@ -1151,7 +1151,7 @@ AccessDeclarationAST::AccessDeclarationAST() void AccessDeclarationAST::addAccess( AST::Node& access ) { - if( !access.get() ) + if( !access ) return; access->setParent( this ); @@ -1178,26 +1178,26 @@ TypeParameterAST::TypeParameterAST() void TypeParameterAST::setKind( AST::Node& kind ) { - m_kind = kind; - if( m_kind.get() ) m_kind->setParent( this ); + m_kind = std::move(kind); + if( m_kind ) m_kind->setParent( this ); } -void TypeParameterAST::setTemplateParameterList( TemplateParameterListAST::Node& templateParameterList ) +void TypeParameterAST::setTemplateParameterList( std::unique_ptr<class TemplateParameterListAST>& templateParameterList ) { - m_templateParameterList = templateParameterList; - if( m_templateParameterList.get() ) m_templateParameterList->setParent( this ); + m_templateParameterList = std::move(templateParameterList); + if( m_templateParameterList ) m_templateParameterList->setParent( this ); } void TypeParameterAST::setName( NameAST::Node& name ) { - m_name = name; - if( m_name.get() ) m_name->setParent( this ); + m_name = std::move(name); + if( m_name ) m_name->setParent( this ); } void TypeParameterAST::setTypeId( AST::Node& typeId ) { - m_typeId = typeId; - if( m_typeId.get() ) m_typeId->setParent( this ); + m_typeId = std::move(typeId); + if( m_typeId ) m_typeId->setParent( this ); } // -------------------------------------------------------------------------- @@ -1207,14 +1207,14 @@ TemplateParameterAST::TemplateParameterAST() void TemplateParameterAST::setTypeParameter( TypeParameterAST::Node& typeParameter ) { - m_typeParameter = typeParameter; - if( m_typeParameter.get() ) m_typeParameter->setParent( this ); + m_typeParameter = std::move(typeParameter); + if( m_typeParameter ) m_typeParameter->setParent( this ); } void TemplateParameterAST::setTypeValueParameter( ParameterDeclarationAST::Node& typeValueParameter ) { - m_typeValueParameter = typeValueParameter; - if( m_typeValueParameter.get() ) m_typeValueParameter->setParent( this ); + m_typeValueParameter = std::move(typeValueParameter); + if( m_typeValueParameter ) m_typeValueParameter->setParent( this ); } // -------------------------------------------------------------------------- @@ -1225,7 +1225,7 @@ TemplateParameterListAST::TemplateParameterListAST() void TemplateParameterListAST::addTemplateParameter( TemplateParameterAST::Node& templateParameter ) { - if( !templateParameter.get() ) + if( !templateParameter ) return; templateParameter->setParent( this ); @@ -1239,24 +1239,24 @@ ConditionAST::ConditionAST() void ConditionAST::setTypeSpec( TypeSpecifierAST::Node& typeSpec ) { - m_typeSpec = typeSpec; - if( m_typeSpec.get() ) m_typeSpec->setParent( this ); + m_typeSpec = std::move(typeSpec); + if( m_typeSpec ) m_typeSpec->setParent( this ); } void ConditionAST::setDeclarator( DeclaratorAST::Node& declarator ) { - m_declarator = declarator; - if( m_declarator.get() ) m_declarator->setParent( this ); + m_declarator = std::move(declarator); + if( m_declarator ) m_declarator->setParent( this ); } void ConditionAST::setExpression( AST::Node& expression ) { - m_expression = expression; - if( m_expression.get() ) m_expression->setParent( this ); + m_expression = std::move(expression); + if( m_expression ) m_expression->setParent( this ); } void ClassSpecifierAST::setWinDeclSpec( GroupAST::Node & winDeclSpec ) { - m_winDeclSpec = winDeclSpec; - if( m_winDeclSpec.get() ) m_winDeclSpec->setParent( this ); + m_winDeclSpec = std::move(winDeclSpec); + if( m_winDeclSpec ) m_winDeclSpec->setParent( this ); } |