OwningExprResult -> ExprResult. This patch brought to you by

M-x query-replace-regexp
\(Sema::\|Action::\|Parser::\|\)Owning\(Expr\|Stmt\)Result -> \2Result

llvm-svn: 111903
This commit is contained in:
John McCall 2010-08-24 06:29:42 +00:00
parent e172be555d
commit dadc575b1e
32 changed files with 1109 additions and 1126 deletions

View File

@ -163,29 +163,26 @@ public:
typedef clang::MemInitResult MemInitResult;
typedef clang::TypeResult TypeResult;
typedef clang::OwningExprResult OwningExprResult;
typedef clang::OwningStmtResult OwningStmtResult;
typedef Expr *ExprArg;
typedef ASTMultiPtr<Stmt*> MultiStmtArg;
typedef Action::FullExprArg FullExprArg;
/// Adorns a ExprResult with Actions to make it an OwningExprResult
OwningExprResult Owned(ExprResult res) {
return OwningExprResult(res);
/// Adorns a ExprResult with Actions to make it an ExprResult
ExprResult Owned(ExprResult res) {
return ExprResult(res);
}
/// Adorns a StmtResult with Actions to make it an OwningStmtResult
OwningStmtResult Owned(StmtResult res) {
return OwningStmtResult(res);
/// Adorns a StmtResult with Actions to make it an StmtResult
StmtResult Owned(StmtResult res) {
return StmtResult(res);
}
OwningExprResult ExprError() { return OwningExprResult(true); }
OwningStmtResult StmtError() { return OwningStmtResult(true); }
ExprResult ExprError() { return ExprResult(true); }
StmtResult StmtError() { return StmtResult(true); }
OwningExprResult ExprError(const DiagnosticBuilder &) { return ExprError(); }
OwningStmtResult StmtError(const DiagnosticBuilder &) { return StmtError(); }
ExprResult ExprError(const DiagnosticBuilder &) { return ExprError(); }
StmtResult StmtError(const DiagnosticBuilder &) { return StmtError(); }
OwningExprResult ExprEmpty() { return OwningExprResult(false); }
ExprResult ExprEmpty() { return ExprResult(false); }
// Parsing methods.
@ -876,8 +873,8 @@ private:
void ParseKNRParamDeclarations(Declarator &D);
// EndLoc, if non-NULL, is filled with the location of the last token of
// the simple-asm.
OwningExprResult ParseSimpleAsm(SourceLocation *EndLoc = 0);
OwningExprResult ParseAsmStringLiteral();
ExprResult ParseSimpleAsm(SourceLocation *EndLoc = 0);
ExprResult ParseAsmStringLiteral();
// Objective-C External Declarations
Decl *ParseObjCAtDirectives();
@ -931,29 +928,29 @@ private:
//===--------------------------------------------------------------------===//
// C99 6.5: Expressions.
OwningExprResult ParseExpression();
OwningExprResult ParseConstantExpression();
ExprResult ParseExpression();
ExprResult ParseConstantExpression();
// Expr that doesn't include commas.
OwningExprResult ParseAssignmentExpression();
ExprResult ParseAssignmentExpression();
OwningExprResult ParseExpressionWithLeadingAt(SourceLocation AtLoc);
ExprResult ParseExpressionWithLeadingAt(SourceLocation AtLoc);
OwningExprResult ParseExpressionWithLeadingExtension(SourceLocation ExtLoc);
ExprResult ParseExpressionWithLeadingExtension(SourceLocation ExtLoc);
OwningExprResult ParseRHSOfBinaryExpression(OwningExprResult LHS,
ExprResult ParseRHSOfBinaryExpression(ExprResult LHS,
prec::Level MinPrec);
OwningExprResult ParseCastExpression(bool isUnaryExpression,
ExprResult ParseCastExpression(bool isUnaryExpression,
bool isAddressOfOperand,
bool &NotCastExpr,
ParsedType TypeOfCast);
OwningExprResult ParseCastExpression(bool isUnaryExpression,
ExprResult ParseCastExpression(bool isUnaryExpression,
bool isAddressOfOperand = false,
ParsedType TypeOfCast = ParsedType());
OwningExprResult ParsePostfixExpressionSuffix(OwningExprResult LHS);
OwningExprResult ParseSizeofAlignofExpression();
OwningExprResult ParseBuiltinPrimaryExpression();
ExprResult ParsePostfixExpressionSuffix(ExprResult LHS);
ExprResult ParseSizeofAlignofExpression();
ExprResult ParseBuiltinPrimaryExpression();
OwningExprResult ParseExprAfterTypeofSizeofAlignof(const Token &OpTok,
ExprResult ParseExprAfterTypeofSizeofAlignof(const Token &OpTok,
bool &isCastExpr,
ParsedType &CastTy,
SourceRange &CastRange);
@ -977,26 +974,26 @@ private:
CompoundLiteral, // Also allow '(' type-name ')' '{' ... '}'
CastExpr // Also allow '(' type-name ')' <anything>
};
OwningExprResult ParseParenExpression(ParenParseOption &ExprType,
ExprResult ParseParenExpression(ParenParseOption &ExprType,
bool stopIfCastExpr,
ParsedType TypeOfCast,
ParsedType &CastTy,
SourceLocation &RParenLoc);
OwningExprResult ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType,
ExprResult ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType,
ParsedType &CastTy,
SourceLocation LParenLoc,
SourceLocation &RParenLoc);
OwningExprResult ParseCompoundLiteralExpression(ParsedType Ty,
ExprResult ParseCompoundLiteralExpression(ParsedType Ty,
SourceLocation LParenLoc,
SourceLocation RParenLoc);
OwningExprResult ParseStringLiteralExpression();
ExprResult ParseStringLiteralExpression();
//===--------------------------------------------------------------------===//
// C++ Expressions
OwningExprResult ParseCXXIdExpression(bool isAddressOfOperand = false);
ExprResult ParseCXXIdExpression(bool isAddressOfOperand = false);
bool ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
ParsedType ObjectType,
@ -1005,26 +1002,26 @@ private:
//===--------------------------------------------------------------------===//
// C++ 5.2p1: C++ Casts
OwningExprResult ParseCXXCasts();
ExprResult ParseCXXCasts();
//===--------------------------------------------------------------------===//
// C++ 5.2p1: C++ Type Identification
OwningExprResult ParseCXXTypeid();
ExprResult ParseCXXTypeid();
//===--------------------------------------------------------------------===//
// C++ 5.2.4: C++ Pseudo-Destructor Expressions
OwningExprResult ParseCXXPseudoDestructor(ExprArg Base, SourceLocation OpLoc,
ExprResult ParseCXXPseudoDestructor(ExprArg Base, SourceLocation OpLoc,
tok::TokenKind OpKind,
CXXScopeSpec &SS,
ParsedType ObjectType);
//===--------------------------------------------------------------------===//
// C++ 9.3.2: C++ 'this' pointer
OwningExprResult ParseCXXThis();
ExprResult ParseCXXThis();
//===--------------------------------------------------------------------===//
// C++ 15: C++ Throw Expression
OwningExprResult ParseThrowExpression();
ExprResult ParseThrowExpression();
// EndLoc is filled with the location of the last token of the specification.
bool ParseExceptionSpecification(SourceLocation &EndLoc,
llvm::SmallVectorImpl<ParsedType> &Exns,
@ -1033,11 +1030,11 @@ private:
//===--------------------------------------------------------------------===//
// C++ 2.13.5: C++ Boolean Literals
OwningExprResult ParseCXXBoolLiteral();
ExprResult ParseCXXBoolLiteral();
//===--------------------------------------------------------------------===//
// C++ 5.2.3: Explicit type conversion (functional notation)
OwningExprResult ParseCXXTypeConstructExpression(const DeclSpec &DS);
ExprResult ParseCXXTypeConstructExpression(const DeclSpec &DS);
bool isCXXSimpleTypeSpecifier() const;
@ -1053,13 +1050,13 @@ private:
bool ParseExpressionListOrTypeId(llvm::SmallVectorImpl<Expr*> &Exprs,
Declarator &D);
void ParseDirectNewDeclarator(Declarator &D);
OwningExprResult ParseCXXNewExpression(bool UseGlobal, SourceLocation Start);
OwningExprResult ParseCXXDeleteExpression(bool UseGlobal,
ExprResult ParseCXXNewExpression(bool UseGlobal, SourceLocation Start);
ExprResult ParseCXXDeleteExpression(bool UseGlobal,
SourceLocation Start);
//===--------------------------------------------------------------------===//
// C++ if/switch/while condition expression.
bool ParseCXXCondition(OwningExprResult &ExprResult, Decl *&DeclResult,
bool ParseCXXCondition(ExprResult &ExprResult, Decl *&DeclResult,
SourceLocation Loc, bool ConvertToBoolean);
//===--------------------------------------------------------------------===//
@ -1072,33 +1069,33 @@ private:
/// initializer: [C99 6.7.8]
/// assignment-expression
/// '{' ...
OwningExprResult ParseInitializer() {
ExprResult ParseInitializer() {
if (Tok.isNot(tok::l_brace))
return ParseAssignmentExpression();
return ParseBraceInitializer();
}
OwningExprResult ParseBraceInitializer();
OwningExprResult ParseInitializerWithPotentialDesignator();
ExprResult ParseBraceInitializer();
ExprResult ParseInitializerWithPotentialDesignator();
//===--------------------------------------------------------------------===//
// clang Expressions
OwningExprResult ParseBlockLiteralExpression(); // ^{...}
ExprResult ParseBlockLiteralExpression(); // ^{...}
//===--------------------------------------------------------------------===//
// Objective-C Expressions
OwningExprResult ParseObjCAtExpression(SourceLocation AtLocation);
OwningExprResult ParseObjCStringLiteral(SourceLocation AtLoc);
OwningExprResult ParseObjCEncodeExpression(SourceLocation AtLoc);
OwningExprResult ParseObjCSelectorExpression(SourceLocation AtLoc);
OwningExprResult ParseObjCProtocolExpression(SourceLocation AtLoc);
ExprResult ParseObjCAtExpression(SourceLocation AtLocation);
ExprResult ParseObjCStringLiteral(SourceLocation AtLoc);
ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc);
ExprResult ParseObjCSelectorExpression(SourceLocation AtLoc);
ExprResult ParseObjCProtocolExpression(SourceLocation AtLoc);
bool isSimpleObjCMessageExpression();
OwningExprResult ParseObjCMessageExpression();
OwningExprResult ParseObjCMessageExpressionBody(SourceLocation LBracloc,
ExprResult ParseObjCMessageExpression();
ExprResult ParseObjCMessageExpressionBody(SourceLocation LBracloc,
SourceLocation SuperLoc,
ParsedType ReceiverType,
ExprArg ReceiverExpr);
OwningExprResult ParseAssignmentExprWithObjCMessageExprStart(
ExprResult ParseAssignmentExprWithObjCMessageExprStart(
SourceLocation LBracloc, SourceLocation SuperLoc,
ParsedType ReceiverType, ExprArg ReceiverExpr);
bool ParseObjCXXMessageReceiver(bool &IsExpr, void *&TypeOrExpr);
@ -1106,31 +1103,31 @@ private:
//===--------------------------------------------------------------------===//
// C99 6.8: Statements and Blocks.
OwningStmtResult ParseStatement() {
StmtResult ParseStatement() {
return ParseStatementOrDeclaration(true);
}
OwningStmtResult ParseStatementOrDeclaration(bool OnlyStatement = false);
OwningStmtResult ParseLabeledStatement(AttributeList *Attr);
OwningStmtResult ParseCaseStatement(AttributeList *Attr);
OwningStmtResult ParseDefaultStatement(AttributeList *Attr);
OwningStmtResult ParseCompoundStatement(AttributeList *Attr,
StmtResult ParseStatementOrDeclaration(bool OnlyStatement = false);
StmtResult ParseLabeledStatement(AttributeList *Attr);
StmtResult ParseCaseStatement(AttributeList *Attr);
StmtResult ParseDefaultStatement(AttributeList *Attr);
StmtResult ParseCompoundStatement(AttributeList *Attr,
bool isStmtExpr = false);
OwningStmtResult ParseCompoundStatementBody(bool isStmtExpr = false);
bool ParseParenExprOrCondition(OwningExprResult &ExprResult,
StmtResult ParseCompoundStatementBody(bool isStmtExpr = false);
bool ParseParenExprOrCondition(ExprResult &ExprResult,
Decl *&DeclResult,
SourceLocation Loc,
bool ConvertToBoolean);
OwningStmtResult ParseIfStatement(AttributeList *Attr);
OwningStmtResult ParseSwitchStatement(AttributeList *Attr);
OwningStmtResult ParseWhileStatement(AttributeList *Attr);
OwningStmtResult ParseDoStatement(AttributeList *Attr);
OwningStmtResult ParseForStatement(AttributeList *Attr);
OwningStmtResult ParseGotoStatement(AttributeList *Attr);
OwningStmtResult ParseContinueStatement(AttributeList *Attr);
OwningStmtResult ParseBreakStatement(AttributeList *Attr);
OwningStmtResult ParseReturnStatement(AttributeList *Attr);
OwningStmtResult ParseAsmStatement(bool &msAsm);
OwningStmtResult FuzzyParseMicrosoftAsmStatement();
StmtResult ParseIfStatement(AttributeList *Attr);
StmtResult ParseSwitchStatement(AttributeList *Attr);
StmtResult ParseWhileStatement(AttributeList *Attr);
StmtResult ParseDoStatement(AttributeList *Attr);
StmtResult ParseForStatement(AttributeList *Attr);
StmtResult ParseGotoStatement(AttributeList *Attr);
StmtResult ParseContinueStatement(AttributeList *Attr);
StmtResult ParseBreakStatement(AttributeList *Attr);
StmtResult ParseReturnStatement(AttributeList *Attr);
StmtResult ParseAsmStatement(bool &msAsm);
StmtResult FuzzyParseMicrosoftAsmStatement();
bool ParseAsmOperandsOpt(llvm::SmallVectorImpl<IdentifierInfo *> &Names,
llvm::SmallVectorImpl<ExprTy *> &Constraints,
llvm::SmallVectorImpl<ExprTy *> &Exprs);
@ -1138,17 +1135,17 @@ private:
//===--------------------------------------------------------------------===//
// C++ 6: Statements and Blocks
OwningStmtResult ParseCXXTryBlock(AttributeList *Attr);
OwningStmtResult ParseCXXTryBlockCommon(SourceLocation TryLoc);
OwningStmtResult ParseCXXCatchBlock();
StmtResult ParseCXXTryBlock(AttributeList *Attr);
StmtResult ParseCXXTryBlockCommon(SourceLocation TryLoc);
StmtResult ParseCXXCatchBlock();
//===--------------------------------------------------------------------===//
// Objective-C Statements
OwningStmtResult ParseObjCAtStatement(SourceLocation atLoc);
OwningStmtResult ParseObjCTryStmt(SourceLocation atLoc);
OwningStmtResult ParseObjCThrowStmt(SourceLocation atLoc);
OwningStmtResult ParseObjCSynchronizedStmt(SourceLocation atLoc);
StmtResult ParseObjCAtStatement(SourceLocation atLoc);
StmtResult ParseObjCTryStmt(SourceLocation atLoc);
StmtResult ParseObjCThrowStmt(SourceLocation atLoc);
StmtResult ParseObjCSynchronizedStmt(SourceLocation atLoc);
//===--------------------------------------------------------------------===//
@ -1358,7 +1355,7 @@ private:
void ParseTypeofSpecifier(DeclSpec &DS);
void ParseDecltypeSpecifier(DeclSpec &DS);
OwningExprResult ParseCXX0XAlignArgument(SourceLocation Start);
ExprResult ParseCXX0XAlignArgument(SourceLocation Start);
/// DeclaratorScopeObj - RAII object used in Parser::ParseDirectDeclarator to
/// enter a new C++ declarator scope and exit it when the function is
@ -1530,7 +1527,7 @@ private:
//===--------------------------------------------------------------------===//
// GNU G++: Type Traits [Type-Traits.html in the GCC manual]
OwningExprResult ParseUnaryTypeTrait();
ExprResult ParseUnaryTypeTrait();
};
} // end namespace clang

View File

@ -99,12 +99,6 @@ public:
typedef clang::DeclResult DeclResult;
typedef clang::MemInitResult MemInitResult;
/// Same, but with ownership.
typedef clang::OwningExprResult OwningExprResult;
typedef clang::OwningStmtResult OwningStmtResult;
// Note that these will replace ExprResult and StmtResult when the transition
// is complete.
/// Single expressions or statements as arguments.
typedef Expr *ExprArg;
typedef Stmt *StmtArg;
@ -123,7 +117,7 @@ public:
// emulation code from Ownership.h).
FullExprArg(const FullExprArg& Other): E(Other.E) {}
OwningExprResult release() {
ExprResult release() {
return move(E);
}
@ -149,14 +143,14 @@ public:
// Utilities for Action implementations to return smart results.
OwningExprResult ExprError() { return OwningExprResult(true); }
OwningStmtResult StmtError() { return OwningStmtResult(true); }
ExprResult ExprError() { return ExprResult(true); }
StmtResult StmtError() { return StmtResult(true); }
OwningExprResult ExprError(const DiagnosticBuilder&) { return ExprError(); }
OwningStmtResult StmtError(const DiagnosticBuilder&) { return StmtError(); }
ExprResult ExprError(const DiagnosticBuilder&) { return ExprError(); }
StmtResult StmtError(const DiagnosticBuilder&) { return StmtError(); }
OwningExprResult ExprEmpty() { return OwningExprResult(false); }
OwningStmtResult StmtEmpty() { return OwningStmtResult(false); }
ExprResult ExprEmpty() { return ExprResult(false); }
StmtResult StmtEmpty() { return StmtResult(false); }
/// Statistics.
virtual void PrintStats() const {}
@ -774,16 +768,16 @@ public:
// Statement Parsing Callbacks.
//===--------------------------------------------------------------------===//
virtual OwningStmtResult ActOnNullStmt(SourceLocation SemiLoc) {
virtual StmtResult ActOnNullStmt(SourceLocation SemiLoc) {
return StmtEmpty();
}
virtual OwningStmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R,
virtual StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R,
MultiStmtArg Elts,
bool isStmtExpr) {
return StmtEmpty();
}
virtual OwningStmtResult ActOnDeclStmt(DeclGroupPtrTy Decl,
virtual StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl,
SourceLocation StartLoc,
SourceLocation EndLoc) {
return StmtEmpty();
@ -792,12 +786,12 @@ public:
virtual void ActOnForEachDeclStmt(DeclGroupPtrTy Decl) {
}
virtual OwningStmtResult ActOnExprStmt(FullExprArg Expr) = 0;
virtual StmtResult ActOnExprStmt(FullExprArg Expr) = 0;
/// ActOnCaseStmt - Note that this handles the GNU 'case 1 ... 4' extension,
/// which can specify an RHS value. The sub-statement of the case is
/// specified in a separate action.
virtual OwningStmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprArg LHSVal,
virtual StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprArg LHSVal,
SourceLocation DotDotDotLoc,
ExprArg RHSVal,
SourceLocation ColonLoc) {
@ -807,13 +801,13 @@ public:
/// ActOnCaseStmtBody - This installs a statement as the body of a case.
virtual void ActOnCaseStmtBody(StmtTy *CaseStmt, StmtArg SubStmt) {}
virtual OwningStmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
virtual StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
SourceLocation ColonLoc,
StmtArg SubStmt, Scope *CurScope){
return StmtEmpty();
}
virtual OwningStmtResult ActOnLabelStmt(SourceLocation IdentLoc,
virtual StmtResult ActOnLabelStmt(SourceLocation IdentLoc,
IdentifierInfo *II,
SourceLocation ColonLoc,
StmtArg SubStmt) {
@ -835,7 +829,7 @@ public:
/// \param ElseLoc the location of the "else" keyword.
///
/// \param ElseVal the "else" statement.
virtual OwningStmtResult ActOnIfStmt(SourceLocation IfLoc,
virtual StmtResult ActOnIfStmt(SourceLocation IfLoc,
FullExprArg CondVal,
Decl *CondVar,
StmtArg ThenVal,
@ -853,13 +847,13 @@ public:
///
/// \param CondVar if the "switch" condition was parsed as a condition
/// variable, the condition variable itself.
virtual OwningStmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc,
virtual StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc,
ExprArg Cond,
Decl *CondVar) {
return StmtEmpty();
}
virtual OwningStmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
virtual StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
StmtArg Switch, StmtArg Body) {
return StmtEmpty();
}
@ -873,12 +867,12 @@ public:
/// variable, the condition variable itself.
///
/// \param Body the body of the "while" loop.
virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc,
virtual StmtResult ActOnWhileStmt(SourceLocation WhileLoc,
FullExprArg Cond, Decl *CondVar,
StmtArg Body) {
return StmtEmpty();
}
virtual OwningStmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
virtual StmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
SourceLocation WhileLoc,
SourceLocation CondLParen,
ExprArg Cond,
@ -906,7 +900,7 @@ public:
/// \param RParenLoc the location of the right parentheses.
///
/// \param Body the body of the "body" loop.
virtual OwningStmtResult ActOnForStmt(SourceLocation ForLoc,
virtual StmtResult ActOnForStmt(SourceLocation ForLoc,
SourceLocation LParenLoc,
StmtArg First, FullExprArg Second,
Decl *SecondVar, FullExprArg Third,
@ -915,35 +909,35 @@ public:
return StmtEmpty();
}
virtual OwningStmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc,
virtual StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc,
SourceLocation LParenLoc,
StmtArg First, ExprArg Second,
SourceLocation RParenLoc, StmtArg Body) {
return StmtEmpty();
}
virtual OwningStmtResult ActOnGotoStmt(SourceLocation GotoLoc,
virtual StmtResult ActOnGotoStmt(SourceLocation GotoLoc,
SourceLocation LabelLoc,
IdentifierInfo *LabelII) {
return StmtEmpty();
}
virtual OwningStmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
virtual StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
SourceLocation StarLoc,
ExprArg DestExp) {
return StmtEmpty();
}
virtual OwningStmtResult ActOnContinueStmt(SourceLocation ContinueLoc,
virtual StmtResult ActOnContinueStmt(SourceLocation ContinueLoc,
Scope *CurScope) {
return StmtEmpty();
}
virtual OwningStmtResult ActOnBreakStmt(SourceLocation GotoLoc,
virtual StmtResult ActOnBreakStmt(SourceLocation GotoLoc,
Scope *CurScope) {
return StmtEmpty();
}
virtual OwningStmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
virtual StmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
ExprArg RetValExp) {
return StmtEmpty();
}
virtual OwningStmtResult ActOnAsmStmt(SourceLocation AsmLoc,
virtual StmtResult ActOnAsmStmt(SourceLocation AsmLoc,
bool IsSimple,
bool IsVolatile,
unsigned NumOutputs,
@ -971,7 +965,7 @@ public:
/// this is a @catch(...) block.
///
/// \param Body The body of the @catch block.
virtual OwningStmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
virtual StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
SourceLocation RParen,
Decl *Parm, StmtArg Body) {
return StmtEmpty();
@ -982,7 +976,7 @@ public:
/// \param AtLoc The location of the '@' starting the '@finally'.
///
/// \param Body The body of the @finally block.
virtual OwningStmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
virtual StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
StmtArg Body) {
return StmtEmpty();
}
@ -996,20 +990,20 @@ public:
/// \param CatchStmts The @catch statements.
///
/// \param Finally The @finally statement.
virtual OwningStmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
virtual StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
StmtArg Try,
MultiStmtArg CatchStmts,
StmtArg Finally) {
return StmtEmpty();
}
virtual OwningStmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
virtual StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
ExprArg Throw,
Scope *CurScope) {
return StmtEmpty();
}
virtual OwningStmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
virtual StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
ExprArg SynchExpr,
StmtArg SynchBody) {
return StmtEmpty();
@ -1020,13 +1014,13 @@ public:
return 0;
}
virtual OwningStmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc,
virtual StmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc,
Decl *ExceptionDecl,
StmtArg HandlerBlock) {
return StmtEmpty();
}
virtual OwningStmtResult ActOnCXXTryBlock(SourceLocation TryLoc,
virtual StmtResult ActOnCXXTryBlock(SourceLocation TryLoc,
StmtArg TryBlock,
MultiStmtArg Handlers) {
return StmtEmpty();
@ -1095,7 +1089,7 @@ public:
/// \param IsAddressOfOperand whether the token that precedes this
/// id-expression or identifier was an ampersand ('&'), indicating that
/// we will be taking the address of this expression.
virtual OwningExprResult ActOnIdExpression(Scope *S,
virtual ExprResult ActOnIdExpression(Scope *S,
CXXScopeSpec &SS,
UnqualifiedId &Name,
bool HasTrailingLParen,
@ -1103,30 +1097,30 @@ public:
return ExprEmpty();
}
virtual OwningExprResult ActOnPredefinedExpr(SourceLocation Loc,
virtual ExprResult ActOnPredefinedExpr(SourceLocation Loc,
tok::TokenKind Kind) {
return ExprEmpty();
}
virtual OwningExprResult ActOnCharacterConstant(const Token &) {
virtual ExprResult ActOnCharacterConstant(const Token &) {
return ExprEmpty();
}
virtual OwningExprResult ActOnNumericConstant(const Token &) {
virtual ExprResult ActOnNumericConstant(const Token &) {
return ExprEmpty();
}
/// ActOnStringLiteral - The specified tokens were lexed as pasted string
/// fragments (e.g. "foo" "bar" L"baz").
virtual OwningExprResult ActOnStringLiteral(const Token *Toks,
virtual ExprResult ActOnStringLiteral(const Token *Toks,
unsigned NumToks) {
return ExprEmpty();
}
virtual OwningExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
virtual ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
ExprArg Val) {
return move(Val); // Default impl returns operand.
}
virtual OwningExprResult ActOnParenOrParenListExpr(SourceLocation L,
virtual ExprResult ActOnParenOrParenListExpr(SourceLocation L,
SourceLocation R,
MultiExprArg Val,
ParsedType TypeOfCast
@ -1135,12 +1129,12 @@ public:
}
// Postfix Expressions.
virtual OwningExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
virtual ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
tok::TokenKind Kind,
ExprArg Input) {
return ExprEmpty();
}
virtual OwningExprResult ActOnArraySubscriptExpr(Scope *S, ExprArg Base,
virtual ExprResult ActOnArraySubscriptExpr(Scope *S, ExprArg Base,
SourceLocation LLoc,
ExprArg Idx,
SourceLocation RLoc) {
@ -1172,7 +1166,7 @@ public:
///
/// \param HasTrailingLParen whether this member name is immediately followed
/// by a left parentheses ('(').
virtual OwningExprResult ActOnMemberAccessExpr(Scope *S, ExprArg Base,
virtual ExprResult ActOnMemberAccessExpr(Scope *S, ExprArg Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
CXXScopeSpec &SS,
@ -1186,7 +1180,7 @@ public:
/// This provides the location of the left/right parens and a list of comma
/// locations. There are guaranteed to be one fewer commas than arguments,
/// unless there are zero arguments.
virtual OwningExprResult ActOnCallExpr(Scope *S, ExprArg Fn,
virtual ExprResult ActOnCallExpr(Scope *S, ExprArg Fn,
SourceLocation LParenLoc,
MultiExprArg Args,
SourceLocation *CommaLocs,
@ -1195,23 +1189,23 @@ public:
}
// Unary Operators. 'Tok' is the token for the operator.
virtual OwningExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
virtual ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
tok::TokenKind Op, ExprArg Input) {
return ExprEmpty();
}
virtual OwningExprResult
virtual ExprResult
ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType,
void *TyOrEx, const SourceRange &ArgRange) {
return ExprEmpty();
}
virtual OwningExprResult ActOnCompoundLiteral(SourceLocation LParen,
virtual ExprResult ActOnCompoundLiteral(SourceLocation LParen,
ParsedType Ty,
SourceLocation RParen,
ExprArg Op) {
return ExprEmpty();
}
virtual OwningExprResult ActOnInitList(SourceLocation LParenLoc,
virtual ExprResult ActOnInitList(SourceLocation LParenLoc,
MultiExprArg InitList,
SourceLocation RParenLoc) {
return ExprEmpty();
@ -1229,14 +1223,14 @@ public:
///
/// @param Init The value that the entity (or entities) described by
/// the designation will be initialized with.
virtual OwningExprResult ActOnDesignatedInitializer(Designation &Desig,
virtual ExprResult ActOnDesignatedInitializer(Designation &Desig,
SourceLocation Loc,
bool GNUSyntax,
OwningExprResult Init) {
ExprResult Init) {
return ExprEmpty();
}
virtual OwningExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
virtual ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
ParsedType Ty, SourceLocation RParenLoc,
ExprArg Op) {
return ExprEmpty();
@ -1246,7 +1240,7 @@ public:
return false;
}
virtual OwningExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc,
virtual ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc,
tok::TokenKind Kind,
ExprArg LHS, ExprArg RHS) {
return ExprEmpty();
@ -1254,7 +1248,7 @@ public:
/// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
/// in the case of a the GNU conditional expr extension.
virtual OwningExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
virtual ExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
SourceLocation ColonLoc,
ExprArg Cond, ExprArg LHS,
ExprArg RHS) {
@ -1263,13 +1257,13 @@ public:
//===---------------------- GNU Extension Expressions -------------------===//
virtual OwningExprResult ActOnAddrLabel(SourceLocation OpLoc,
virtual ExprResult ActOnAddrLabel(SourceLocation OpLoc,
SourceLocation LabLoc,
IdentifierInfo *LabelII) { // "&&foo"
return ExprEmpty();
}
virtual OwningExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtArg SubStmt,
virtual ExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtArg SubStmt,
SourceLocation RPLoc) { // "({..})"
return ExprEmpty();
}
@ -1284,7 +1278,7 @@ public:
} U;
};
virtual OwningExprResult ActOnBuiltinOffsetOf(Scope *S,
virtual ExprResult ActOnBuiltinOffsetOf(Scope *S,
SourceLocation BuiltinLoc,
SourceLocation TypeLoc,
ParsedType Arg1,
@ -1295,21 +1289,21 @@ public:
}
// __builtin_types_compatible_p(type1, type2)
virtual OwningExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
virtual ExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
ParsedType arg1,
ParsedType arg2,
SourceLocation RPLoc) {
return ExprEmpty();
}
// __builtin_choose_expr(constExpr, expr1, expr2)
virtual OwningExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
virtual ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
ExprArg cond, ExprArg expr1,
ExprArg expr2, SourceLocation RPLoc){
return ExprEmpty();
}
// __builtin_va_arg(expr, type)
virtual OwningExprResult ActOnVAArg(SourceLocation BuiltinLoc,
virtual ExprResult ActOnVAArg(SourceLocation BuiltinLoc,
ExprArg expr, ParsedType type,
SourceLocation RPLoc) {
return ExprEmpty();
@ -1317,7 +1311,7 @@ public:
/// ActOnGNUNullExpr - Parsed the GNU __null expression, the token
/// for which is at position TokenLoc.
virtual OwningExprResult ActOnGNUNullExpr(SourceLocation TokenLoc) {
virtual ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc) {
return ExprEmpty();
}
@ -1337,7 +1331,7 @@ public:
/// ActOnBlockStmtExpr - This is called when the body of a block statement
/// literal was successfully completed. ^(int x){...}
virtual OwningExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc,
virtual ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc,
StmtArg Body,
Scope *CurScope) {
return ExprEmpty();
@ -1558,7 +1552,7 @@ public:
/// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's.
virtual OwningExprResult ActOnCXXNamedCast(SourceLocation OpLoc,
virtual ExprResult ActOnCXXNamedCast(SourceLocation OpLoc,
tok::TokenKind Kind,
SourceLocation LAngleBracketLoc,
ParsedType Ty,
@ -1570,7 +1564,7 @@ public:
}
/// ActOnCXXTypeidOfType - Parse typeid( type-id ).
virtual OwningExprResult ActOnCXXTypeid(SourceLocation OpLoc,
virtual ExprResult ActOnCXXTypeid(SourceLocation OpLoc,
SourceLocation LParenLoc, bool isType,
void *TyOrExpr,
SourceLocation RParenLoc) {
@ -1578,23 +1572,23 @@ public:
}
/// ActOnCXXThis - Parse the C++ 'this' pointer.
virtual OwningExprResult ActOnCXXThis(SourceLocation ThisLoc) {
virtual ExprResult ActOnCXXThis(SourceLocation ThisLoc) {
return ExprEmpty();
}
/// ActOnCXXBoolLiteral - Parse {true,false} literals.
virtual OwningExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc,
virtual ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc,
tok::TokenKind Kind) {
return ExprEmpty();
}
/// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
virtual OwningExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc) {
virtual ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc) {
return ExprEmpty();
}
/// ActOnCXXThrow - Parse throw expressions.
virtual OwningExprResult ActOnCXXThrow(SourceLocation OpLoc, ExprArg Op) {
virtual ExprResult ActOnCXXThrow(SourceLocation OpLoc, ExprArg Op) {
return ExprEmpty();
}
@ -1602,7 +1596,7 @@ public:
/// Can be interpreted either as function-style casting ("int(x)")
/// or class type construction ("ClassType(x,y,z)")
/// or creation of a value-initialized type ("int()").
virtual OwningExprResult ActOnCXXTypeConstructExpr(SourceRange TypeRange,
virtual ExprResult ActOnCXXTypeConstructExpr(SourceRange TypeRange,
ParsedType TypeRep,
SourceLocation LParenLoc,
MultiExprArg Exprs,
@ -1638,7 +1632,7 @@ public:
/// a boolean value.
///
/// \param SubExpr The expression that is being converted to bool.
virtual OwningExprResult ActOnBooleanCondition(Scope *S, SourceLocation Loc,
virtual ExprResult ActOnBooleanCondition(Scope *S, SourceLocation Loc,
ExprArg SubExpr) {
return move(SubExpr);
}
@ -1671,7 +1665,7 @@ public:
///
/// \param ConstructorRParen The location of the closing parenthesis (')') for
/// the constructor arguments, if any.
virtual OwningExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
virtual ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
SourceLocation PlacementLParen,
MultiExprArg PlacementArgs,
SourceLocation PlacementRParen,
@ -1685,13 +1679,13 @@ public:
/// ActOnCXXDelete - Parsed a C++ 'delete' expression. UseGlobal is true if
/// the delete was qualified (::delete). ArrayForm is true if the array form
/// was used (delete[]).
virtual OwningExprResult ActOnCXXDelete(SourceLocation StartLoc,
virtual ExprResult ActOnCXXDelete(SourceLocation StartLoc,
bool UseGlobal, bool ArrayForm,
ExprArg Operand) {
return ExprEmpty();
}
virtual OwningExprResult ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
virtual ExprResult ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
SourceLocation KWLoc,
SourceLocation LParen,
ParsedType Ty,
@ -1723,7 +1717,7 @@ public:
/// object type is a scalar and when the object type is dependent.
///
/// \returns the (possibly modified) \p Base expression
virtual OwningExprResult ActOnStartCXXMemberReference(Scope *S,
virtual ExprResult ActOnStartCXXMemberReference(Scope *S,
ExprArg Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
@ -1766,7 +1760,7 @@ public:
///
/// \param HasTrailingLParen Whether the next token in the stream is
/// a left parentheses.
virtual OwningExprResult ActOnPseudoDestructorExpr(Scope *S, ExprArg Base,
virtual ExprResult ActOnPseudoDestructorExpr(Scope *S, ExprArg Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
CXXScopeSpec &SS,
@ -1780,7 +1774,7 @@ public:
/// ActOnFinishFullExpr - Called whenever a full expression has been parsed.
/// (C++ [intro.execution]p12).
virtual OwningExprResult ActOnFinishFullExpr(ExprArg Expr) {
virtual ExprResult ActOnFinishFullExpr(ExprArg Expr) {
return move(Expr);
}
@ -2515,7 +2509,7 @@ public:
return 0;
}
virtual OwningExprResult
virtual ExprResult
ActOnClassPropertyRefExpr(IdentifierInfo &receiverName,
IdentifierInfo &propertyName,
SourceLocation receiverNameLoc,
@ -2580,7 +2574,7 @@ public:
/// \param SelectorLoc The location of the first identifier in the selector.
/// \param RBrac The location of the closing square bracket ']'.
/// \param Args The message arguments.
virtual OwningExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc,
virtual ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc,
Selector Sel,
SourceLocation LBracLoc,
SourceLocation SelectorLoc,
@ -2596,13 +2590,13 @@ public:
/// \param SelectorLoc The location of the first identifier in the selector.
/// \param RBrac The location of the closing square bracket ']'.
/// \param Args The message arguments.
virtual OwningExprResult ActOnClassMessage(Scope *S,
ParsedType Receiver,
Selector Sel,
SourceLocation LBracLoc,
SourceLocation SelectorLoc,
SourceLocation RBracLoc,
MultiExprArg Args) = 0;
virtual ExprResult ActOnClassMessage(Scope *S,
ParsedType Receiver,
Selector Sel,
SourceLocation LBracLoc,
SourceLocation SelectorLoc,
SourceLocation RBracLoc,
MultiExprArg Args) = 0;
/// \brief Parsed a message send to an object instance.
///
@ -2613,13 +2607,13 @@ public:
/// \param SelectorLoc The location of the first identifier in the selector.
/// \param RBrac The location of the closing square bracket ']'.
/// \param Args The message arguments.
virtual OwningExprResult ActOnInstanceMessage(Scope *S,
ExprArg Receiver,
Selector Sel,
SourceLocation LBracLoc,
SourceLocation SelectorLoc,
SourceLocation RBracLoc,
MultiExprArg Args) = 0;
virtual ExprResult ActOnInstanceMessage(Scope *S,
ExprArg Receiver,
Selector Sel,
SourceLocation LBracLoc,
SourceLocation SelectorLoc,
SourceLocation RBracLoc,
MultiExprArg Args) = 0;
virtual Decl *ActOnForwardClassDeclaration(
SourceLocation AtClassLoc,

View File

@ -625,11 +625,11 @@ public:
/// \returns an expression that performs the actual object initialization, if
/// the initialization is well-formed. Otherwise, emits diagnostics
/// and returns an invalid expression.
Action::OwningExprResult Perform(Sema &S,
const InitializedEntity &Entity,
const InitializationKind &Kind,
Action::MultiExprArg Args,
QualType *ResultType = 0);
ExprResult Perform(Sema &S,
const InitializedEntity &Entity,
const InitializationKind &Kind,
Action::MultiExprArg Args,
QualType *ResultType = 0);
/// \brief Diagnose an potentially-invalid initialization sequence.
///

View File

@ -431,21 +431,18 @@ namespace clang {
typedef ActionResult<Decl*> DeclResult;
typedef OpaquePtr<TemplateName> ParsedTemplateTy;
typedef ActionResult<Expr*> OwningExprResult;
typedef ActionResult<Stmt*> OwningStmtResult;
inline Expr *move(Expr *E) { return E; }
inline Stmt *move(Stmt *S) { return S; }
typedef ASTMultiPtr<Expr*> MultiExprArg;
typedef ASTMultiPtr<TemplateParameterList*> MultiTemplateParamsArg;
inline Expr *AssertSuccess(OwningExprResult R) {
inline Expr *AssertSuccess(ExprResult R) {
assert(!R.isInvalid() && "operation was asserted to never fail!");
return R.get();
}
inline Stmt *AssertSuccess(OwningStmtResult R) {
inline Stmt *AssertSuccess(StmtResult R) {
assert(!R.isInvalid() && "operation was asserted to never fail!");
return R.get();
}

View File

@ -686,19 +686,19 @@ public:
virtual void DeleteExpr(ExprTy *E);
virtual void DeleteStmt(StmtTy *S);
OwningExprResult Owned(Expr* E) {
ExprResult Owned(Expr* E) {
assert(!E || E->isRetained());
return OwningExprResult(E);
return ExprResult(E);
}
OwningExprResult Owned(ExprResult R) {
ExprResult Owned(ExprResult R) {
if (R.isInvalid())
return ExprError();
assert(!R.get() || ((Expr*) R.get())->isRetained());
return OwningExprResult(R.get());
return ExprResult(R.get());
}
OwningStmtResult Owned(Stmt* S) {
StmtResult Owned(Stmt* S) {
assert(!S || S->isRetained());
return OwningStmtResult(S);
return StmtResult(S);
}
virtual void ActOnEndOfTranslationUnit();
@ -1223,9 +1223,9 @@ public:
CompareDerivedToBaseConversions(const StandardConversionSequence& SCS1,
const StandardConversionSequence& SCS2);
OwningExprResult PerformCopyInitialization(const InitializedEntity &Entity,
ExprResult PerformCopyInitialization(const InitializedEntity &Entity,
SourceLocation EqualLoc,
OwningExprResult Init);
ExprResult Init);
ImplicitConversionSequence
TryObjectArgumentInitialization(QualType FromType, CXXMethodDecl *Method,
CXXRecordDecl *ActingContext);
@ -1240,7 +1240,7 @@ public:
ImplicitConversionSequence TryContextuallyConvertToObjCId(Expr *From);
bool PerformContextuallyConvertToObjCId(Expr *&From);
OwningExprResult
ExprResult
ConvertToIntegralOrEnumerationType(SourceLocation Loc, ExprArg FromE,
const PartialDiagnostic &NotIntDiag,
const PartialDiagnostic &IncompleteDiag,
@ -1370,7 +1370,7 @@ public:
Expr *FixOverloadedFunctionReference(Expr *E,
DeclAccessPair FoundDecl,
FunctionDecl *Fn);
OwningExprResult FixOverloadedFunctionReference(OwningExprResult,
ExprResult FixOverloadedFunctionReference(ExprResult,
DeclAccessPair FoundDecl,
FunctionDecl *Fn);
@ -1379,28 +1379,28 @@ public:
OverloadCandidateSet &CandidateSet,
bool PartialOverloading = false);
OwningExprResult BuildOverloadedCallExpr(Scope *S, Expr *Fn,
ExprResult BuildOverloadedCallExpr(Scope *S, Expr *Fn,
UnresolvedLookupExpr *ULE,
SourceLocation LParenLoc,
Expr **Args, unsigned NumArgs,
SourceLocation *CommaLocs,
SourceLocation RParenLoc);
OwningExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc,
ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc,
unsigned Opc,
const UnresolvedSetImpl &Fns,
ExprArg input);
OwningExprResult CreateOverloadedBinOp(SourceLocation OpLoc,
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc,
unsigned Opc,
const UnresolvedSetImpl &Fns,
Expr *LHS, Expr *RHS);
OwningExprResult CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
ExprResult CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
SourceLocation RLoc,
ExprArg Base,ExprArg Idx);
OwningExprResult
ExprResult
BuildCallToMemberFunction(Scope *S, Expr *MemExpr,
SourceLocation LParenLoc, Expr **Args,
unsigned NumArgs, SourceLocation *CommaLocs,
@ -1411,7 +1411,7 @@ public:
SourceLocation *CommaLocs,
SourceLocation RParenLoc);
OwningExprResult BuildOverloadedArrowExpr(Scope *S, ExprArg Base,
ExprResult BuildOverloadedArrowExpr(Scope *S, ExprArg Base,
SourceLocation OpLoc);
/// CheckCallReturnType - Checks that a call expression's return type is
@ -1760,74 +1760,74 @@ public:
//===--------------------------------------------------------------------===//
// Statement Parsing Callbacks: SemaStmt.cpp.
public:
virtual OwningStmtResult ActOnExprStmt(FullExprArg Expr);
virtual StmtResult ActOnExprStmt(FullExprArg Expr);
virtual OwningStmtResult ActOnNullStmt(SourceLocation SemiLoc);
virtual OwningStmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R,
virtual StmtResult ActOnNullStmt(SourceLocation SemiLoc);
virtual StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R,
MultiStmtArg Elts,
bool isStmtExpr);
virtual OwningStmtResult ActOnDeclStmt(DeclGroupPtrTy Decl,
virtual StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl,
SourceLocation StartLoc,
SourceLocation EndLoc);
virtual void ActOnForEachDeclStmt(DeclGroupPtrTy Decl);
virtual OwningStmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprArg LHSVal,
virtual StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprArg LHSVal,
SourceLocation DotDotDotLoc, ExprArg RHSVal,
SourceLocation ColonLoc);
virtual void ActOnCaseStmtBody(StmtTy *CaseStmt, StmtArg SubStmt);
virtual OwningStmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
virtual StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc,
SourceLocation ColonLoc,
StmtArg SubStmt, Scope *CurScope);
virtual OwningStmtResult ActOnLabelStmt(SourceLocation IdentLoc,
virtual StmtResult ActOnLabelStmt(SourceLocation IdentLoc,
IdentifierInfo *II,
SourceLocation ColonLoc,
StmtArg SubStmt);
virtual OwningStmtResult ActOnIfStmt(SourceLocation IfLoc,
virtual StmtResult ActOnIfStmt(SourceLocation IfLoc,
FullExprArg CondVal, Decl *CondVar,
StmtArg ThenVal,
SourceLocation ElseLoc, StmtArg ElseVal);
virtual OwningStmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc,
virtual StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc,
ExprArg Cond,
Decl *CondVar);
virtual OwningStmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
virtual StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc,
StmtArg Switch, StmtArg Body);
virtual OwningStmtResult ActOnWhileStmt(SourceLocation WhileLoc,
virtual StmtResult ActOnWhileStmt(SourceLocation WhileLoc,
FullExprArg Cond,
Decl *CondVar, StmtArg Body);
virtual OwningStmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
virtual StmtResult ActOnDoStmt(SourceLocation DoLoc, StmtArg Body,
SourceLocation WhileLoc,
SourceLocation CondLParen, ExprArg Cond,
SourceLocation CondRParen);
virtual OwningStmtResult ActOnForStmt(SourceLocation ForLoc,
virtual StmtResult ActOnForStmt(SourceLocation ForLoc,
SourceLocation LParenLoc,
StmtArg First, FullExprArg Second,
Decl *SecondVar,
FullExprArg Third,
SourceLocation RParenLoc,
StmtArg Body);
virtual OwningStmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc,
virtual StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc,
SourceLocation LParenLoc,
StmtArg First, ExprArg Second,
SourceLocation RParenLoc, StmtArg Body);
virtual OwningStmtResult ActOnGotoStmt(SourceLocation GotoLoc,
virtual StmtResult ActOnGotoStmt(SourceLocation GotoLoc,
SourceLocation LabelLoc,
IdentifierInfo *LabelII);
virtual OwningStmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
virtual StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
SourceLocation StarLoc,
ExprArg DestExp);
virtual OwningStmtResult ActOnContinueStmt(SourceLocation ContinueLoc,
virtual StmtResult ActOnContinueStmt(SourceLocation ContinueLoc,
Scope *CurScope);
virtual OwningStmtResult ActOnBreakStmt(SourceLocation GotoLoc,
virtual StmtResult ActOnBreakStmt(SourceLocation GotoLoc,
Scope *CurScope);
virtual OwningStmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
virtual StmtResult ActOnReturnStmt(SourceLocation ReturnLoc,
ExprArg RetValExp);
OwningStmtResult ActOnBlockReturnStmt(SourceLocation ReturnLoc,
StmtResult ActOnBlockReturnStmt(SourceLocation ReturnLoc,
Expr *RetValExp);
virtual OwningStmtResult ActOnAsmStmt(SourceLocation AsmLoc,
virtual StmtResult ActOnAsmStmt(SourceLocation AsmLoc,
bool IsSimple,
bool IsVolatile,
unsigned NumOutputs,
@ -1847,24 +1847,24 @@ public:
virtual Decl *ActOnObjCExceptionDecl(Scope *S, Declarator &D);
virtual OwningStmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
virtual StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc,
SourceLocation RParen,
Decl *Parm, StmtArg Body);
virtual OwningStmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
virtual StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc,
StmtArg Body);
virtual OwningStmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
virtual StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc,
StmtArg Try,
MultiStmtArg Catch,
StmtArg Finally);
virtual OwningStmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc,
virtual StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc,
ExprArg Throw);
virtual OwningStmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
virtual StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc,
ExprArg Throw,
Scope *CurScope);
virtual OwningStmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
virtual StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc,
ExprArg SynchExpr,
StmtArg SynchBody);
@ -1875,10 +1875,10 @@ public:
SourceRange Range);
virtual Decl *ActOnExceptionDeclarator(Scope *S, Declarator &D);
virtual OwningStmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc,
virtual StmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc,
Decl *ExDecl,
StmtArg HandlerBlock);
virtual OwningStmtResult ActOnCXXTryBlock(SourceLocation TryLoc,
virtual StmtResult ActOnCXXTryBlock(SourceLocation TryLoc,
StmtArg TryBlock,
MultiStmtArg Handlers);
void DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock);
@ -1922,7 +1922,7 @@ public:
// Primary Expressions.
virtual SourceRange getExprRange(ExprTy *E) const;
virtual OwningExprResult ActOnIdExpression(Scope *S,
virtual ExprResult ActOnIdExpression(Scope *S,
CXXScopeSpec &SS,
UnqualifiedId &Name,
bool HasTrailingLParen,
@ -1931,33 +1931,33 @@ public:
bool DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
CorrectTypoContext CTC = CTC_Unknown);
OwningExprResult LookupInObjCMethod(LookupResult &R,
ExprResult LookupInObjCMethod(LookupResult &R,
Scope *S,
IdentifierInfo *II,
bool AllowBuiltinCreation=false);
OwningExprResult ActOnDependentIdExpression(const CXXScopeSpec &SS,
ExprResult ActOnDependentIdExpression(const CXXScopeSpec &SS,
const DeclarationNameInfo &NameInfo,
bool isAddressOfOperand,
const TemplateArgumentListInfo *TemplateArgs);
OwningExprResult BuildDeclRefExpr(ValueDecl *D, QualType Ty,
ExprResult BuildDeclRefExpr(ValueDecl *D, QualType Ty,
SourceLocation Loc,
const CXXScopeSpec *SS = 0);
OwningExprResult BuildDeclRefExpr(ValueDecl *D, QualType Ty,
ExprResult BuildDeclRefExpr(ValueDecl *D, QualType Ty,
const DeclarationNameInfo &NameInfo,
const CXXScopeSpec *SS = 0);
VarDecl *BuildAnonymousStructUnionMemberPath(FieldDecl *Field,
llvm::SmallVectorImpl<FieldDecl *> &Path);
OwningExprResult
ExprResult
BuildAnonymousStructUnionMemberReference(SourceLocation Loc,
FieldDecl *Field,
Expr *BaseObjectExpr = 0,
SourceLocation OpLoc = SourceLocation());
OwningExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS,
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS,
LookupResult &R,
const TemplateArgumentListInfo *TemplateArgs);
OwningExprResult BuildImplicitMemberExpr(const CXXScopeSpec &SS,
ExprResult BuildImplicitMemberExpr(const CXXScopeSpec &SS,
LookupResult &R,
const TemplateArgumentListInfo *TemplateArgs,
bool IsDefiniteInstance);
@ -1965,26 +1965,26 @@ public:
const LookupResult &R,
bool HasTrailingLParen);
OwningExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS,
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS,
const DeclarationNameInfo &NameInfo);
OwningExprResult BuildDependentDeclRefExpr(const CXXScopeSpec &SS,
ExprResult BuildDependentDeclRefExpr(const CXXScopeSpec &SS,
const DeclarationNameInfo &NameInfo,
const TemplateArgumentListInfo *TemplateArgs);
OwningExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS,
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS,
LookupResult &R,
bool ADL);
OwningExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS,
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS,
const DeclarationNameInfo &NameInfo,
NamedDecl *D);
virtual OwningExprResult ActOnPredefinedExpr(SourceLocation Loc,
virtual ExprResult ActOnPredefinedExpr(SourceLocation Loc,
tok::TokenKind Kind);
virtual OwningExprResult ActOnNumericConstant(const Token &);
virtual OwningExprResult ActOnCharacterConstant(const Token &);
virtual OwningExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
virtual ExprResult ActOnNumericConstant(const Token &);
virtual ExprResult ActOnCharacterConstant(const Token &);
virtual ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
ExprArg Val);
virtual OwningExprResult ActOnParenOrParenListExpr(SourceLocation L,
virtual ExprResult ActOnParenOrParenListExpr(SourceLocation L,
SourceLocation R,
MultiExprArg Val,
ParsedType TypeOfCast
@ -1992,24 +1992,24 @@ public:
/// ActOnStringLiteral - The specified tokens were lexed as pasted string
/// fragments (e.g. "foo" "bar" L"baz").
virtual OwningExprResult ActOnStringLiteral(const Token *Toks,
virtual ExprResult ActOnStringLiteral(const Token *Toks,
unsigned NumToks);
// Binary/Unary Operators. 'Tok' is the token for the operator.
OwningExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc,
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc,
unsigned OpcIn,
ExprArg InputArg);
OwningExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc,
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc,
UnaryOperator::Opcode Opc, ExprArg input);
virtual OwningExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
virtual ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
tok::TokenKind Op, ExprArg Input);
OwningExprResult CreateSizeOfAlignOfExpr(TypeSourceInfo *T,
ExprResult CreateSizeOfAlignOfExpr(TypeSourceInfo *T,
SourceLocation OpLoc,
bool isSizeOf, SourceRange R);
OwningExprResult CreateSizeOfAlignOfExpr(Expr *E, SourceLocation OpLoc,
ExprResult CreateSizeOfAlignOfExpr(Expr *E, SourceLocation OpLoc,
bool isSizeOf, SourceRange R);
virtual OwningExprResult
virtual ExprResult
ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType,
void *TyOrEx, const SourceRange &ArgRange);
@ -2017,20 +2017,20 @@ public:
bool CheckSizeOfAlignOfOperand(QualType type, SourceLocation OpLoc,
const SourceRange &R, bool isSizeof);
virtual OwningExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
virtual ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
tok::TokenKind Kind,
ExprArg Input);
virtual OwningExprResult ActOnArraySubscriptExpr(Scope *S, ExprArg Base,
virtual ExprResult ActOnArraySubscriptExpr(Scope *S, ExprArg Base,
SourceLocation LLoc,
ExprArg Idx,
SourceLocation RLoc);
OwningExprResult CreateBuiltinArraySubscriptExpr(ExprArg Base,
ExprResult CreateBuiltinArraySubscriptExpr(ExprArg Base,
SourceLocation LLoc,
ExprArg Idx,
SourceLocation RLoc);
OwningExprResult BuildMemberReferenceExpr(ExprArg Base,
ExprResult BuildMemberReferenceExpr(ExprArg Base,
QualType BaseType,
SourceLocation OpLoc,
bool IsArrow,
@ -2039,7 +2039,7 @@ public:
const DeclarationNameInfo &NameInfo,
const TemplateArgumentListInfo *TemplateArgs);
OwningExprResult BuildMemberReferenceExpr(ExprArg Base,
ExprResult BuildMemberReferenceExpr(ExprArg Base,
QualType BaseType,
SourceLocation OpLoc, bool IsArrow,
const CXXScopeSpec &SS,
@ -2048,7 +2048,7 @@ public:
const TemplateArgumentListInfo *TemplateArgs,
bool SuppressQualifierCheck = false);
OwningExprResult LookupMemberExpr(LookupResult &R, Expr *&Base,
ExprResult LookupMemberExpr(LookupResult &R, Expr *&Base,
bool &IsArrow, SourceLocation OpLoc,
CXXScopeSpec &SS,
Decl *ObjCImpDecl,
@ -2058,7 +2058,7 @@ public:
const CXXScopeSpec &SS,
const LookupResult &R);
OwningExprResult ActOnDependentMemberExpr(ExprArg Base,
ExprResult ActOnDependentMemberExpr(ExprArg Base,
QualType BaseType,
bool IsArrow,
SourceLocation OpLoc,
@ -2067,7 +2067,7 @@ public:
const DeclarationNameInfo &NameInfo,
const TemplateArgumentListInfo *TemplateArgs);
virtual OwningExprResult ActOnMemberAccessExpr(Scope *S, ExprArg Base,
virtual ExprResult ActOnMemberAccessExpr(Scope *S, ExprArg Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
CXXScopeSpec &SS,
@ -2085,21 +2085,21 @@ public:
/// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
/// This provides the location of the left/right parens and a list of comma
/// locations.
virtual OwningExprResult ActOnCallExpr(Scope *S, ExprArg Fn,
virtual ExprResult ActOnCallExpr(Scope *S, ExprArg Fn,
SourceLocation LParenLoc,
MultiExprArg Args,
SourceLocation *CommaLocs,
SourceLocation RParenLoc);
OwningExprResult BuildResolvedCallExpr(Expr *Fn,
ExprResult BuildResolvedCallExpr(Expr *Fn,
NamedDecl *NDecl,
SourceLocation LParenLoc,
Expr **Args, unsigned NumArgs,
SourceLocation RParenLoc);
virtual OwningExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
virtual ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
ParsedType Ty, SourceLocation RParenLoc,
ExprArg Op);
OwningExprResult BuildCStyleCastExpr(SourceLocation LParenLoc,
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc,
TypeSourceInfo *Ty,
SourceLocation RParenLoc,
ExprArg Op);
@ -2108,61 +2108,61 @@ public:
return GetTypeFromParser(Ty)->isVectorType();
}
OwningExprResult MaybeConvertParenListExprToParenExpr(Scope *S, Expr *ME);
OwningExprResult ActOnCastOfParenListExpr(Scope *S, SourceLocation LParenLoc,
ExprResult MaybeConvertParenListExprToParenExpr(Scope *S, Expr *ME);
ExprResult ActOnCastOfParenListExpr(Scope *S, SourceLocation LParenLoc,
SourceLocation RParenLoc, ExprArg E,
TypeSourceInfo *TInfo);
virtual OwningExprResult ActOnCompoundLiteral(SourceLocation LParenLoc,
virtual ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc,
ParsedType Ty,
SourceLocation RParenLoc,
ExprArg Op);
OwningExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc,
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc,
TypeSourceInfo *TInfo,
SourceLocation RParenLoc,
ExprArg InitExpr);
virtual OwningExprResult ActOnInitList(SourceLocation LParenLoc,
virtual ExprResult ActOnInitList(SourceLocation LParenLoc,
MultiExprArg InitList,
SourceLocation RParenLoc);
virtual OwningExprResult ActOnDesignatedInitializer(Designation &Desig,
virtual ExprResult ActOnDesignatedInitializer(Designation &Desig,
SourceLocation Loc,
bool GNUSyntax,
OwningExprResult Init);
ExprResult Init);
virtual OwningExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc,
virtual ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc,
tok::TokenKind Kind,
ExprArg LHS, ExprArg RHS);
OwningExprResult BuildBinOp(Scope *S, SourceLocation OpLoc,
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc,
BinaryOperator::Opcode Opc,
Expr *lhs, Expr *rhs);
OwningExprResult CreateBuiltinBinOp(SourceLocation TokLoc,
ExprResult CreateBuiltinBinOp(SourceLocation TokLoc,
unsigned Opc, Expr *lhs, Expr *rhs);
/// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
/// in the case of a the GNU conditional expr extension.
virtual OwningExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
virtual ExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
SourceLocation ColonLoc,
ExprArg Cond, ExprArg LHS,
ExprArg RHS);
/// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
virtual OwningExprResult ActOnAddrLabel(SourceLocation OpLoc,
virtual ExprResult ActOnAddrLabel(SourceLocation OpLoc,
SourceLocation LabLoc,
IdentifierInfo *LabelII);
virtual OwningExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtArg SubStmt,
virtual ExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtArg SubStmt,
SourceLocation RPLoc); // "({..})"
/// __builtin_offsetof(type, a.b[123][456].c)
OwningExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
TypeSourceInfo *TInfo,
OffsetOfComponent *CompPtr,
unsigned NumComponents,
SourceLocation RParenLoc);
virtual OwningExprResult ActOnBuiltinOffsetOf(Scope *S,
virtual ExprResult ActOnBuiltinOffsetOf(Scope *S,
SourceLocation BuiltinLoc,
SourceLocation TypeLoc,
ParsedType Arg1,
@ -2171,30 +2171,30 @@ public:
SourceLocation RParenLoc);
// __builtin_types_compatible_p(type1, type2)
virtual OwningExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
virtual ExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
ParsedType arg1,
ParsedType arg2,
SourceLocation RPLoc);
OwningExprResult BuildTypesCompatibleExpr(SourceLocation BuiltinLoc,
ExprResult BuildTypesCompatibleExpr(SourceLocation BuiltinLoc,
TypeSourceInfo *argTInfo1,
TypeSourceInfo *argTInfo2,
SourceLocation RPLoc);
// __builtin_choose_expr(constExpr, expr1, expr2)
virtual OwningExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
virtual ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
ExprArg cond, ExprArg expr1,
ExprArg expr2, SourceLocation RPLoc);
// __builtin_va_arg(expr, type)
virtual OwningExprResult ActOnVAArg(SourceLocation BuiltinLoc,
virtual ExprResult ActOnVAArg(SourceLocation BuiltinLoc,
ExprArg expr, ParsedType type,
SourceLocation RPLoc);
OwningExprResult BuildVAArgExpr(SourceLocation BuiltinLoc,
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc,
ExprArg expr, TypeSourceInfo *TInfo,
SourceLocation RPLoc);
// __null
virtual OwningExprResult ActOnGNUNullExpr(SourceLocation TokenLoc);
virtual ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc);
//===------------------------- "Block" Extension ------------------------===//
@ -2212,7 +2212,7 @@ public:
/// ActOnBlockStmtExpr - This is called when the body of a block statement
/// literal was successfully completed. ^(int x){...}
virtual OwningExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc,
virtual ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc,
StmtArg Body, Scope *CurScope);
//===---------------------------- C++ Features --------------------------===//
@ -2304,7 +2304,7 @@ public:
/// BuildCXXConstructExpr - Creates a complete call to a constructor,
/// including handling of its default argument expressions.
OwningExprResult
ExprResult
BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
CXXConstructorDecl *Constructor, MultiExprArg Exprs,
bool RequiresZeroInit = false,
@ -2313,7 +2313,7 @@ public:
// FIXME: Can re remove this and have the above BuildCXXConstructExpr check if
// the constructor can be elidable?
OwningExprResult
ExprResult
BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
CXXConstructorDecl *Constructor, bool Elidable,
MultiExprArg Exprs, bool RequiresZeroInit = false,
@ -2322,7 +2322,7 @@ public:
/// BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating
/// the default expr if needed.
OwningExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc,
ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc,
FunctionDecl *FD,
ParmVarDecl *Param);
@ -2396,7 +2396,7 @@ public:
/// MaybeBindToTemporary - If the passed in expression has a record type with
/// a non-trivial destructor, this will return CXXBindTemporaryExpr. Otherwise
/// it simply returns the passed in expression.
OwningExprResult MaybeBindToTemporary(Expr *E);
ExprResult MaybeBindToTemporary(Expr *E);
bool CompleteConstructorCall(CXXConstructorDecl *Constructor,
MultiExprArg ArgsPtr,
@ -2410,7 +2410,7 @@ public:
bool EnteringContext);
/// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's.
virtual OwningExprResult ActOnCXXNamedCast(SourceLocation OpLoc,
virtual ExprResult ActOnCXXNamedCast(SourceLocation OpLoc,
tok::TokenKind Kind,
SourceLocation LAngleBracketLoc,
ParsedType Ty,
@ -2419,40 +2419,40 @@ public:
ExprArg E,
SourceLocation RParenLoc);
OwningExprResult BuildCXXNamedCast(SourceLocation OpLoc,
ExprResult BuildCXXNamedCast(SourceLocation OpLoc,
tok::TokenKind Kind,
TypeSourceInfo *Ty,
ExprArg E,
SourceRange AngleBrackets,
SourceRange Parens);
OwningExprResult BuildCXXTypeId(QualType TypeInfoType,
ExprResult BuildCXXTypeId(QualType TypeInfoType,
SourceLocation TypeidLoc,
TypeSourceInfo *Operand,
SourceLocation RParenLoc);
OwningExprResult BuildCXXTypeId(QualType TypeInfoType,
ExprResult BuildCXXTypeId(QualType TypeInfoType,
SourceLocation TypeidLoc,
ExprArg Operand,
SourceLocation RParenLoc);
/// ActOnCXXTypeid - Parse typeid( something ).
virtual OwningExprResult ActOnCXXTypeid(SourceLocation OpLoc,
virtual ExprResult ActOnCXXTypeid(SourceLocation OpLoc,
SourceLocation LParenLoc, bool isType,
void *TyOrExpr,
SourceLocation RParenLoc);
//// ActOnCXXThis - Parse 'this' pointer.
virtual OwningExprResult ActOnCXXThis(SourceLocation ThisLoc);
virtual ExprResult ActOnCXXThis(SourceLocation ThisLoc);
/// ActOnCXXBoolLiteral - Parse {true,false} literals.
virtual OwningExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc,
virtual ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc,
tok::TokenKind Kind);
/// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
virtual OwningExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc);
virtual ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc);
//// ActOnCXXThrow - Parse throw expressions.
virtual OwningExprResult ActOnCXXThrow(SourceLocation OpLoc,
virtual ExprResult ActOnCXXThrow(SourceLocation OpLoc,
ExprArg expr);
bool CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *&E);
@ -2460,7 +2460,7 @@ public:
/// Can be interpreted either as function-style casting ("int(x)")
/// or class type construction ("ClassType(x,y,z)")
/// or creation of a value-initialized type ("int()").
virtual OwningExprResult ActOnCXXTypeConstructExpr(SourceRange TypeRange,
virtual ExprResult ActOnCXXTypeConstructExpr(SourceRange TypeRange,
ParsedType TypeRep,
SourceLocation LParenLoc,
MultiExprArg Exprs,
@ -2468,7 +2468,7 @@ public:
SourceLocation RParenLoc);
/// ActOnCXXNew - Parsed a C++ 'new' expression.
virtual OwningExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
virtual ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
SourceLocation PlacementLParen,
MultiExprArg PlacementArgs,
SourceLocation PlacementRParen,
@ -2476,7 +2476,7 @@ public:
SourceLocation ConstructorLParen,
MultiExprArg ConstructorArgs,
SourceLocation ConstructorRParen);
OwningExprResult BuildCXXNew(SourceLocation StartLoc, bool UseGlobal,
ExprResult BuildCXXNew(SourceLocation StartLoc, bool UseGlobal,
SourceLocation PlacementLParen,
MultiExprArg PlacementArgs,
SourceLocation PlacementRParen,
@ -2509,35 +2509,35 @@ public:
DeclarationName Name, FunctionDecl* &Operator);
/// ActOnCXXDelete - Parsed a C++ 'delete' expression
virtual OwningExprResult ActOnCXXDelete(SourceLocation StartLoc,
virtual ExprResult ActOnCXXDelete(SourceLocation StartLoc,
bool UseGlobal, bool ArrayForm,
ExprArg Operand);
virtual DeclResult ActOnCXXConditionDeclaration(Scope *S,
Declarator &D);
OwningExprResult CheckConditionVariable(VarDecl *ConditionVar,
ExprResult CheckConditionVariable(VarDecl *ConditionVar,
SourceLocation StmtLoc,
bool ConvertToBoolean);
/// ActOnUnaryTypeTrait - Parsed one of the unary type trait support
/// pseudo-functions.
virtual OwningExprResult ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
virtual ExprResult ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
SourceLocation KWLoc,
SourceLocation LParen,
ParsedType Ty,
SourceLocation RParen);
virtual OwningExprResult ActOnStartCXXMemberReference(Scope *S,
virtual ExprResult ActOnStartCXXMemberReference(Scope *S,
ExprArg Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
ParsedType &ObjectType,
bool &MayBePseudoDestructor);
OwningExprResult DiagnoseDtorReference(SourceLocation NameLoc,
ExprResult DiagnoseDtorReference(SourceLocation NameLoc,
ExprArg MemExpr);
OwningExprResult BuildPseudoDestructorExpr(ExprArg Base,
ExprResult BuildPseudoDestructorExpr(ExprArg Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
const CXXScopeSpec &SS,
@ -2547,7 +2547,7 @@ public:
PseudoDestructorTypeStorage DestroyedType,
bool HasTrailingLParen);
virtual OwningExprResult ActOnPseudoDestructorExpr(Scope *S, ExprArg Base,
virtual ExprResult ActOnPseudoDestructorExpr(Scope *S, ExprArg Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
CXXScopeSpec &SS,
@ -2561,10 +2561,10 @@ public:
/// non-empty, will create a new CXXExprWithTemporaries expression.
/// Otherwise, just returs the passed in expression.
Expr *MaybeCreateCXXExprWithTemporaries(Expr *SubExpr);
OwningExprResult MaybeCreateCXXExprWithTemporaries(OwningExprResult SubExpr);
ExprResult MaybeCreateCXXExprWithTemporaries(ExprResult SubExpr);
FullExpr CreateFullExpr(Expr *SubExpr);
virtual OwningExprResult ActOnFinishFullExpr(ExprArg Expr);
virtual ExprResult ActOnFinishFullExpr(ExprArg Expr);
// Marks SS invalid if it represents an incomplete type.
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC);
@ -3088,11 +3088,11 @@ public:
DeclSpec::TST TagSpec,
SourceLocation TagLoc);
OwningExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS,
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS,
LookupResult &R,
bool RequiresADL,
const TemplateArgumentListInfo &TemplateArgs);
OwningExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS,
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS,
const DeclarationNameInfo &NameInfo,
const TemplateArgumentListInfo &TemplateArgs);
@ -3228,11 +3228,11 @@ public:
bool CheckTemplateArgument(TemplateTemplateParmDecl *Param,
const TemplateArgumentLoc &Arg);
OwningExprResult
ExprResult
BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg,
QualType ParamType,
SourceLocation Loc);
OwningExprResult
ExprResult
BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg,
SourceLocation Loc);
@ -3318,7 +3318,7 @@ public:
DeclarationName Name);
bool RebuildNestedNameSpecifierInCurrentInstantiation(CXXScopeSpec &SS);
OwningExprResult RebuildExprInCurrentInstantiation(Expr *E);
ExprResult RebuildExprInCurrentInstantiation(Expr *E);
std::string
getTemplateArgumentBindingsText(const TemplateParameterList *Params,
@ -3951,10 +3951,10 @@ public:
DeclarationName Entity);
ParmVarDecl *SubstParmVarDecl(ParmVarDecl *D,
const MultiLevelTemplateArgumentList &TemplateArgs);
OwningExprResult SubstExpr(Expr *E,
ExprResult SubstExpr(Expr *E,
const MultiLevelTemplateArgumentList &TemplateArgs);
OwningStmtResult SubstStmt(Stmt *S,
StmtResult SubstStmt(Stmt *S,
const MultiLevelTemplateArgumentList &TemplateArgs);
Decl *SubstDecl(Decl *D, DeclContext *Owner,
@ -4157,13 +4157,13 @@ public:
ObjCMethodDecl *LookupPrivateInstanceMethod(Selector Sel,
ObjCInterfaceDecl *ClassDecl);
OwningExprResult
ExprResult
HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
Expr *BaseExpr,
DeclarationName MemberName,
SourceLocation MemberLoc);
virtual OwningExprResult
virtual ExprResult
ActOnClassPropertyRefExpr(IdentifierInfo &receiverName,
IdentifierInfo &propertyName,
SourceLocation receiverNameLoc,
@ -4176,14 +4176,14 @@ public:
bool HasTrailingDot,
ParsedType &ReceiverType);
virtual OwningExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc,
virtual ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc,
Selector Sel,
SourceLocation LBracLoc,
SourceLocation SelectorLoc,
SourceLocation RBracLoc,
MultiExprArg Args);
OwningExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
QualType ReceiverType,
SourceLocation SuperLoc,
Selector Sel,
@ -4192,7 +4192,7 @@ public:
SourceLocation RBracLoc,
MultiExprArg Args);
virtual OwningExprResult ActOnClassMessage(Scope *S,
virtual ExprResult ActOnClassMessage(Scope *S,
ParsedType Receiver,
Selector Sel,
SourceLocation LBracLoc,
@ -4200,7 +4200,7 @@ public:
SourceLocation RBracLoc,
MultiExprArg Args);
OwningExprResult BuildInstanceMessage(ExprArg Receiver,
ExprResult BuildInstanceMessage(ExprArg Receiver,
QualType ReceiverType,
SourceLocation SuperLoc,
Selector Sel,
@ -4209,7 +4209,7 @@ public:
SourceLocation RBracLoc,
MultiExprArg Args);
virtual OwningExprResult ActOnInstanceMessage(Scope *S,
virtual ExprResult ActOnInstanceMessage(Scope *S,
ExprArg Receiver,
Selector Sel,
SourceLocation LBracLoc,
@ -4604,7 +4604,7 @@ public:
/// \return true iff there were any errors
bool CheckBooleanCondition(Expr *&CondExpr, SourceLocation Loc);
virtual OwningExprResult ActOnBooleanCondition(Scope *S, SourceLocation Loc,
virtual ExprResult ActOnBooleanCondition(Scope *S, SourceLocation Loc,
ExprArg SubExpr);
/// DiagnoseAssignmentAsCondition - Given that an expression is
@ -4743,7 +4743,7 @@ private:
bool CheckablePrintfAttr(const FormatAttr *Format, CallExpr *TheCall);
bool CheckObjCString(Expr *Arg);
Action::OwningExprResult CheckBuiltinFunctionCall(unsigned BuiltinID,
ExprResult CheckBuiltinFunctionCall(unsigned BuiltinID,
CallExpr *TheCall);
bool CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
bool CheckX86BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
@ -4754,13 +4754,13 @@ private:
public:
// Used by C++ template instantiation.
Action::OwningExprResult SemaBuiltinShuffleVector(CallExpr *TheCall);
ExprResult SemaBuiltinShuffleVector(CallExpr *TheCall);
private:
bool SemaBuiltinPrefetch(CallExpr *TheCall);
bool SemaBuiltinObjectSize(CallExpr *TheCall);
bool SemaBuiltinLongjmp(CallExpr *TheCall);
OwningExprResult SemaBuiltinAtomicOverloaded(OwningExprResult TheCallResult);
ExprResult SemaBuiltinAtomicOverloaded(ExprResult TheCallResult);
bool SemaBuiltinConstantArg(CallExpr *TheCall, int ArgNum,
llvm::APSInt &Result);

View File

@ -138,7 +138,7 @@ void Parser::ParseLexedMethodDeclarations(ParsingClass &Class) {
assert(Tok.is(tok::equal) && "Default argument not starting with '='");
SourceLocation EqualLoc = ConsumeToken();
OwningExprResult DefArgResult(ParseAssignmentExpression());
ExprResult DefArgResult(ParseAssignmentExpression());
if (DefArgResult.isInvalid())
Actions.ActOnParamDefaultArgumentError(LM.DefaultArgs[I].Param);
else {

View File

@ -131,7 +131,7 @@ AttributeList *Parser::ParseGNUAttributes(SourceLocation *EndLoc) {
// now parse the non-empty comma separated list of expressions
while (1) {
OwningExprResult ArgExpr(ParseAssignmentExpression());
ExprResult ArgExpr(ParseAssignmentExpression());
if (ArgExpr.isInvalid()) {
ArgExprsOk = false;
SkipUntil(tok::r_paren);
@ -191,7 +191,7 @@ AttributeList *Parser::ParseGNUAttributes(SourceLocation *EndLoc) {
// now parse the list of expressions
while (1) {
OwningExprResult ArgExpr(ParseAssignmentExpression());
ExprResult ArgExpr(ParseAssignmentExpression());
if (ArgExpr.isInvalid()) {
ArgExprsOk = false;
SkipUntil(tok::r_paren);
@ -256,7 +256,7 @@ AttributeList* Parser::ParseMicrosoftDeclSpec(AttributeList *CurrAttr) {
ConsumeParen();
// FIXME: This doesn't parse __declspec(property(get=get_func_name))
// correctly.
OwningExprResult ArgExpr(ParseAssignmentExpression());
ExprResult ArgExpr(ParseAssignmentExpression());
if (!ArgExpr.isInvalid()) {
Expr *ExprList = ArgExpr.take();
CurrAttr = new AttributeList(AttrName, AttrNameLoc, 0, AttrNameLoc, 0,
@ -514,7 +514,7 @@ Decl *Parser::ParseDeclarationAfterDeclarator(Declarator &D,
// If a simple-asm-expr is present, parse it.
if (Tok.is(tok::kw_asm)) {
SourceLocation Loc;
OwningExprResult AsmLabel(ParseSimpleAsm(&Loc));
ExprResult AsmLabel(ParseSimpleAsm(&Loc));
if (AsmLabel.isInvalid()) {
SkipUntil(tok::semi, true, true);
return 0;
@ -582,7 +582,7 @@ Decl *Parser::ParseDeclarationAfterDeclarator(Declarator &D,
return ThisDecl;
}
OwningExprResult Init(ParseInitializer());
ExprResult Init(ParseInitializer());
if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
Actions.ActOnCXXExitDeclInitializer(getCurScope(), ThisDecl);
@ -1756,7 +1756,7 @@ ParseStructDeclaration(DeclSpec &DS, FieldCallback &Fields) {
if (Tok.is(tok::colon)) {
ConsumeToken();
OwningExprResult Res(ParseConstantExpression());
ExprResult Res(ParseConstantExpression());
if (Res.isInvalid())
SkipUntil(tok::semi, true, true);
else
@ -2078,7 +2078,7 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, Decl *EnumDecl) {
SourceLocation IdentLoc = ConsumeToken();
SourceLocation EqualLoc;
OwningExprResult AssignedVal;
ExprResult AssignedVal;
if (Tok.is(tok::equal)) {
EqualLoc = ConsumeToken();
AssignedVal = ParseConstantExpression();
@ -3131,7 +3131,7 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D,
// Consume the '='.
ConsumeToken();
OwningExprResult DefArgResult(ParseAssignmentExpression());
ExprResult DefArgResult(ParseAssignmentExpression());
if (DefArgResult.isInvalid()) {
Actions.ActOnParamDefaultArgumentError(Param);
SkipUntil(tok::comma, tok::r_paren, true, true);
@ -3309,7 +3309,7 @@ void Parser::ParseBracketDeclarator(Declarator &D) {
}
// Remember that we parsed the empty array type.
OwningExprResult NumElements;
ExprResult NumElements;
D.AddTypeInfo(DeclaratorChunk::getArray(0, false, false, 0,
StartLoc, EndLoc),
EndLoc);
@ -3317,7 +3317,7 @@ void Parser::ParseBracketDeclarator(Declarator &D) {
} else if (Tok.getKind() == tok::numeric_constant &&
GetLookAheadToken(1).is(tok::r_square)) {
// [4] is very common. Parse the numeric constant expression.
OwningExprResult ExprRes(Actions.ActOnNumericConstant(Tok));
ExprResult ExprRes(Actions.ActOnNumericConstant(Tok));
ConsumeToken();
SourceLocation EndLoc = MatchRHSPunctuation(tok::r_square, StartLoc);
@ -3355,7 +3355,7 @@ void Parser::ParseBracketDeclarator(Declarator &D) {
// Handle "direct-declarator [ type-qual-list[opt] * ]".
bool isStar = false;
OwningExprResult NumElements;
ExprResult NumElements;
// Handle the case where we have '[*]' as the array size. However, a leading
// star could be the start of an expression, for example 'X[*p + 4]'. Verify
@ -3422,7 +3422,7 @@ void Parser::ParseTypeofSpecifier(DeclSpec &DS) {
bool isCastExpr;
ParsedType CastTy;
SourceRange CastRange;
OwningExprResult Operand = ParseExprAfterTypeofSizeofAlignof(OpTok,
ExprResult Operand = ParseExprAfterTypeofSizeofAlignof(OpTok,
isCastExpr,
CastTy,
CastRange);

View File

@ -389,7 +389,7 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd){
SourceLocation LParenLoc = ConsumeParen();
OwningExprResult AssertExpr(ParseConstantExpression());
ExprResult AssertExpr(ParseConstantExpression());
if (AssertExpr.isInvalid()) {
SkipUntil(tok::semi);
return 0;
@ -404,7 +404,7 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd){
return 0;
}
OwningExprResult AssertMessage(ParseStringLiteralExpression());
ExprResult AssertMessage(ParseStringLiteralExpression());
if (AssertMessage.isInvalid())
return 0;
@ -440,7 +440,7 @@ void Parser::ParseDecltypeSpecifier(DeclSpec &DS) {
// The operand of the decltype specifier is an unevaluated operand.
EnterExpressionEvaluationContext Unevaluated(Actions,
Action::Unevaluated);
OwningExprResult Result = ParseExpression();
ExprResult Result = ParseExpression();
if (Result.isInvalid()) {
SkipUntil(tok::r_paren);
return;
@ -1404,8 +1404,8 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
// member-declarator-list ',' member-declarator
llvm::SmallVector<Decl *, 8> DeclsInGroup;
OwningExprResult BitfieldSize;
OwningExprResult Init;
ExprResult BitfieldSize;
ExprResult Init;
bool Deleted = false;
while (1) {
@ -1444,7 +1444,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
// If a simple-asm-expr is present, parse it.
if (Tok.is(tok::kw_asm)) {
SourceLocation Loc;
OwningExprResult AsmLabel(ParseSimpleAsm(&Loc));
ExprResult AsmLabel(ParseSimpleAsm(&Loc));
if (AsmLabel.isInvalid())
SkipUntil(tok::comma, true, true);
@ -2015,7 +2015,7 @@ CXX0XAttributeList Parser::ParseCXX0XAttributes(SourceLocation *EndLoc) {
}
SourceLocation ParamLoc = ConsumeParen();
OwningExprResult ArgExpr = ParseCXX0XAlignArgument(ParamLoc);
ExprResult ArgExpr = ParseCXX0XAlignArgument(ParamLoc);
MatchRHSPunctuation(tok::r_paren, ParamLoc);
@ -2060,7 +2060,7 @@ CXX0XAttributeList Parser::ParseCXX0XAttributes(SourceLocation *EndLoc) {
///
/// [C++0x] 'align' '(' type-id ')'
/// [C++0x] 'align' '(' assignment-expression ')'
Parser::OwningExprResult Parser::ParseCXX0XAlignArgument(SourceLocation Start) {
ExprResult Parser::ParseCXX0XAlignArgument(SourceLocation Start) {
if (isTypeIdInParens()) {
EnterExpressionEvaluationContext Unevaluated(Actions,
Action::Unevaluated);

View File

@ -175,8 +175,8 @@ static prec::Level getBinOpPrecedence(tok::TokenKind Kind,
/// assignment-expression
/// expression ',' assignment-expression
///
Parser::OwningExprResult Parser::ParseExpression() {
OwningExprResult LHS(ParseAssignmentExpression());
ExprResult Parser::ParseExpression() {
ExprResult LHS(ParseAssignmentExpression());
if (LHS.isInvalid()) return move(LHS);
return ParseRHSOfBinaryExpression(move(LHS), prec::Comma);
@ -187,9 +187,9 @@ Parser::OwningExprResult Parser::ParseExpression() {
/// routine is necessary to disambiguate @try-statement from,
/// for example, @encode-expression.
///
Parser::OwningExprResult
ExprResult
Parser::ParseExpressionWithLeadingAt(SourceLocation AtLoc) {
OwningExprResult LHS(ParseObjCAtExpression(AtLoc));
ExprResult LHS(ParseObjCAtExpression(AtLoc));
if (LHS.isInvalid()) return move(LHS);
return ParseRHSOfBinaryExpression(move(LHS), prec::Comma);
@ -198,9 +198,9 @@ Parser::ParseExpressionWithLeadingAt(SourceLocation AtLoc) {
/// This routine is called when a leading '__extension__' is seen and
/// consumed. This is necessary because the token gets consumed in the
/// process of disambiguating between an expression and a declaration.
Parser::OwningExprResult
ExprResult
Parser::ParseExpressionWithLeadingExtension(SourceLocation ExtLoc) {
OwningExprResult LHS(true);
ExprResult LHS(true);
{
// Silence extension warnings in the sub-expression
ExtensionRAIIObject O(Diags);
@ -218,7 +218,7 @@ Parser::ParseExpressionWithLeadingExtension(SourceLocation ExtLoc) {
/// ParseAssignmentExpression - Parse an expr that doesn't include commas.
///
Parser::OwningExprResult Parser::ParseAssignmentExpression() {
ExprResult Parser::ParseAssignmentExpression() {
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteOrdinaryName(getCurScope(), Action::PCC_Expression);
ConsumeCodeCompletionToken();
@ -227,7 +227,7 @@ Parser::OwningExprResult Parser::ParseAssignmentExpression() {
if (Tok.is(tok::kw_throw))
return ParseThrowExpression();
OwningExprResult LHS(ParseCastExpression(false));
ExprResult LHS(ParseCastExpression(false));
if (LHS.isInvalid()) return move(LHS);
return ParseRHSOfBinaryExpression(LHS.take(), prec::Assignment);
@ -241,12 +241,12 @@ Parser::OwningExprResult Parser::ParseAssignmentExpression() {
///
/// Since this handles full assignment-expression's, it handles postfix
/// expressions and other binary operators for these expressions as well.
Parser::OwningExprResult
ExprResult
Parser::ParseAssignmentExprWithObjCMessageExprStart(SourceLocation LBracLoc,
SourceLocation SuperLoc,
ParsedType ReceiverType,
Expr *ReceiverExpr) {
OwningExprResult R
ExprResult R
= ParseObjCMessageExpressionBody(LBracLoc, SuperLoc,
ReceiverType, ReceiverExpr);
if (R.isInvalid()) return move(R);
@ -256,14 +256,14 @@ Parser::ParseAssignmentExprWithObjCMessageExprStart(SourceLocation LBracLoc,
}
Parser::OwningExprResult Parser::ParseConstantExpression() {
ExprResult Parser::ParseConstantExpression() {
// C++ [basic.def.odr]p2:
// An expression is potentially evaluated unless it appears where an
// integral constant expression is required (see 5.19) [...].
EnterExpressionEvaluationContext Unevaluated(Actions,
Action::Unevaluated);
OwningExprResult LHS(ParseCastExpression(false));
ExprResult LHS(ParseCastExpression(false));
if (LHS.isInvalid()) return move(LHS);
return ParseRHSOfBinaryExpression(LHS.take(), prec::Conditional);
@ -271,8 +271,8 @@ Parser::OwningExprResult Parser::ParseConstantExpression() {
/// ParseRHSOfBinaryExpression - Parse a binary expression that starts with
/// LHS and has a precedence of at least MinPrec.
Parser::OwningExprResult
Parser::ParseRHSOfBinaryExpression(OwningExprResult LHS, prec::Level MinPrec) {
ExprResult
Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) {
prec::Level NextTokPrec = getBinOpPrecedence(Tok.getKind(),
GreaterThanIsOperator,
getLang().CPlusPlus0x);
@ -290,7 +290,7 @@ Parser::ParseRHSOfBinaryExpression(OwningExprResult LHS, prec::Level MinPrec) {
ConsumeToken();
// Special case handling for the ternary operator.
OwningExprResult TernaryMiddle(true);
ExprResult TernaryMiddle(true);
if (NextTokPrec == prec::Conditional) {
if (Tok.isNot(tok::colon)) {
// Don't parse FOO:BAR as if it were a typo for FOO::BAR.
@ -357,7 +357,7 @@ Parser::ParseRHSOfBinaryExpression(OwningExprResult LHS, prec::Level MinPrec) {
// Therefore we need some special-casing here.
// Also note that the third operand of the conditional operator is
// an assignment-expression in C++.
OwningExprResult RHS;
ExprResult RHS;
if (getLang().CPlusPlus && NextTokPrec <= prec::Conditional)
RHS = ParseAssignmentExpression();
else
@ -421,11 +421,11 @@ Parser::ParseRHSOfBinaryExpression(OwningExprResult LHS, prec::Level MinPrec) {
/// id-expression that is the operand of address-of gets special treatment
/// due to member pointers.
///
Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
bool isAddressOfOperand,
ParsedType TypeOfCast) {
bool NotCastExpr;
OwningExprResult Res = ParseCastExpression(isUnaryExpression,
ExprResult Res = ParseCastExpression(isUnaryExpression,
isAddressOfOperand,
NotCastExpr,
TypeOfCast);
@ -545,11 +545,11 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
/// [GNU] binary-type-trait:
/// '__is_base_of' [TODO]
///
Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
bool isAddressOfOperand,
bool &NotCastExpr,
ParsedType TypeOfCast) {
OwningExprResult Res;
ExprResult Res;
tok::TokenKind SavedKind = Tok.getKind();
NotCastExpr = false;
@ -942,8 +942,8 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
/// argument-expression
/// argument-expression-list ',' assignment-expression
///
Parser::OwningExprResult
Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
ExprResult
Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
// Now that the primary-expression piece of the postfix-expression has been
// parsed, see if there are any postfix-expression pieces here.
SourceLocation Loc;
@ -963,7 +963,7 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
return move(LHS);
Loc = ConsumeBracket();
OwningExprResult Idx(ParseExpression());
ExprResult Idx(ParseExpression());
SourceLocation RLoc = Tok.getLocation();
@ -1105,7 +1105,7 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) {
/// typeof ( type-name )
/// [GNU/C++] typeof unary-expression
///
Parser::OwningExprResult
ExprResult
Parser::ParseExprAfterTypeofSizeofAlignof(const Token &OpTok,
bool &isCastExpr,
ParsedType &CastTy,
@ -1115,7 +1115,7 @@ Parser::ParseExprAfterTypeofSizeofAlignof(const Token &OpTok,
OpTok.is(tok::kw___alignof) || OpTok.is(tok::kw_alignof)) &&
"Not a typeof/sizeof/alignof expression!");
OwningExprResult Operand;
ExprResult Operand;
// If the operand doesn't start with an '(', it must be an expression.
if (Tok.isNot(tok::l_paren)) {
@ -1183,7 +1183,7 @@ Parser::ParseExprAfterTypeofSizeofAlignof(const Token &OpTok,
/// [GNU] '__alignof' unary-expression
/// [GNU] '__alignof' '(' type-name ')'
/// [C++0x] 'alignof' '(' type-id ')'
Parser::OwningExprResult Parser::ParseSizeofAlignofExpression() {
ExprResult Parser::ParseSizeofAlignofExpression() {
assert((Tok.is(tok::kw_sizeof) || Tok.is(tok::kw___alignof)
|| Tok.is(tok::kw_alignof)) &&
"Not a sizeof/alignof expression!");
@ -1193,7 +1193,7 @@ Parser::OwningExprResult Parser::ParseSizeofAlignofExpression() {
bool isCastExpr;
ParsedType CastTy;
SourceRange CastRange;
OwningExprResult Operand = ParseExprAfterTypeofSizeofAlignof(OpTok,
ExprResult Operand = ParseExprAfterTypeofSizeofAlignof(OpTok,
isCastExpr,
CastTy,
CastRange);
@ -1228,8 +1228,8 @@ Parser::OwningExprResult Parser::ParseSizeofAlignofExpression() {
/// [GNU] offsetof-member-designator '.' identifier
/// [GNU] offsetof-member-designator '[' expression ']'
///
Parser::OwningExprResult Parser::ParseBuiltinPrimaryExpression() {
OwningExprResult Res;
ExprResult Parser::ParseBuiltinPrimaryExpression() {
ExprResult Res;
const IdentifierInfo *BuiltinII = Tok.getIdentifierInfo();
tok::TokenKind T = Tok.getKind();
@ -1246,7 +1246,7 @@ Parser::OwningExprResult Parser::ParseBuiltinPrimaryExpression() {
switch (T) {
default: assert(0 && "Not a builtin primary expression!");
case tok::kw___builtin_va_arg: {
OwningExprResult Expr(ParseAssignmentExpression());
ExprResult Expr(ParseAssignmentExpression());
if (Expr.isInvalid()) {
SkipUntil(tok::r_paren);
return ExprError();
@ -1340,7 +1340,7 @@ Parser::OwningExprResult Parser::ParseBuiltinPrimaryExpression() {
break;
}
case tok::kw___builtin_choose_expr: {
OwningExprResult Cond(ParseAssignmentExpression());
ExprResult Cond(ParseAssignmentExpression());
if (Cond.isInvalid()) {
SkipUntil(tok::r_paren);
return move(Cond);
@ -1348,7 +1348,7 @@ Parser::OwningExprResult Parser::ParseBuiltinPrimaryExpression() {
if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
return ExprError();
OwningExprResult Expr1(ParseAssignmentExpression());
ExprResult Expr1(ParseAssignmentExpression());
if (Expr1.isInvalid()) {
SkipUntil(tok::r_paren);
return move(Expr1);
@ -1356,7 +1356,7 @@ Parser::OwningExprResult Parser::ParseBuiltinPrimaryExpression() {
if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
return ExprError();
OwningExprResult Expr2(ParseAssignmentExpression());
ExprResult Expr2(ParseAssignmentExpression());
if (Expr2.isInvalid()) {
SkipUntil(tok::r_paren);
return move(Expr2);
@ -1412,20 +1412,20 @@ Parser::OwningExprResult Parser::ParseBuiltinPrimaryExpression() {
/// cast-expression: [C99 6.5.4]
/// '(' type-name ')' cast-expression
///
Parser::OwningExprResult
ExprResult
Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
ParsedType TypeOfCast, ParsedType &CastTy,
SourceLocation &RParenLoc) {
assert(Tok.is(tok::l_paren) && "Not a paren expr!");
GreaterThanIsOperatorScope G(GreaterThanIsOperator, true);
SourceLocation OpenLoc = ConsumeParen();
OwningExprResult Result(true);
ExprResult Result(true);
bool isAmbiguousTypeId;
CastTy = ParsedType();
if (ExprType >= CompoundStmt && Tok.is(tok::l_brace)) {
Diag(Tok, diag::ext_gnu_statement_expr);
OwningStmtResult Stmt(ParseCompoundStatement(0, true));
StmtResult Stmt(ParseCompoundStatement(0, true));
ExprType = CompoundStmt;
// If the substmt parsed correctly, build the AST node.
@ -1470,7 +1470,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
// Note that this doesn't parse the subsequent cast-expression, it just
// returns the parsed type to the callee.
if (stopIfCastExpr)
return OwningExprResult();
return ExprResult();
// Reject the cast of super idiom in ObjC.
if (Tok.is(tok::identifier) && getLang().ObjC1 &&
@ -1531,14 +1531,14 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
/// '(' type-name ')' '{' initializer-list '}'
/// '(' type-name ')' '{' initializer-list ',' '}'
///
Parser::OwningExprResult
ExprResult
Parser::ParseCompoundLiteralExpression(ParsedType Ty,
SourceLocation LParenLoc,
SourceLocation RParenLoc) {
assert(Tok.is(tok::l_brace) && "Not a compound literal!");
if (!getLang().C99) // Compound literals don't exist in C90.
Diag(LParenLoc, diag::ext_c99_compound_literal);
OwningExprResult Result = ParseInitializer();
ExprResult Result = ParseInitializer();
if (!Result.isInvalid() && Ty)
return Actions.ActOnCompoundLiteral(LParenLoc, Ty, RParenLoc, Result.take());
return move(Result);
@ -1550,7 +1550,7 @@ Parser::ParseCompoundLiteralExpression(ParsedType Ty,
///
/// primary-expression: [C99 6.5.1]
/// string-literal
Parser::OwningExprResult Parser::ParseStringLiteralExpression() {
ExprResult Parser::ParseStringLiteralExpression() {
assert(isTokenStringLiteral() && "Not a string literal!");
// String concat. Note that keywords like __func__ and __FUNCTION__ are not
@ -1590,7 +1590,7 @@ bool Parser::ParseExpressionList(llvm::SmallVectorImpl<Expr*> &Exprs,
ConsumeCodeCompletionToken();
}
OwningExprResult Expr(ParseAssignmentExpression());
ExprResult Expr(ParseAssignmentExpression());
if (Expr.isInvalid())
return true;
@ -1640,7 +1640,7 @@ void Parser::ParseBlockId() {
/// [clang] block-args:
/// [clang] '(' parameter-list ')'
///
Parser::OwningExprResult Parser::ParseBlockLiteralExpression() {
ExprResult Parser::ParseBlockLiteralExpression() {
assert(Tok.is(tok::caret) && "block literal starts with ^");
SourceLocation CaretLoc = ConsumeToken();
@ -1715,7 +1715,7 @@ Parser::OwningExprResult Parser::ParseBlockLiteralExpression() {
}
OwningExprResult Result(true);
ExprResult Result(true);
if (!Tok.is(tok::l_brace)) {
// Saw something like: ^expr
Diag(Tok, diag::err_expected_expression);
@ -1723,7 +1723,7 @@ Parser::OwningExprResult Parser::ParseBlockLiteralExpression() {
return ExprError();
}
OwningStmtResult Stmt(ParseCompoundStatementBody());
StmtResult Stmt(ParseCompoundStatementBody());
if (!Stmt.isInvalid())
Result = Actions.ActOnBlockStmtExpr(CaretLoc, Stmt.take(), getCurScope());
else

View File

@ -397,7 +397,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS,
/// the only place where a qualified-id naming a non-static class member may
/// appear.
///
Parser::OwningExprResult Parser::ParseCXXIdExpression(bool isAddressOfOperand) {
ExprResult Parser::ParseCXXIdExpression(bool isAddressOfOperand) {
// qualified-id:
// '::'[opt] nested-name-specifier 'template'[opt] unqualified-id
// '::' unqualified-id
@ -446,7 +446,7 @@ Parser::OwningExprResult Parser::ParseCXXIdExpression(bool isAddressOfOperand) {
/// 'reinterpret_cast' '<' type-name '>' '(' expression ')'
/// 'const_cast' '<' type-name '>' '(' expression ')'
///
Parser::OwningExprResult Parser::ParseCXXCasts() {
ExprResult Parser::ParseCXXCasts() {
tok::TokenKind Kind = Tok.getKind();
const char *CastName = 0; // For error messages
@ -475,7 +475,7 @@ Parser::OwningExprResult Parser::ParseCXXCasts() {
if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after, CastName))
return ExprError();
OwningExprResult Result = ParseExpression();
ExprResult Result = ParseExpression();
// Match the ')'.
RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
@ -495,7 +495,7 @@ Parser::OwningExprResult Parser::ParseCXXCasts() {
/// 'typeid' '(' expression ')'
/// 'typeid' '(' type-id ')'
///
Parser::OwningExprResult Parser::ParseCXXTypeid() {
ExprResult Parser::ParseCXXTypeid() {
assert(Tok.is(tok::kw_typeid) && "Not 'typeid'!");
SourceLocation OpLoc = ConsumeToken();
@ -507,7 +507,7 @@ Parser::OwningExprResult Parser::ParseCXXTypeid() {
"typeid"))
return ExprError();
OwningExprResult Result;
ExprResult Result;
if (isTypeIdInParens()) {
TypeResult Ty = ParseTypeName();
@ -561,7 +561,7 @@ Parser::OwningExprResult Parser::ParseCXXTypeid() {
/// ~type-name
/// ::[opt] nested-name-specifier[opt] ~type-name
///
Parser::OwningExprResult
ExprResult
Parser::ParseCXXPseudoDestructor(ExprArg Base, SourceLocation OpLoc,
tok::TokenKind OpKind,
CXXScopeSpec &SS,
@ -625,7 +625,7 @@ Parser::ParseCXXPseudoDestructor(ExprArg Base, SourceLocation OpLoc,
/// boolean-literal: [C++ 2.13.5]
/// 'true'
/// 'false'
Parser::OwningExprResult Parser::ParseCXXBoolLiteral() {
ExprResult Parser::ParseCXXBoolLiteral() {
tok::TokenKind Kind = Tok.getKind();
return Actions.ActOnCXXBoolLiteral(ConsumeToken(), Kind);
}
@ -634,7 +634,7 @@ Parser::OwningExprResult Parser::ParseCXXBoolLiteral() {
///
/// throw-expression: [C++ 15]
/// 'throw' assignment-expression[opt]
Parser::OwningExprResult Parser::ParseThrowExpression() {
ExprResult Parser::ParseThrowExpression() {
assert(Tok.is(tok::kw_throw) && "Not throw!");
SourceLocation ThrowLoc = ConsumeToken(); // Eat the throw token.
@ -651,7 +651,7 @@ Parser::OwningExprResult Parser::ParseThrowExpression() {
return Actions.ActOnCXXThrow(ThrowLoc, 0);
default:
OwningExprResult Expr(ParseAssignmentExpression());
ExprResult Expr(ParseAssignmentExpression());
if (Expr.isInvalid()) return move(Expr);
return Actions.ActOnCXXThrow(ThrowLoc, Expr.take());
}
@ -662,7 +662,7 @@ Parser::OwningExprResult Parser::ParseThrowExpression() {
/// C++ 9.3.2: In the body of a non-static member function, the keyword this is
/// a non-lvalue expression whose value is the address of the object for which
/// the function is called.
Parser::OwningExprResult Parser::ParseCXXThis() {
ExprResult Parser::ParseCXXThis() {
assert(Tok.is(tok::kw_this) && "Not 'this'!");
SourceLocation ThisLoc = ConsumeToken();
return Actions.ActOnCXXThis(ThisLoc);
@ -677,7 +677,7 @@ Parser::OwningExprResult Parser::ParseCXXThis() {
/// simple-type-specifier '(' expression-list[opt] ')' [C++ 5.2.3]
/// typename-specifier '(' expression-list[opt] ')' [TODO]
///
Parser::OwningExprResult
ExprResult
Parser::ParseCXXTypeConstructExpression(const DeclSpec &DS) {
Declarator DeclaratorInfo(DS, Declarator::TypeNameContext);
ParsedType TypeRep = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get();
@ -730,8 +730,8 @@ Parser::ParseCXXTypeConstructExpression(const DeclSpec &DS) {
/// converted to a boolean value.
///
/// \returns true if there was a parsing, false otherwise.
bool Parser::ParseCXXCondition(OwningExprResult &ExprResult,
Decl *&DeclResult,
bool Parser::ParseCXXCondition(ExprResult &ExprOut,
Decl *&DeclOut,
SourceLocation Loc,
bool ConvertToBoolean) {
if (Tok.is(tok::code_completion)) {
@ -741,16 +741,16 @@ bool Parser::ParseCXXCondition(OwningExprResult &ExprResult,
if (!isCXXConditionDeclaration()) {
// Parse the expression.
ExprResult = ParseExpression(); // expression
DeclResult = 0;
if (ExprResult.isInvalid())
ExprOut = ParseExpression(); // expression
DeclOut = 0;
if (ExprOut.isInvalid())
return true;
// If required, convert to a boolean value.
if (ConvertToBoolean)
ExprResult
= Actions.ActOnBooleanCondition(getCurScope(), Loc, ExprResult.take());
return ExprResult.isInvalid();
ExprOut
= Actions.ActOnBooleanCondition(getCurScope(), Loc, ExprOut.get());
return ExprOut.isInvalid();
}
// type-specifier-seq
@ -764,7 +764,7 @@ bool Parser::ParseCXXCondition(OwningExprResult &ExprResult,
// simple-asm-expr[opt]
if (Tok.is(tok::kw_asm)) {
SourceLocation Loc;
OwningExprResult AsmLabel(ParseSimpleAsm(&Loc));
ExprResult AsmLabel(ParseSimpleAsm(&Loc));
if (AsmLabel.isInvalid()) {
SkipUntil(tok::semi);
return true;
@ -781,17 +781,17 @@ bool Parser::ParseCXXCondition(OwningExprResult &ExprResult,
}
// Type-check the declaration itself.
Action::DeclResult Dcl = Actions.ActOnCXXConditionDeclaration(getCurScope(),
DeclResult Dcl = Actions.ActOnCXXConditionDeclaration(getCurScope(),
DeclaratorInfo);
DeclResult = Dcl.get();
ExprResult = ExprError();
DeclOut = Dcl.get();
ExprOut = ExprError();
// '=' assignment-expression
if (Tok.is(tok::equal)) {
SourceLocation EqualLoc = ConsumeToken();
OwningExprResult AssignExpr(ParseAssignmentExpression());
ExprResult AssignExpr(ParseAssignmentExpression());
if (!AssignExpr.isInvalid())
Actions.AddInitializerToDecl(DeclResult, AssignExpr.take());
Actions.AddInitializerToDecl(DeclOut, AssignExpr.take());
} else {
// FIXME: C++0x allows a braced-init-list
Diag(Tok, diag::err_expected_equal_after_declarator);
@ -1566,7 +1566,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext,
/// '(' expression-list[opt] ')'
/// [C++0x] braced-init-list [TODO]
///
Parser::OwningExprResult
ExprResult
Parser::ParseCXXNewExpression(bool UseGlobal, SourceLocation Start) {
assert(Tok.is(tok::kw_new) && "expected 'new' token");
ConsumeToken(); // Consume 'new'
@ -1670,7 +1670,7 @@ void Parser::ParseDirectNewDeclarator(Declarator &D) {
bool first = true;
while (Tok.is(tok::l_square)) {
SourceLocation LLoc = ConsumeBracket();
OwningExprResult Size(first ? ParseExpression()
ExprResult Size(first ? ParseExpression()
: ParseConstantExpression());
if (Size.isInvalid()) {
// Recover
@ -1727,7 +1727,7 @@ bool Parser::ParseExpressionListOrTypeId(
/// delete-expression:
/// '::'[opt] 'delete' cast-expression
/// '::'[opt] 'delete' '[' ']' cast-expression
Parser::OwningExprResult
ExprResult
Parser::ParseCXXDeleteExpression(bool UseGlobal, SourceLocation Start) {
assert(Tok.is(tok::kw_delete) && "Expected 'delete' keyword");
ConsumeToken(); // Consume 'delete'
@ -1742,7 +1742,7 @@ Parser::ParseCXXDeleteExpression(bool UseGlobal, SourceLocation Start) {
return ExprError();
}
OwningExprResult Operand(ParseCastExpression(false));
ExprResult Operand(ParseCastExpression(false));
if (Operand.isInvalid())
return move(Operand);
@ -1778,7 +1778,7 @@ static UnaryTypeTrait UnaryTypeTraitFromTokKind(tok::TokenKind kind) {
/// primary-expression:
/// [GNU] unary-type-trait '(' type-id ')'
///
Parser::OwningExprResult Parser::ParseUnaryTypeTrait() {
ExprResult Parser::ParseUnaryTypeTrait() {
UnaryTypeTrait UTT = UnaryTypeTraitFromTokKind(Tok.getKind());
SourceLocation Loc = ConsumeToken();
@ -1802,7 +1802,7 @@ Parser::OwningExprResult Parser::ParseUnaryTypeTrait() {
/// ParseCXXAmbiguousParenExpression - We have parsed the left paren of a
/// parenthesized ambiguous type-id. This uses tentative parsing to disambiguate
/// based on the context past the parens.
Parser::OwningExprResult
ExprResult
Parser::ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType,
ParsedType &CastTy,
SourceLocation LParenLoc,
@ -1811,7 +1811,7 @@ Parser::ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType,
assert(ExprType == CastExpr && "Compound literals are not ambiguous!");
assert(isTypeIdInParens() && "Not a type-id!");
OwningExprResult Result(true);
ExprResult Result(true);
CastTy = ParsedType();
// We need to disambiguate a very ugly part of the C++ syntax:

View File

@ -71,7 +71,7 @@ static void CheckArrayDesignatorSyntax(Parser &P, SourceLocation Loc,
/// initializer (because it is an expression). We need to consider this case
/// when parsing array designators.
///
Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() {
ExprResult Parser::ParseInitializerWithPotentialDesignator() {
// If this is the old-style GNU extension:
// designation ::= identifier ':'
@ -137,7 +137,7 @@ Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() {
// [4][foo bar] -> obsolete GNU designation with objc message send.
//
SourceLocation StartLoc = ConsumeBracket();
OwningExprResult Idx;
ExprResult Idx;
// If Objective-C is enabled and this is a typename (class message
// send) or send to 'super', parse this as a message send
@ -176,7 +176,7 @@ Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() {
// whether we have a message send or an array designator; just
// adopt the expression for further analysis below.
// FIXME: potentially-potentially evaluated expression above?
Idx = OwningExprResult(static_cast<Expr*>(TypeOrExpr));
Idx = ExprResult(static_cast<Expr*>(TypeOrExpr));
} else if (getLang().ObjC1 && Tok.is(tok::identifier)) {
IdentifierInfo *II = Tok.getIdentifierInfo();
SourceLocation IILoc = Tok.getLocation();
@ -252,7 +252,7 @@ Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() {
Diag(Tok, diag::ext_gnu_array_range);
SourceLocation EllipsisLoc = ConsumeToken();
OwningExprResult RHS(ParseConstantExpression());
ExprResult RHS(ParseConstantExpression());
if (RHS.isInvalid()) {
SkipUntil(tok::r_square);
return move(RHS);
@ -309,7 +309,7 @@ Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() {
/// designation[opt] initializer
/// initializer-list ',' designation[opt] initializer
///
Parser::OwningExprResult Parser::ParseBraceInitializer() {
ExprResult Parser::ParseBraceInitializer() {
SourceLocation LBraceLoc = ConsumeBrace();
/// InitExprs - This is the actual list of expressions contained in the
@ -332,7 +332,7 @@ Parser::OwningExprResult Parser::ParseBraceInitializer() {
// If we know that this cannot be a designation, just parse the nested
// initializer directly.
OwningExprResult SubElt;
ExprResult SubElt;
if (MayBeDesignationStart(Tok.getKind(), PP))
SubElt = ParseInitializerWithPotentialDesignator();
else

View File

@ -1463,8 +1463,8 @@ Decl *Parser::ParseObjCPropertyDynamic(SourceLocation atLoc) {
/// objc-throw-statement:
/// throw expression[opt];
///
Parser::OwningStmtResult Parser::ParseObjCThrowStmt(SourceLocation atLoc) {
OwningExprResult Res;
StmtResult Parser::ParseObjCThrowStmt(SourceLocation atLoc) {
ExprResult Res;
ConsumeToken(); // consume throw
if (Tok.isNot(tok::semi)) {
Res = ParseExpression();
@ -1481,7 +1481,7 @@ Parser::OwningStmtResult Parser::ParseObjCThrowStmt(SourceLocation atLoc) {
/// objc-synchronized-statement:
/// @synchronized '(' expression ')' compound-statement
///
Parser::OwningStmtResult
StmtResult
Parser::ParseObjCSynchronizedStmt(SourceLocation atLoc) {
ConsumeToken(); // consume synchronized
if (Tok.isNot(tok::l_paren)) {
@ -1489,7 +1489,7 @@ Parser::ParseObjCSynchronizedStmt(SourceLocation atLoc) {
return StmtError();
}
ConsumeParen(); // '('
OwningExprResult Res(ParseExpression());
ExprResult Res(ParseExpression());
if (Res.isInvalid()) {
SkipUntil(tok::semi);
return StmtError();
@ -1507,7 +1507,7 @@ Parser::ParseObjCSynchronizedStmt(SourceLocation atLoc) {
// statements can always hold declarations.
ParseScope BodyScope(this, Scope::DeclScope);
OwningStmtResult SynchBody(ParseCompoundStatementBody());
StmtResult SynchBody(ParseCompoundStatementBody());
BodyScope.Exit();
if (SynchBody.isInvalid())
@ -1526,7 +1526,7 @@ Parser::ParseObjCSynchronizedStmt(SourceLocation atLoc) {
/// parameter-declaration
/// '...' [OBJC2]
///
Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
bool catch_or_finally_seen = false;
ConsumeToken(); // consume try
@ -1535,9 +1535,9 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
return StmtError();
}
StmtVector CatchStmts(Actions);
OwningStmtResult FinallyStmt;
StmtResult FinallyStmt;
ParseScope TryScope(this, Scope::DeclScope);
OwningStmtResult TryBody(ParseCompoundStatementBody());
StmtResult TryBody(ParseCompoundStatementBody());
TryScope.Exit();
if (TryBody.isInvalid())
TryBody = Actions.ActOnNullStmt(Tok.getLocation());
@ -1580,7 +1580,7 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
else // Skip over garbage, until we get to ')'. Eat the ')'.
SkipUntil(tok::r_paren, true, false);
OwningStmtResult CatchBody(true);
StmtResult CatchBody(true);
if (Tok.is(tok::l_brace))
CatchBody = ParseCompoundStatementBody();
else
@ -1588,7 +1588,7 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
if (CatchBody.isInvalid())
CatchBody = Actions.ActOnNullStmt(Tok.getLocation());
OwningStmtResult Catch = Actions.ActOnObjCAtCatchStmt(AtCatchFinallyLoc,
StmtResult Catch = Actions.ActOnObjCAtCatchStmt(AtCatchFinallyLoc,
RParenLoc,
FirstPart,
CatchBody.take());
@ -1606,7 +1606,7 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
ConsumeToken(); // consume finally
ParseScope FinallyScope(this, Scope::DeclScope);
OwningStmtResult FinallyBody(true);
StmtResult FinallyBody(true);
if (Tok.is(tok::l_brace))
FinallyBody = ParseCompoundStatementBody();
else
@ -1668,7 +1668,7 @@ Decl *Parser::ParseObjCMethodDefinition() {
// specified Declarator for the method.
Actions.ActOnStartOfObjCMethodDef(getCurScope(), MDecl);
OwningStmtResult FnBody(ParseCompoundStatementBody());
StmtResult FnBody(ParseCompoundStatementBody());
// If the function body could not be parsed, make a bogus compoundstmt.
if (FnBody.isInvalid())
@ -1684,7 +1684,7 @@ Decl *Parser::ParseObjCMethodDefinition() {
return MDecl;
}
Parser::OwningStmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) {
StmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) {
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCAtStatement(getCurScope());
ConsumeCodeCompletionToken();
@ -1700,7 +1700,7 @@ Parser::OwningStmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) {
if (Tok.isObjCAtKeyword(tok::objc_synchronized))
return ParseObjCSynchronizedStmt(AtLoc);
OwningExprResult Res(ParseExpressionWithLeadingAt(AtLoc));
ExprResult Res(ParseExpressionWithLeadingAt(AtLoc));
if (Res.isInvalid()) {
// If the expression is invalid, skip ahead to the next semicolon. Not
// doing this opens us up to the possibility of infinite loops if
@ -1714,7 +1714,7 @@ Parser::OwningStmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) {
return Actions.ActOnExprStmt(Actions.MakeFullExpr(Res.take()));
}
Parser::OwningExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) {
ExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) {
switch (Tok.getKind()) {
case tok::code_completion:
Actions.CodeCompleteObjCAtExpression(getCurScope());
@ -1771,7 +1771,7 @@ bool Parser::ParseObjCXXMessageReceiver(bool &IsExpr, void *&TypeOrExpr) {
if (!isCXXSimpleTypeSpecifier()) {
// objc-receiver:
// expression
OwningExprResult Receiver = ParseExpression();
ExprResult Receiver = ParseExpression();
if (Receiver.isInvalid())
return true;
@ -1800,7 +1800,7 @@ bool Parser::ParseObjCXXMessageReceiver(bool &IsExpr, void *&TypeOrExpr) {
// postfix-expression suffix, followed by the (optional)
// right-hand side of the binary expression. We have an
// instance method.
OwningExprResult Receiver = ParseCXXTypeConstructExpression(DS);
ExprResult Receiver = ParseCXXTypeConstructExpression(DS);
if (!Receiver.isInvalid())
Receiver = ParsePostfixExpressionSuffix(Receiver.take());
if (!Receiver.isInvalid())
@ -1847,7 +1847,7 @@ bool Parser::isSimpleObjCMessageExpression() {
/// class-name
/// type-name
///
Parser::OwningExprResult Parser::ParseObjCMessageExpression() {
ExprResult Parser::ParseObjCMessageExpression() {
assert(Tok.is(tok::l_square) && "'[' expected");
SourceLocation LBracLoc = ConsumeBracket(); // consume '['
@ -1918,7 +1918,7 @@ Parser::OwningExprResult Parser::ParseObjCMessageExpression() {
}
// Otherwise, an arbitrary expression can be the receiver of a send.
OwningExprResult Res(ParseExpression());
ExprResult Res(ParseExpression());
if (Res.isInvalid()) {
SkipUntil(tok::r_square);
return move(Res);
@ -1966,7 +1966,7 @@ Parser::OwningExprResult Parser::ParseObjCMessageExpression() {
/// assignment-expression
/// nonempty-expr-list , assignment-expression
///
Parser::OwningExprResult
ExprResult
Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
SourceLocation SuperLoc,
ParsedType ReceiverType,
@ -2007,7 +2007,7 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
ConsumeToken(); // Eat the ':'.
/// Parse the expression after ':'
OwningExprResult Res(ParseAssignmentExpression());
ExprResult Res(ParseAssignmentExpression());
if (Res.isInvalid()) {
// We must manually skip to a ']', otherwise the expression skipper will
// stop at the ']' when it skips to the ';'. We want it to skip beyond
@ -2046,7 +2046,7 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
while (Tok.is(tok::comma)) {
ConsumeToken(); // Eat the ','.
/// Parse the expression after ','
OwningExprResult Res(ParseAssignmentExpression());
ExprResult Res(ParseAssignmentExpression());
if (Res.isInvalid()) {
// We must manually skip to a ']', otherwise the expression skipper will
// stop at the ']' when it skips to the ';'. We want it to skip beyond
@ -2106,8 +2106,8 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
KeyExprs.size()));
}
Parser::OwningExprResult Parser::ParseObjCStringLiteral(SourceLocation AtLoc) {
OwningExprResult Res(ParseStringLiteralExpression());
ExprResult Parser::ParseObjCStringLiteral(SourceLocation AtLoc) {
ExprResult Res(ParseStringLiteralExpression());
if (Res.isInvalid()) return move(Res);
// @"foo" @"bar" is a valid concatenated string. Eat any subsequent string
@ -2125,7 +2125,7 @@ Parser::OwningExprResult Parser::ParseObjCStringLiteral(SourceLocation AtLoc) {
if (!isTokenStringLiteral())
return ExprError(Diag(Tok, diag::err_objc_concat_string));
OwningExprResult Lit(ParseStringLiteralExpression());
ExprResult Lit(ParseStringLiteralExpression());
if (Lit.isInvalid())
return move(Lit);
@ -2138,7 +2138,7 @@ Parser::OwningExprResult Parser::ParseObjCStringLiteral(SourceLocation AtLoc) {
/// objc-encode-expression:
/// @encode ( type-name )
Parser::OwningExprResult
ExprResult
Parser::ParseObjCEncodeExpression(SourceLocation AtLoc) {
assert(Tok.isObjCAtKeyword(tok::objc_encode) && "Not an @encode expression!");
@ -2162,7 +2162,7 @@ Parser::ParseObjCEncodeExpression(SourceLocation AtLoc) {
/// objc-protocol-expression
/// @protocol ( protocol-name )
Parser::OwningExprResult
ExprResult
Parser::ParseObjCProtocolExpression(SourceLocation AtLoc) {
SourceLocation ProtoLoc = ConsumeToken();
@ -2185,8 +2185,7 @@ Parser::ParseObjCProtocolExpression(SourceLocation AtLoc) {
/// objc-selector-expression
/// @selector '(' objc-keyword-selector ')'
Parser::OwningExprResult
Parser::ParseObjCSelectorExpression(SourceLocation AtLoc) {
ExprResult Parser::ParseObjCSelectorExpression(SourceLocation AtLoc) {
SourceLocation SelectorLoc = ConsumeToken();
if (Tok.isNot(tok::l_paren))

View File

@ -87,7 +87,7 @@ void PragmaPackHandler::HandlePragma(Preprocessor &PP, Token &PackTok) {
Action::PragmaPackKind Kind = Action::PPK_Default;
IdentifierInfo *Name = 0;
Action::OwningExprResult Alignment;
ExprResult Alignment;
SourceLocation LParenLoc = Tok.getLocation();
PP.Lex(Tok);
if (Tok.is(tok::numeric_constant)) {

View File

@ -73,10 +73,10 @@ using namespace clang;
/// [OBC] '@' 'throw' expression ';'
/// [OBC] '@' 'throw' ';'
///
Parser::OwningStmtResult
StmtResult
Parser::ParseStatementOrDeclaration(bool OnlyStatement) {
const char *SemiError = 0;
OwningStmtResult Res;
StmtResult Res;
ParenBraceBracketBalancer BalancerRAIIObj(*this);
@ -125,7 +125,7 @@ Parser::ParseStatementOrDeclaration(bool OnlyStatement) {
// FIXME: Use the attributes
// expression[opt] ';'
OwningExprResult Expr(ParseExpression());
ExprResult Expr(ParseExpression());
if (Expr.isInvalid()) {
// If the expression is invalid, skip ahead to the next semicolon or '}'.
// Not doing this opens us up to the possibility of infinite loops if
@ -217,7 +217,7 @@ Parser::ParseStatementOrDeclaration(bool OnlyStatement) {
/// identifier ':' statement
/// [GNU] identifier ':' attributes[opt] statement
///
Parser::OwningStmtResult Parser::ParseLabeledStatement(AttributeList *Attr) {
StmtResult Parser::ParseLabeledStatement(AttributeList *Attr) {
assert(Tok.is(tok::identifier) && Tok.getIdentifierInfo() &&
"Not an identifier!");
@ -234,7 +234,7 @@ Parser::OwningStmtResult Parser::ParseLabeledStatement(AttributeList *Attr) {
if (Tok.is(tok::kw___attribute))
AttrList.reset(addAttributeLists(AttrList.take(), ParseGNUAttributes()));
OwningStmtResult SubStmt(ParseStatement());
StmtResult SubStmt(ParseStatement());
// Broken substmt shouldn't prevent the label from being added to the AST.
if (SubStmt.isInvalid())
@ -251,7 +251,7 @@ Parser::OwningStmtResult Parser::ParseLabeledStatement(AttributeList *Attr) {
/// 'case' constant-expression ':' statement
/// [GNU] 'case' constant-expression '...' constant-expression ':' statement
///
Parser::OwningStmtResult Parser::ParseCaseStatement(AttributeList *Attr) {
StmtResult Parser::ParseCaseStatement(AttributeList *Attr) {
assert(Tok.is(tok::kw_case) && "Not a case stmt!");
// FIXME: Use attributes?
delete Attr;
@ -272,7 +272,7 @@ Parser::OwningStmtResult Parser::ParseCaseStatement(AttributeList *Attr) {
// TopLevelCase - This is the highest level we have parsed. 'case 1' in the
// example above.
OwningStmtResult TopLevelCase(true);
StmtResult TopLevelCase(true);
// DeepestParsedCaseStmt - This is the deepest statement we have parsed, which
// gets updated each time a new case is parsed, and whose body is unset so
@ -293,7 +293,7 @@ Parser::OwningStmtResult Parser::ParseCaseStatement(AttributeList *Attr) {
/// expression.
ColonProtectionRAIIObject ColonProtection(*this);
OwningExprResult LHS(ParseConstantExpression());
ExprResult LHS(ParseConstantExpression());
if (LHS.isInvalid()) {
SkipUntil(tok::colon);
return StmtError();
@ -301,7 +301,7 @@ Parser::OwningStmtResult Parser::ParseCaseStatement(AttributeList *Attr) {
// GNU case range extension.
SourceLocation DotDotDotLoc;
OwningExprResult RHS;
ExprResult RHS;
if (Tok.is(tok::ellipsis)) {
Diag(Tok, diag::ext_gnu_case_range);
DotDotDotLoc = ConsumeToken();
@ -323,7 +323,7 @@ Parser::OwningStmtResult Parser::ParseCaseStatement(AttributeList *Attr) {
SourceLocation ColonLoc = ConsumeToken();
OwningStmtResult Case =
StmtResult Case =
Actions.ActOnCaseStmt(CaseLoc, LHS.get(), DotDotDotLoc,
RHS.get(), ColonLoc);
@ -350,7 +350,7 @@ Parser::OwningStmtResult Parser::ParseCaseStatement(AttributeList *Attr) {
assert(!TopLevelCase.isInvalid() && "Should have parsed at least one case!");
// If we found a non-case statement, start by parsing it.
OwningStmtResult SubStmt;
StmtResult SubStmt;
if (Tok.isNot(tok::r_brace)) {
SubStmt = ParseStatement();
@ -378,7 +378,7 @@ Parser::OwningStmtResult Parser::ParseCaseStatement(AttributeList *Attr) {
/// 'default' ':' statement
/// Note that this does not parse the 'statement' at the end.
///
Parser::OwningStmtResult Parser::ParseDefaultStatement(AttributeList *Attr) {
StmtResult Parser::ParseDefaultStatement(AttributeList *Attr) {
//FIXME: Use attributes?
delete Attr;
@ -399,7 +399,7 @@ Parser::OwningStmtResult Parser::ParseDefaultStatement(AttributeList *Attr) {
return StmtError();
}
OwningStmtResult SubStmt(ParseStatement());
StmtResult SubStmt(ParseStatement());
if (SubStmt.isInvalid())
return StmtError();
@ -435,7 +435,7 @@ Parser::OwningStmtResult Parser::ParseDefaultStatement(AttributeList *Attr) {
/// [OMP] barrier-directive
/// [OMP] flush-directive
///
Parser::OwningStmtResult Parser::ParseCompoundStatement(AttributeList *Attr,
StmtResult Parser::ParseCompoundStatement(AttributeList *Attr,
bool isStmtExpr) {
//FIXME: Use attributes?
delete Attr;
@ -455,7 +455,7 @@ Parser::OwningStmtResult Parser::ParseCompoundStatement(AttributeList *Attr,
/// ActOnCompoundStmt action. This expects the '{' to be the current token, and
/// consume the '}' at the end of the block. It does not manipulate the scope
/// stack.
Parser::OwningStmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
PrettyStackTraceLoc CrashInfo(PP.getSourceManager(),
Tok.getLocation(),
"in compound statement ('{}')");
@ -468,7 +468,7 @@ Parser::OwningStmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
typedef StmtVector StmtsTy;
StmtsTy Stmts(Actions);
while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
OwningStmtResult R;
StmtResult R;
if (Tok.isNot(tok::kw___extension__)) {
R = ParseStatementOrDeclaration(false);
} else {
@ -496,7 +496,7 @@ Parser::OwningStmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
R = Actions.ActOnDeclStmt(Res, DeclStart, DeclEnd);
} else {
// Otherwise this was a unary __extension__ marker.
OwningExprResult Res(ParseExpressionWithLeadingExtension(ExtLoc));
ExprResult Res(ParseExpressionWithLeadingExtension(ExtLoc));
if (Res.isInvalid()) {
SkipUntil(tok::semi);
@ -537,7 +537,7 @@ Parser::OwningStmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
/// should try to recover harder. It returns false if the condition is
/// successfully parsed. Note that a successful parse can still have semantic
/// errors in the condition.
bool Parser::ParseParenExprOrCondition(OwningExprResult &ExprResult,
bool Parser::ParseParenExprOrCondition(ExprResult &ExprResult,
Decl *&DeclResult,
SourceLocation Loc,
bool ConvertToBoolean) {
@ -581,7 +581,7 @@ bool Parser::ParseParenExprOrCondition(OwningExprResult &ExprResult,
/// [C++] 'if' '(' condition ')' statement
/// [C++] 'if' '(' condition ')' statement 'else' statement
///
Parser::OwningStmtResult Parser::ParseIfStatement(AttributeList *Attr) {
StmtResult Parser::ParseIfStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
@ -611,7 +611,7 @@ Parser::OwningStmtResult Parser::ParseIfStatement(AttributeList *Attr) {
ParseScope IfScope(this, Scope::DeclScope | Scope::ControlScope, C99orCXX);
// Parse the condition.
OwningExprResult CondExp;
ExprResult CondExp;
Decl *CondVar = 0;
if (ParseParenExprOrCondition(CondExp, CondVar, IfLoc, true))
return StmtError();
@ -641,7 +641,7 @@ Parser::OwningStmtResult Parser::ParseIfStatement(AttributeList *Attr) {
// Read the 'then' stmt.
SourceLocation ThenStmtLoc = Tok.getLocation();
OwningStmtResult ThenStmt(ParseStatement());
StmtResult ThenStmt(ParseStatement());
// Pop the 'if' scope if needed.
InnerScope.Exit();
@ -649,7 +649,7 @@ Parser::OwningStmtResult Parser::ParseIfStatement(AttributeList *Attr) {
// If it has an else, parse it.
SourceLocation ElseLoc;
SourceLocation ElseStmtLoc;
OwningStmtResult ElseStmt;
StmtResult ElseStmt;
if (Tok.is(tok::kw_else)) {
ElseLoc = ConsumeToken();
@ -704,7 +704,7 @@ Parser::OwningStmtResult Parser::ParseIfStatement(AttributeList *Attr) {
/// switch-statement:
/// 'switch' '(' expression ')' statement
/// [C++] 'switch' '(' condition ')' statement
Parser::OwningStmtResult Parser::ParseSwitchStatement(AttributeList *Attr) {
StmtResult Parser::ParseSwitchStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
@ -737,12 +737,12 @@ Parser::OwningStmtResult Parser::ParseSwitchStatement(AttributeList *Attr) {
ParseScope SwitchScope(this, ScopeFlags);
// Parse the condition.
OwningExprResult Cond;
ExprResult Cond;
Decl *CondVar = 0;
if (ParseParenExprOrCondition(Cond, CondVar, SwitchLoc, false))
return StmtError();
OwningStmtResult Switch
StmtResult Switch
= Actions.ActOnStartOfSwitchStmt(SwitchLoc, Cond.get(), CondVar);
if (Switch.isInvalid()) {
@ -773,7 +773,7 @@ Parser::OwningStmtResult Parser::ParseSwitchStatement(AttributeList *Attr) {
C99orCXX && Tok.isNot(tok::l_brace));
// Read the body statement.
OwningStmtResult Body(ParseStatement());
StmtResult Body(ParseStatement());
// Pop the scopes.
InnerScope.Exit();
@ -790,7 +790,7 @@ Parser::OwningStmtResult Parser::ParseSwitchStatement(AttributeList *Attr) {
/// while-statement: [C99 6.8.5.1]
/// 'while' '(' expression ')' statement
/// [C++] 'while' '(' condition ')' statement
Parser::OwningStmtResult Parser::ParseWhileStatement(AttributeList *Attr) {
StmtResult Parser::ParseWhileStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
@ -827,7 +827,7 @@ Parser::OwningStmtResult Parser::ParseWhileStatement(AttributeList *Attr) {
ParseScope WhileScope(this, ScopeFlags);
// Parse the condition.
OwningExprResult Cond;
ExprResult Cond;
Decl *CondVar = 0;
if (ParseParenExprOrCondition(Cond, CondVar, WhileLoc, true))
return StmtError();
@ -849,7 +849,7 @@ Parser::OwningStmtResult Parser::ParseWhileStatement(AttributeList *Attr) {
C99orCXX && Tok.isNot(tok::l_brace));
// Read the body statement.
OwningStmtResult Body(ParseStatement());
StmtResult Body(ParseStatement());
// Pop the body scope if needed.
InnerScope.Exit();
@ -865,7 +865,7 @@ Parser::OwningStmtResult Parser::ParseWhileStatement(AttributeList *Attr) {
/// do-statement: [C99 6.8.5.2]
/// 'do' statement 'while' '(' expression ')' ';'
/// Note: this lets the caller parse the end ';'.
Parser::OwningStmtResult Parser::ParseDoStatement(AttributeList *Attr) {
StmtResult Parser::ParseDoStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
@ -895,7 +895,7 @@ Parser::OwningStmtResult Parser::ParseDoStatement(AttributeList *Attr) {
Tok.isNot(tok::l_brace));
// Read the body statement.
OwningStmtResult Body(ParseStatement());
StmtResult Body(ParseStatement());
// Pop the body scope if needed.
InnerScope.Exit();
@ -918,7 +918,7 @@ Parser::OwningStmtResult Parser::ParseDoStatement(AttributeList *Attr) {
// Parse the parenthesized condition.
SourceLocation LPLoc = ConsumeParen();
OwningExprResult Cond = ParseExpression();
ExprResult Cond = ParseExpression();
SourceLocation RPLoc = MatchRHSPunctuation(tok::r_paren, LPLoc);
DoScope.Exit();
@ -942,7 +942,7 @@ Parser::OwningStmtResult Parser::ParseDoStatement(AttributeList *Attr) {
/// [C++] expression-statement
/// [C++] simple-declaration
///
Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
StmtResult Parser::ParseForStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
@ -982,13 +982,13 @@ Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
ParseScope ForScope(this, ScopeFlags);
SourceLocation LParenLoc = ConsumeParen();
OwningExprResult Value;
ExprResult Value;
bool ForEach = false;
OwningStmtResult FirstPart;
StmtResult FirstPart;
bool SecondPartIsInvalid = false;
FullExprArg SecondPart(Actions);
OwningExprResult Collection;
ExprResult Collection;
FullExprArg ThirdPart(Actions);
Decl *SecondVar = 0;
@ -1061,7 +1061,7 @@ Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
if (Tok.is(tok::semi)) { // for (...;;
// no second part.
} else {
OwningExprResult Second;
ExprResult Second;
if (getLang().CPlusPlus)
ParseCXXCondition(Second, SecondVar, ForLoc, true);
else {
@ -1084,7 +1084,7 @@ Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
// Parse the third part of the for specifier.
if (Tok.isNot(tok::r_paren)) { // for (...;...;)
OwningExprResult Third = ParseExpression();
ExprResult Third = ParseExpression();
ThirdPart = Actions.MakeFullExpr(Third.take());
}
}
@ -1106,7 +1106,7 @@ Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
C99orCXXorObjC && Tok.isNot(tok::l_brace));
// Read the body statement.
OwningStmtResult Body(ParseStatement());
StmtResult Body(ParseStatement());
// Pop the body scope if needed.
InnerScope.Exit();
@ -1135,14 +1135,14 @@ Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
///
/// Note: this lets the caller parse the end ';'.
///
Parser::OwningStmtResult Parser::ParseGotoStatement(AttributeList *Attr) {
StmtResult Parser::ParseGotoStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
assert(Tok.is(tok::kw_goto) && "Not a goto stmt!");
SourceLocation GotoLoc = ConsumeToken(); // eat the 'goto'.
OwningStmtResult Res;
StmtResult Res;
if (Tok.is(tok::identifier)) {
Res = Actions.ActOnGotoStmt(GotoLoc, Tok.getLocation(),
Tok.getIdentifierInfo());
@ -1151,7 +1151,7 @@ Parser::OwningStmtResult Parser::ParseGotoStatement(AttributeList *Attr) {
// GNU indirect goto extension.
Diag(Tok, diag::ext_gnu_indirect_goto);
SourceLocation StarLoc = ConsumeToken();
OwningExprResult R(ParseExpression());
ExprResult R(ParseExpression());
if (R.isInvalid()) { // Skip to the semicolon, but don't consume it.
SkipUntil(tok::semi, false, true);
return StmtError();
@ -1171,7 +1171,7 @@ Parser::OwningStmtResult Parser::ParseGotoStatement(AttributeList *Attr) {
///
/// Note: this lets the caller parse the end ';'.
///
Parser::OwningStmtResult Parser::ParseContinueStatement(AttributeList *Attr) {
StmtResult Parser::ParseContinueStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
@ -1185,7 +1185,7 @@ Parser::OwningStmtResult Parser::ParseContinueStatement(AttributeList *Attr) {
///
/// Note: this lets the caller parse the end ';'.
///
Parser::OwningStmtResult Parser::ParseBreakStatement(AttributeList *Attr) {
StmtResult Parser::ParseBreakStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
@ -1196,14 +1196,14 @@ Parser::OwningStmtResult Parser::ParseBreakStatement(AttributeList *Attr) {
/// ParseReturnStatement
/// jump-statement:
/// 'return' expression[opt] ';'
Parser::OwningStmtResult Parser::ParseReturnStatement(AttributeList *Attr) {
StmtResult Parser::ParseReturnStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete Attr;
assert(Tok.is(tok::kw_return) && "Not a return stmt!");
SourceLocation ReturnLoc = ConsumeToken(); // eat the 'return'.
OwningExprResult R;
ExprResult R;
if (Tok.isNot(tok::semi)) {
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteReturn(getCurScope());
@ -1223,7 +1223,7 @@ Parser::OwningStmtResult Parser::ParseReturnStatement(AttributeList *Attr) {
/// FuzzyParseMicrosoftAsmStatement. When -fms-extensions is enabled, this
/// routine is called to skip/ignore tokens that comprise the MS asm statement.
Parser::OwningStmtResult Parser::FuzzyParseMicrosoftAsmStatement() {
StmtResult Parser::FuzzyParseMicrosoftAsmStatement() {
if (Tok.is(tok::l_brace)) {
unsigned short savedBraceCount = BraceCount;
do {
@ -1247,7 +1247,7 @@ Parser::OwningStmtResult Parser::FuzzyParseMicrosoftAsmStatement() {
t.setLiteralData("\"/*FIXME: not done*/\"");
t.clearFlag(Token::NeedsCleaning);
t.setLength(21);
OwningExprResult AsmString(Actions.ActOnStringLiteral(&t, 1));
ExprResult AsmString(Actions.ActOnStringLiteral(&t, 1));
ExprVector Constraints(Actions);
ExprVector Exprs(Actions);
ExprVector Clobbers(Actions);
@ -1284,7 +1284,7 @@ Parser::OwningStmtResult Parser::FuzzyParseMicrosoftAsmStatement() {
/// assembly-instruction ';'[opt]
/// assembly-instruction-list ';' assembly-instruction ';'[opt]
///
Parser::OwningStmtResult Parser::ParseAsmStatement(bool &msAsm) {
StmtResult Parser::ParseAsmStatement(bool &msAsm) {
assert(Tok.is(tok::kw_asm) && "Not an asm stmt");
SourceLocation AsmLoc = ConsumeToken();
@ -1311,7 +1311,7 @@ Parser::OwningStmtResult Parser::ParseAsmStatement(bool &msAsm) {
}
Loc = ConsumeParen();
OwningExprResult AsmString(ParseAsmStringLiteral());
ExprResult AsmString(ParseAsmStringLiteral());
if (AsmString.isInvalid())
return StmtError();
@ -1374,7 +1374,7 @@ Parser::OwningStmtResult Parser::ParseAsmStatement(bool &msAsm) {
// Parse the asm-string list for clobbers if present.
if (Tok.isNot(tok::r_paren)) {
while (1) {
OwningExprResult Clobber(ParseAsmStringLiteral());
ExprResult Clobber(ParseAsmStringLiteral());
if (Clobber.isInvalid())
break;
@ -1434,7 +1434,7 @@ bool Parser::ParseAsmOperandsOpt(llvm::SmallVectorImpl<IdentifierInfo *> &Names,
} else
Names.push_back(0);
OwningExprResult Constraint(ParseAsmStringLiteral());
ExprResult Constraint(ParseAsmStringLiteral());
if (Constraint.isInvalid()) {
SkipUntil(tok::r_paren);
return true;
@ -1449,7 +1449,7 @@ bool Parser::ParseAsmOperandsOpt(llvm::SmallVectorImpl<IdentifierInfo *> &Names,
// Read the parenthesized expression.
SourceLocation OpenLoc = ConsumeParen();
OwningExprResult Res(ParseExpression());
ExprResult Res(ParseExpression());
MatchRHSPunctuation(tok::r_paren, OpenLoc);
if (Res.isInvalid()) {
SkipUntil(tok::r_paren);
@ -1475,7 +1475,7 @@ Decl *Parser::ParseFunctionStatementBody(Decl *Decl) {
// Do not enter a scope for the brace, as the arguments are in the same scope
// (the function body) as the body itself. Instead, just read the statement
// list and put it into a CompoundStmt for safe keeping.
OwningStmtResult FnBody(ParseCompoundStatementBody());
StmtResult FnBody(ParseCompoundStatementBody());
// If the function body could not be parsed, make a bogus compoundstmt.
if (FnBody.isInvalid())
@ -1503,7 +1503,7 @@ Decl *Parser::ParseFunctionTryBlock(Decl *Decl) {
ParseConstructorInitializer(Decl);
SourceLocation LBraceLoc = Tok.getLocation();
OwningStmtResult FnBody(ParseCXXTryBlockCommon(TryLoc));
StmtResult FnBody(ParseCXXTryBlockCommon(TryLoc));
// If we failed to parse the try-catch, we just give the function an empty
// compound statement as the body.
if (FnBody.isInvalid())
@ -1518,7 +1518,7 @@ Decl *Parser::ParseFunctionTryBlock(Decl *Decl) {
/// try-block:
/// 'try' compound-statement handler-seq
///
Parser::OwningStmtResult Parser::ParseCXXTryBlock(AttributeList* Attr) {
StmtResult Parser::ParseCXXTryBlock(AttributeList* Attr) {
// FIXME: Add attributes?
delete Attr;
@ -1540,11 +1540,11 @@ Parser::OwningStmtResult Parser::ParseCXXTryBlock(AttributeList* Attr) {
/// handler-seq:
/// handler handler-seq[opt]
///
Parser::OwningStmtResult Parser::ParseCXXTryBlockCommon(SourceLocation TryLoc) {
StmtResult Parser::ParseCXXTryBlockCommon(SourceLocation TryLoc) {
if (Tok.isNot(tok::l_brace))
return StmtError(Diag(Tok, diag::err_expected_lbrace));
// FIXME: Possible draft standard bug: attribute-specifier should be allowed?
OwningStmtResult TryBlock(ParseCompoundStatement(0));
StmtResult TryBlock(ParseCompoundStatement(0));
if (TryBlock.isInvalid())
return move(TryBlock);
@ -1557,7 +1557,7 @@ Parser::OwningStmtResult Parser::ParseCXXTryBlockCommon(SourceLocation TryLoc) {
if (Tok.isNot(tok::kw_catch))
return StmtError(Diag(Tok, diag::err_expected_catch));
while (Tok.is(tok::kw_catch)) {
OwningStmtResult Handler(ParseCXXCatchBlock());
StmtResult Handler(ParseCXXCatchBlock());
if (!Handler.isInvalid())
Handlers.push_back(Handler.release());
}
@ -1580,7 +1580,7 @@ Parser::OwningStmtResult Parser::ParseCXXTryBlockCommon(SourceLocation TryLoc) {
/// type-specifier-seq
/// '...'
///
Parser::OwningStmtResult Parser::ParseCXXCatchBlock() {
StmtResult Parser::ParseCXXCatchBlock() {
assert(Tok.is(tok::kw_catch) && "Expected 'catch'");
SourceLocation CatchLoc = ConsumeToken();
@ -1614,7 +1614,7 @@ Parser::OwningStmtResult Parser::ParseCXXCatchBlock() {
return StmtError(Diag(Tok, diag::err_expected_lbrace));
// FIXME: Possible draft standard bug: attribute-specifier should be allowed?
OwningStmtResult Block(ParseCompoundStatement(0));
StmtResult Block(ParseCompoundStatement(0));
if (Block.isInvalid())
return move(Block);

View File

@ -601,7 +601,7 @@ Parser::ParseNonTypeTemplateParameter(unsigned Depth, unsigned Position) {
// Per C++0x [basic.scope.pdecl]p9, we parse the default argument before
// we introduce the template parameter into the local scope.
SourceLocation EqualLoc;
OwningExprResult DefaultArg;
ExprResult DefaultArg;
if (Tok.is(tok::equal)) {
EqualLoc = ConsumeToken();
@ -988,7 +988,7 @@ ParsedTemplateArgument Parser::ParseTemplateArgument() {
// Parse a non-type template argument.
SourceLocation Loc = Tok.getLocation();
OwningExprResult ExprArg = ParseConstantExpression();
ExprResult ExprArg = ParseConstantExpression();
if (ExprArg.isInvalid() || !ExprArg.get())
return ParsedTemplateArgument();

View File

@ -436,7 +436,7 @@ Parser::DeclGroupPtrTy Parser::ParseExternalDeclaration(CXX0XAttributeList Attr)
Diag(Attr.Range.getBegin(), diag::err_attributes_not_allowed)
<< Attr.Range;
OwningExprResult Result(ParseSimpleAsm());
ExprResult Result(ParseSimpleAsm());
ExpectAndConsume(tok::semi, diag::err_expected_semi_after,
"top-level asm block");
@ -829,13 +829,13 @@ void Parser::ParseKNRParamDeclarations(Declarator &D) {
/// [GNU] asm-string-literal:
/// string-literal
///
Parser::OwningExprResult Parser::ParseAsmStringLiteral() {
Parser::ExprResult Parser::ParseAsmStringLiteral() {
if (!isTokenStringLiteral()) {
Diag(Tok, diag::err_expected_string_literal);
return ExprError();
}
OwningExprResult Res(ParseStringLiteralExpression());
ExprResult Res(ParseStringLiteralExpression());
if (Res.isInvalid()) return move(Res);
// TODO: Diagnose: wide string literal in 'asm'
@ -848,7 +848,7 @@ Parser::OwningExprResult Parser::ParseAsmStringLiteral() {
/// [GNU] simple-asm-expr:
/// 'asm' '(' asm-string-literal ')'
///
Parser::OwningExprResult Parser::ParseSimpleAsm(SourceLocation *EndLoc) {
Parser::ExprResult Parser::ParseSimpleAsm(SourceLocation *EndLoc) {
assert(Tok.is(tok::kw_asm) && "Not an asm!");
SourceLocation Loc = ConsumeToken();
@ -869,7 +869,7 @@ Parser::OwningExprResult Parser::ParseSimpleAsm(SourceLocation *EndLoc) {
Loc = ConsumeParen();
OwningExprResult Result(ParseAsmStringLiteral());
ExprResult Result(ParseAsmStringLiteral());
if (Result.isInvalid()) {
SkipUntil(tok::r_paren, true, true);

View File

@ -116,7 +116,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
CastExpr::CastKind &Kind);
/// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's.
Action::OwningExprResult
ExprResult
Sema::ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
SourceLocation LAngleBracketLoc, ParsedType Ty,
SourceLocation RAngleBracketLoc,
@ -133,7 +133,7 @@ Sema::ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
SourceRange(LParenLoc, RParenLoc));
}
Action::OwningExprResult
ExprResult
Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
TypeSourceInfo *DestTInfo, ExprArg Ex,
SourceRange AngleBrackets, SourceRange Parens) {
@ -964,7 +964,7 @@ TryStaticImplicitCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
(CStyle || !DestType->isReferenceType()))
return TC_NotApplicable;
Sema::OwningExprResult Result
ExprResult Result
= InitSeq.Perform(Self, Entity, InitKind,
Action::MultiExprArg(Self, &SrcExpr, 1));
if (Result.isInvalid()) {

View File

@ -121,9 +121,9 @@ bool Sema::CheckablePrintfAttr(const FormatAttr *Format, CallExpr *TheCall) {
return false;
}
Action::OwningExprResult
ExprResult
Sema::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
OwningExprResult TheCallResult(Owned(TheCall));
ExprResult TheCallResult(Owned(TheCall));
switch (BuiltinID) {
case Builtin::BI__builtin___CFStringMakeConstantString:
@ -390,8 +390,8 @@ bool Sema::CheckBlockCall(NamedDecl *NDecl, CallExpr *TheCall) {
///
/// This function goes through and does final semantic checking for these
/// builtins,
Sema::OwningExprResult
Sema::SemaBuiltinAtomicOverloaded(OwningExprResult TheCallResult) {
ExprResult
Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) {
CallExpr *TheCall = (CallExpr *)TheCallResult.get();
DeclRefExpr *DRE =cast<DeclRefExpr>(TheCall->getCallee()->IgnoreParenCasts());
FunctionDecl *FDecl = cast<FunctionDecl>(DRE->getDecl());
@ -746,7 +746,7 @@ bool Sema::SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs) {
/// SemaBuiltinShuffleVector - Handle __builtin_shufflevector.
// This is declared to take (...), so we have to check everything.
Action::OwningExprResult Sema::SemaBuiltinShuffleVector(CallExpr *TheCall) {
ExprResult Sema::SemaBuiltinShuffleVector(CallExpr *TheCall) {
if (TheCall->getNumArgs() < 2)
return ExprError(Diag(TheCall->getLocEnd(),
diag::err_typecheck_call_too_few_args_at_least)

View File

@ -3707,7 +3707,7 @@ void Sema::CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc,
// an instance method.
QualType SuperTy = Context.getObjCInterfaceType(CDecl);
SuperTy = Context.getObjCObjectPointerType(SuperTy);
OwningExprResult Super
ExprResult Super
= Owned(new (Context) ObjCSuperExpr(SuperLoc, SuperTy));
return CodeCompleteObjCInstanceMessage(S, (Expr *)Super.get(),
SelIdents, NumSelIdents);
@ -3733,7 +3733,7 @@ void Sema::CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc,
CXXScopeSpec SS;
UnqualifiedId id;
id.setIdentifier(Super, SuperLoc);
OwningExprResult SuperExpr = ActOnIdExpression(S, SS, id, false, false);
ExprResult SuperExpr = ActOnIdExpression(S, SS, id, false, false);
return CodeCompleteObjCInstanceMessage(S, (Expr *)SuperExpr.get(),
SelIdents, NumSelIdents);
}

View File

@ -2147,7 +2147,7 @@ static bool RebuildDeclaratorInCurrentInstantiation(Sema &S, Declarator &D,
case DeclSpec::TST_typeofExpr: {
Expr *E = DS.getRepAsExpr();
OwningExprResult Result = S.RebuildExprInCurrentInstantiation(E);
ExprResult Result = S.RebuildExprInCurrentInstantiation(E);
if (Result.isInvalid()) return true;
DS.UpdateExprRep(Result.get());
break;
@ -4156,7 +4156,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) {
VDecl->setInvalidDecl();
} else if (!VDecl->isInvalidDecl()) {
InitializationSequence InitSeq(*this, Entity, Kind, &Init, 1);
OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind,
ExprResult Result = InitSeq.Perform(*this, Entity, Kind,
MultiExprArg(*this, &Init, 1),
&DclT);
if (Result.isInvalid()) {
@ -4227,7 +4227,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) {
Diag(VDecl->getLocation(), diag::warn_extern_init);
if (!VDecl->isInvalidDecl()) {
InitializationSequence InitSeq(*this, Entity, Kind, &Init, 1);
OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind,
ExprResult Result = InitSeq.Perform(*this, Entity, Kind,
MultiExprArg(*this, &Init, 1),
&DclT);
if (Result.isInvalid()) {
@ -4465,8 +4465,8 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl,
= InitializationKind::CreateDefault(Var->getLocation());
InitializationSequence InitSeq(*this, Entity, Kind, 0, 0);
OwningExprResult Init = InitSeq.Perform(*this, Entity, Kind,
MultiExprArg(*this, 0, 0));
ExprResult Init = InitSeq.Perform(*this, Entity, Kind,
MultiExprArg(*this, 0, 0));
if (Init.isInvalid())
Var->setInvalidDecl();
else if (Init.get()) {

View File

@ -126,7 +126,7 @@ Sema::SetParamDefaultArgument(ParmVarDecl *Param, Expr *Arg,
InitializationKind Kind = InitializationKind::CreateCopy(Param->getLocation(),
EqualLoc);
InitializationSequence InitSeq(*this, Entity, Kind, &Arg, 1);
OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind,
ExprResult Result = InitSeq.Perform(*this, Entity, Kind,
MultiExprArg(*this, &Arg, 1));
if (Result.isInvalid())
return true;
@ -1317,7 +1317,7 @@ Sema::BuildMemberInitializer(FieldDecl *Member, Expr **Args,
InitializationSequence InitSeq(*this, MemberEntity, Kind, Args, NumArgs);
OwningExprResult MemberInit =
ExprResult MemberInit =
InitSeq.Perform(*this, MemberEntity, Kind,
MultiExprArg(*this, Args, NumArgs), 0);
if (MemberInit.isInvalid())
@ -1409,7 +1409,7 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo,
if (Dependent) {
// Can't check initialization for a base of dependent type or when
// any of the arguments are type-dependent expressions.
OwningExprResult BaseInit
ExprResult BaseInit
= Owned(new (Context) ParenListExpr(Context, LParenLoc, Args, NumArgs,
RParenLoc));
@ -1448,7 +1448,7 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo,
InitializationSequence InitSeq(*this, BaseEntity, Kind, Args, NumArgs);
OwningExprResult BaseInit =
ExprResult BaseInit =
InitSeq.Perform(*this, BaseEntity, Kind,
MultiExprArg(*this, Args, NumArgs), 0);
if (BaseInit.isInvalid())
@ -1473,7 +1473,7 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo,
for (unsigned I = 0; I != NumArgs; ++I)
Args[I]->Retain();
OwningExprResult Init
ExprResult Init
= Owned(new (Context) ParenListExpr(Context, LParenLoc, Args, NumArgs,
RParenLoc));
return new (Context) CXXBaseOrMemberInitializer(Context, BaseTInfo,
@ -1508,7 +1508,7 @@ BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
= InitializedEntity::InitializeBase(SemaRef.Context, BaseSpec,
IsInheritedVirtualBase);
Sema::OwningExprResult BaseInit;
ExprResult BaseInit;
switch (ImplicitInitKind) {
case IIK_Default: {
@ -1597,7 +1597,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
Sema::LookupMemberName);
MemberLookup.addDecl(Field, AS_public);
MemberLookup.resolveKind();
Sema::OwningExprResult CopyCtorArg
ExprResult CopyCtorArg
= SemaRef.BuildMemberReferenceExpr(MemberExprBase,
ParamType, Loc,
/*IsArrow=*/false,
@ -1633,7 +1633,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
IndexVariables.push_back(IterationVar);
// Create a reference to the iteration variable.
Sema::OwningExprResult IterationVarRef
ExprResult IterationVarRef
= SemaRef.BuildDeclRefExpr(IterationVar, SizeType, Loc);
assert(!IterationVarRef.isInvalid() &&
"Reference to invented variable cannot fail!");
@ -1668,7 +1668,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
InitializationSequence InitSeq(SemaRef, Entities.back(), InitKind,
&CopyCtorArgE, 1);
Sema::OwningExprResult MemberInit
ExprResult MemberInit
= InitSeq.Perform(SemaRef, Entities.back(), InitKind,
Sema::MultiExprArg(SemaRef, &CopyCtorArgE, 1));
MemberInit = SemaRef.MaybeCreateCXXExprWithTemporaries(MemberInit.get());
@ -1694,7 +1694,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
InitializationKind::CreateDefault(Loc);
InitializationSequence InitSeq(SemaRef, InitEntity, InitKind, 0, 0);
Sema::OwningExprResult MemberInit =
ExprResult MemberInit =
InitSeq.Perform(SemaRef, InitEntity, InitKind,
Sema::MultiExprArg(SemaRef, 0, 0));
if (MemberInit.isInvalid())
@ -4540,7 +4540,7 @@ void Sema::DefineImplicitDestructor(SourceLocation CurrentLocation,
/// \param Depth Internal parameter recording the depth of the recursion.
///
/// \returns A statement or a loop that copies the expressions.
static OwningStmtResult
static StmtResult
BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T,
Expr *To, Expr *From,
bool CopyingBaseSubobject, unsigned Depth = 0) {
@ -4600,7 +4600,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T,
T.getTypePtr()));
// Create the reference to operator=.
OwningExprResult OpEqualRef
ExprResult OpEqualRef
= S.BuildMemberReferenceExpr(To, T, Loc, /*isArrow=*/false, SS,
/*FirstQualifierInScope=*/0, OpLookup,
/*TemplateArgs=*/0,
@ -4610,7 +4610,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T,
// Build the call to the assignment operator.
OwningExprResult Call = S.BuildCallToMemberFunction(/*Scope=*/0,
ExprResult Call = S.BuildCallToMemberFunction(/*Scope=*/0,
OpEqualRef.takeAs<Expr>(),
Loc, &From, 1, 0, Loc);
if (Call.isInvalid())
@ -4623,7 +4623,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T,
// operator is used.
const ConstantArrayType *ArrayTy = S.Context.getAsConstantArrayType(T);
if (!ArrayTy) {
OwningExprResult Assignment = S.CreateBuiltinBinOp(Loc,
ExprResult Assignment = S.CreateBuiltinBinOp(Loc,
BinaryOperator::Assign,
To,
From);
@ -4690,7 +4690,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T,
IterationVarRef, Loc));
// Build the copy for an individual element of the array.
OwningStmtResult Copy = BuildSingleCopyAssign(S, Loc,
StmtResult Copy = BuildSingleCopyAssign(S, Loc,
ArrayTy->getElementType(),
To, From,
CopyingBaseSubobject, Depth+1);
@ -4970,7 +4970,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
ImplicitCastExpr::LValue, &BasePath);
// Dereference "this".
OwningExprResult To = CreateBuiltinUnaryOp(Loc, UnaryOperator::Deref, This);
ExprResult To = CreateBuiltinUnaryOp(Loc, UnaryOperator::Deref, This);
// Implicitly cast "this" to the appropriately-qualified base type.
Expr *ToE = To.takeAs<Expr>();
@ -4982,7 +4982,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
To = Owned(ToE);
// Build the copy.
OwningStmtResult Copy = BuildSingleCopyAssign(*this, Loc, BaseType,
StmtResult Copy = BuildSingleCopyAssign(*this, Loc, BaseType,
To.get(), From,
/*CopyingBaseSubobject=*/true);
if (Copy.isInvalid()) {
@ -5041,10 +5041,10 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
LookupMemberName);
MemberLookup.addDecl(*Field);
MemberLookup.resolveKind();
OwningExprResult From = BuildMemberReferenceExpr(OtherRef, OtherRefType,
ExprResult From = BuildMemberReferenceExpr(OtherRef, OtherRefType,
Loc, /*IsArrow=*/false,
SS, 0, MemberLookup, 0);
OwningExprResult To = BuildMemberReferenceExpr(This, This->getType(),
ExprResult To = BuildMemberReferenceExpr(This, This->getType(),
Loc, /*IsArrow=*/true,
SS, 0, MemberLookup, 0);
assert(!From.isInvalid() && "Implicit field reference cannot fail");
@ -5128,7 +5128,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
llvm::SmallVector<SourceLocation, 4> Commas; // FIXME: Silly
Commas.push_back(Loc);
Commas.push_back(Loc);
OwningExprResult Call = ExprError();
ExprResult Call = ExprError();
if (NeedsCollectableMemCpy)
Call = ActOnCallExpr(/*Scope=*/0,
CollectableMemCpyRef,
@ -5146,7 +5146,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
}
// Build the copy of this field.
OwningStmtResult Copy = BuildSingleCopyAssign(*this, Loc, FieldType,
StmtResult Copy = BuildSingleCopyAssign(*this, Loc, FieldType,
To.get(), From.get(),
/*CopyingBaseSubobject=*/false);
if (Copy.isInvalid()) {
@ -5162,10 +5162,10 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
if (!Invalid) {
// Add a "return *this;"
OwningExprResult ThisObj = CreateBuiltinUnaryOp(Loc, UnaryOperator::Deref,
ExprResult ThisObj = CreateBuiltinUnaryOp(Loc, UnaryOperator::Deref,
This);
OwningStmtResult Return = ActOnReturnStmt(Loc, ThisObj.get());
StmtResult Return = ActOnReturnStmt(Loc, ThisObj.get());
if (Return.isInvalid())
Invalid = true;
else {
@ -5184,7 +5184,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
return;
}
OwningStmtResult Body = ActOnCompoundStmt(Loc, Loc, move_arg(Statements),
StmtResult Body = ActOnCompoundStmt(Loc, Loc, move_arg(Statements),
/*isStmtExpr=*/false);
assert(!Body.isInvalid() && "Compound statement creation cannot fail");
CopyAssignOperator->setBody(Body.takeAs<Stmt>());
@ -5393,7 +5393,7 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
CopyConstructor->setUsed();
}
Sema::OwningExprResult
ExprResult
Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
CXXConstructorDecl *Constructor,
MultiExprArg ExprArgs,
@ -5426,7 +5426,7 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
/// BuildCXXConstructExpr - Creates a complete call to a constructor,
/// including handling of its default argument expressions.
Sema::OwningExprResult
ExprResult
Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
CXXConstructorDecl *Constructor, bool Elidable,
MultiExprArg ExprArgs,
@ -5444,7 +5444,7 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
bool Sema::InitializeVarWithConstructor(VarDecl *VD,
CXXConstructorDecl *Constructor,
MultiExprArg Exprs) {
OwningExprResult TempResult =
ExprResult TempResult =
BuildCXXConstructExpr(VD->getLocation(), VD->getType(), Constructor,
move(Exprs));
if (TempResult.isInvalid())
@ -5579,7 +5579,7 @@ void Sema::AddCXXDirectInitializerToDecl(Decl *RealDecl,
InitializationSequence InitSeq(*this, Entity, Kind,
Exprs.get(), Exprs.size());
OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind, move(Exprs));
ExprResult Result = InitSeq.Perform(*this, Entity, Kind, move(Exprs));
if (Result.isInvalid()) {
VDecl->setInvalidDecl();
return;
@ -6146,7 +6146,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, QualType ExDeclType,
InitializationKind Kind = InitializationKind::CreateCopy(Loc,
SourceLocation());
InitializationSequence InitSeq(*this, Entity, Kind, &ExDeclRef, 1);
OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind,
ExprResult Result = InitSeq.Perform(*this, Entity, Kind,
MultiExprArg(*this, &ExDeclRef, 1));
if (Result.isInvalid())
Invalid = true;
@ -6934,7 +6934,7 @@ void Sema::SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation) {
InitializationKind::CreateDefault(ObjCImplementation->getLocation());
InitializationSequence InitSeq(*this, InitEntity, InitKind, 0, 0);
Sema::OwningExprResult MemberInit =
ExprResult MemberInit =
InitSeq.Perform(*this, InitEntity, InitKind,
Sema::MultiExprArg(*this, 0, 0));
MemberInit = MaybeCreateCXXExprWithTemporaries(MemberInit.get());

View File

@ -371,7 +371,7 @@ QualType Sema::UsualArithmeticConversions(Expr *&lhsExpr, Expr *&rhsExpr,
/// multiple tokens. However, the common case is that StringToks points to one
/// string.
///
Action::OwningExprResult
ExprResult
Sema::ActOnStringLiteral(const Token *StringToks, unsigned NumStringToks) {
assert(NumStringToks && "Must have at least one string!");
@ -459,7 +459,7 @@ static bool ShouldSnapshotBlockValueReference(Sema &S, BlockScopeInfo *CurBlock,
}
Sema::OwningExprResult
ExprResult
Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty, SourceLocation Loc,
const CXXScopeSpec *SS) {
DeclarationNameInfo NameInfo(D->getDeclName(), Loc);
@ -467,7 +467,7 @@ Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty, SourceLocation Loc,
}
/// BuildDeclRefExpr - Build a DeclRefExpr.
Sema::OwningExprResult
ExprResult
Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty,
const DeclarationNameInfo &NameInfo,
const CXXScopeSpec *SS) {
@ -543,7 +543,7 @@ VarDecl *Sema::BuildAnonymousStructUnionMemberPath(FieldDecl *Field,
return BaseObject;
}
Sema::OwningExprResult
ExprResult
Sema::BuildAnonymousStructUnionMemberReference(SourceLocation Loc,
FieldDecl *Field,
Expr *BaseObjectExpr,
@ -1061,7 +1061,7 @@ static ObjCIvarDecl *SynthesizeProvisionalIvar(Sema &SemaRef,
return 0;
}
Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S,
ExprResult Sema::ActOnIdExpression(Scope *S,
CXXScopeSpec &SS,
UnqualifiedId &Id,
bool HasTrailingLParen,
@ -1134,7 +1134,7 @@ Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S,
// If this reference is in an Objective-C method, then we need to do
// some special Objective-C lookup, too.
if (IvarLookupFollowUp) {
OwningExprResult E(LookupInObjCMethod(R, S, II, true));
ExprResult E(LookupInObjCMethod(R, S, II, true));
if (E.isInvalid())
return ExprError();
@ -1180,7 +1180,7 @@ Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S,
// reference the ivar.
if (ObjCIvarDecl *Ivar = R.getAsSingle<ObjCIvarDecl>()) {
R.clear();
OwningExprResult E(LookupInObjCMethod(R, S, Ivar->getIdentifier()));
ExprResult E(LookupInObjCMethod(R, S, Ivar->getIdentifier()));
assert(E.isInvalid() || E.get());
return move(E);
}
@ -1241,7 +1241,7 @@ Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S,
}
/// Builds an expression which might be an implicit member expression.
Sema::OwningExprResult
ExprResult
Sema::BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS,
LookupResult &R,
const TemplateArgumentListInfo *TemplateArgs) {
@ -1280,7 +1280,7 @@ Sema::BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS,
/// declaration name, generally during template instantiation.
/// There's a large number of things which don't need to be done along
/// this path.
Sema::OwningExprResult
ExprResult
Sema::BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS,
const DeclarationNameInfo &NameInfo) {
DeclContext *DC;
@ -1313,7 +1313,7 @@ Sema::BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS,
/// actually quite a lot of extra work involved.
///
/// Returns a null sentinel to indicate trivial success.
Sema::OwningExprResult
ExprResult
Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S,
IdentifierInfo *II, bool AllowBuiltinCreation) {
SourceLocation Loc = Lookup.getNameLoc();
@ -1368,7 +1368,7 @@ Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S,
UnqualifiedId SelfName;
SelfName.setIdentifier(&II, SourceLocation());
CXXScopeSpec SelfScopeSpec;
OwningExprResult SelfExpr = ActOnIdExpression(S, SelfScopeSpec,
ExprResult SelfExpr = ActOnIdExpression(S, SelfScopeSpec,
SelfName, false, false);
MarkDeclarationReferenced(Loc, IV);
return Owned(new (Context)
@ -1593,7 +1593,7 @@ static MemberExpr *BuildMemberExpr(ASTContext &C, Expr *Base, bool isArrow,
/// is known to be an instance method, and the given unqualified lookup
/// set is known to contain only instance members, at least one of which
/// is from an appropriate type.
Sema::OwningExprResult
ExprResult
Sema::BuildImplicitMemberExpr(const CXXScopeSpec &SS,
LookupResult &R,
const TemplateArgumentListInfo *TemplateArgs,
@ -1709,7 +1709,7 @@ static bool CheckDeclInExpr(Sema &S, SourceLocation Loc, NamedDecl *D) {
return false;
}
Sema::OwningExprResult
ExprResult
Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
LookupResult &R,
bool NeedsADL) {
@ -1745,7 +1745,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
/// \brief Complete semantic analysis for a reference to the given declaration.
Sema::OwningExprResult
ExprResult
Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
const DeclarationNameInfo &NameInfo,
NamedDecl *D) {
@ -1828,7 +1828,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
DeclRefExpr(const_cast<ValueDecl*>(BDRE->getDecl()), T,
SourceLocation());
OwningExprResult Res = PerformCopyInitialization(
ExprResult Res = PerformCopyInitialization(
InitializedEntity::InitializeBlock(VD->getLocation(),
T, false),
SourceLocation(),
@ -1849,7 +1849,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
NameInfo, &SS);
}
Sema::OwningExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc,
ExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc,
tok::TokenKind Kind) {
PredefinedExpr::IdentType IT;
@ -1884,7 +1884,7 @@ Sema::OwningExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc,
return Owned(new (Context) PredefinedExpr(Loc, ResTy, IT));
}
Sema::OwningExprResult Sema::ActOnCharacterConstant(const Token &Tok) {
ExprResult Sema::ActOnCharacterConstant(const Token &Tok) {
llvm::SmallString<16> CharBuffer;
bool Invalid = false;
llvm::StringRef ThisTok = PP.getSpelling(Tok, CharBuffer, &Invalid);
@ -1911,7 +1911,7 @@ Sema::OwningExprResult Sema::ActOnCharacterConstant(const Token &Tok) {
Ty, Tok.getLocation()));
}
Action::OwningExprResult Sema::ActOnNumericConstant(const Token &Tok) {
ExprResult Sema::ActOnNumericConstant(const Token &Tok) {
// Fast path for a single digit (which is quite common). A single digit
// cannot have a trigraph, escaped newline, radix prefix, or type suffix.
if (Tok.getLength() == 1) {
@ -2073,7 +2073,7 @@ Action::OwningExprResult Sema::ActOnNumericConstant(const Token &Tok) {
return Owned(Res);
}
Action::OwningExprResult Sema::ActOnParenExpr(SourceLocation L,
ExprResult Sema::ActOnParenExpr(SourceLocation L,
SourceLocation R, Expr *E) {
assert((E != 0) && "ActOnParenExpr() missing expr");
return Owned(new (Context) ParenExpr(L, R, E));
@ -2158,7 +2158,7 @@ bool Sema::CheckAlignOfExpr(Expr *E, SourceLocation OpLoc,
}
/// \brief Build a sizeof or alignof expression given a type operand.
Action::OwningExprResult
ExprResult
Sema::CreateSizeOfAlignOfExpr(TypeSourceInfo *TInfo,
SourceLocation OpLoc,
bool isSizeOf, SourceRange R) {
@ -2179,7 +2179,7 @@ Sema::CreateSizeOfAlignOfExpr(TypeSourceInfo *TInfo,
/// \brief Build a sizeof or alignof expression given an expression
/// operand.
Action::OwningExprResult
ExprResult
Sema::CreateSizeOfAlignOfExpr(Expr *E, SourceLocation OpLoc,
bool isSizeOf, SourceRange R) {
// Verify that the operand is valid.
@ -2207,7 +2207,7 @@ Sema::CreateSizeOfAlignOfExpr(Expr *E, SourceLocation OpLoc,
/// ActOnSizeOfAlignOfExpr - Handle @c sizeof(type) and @c sizeof @c expr and
/// the same for @c alignof and @c __alignof
/// Note that the ArgRange is invalid if isType is false.
Action::OwningExprResult
ExprResult
Sema::ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType,
void *TyOrEx, const SourceRange &ArgRange) {
// If error parsing type, ignore.
@ -2220,7 +2220,7 @@ Sema::ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType,
}
Expr *ArgEx = (Expr *)TyOrEx;
Action::OwningExprResult Result
ExprResult Result
= CreateSizeOfAlignOfExpr(ArgEx, OpLoc, isSizeof, ArgEx->getSourceRange());
if (Result.isInvalid())
@ -2249,7 +2249,7 @@ QualType Sema::CheckRealImagOperand(Expr *&V, SourceLocation Loc, bool isReal) {
Action::OwningExprResult
ExprResult
Sema::ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
tok::TokenKind Kind, Expr *Input) {
UnaryOperator::Opcode Opc;
@ -2262,11 +2262,11 @@ Sema::ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
return BuildUnaryOp(S, OpLoc, Opc, Input);
}
Action::OwningExprResult
ExprResult
Sema::ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc,
Expr *Idx, SourceLocation RLoc) {
// Since this might be a postfix expression, get rid of ParenListExprs.
OwningExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base);
ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base);
if (Result.isInvalid()) return ExprError();
Base = Result.take();
@ -2290,7 +2290,7 @@ Sema::ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc,
}
Action::OwningExprResult
ExprResult
Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
Expr *Idx, SourceLocation RLoc) {
Expr *LHSExp = Base;
@ -2541,7 +2541,7 @@ static Decl *FindGetterNameDecl(const ObjCObjectPointerType *QIdTy,
return GDecl;
}
Sema::OwningExprResult
ExprResult
Sema::ActOnDependentMemberExpr(Expr *BaseExpr, QualType BaseType,
bool IsArrow, SourceLocation OpLoc,
const CXXScopeSpec &SS,
@ -2718,7 +2718,7 @@ LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
return false;
}
Sema::OwningExprResult
ExprResult
Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType,
SourceLocation OpLoc, bool IsArrow,
CXXScopeSpec &SS,
@ -2745,7 +2745,7 @@ Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType,
// Explicit member accesses.
} else {
OwningExprResult Result =
ExprResult Result =
LookupMemberExpr(R, Base, IsArrow, OpLoc,
SS, /*ObjCImpDecl*/ 0, TemplateArgs != 0);
@ -2766,7 +2766,7 @@ Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType,
R, TemplateArgs);
}
Sema::OwningExprResult
ExprResult
Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
SourceLocation OpLoc, bool IsArrow,
const CXXScopeSpec &SS,
@ -2957,7 +2957,7 @@ Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
///
/// The ObjCImpDecl bit is a gross hack that will need to be properly
/// fixed for ObjC++.
Sema::OwningExprResult
ExprResult
Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr,
bool &IsArrow, SourceLocation OpLoc,
CXXScopeSpec &SS,
@ -2991,7 +2991,7 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr,
<< QualType(Fun, 0)
<< FixItHint::CreateInsertion(Loc, "()");
OwningExprResult NewBase
ExprResult NewBase
= ActOnCallExpr(0, BaseExpr, Loc,
MultiExprArg(*this, 0, 0), 0, Loc);
BaseExpr = 0;
@ -3304,7 +3304,7 @@ Sema::LookupMemberExpr(LookupResult &R, Expr *&BaseExpr,
/// \param ObjCImpDecl the current ObjC @implementation decl;
/// this is an ugly hack around the fact that ObjC @implementations
/// aren't properly put in the context chain
Sema::OwningExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base,
ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
CXXScopeSpec &SS,
@ -3330,7 +3330,7 @@ Sema::OwningExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base,
static_cast<NestedNameSpecifier*>(SS.getScopeRep())));
// This is a postfix expression, so get rid of ParenListExprs.
OwningExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base);
ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base);
if (Result.isInvalid()) return ExprError();
Base = Result.take();
@ -3370,7 +3370,7 @@ Sema::OwningExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base,
return move(Result);
}
Sema::OwningExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc,
ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc,
FunctionDecl *FD,
ParmVarDecl *Param) {
if (Param->hasUnparsedDefaultArg()) {
@ -3392,7 +3392,7 @@ Sema::OwningExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc,
InstantiatingTemplate Inst(*this, CallLoc, Param, Innermost.first,
Innermost.second);
OwningExprResult Result = SubstExpr(UninstExpr, ArgList);
ExprResult Result = SubstExpr(UninstExpr, ArgList);
if (Result.isInvalid())
return ExprError();
@ -3525,7 +3525,7 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc,
InitializedEntity Entity =
Param? InitializedEntity::InitializeParameter(Param)
: InitializedEntity::InitializeParameter(ProtoArgType);
OwningExprResult ArgE = PerformCopyInitialization(Entity,
ExprResult ArgE = PerformCopyInitialization(Entity,
SourceLocation(),
Owned(Arg));
if (ArgE.isInvalid())
@ -3535,7 +3535,7 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc,
} else {
ParmVarDecl *Param = FDecl->getParamDecl(i);
OwningExprResult ArgExpr =
ExprResult ArgExpr =
BuildCXXDefaultArgExpr(CallLoc, FDecl, Param);
if (ArgExpr.isInvalid())
return true;
@ -3560,14 +3560,14 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc,
/// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
/// This provides the location of the left/right parens and a list of comma
/// locations.
Action::OwningExprResult
ExprResult
Sema::ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc,
MultiExprArg args,
SourceLocation *CommaLocs, SourceLocation RParenLoc) {
unsigned NumArgs = args.size();
// Since this might be a postfix expression, get rid of ParenListExprs.
OwningExprResult Result = MaybeConvertParenListExprToParenExpr(S, Fn);
ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Fn);
if (Result.isInvalid()) return ExprError();
Fn = Result.take();
@ -3690,7 +3690,7 @@ Sema::ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc,
/// block-pointer type.
///
/// \param NDecl the declaration being called, if available
Sema::OwningExprResult
ExprResult
Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
SourceLocation LParenLoc,
Expr **Args, unsigned NumArgs,
@ -3791,7 +3791,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
return MaybeBindToTemporary(TheCall);
}
Action::OwningExprResult
ExprResult
Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty,
SourceLocation RParenLoc, Expr *InitExpr) {
assert((Ty != 0) && "ActOnCompoundLiteral(): missing type");
@ -3806,7 +3806,7 @@ Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty,
return BuildCompoundLiteralExpr(LParenLoc, TInfo, RParenLoc, InitExpr);
}
Action::OwningExprResult
ExprResult
Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo,
SourceLocation RParenLoc, Expr *literalExpr) {
QualType literalType = TInfo->getType();
@ -3828,7 +3828,7 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo,
= InitializationKind::CreateCast(SourceRange(LParenLoc, RParenLoc),
/*IsCStyleCast=*/true);
InitializationSequence InitSeq(*this, Entity, Kind, &literalExpr, 1);
OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind,
ExprResult Result = InitSeq.Perform(*this, Entity, Kind,
MultiExprArg(*this, &literalExpr, 1),
&literalType);
if (Result.isInvalid())
@ -3845,7 +3845,7 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo,
literalExpr, isFileScope));
}
Action::OwningExprResult
ExprResult
Sema::ActOnInitList(SourceLocation LBraceLoc, MultiExprArg initlist,
SourceLocation RBraceLoc) {
unsigned NumInit = initlist.size();
@ -4046,7 +4046,7 @@ bool Sema::CheckExtVectorCast(SourceRange R, QualType DestTy, Expr *&CastExpr,
return false;
}
Action::OwningExprResult
ExprResult
Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc, ParsedType Ty,
SourceLocation RParenLoc, Expr *castExpr) {
assert((Ty != 0) && (castExpr != 0) &&
@ -4065,7 +4065,7 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc, ParsedType Ty,
return BuildCStyleCastExpr(LParenLoc, castTInfo, RParenLoc, castExpr);
}
Action::OwningExprResult
ExprResult
Sema::BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty,
SourceLocation RParenLoc, Expr *castExpr) {
CastExpr::CastKind Kind = CastExpr::CK_Unknown;
@ -4082,13 +4082,13 @@ Sema::BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty,
/// This is not an AltiVec-style cast, so turn the ParenListExpr into a sequence
/// of comma binary operators.
OwningExprResult
ExprResult
Sema::MaybeConvertParenListExprToParenExpr(Scope *S, Expr *expr) {
ParenListExpr *E = dyn_cast<ParenListExpr>(expr);
if (!E)
return Owned(expr);
OwningExprResult Result(E->getExpr(0));
ExprResult Result(E->getExpr(0));
for (unsigned i = 1, e = E->getNumExprs(); i != e && !Result.isInvalid(); ++i)
Result = ActOnBinOp(S, E->getExprLoc(), tok::comma, Result.get(),
@ -4099,7 +4099,7 @@ Sema::MaybeConvertParenListExprToParenExpr(Scope *S, Expr *expr) {
return ActOnParenExpr(E->getLParenLoc(), E->getRParenLoc(), Result.get());
}
Action::OwningExprResult
ExprResult
Sema::ActOnCastOfParenListExpr(Scope *S, SourceLocation LParenLoc,
SourceLocation RParenLoc, Expr *Op,
TypeSourceInfo *TInfo) {
@ -4139,13 +4139,13 @@ Sema::ActOnCastOfParenListExpr(Scope *S, SourceLocation LParenLoc,
} else {
// This is not an AltiVec-style cast, so turn the ParenListExpr into a
// sequence of BinOp comma operators.
OwningExprResult Result = MaybeConvertParenListExprToParenExpr(S, Op);
ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Op);
if (Result.isInvalid()) return ExprError();
return BuildCStyleCastExpr(LParenLoc, TInfo, RParenLoc, Result.take());
}
}
Action::OwningExprResult Sema::ActOnParenOrParenListExpr(SourceLocation L,
ExprResult Sema::ActOnParenOrParenListExpr(SourceLocation L,
SourceLocation R,
MultiExprArg Val,
ParsedType TypeOfCast) {
@ -4483,7 +4483,7 @@ QualType Sema::FindCompositeObjCPointerType(Expr *&LHS, Expr *&RHS,
/// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
/// in the case of a the GNU conditional expr extension.
Action::OwningExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc,
ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc,
SourceLocation ColonLoc,
Expr *CondExpr, Expr *LHSExpr,
Expr *RHSExpr) {
@ -6418,7 +6418,7 @@ static inline UnaryOperator::Opcode ConvertTokenKindToUnaryOpcode(
/// CreateBuiltinBinOp - Creates a new built-in binary operation with
/// operator @p Opc at location @c TokLoc. This routine only supports
/// built-in operations; ActOnBinOp handles overloaded operators.
Action::OwningExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc,
ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc,
unsigned Op,
Expr *lhs, Expr *rhs) {
QualType ResultTy; // Result type of the binary operator.
@ -6628,7 +6628,7 @@ static void DiagnoseBinOpPrecedence(Sema &Self, BinaryOperator::Opcode Opc,
}
// Binary Operators. 'Tok' is the token for the operator.
Action::OwningExprResult Sema::ActOnBinOp(Scope *S, SourceLocation TokLoc,
ExprResult Sema::ActOnBinOp(Scope *S, SourceLocation TokLoc,
tok::TokenKind Kind,
Expr *lhs, Expr *rhs) {
BinaryOperator::Opcode Opc = ConvertTokenKindToBinaryOpcode(Kind);
@ -6641,7 +6641,7 @@ Action::OwningExprResult Sema::ActOnBinOp(Scope *S, SourceLocation TokLoc,
return BuildBinOp(S, TokLoc, Opc, lhs, rhs);
}
Action::OwningExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc,
ExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc,
BinaryOperator::Opcode Opc,
Expr *lhs, Expr *rhs) {
if (getLangOptions().CPlusPlus &&
@ -6666,7 +6666,7 @@ Action::OwningExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc,
return CreateBuiltinBinOp(OpLoc, Opc, lhs, rhs);
}
Action::OwningExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc,
ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc,
unsigned OpcIn,
Expr *Input) {
UnaryOperator::Opcode Opc = static_cast<UnaryOperator::Opcode>(OpcIn);
@ -6750,7 +6750,7 @@ Action::OwningExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc,
return Owned(new (Context) UnaryOperator(Input, Opc, resultType, OpLoc));
}
Action::OwningExprResult Sema::BuildUnaryOp(Scope *S, SourceLocation OpLoc,
ExprResult Sema::BuildUnaryOp(Scope *S, SourceLocation OpLoc,
UnaryOperator::Opcode Opc,
Expr *Input) {
if (getLangOptions().CPlusPlus && Input->getType()->isOverloadableType() &&
@ -6772,13 +6772,13 @@ Action::OwningExprResult Sema::BuildUnaryOp(Scope *S, SourceLocation OpLoc,
}
// Unary Operators. 'Tok' is the token for the operator.
Action::OwningExprResult Sema::ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
ExprResult Sema::ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
tok::TokenKind Op, Expr *Input) {
return BuildUnaryOp(S, OpLoc, ConvertTokenKindToUnaryOpcode(Op), Input);
}
/// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
Sema::OwningExprResult Sema::ActOnAddrLabel(SourceLocation OpLoc,
ExprResult Sema::ActOnAddrLabel(SourceLocation OpLoc,
SourceLocation LabLoc,
IdentifierInfo *LabelII) {
// Look up the record for this label identifier.
@ -6794,7 +6794,7 @@ Sema::OwningExprResult Sema::ActOnAddrLabel(SourceLocation OpLoc,
Context.getPointerType(Context.VoidTy)));
}
Sema::OwningExprResult
ExprResult
Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt,
SourceLocation RPLoc) { // "({..})"
assert(SubStmt && isa<CompoundStmt>(SubStmt) && "Invalid action invocation!");
@ -6829,7 +6829,7 @@ Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt,
return Owned(new (Context) StmtExpr(Compound, Ty, LPLoc, RPLoc));
}
Sema::OwningExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
TypeSourceInfo *TInfo,
OffsetOfComponent *CompPtr,
unsigned NumComponents,
@ -6985,7 +6985,7 @@ Sema::OwningExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
Exprs.data(), Exprs.size(), RParenLoc));
}
Sema::OwningExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
ExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
SourceLocation BuiltinLoc,
SourceLocation TypeLoc,
ParsedType argty,
@ -7006,7 +7006,7 @@ Sema::OwningExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
}
Sema::OwningExprResult Sema::ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
ExprResult Sema::ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
ParsedType arg1,ParsedType arg2,
SourceLocation RPLoc) {
TypeSourceInfo *argTInfo1;
@ -7019,7 +7019,7 @@ Sema::OwningExprResult Sema::ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
return BuildTypesCompatibleExpr(BuiltinLoc, argTInfo1, argTInfo2, RPLoc);
}
Sema::OwningExprResult
ExprResult
Sema::BuildTypesCompatibleExpr(SourceLocation BuiltinLoc,
TypeSourceInfo *argTInfo1,
TypeSourceInfo *argTInfo2,
@ -7035,7 +7035,7 @@ Sema::BuildTypesCompatibleExpr(SourceLocation BuiltinLoc,
}
Sema::OwningExprResult Sema::ActOnChooseExpr(SourceLocation BuiltinLoc,
ExprResult Sema::ActOnChooseExpr(SourceLocation BuiltinLoc,
Expr *CondExpr,
Expr *LHSExpr, Expr *RHSExpr,
SourceLocation RPLoc) {
@ -7197,7 +7197,7 @@ void Sema::ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope) {
/// ActOnBlockStmtExpr - This is called when the body of a block statement
/// literal was successfully completed. ^(int x){...}
Sema::OwningExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
Stmt *Body, Scope *CurScope) {
// If blocks are disabled, emit an error.
if (!LangOpts.Blocks)
@ -7296,7 +7296,7 @@ Sema::OwningExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
return Owned(Result);
}
Sema::OwningExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc,
ExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc,
Expr *expr, ParsedType type,
SourceLocation RPLoc) {
TypeSourceInfo *TInfo;
@ -7304,7 +7304,7 @@ Sema::OwningExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc,
return BuildVAArgExpr(BuiltinLoc, expr, TInfo, RPLoc);
}
Sema::OwningExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc,
ExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc,
Expr *E, TypeSourceInfo *TInfo,
SourceLocation RPLoc) {
Expr *OrigExpr = E;
@ -7342,7 +7342,7 @@ Sema::OwningExprResult Sema::BuildVAArgExpr(SourceLocation BuiltinLoc,
return Owned(new (Context) VAArgExpr(BuiltinLoc, E, TInfo, RPLoc, T));
}
Sema::OwningExprResult Sema::ActOnGNUNullExpr(SourceLocation TokenLoc) {
ExprResult Sema::ActOnGNUNullExpr(SourceLocation TokenLoc) {
// The type of __null will be int or long, depending on the size of
// pointers on the target.
QualType Ty;
@ -7870,8 +7870,8 @@ bool Sema::CheckBooleanCondition(Expr *&E, SourceLocation Loc) {
return false;
}
Sema::OwningExprResult Sema::ActOnBooleanCondition(Scope *S, SourceLocation Loc,
Expr *Sub) {
ExprResult Sema::ActOnBooleanCondition(Scope *S, SourceLocation Loc,
Expr *Sub) {
if (!Sub)
return ExprError();

View File

@ -258,7 +258,7 @@ ParsedType Sema::getDestructorName(SourceLocation TildeLoc,
}
/// \brief Build a C++ typeid expression with a type operand.
Sema::OwningExprResult Sema::BuildCXXTypeId(QualType TypeInfoType,
ExprResult Sema::BuildCXXTypeId(QualType TypeInfoType,
SourceLocation TypeidLoc,
TypeSourceInfo *Operand,
SourceLocation RParenLoc) {
@ -281,7 +281,7 @@ Sema::OwningExprResult Sema::BuildCXXTypeId(QualType TypeInfoType,
}
/// \brief Build a C++ typeid expression with an expression operand.
Sema::OwningExprResult Sema::BuildCXXTypeId(QualType TypeInfoType,
ExprResult Sema::BuildCXXTypeId(QualType TypeInfoType,
SourceLocation TypeidLoc,
Expr *E,
SourceLocation RParenLoc) {
@ -333,7 +333,7 @@ Sema::OwningExprResult Sema::BuildCXXTypeId(QualType TypeInfoType,
}
/// ActOnCXXTypeidOfType - Parse typeid( type-id ) or typeid (expression);
Action::OwningExprResult
ExprResult
Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc,
bool isType, void *TyOrExpr, SourceLocation RParenLoc) {
// Find the std::type_info type.
@ -368,7 +368,7 @@ Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc,
}
/// ActOnCXXBoolLiteral - Parse {true,false} literals.
Action::OwningExprResult
ExprResult
Sema::ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind) {
assert((Kind == tok::kw_true || Kind == tok::kw_false) &&
"Unknown C++ Boolean value!");
@ -377,13 +377,13 @@ Sema::ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind) {
}
/// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
Action::OwningExprResult
ExprResult
Sema::ActOnCXXNullPtrLiteral(SourceLocation Loc) {
return Owned(new (Context) CXXNullPtrLiteralExpr(Context.NullPtrTy, Loc));
}
/// ActOnCXXThrow - Parse throw expressions.
Action::OwningExprResult
ExprResult
Sema::ActOnCXXThrow(SourceLocation OpLoc, Expr *Ex) {
if (Ex && !Ex->isTypeDependent() && CheckCXXThrowOperand(OpLoc, Ex))
return ExprError();
@ -431,7 +431,7 @@ bool Sema::CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *&E) {
InitializedEntity Entity =
InitializedEntity::InitializeException(ThrowLoc, E->getType(),
/*NRVO=*/false);
OwningExprResult Res = PerformCopyInitialization(Entity,
ExprResult Res = PerformCopyInitialization(Entity,
SourceLocation(),
Owned(E));
if (Res.isInvalid())
@ -463,7 +463,7 @@ bool Sema::CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *&E) {
return false;
}
Action::OwningExprResult Sema::ActOnCXXThis(SourceLocation ThisLoc) {
ExprResult Sema::ActOnCXXThis(SourceLocation ThisLoc) {
/// C++ 9.3.2: In the body of a non-static member function, the keyword this
/// is a non-lvalue expression whose value is the address of the object for
/// which the function is called.
@ -482,7 +482,7 @@ Action::OwningExprResult Sema::ActOnCXXThis(SourceLocation ThisLoc) {
/// Can be interpreted either as function-style casting ("int(x)")
/// or class type construction ("ClassType(x,y,z)")
/// or creation of a value-initialized type ("int()").
Action::OwningExprResult
ExprResult
Sema::ActOnCXXTypeConstructExpr(SourceRange TypeRange, ParsedType TypeRep,
SourceLocation LParenLoc,
MultiExprArg exprs,
@ -554,7 +554,7 @@ Sema::ActOnCXXTypeConstructExpr(SourceRange TypeRange, ParsedType TypeRep,
: InitializationKind::CreateValue(TypeRange.getBegin(),
LParenLoc, RParenLoc);
InitializationSequence InitSeq(*this, Entity, Kind, Exprs, NumExprs);
OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind,
ExprResult Result = InitSeq.Perform(*this, Entity, Kind,
move(exprs));
// FIXME: Improve AST representation?
@ -586,7 +586,7 @@ Sema::ActOnCXXTypeConstructExpr(SourceRange TypeRange, ParsedType TypeRep,
/// or
/// @code ::new Foo(23, "hello") @endcode
/// For the interpretation of this heap of arguments, consult the base version.
Action::OwningExprResult
ExprResult
Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
SourceLocation PlacementLParen, MultiExprArg PlacementArgs,
SourceLocation PlacementRParen, SourceRange TypeIdParens,
@ -648,7 +648,7 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
ConstructorRParen);
}
Sema::OwningExprResult
ExprResult
Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal,
SourceLocation PlacementLParen,
MultiExprArg PlacementArgs,
@ -684,7 +684,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal,
QualType SizeType = ArraySize->getType();
OwningExprResult ConvertedSize
ExprResult ConvertedSize
= ConvertToIntegralOrEnumerationType(StartLoc, ArraySize,
PDiag(diag::err_array_size_not_integral),
PDiag(diag::err_array_size_incomplete_type)
@ -807,7 +807,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal,
InitializedEntity Entity
= InitializedEntity::InitializeNew(StartLoc, AllocType);
InitializationSequence InitSeq(*this, Entity, Kind, ConsArgs, NumConsArgs);
OwningExprResult FullInit = InitSeq.Perform(*this, Entity, Kind,
ExprResult FullInit = InitSeq.Perform(*this, Entity, Kind,
move(ConstructorArgs));
if (FullInit.isInvalid())
return ExprError();
@ -1133,7 +1133,7 @@ bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range,
// Watch out for variadic allocator function.
unsigned NumArgsInFnDecl = FnDecl->getNumParams();
for (unsigned i = 0; (i < NumArgs && i < NumArgsInFnDecl); ++i) {
OwningExprResult Result
ExprResult Result
= PerformCopyInitialization(InitializedEntity::InitializeParameter(
FnDecl->getParamDecl(i)),
SourceLocation(),
@ -1376,7 +1376,7 @@ bool Sema::FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD,
/// @code ::delete ptr; @endcode
/// or
/// @code delete [] ptr; @endcode
Action::OwningExprResult
ExprResult
Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
bool ArrayForm, Expr *Ex) {
// C++ [expr.delete]p1:
@ -1500,7 +1500,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
/// \brief Check the use of the given variable as a C++ condition in an if,
/// while, do-while, or switch statement.
Action::OwningExprResult Sema::CheckConditionVariable(VarDecl *ConditionVar,
ExprResult Sema::CheckConditionVariable(VarDecl *ConditionVar,
SourceLocation StmtLoc,
bool ConvertToBoolean) {
QualType T = ConditionVar->getType();
@ -1569,7 +1569,7 @@ Sema::IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType) {
return false;
}
static Sema::OwningExprResult BuildCXXCastArgument(Sema &S,
static ExprResult BuildCXXCastArgument(Sema &S,
SourceLocation CastLoc,
QualType Ty,
CastExpr::CastKind Kind,
@ -1585,7 +1585,7 @@ static Sema::OwningExprResult BuildCXXCastArgument(Sema &S,
CastLoc, ConstructorArgs))
return S.ExprError();
Sema::OwningExprResult Result =
ExprResult Result =
S.BuildCXXConstructExpr(CastLoc, Ty, cast<CXXConstructorDecl>(Method),
move_arg(ConstructorArgs));
if (Result.isInvalid())
@ -1655,7 +1655,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
return true;
}
OwningExprResult CastArg
ExprResult CastArg
= BuildCXXCastArgument(*this,
From->getLocStart(),
ToType.getNonReferenceType(),
@ -1715,7 +1715,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
/*FIXME:ConstructLoc*/SourceLocation(),
ConstructorArgs))
return true;
OwningExprResult FromResult =
ExprResult FromResult =
BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(),
ToType, SCS.CopyConstructor,
move_arg(ConstructorArgs));
@ -1724,7 +1724,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
From = FromResult.takeAs<Expr>();
return false;
}
OwningExprResult FromResult =
ExprResult FromResult =
BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(),
ToType, SCS.CopyConstructor,
MultiExprArg(*this, &From, 1));
@ -1922,7 +1922,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
return false;
}
Sema::OwningExprResult Sema::ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
ExprResult Sema::ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
SourceLocation KWLoc,
SourceLocation LParen,
ParsedType Ty,
@ -2172,7 +2172,7 @@ static bool ConvertForConditional(Sema &Self, Expr *&E, QualType T) {
InitializationKind Kind = InitializationKind::CreateCopy(E->getLocStart(),
SourceLocation());
InitializationSequence InitSeq(Self, Entity, Kind, &E, 1);
Sema::OwningExprResult Result = InitSeq.Perform(Self, Entity, Kind,
ExprResult Result = InitSeq.Perform(Self, Entity, Kind,
Sema::MultiExprArg(Self, &E, 1));
if (Result.isInvalid())
return true;
@ -2312,13 +2312,13 @@ QualType Sema::CXXCheckConditionalOperands(Expr *&Cond, Expr *&LHS, Expr *&RHS,
if (LTy->isRecordType()) {
// The operands have class type. Make a temporary copy.
InitializedEntity Entity = InitializedEntity::InitializeTemporary(LTy);
OwningExprResult LHSCopy = PerformCopyInitialization(Entity,
ExprResult LHSCopy = PerformCopyInitialization(Entity,
SourceLocation(),
Owned(LHS));
if (LHSCopy.isInvalid())
return QualType();
OwningExprResult RHSCopy = PerformCopyInitialization(Entity,
ExprResult RHSCopy = PerformCopyInitialization(Entity,
SourceLocation(),
Owned(RHS));
if (RHSCopy.isInvalid())
@ -2554,14 +2554,14 @@ QualType Sema::FindCompositePointerType(SourceLocation Loc,
}
// Convert E1 to Composite1
OwningExprResult E1Result
ExprResult E1Result
= E1ToC1.Perform(*this, Entity1, Kind, MultiExprArg(*this,&E1,1));
if (E1Result.isInvalid())
return QualType();
E1 = E1Result.takeAs<Expr>();
// Convert E2 to Composite1
OwningExprResult E2Result
ExprResult E2Result
= E2ToC1.Perform(*this, Entity1, Kind, MultiExprArg(*this,&E2,1));
if (E2Result.isInvalid())
return QualType();
@ -2579,14 +2579,14 @@ QualType Sema::FindCompositePointerType(SourceLocation Loc,
return QualType();
// Convert E1 to Composite2
OwningExprResult E1Result
ExprResult E1Result
= E1ToC2.Perform(*this, Entity2, Kind, MultiExprArg(*this, &E1, 1));
if (E1Result.isInvalid())
return QualType();
E1 = E1Result.takeAs<Expr>();
// Convert E2 to Composite2
OwningExprResult E2Result
ExprResult E2Result
= E2ToC2.Perform(*this, Entity2, Kind, MultiExprArg(*this, &E2, 1));
if (E2Result.isInvalid())
return QualType();
@ -2595,7 +2595,7 @@ QualType Sema::FindCompositePointerType(SourceLocation Loc,
return Composite2;
}
Sema::OwningExprResult Sema::MaybeBindToTemporary(Expr *E) {
ExprResult Sema::MaybeBindToTemporary(Expr *E) {
if (!Context.getLangOptions().CPlusPlus)
return Owned(E);
@ -2655,8 +2655,8 @@ Expr *Sema::MaybeCreateCXXExprWithTemporaries(Expr *SubExpr) {
return E;
}
Sema::OwningExprResult
Sema::MaybeCreateCXXExprWithTemporaries(OwningExprResult SubExpr) {
ExprResult
Sema::MaybeCreateCXXExprWithTemporaries(ExprResult SubExpr) {
if (SubExpr.isInvalid())
return ExprError();
@ -2679,12 +2679,12 @@ FullExpr Sema::CreateFullExpr(Expr *SubExpr) {
return E;
}
Sema::OwningExprResult
ExprResult
Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc,
tok::TokenKind OpKind, ParsedType &ObjectType,
bool &MayBePseudoDestructor) {
// Since this might be a postfix expression, get rid of ParenListExprs.
OwningExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base);
ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base);
if (Result.isInvalid()) return ExprError();
Base = Result.get();
@ -2764,7 +2764,7 @@ Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc,
return move(Base);
}
Sema::OwningExprResult Sema::DiagnoseDtorReference(SourceLocation NameLoc,
ExprResult Sema::DiagnoseDtorReference(SourceLocation NameLoc,
Expr *MemExpr) {
SourceLocation ExpectedLParenLoc = PP.getLocForEndOfToken(NameLoc);
Diag(MemExpr->getLocStart(), diag::err_dtor_expr_without_call)
@ -2779,7 +2779,7 @@ Sema::OwningExprResult Sema::DiagnoseDtorReference(SourceLocation NameLoc,
/*RPLoc*/ ExpectedLParenLoc);
}
Sema::OwningExprResult Sema::BuildPseudoDestructorExpr(Expr *Base,
ExprResult Sema::BuildPseudoDestructorExpr(Expr *Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
const CXXScopeSpec &SS,
@ -2874,7 +2874,7 @@ Sema::OwningExprResult Sema::BuildPseudoDestructorExpr(Expr *Base,
return DiagnoseDtorReference(Destructed.getLocation(), Result);
}
Sema::OwningExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, Expr *Base,
ExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, Expr *Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
CXXScopeSpec &SS,
@ -3044,7 +3044,7 @@ CXXMemberCallExpr *Sema::BuildCXXMemberCallExpr(Expr *Exp,
return CE;
}
Sema::OwningExprResult Sema::ActOnFinishFullExpr(Expr *FullExpr) {
ExprResult Sema::ActOnFinishFullExpr(Expr *FullExpr) {
if (!FullExpr) return ExprError();
return MaybeCreateCXXExprWithTemporaries(FullExpr);
}

View File

@ -241,7 +241,7 @@ bool Sema::CheckMessageArgumentTypes(Expr **Args, unsigned NumArgs,
return true;
InitializedEntity Entity = InitializedEntity::InitializeParameter(Param);
OwningExprResult ArgE = PerformCopyInitialization(Entity,
ExprResult ArgE = PerformCopyInitialization(Entity,
SourceLocation(),
Owned(argExpr->Retain()));
if (ArgE.isInvalid())
@ -331,7 +331,7 @@ ObjCMethodDecl *Sema::LookupPrivateInstanceMethod(Selector Sel,
/// HandleExprPropertyRefExpr - Handle foo.bar where foo is a pointer to an
/// objective C interface. This is a property reference expression.
Action::OwningExprResult Sema::
ExprResult Sema::
HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
Expr *BaseExpr, DeclarationName MemberName,
SourceLocation MemberLoc) {
@ -433,7 +433,7 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
Action::OwningExprResult Sema::
ExprResult Sema::
ActOnClassPropertyRefExpr(IdentifierInfo &receiverName,
IdentifierInfo &propertyName,
SourceLocation receiverNameLoc,
@ -624,7 +624,7 @@ Sema::ObjCMessageKind Sema::getObjCMessageKind(Scope *S,
return ObjCInstanceMessage;
}
Sema::OwningExprResult Sema::ActOnSuperMessage(Scope *S,
ExprResult Sema::ActOnSuperMessage(Scope *S,
SourceLocation SuperLoc,
Selector Sel,
SourceLocation LBracLoc,
@ -700,7 +700,7 @@ Sema::OwningExprResult Sema::ActOnSuperMessage(Scope *S,
/// \param RBrac The location of the closing square bracket ']'.
///
/// \param Args The message arguments.
Sema::OwningExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
QualType ReceiverType,
SourceLocation SuperLoc,
Selector Sel,
@ -779,7 +779,7 @@ Sema::OwningExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
// ActOnClassMessage - used for both unary and keyword messages.
// ArgExprs is optional - if it is present, the number of expressions
// is obtained from Sel.getNumArgs().
Sema::OwningExprResult Sema::ActOnClassMessage(Scope *S,
ExprResult Sema::ActOnClassMessage(Scope *S,
ParsedType Receiver,
Selector Sel,
SourceLocation LBracLoc,
@ -828,7 +828,7 @@ Sema::OwningExprResult Sema::ActOnClassMessage(Scope *S,
/// \param RBrac The location of the closing square bracket ']'.
///
/// \param Args The message arguments.
Sema::OwningExprResult Sema::BuildInstanceMessage(Expr *Receiver,
ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
QualType ReceiverType,
SourceLocation SuperLoc,
Selector Sel,
@ -1032,13 +1032,13 @@ Sema::OwningExprResult Sema::BuildInstanceMessage(Expr *Receiver,
// ActOnInstanceMessage - used for both unary and keyword messages.
// ArgExprs is optional - if it is present, the number of expressions
// is obtained from Sel.getNumArgs().
Sema::OwningExprResult Sema::ActOnInstanceMessage(Scope *S,
Expr *Receiver,
Selector Sel,
SourceLocation LBracLoc,
SourceLocation SelectorLoc,
SourceLocation RBracLoc,
MultiExprArg Args) {
ExprResult Sema::ActOnInstanceMessage(Scope *S,
Expr *Receiver,
Selector Sel,
SourceLocation LBracLoc,
SourceLocation SelectorLoc,
SourceLocation RBracLoc,
MultiExprArg Args) {
if (!Receiver)
return ExprError();

View File

@ -263,7 +263,7 @@ void InitListChecker::FillInValueInitForField(unsigned Init, FieldDecl *Field,
return;
}
Sema::OwningExprResult MemberInit
ExprResult MemberInit
= InitSeq.Perform(SemaRef, MemberEntity, Kind,
Sema::MultiExprArg(SemaRef, 0, 0));
if (MemberInit.isInvalid()) {
@ -373,7 +373,7 @@ InitListChecker::FillInValueInitializations(const InitializedEntity &Entity,
return;
}
Sema::OwningExprResult ElementInit
ExprResult ElementInit
= InitSeq.Perform(SemaRef, ElementEntity, Kind,
Sema::MultiExprArg(SemaRef, 0, 0));
if (ElementInit.isInvalid()) {
@ -678,7 +678,7 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity,
InitializationSequence Seq(SemaRef, Entity, Kind, &expr, 1);
if (Seq) {
Sema::OwningExprResult Result =
ExprResult Result =
Seq.Perform(SemaRef, Entity, Kind,
Sema::MultiExprArg(SemaRef, &expr, 1));
if (Result.isInvalid())
@ -758,7 +758,7 @@ void InitListChecker::CheckScalarType(const InitializedEntity &Entity,
return;
}
Sema::OwningExprResult Result =
ExprResult Result =
SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(),
SemaRef.Owned(expr));
@ -805,7 +805,7 @@ void InitListChecker::CheckReferenceType(const InitializedEntity &Entity,
return;
}
Sema::OwningExprResult Result =
ExprResult Result =
SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(),
SemaRef.Owned(expr));
@ -1813,10 +1813,10 @@ CheckArrayDesignatorExpr(Sema &S, Expr *Index, llvm::APSInt &Value) {
return false;
}
Sema::OwningExprResult Sema::ActOnDesignatedInitializer(Designation &Desig,
ExprResult Sema::ActOnDesignatedInitializer(Designation &Desig,
SourceLocation Loc,
bool GNUSyntax,
OwningExprResult Init) {
ExprResult Init) {
typedef DesignatedInitExpr::Designator ASTDesignator;
bool Invalid = false;
@ -3298,10 +3298,10 @@ static bool shouldDestroyTemporary(const InitializedEntity &Entity) {
/// \returns An expression that copies the initializer expression into
/// a temporary object, or an error expression if a copy could not be
/// created.
static Sema::OwningExprResult CopyObject(Sema &S,
static ExprResult CopyObject(Sema &S,
QualType T,
const InitializedEntity &Entity,
Sema::OwningExprResult CurInit,
ExprResult CurInit,
bool IsExtraneousCopy) {
// Determine which class type we're copying to.
Expr *CurInitExpr = (Expr *)CurInit.get();
@ -3475,7 +3475,7 @@ void InitializationSequence::PrintInitLocationNote(Sema &S,
}
}
Action::OwningExprResult
ExprResult
InitializationSequence::Perform(Sema &S,
const InitializedEntity &Entity,
const InitializationKind &Kind,
@ -3528,7 +3528,7 @@ InitializationSequence::Perform(Sema &S,
}
if (Kind.getKind() == InitializationKind::IK_Copy || Kind.isExplicitCast())
return Sema::OwningExprResult(Args.release()[0]);
return ExprResult(Args.release()[0]);
if (Args.size() == 0)
return S.Owned((Expr *)0);
@ -3552,7 +3552,7 @@ InitializationSequence::Perform(Sema &S,
*ResultType = Entity.getDecl() ? Entity.getDecl()->getType() :
Entity.getType();
Sema::OwningExprResult CurInit = S.Owned((Expr *)0);
ExprResult CurInit = S.Owned((Expr *)0);
assert(!Steps.empty() && "Cannot have an empty initialization sequence");
@ -3577,7 +3577,7 @@ InitializationSequence::Perform(Sema &S,
case SK_StringInit:
case SK_ObjCObjectConversion:
assert(Args.size() == 1);
CurInit = Sema::OwningExprResult(((Expr **)(Args.get()))[0]->Retain());
CurInit = ExprResult(((Expr **)(Args.get()))[0]->Retain());
if (CurInit.isInvalid())
return S.ExprError();
break;
@ -4454,10 +4454,10 @@ void InitializationSequence::dump() const {
//===----------------------------------------------------------------------===//
// Initialization helper functions
//===----------------------------------------------------------------------===//
Sema::OwningExprResult
ExprResult
Sema::PerformCopyInitialization(const InitializedEntity &Entity,
SourceLocation EqualLoc,
OwningExprResult Init) {
ExprResult Init) {
if (Init.isInvalid())
return ExprError();

View File

@ -464,7 +464,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
Expr *IvarRefExpr =
new (Context) ObjCIvarRefExpr(Ivar, Ivar->getType(), AtLoc,
SelfExpr, true, true);
OwningExprResult Res =
ExprResult Res =
PerformCopyInitialization(InitializedEntity::InitializeResult(
SourceLocation(),
getterMethod->getResultType(),
@ -494,8 +494,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
ParmVarDecl *Param = (*P);
Expr *rhs = new (Context) DeclRefExpr(Param,Param->getType(),
SourceLocation());
OwningExprResult Res = BuildBinOp(S, SourceLocation(),
BinaryOperator::Assign, lhs, rhs);
ExprResult Res = BuildBinOp(S, SourceLocation(),
BinaryOperator::Assign, lhs, rhs);
PIDecl->setSetterCXXAssignment(Res.takeAs<Expr>());
}
}

View File

@ -3191,7 +3191,7 @@ bool Sema::PerformContextuallyConvertToObjCId(Expr *&From) {
///
/// \returns The expression, converted to an integral or enumeration type if
/// successful.
Sema::OwningExprResult
ExprResult
Sema::ConvertToIntegralOrEnumerationType(SourceLocation Loc, Expr *From,
const PartialDiagnostic &NotIntDiag,
const PartialDiagnostic &IncompleteDiag,
@ -6505,7 +6505,7 @@ void Sema::AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE,
/// Attempts to recover from a call where no functions were found.
///
/// Returns true if new candidates were found.
static Sema::OwningExprResult
static ExprResult
BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
UnresolvedLookupExpr *ULE,
SourceLocation LParenLoc,
@ -6535,7 +6535,7 @@ BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
// Build an implicit member call if appropriate. Just drop the
// casts and such from the call, we don't really care.
Sema::OwningExprResult NewFn = SemaRef.ExprError();
ExprResult NewFn = SemaRef.ExprError();
if ((*R.begin())->isCXXClassMember())
NewFn = SemaRef.BuildPossibleImplicitMemberExpr(SS, R, ExplicitTemplateArgs);
else if (ExplicitTemplateArgs)
@ -6561,7 +6561,7 @@ BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
/// the function declaration produced by overload
/// resolution. Otherwise, emits diagnostics, deletes all of the
/// arguments and Fn, and returns NULL.
Sema::OwningExprResult
ExprResult
Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE,
SourceLocation LParenLoc,
Expr **Args, unsigned NumArgs,
@ -6655,7 +6655,7 @@ static bool IsOverloaded(const UnresolvedSetImpl &Functions) {
/// by CreateOverloadedUnaryOp().
///
/// \param input The input argument.
Sema::OwningExprResult
ExprResult
Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
const UnresolvedSetImpl &Fns,
Expr *Input) {
@ -6737,7 +6737,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
return ExprError();
} else {
// Convert the arguments.
OwningExprResult InputInit
ExprResult InputInit
= PerformCopyInitialization(InitializedEntity::InitializeParameter(
FnDecl->getParamDecl(0)),
SourceLocation(),
@ -6824,7 +6824,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
///
/// \param LHS Left-hand argument.
/// \param RHS Right-hand argument.
Sema::OwningExprResult
ExprResult
Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
unsigned OpcIn,
const UnresolvedSetImpl &Fns,
@ -6916,7 +6916,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
// Best->Access is only meaningful for class members.
CheckMemberOperatorAccess(OpLoc, Args[0], Args[1], Best->FoundDecl);
OwningExprResult Arg1
ExprResult Arg1
= PerformCopyInitialization(
InitializedEntity::InitializeParameter(
FnDecl->getParamDecl(0)),
@ -6932,7 +6932,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
Args[1] = RHS = Arg1.takeAs<Expr>();
} else {
// Convert the arguments.
OwningExprResult Arg0
ExprResult Arg0
= PerformCopyInitialization(
InitializedEntity::InitializeParameter(
FnDecl->getParamDecl(0)),
@ -6941,7 +6941,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
if (Arg0.isInvalid())
return ExprError();
OwningExprResult Arg1
ExprResult Arg1
= PerformCopyInitialization(
InitializedEntity::InitializeParameter(
FnDecl->getParamDecl(1)),
@ -6999,7 +6999,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
// For class as left operand for assignment or compound assigment operator
// do not fall through to handling in built-in, but report that no overloaded
// assignment operator found
OwningExprResult Result = ExprError();
ExprResult Result = ExprError();
if (Args[0]->getType()->isRecordType() &&
Opc >= BinaryOperator::Assign && Opc <= BinaryOperator::OrAssign) {
Diag(OpLoc, diag::err_ovl_no_viable_oper)
@ -7039,7 +7039,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
return CreateBuiltinBinOp(OpLoc, Opc, Args[0], Args[1]);
}
Action::OwningExprResult
ExprResult
Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
SourceLocation RLoc,
Expr *Base, Expr *Idx) {
@ -7101,7 +7101,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
return ExprError();
// Convert the arguments.
OwningExprResult InputInit
ExprResult InputInit
= PerformCopyInitialization(InitializedEntity::InitializeParameter(
FnDecl->getParamDecl(0)),
SourceLocation(),
@ -7186,7 +7186,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
/// parameter). The caller needs to validate that the member
/// expression refers to a member function or an overloaded member
/// function.
Sema::OwningExprResult
ExprResult
Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
SourceLocation LParenLoc, Expr **Args,
unsigned NumArgs, SourceLocation *CommaLocs,
@ -7539,7 +7539,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object,
// Pass the argument.
OwningExprResult InputInit
ExprResult InputInit
= PerformCopyInitialization(InitializedEntity::InitializeParameter(
Method->getParamDecl(i)),
SourceLocation(), Arg);
@ -7547,7 +7547,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object,
IsError |= InputInit.isInvalid();
Arg = InputInit.takeAs<Expr>();
} else {
OwningExprResult DefArg
ExprResult DefArg
= BuildCXXDefaultArgExpr(LParenLoc, Method, Method->getParamDecl(i));
if (DefArg.isInvalid()) {
IsError = true;
@ -7581,7 +7581,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object,
/// BuildOverloadedArrowExpr - Build a call to an overloaded @c operator->
/// (if one exists), where @c Base is an expression of class type and
/// @c Member is the name of the member we're trying to find.
Sema::OwningExprResult
ExprResult
Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc) {
assert(Base->getType()->isRecordType() && "left-hand side must have class type");
@ -7806,9 +7806,9 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,
return E->Retain();
}
Sema::OwningExprResult Sema::FixOverloadedFunctionReference(OwningExprResult E,
DeclAccessPair Found,
FunctionDecl *Fn) {
ExprResult Sema::FixOverloadedFunctionReference(ExprResult E,
DeclAccessPair Found,
FunctionDecl *Fn) {
return Owned(FixOverloadedFunctionReference((Expr *)E.get(), Found, Fn));
}

View File

@ -27,7 +27,7 @@
#include "llvm/ADT/SmallVector.h"
using namespace clang;
Sema::OwningStmtResult Sema::ActOnExprStmt(FullExprArg expr) {
StmtResult Sema::ActOnExprStmt(FullExprArg expr) {
Expr *E = expr.get();
assert(E && "ActOnExprStmt(): missing expression");
// C99 6.8.3p2: The expression in an expression statement is evaluated as a
@ -39,11 +39,11 @@ Sema::OwningStmtResult Sema::ActOnExprStmt(FullExprArg expr) {
}
Sema::OwningStmtResult Sema::ActOnNullStmt(SourceLocation SemiLoc) {
StmtResult Sema::ActOnNullStmt(SourceLocation SemiLoc) {
return Owned(new (Context) NullStmt(SemiLoc));
}
Sema::OwningStmtResult Sema::ActOnDeclStmt(DeclGroupPtrTy dg,
StmtResult Sema::ActOnDeclStmt(DeclGroupPtrTy dg,
SourceLocation StartLoc,
SourceLocation EndLoc) {
DeclGroupRef DG = dg.getAsVal<DeclGroupRef>();
@ -135,7 +135,7 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S) {
DiagRuntimeBehavior(Loc, PDiag(DiagID) << R1 << R2);
}
Action::OwningStmtResult
StmtResult
Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R,
MultiStmtArg elts, bool isStmtExpr) {
unsigned NumElts = elts.size();
@ -170,7 +170,7 @@ Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R,
return Owned(new (Context) CompoundStmt(Context, Elts, NumElts, L, R));
}
Action::OwningStmtResult
StmtResult
Sema::ActOnCaseStmt(SourceLocation CaseLoc, Expr *LHSVal,
SourceLocation DotDotDotLoc, Expr *RHSVal,
SourceLocation ColonLoc) {
@ -206,7 +206,7 @@ void Sema::ActOnCaseStmtBody(Stmt *caseStmt, Stmt *SubStmt) {
CS->setSubStmt(SubStmt);
}
Action::OwningStmtResult
StmtResult
Sema::ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc,
Stmt *SubStmt, Scope *CurScope) {
if (getSwitchStack().empty()) {
@ -219,7 +219,7 @@ Sema::ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc,
return Owned(DS);
}
Action::OwningStmtResult
StmtResult
Sema::ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II,
SourceLocation ColonLoc, Stmt *SubStmt) {
// Look up the record for this label identifier.
@ -246,11 +246,11 @@ Sema::ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II,
return Owned(LabelDecl);
}
Action::OwningStmtResult
StmtResult
Sema::ActOnIfStmt(SourceLocation IfLoc, FullExprArg CondVal, Decl *CondVar,
Stmt *thenStmt, SourceLocation ElseLoc,
Stmt *elseStmt) {
OwningExprResult CondResult(CondVal.release());
ExprResult CondResult(CondVal.release());
VarDecl *ConditionVar = 0;
if (CondVar) {
@ -382,10 +382,10 @@ static QualType GetTypeBeforeIntegralPromotion(const Expr* expr) {
return expr->getType();
}
Action::OwningStmtResult
StmtResult
Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, Expr *Cond,
Decl *CondVar) {
OwningExprResult CondResult;
ExprResult CondResult;
VarDecl *ConditionVar = 0;
if (CondVar) {
@ -427,7 +427,7 @@ Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, Expr *Cond,
return Owned(SS);
}
Action::OwningStmtResult
StmtResult
Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
Stmt *BodyStmt) {
SwitchStmt *SS = cast<SwitchStmt>(Switch);
@ -783,10 +783,10 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
return Owned(SS);
}
Action::OwningStmtResult
StmtResult
Sema::ActOnWhileStmt(SourceLocation WhileLoc, FullExprArg Cond,
Decl *CondVar, Stmt *Body) {
OwningExprResult CondResult(Cond.release());
ExprResult CondResult(Cond.release());
VarDecl *ConditionVar = 0;
if (CondVar) {
@ -805,7 +805,7 @@ Sema::ActOnWhileStmt(SourceLocation WhileLoc, FullExprArg Cond,
Body, WhileLoc));
}
Action::OwningStmtResult
StmtResult
Sema::ActOnDoStmt(SourceLocation DoLoc, Stmt *Body,
SourceLocation WhileLoc, SourceLocation CondLParen,
Expr *Cond, SourceLocation CondRParen) {
@ -814,7 +814,7 @@ Sema::ActOnDoStmt(SourceLocation DoLoc, Stmt *Body,
if (CheckBooleanCondition(Cond, DoLoc))
return StmtError();
OwningExprResult CondResult = MaybeCreateCXXExprWithTemporaries(Cond);
ExprResult CondResult = MaybeCreateCXXExprWithTemporaries(Cond);
if (CondResult.isInvalid())
return StmtError();
Cond = CondResult.take();
@ -824,7 +824,7 @@ Sema::ActOnDoStmt(SourceLocation DoLoc, Stmt *Body,
return Owned(new (Context) DoStmt(Body, Cond, DoLoc, WhileLoc, CondRParen));
}
Action::OwningStmtResult
StmtResult
Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
Stmt *First, FullExprArg second, Decl *secondVar,
FullExprArg third,
@ -846,7 +846,7 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
}
}
OwningExprResult SecondResult(second.release());
ExprResult SecondResult(second.release());
VarDecl *ConditionVar = 0;
if (secondVar) {
ConditionVar = cast<VarDecl>(secondVar);
@ -867,7 +867,7 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
RParenLoc));
}
Action::OwningStmtResult
StmtResult
Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc,
SourceLocation LParenLoc,
Stmt *First, Expr *Second,
@ -936,7 +936,7 @@ Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc,
ForLoc, RParenLoc));
}
Action::OwningStmtResult
StmtResult
Sema::ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc,
IdentifierInfo *LabelII) {
// Look up the record for this label identifier.
@ -951,7 +951,7 @@ Sema::ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc,
return Owned(new (Context) GotoStmt(LabelDecl, GotoLoc, LabelLoc));
}
Action::OwningStmtResult
StmtResult
Sema::ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc,
Expr *E) {
// Convert operand to void*
@ -969,7 +969,7 @@ Sema::ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc,
return Owned(new (Context) IndirectGotoStmt(GotoLoc, StarLoc, E));
}
Action::OwningStmtResult
StmtResult
Sema::ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope) {
Scope *S = CurScope->getContinueParent();
if (!S) {
@ -980,7 +980,7 @@ Sema::ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope) {
return Owned(new (Context) ContinueStmt(ContinueLoc));
}
Action::OwningStmtResult
StmtResult
Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) {
Scope *S = CurScope->getBreakParent();
if (!S) {
@ -1032,7 +1032,7 @@ static const VarDecl *getNRVOCandidate(ASTContext &Ctx, QualType RetType,
/// ActOnBlockReturnStmt - Utility routine to figure out block's return type.
///
Action::OwningStmtResult
StmtResult
Sema::ActOnBlockReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
// If this is the first return we've seen in the block, infer the type of
// the block from it.
@ -1086,7 +1086,7 @@ Sema::ActOnBlockReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
// In C++ the return statement is handled via a copy initialization.
// the C version of which boils down to CheckSingleAssignmentConstraints.
NRVOCandidate = getNRVOCandidate(Context, FnRetType, RetValExp);
OwningExprResult Res = PerformCopyInitialization(
ExprResult Res = PerformCopyInitialization(
InitializedEntity::InitializeResult(ReturnLoc,
FnRetType,
NRVOCandidate != 0),
@ -1117,7 +1117,7 @@ Sema::ActOnBlockReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
return Owned(Result);
}
Action::OwningStmtResult
StmtResult
Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
if (getCurBlock())
return ActOnBlockReturnStmt(ReturnLoc, RetValExp);
@ -1177,7 +1177,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
// In C++ the return statement is handled via a copy initialization.
// the C version of which boils down to CheckSingleAssignmentConstraints.
NRVOCandidate = getNRVOCandidate(Context, FnRetType, RetValExp);
OwningExprResult Res = PerformCopyInitialization(
ExprResult Res = PerformCopyInitialization(
InitializedEntity::InitializeResult(ReturnLoc,
FnRetType,
NRVOCandidate != 0),
@ -1241,7 +1241,7 @@ static bool CheckAsmLValue(const Expr *E, Sema &S) {
}
Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
bool IsSimple,
bool IsVolatile,
unsigned NumOutputs,
@ -1462,7 +1462,7 @@ Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
return Owned(NS);
}
Action::OwningStmtResult
StmtResult
Sema::ActOnObjCAtCatchStmt(SourceLocation AtLoc,
SourceLocation RParen, Decl *Parm,
Stmt *Body) {
@ -1473,12 +1473,12 @@ Sema::ActOnObjCAtCatchStmt(SourceLocation AtLoc,
return Owned(new (Context) ObjCAtCatchStmt(AtLoc, RParen, Var, Body));
}
Action::OwningStmtResult
StmtResult
Sema::ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body) {
return Owned(new (Context) ObjCAtFinallyStmt(AtLoc, Body));
}
Action::OwningStmtResult
StmtResult
Sema::ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try,
MultiStmtArg CatchStmts, Stmt *Finally) {
setFunctionHasBranchProtectedScope();
@ -1489,7 +1489,7 @@ Sema::ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try,
Finally));
}
Sema::OwningStmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc,
StmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc,
Expr *Throw) {
if (Throw) {
QualType ThrowType = Throw->getType();
@ -1506,7 +1506,7 @@ Sema::OwningStmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc,
return Owned(new (Context) ObjCAtThrowStmt(AtLoc, Throw));
}
Action::OwningStmtResult
StmtResult
Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw,
Scope *CurScope) {
if (!Throw) {
@ -1522,7 +1522,7 @@ Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw,
return BuildObjCAtThrowStmt(AtLoc, Throw);
}
Action::OwningStmtResult
StmtResult
Sema::ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SyncExpr,
Stmt *SyncBody) {
setFunctionHasBranchProtectedScope();
@ -1541,7 +1541,7 @@ Sema::ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SyncExpr,
/// ActOnCXXCatchBlock - Takes an exception declaration and a handler block
/// and creates a proper catch handler from them.
Action::OwningStmtResult
StmtResult
Sema::ActOnCXXCatchBlock(SourceLocation CatchLoc, Decl *ExDecl,
Stmt *HandlerBlock) {
// There's nothing to test that ActOnExceptionDecl didn't already test.
@ -1585,7 +1585,7 @@ public:
/// ActOnCXXTryBlock - Takes a try compound-statement and a number of
/// handlers and creates a try statement from them.
Action::OwningStmtResult
StmtResult
Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock,
MultiStmtArg RawHandlers) {
unsigned NumHandlers = RawHandlers.size();

View File

@ -344,7 +344,7 @@ void Sema::LookupTemplateName(LookupResult &Found,
/// ActOnDependentIdExpression - Handle a dependent id-expression that
/// was just parsed. This is only possible with an explicit scope
/// specifier naming a dependent type.
Sema::OwningExprResult
ExprResult
Sema::ActOnDependentIdExpression(const CXXScopeSpec &SS,
const DeclarationNameInfo &NameInfo,
bool isAddressOfOperand,
@ -376,7 +376,7 @@ Sema::ActOnDependentIdExpression(const CXXScopeSpec &SS,
return BuildDependentDeclRefExpr(SS, NameInfo, TemplateArgs);
}
Sema::OwningExprResult
ExprResult
Sema::BuildDependentDeclRefExpr(const CXXScopeSpec &SS,
const DeclarationNameInfo &NameInfo,
const TemplateArgumentListInfo *TemplateArgs) {
@ -1578,7 +1578,7 @@ Sema::TypeResult Sema::ActOnTagTemplateIdType(TypeResult TypeResult,
return ParsedType::make(ElabType);
}
Sema::OwningExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS,
ExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS,
LookupResult &R,
bool RequiresADL,
const TemplateArgumentListInfo &TemplateArgs) {
@ -1615,7 +1615,7 @@ Sema::OwningExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS,
}
// We actually only call this from template instantiation.
Sema::OwningExprResult
ExprResult
Sema::BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS,
const DeclarationNameInfo &NameInfo,
const TemplateArgumentListInfo &TemplateArgs) {
@ -1860,7 +1860,7 @@ SubstDefaultTemplateArgument(Sema &SemaRef,
/// parameters that precede \p Param in the template parameter list.
///
/// \returns the substituted template argument, or NULL if an error occurred.
static Sema::OwningExprResult
static ExprResult
SubstDefaultTemplateArgument(Sema &SemaRef,
TemplateDecl *Template,
SourceLocation TemplateLoc,
@ -1956,7 +1956,7 @@ Sema::SubstDefaultTemplateArgumentIfAvailable(TemplateDecl *Template,
if (!NonTypeParm->hasDefaultArgument())
return TemplateArgumentLoc();
OwningExprResult Arg = SubstDefaultTemplateArgument(*this, Template,
ExprResult Arg = SubstDefaultTemplateArgument(*this, Template,
TemplateLoc,
RAngleLoc,
NonTypeParm,
@ -2279,7 +2279,7 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template,
break;
}
Sema::OwningExprResult E = SubstDefaultTemplateArgument(*this, Template,
ExprResult E = SubstDefaultTemplateArgument(*this, Template,
TemplateLoc,
RAngleLoc,
NTTP,
@ -3038,7 +3038,7 @@ bool Sema::CheckTemplateArgument(TemplateTemplateParmDecl *Param,
/// declaration and the type of its corresponding non-type template
/// parameter, produce an expression that properly refers to that
/// declaration.
Sema::OwningExprResult
ExprResult
Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg,
QualType ParamType,
SourceLocation Loc) {
@ -3061,7 +3061,7 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg,
ClassType.getTypePtr());
CXXScopeSpec SS;
SS.setScopeRep(Qualifier);
OwningExprResult RefExpr = BuildDeclRefExpr(VD,
ExprResult RefExpr = BuildDeclRefExpr(VD,
VD->getType().getNonReferenceType(),
Loc,
&SS);
@ -3092,7 +3092,7 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg,
if (ParamType->isPointerType()) {
// When the non-type template parameter is a pointer, take the
// address of the declaration.
OwningExprResult RefExpr = BuildDeclRefExpr(VD, T, Loc);
ExprResult RefExpr = BuildDeclRefExpr(VD, T, Loc);
if (RefExpr.isInvalid())
return ExprError();
@ -3128,7 +3128,7 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg,
/// This routine takes care of the mapping from an integral template
/// argument (which may have any integral type) to the appropriate
/// literal value.
Sema::OwningExprResult
ExprResult
Sema::BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg,
SourceLocation Loc) {
assert(Arg.getKind() == TemplateArgument::Integral &&
@ -5485,7 +5485,7 @@ TypeSourceInfo *Sema::RebuildTypeInCurrentInstantiation(TypeSourceInfo *T,
return Rebuilder.TransformType(T);
}
OwningExprResult Sema::RebuildExprInCurrentInstantiation(Expr *E) {
ExprResult Sema::RebuildExprInCurrentInstantiation(Expr *E) {
CurrentInstantiationRebuilder Rebuilder(*this, E->getExprLoc(),
DeclarationName());
return Rebuilder.TransformExpr(E);

View File

@ -614,10 +614,10 @@ namespace {
QualType RebuildElaboratedType(ElaboratedTypeKeyword Keyword,
NestedNameSpecifier *NNS, QualType T);
Sema::OwningExprResult TransformPredefinedExpr(PredefinedExpr *E);
Sema::OwningExprResult TransformDeclRefExpr(DeclRefExpr *E);
Sema::OwningExprResult TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E);
Sema::OwningExprResult TransformTemplateParmRefExpr(DeclRefExpr *E,
ExprResult TransformPredefinedExpr(PredefinedExpr *E);
ExprResult TransformDeclRefExpr(DeclRefExpr *E);
ExprResult TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E);
ExprResult TransformTemplateParmRefExpr(DeclRefExpr *E,
NonTypeTemplateParmDecl *D);
QualType TransformFunctionProtoType(TypeLocBuilder &TLB,
@ -631,9 +631,9 @@ namespace {
TemplateTypeParmTypeLoc TL,
QualType ObjectType);
Sema::OwningExprResult TransformCallExpr(CallExpr *CE) {
ExprResult TransformCallExpr(CallExpr *CE) {
getSema().CallsUndergoingInstantiation.push_back(CE);
OwningExprResult Result =
ExprResult Result =
TreeTransform<TemplateInstantiator>::TransformCallExpr(CE);
getSema().CallsUndergoingInstantiation.pop_back();
return move(Result);
@ -768,7 +768,7 @@ TemplateInstantiator::RebuildElaboratedType(ElaboratedTypeKeyword Keyword,
NNS, T);
}
Sema::OwningExprResult
ExprResult
TemplateInstantiator::TransformPredefinedExpr(PredefinedExpr *E) {
if (!E->isTypeDependent())
return SemaRef.Owned(E->Retain());
@ -790,7 +790,7 @@ TemplateInstantiator::TransformPredefinedExpr(PredefinedExpr *E) {
return getSema().Owned(PE);
}
Sema::OwningExprResult
ExprResult
TemplateInstantiator::TransformTemplateParmRefExpr(DeclRefExpr *E,
NonTypeTemplateParmDecl *NTTP) {
// If the corresponding template argument is NULL or non-existent, it's
@ -837,7 +837,7 @@ TemplateInstantiator::TransformTemplateParmRefExpr(DeclRefExpr *E,
}
Sema::OwningExprResult
ExprResult
TemplateInstantiator::TransformDeclRefExpr(DeclRefExpr *E) {
NamedDecl *D = E->getDecl();
if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(D)) {
@ -851,7 +851,7 @@ TemplateInstantiator::TransformDeclRefExpr(DeclRefExpr *E) {
return TreeTransform<TemplateInstantiator>::TransformDeclRefExpr(E);
}
Sema::OwningExprResult TemplateInstantiator::TransformCXXDefaultArgExpr(
ExprResult TemplateInstantiator::TransformCXXDefaultArgExpr(
CXXDefaultArgExpr *E) {
assert(!cast<FunctionDecl>(E->getParam()->getDeclContext())->
getDescribedFunctionTemplate() &&
@ -1579,7 +1579,7 @@ Sema::InstantiateClassTemplateSpecializationMembers(
TSK);
}
Sema::OwningStmtResult
StmtResult
Sema::SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs) {
if (!S)
return Owned(S);
@ -1590,7 +1590,7 @@ Sema::SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs) {
return Instantiator.TransformStmt(S);
}
Sema::OwningExprResult
ExprResult
Sema::SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs) {
if (!E)
return Owned(E);

View File

@ -32,8 +32,6 @@ namespace {
const MultiLevelTemplateArgumentList &TemplateArgs;
public:
typedef Sema::OwningExprResult OwningExprResult;
TemplateDeclInstantiator(Sema &SemaRef, DeclContext *Owner,
const MultiLevelTemplateArgumentList &TemplateArgs)
: SemaRef(SemaRef), Owner(Owner), TemplateArgs(TemplateArgs) { }
@ -151,7 +149,7 @@ void Sema::InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
Action::Unevaluated);
if (Aligned->isAlignmentExpr()) {
OwningExprResult Result = SubstExpr(Aligned->getAlignmentExpr(),
ExprResult Result = SubstExpr(Aligned->getAlignmentExpr(),
TemplateArgs);
if (!Result.isInvalid())
AddAlignedAttr(Aligned->getLocation(), New, Result.takeAs<Expr>());
@ -260,7 +258,7 @@ static bool InstantiateInitializationArguments(Sema &SemaRef,
if (Args[I]->isDefaultArgument())
break;
Sema::OwningExprResult Arg = SemaRef.SubstExpr(Args[I], TemplateArgs);
ExprResult Arg = SemaRef.SubstExpr(Args[I], TemplateArgs);
if (Arg.isInvalid())
return true;
@ -335,7 +333,7 @@ static bool InstantiateInitializer(Sema &S, Expr *Init,
}
}
Sema::OwningExprResult Result = S.SubstExpr(Init, TemplateArgs);
ExprResult Result = S.SubstExpr(Init, TemplateArgs);
if (Result.isInvalid())
return true;
@ -496,7 +494,7 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) {
// The bit-width expression is not potentially evaluated.
EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
OwningExprResult InstantiatedBitWidth
ExprResult InstantiatedBitWidth
= SemaRef.SubstExpr(BitWidth, TemplateArgs);
if (InstantiatedBitWidth.isInvalid()) {
Invalid = true;
@ -584,12 +582,12 @@ Decl *TemplateDeclInstantiator::VisitStaticAssertDecl(StaticAssertDecl *D) {
// The expression in a static assertion is not potentially evaluated.
EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
OwningExprResult InstantiatedAssertExpr
ExprResult InstantiatedAssertExpr
= SemaRef.SubstExpr(AssertExpr, TemplateArgs);
if (InstantiatedAssertExpr.isInvalid())
return 0;
OwningExprResult Message(D->getMessage());
ExprResult Message(D->getMessage());
D->getMessage()->Retain();
return SemaRef.ActOnStaticAssertDeclaration(D->getLocation(),
InstantiatedAssertExpr.get(),
@ -617,7 +615,7 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
ECEnd = D->enumerator_end();
EC != ECEnd; ++EC) {
// The specified value for the enumerator.
OwningExprResult Value = SemaRef.Owned((Expr *)0);
ExprResult Value = SemaRef.Owned((Expr *)0);
if (Expr *UninstValue = EC->getInitExpr()) {
// The enumerator's value expression is not potentially evaluated.
EnterExpressionEvaluationContext Unevaluated(SemaRef,
@ -2106,7 +2104,7 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
}
// Instantiate the function body.
OwningStmtResult Body = SubstStmt(Pattern, TemplateArgs);
StmtResult Body = SubstStmt(Pattern, TemplateArgs);
if (Body.isInvalid())
Function->setInvalidDecl();

File diff suppressed because it is too large Load Diff