diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-12-10 00:02:53 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-12-10 00:02:53 +0000 |
commit | effa8d1c97b00a3f53e972b0e61d9aade5ea1c57 (patch) | |
tree | 841987d02feb0d8e50485212e3580660c5c1847e /lib/Parse/ParseDecl.cpp | |
parent | 1d6c14bd27ee4945aa453ab2e8d2b3dfca374318 (diff) |
Modify the move emulation according to the excellent design of Howard Hinnant. Makes for much nicer syntax when smart pointers are used consistently. Also, start converting internal argument passing of Parser to smart pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60809 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 242c1b3c6f..e7f4fc92ea 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -132,7 +132,7 @@ AttributeList *Parser::ParseAttributes() { SkipUntil(tok::r_paren); break; } else { - ArgExprs.push_back(ArgExpr.move()); + ArgExprs.push_back(ArgExpr.release()); } if (Tok.isNot(tok::comma)) break; @@ -164,7 +164,7 @@ AttributeList *Parser::ParseAttributes() { SkipUntil(tok::r_paren); break; } else { - ArgExprs.push_back(ArgExpr.move()); + ArgExprs.push_back(ArgExpr.release()); } if (Tok.isNot(tok::comma)) break; @@ -270,13 +270,13 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) { while (1) { // If a simple-asm-expr is present, parse it. if (Tok.is(tok::kw_asm)) { - OwningExprResult AsmLabel(Actions, ParseSimpleAsm()); + OwningExprResult AsmLabel(ParseSimpleAsm()); if (AsmLabel.isInvalid()) { SkipUntil(tok::semi); return 0; } - D.setAsmLabel(AsmLabel.move()); + D.setAsmLabel(AsmLabel.release()); } // If attributes are present, parse them. @@ -294,7 +294,7 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) { SkipUntil(tok::semi); return 0; } - Actions.AddInitializerToDecl(LastDeclInGroup, Init.move()); + Actions.AddInitializerToDecl(LastDeclInGroup, Init.release()); } else if (Tok.is(tok::l_paren)) { // Parse C++ direct initializer: '(' expression-list ')' SourceLocation LParenLoc = ConsumeParen(); @@ -846,7 +846,7 @@ ParseStructDeclaration(DeclSpec &DS, if (Res.isInvalid()) SkipUntil(tok::semi, true, true); else - DeclaratorInfo.BitfieldSize = Res.move(); + DeclaratorInfo.BitfieldSize = Res.release(); } // If attributes exist after the declarator, parse them. @@ -1087,7 +1087,7 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, DeclTy *EnumDecl) { LastEnumConstDecl, IdentLoc, Ident, EqualLoc, - AssignedVal.move()); + AssignedVal.release()); EnumConstantDecls.push_back(EnumConstDecl); LastEnumConstDecl = EnumConstDecl; @@ -1802,7 +1802,7 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, } else { // Inform the actions module about the default argument Actions.ActOnParamDefaultArgument(Param, EqualLoc, - DefArgResult.move()); + DefArgResult.release()); } } @@ -1973,7 +1973,7 @@ void Parser::ParseBracketDeclarator(Declarator &D) { // Remember that we parsed a pointer type, and remember the type-quals. D.AddTypeInfo(DeclaratorChunk::getArray(DS.getTypeQualifiers(), StaticLoc.isValid(), isStar, - NumElements.move(), StartLoc)); + NumElements.release(), StartLoc)); } /// [GNU] typeof-specifier: @@ -2000,7 +2000,7 @@ void Parser::ParseTypeofSpecifier(DeclSpec &DS) { const char *PrevSpec = 0; // Check for duplicate type specifiers. if (DS.SetTypeSpecType(DeclSpec::TST_typeofExpr, StartLoc, PrevSpec, - Result.move())) + Result.release())) Diag(StartLoc, diag::err_invalid_decl_spec_combination) << PrevSpec; // FIXME: Not accurate, the range gets one token more than it should. @@ -2035,7 +2035,7 @@ void Parser::ParseTypeofSpecifier(DeclSpec &DS) { const char *PrevSpec = 0; // Check for duplicate type specifiers (e.g. "int typeof(int)"). if (DS.SetTypeSpecType(DeclSpec::TST_typeofExpr, StartLoc, PrevSpec, - Result.move())) + Result.release())) Diag(StartLoc, diag::err_invalid_decl_spec_combination) << PrevSpec; } DS.SetRangeEnd(RParenLoc); |