summaryrefslogtreecommitdiffstats
path: root/lib/cppparser/parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cppparser/parser.cpp')
-rw-r--r--lib/cppparser/parser.cpp152
1 files changed, 76 insertions, 76 deletions
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;
}