diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-11-25 22:21:31 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-11-25 22:21:31 +0000 |
commit | 511ed555245c79149ebe61a3a6f20d0350c7f9ad (patch) | |
tree | 55b8d1566dcd398ab0447419ba7fa21331fcb3e6 /clang/lib/Parse/ParseDeclCXX.cpp | |
parent | 474003763f1f54d37e875eb5ca2eb828bad32b98 (diff) | |
download | bcm5719-llvm-511ed555245c79149ebe61a3a6f20d0350c7f9ad.tar.gz bcm5719-llvm-511ed555245c79149ebe61a3a6f20d0350c7f9ad.zip |
Use RAII objects to ensure proper destruction of expression and statement AST nodes in the parser in most cases, even on error.
llvm-svn: 60057
Diffstat (limited to 'clang/lib/Parse/ParseDeclCXX.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 9e380c90369..a80e06002a3 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -15,6 +15,7 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Parse/DeclSpec.h" #include "clang/Parse/Scope.h" +#include "AstGuard.h" using namespace clang; /// ParseNamespace - We know that the current token is a namespace keyword. This @@ -377,8 +378,8 @@ Parser::BaseResult Parser::ParseBaseSpecifier(DeclTy *ClassDecl) // Notify semantic analysis that we have parsed a complete // base-specifier. - return Actions.ActOnBaseSpecifier(ClassDecl, Range, IsVirtual, Access, BaseType, - BaseLoc); + return Actions.ActOnBaseSpecifier(ClassDecl, Range, IsVirtual, Access, + BaseType, BaseLoc); } /// getAccessSpecifierIfPresent - Determine whether the next token is @@ -747,7 +748,7 @@ Parser::MemInitResult Parser::ParseMemInitializer(DeclTy *ConstructorDecl) { SourceLocation LParenLoc = ConsumeParen(); // Parse the optional expression-list. - ExprListTy ArgExprs; + ExprVector ArgExprs(Actions); CommaLocsTy CommaLocs; if (Tok.isNot(tok::r_paren) && ParseExpressionList(ArgExprs, CommaLocs)) { SkipUntil(tok::r_paren); @@ -756,9 +757,9 @@ Parser::MemInitResult Parser::ParseMemInitializer(DeclTy *ConstructorDecl) { SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc); - return Actions.ActOnMemInitializer(ConstructorDecl, CurScope, II, IdLoc, - LParenLoc, &ArgExprs[0], ArgExprs.size(), - &CommaLocs[0], RParenLoc); + return Actions.ActOnMemInitializer(ConstructorDecl, CurScope, II, IdLoc, + LParenLoc, ArgExprs.take(), + ArgExprs.size(), &CommaLocs[0], RParenLoc); } /// ParseExceptionSpecification - Parse a C++ exception-specification |