diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-12-09 13:15:23 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-12-09 13:15:23 +0000 |
commit | 0e9eabca263e8922bec0e2b38c8670eba9a39a1f (patch) | |
tree | 8f194e270e74bc3d0a746d77f7388980d2fa39d2 /lib/Parse/ParseDeclCXX.cpp | |
parent | b619d957b020744bb6bfdd1cef8169d8042df43e (diff) |
Consistently use smart pointers for stmt and expr nodes in parser local variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60761 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDeclCXX.cpp')
-rw-r--r-- | lib/Parse/ParseDeclCXX.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 78539abaad..ea7a5a103b 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -489,8 +489,8 @@ Parser::DeclTy *Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS) { // member-declarator-list ',' member-declarator DeclTy *LastDeclInGroup = 0; - ExprTy *BitfieldSize = 0; - ExprTy *Init = 0; + ExprOwner BitfieldSize(Actions); + ExprOwner Init(Actions); while (1) { @@ -501,11 +501,9 @@ Parser::DeclTy *Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS) { if (Tok.is(tok::colon)) { ConsumeToken(); - ExprResult Res = ParseConstantExpression(); - if (Res.isInvalid) + BitfieldSize = ParseConstantExpression(); + if (BitfieldSize.isInvalid()) SkipUntil(tok::comma, true, true); - else - BitfieldSize = Res.Val; } // pure-specifier: @@ -516,11 +514,9 @@ Parser::DeclTy *Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS) { if (Tok.is(tok::equal)) { ConsumeToken(); - ExprResult Res = ParseInitializer(); - if (Res.isInvalid) + Init = ParseInitializer(); + if (Init.isInvalid()) SkipUntil(tok::comma, true, true); - else - Init = Res.Val; } // If attributes exist after the declarator, parse them. @@ -533,7 +529,8 @@ Parser::DeclTy *Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS) { // See Sema::ActOnCXXMemberDeclarator for details. LastDeclInGroup = Actions.ActOnCXXMemberDeclarator(CurScope, AS, DeclaratorInfo, - BitfieldSize, Init, + BitfieldSize.move(), + Init.move(), LastDeclInGroup); // If we don't have a comma, it is either the end of the list (a ';') @@ -546,7 +543,8 @@ Parser::DeclTy *Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS) { // Parse the next declarator. DeclaratorInfo.clear(); - BitfieldSize = Init = 0; + BitfieldSize.reset(); + Init.reset(); // Attributes are only allowed on the second declarator. if (Tok.is(tok::kw___attribute)) |