diff options
| author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-12-13 15:32:12 +0000 |
|---|---|---|
| committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-12-13 15:32:12 +0000 |
| commit | cb6e2c615605d22f726029cba09a8c92c6638f8d (patch) | |
| tree | 3ac79bb361e3e10d0a7aa8ba2a5c195a29b4be7c /clang/include | |
| parent | 19ed30be382f63dee25884282438c98df70c20b1 (diff) | |
| download | bcm5719-llvm-cb6e2c615605d22f726029cba09a8c92c6638f8d.tar.gz bcm5719-llvm-cb6e2c615605d22f726029cba09a8c92c6638f8d.zip | |
Convert remaining expression parsers to smart pointers. Now on to the Action connection.
llvm-svn: 60982
Diffstat (limited to 'clang/include')
| -rw-r--r-- | clang/include/clang/Parse/Ownership.h | 12 | ||||
| -rw-r--r-- | clang/include/clang/Parse/Parser.h | 37 |
2 files changed, 31 insertions, 18 deletions
diff --git a/clang/include/clang/Parse/Ownership.h b/clang/include/clang/Parse/Ownership.h index 8c7324f27c0..e6cf4a2ebf8 100644 --- a/clang/include/clang/Parse/Ownership.h +++ b/clang/include/clang/Parse/Ownership.h @@ -400,6 +400,18 @@ namespace clang ASTMultiPtr<Destroyer> move(ASTMultiPtr<Destroyer> &ptr) { return ASTMultiPtr<Destroyer>(moving::ASTMultiMover<Destroyer>(ptr)); } + + // A shortcoming of the move emulation is that Ptr = move(Result) doesn't work + + template <ASTDestroyer Destroyer> inline + ASTOwningResult<Destroyer> move_convert(ASTOwningPtr<Destroyer> &ptr) { + return ASTOwningResult<Destroyer>(moving::ASTPtrMover<Destroyer>(ptr)); + } + + template <ASTDestroyer Destroyer> inline + ASTOwningPtr<Destroyer> move_convert(ASTOwningResult<Destroyer> &ptr) { + return ASTOwningPtr<Destroyer>(moving::ASTResultMover<Destroyer>(ptr)); + } } #endif diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h index fafaac59543..d6a3efdd5ef 100644 --- a/clang/include/clang/Parse/Parser.h +++ b/clang/include/clang/Parse/Parser.h @@ -87,6 +87,8 @@ public: typedef Action::OwningExprResult OwningExprResult; typedef Action::OwningStmtResult OwningStmtResult; + typedef Action::ExprArg ExprArg; + /// Adorns a ExprResult with Actions to make it an OwningExprResult OwningExprResult Owned(ExprResult res) { return OwningExprResult(Actions, res); @@ -594,11 +596,11 @@ private: OwningExprResult ParseBraceInitializer(); OwningExprResult ParseInitializerWithPotentialDesignator( InitListDesignations &D, unsigned InitNum); - + //===--------------------------------------------------------------------===// // clang Expressions - - ExprResult ParseBlockLiteralExpression(); // ^{...} + + OwningExprResult ParseBlockLiteralExpression(); // ^{...} //===--------------------------------------------------------------------===// // Objective-C Expressions @@ -612,21 +614,20 @@ private: return Tok.getIdentifierInfo() == Ident_super; } - - ExprResult ParseObjCAtExpression(SourceLocation AtLocation); - ExprResult ParseObjCStringLiteral(SourceLocation AtLoc); - ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc); - ExprResult ParseObjCSelectorExpression(SourceLocation AtLoc); - ExprResult ParseObjCProtocolExpression(SourceLocation AtLoc); - ExprResult ParseObjCMessageExpression(); - ExprResult ParseObjCMessageExpressionBody(SourceLocation LBracloc, - SourceLocation NameLoc, - IdentifierInfo *ReceiverName, - ExprTy *ReceiverExpr); - ExprResult ParseAssignmentExprWithObjCMessageExprStart(SourceLocation LBracloc, - SourceLocation NameLoc, - IdentifierInfo *ReceiverName, - ExprTy *ReceiverExpr); + + OwningExprResult ParseObjCAtExpression(SourceLocation AtLocation); + OwningExprResult ParseObjCStringLiteral(SourceLocation AtLoc); + OwningExprResult ParseObjCEncodeExpression(SourceLocation AtLoc); + OwningExprResult ParseObjCSelectorExpression(SourceLocation AtLoc); + OwningExprResult ParseObjCProtocolExpression(SourceLocation AtLoc); + OwningExprResult ParseObjCMessageExpression(); + OwningExprResult ParseObjCMessageExpressionBody(SourceLocation LBracloc, + SourceLocation NameLoc, + IdentifierInfo *ReceiverName, + ExprArg ReceiverExpr); + OwningExprResult ParseAssignmentExprWithObjCMessageExprStart( + SourceLocation LBracloc, SourceLocation NameLoc, + IdentifierInfo *ReceiverName, ExprArg ReceiverExpr); //===--------------------------------------------------------------------===// // C99 6.8: Statements and Blocks. |

