From a120985048e7e9e5c745b97c561c9a1ae531ec03 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 23 Jan 2024 12:14:55 +0900 Subject: [PATCH] Replace auto_ptr Signed-off-by: Michele Calgaro --- kbabel/kbabel/kbcataloglistviewitem.cpp | 8 +- kbabel/kbabel/kbcataloglistviewitem.h | 4 +- .../umbrello/codeimport/kdevcppparser/ast.cpp | 372 +++++++++--------- .../umbrello/codeimport/kdevcppparser/ast.h | 96 ++--- .../codeimport/kdevcppparser/parser.cpp | 148 +++---- 5 files changed, 314 insertions(+), 314 deletions(-) diff --git a/kbabel/kbabel/kbcataloglistviewitem.cpp b/kbabel/kbabel/kbcataloglistviewitem.cpp index 5507e9db..361b967c 100644 --- a/kbabel/kbabel/kbcataloglistviewitem.cpp +++ b/kbabel/kbabel/kbcataloglistviewitem.cpp @@ -80,8 +80,8 @@ void KBCatalogListViewItem::setup() widthChanged(); - m_doc_msgid.reset(0); - m_doc_msgstr.reset(0); + m_doc_msgid.reset(); + m_doc_msgstr.reset(); makeDocAvailable(); @@ -170,7 +170,7 @@ void KBCatalogListViewItem::paintMsgStrCell(TQPainter* p, const TQColorGroup& cg void KBCatalogListViewItem::paintCell(TQPainter* p, const TQColorGroup& cg, int column, int width, int align) { - assert(m_doc_msgid.get() && m_doc_msgstr.get() && p); + assert(m_doc_msgid && m_doc_msgstr && p); // paint background (empty text) @@ -191,7 +191,7 @@ void KBCatalogListViewItem::paintCell(TQPainter* p, const TQColorGroup& cg, void KBCatalogListViewItem::makeDocAvailable() { - if (m_doc_msgid.get() && m_doc_msgstr.get()) + if (m_doc_msgid && m_doc_msgstr) return; assert(listView()); diff --git a/kbabel/kbabel/kbcataloglistviewitem.h b/kbabel/kbabel/kbcataloglistviewitem.h index 6384360f..a29ca9ba 100644 --- a/kbabel/kbabel/kbcataloglistviewitem.h +++ b/kbabel/kbabel/kbcataloglistviewitem.h @@ -65,8 +65,8 @@ private: TQString m_msgid; TQString m_msgstr; - std::auto_ptr m_doc_msgid; - std::auto_ptr m_doc_msgstr; + std::unique_ptr m_doc_msgid; + std::unique_ptr m_doc_msgstr; }; #endif diff --git a/umbrello/umbrello/codeimport/kdevcppparser/ast.cpp b/umbrello/umbrello/codeimport/kdevcppparser/ast.cpp index c10e6da6..dd8c9ba8 100644 --- a/umbrello/umbrello/codeimport/kdevcppparser/ast.cpp +++ b/umbrello/umbrello/codeimport/kdevcppparser/ast.cpp @@ -211,13 +211,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 ); @@ -226,7 +226,7 @@ void NameAST::addClassOrNamespaceName( ClassOrNamespaceNameAST::Node& classOrNam TQString NameAST::text() const { - if( !m_unqualifiedName.get() ) + if( !m_unqualifiedName ) return TQString(); TQString str; @@ -241,7 +241,7 @@ TQString NameAST::text() const ++it; } - if( m_unqualifiedName.get() ) + if( m_unqualifiedName ) str += m_unqualifiedName->text(); return str; @@ -260,7 +260,7 @@ LinkageBodyAST::LinkageBodyAST() void LinkageBodyAST::addDeclaration( DeclarationAST::Node& ast ) { - if( !ast.get() ) + if( !ast ) return; ast->setParent( this ); @@ -274,20 +274,20 @@ 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 ); } // ------------------------------------------------------------------------ @@ -299,7 +299,7 @@ TranslationUnitAST::TranslationUnitAST() void TranslationUnitAST::addDeclaration( DeclarationAST::Node& ast ) { - if( !ast.get() ) + if( !ast ) return; ast->setParent( this ); @@ -313,14 +313,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 ); } @@ -331,14 +331,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 ); } // ------------------------------------------------------------------------ @@ -348,14 +348,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 ); } // ------------------------------------------------------------------------ @@ -365,8 +365,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() @@ -375,20 +375,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 ); } // ------------------------------------------------------------------------ @@ -399,7 +399,7 @@ TemplateArgumentListAST::TemplateArgumentListAST() void TemplateArgumentListAST::addArgument( AST::Node& arg ) { - if( !arg.get() ) + if( !arg ) return; arg->setParent( this ); @@ -426,20 +426,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 ); } // ------------------------------------------------------------------------ @@ -449,23 +449,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; @@ -478,27 +478,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; @@ -512,13 +512,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 ); @@ -527,8 +527,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 ); } // ------------------------------------------------------------------------ @@ -539,7 +539,7 @@ EnumSpecifierAST::EnumSpecifierAST() void EnumSpecifierAST::addEnumerator( EnumeratorAST::Node& enumerator ) { - if( !enumerator.get() ) + if( !enumerator ) return; enumerator->setParent( this ); @@ -554,13 +554,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(); @@ -578,14 +578,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 ); } // ------------------------------------------------------------------------ @@ -596,7 +596,7 @@ BaseClauseAST::BaseClauseAST() void BaseClauseAST::addBaseSpecifier( BaseSpecifierAST::Node& baseSpecifier ) { - if( !baseSpecifier.get() ) + if( !baseSpecifier ) return; baseSpecifier->setParent( this ); @@ -610,20 +610,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 ); } // ------------------------------------------------------------------------ @@ -633,32 +633,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 ); } @@ -670,7 +670,7 @@ InitDeclaratorListAST::InitDeclaratorListAST() void InitDeclaratorListAST::addInitDeclarator( InitDeclaratorAST::Node& decl ) { - if( !decl.get() ) + if( !decl ) return; decl->setParent( this ); @@ -686,52 +686,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( std::auto_ptr& parameterDeclarationClause ) +void DeclaratorAST::setParameterDeclarationClause( std::unique_ptr& 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 ); @@ -745,14 +745,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 ); } // -------------------------------------------------------------------------- @@ -762,38 +762,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 ); } // -------------------------------------------------------------------------- @@ -804,7 +804,7 @@ StatementListAST::StatementListAST() void StatementListAST::addStatement( StatementAST::Node& statement ) { - if( !statement.get() ) + if( !statement ) return; statement->setParent( this ); @@ -818,20 +818,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 ); } // -------------------------------------------------------------------------- @@ -841,14 +841,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 ); } // -------------------------------------------------------------------------- @@ -858,14 +858,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 ); } // -------------------------------------------------------------------------- @@ -875,26 +875,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 ); } // -------------------------------------------------------------------------- @@ -904,14 +904,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 ); } // -------------------------------------------------------------------------- @@ -921,8 +921,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 ); } // -------------------------------------------------------------------------- @@ -932,8 +932,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 ); } @@ -944,32 +944,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; @@ -983,7 +983,7 @@ ParameterDeclarationListAST::ParameterDeclarationListAST() void ParameterDeclarationListAST::addParameter( ParameterDeclarationAST::Node& parameter ) { - if( !parameter.get() ) + if( !parameter ) return; parameter->setParent( this ); @@ -1011,24 +1011,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; @@ -1043,7 +1043,7 @@ GroupAST::GroupAST() void GroupAST::addNode( AST::Node& node ) { - if( !node.get() ) + if( !node ) return; node->setParent( this ); @@ -1071,7 +1071,7 @@ AccessDeclarationAST::AccessDeclarationAST() void AccessDeclarationAST::addAccess( AST::Node& access ) { - if( !access.get() ) + if( !access ) return; access->setParent( this ); @@ -1098,26 +1098,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( std::auto_ptr& templateParameterList ) +void TypeParameterAST::setTemplateParameterList( std::unique_ptr& 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 ); } // -------------------------------------------------------------------------- @@ -1127,14 +1127,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 ); } // -------------------------------------------------------------------------- @@ -1145,7 +1145,7 @@ TemplateParameterListAST::TemplateParameterListAST() void TemplateParameterListAST::addTemplateParameter( TemplateParameterAST::Node& templateParameter ) { - if( !templateParameter.get() ) + if( !templateParameter ) return; templateParameter->setParent( this ); @@ -1159,25 +1159,25 @@ 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/umbrello/umbrello/codeimport/kdevcppparser/ast.h b/umbrello/umbrello/codeimport/kdevcppparser/ast.h index 103276d5..d98044ef 100644 --- a/umbrello/umbrello/codeimport/kdevcppparser/ast.h +++ b/umbrello/umbrello/codeimport/kdevcppparser/ast.h @@ -124,7 +124,7 @@ struct Slice class AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type=NodeType_Generic }; DECLARE_ALLOC( AST ) @@ -192,7 +192,7 @@ private: class GroupAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_Group }; DECLARE_ALLOC( GroupAST ) @@ -217,7 +217,7 @@ private: class TemplateArgumentListAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_TemplateArgumentList }; DECLARE_ALLOC( TemplateArgumentListAST ) @@ -241,7 +241,7 @@ private: class ClassOrNamespaceNameAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_ClassOrNamespaceName }; DECLARE_ALLOC( ClassOrNamespaceNameAST ) @@ -269,7 +269,7 @@ private: class NameAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_Name }; DECLARE_ALLOC( NameAST ) @@ -301,7 +301,7 @@ private: class TypeParameterAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_TypeParameter }; DECLARE_ALLOC( TypeParameterAST ) @@ -313,7 +313,7 @@ public: void setKind( AST::Node& kind ); class TemplateParameterListAST* templateParameterList() { return m_templateParameterList.get(); } - void setTemplateParameterList( std::auto_ptr& templateParameterList ); + void setTemplateParameterList( std::unique_ptr& templateParameterList ); NameAST* name() { return m_name.get(); } void setName( NameAST::Node& name ); @@ -323,7 +323,7 @@ public: private: AST::Node m_kind; - std::auto_ptr m_templateParameterList; + std::unique_ptr m_templateParameterList; NameAST::Node m_name; AST::Node m_typeId; @@ -335,7 +335,7 @@ private: class DeclarationAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_Declaration }; DECLARE_ALLOC( DeclarationAST ) @@ -351,7 +351,7 @@ private: class AccessDeclarationAST: public DeclarationAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_AccessDeclaration }; DECLARE_ALLOC( AccessDeclarationAST ) @@ -375,7 +375,7 @@ private: class TypeSpecifierAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_TypeSpecifier }; DECLARE_ALLOC( TypeSpecifierAST ) @@ -407,7 +407,7 @@ private: class BaseSpecifierAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_BaseSpecifier }; DECLARE_ALLOC( BaseSpecifierAST ) @@ -437,7 +437,7 @@ private: class BaseClauseAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_BaseClause }; DECLARE_ALLOC( BaseClauseAST ) @@ -459,7 +459,7 @@ private: class ClassSpecifierAST: public TypeSpecifierAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_ClassSpecifier }; DECLARE_ALLOC( ClassSpecifierAST ) @@ -493,7 +493,7 @@ private: class EnumeratorAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_Enumerator }; DECLARE_ALLOC( EnumeratorAST ) @@ -519,7 +519,7 @@ private: class EnumSpecifierAST: public TypeSpecifierAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_EnumSpecifier }; DECLARE_ALLOC( EnumSpecifierAST ) @@ -541,7 +541,7 @@ private: class ElaboratedTypeSpecifierAST: public TypeSpecifierAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_ElaboratedTypeSpecifier }; DECLARE_ALLOC( ElaboratedTypeSpecifierAST ) @@ -566,7 +566,7 @@ private: class LinkageBodyAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_LinkageBody }; DECLARE_ALLOC( LinkageBodyAST ) @@ -588,7 +588,7 @@ private: class LinkageSpecificationAST: public DeclarationAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_LinkageSpecification }; DECLARE_ALLOC( LinkageSpecificationAST ) @@ -618,7 +618,7 @@ private: class NamespaceAST: public DeclarationAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_Namespace }; DECLARE_ALLOC( NamespaceAST ) @@ -644,7 +644,7 @@ private: class NamespaceAliasAST: public DeclarationAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_NamespaceAlias }; DECLARE_ALLOC( NamespaceAliasAST ) @@ -670,7 +670,7 @@ private: class UsingAST: public DeclarationAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_Using }; DECLARE_ALLOC( UsingAST ) @@ -696,7 +696,7 @@ private: class UsingDirectiveAST: public DeclarationAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_UsingDirective }; DECLARE_ALLOC( UsingDirectiveAST ) @@ -718,7 +718,7 @@ private: class DeclaratorAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_Declarator }; DECLARE_ALLOC( DeclaratorAST ) @@ -742,7 +742,7 @@ public: void addArrayDimension( AST::Node& arrayDimension ); class ParameterDeclarationClauseAST* parameterDeclarationClause() { return m_parameterDeclarationClause.get(); } - void setParameterDeclarationClause( std::auto_ptr& parameterDeclarationClause ); + void setParameterDeclarationClause( std::unique_ptr& parameterDeclarationClause ); // ### replace 'constant' with cvQualify AST* constant() { return m_constant.get(); } @@ -757,7 +757,7 @@ private: NameAST::Node m_declaratorId; AST::Node m_bitfieldInitialization; TQPtrList m_arrayDimensionList; - std::auto_ptr m_parameterDeclarationClause; + std::unique_ptr m_parameterDeclarationClause; AST::Node m_constant; GroupAST::Node m_exceptionSpecification; @@ -769,7 +769,7 @@ private: class ParameterDeclarationAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_ParameterDeclaration }; DECLARE_ALLOC( ParameterDeclarationAST ) @@ -801,7 +801,7 @@ private: class ParameterDeclarationListAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_ParameterDeclarationList }; DECLARE_ALLOC( ParameterDeclarationListAST ) @@ -825,7 +825,7 @@ private: class ParameterDeclarationClauseAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_ParameterDeclarationClause }; DECLARE_ALLOC( ParameterDeclarationClauseAST ) @@ -854,7 +854,7 @@ private: class InitDeclaratorAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_InitDeclarator }; DECLARE_ALLOC( InitDeclaratorAST ) @@ -880,7 +880,7 @@ private: class InitDeclaratorListAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_InitDeclaratorList }; DECLARE_ALLOC( InitDeclaratorListAST ) @@ -902,7 +902,7 @@ private: class TypedefAST: public DeclarationAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_Typedef }; DECLARE_ALLOC( TypedefAST ) @@ -928,7 +928,7 @@ private: class TemplateParameterAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_TemplateParameter }; DECLARE_ALLOC( TemplateParameterAST ) @@ -954,7 +954,7 @@ private: class TemplateParameterListAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_TemplateParameterList }; DECLARE_ALLOC( TemplateParameterListAST ) @@ -976,7 +976,7 @@ private: class TemplateDeclarationAST: public DeclarationAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_TemplateDeclaration }; DECLARE_ALLOC( TemplateDeclarationAST ) @@ -1006,7 +1006,7 @@ private: class SimpleDeclarationAST: public DeclarationAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_SimpleDeclaration }; DECLARE_ALLOC( SimpleDeclarationAST ) @@ -1044,7 +1044,7 @@ private: class StatementAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_Statement }; DECLARE_ALLOC( StatementAST ) @@ -1060,7 +1060,7 @@ private: class ExpressionStatementAST: public StatementAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_ExpressionStatement }; DECLARE_ALLOC( ExpressionStatementAST ) @@ -1082,7 +1082,7 @@ private: class ConditionAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_Condition }; DECLARE_ALLOC( ConditionAST ) @@ -1112,7 +1112,7 @@ private: class IfStatementAST: public StatementAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_IfStatement }; DECLARE_ALLOC( IfStatementAST ) @@ -1142,7 +1142,7 @@ private: class WhileStatementAST: public StatementAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_WhileStatement }; DECLARE_ALLOC( WhileStatementAST ) @@ -1168,7 +1168,7 @@ private: class DoStatementAST: public StatementAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_DoStatement }; DECLARE_ALLOC( DoStatementAST ) @@ -1194,7 +1194,7 @@ private: class ForStatementAST: public StatementAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_ForStatement }; DECLARE_ALLOC( ForStatementAST ) @@ -1228,7 +1228,7 @@ private: class SwitchStatementAST: public StatementAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_SwitchStatement }; DECLARE_ALLOC( SwitchStatementAST ) @@ -1254,7 +1254,7 @@ private: class StatementListAST: public StatementAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_StatementList }; DECLARE_ALLOC( StatementListAST ) @@ -1276,7 +1276,7 @@ private: class DeclarationStatementAST: public StatementAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_DeclarationStatement }; DECLARE_ALLOC( DeclarationStatementAST ) @@ -1298,7 +1298,7 @@ private: class FunctionDefinitionAST: public DeclarationAST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_FunctionDefinition }; DECLARE_ALLOC( FunctionDefinitionAST ) @@ -1341,7 +1341,7 @@ private: class TranslationUnitAST: public AST { public: - typedef std::auto_ptr Node; + typedef std::unique_ptr Node; enum { Type = NodeType_TranslationUnit }; DECLARE_ALLOC( TranslationUnitAST ) diff --git a/umbrello/umbrello/codeimport/kdevcppparser/parser.cpp b/umbrello/umbrello/codeimport/kdevcppparser/parser.cpp index adc729e9..f5748859 100644 --- a/umbrello/umbrello/codeimport/kdevcppparser/parser.cpp +++ b/umbrello/umbrello/codeimport/kdevcppparser/parser.cpp @@ -327,7 +327,7 @@ bool Parser::skipCommaExpression( AST::Node& node ) AST::Node ast = CreateNode(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -379,7 +379,7 @@ bool Parser::skipExpression( AST::Node& node ) { AST::Node ast = CreateNode(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); } return true; @@ -430,7 +430,7 @@ bool Parser::parseName( NameAST::Node& node ) return false; UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -443,7 +443,7 @@ bool Parser::parseTranslationUnit( TranslationUnitAST::Node& node ) m_problems = 0; TranslationUnitAST::Node tun = CreateNode(); - node = tun; + node = std::move(tun); while( !lex->lookAhead(0).isNull() ){ DeclarationAST::Node def; int startDecl = lex->index(); @@ -548,7 +548,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; } @@ -602,7 +602,7 @@ bool Parser::parseLinkageSpecification( DeclarationAST::Node& node ) UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -619,7 +619,7 @@ bool Parser::parseLinkageBody( LinkageBodyAST::Node& node ) lex->nextToken(); LinkageBodyAST::Node lba = CreateNode(); - node = lba; + node = std::move(lba); while( !lex->lookAhead(0).isNull() ){ int tk = lex->lookAhead( 0 ); @@ -678,7 +678,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") ); @@ -697,7 +697,7 @@ bool Parser::parseNamespace( DeclarationAST::Node& node ) ast->setLinkageBody( linkageBody ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -740,7 +740,7 @@ bool Parser::parseUsing( DeclarationAST::Node& node ) ADVANCE( ';', ";" ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -767,7 +767,7 @@ bool Parser::parseUsingDirective( DeclarationAST::Node& node ) UsingDirectiveAST::Node ast = CreateNode(); ast->setName( name ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -787,7 +787,7 @@ bool Parser::parseOperatorFunctionId( AST::Node& node ) AST::Node op; if( parseOperator(op) ){ AST::Node asn = CreateNode(); - node = asn; + node = std::move(asn); UPDATE_POS( node, start, lex->index() ); return true; } else { @@ -811,7 +811,7 @@ bool Parser::parseOperatorFunctionId( AST::Node& node ) ; AST::Node asn = CreateNode(); - node = asn; + node = std::move(asn); UPDATE_POS( node, start, lex->index() ); return true; } @@ -848,7 +848,7 @@ bool Parser::parseTemplateArgumentList( TemplateArgumentListAST::Node& node, boo } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -882,7 +882,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; } @@ -916,7 +916,7 @@ bool Parser::parseTemplateDeclaration( DeclarationAST::Node& node ) lex->nextToken(); AST::Node n = CreateNode(); UPDATE_POS( n, startExport, lex->index() ); - exp = n; + exp = std::move(n); } if( lex->lookAhead(0) != Token_template ){ @@ -943,7 +943,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; } @@ -1037,7 +1037,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; } @@ -1094,7 +1094,7 @@ bool Parser::parseSimpleTypeSpecifier( TypeSpecifierAST::Node& node ) } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1122,7 +1122,7 @@ bool Parser::parsePtrOperator( AST::Node& node ) AST::Node ast = CreateNode(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1287,7 +1287,7 @@ bool Parser::parseDeclarator( DeclaratorAST::Node& node ) update_pos: UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1384,7 +1384,7 @@ bool Parser::parseAbstractDeclarator( DeclaratorAST::Node& node ) UPDATE_POS: UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1453,7 +1453,7 @@ bool Parser::parseEnumSpecifier( TypeSpecifierAST::Node& node ) lex->nextToken(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1488,7 +1488,7 @@ bool Parser::parseTemplateParameterList( TemplateParameterListAST::Node& node ) } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1516,7 +1516,7 @@ bool Parser::parseTemplateParameter( TemplateParameterAST::Node& node ) ok: UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1604,7 +1604,7 @@ bool Parser::parseTypeParameter( TypeParameterAST::Node& node ) UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1633,7 +1633,7 @@ bool Parser::parseStorageClassSpecifier( GroupAST::Node& node ) return false; UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1662,7 +1662,7 @@ bool Parser::parseFunctionSpecifier( GroupAST::Node& node ) return false; UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1683,7 +1683,7 @@ bool Parser::parseTypeId( AST::Node& node ) parseAbstractDeclarator( decl ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1718,7 +1718,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; } @@ -1757,7 +1757,7 @@ good: /// @todo add ellipsis UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1795,7 +1795,7 @@ bool Parser::parseParameterDeclarationList( ParameterDeclarationListAST::Node& n } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1838,7 +1838,7 @@ bool Parser::parseParameterDeclaration( ParameterDeclarationAST::Node& node ) ast->setExpression( expr ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1855,7 +1855,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(); - classKey = asn; + classKey = std::move(asn); lex->nextToken(); UPDATE_POS( classKey, classKeyStart, lex->index() ); } else { @@ -1916,7 +1916,7 @@ bool Parser::parseClassSpecifier( TypeSpecifierAST::Node& node ) lex->nextToken(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -1932,7 +1932,7 @@ bool Parser::parseAccessSpecifier( AST::Node& node ) case Token_protected: case Token_private: { AST::Node asn = CreateNode(); - node = asn; + node = std::move(asn); lex->nextToken(); UPDATE_POS( node, start, lex->index() ); return true; @@ -1991,7 +1991,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; @@ -2012,7 +2012,7 @@ bool Parser::parseMemberSpecification( DeclarationAST::Node& node ) } ADVANCE( ':', ":" ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2045,7 +2045,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; } @@ -2101,7 +2101,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; } @@ -2135,7 +2135,7 @@ bool Parser::parseExceptionSpecification( GroupAST::Node& node ) ast->addNode( ellipsis ); lex->nextToken(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); } else { parseTypeIdList( node ); } @@ -2164,7 +2164,7 @@ bool Parser::parseEnumerator( EnumeratorAST::Node& node ) lex->nextToken(); EnumeratorAST::Node ena = CreateNode(); - node = ena; + node = std::move(ena); AST::Node id = CreateNode(); UPDATE_POS( id, start, lex->index() ); @@ -2203,7 +2203,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; } @@ -2243,7 +2243,7 @@ bool Parser::parseBaseClause( BaseClauseAST::Node& node ) return false; UPDATE_POS( bca, start, lex->index() ); - node = bca; + node = std::move(bca); return true; } @@ -2340,7 +2340,7 @@ bool Parser::parseTypeIdList( GroupAST::Node& node ) } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2377,7 +2377,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; } @@ -2483,7 +2483,7 @@ bool Parser::parseUnqualifiedName( ClassOrNamespaceNameAST::Node& node ) } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2518,7 +2518,7 @@ bool Parser::skipExpressionStatement( StatementAST::Node& node ) ExpressionStatementAST::Node ast = CreateNode(); ast->setExpression( expr ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2608,7 +2608,7 @@ bool Parser::parseCondition( ConditionAST::Node& node ) ast->setExpression( expr ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2623,7 +2623,7 @@ bool Parser::parseCondition( ConditionAST::Node& node ) ast->setExpression( expr ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2653,7 +2653,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; } @@ -2687,7 +2687,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; } @@ -2724,7 +2724,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; } @@ -2773,7 +2773,7 @@ bool Parser::parseCompoundStatement( StatementAST::Node& node ) } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2817,7 +2817,7 @@ bool Parser::parseIfStatement( StatementAST::Node& node ) } UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -2847,7 +2847,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; } @@ -2864,7 +2864,7 @@ bool Parser::parseLabeledStatement( StatementAST::Node& node ) StatementAST::Node stmt; if( parseStatement(stmt) ){ - node = stmt; + node = std::move(stmt); return true; } } @@ -2888,7 +2888,7 @@ bool Parser::parseLabeledStatement( StatementAST::Node& node ) StatementAST::Node stmt; if( parseStatement(stmt) ){ - node = stmt; + node = std::move(stmt); return true; } } @@ -2945,7 +2945,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; } @@ -2985,7 +2985,7 @@ bool Parser::parseDeclarationStatement( StatementAST::Node& node ) DeclarationStatementAST::Node ast = CreateNode(); ast->setDeclaration( decl ); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); //kdDebug(9007)<< "---------------------> found a block declaration" << endl; return true; @@ -3049,7 +3049,7 @@ bool Parser::parseDeclarationInternal( DeclarationAST::Node& node, TQString& com SimpleDeclarationAST::Node ast = CreateNode(); ast->setInitDeclaratorList( declarators ); ast->setText( toString(start, endSignature) ); - node = ast; + node = std::move(ast); UPDATE_POS( node, start, lex->index() ); return true; @@ -3067,7 +3067,7 @@ bool Parser::parseDeclarationInternal( DeclarationAST::Node& node, TQString& com 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; } @@ -3084,7 +3084,7 @@ bool Parser::parseDeclarationInternal( DeclarationAST::Node& node, TQString& com 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; } @@ -3114,7 +3114,7 @@ start_decl: if( parseInitDeclaratorList(declarators) ){ ADVANCE( ';', ";" ); DeclarationAST::Node ast = CreateNode(); - node = ast; + node = std::move(ast); UPDATE_POS( node, start, lex->index() ); return true; } @@ -3159,7 +3159,7 @@ start_decl: ast->setTypeSpec( spec ); ast->setWinDeclSpec( winDeclSpec ); ast->setInitDeclaratorList( declarators ); - node = ast; + node = std::move(ast); UPDATE_POS( node, start, lex->index() ); } return true; @@ -3180,7 +3180,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; } @@ -3226,7 +3226,7 @@ bool Parser::parseFunctionBody( StatementListAST::Node& node ) lex->nextToken(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -3291,7 +3291,7 @@ bool Parser::parseTryBlockStatement( StatementAST::Node& node ) } } - node = stmt; + node = std::move(stmt); return true; } @@ -3816,7 +3816,7 @@ bool Parser::parseLogicalOrExpression( AST::Node& node, bool templArgs ) AST::Node ast = CreateNode(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -3861,7 +3861,7 @@ bool Parser::parseAssignmentExpression( AST::Node& node ) AST::Node ast = CreateNode(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -3872,7 +3872,7 @@ bool Parser::parseConstantExpression( AST::Node& node ) if( parseConditionalExpression(node) ){ AST::Node ast = CreateNode(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } return false; @@ -3889,7 +3889,7 @@ bool Parser::parseExpression( AST::Node& node ) AST::Node ast = CreateNode(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -3915,7 +3915,7 @@ bool Parser::parseCommaExpression( AST::Node& node ) AST::Node ast = CreateNode(); UPDATE_POS( ast, start, lex->index() ); - node = ast; + node = std::move(ast); return true; } @@ -4120,7 +4120,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; }