diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-01-23 12:47:15 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-02-07 00:06:53 +0900 |
commit | 12c95f5db577785d29c51643f20fe2c8700af7cb (patch) | |
tree | 8845a757afbec274baf0ed3c677df1b43b52459a /lib | |
parent | c8d7b46522918fbb19e77e7a12d7c1d0ed9ae390 (diff) | |
download | tdevelop-12c95f5db577785d29c51643f20fe2c8700af7cb.tar.gz tdevelop-12c95f5db577785d29c51643f20fe2c8700af7cb.zip |
Replace auto_ptr
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cppparser/ast.cpp | 404 | ||||
-rw-r--r-- | lib/cppparser/ast.h | 106 | ||||
-rw-r--r-- | lib/cppparser/parser.cpp | 152 |
3 files changed, 331 insertions, 331 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 ); } diff --git a/lib/cppparser/ast.h b/lib/cppparser/ast.h index c53cce20..b6c2d64b 100644 --- a/lib/cppparser/ast.h +++ b/lib/cppparser/ast.h @@ -155,7 +155,7 @@ class CommentAST { class AST : public CommentAST { public: - typedef std::auto_ptr<AST> Node; + typedef std::unique_ptr<AST> Node; enum { Type=NodeType_Generic }; DECLARE_ALLOC( AST ) @@ -217,7 +217,7 @@ private: class GroupAST: public AST { public: - typedef std::auto_ptr<GroupAST> Node; + typedef std::unique_ptr<GroupAST> Node; enum { Type = NodeType_Group }; DECLARE_ALLOC( GroupAST ) @@ -242,7 +242,7 @@ private: class TemplateArgumentListAST: public AST { public: - typedef std::auto_ptr<TemplateArgumentListAST> Node; + typedef std::unique_ptr<TemplateArgumentListAST> Node; enum { Type = NodeType_TemplateArgumentList }; DECLARE_ALLOC( TemplateArgumentListAST ) @@ -266,7 +266,7 @@ private: class ClassOrNamespaceNameAST: public AST { public: - typedef std::auto_ptr<ClassOrNamespaceNameAST> Node; + typedef std::unique_ptr<ClassOrNamespaceNameAST> Node; enum { Type = NodeType_ClassOrNamespaceName }; DECLARE_ALLOC( ClassOrNamespaceNameAST ) @@ -294,7 +294,7 @@ private: class NameAST: public AST { public: - typedef std::auto_ptr<NameAST> Node; + typedef std::unique_ptr<NameAST> Node; enum { Type = NodeType_Name }; DECLARE_ALLOC( NameAST ) @@ -326,7 +326,7 @@ private: class TypeParameterAST: public AST { public: - typedef std::auto_ptr<TypeParameterAST> Node; + typedef std::unique_ptr<TypeParameterAST> Node; enum { Type = NodeType_TypeParameter }; DECLARE_ALLOC( TypeParameterAST ) @@ -338,7 +338,7 @@ public: void setKind( AST::Node& kind ); class TemplateParameterListAST* templateParameterList() { return m_templateParameterList.get(); } - void setTemplateParameterList( std::auto_ptr<class TemplateParameterListAST>& templateParameterList ); + void setTemplateParameterList( std::unique_ptr<class TemplateParameterListAST>& templateParameterList ); NameAST* name() { return m_name.get(); } void setName( NameAST::Node& name ); @@ -348,7 +348,7 @@ public: private: AST::Node m_kind; - std::auto_ptr<class TemplateParameterListAST> m_templateParameterList; + std::unique_ptr<class TemplateParameterListAST> m_templateParameterList; NameAST::Node m_name; AST::Node m_typeId; @@ -360,7 +360,7 @@ private: class DeclarationAST: public AST { public: - typedef std::auto_ptr<DeclarationAST> Node; + typedef std::unique_ptr<DeclarationAST> Node; enum { Type = NodeType_Declaration }; DECLARE_ALLOC( DeclarationAST ) @@ -376,7 +376,7 @@ private: class AccessDeclarationAST: public DeclarationAST { public: - typedef std::auto_ptr<AccessDeclarationAST> Node; + typedef std::unique_ptr<AccessDeclarationAST> Node; enum { Type = NodeType_AccessDeclaration }; DECLARE_ALLOC( AccessDeclarationAST ) @@ -400,7 +400,7 @@ private: class TypeSpecifierAST: public AST { public: - typedef std::auto_ptr<TypeSpecifierAST> Node; + typedef std::unique_ptr<TypeSpecifierAST> Node; enum { Type = NodeType_TypeSpecifier }; DECLARE_ALLOC( TypeSpecifierAST ) @@ -432,7 +432,7 @@ private: class BaseSpecifierAST: public AST { public: - typedef std::auto_ptr<BaseSpecifierAST> Node; + typedef std::unique_ptr<BaseSpecifierAST> Node; enum { Type = NodeType_BaseSpecifier }; DECLARE_ALLOC( BaseSpecifierAST ) @@ -462,7 +462,7 @@ private: class BaseClauseAST: public AST { public: - typedef std::auto_ptr<BaseClauseAST> Node; + typedef std::unique_ptr<BaseClauseAST> Node; enum { Type = NodeType_BaseClause }; DECLARE_ALLOC( BaseClauseAST ) @@ -484,7 +484,7 @@ private: class ClassSpecifierAST: public TypeSpecifierAST { public: - typedef std::auto_ptr<ClassSpecifierAST> Node; + typedef std::unique_ptr<ClassSpecifierAST> Node; enum { Type = NodeType_ClassSpecifier }; DECLARE_ALLOC( ClassSpecifierAST ) @@ -517,7 +517,7 @@ private: class EnumeratorAST: public AST { public: - typedef std::auto_ptr<EnumeratorAST> Node; + typedef std::unique_ptr<EnumeratorAST> Node; enum { Type = NodeType_Enumerator }; DECLARE_ALLOC( EnumeratorAST ) @@ -543,7 +543,7 @@ private: class EnumSpecifierAST: public TypeSpecifierAST { public: - typedef std::auto_ptr<EnumSpecifierAST> Node; + typedef std::unique_ptr<EnumSpecifierAST> Node; enum { Type = NodeType_EnumSpecifier }; DECLARE_ALLOC( EnumSpecifierAST ) @@ -565,7 +565,7 @@ private: class ElaboratedTypeSpecifierAST: public TypeSpecifierAST { public: - typedef std::auto_ptr<ElaboratedTypeSpecifierAST> Node; + typedef std::unique_ptr<ElaboratedTypeSpecifierAST> Node; enum { Type = NodeType_ElaboratedTypeSpecifier }; DECLARE_ALLOC( ElaboratedTypeSpecifierAST ) @@ -590,7 +590,7 @@ private: class LinkageBodyAST: public AST { public: - typedef std::auto_ptr<LinkageBodyAST> Node; + typedef std::unique_ptr<LinkageBodyAST> Node; enum { Type = NodeType_LinkageBody }; DECLARE_ALLOC( LinkageBodyAST ) @@ -612,7 +612,7 @@ private: class LinkageSpecificationAST: public DeclarationAST { public: - typedef std::auto_ptr<LinkageSpecificationAST> Node; + typedef std::unique_ptr<LinkageSpecificationAST> Node; enum { Type = NodeType_LinkageSpecification }; DECLARE_ALLOC( LinkageSpecificationAST ) @@ -642,7 +642,7 @@ private: class NamespaceAST: public DeclarationAST { public: - typedef std::auto_ptr<NamespaceAST> Node; + typedef std::unique_ptr<NamespaceAST> Node; enum { Type = NodeType_Namespace }; DECLARE_ALLOC( NamespaceAST ) @@ -668,7 +668,7 @@ private: class NamespaceAliasAST: public DeclarationAST { public: - typedef std::auto_ptr<NamespaceAliasAST> Node; + typedef std::unique_ptr<NamespaceAliasAST> Node; enum { Type = NodeType_NamespaceAlias }; DECLARE_ALLOC( NamespaceAliasAST ) @@ -694,7 +694,7 @@ private: class UsingAST: public DeclarationAST { public: - typedef std::auto_ptr<UsingAST> Node; + typedef std::unique_ptr<UsingAST> Node; enum { Type = NodeType_Using }; DECLARE_ALLOC( UsingAST ) @@ -720,7 +720,7 @@ private: class UsingDirectiveAST: public DeclarationAST { public: - typedef std::auto_ptr<UsingDirectiveAST> Node; + typedef std::unique_ptr<UsingDirectiveAST> Node; enum { Type = NodeType_UsingDirective }; DECLARE_ALLOC( UsingDirectiveAST ) @@ -742,7 +742,7 @@ private: class DeclaratorAST: public AST { public: - typedef std::auto_ptr<DeclaratorAST> Node; + typedef std::unique_ptr<DeclaratorAST> Node; enum { Type = NodeType_Declarator }; DECLARE_ALLOC( DeclaratorAST ) @@ -754,7 +754,7 @@ public: void addPtrOp( AST::Node& ptrOp ); DeclaratorAST* subDeclarator() { return m_subDeclarator.get(); } - void setSubDeclarator( std::auto_ptr<DeclaratorAST>& subDeclarator ); + void setSubDeclarator( Node& subDeclarator ); NameAST* declaratorId() { return m_declaratorId.get(); } void setDeclaratorId( NameAST::Node& declaratorId ); @@ -766,7 +766,7 @@ public: void addArrayDimension( AST::Node& arrayDimension ); class ParameterDeclarationClauseAST* parameterDeclarationClause() { return m_parameterDeclarationClause.get(); } - void setParameterDeclarationClause( std::auto_ptr<class ParameterDeclarationClauseAST>& parameterDeclarationClause ); + void setParameterDeclarationClause( std::unique_ptr<class ParameterDeclarationClauseAST>& parameterDeclarationClause ); // ### replace 'constant' with cvQualify AST* constant() { return m_constant.get(); } @@ -777,11 +777,11 @@ public: private: TQPtrList<AST> m_ptrOpList; - std::auto_ptr<DeclaratorAST> m_subDeclarator; + Node m_subDeclarator; NameAST::Node m_declaratorId; AST::Node m_bitfieldInitialization; TQPtrList<AST> m_arrayDimensionList; - std::auto_ptr<class ParameterDeclarationClauseAST> m_parameterDeclarationClause; + std::unique_ptr<class ParameterDeclarationClauseAST> m_parameterDeclarationClause; AST::Node m_constant; GroupAST::Node m_exceptionSpecification; @@ -793,7 +793,7 @@ private: class ParameterDeclarationAST: public AST { public: - typedef std::auto_ptr<ParameterDeclarationAST> Node; + typedef std::unique_ptr<ParameterDeclarationAST> Node; enum { Type = NodeType_ParameterDeclaration }; DECLARE_ALLOC( ParameterDeclarationAST ) @@ -825,7 +825,7 @@ private: class ParameterDeclarationListAST: public AST { public: - typedef std::auto_ptr<ParameterDeclarationListAST> Node; + typedef std::unique_ptr<ParameterDeclarationListAST> Node; enum { Type = NodeType_ParameterDeclarationList }; DECLARE_ALLOC( ParameterDeclarationListAST ) @@ -849,7 +849,7 @@ private: class ParameterDeclarationClauseAST: public AST { public: - typedef std::auto_ptr<ParameterDeclarationClauseAST> Node; + typedef std::unique_ptr<ParameterDeclarationClauseAST> Node; enum { Type = NodeType_ParameterDeclarationClause }; DECLARE_ALLOC( ParameterDeclarationClauseAST ) @@ -878,7 +878,7 @@ private: class InitDeclaratorAST: public AST { public: - typedef std::auto_ptr<InitDeclaratorAST> Node; + typedef std::unique_ptr<InitDeclaratorAST> Node; enum { Type = NodeType_InitDeclarator }; DECLARE_ALLOC( InitDeclaratorAST ) @@ -904,7 +904,7 @@ private: class InitDeclaratorListAST: public AST { public: - typedef std::auto_ptr<InitDeclaratorListAST> Node; + typedef std::unique_ptr<InitDeclaratorListAST> Node; enum { Type = NodeType_InitDeclaratorList }; DECLARE_ALLOC( InitDeclaratorListAST ) @@ -926,7 +926,7 @@ private: class TypedefAST: public DeclarationAST { public: - typedef std::auto_ptr<TypedefAST> Node; + typedef std::unique_ptr<TypedefAST> Node; enum { Type = NodeType_Typedef }; DECLARE_ALLOC( TypedefAST ) @@ -952,7 +952,7 @@ private: class TemplateParameterAST: public AST { public: - typedef std::auto_ptr<TemplateParameterAST> Node; + typedef std::unique_ptr<TemplateParameterAST> Node; enum { Type = NodeType_TemplateParameter }; DECLARE_ALLOC( TemplateParameterAST ) @@ -978,7 +978,7 @@ private: class TemplateParameterListAST: public AST { public: - typedef std::auto_ptr<TemplateParameterListAST> Node; + typedef std::unique_ptr<TemplateParameterListAST> Node; enum { Type = NodeType_TemplateParameterList }; DECLARE_ALLOC( TemplateParameterListAST ) @@ -1000,7 +1000,7 @@ private: class TemplateDeclarationAST: public DeclarationAST { public: - typedef std::auto_ptr<TemplateDeclarationAST> Node; + typedef std::unique_ptr<TemplateDeclarationAST> Node; enum { Type = NodeType_TemplateDeclaration }; DECLARE_ALLOC( TemplateDeclarationAST ) @@ -1030,7 +1030,7 @@ private: class SimpleDeclarationAST: public DeclarationAST { public: - typedef std::auto_ptr<SimpleDeclarationAST> Node; + typedef std::unique_ptr<SimpleDeclarationAST> Node; enum { Type = NodeType_SimpleDeclaration }; DECLARE_ALLOC( SimpleDeclarationAST ) @@ -1068,7 +1068,7 @@ private: class StatementAST: public AST { public: - typedef std::auto_ptr<StatementAST> Node; + typedef std::unique_ptr<StatementAST> Node; enum { Type = NodeType_Statement }; DECLARE_ALLOC( StatementAST ) @@ -1084,7 +1084,7 @@ private: class ExpressionStatementAST: public StatementAST { public: - typedef std::auto_ptr<ExpressionStatementAST> Node; + typedef std::unique_ptr<ExpressionStatementAST> Node; enum { Type = NodeType_ExpressionStatement }; DECLARE_ALLOC( ExpressionStatementAST ) @@ -1106,7 +1106,7 @@ private: class ConditionAST: public AST { public: - typedef std::auto_ptr<ConditionAST> Node; + typedef std::unique_ptr<ConditionAST> Node; enum { Type = NodeType_Condition }; DECLARE_ALLOC( ConditionAST ) @@ -1136,7 +1136,7 @@ private: class IfStatementAST: public StatementAST { public: - typedef std::auto_ptr<IfStatementAST> Node; + typedef std::unique_ptr<IfStatementAST> Node; enum { Type = NodeType_IfStatement }; DECLARE_ALLOC( IfStatementAST ) @@ -1166,7 +1166,7 @@ private: class WhileStatementAST: public StatementAST { public: - typedef std::auto_ptr<WhileStatementAST> Node; + typedef std::unique_ptr<WhileStatementAST> Node; enum { Type = NodeType_WhileStatement }; DECLARE_ALLOC( WhileStatementAST ) @@ -1192,7 +1192,7 @@ private: class DoStatementAST: public StatementAST { public: - typedef std::auto_ptr<DoStatementAST> Node; + typedef std::unique_ptr<DoStatementAST> Node; enum { Type = NodeType_DoStatement }; DECLARE_ALLOC( DoStatementAST ) @@ -1218,7 +1218,7 @@ private: class ForStatementAST: public StatementAST { public: - typedef std::auto_ptr<ForStatementAST> Node; + typedef std::unique_ptr<ForStatementAST> Node; enum { Type = NodeType_ForStatement }; DECLARE_ALLOC( ForStatementAST ) @@ -1252,7 +1252,7 @@ private: class ForEachStatementAST: public StatementAST { public: - typedef std::auto_ptr<ForEachStatementAST> Node; + typedef std::unique_ptr<ForEachStatementAST> Node; enum { Type = NodeType_ForEachStatement }; DECLARE_ALLOC( ForEachStatementAST ) @@ -1282,7 +1282,7 @@ private: class SwitchStatementAST: public StatementAST { public: - typedef std::auto_ptr<SwitchStatementAST> Node; + typedef std::unique_ptr<SwitchStatementAST> Node; enum { Type = NodeType_SwitchStatement }; DECLARE_ALLOC( SwitchStatementAST ) @@ -1308,7 +1308,7 @@ private: class StatementListAST: public StatementAST { public: - typedef std::auto_ptr<StatementListAST> Node; + typedef std::unique_ptr<StatementListAST> Node; enum { Type = NodeType_StatementList }; DECLARE_ALLOC( StatementListAST ) @@ -1330,7 +1330,7 @@ private: class CatchStatementAST: public StatementAST { public: - typedef std::auto_ptr<CatchStatementAST> Node; + typedef std::unique_ptr<CatchStatementAST> Node; enum { Type = NodeType_CatchStatement }; DECLARE_ALLOC( CatchStatementAST ) @@ -1356,7 +1356,7 @@ private: class CatchStatementListAST: public StatementAST { public: - typedef std::auto_ptr<CatchStatementListAST> Node; + typedef std::unique_ptr<CatchStatementListAST> Node; enum { Type = NodeType_CatchStatementList }; DECLARE_ALLOC( CatchStatementListAST ) @@ -1378,7 +1378,7 @@ private: class TryBlockStatementAST: public StatementAST { public: - typedef std::auto_ptr<TryBlockStatementAST> Node; + typedef std::unique_ptr<TryBlockStatementAST> Node; enum { Type = NodeType_TryBlockStatement }; DECLARE_ALLOC( TryBlockStatementAST ) @@ -1404,7 +1404,7 @@ private: class DeclarationStatementAST: public StatementAST { public: - typedef std::auto_ptr<DeclarationStatementAST> Node; + typedef std::unique_ptr<DeclarationStatementAST> Node; enum { Type = NodeType_DeclarationStatement }; DECLARE_ALLOC( DeclarationStatementAST ) @@ -1426,7 +1426,7 @@ private: class FunctionDefinitionAST: public DeclarationAST { public: - typedef std::auto_ptr<FunctionDefinitionAST> Node; + typedef std::unique_ptr<FunctionDefinitionAST> Node; enum { Type = NodeType_FunctionDefinition }; DECLARE_ALLOC( FunctionDefinitionAST ) diff --git a/lib/cppparser/parser.cpp b/lib/cppparser/parser.cpp index c4eccfd3..9701b944 100644 --- a/lib/cppparser/parser.cpp +++ b/lib/cppparser/parser.cpp @@ -325,7 +325,7 @@ bool Parser::skipCommaExpression( AST::Node& node ) AST::Node ast = CreateNode<AST>(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -377,7 +377,7 @@ bool Parser::skipExpression( AST::Node& node ) { AST::Node ast = CreateNode<AST>(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); } return true; @@ -428,7 +428,7 @@ bool Parser::parseName( NameAST::Node& node ) return false; UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -441,7 +441,7 @@ bool Parser::parseTranslationUnit( TranslationUnitAST::Node& node ) m_problems = 0; TranslationUnitAST::Node tun = CreateNode<TranslationUnitAST>(); - node = tun; + node = std::move(tun); if( lex->lookAhead(0) == Token_comment ) { node->setComment( lex->lookAhead(0).text() ); nextToken(); @@ -539,7 +539,7 @@ bool Parser::parseDeclaration( DeclarationAST::Node& node ) ast->setTypeSpec( spec ); ast->setInitDeclaratorList( declarators ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -587,7 +587,7 @@ bool Parser::parseLinkageSpecification( DeclarationAST::Node& node ) UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -604,7 +604,7 @@ bool Parser::parseLinkageBody( LinkageBodyAST::Node& node ) nextToken(); LinkageBodyAST::Node lba = CreateNode<LinkageBodyAST>(); - node = lba; + node = std::move(lba); while( !lex->lookAhead(0).isNull() ){ int tk = lex->lookAhead( 0 ); @@ -665,7 +665,7 @@ bool Parser::parseNamespace( DeclarationAST::Node& node ) ast->setNamespaceName( namespaceName ); ast->setAliasName( name ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } else { reportError( i18n("namespace expected") ); @@ -684,7 +684,7 @@ bool Parser::parseNamespace( DeclarationAST::Node& node ) ast->setLinkageBody( linkageBody ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -727,7 +727,7 @@ bool Parser::parseUsing( DeclarationAST::Node& node ) ADVANCE( ';', ";" ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -754,7 +754,7 @@ bool Parser::parseUsingDirective( DeclarationAST::Node& node ) UsingDirectiveAST::Node ast = CreateNode<UsingDirectiveAST>(); ast->setName( name ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -774,7 +774,7 @@ bool Parser::parseOperatorFunctionId( AST::Node& node ) AST::Node op; if( parseOperator(op) ){ AST::Node asn = CreateNode<AST>(); - node = asn; + node = std::move(asn); UPDATE_POS( node, start, lex->index() ); return true; } else { @@ -798,7 +798,7 @@ bool Parser::parseOperatorFunctionId( AST::Node& node ) ; AST::Node asn = CreateNode<AST>(); - node = asn; + node = std::move(asn); UPDATE_POS( node, start, lex->index() ); return true; } @@ -831,7 +831,7 @@ bool Parser::parseTemplateArgumentList( TemplateArgumentListAST::Node& node, boo } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -879,7 +879,7 @@ bool Parser::parseTypedef( DeclarationAST::Node& node ) ast->setTypeSpec( spec ); ast->setInitDeclaratorList( declarators ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -913,7 +913,7 @@ bool Parser::parseTemplateDeclaration( DeclarationAST::Node& node ) nextToken(); AST::Node n = CreateNode<AST>(); UPDATE_POS( n, startExport, lex->index() ); - exp = n; + exp = std::move(n); } if( lex->lookAhead(0) != Token_template ){ @@ -939,7 +939,7 @@ bool Parser::parseTemplateDeclaration( DeclarationAST::Node& node ) ast->setTemplateParameterList( params ); ast->setDeclaration( def ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1033,7 +1033,7 @@ bool Parser::parseCvQualify( GroupAST::Node& node ) ////kdDebug(9007)<< "-----------------> token = " << lex->lookAhead(0).text() << endl; UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1090,7 +1090,7 @@ bool Parser::parseSimpleTypeSpecifier( TypeSpecifierAST::Node& node ) } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1118,7 +1118,7 @@ bool Parser::parsePtrOperator( AST::Node& node ) AST::Node ast = CreateNode<AST>(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1283,7 +1283,7 @@ bool Parser::parseDeclarator( DeclaratorAST::Node& node ) update_pos: UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1380,7 +1380,7 @@ bool Parser::parseAbstractDeclarator( DeclaratorAST::Node& node ) UPDATE_POS: UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1439,7 +1439,7 @@ bool Parser::parseEnumSpecifier( TypeSpecifierAST::Node& node ) UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1470,7 +1470,7 @@ bool Parser::parseTemplateParameterList( TemplateParameterListAST::Node& node ) } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1498,7 +1498,7 @@ bool Parser::parseTemplateParameter( TemplateParameterAST::Node& node ) ok: UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1586,7 +1586,7 @@ bool Parser::parseTypeParameter( TypeParameterAST::Node& node ) UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1615,7 +1615,7 @@ bool Parser::parseStorageClassSpecifier( GroupAST::Node& node ) return false; UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1644,7 +1644,7 @@ bool Parser::parseFunctionSpecifier( GroupAST::Node& node ) return false; UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1665,7 +1665,7 @@ bool Parser::parseTypeId( AST::Node& node ) parseAbstractDeclarator( decl ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1696,7 +1696,7 @@ bool Parser::parseInitDeclaratorList( InitDeclaratorListAST::Node& node ) ////kdDebug(9007)<< "--- tok = " << lex->lookAhead(0).text() << " -- " << "Parser::parseInitDeclaratorList() -- end" << endl; UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1735,7 +1735,7 @@ good: /// @todo add ellipsis UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1844,7 +1844,7 @@ bool Parser::parseParameterDeclarationList( ParameterDeclarationListAST::Node& n } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1887,7 +1887,7 @@ bool Parser::parseParameterDeclaration( ParameterDeclarationAST::Node& node ) ast->setExpression( expr ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1905,7 +1905,7 @@ bool Parser::parseClassSpecifier( TypeSpecifierAST::Node& node ) int kind = lex->lookAhead( 0 ); if( kind == Token_class || kind == Token_struct || kind == Token_union ){ AST::Node asn = CreateNode<AST>(); - classKey = asn; + classKey = std::move(asn); nextToken(); UPDATE_POS( classKey, classKeyStart, lex->index() ); } else { @@ -1968,7 +1968,7 @@ bool Parser::parseClassSpecifier( TypeSpecifierAST::Node& node ) nextToken(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1984,7 +1984,7 @@ bool Parser::parseAccessSpecifier( AST::Node& node ) case Token_protected: case Token_private: { AST::Node asn = CreateNode<AST>(); - node = asn; + node = std::move(asn); nextToken(); UPDATE_POS( node, start, lex->index() ); return true; @@ -2016,7 +2016,7 @@ bool Parser::parseMemberSpecification( DeclarationAST::Node& node ) ast->addAccess( n ); ADVANCE( ':', ":" ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } else if( parseTypedef(node) ){ return true; @@ -2037,7 +2037,7 @@ bool Parser::parseMemberSpecification( DeclarationAST::Node& node ) } ADVANCE( ':', ":" ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2065,7 +2065,7 @@ bool Parser::parseMemberSpecification( DeclarationAST::Node& node ) ast->setTypeSpec( spec ); ast->setInitDeclaratorList( declarators ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2115,7 +2115,7 @@ bool Parser::parseElaboratedTypeSpecifier( TypeSpecifierAST::Node& node ) ast->setKind( kind ); ast->setName( name ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2149,7 +2149,7 @@ bool Parser::parseExceptionSpecification( GroupAST::Node& node ) ast->addNode( ellipsis ); nextToken(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); } else if( lex->lookAhead(0) == ')' ) { node = CreateNode<GroupAST>(); } else { @@ -2174,7 +2174,7 @@ bool Parser::parseEnumerator( EnumeratorAST::Node& node ) EnumeratorAST::Node ena = CreateNode<EnumeratorAST>(); - node = ena; + node = std::move(ena); AST::Node id = CreateNode<AST>(); UPDATE_POS( id, start, lex->index() ); @@ -2219,7 +2219,7 @@ bool Parser::parseInitDeclarator( InitDeclaratorAST::Node& node ) ast->setDeclarator( decl ); ast->setInitializer( init ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2255,7 +2255,7 @@ bool Parser::parseBaseClause( BaseClauseAST::Node& node ) return false; UPDATE_POS( bca, start, lex->index() ); - node = bca; + node = std::move(bca); return true; } @@ -2346,7 +2346,7 @@ bool Parser::parseTypeIdList( GroupAST::Node& node ) } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2383,7 +2383,7 @@ bool Parser::parseBaseSpecifier( BaseSpecifierAST::Node& node ) ast->setAccess( access ); ast->setName( name ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2491,7 +2491,7 @@ bool Parser::parseUnqualifiedName( ClassOrNamespaceNameAST::Node& node ) } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2526,7 +2526,7 @@ bool Parser::skipExpressionStatement( StatementAST::Node& node ) ExpressionStatementAST::Node ast = CreateNode<ExpressionStatementAST>(); ast->setExpression( expr ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2620,7 +2620,7 @@ bool Parser::parseCondition( ConditionAST::Node& node ) ast->setExpression( expr ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2629,7 +2629,7 @@ bool Parser::parseCondition( ConditionAST::Node& node ) ast->setDeclarator( decl ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2644,7 +2644,7 @@ bool Parser::parseCondition( ConditionAST::Node& node ) ast->setExpression( expr ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2673,7 +2673,7 @@ bool Parser::parseWhileStatement( StatementAST::Node& node ) ast->setCondition( cond ); ast->setStatement( body ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2707,7 +2707,7 @@ bool Parser::parseDoStatement( StatementAST::Node& node ) ast->setStatement( body ); //ast->setCondition( condition ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2743,7 +2743,7 @@ bool Parser::parseForStatement( StatementAST::Node& node ) // ast->setExpression( expression ); ast->setStatement( body ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2768,7 +2768,7 @@ bool Parser::parseForEachStatement( StatementAST::Node& node ) // add here the parser results ast->setStatement( body ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2819,7 +2819,7 @@ bool Parser::parseCompoundStatement( StatementAST::Node& node ) } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2861,7 +2861,7 @@ bool Parser::parseIfStatement( StatementAST::Node& node ) } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2891,7 +2891,7 @@ bool Parser::parseSwitchStatement( StatementAST::Node& node ) ast->setCondition( cond ); ast->setStatement( stmt ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2908,7 +2908,7 @@ bool Parser::parseLabeledStatement( StatementAST::Node& node ) StatementAST::Node stmt; if( parseStatement(stmt) ){ - node = stmt; + node = std::move(stmt); return true; } } @@ -2932,7 +2932,7 @@ bool Parser::parseLabeledStatement( StatementAST::Node& node ) StatementAST::Node stmt; if( parseStatement(stmt) ){ - node = stmt; + node = std::move(stmt); return true; } } @@ -2989,7 +2989,7 @@ bool Parser::parseBlockDeclaration( DeclarationAST::Node& node ) ast->setTypeSpec( spec ); ast->setInitDeclaratorList( declarators ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -3029,7 +3029,7 @@ bool Parser::parseDeclarationStatement( StatementAST::Node& node ) DeclarationStatementAST::Node ast = CreateNode<DeclarationStatementAST>(); ast->setDeclaration( decl ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); ////kdDebug(9007)<< "---------------------> found a block declaration" << endl; return true; @@ -3093,7 +3093,7 @@ bool Parser::parseDeclarationInternal( DeclarationAST::Node& node ) SimpleDeclarationAST::Node ast = CreateNode<SimpleDeclarationAST>(); ast->setInitDeclaratorList( declarators ); ast->setText( toString(start, endSignature) ); - node = ast; + node = std::move(ast); UPDATE_POS( node, start, lex->index() ); return true; @@ -3111,7 +3111,7 @@ bool Parser::parseDeclarationInternal( DeclarationAST::Node& node ) ast->setInitDeclarator( declarator ); ast->setFunctionBody( funBody ); ast->setText( toString(start, endSignature) ); - node = ast; + node = std::move(ast); UPDATE_POS( node, start, lex->index() ); return true; } @@ -3128,7 +3128,7 @@ bool Parser::parseDeclarationInternal( DeclarationAST::Node& node ) ast->setInitDeclarator( declarator ); ast->setText( toString(start, endSignature) ); ast->setFunctionBody( funBody ); - node = ast; + node = std::move(ast); UPDATE_POS( node, start, lex->index() ); return true; } @@ -3158,7 +3158,7 @@ start_decl: if( parseInitDeclaratorList(declarators) ){ ADVANCE( ';', ";" ); DeclarationAST::Node ast = CreateNode<DeclarationAST>(); - node = ast; + node = std::move(ast); UPDATE_POS( node, start, lex->index() ); return true; } @@ -3219,7 +3219,7 @@ start_decl: ast->setWinDeclSpec( winDeclSpec ); ast->setInitDeclaratorList( declarators ); - node = ast; + node = std::move(ast); UPDATE_POS( node, start, lex->index() ); } return true; @@ -3243,7 +3243,7 @@ start_decl: ast->setTypeSpec( spec ); ast->setFunctionBody( funBody ); ast->setInitDeclarator( decl ); - node = ast; + node = std::move(ast); UPDATE_POS( node, start, lex->index() ); return true; } @@ -3291,7 +3291,7 @@ bool Parser::parseFunctionBody( StatementListAST::Node& node ) nextToken(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -3379,7 +3379,7 @@ bool Parser::parseTryBlockStatement( StatementAST::Node& node ) ast->setStatement( stmt ); ast->setCatchStatementList( list ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -3905,7 +3905,7 @@ bool Parser::parseLogicalOrExpression( AST::Node& node, bool templArgs ) AST::Node ast = CreateNode<AST>(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -3950,7 +3950,7 @@ bool Parser::parseAssignmentExpression( AST::Node& node ) AST::Node ast = CreateNode<AST>(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -3961,7 +3961,7 @@ bool Parser::parseConstantExpression( AST::Node& node ) if( parseConditionalExpression(node) ){ AST::Node ast = CreateNode<AST>(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } return false; @@ -3978,7 +3978,7 @@ bool Parser::parseExpression( AST::Node& node ) AST::Node ast = CreateNode<AST>(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -4000,7 +4000,7 @@ bool Parser::parseCommaExpression( AST::Node& node ) AST::Node ast = CreateNode<AST>(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -4203,7 +4203,7 @@ bool Parser::parseIdentifierList( GroupAST::Node & node ) ADVANCE( Token_identifier, "identifier" ); } - node = ast; + node = std::move(ast); UPDATE_POS( node, start, lex->index() ); return true; } |