diff options
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. |

