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.
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();
//===--------------------------------------------------------------------===//
// 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);
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,
//===--------------------------------------------------------------------===//
// 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,
//===--------------------------------------------------------------------===//
// 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;
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);
//===--------------------------------------------------------------------===//
/// 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);
//===--------------------------------------------------------------------===//
// 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);
//===--------------------------------------------------------------------===//
// 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);
//===--------------------------------------------------------------------===//
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
//===--------------------------------------------------------------------===//
// GNU G++: Type Traits [Type-Traits.html in the GCC manual]
- OwningExprResult ParseUnaryTypeTrait();
+ ExprResult ParseUnaryTypeTrait();
};
} // end namespace clang
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;
// emulation code from Ownership.h).
FullExprArg(const FullExprArg& Other): E(Other.E) {}
- OwningExprResult release() {
+ ExprResult release() {
return move(E);
}
// 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 {}
// 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();
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) {
/// 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) {
/// \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,
///
/// \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();
}
/// 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,
/// \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,
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,
/// 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();
/// \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();
}
/// \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();
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();
/// \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,
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
}
// 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) {
///
/// \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,
/// 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,
}
// 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();
///
/// @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();
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();
/// 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) {
//===---------------------- 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();
}
} U;
};
- virtual OwningExprResult ActOnBuiltinOffsetOf(Scope *S,
+ virtual ExprResult ActOnBuiltinOffsetOf(Scope *S,
SourceLocation BuiltinLoc,
SourceLocation TypeLoc,
ParsedType Arg1,
}
// __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();
/// 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();
}
/// 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();
/// 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,
}
/// ActOnCXXTypeidOfType - Parse typeid( type-id ).
- virtual OwningExprResult ActOnCXXTypeid(SourceLocation OpLoc,
+ virtual ExprResult ActOnCXXTypeid(SourceLocation OpLoc,
SourceLocation LParenLoc, bool isType,
void *TyOrExpr,
SourceLocation RParenLoc) {
}
/// 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();
}
/// 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,
/// 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);
}
///
/// \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,
/// 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,
/// 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,
///
/// \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,
/// 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);
}
return 0;
}
- virtual OwningExprResult
+ virtual ExprResult
ActOnClassPropertyRefExpr(IdentifierInfo &receiverName,
IdentifierInfo &propertyName,
SourceLocation receiverNameLoc,
/// \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,
/// \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.
///
/// \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,
/// \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.
///
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();
}
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();
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);
ImplicitConversionSequence TryContextuallyConvertToObjCId(Expr *From);
bool PerformContextuallyConvertToObjCId(Expr *&From);
- OwningExprResult
+ ExprResult
ConvertToIntegralOrEnumerationType(SourceLocation Loc, ExprArg FromE,
const PartialDiagnostic &NotIntDiag,
const PartialDiagnostic &IncompleteDiag,
Expr *FixOverloadedFunctionReference(Expr *E,
DeclAccessPair FoundDecl,
FunctionDecl *Fn);
- OwningExprResult FixOverloadedFunctionReference(OwningExprResult,
+ ExprResult FixOverloadedFunctionReference(ExprResult,
DeclAccessPair FoundDecl,
FunctionDecl *Fn);
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,
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
//===--------------------------------------------------------------------===//
// 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,
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);
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);
// Primary Expressions.
virtual SourceRange getExprRange(ExprTy *E) const;
- virtual OwningExprResult ActOnIdExpression(Scope *S,
+ virtual ExprResult ActOnIdExpression(Scope *S,
CXXScopeSpec &SS,
UnqualifiedId &Name,
bool HasTrailingLParen,
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);
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
/// 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);
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,
const DeclarationNameInfo &NameInfo,
const TemplateArgumentListInfo *TemplateArgs);
- OwningExprResult BuildMemberReferenceExpr(ExprArg Base,
+ ExprResult BuildMemberReferenceExpr(ExprArg Base,
QualType BaseType,
SourceLocation OpLoc, bool IsArrow,
const CXXScopeSpec &SS,
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,
const CXXScopeSpec &SS,
const LookupResult &R);
- OwningExprResult ActOnDependentMemberExpr(ExprArg Base,
+ ExprResult ActOnDependentMemberExpr(ExprArg Base,
QualType BaseType,
bool IsArrow,
SourceLocation OpLoc,
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,
/// 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);
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,
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 ------------------------===//
/// 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 --------------------------===//
/// 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,
// 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,
/// BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating
/// the default expr if needed.
- OwningExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc,
+ ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc,
FunctionDecl *FD,
ParmVarDecl *Param);
/// 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,
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,
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);
/// 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,
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,
SourceLocation ConstructorLParen,
MultiExprArg ConstructorArgs,
SourceLocation ConstructorRParen);
- OwningExprResult BuildCXXNew(SourceLocation StartLoc, bool UseGlobal,
+ ExprResult BuildCXXNew(SourceLocation StartLoc, bool UseGlobal,
SourceLocation PlacementLParen,
MultiExprArg PlacementArgs,
SourceLocation PlacementRParen,
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,
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,
/// 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);
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);
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);
DeclarationName Name);
bool RebuildNestedNameSpecifierInCurrentInstantiation(CXXScopeSpec &SS);
- OwningExprResult RebuildExprInCurrentInstantiation(Expr *E);
+ ExprResult RebuildExprInCurrentInstantiation(Expr *E);
std::string
getTemplateArgumentBindingsText(const TemplateParameterList *Params,
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,
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,
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,
SourceLocation RBracLoc,
MultiExprArg Args);
- virtual OwningExprResult ActOnClassMessage(Scope *S,
+ virtual ExprResult ActOnClassMessage(Scope *S,
ParsedType Receiver,
Selector Sel,
SourceLocation LBracLoc,
SourceLocation RBracLoc,
MultiExprArg Args);
- OwningExprResult BuildInstanceMessage(ExprArg Receiver,
+ ExprResult BuildInstanceMessage(ExprArg Receiver,
QualType ReceiverType,
SourceLocation SuperLoc,
Selector Sel,
SourceLocation RBracLoc,
MultiExprArg Args);
- virtual OwningExprResult ActOnInstanceMessage(Scope *S,
+ virtual ExprResult ActOnInstanceMessage(Scope *S,
ExprArg Receiver,
Selector Sel,
SourceLocation LBracLoc,
/// \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
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);
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);
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 {
// 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);
// now parse the list of expressions
while (1) {
- OwningExprResult ArgExpr(ParseAssignmentExpression());
+ ExprResult ArgExpr(ParseAssignmentExpression());
if (ArgExpr.isInvalid()) {
ArgExprsOk = false;
SkipUntil(tok::r_paren);
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,
// 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;
return ThisDecl;
}
- OwningExprResult Init(ParseInitializer());
+ ExprResult Init(ParseInitializer());
if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) {
Actions.ActOnCXXExitDeclInitializer(getCurScope(), ThisDecl);
if (Tok.is(tok::colon)) {
ConsumeToken();
- OwningExprResult Res(ParseConstantExpression());
+ ExprResult Res(ParseConstantExpression());
if (Res.isInvalid())
SkipUntil(tok::semi, true, true);
else
SourceLocation IdentLoc = ConsumeToken();
SourceLocation EqualLoc;
- OwningExprResult AssignedVal;
+ ExprResult AssignedVal;
if (Tok.is(tok::equal)) {
EqualLoc = ConsumeToken();
AssignedVal = ParseConstantExpression();
// Consume the '='.
ConsumeToken();
- OwningExprResult DefArgResult(ParseAssignmentExpression());
+ ExprResult DefArgResult(ParseAssignmentExpression());
if (DefArgResult.isInvalid()) {
Actions.ActOnParamDefaultArgumentError(Param);
SkipUntil(tok::comma, tok::r_paren, true, true);
}
// Remember that we parsed the empty array type.
- OwningExprResult NumElements;
+ ExprResult NumElements;
D.AddTypeInfo(DeclaratorChunk::getArray(0, false, false, 0,
StartLoc, EndLoc),
EndLoc);
} 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);
// 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
bool isCastExpr;
ParsedType CastTy;
SourceRange CastRange;
- OwningExprResult Operand = ParseExprAfterTypeofSizeofAlignof(OpTok,
+ ExprResult Operand = ParseExprAfterTypeofSizeofAlignof(OpTok,
isCastExpr,
CastTy,
CastRange);
SourceLocation LParenLoc = ConsumeParen();
- OwningExprResult AssertExpr(ParseConstantExpression());
+ ExprResult AssertExpr(ParseConstantExpression());
if (AssertExpr.isInvalid()) {
SkipUntil(tok::semi);
return 0;
return 0;
}
- OwningExprResult AssertMessage(ParseStringLiteralExpression());
+ ExprResult AssertMessage(ParseStringLiteralExpression());
if (AssertMessage.isInvalid())
return 0;
// 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;
// member-declarator-list ',' member-declarator
llvm::SmallVector<Decl *, 8> DeclsInGroup;
- OwningExprResult BitfieldSize;
- OwningExprResult Init;
+ ExprResult BitfieldSize;
+ ExprResult Init;
bool Deleted = false;
while (1) {
// 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);
}
SourceLocation ParamLoc = ConsumeParen();
- OwningExprResult ArgExpr = ParseCXX0XAlignArgument(ParamLoc);
+ ExprResult ArgExpr = ParseCXX0XAlignArgument(ParamLoc);
MatchRHSPunctuation(tok::r_paren, ParamLoc);
///
/// [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);
/// 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);
/// 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);
/// 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);
/// 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();
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);
///
/// 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);
}
-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);
/// 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);
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.
// 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
/// 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);
/// [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;
/// 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;
return move(LHS);
Loc = ConsumeBracket();
- OwningExprResult Idx(ParseExpression());
+ ExprResult Idx(ParseExpression());
SourceLocation RLoc = Tok.getLocation();
/// typeof ( type-name )
/// [GNU/C++] typeof unary-expression
///
-Parser::OwningExprResult
+ExprResult
Parser::ParseExprAfterTypeofSizeofAlignof(const Token &OpTok,
bool &isCastExpr,
ParsedType &CastTy,
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)) {
/// [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!");
bool isCastExpr;
ParsedType CastTy;
SourceRange CastRange;
- OwningExprResult Operand = ParseExprAfterTypeofSizeofAlignof(OpTok,
+ ExprResult Operand = ParseExprAfterTypeofSizeofAlignof(OpTok,
isCastExpr,
CastTy,
CastRange);
/// [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();
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();
break;
}
case tok::kw___builtin_choose_expr: {
- OwningExprResult Cond(ParseAssignmentExpression());
+ ExprResult Cond(ParseAssignmentExpression());
if (Cond.isInvalid()) {
SkipUntil(tok::r_paren);
return move(Cond);
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);
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);
/// 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.
// 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 &&
/// '(' 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);
///
/// 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
ConsumeCodeCompletionToken();
}
- OwningExprResult Expr(ParseAssignmentExpression());
+ ExprResult Expr(ParseAssignmentExpression());
if (Expr.isInvalid())
return true;
/// [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();
}
- OwningExprResult Result(true);
+ ExprResult Result(true);
if (!Tok.is(tok::l_brace)) {
// Saw something like: ^expr
Diag(Tok, diag::err_expected_expression);
return ExprError();
}
- OwningStmtResult Stmt(ParseCompoundStatementBody());
+ StmtResult Stmt(ParseCompoundStatementBody());
if (!Stmt.isInvalid())
Result = Actions.ActOnBlockStmtExpr(CaretLoc, Stmt.take(), getCurScope());
else
/// 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
/// '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
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);
/// 'typeid' '(' expression ')'
/// 'typeid' '(' type-id ')'
///
-Parser::OwningExprResult Parser::ParseCXXTypeid() {
+ExprResult Parser::ParseCXXTypeid() {
assert(Tok.is(tok::kw_typeid) && "Not 'typeid'!");
SourceLocation OpLoc = ConsumeToken();
"typeid"))
return ExprError();
- OwningExprResult Result;
+ ExprResult Result;
if (isTypeIdInParens()) {
TypeResult Ty = ParseTypeName();
/// ~type-name
/// ::[opt] nested-name-specifier[opt] ~type-name
///
-Parser::OwningExprResult
+ExprResult
Parser::ParseCXXPseudoDestructor(ExprArg Base, SourceLocation OpLoc,
tok::TokenKind OpKind,
CXXScopeSpec &SS,
/// 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);
}
///
/// 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.
return Actions.ActOnCXXThrow(ThrowLoc, 0);
default:
- OwningExprResult Expr(ParseAssignmentExpression());
+ ExprResult Expr(ParseAssignmentExpression());
if (Expr.isInvalid()) return move(Expr);
return Actions.ActOnCXXThrow(ThrowLoc, Expr.take());
}
/// 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);
/// 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();
/// 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)) {
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
// 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;
}
// 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);
/// '(' 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'
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
/// 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'
return ExprError();
}
- OwningExprResult Operand(ParseCastExpression(false));
+ ExprResult Operand(ParseCastExpression(false));
if (Operand.isInvalid())
return move(Operand);
/// primary-expression:
/// [GNU] unary-type-trait '(' type-id ')'
///
-Parser::OwningExprResult Parser::ParseUnaryTypeTrait() {
+ExprResult Parser::ParseUnaryTypeTrait() {
UnaryTypeTrait UTT = UnaryTypeTraitFromTokKind(Tok.getKind());
SourceLocation Loc = ConsumeToken();
/// 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,
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:
/// 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 ':'
// [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
// 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();
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);
/// 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
// 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
/// 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();
/// objc-synchronized-statement:
/// @synchronized '(' expression ')' compound-statement
///
-Parser::OwningStmtResult
+StmtResult
Parser::ParseObjCSynchronizedStmt(SourceLocation atLoc) {
ConsumeToken(); // consume synchronized
if (Tok.isNot(tok::l_paren)) {
return StmtError();
}
ConsumeParen(); // '('
- OwningExprResult Res(ParseExpression());
+ ExprResult Res(ParseExpression());
if (Res.isInvalid()) {
SkipUntil(tok::semi);
return StmtError();
// statements can always hold declarations.
ParseScope BodyScope(this, Scope::DeclScope);
- OwningStmtResult SynchBody(ParseCompoundStatementBody());
+ StmtResult SynchBody(ParseCompoundStatementBody());
BodyScope.Exit();
if (SynchBody.isInvalid())
/// parameter-declaration
/// '...' [OBJC2]
///
-Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
+StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
bool catch_or_finally_seen = false;
ConsumeToken(); // consume try
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());
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
if (CatchBody.isInvalid())
CatchBody = Actions.ActOnNullStmt(Tok.getLocation());
- OwningStmtResult Catch = Actions.ActOnObjCAtCatchStmt(AtCatchFinallyLoc,
+ StmtResult Catch = Actions.ActOnObjCAtCatchStmt(AtCatchFinallyLoc,
RParenLoc,
FirstPart,
CatchBody.take());
ConsumeToken(); // consume finally
ParseScope FinallyScope(this, Scope::DeclScope);
- OwningStmtResult FinallyBody(true);
+ StmtResult FinallyBody(true);
if (Tok.is(tok::l_brace))
FinallyBody = ParseCompoundStatementBody();
else
// 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())
return MDecl;
}
-Parser::OwningStmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) {
+StmtResult Parser::ParseObjCAtStatement(SourceLocation AtLoc) {
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteObjCAtStatement(getCurScope());
ConsumeCodeCompletionToken();
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
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());
if (!isCXXSimpleTypeSpecifier()) {
// objc-receiver:
// expression
- OwningExprResult Receiver = ParseExpression();
+ ExprResult Receiver = ParseExpression();
if (Receiver.isInvalid())
return true;
// 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())
/// class-name
/// type-name
///
-Parser::OwningExprResult Parser::ParseObjCMessageExpression() {
+ExprResult Parser::ParseObjCMessageExpression() {
assert(Tok.is(tok::l_square) && "'[' expected");
SourceLocation LBracLoc = ConsumeBracket(); // consume '['
}
// 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);
/// assignment-expression
/// nonempty-expr-list , assignment-expression
///
-Parser::OwningExprResult
+ExprResult
Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
SourceLocation SuperLoc,
ParsedType ReceiverType,
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
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
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
if (!isTokenStringLiteral())
return ExprError(Diag(Tok, diag::err_objc_concat_string));
- OwningExprResult Lit(ParseStringLiteralExpression());
+ ExprResult Lit(ParseStringLiteralExpression());
if (Lit.isInvalid())
return move(Lit);
/// objc-encode-expression:
/// @encode ( type-name )
-Parser::OwningExprResult
+ExprResult
Parser::ParseObjCEncodeExpression(SourceLocation AtLoc) {
assert(Tok.isObjCAtKeyword(tok::objc_encode) && "Not an @encode expression!");
/// objc-protocol-expression
/// @protocol ( protocol-name )
-Parser::OwningExprResult
+ExprResult
Parser::ParseObjCProtocolExpression(SourceLocation AtLoc) {
SourceLocation ProtoLoc = ConsumeToken();
/// 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))
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)) {
/// [OBC] '@' 'throw' expression ';'
/// [OBC] '@' 'throw' ';'
///
-Parser::OwningStmtResult
+StmtResult
Parser::ParseStatementOrDeclaration(bool OnlyStatement) {
const char *SemiError = 0;
- OwningStmtResult Res;
+ StmtResult Res;
ParenBraceBracketBalancer BalancerRAIIObj(*this);
// 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
/// 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!");
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())
/// '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;
// 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
/// expression.
ColonProtectionRAIIObject ColonProtection(*this);
- OwningExprResult LHS(ParseConstantExpression());
+ ExprResult LHS(ParseConstantExpression());
if (LHS.isInvalid()) {
SkipUntil(tok::colon);
return StmtError();
// GNU case range extension.
SourceLocation DotDotDotLoc;
- OwningExprResult RHS;
+ ExprResult RHS;
if (Tok.is(tok::ellipsis)) {
Diag(Tok, diag::ext_gnu_case_range);
DotDotDotLoc = ConsumeToken();
SourceLocation ColonLoc = ConsumeToken();
- OwningStmtResult Case =
+ StmtResult Case =
Actions.ActOnCaseStmt(CaseLoc, LHS.get(), DotDotDotLoc,
RHS.get(), ColonLoc);
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();
/// '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;
return StmtError();
}
- OwningStmtResult SubStmt(ParseStatement());
+ StmtResult SubStmt(ParseStatement());
if (SubStmt.isInvalid())
return StmtError();
/// [OMP] barrier-directive
/// [OMP] flush-directive
///
-Parser::OwningStmtResult Parser::ParseCompoundStatement(AttributeList *Attr,
+StmtResult Parser::ParseCompoundStatement(AttributeList *Attr,
bool isStmtExpr) {
//FIXME: Use attributes?
delete 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 ('{}')");
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 {
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);
/// 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) {
/// [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;
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();
// Read the 'then' stmt.
SourceLocation ThenStmtLoc = Tok.getLocation();
- OwningStmtResult ThenStmt(ParseStatement());
+ StmtResult ThenStmt(ParseStatement());
// Pop the 'if' scope if needed.
InnerScope.Exit();
// If it has an else, parse it.
SourceLocation ElseLoc;
SourceLocation ElseStmtLoc;
- OwningStmtResult ElseStmt;
+ StmtResult ElseStmt;
if (Tok.is(tok::kw_else)) {
ElseLoc = ConsumeToken();
/// 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;
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()) {
C99orCXX && Tok.isNot(tok::l_brace));
// Read the body statement.
- OwningStmtResult Body(ParseStatement());
+ StmtResult Body(ParseStatement());
// Pop the scopes.
InnerScope.Exit();
/// 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;
ParseScope WhileScope(this, ScopeFlags);
// Parse the condition.
- OwningExprResult Cond;
+ ExprResult Cond;
Decl *CondVar = 0;
if (ParseParenExprOrCondition(Cond, CondVar, WhileLoc, true))
return StmtError();
C99orCXX && Tok.isNot(tok::l_brace));
// Read the body statement.
- OwningStmtResult Body(ParseStatement());
+ StmtResult Body(ParseStatement());
// Pop the body scope if needed.
InnerScope.Exit();
/// 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;
Tok.isNot(tok::l_brace));
// Read the body statement.
- OwningStmtResult Body(ParseStatement());
+ StmtResult Body(ParseStatement());
// Pop the body scope if needed.
InnerScope.Exit();
// Parse the parenthesized condition.
SourceLocation LPLoc = ConsumeParen();
- OwningExprResult Cond = ParseExpression();
+ ExprResult Cond = ParseExpression();
SourceLocation RPLoc = MatchRHSPunctuation(tok::r_paren, LPLoc);
DoScope.Exit();
/// [C++] expression-statement
/// [C++] simple-declaration
///
-Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) {
+StmtResult Parser::ParseForStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete 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;
if (Tok.is(tok::semi)) { // for (...;;
// no second part.
} else {
- OwningExprResult Second;
+ ExprResult Second;
if (getLang().CPlusPlus)
ParseCXXCondition(Second, SecondVar, ForLoc, true);
else {
// 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());
}
}
C99orCXXorObjC && Tok.isNot(tok::l_brace));
// Read the body statement.
- OwningStmtResult Body(ParseStatement());
+ StmtResult Body(ParseStatement());
// Pop the body scope if needed.
InnerScope.Exit();
///
/// 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());
// 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();
///
/// Note: this lets the caller parse the end ';'.
///
-Parser::OwningStmtResult Parser::ParseContinueStatement(AttributeList *Attr) {
+StmtResult Parser::ParseContinueStatement(AttributeList *Attr) {
// FIXME: Use attributes?
delete 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;
/// 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());
/// 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 {
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);
/// 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();
}
Loc = ConsumeParen();
- OwningExprResult AsmString(ParseAsmStringLiteral());
+ ExprResult AsmString(ParseAsmStringLiteral());
if (AsmString.isInvalid())
return StmtError();
// 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;
} else
Names.push_back(0);
- OwningExprResult Constraint(ParseAsmStringLiteral());
+ ExprResult Constraint(ParseAsmStringLiteral());
if (Constraint.isInvalid()) {
SkipUntil(tok::r_paren);
return true;
// 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);
// 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())
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())
/// try-block:
/// 'try' compound-statement handler-seq
///
-Parser::OwningStmtResult Parser::ParseCXXTryBlock(AttributeList* Attr) {
+StmtResult Parser::ParseCXXTryBlock(AttributeList* Attr) {
// FIXME: Add attributes?
delete 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);
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());
}
/// type-specifier-seq
/// '...'
///
-Parser::OwningStmtResult Parser::ParseCXXCatchBlock() {
+StmtResult Parser::ParseCXXCatchBlock() {
assert(Tok.is(tok::kw_catch) && "Expected 'catch'");
SourceLocation CatchLoc = ConsumeToken();
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);
// 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();
// Parse a non-type template argument.
SourceLocation Loc = Tok.getLocation();
- OwningExprResult ExprArg = ParseConstantExpression();
+ ExprResult ExprArg = ParseConstantExpression();
if (ExprArg.isInvalid() || !ExprArg.get())
return ParsedTemplateArgument();
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");
/// [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'
/// [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();
Loc = ConsumeParen();
- OwningExprResult Result(ParseAsmStringLiteral());
+ ExprResult Result(ParseAsmStringLiteral());
if (Result.isInvalid()) {
SkipUntil(tok::r_paren, true, true);
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,
SourceRange(LParenLoc, RParenLoc));
}
-Action::OwningExprResult
+ExprResult
Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
TypeSourceInfo *DestTInfo, ExprArg Ex,
SourceRange AngleBrackets, SourceRange Parens) {
(CStyle || !DestType->isReferenceType()))
return TC_NotApplicable;
- Sema::OwningExprResult Result
+ ExprResult Result
= InitSeq.Perform(Self, Entity, InitKind,
Action::MultiExprArg(Self, &SrcExpr, 1));
if (Result.isInvalid()) {
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:
///
/// 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());
/// 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)
// 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);
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);
}
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;
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()) {
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()) {
= 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()) {
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;
InitializationSequence InitSeq(*this, MemberEntity, Kind, Args, NumArgs);
- OwningExprResult MemberInit =
+ ExprResult MemberInit =
InitSeq.Perform(*this, MemberEntity, Kind,
MultiExprArg(*this, Args, NumArgs), 0);
if (MemberInit.isInvalid())
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));
InitializationSequence InitSeq(*this, BaseEntity, Kind, Args, NumArgs);
- OwningExprResult BaseInit =
+ ExprResult BaseInit =
InitSeq.Perform(*this, BaseEntity, Kind,
MultiExprArg(*this, Args, NumArgs), 0);
if (BaseInit.isInvalid())
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,
= InitializedEntity::InitializeBase(SemaRef.Context, BaseSpec,
IsInheritedVirtualBase);
- Sema::OwningExprResult BaseInit;
+ ExprResult BaseInit;
switch (ImplicitInitKind) {
case IIK_Default: {
Sema::LookupMemberName);
MemberLookup.addDecl(Field, AS_public);
MemberLookup.resolveKind();
- Sema::OwningExprResult CopyCtorArg
+ ExprResult CopyCtorArg
= SemaRef.BuildMemberReferenceExpr(MemberExprBase,
ParamType, Loc,
/*IsArrow=*/false,
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!");
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());
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())
/// \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) {
T.getTypePtr()));
// Create the reference to operator=.
- OwningExprResult OpEqualRef
+ ExprResult OpEqualRef
= S.BuildMemberReferenceExpr(To, T, Loc, /*isArrow=*/false, SS,
/*FirstQualifierInScope=*/0, OpLookup,
/*TemplateArgs=*/0,
// 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())
// 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);
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);
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>();
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()) {
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");
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,
}
// 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()) {
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 {
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>());
CopyConstructor->setUsed();
}
-Sema::OwningExprResult
+ExprResult
Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
CXXConstructorDecl *Constructor,
MultiExprArg ExprArgs,
/// 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,
bool Sema::InitializeVarWithConstructor(VarDecl *VD,
CXXConstructorDecl *Constructor,
MultiExprArg Exprs) {
- OwningExprResult TempResult =
+ ExprResult TempResult =
BuildCXXConstructExpr(VD->getLocation(), VD->getType(), Constructor,
move(Exprs));
if (TempResult.isInvalid())
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;
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;
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());
/// 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!");
}
-Sema::OwningExprResult
+ExprResult
Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty, SourceLocation Loc,
const CXXScopeSpec *SS) {
DeclarationNameInfo NameInfo(D->getDeclName(), Loc);
}
/// BuildDeclRefExpr - Build a DeclRefExpr.
-Sema::OwningExprResult
+ExprResult
Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty,
const DeclarationNameInfo &NameInfo,
const CXXScopeSpec *SS) {
return BaseObject;
}
-Sema::OwningExprResult
+ExprResult
Sema::BuildAnonymousStructUnionMemberReference(SourceLocation Loc,
FieldDecl *Field,
Expr *BaseObjectExpr,
return 0;
}
-Sema::OwningExprResult Sema::ActOnIdExpression(Scope *S,
+ExprResult Sema::ActOnIdExpression(Scope *S,
CXXScopeSpec &SS,
UnqualifiedId &Id,
bool HasTrailingLParen,
// 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();
// 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);
}
}
/// Builds an expression which might be an implicit member expression.
-Sema::OwningExprResult
+ExprResult
Sema::BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS,
LookupResult &R,
const TemplateArgumentListInfo *TemplateArgs) {
/// 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;
/// 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();
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)
/// 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,
return false;
}
-Sema::OwningExprResult
+ExprResult
Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
LookupResult &R,
bool NeedsADL) {
/// \brief Complete semantic analysis for a reference to the given declaration.
-Sema::OwningExprResult
+ExprResult
Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS,
const DeclarationNameInfo &NameInfo,
NamedDecl *D) {
DeclRefExpr(const_cast<ValueDecl*>(BDRE->getDecl()), T,
SourceLocation());
- OwningExprResult Res = PerformCopyInitialization(
+ ExprResult Res = PerformCopyInitialization(
InitializedEntity::InitializeBlock(VD->getLocation(),
T, false),
SourceLocation(),
NameInfo, &SS);
}
-Sema::OwningExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc,
+ExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc,
tok::TokenKind Kind) {
PredefinedExpr::IdentType IT;
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);
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) {
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));
}
/// \brief Build a sizeof or alignof expression given a type operand.
-Action::OwningExprResult
+ExprResult
Sema::CreateSizeOfAlignOfExpr(TypeSourceInfo *TInfo,
SourceLocation OpLoc,
bool isSizeOf, SourceRange R) {
/// \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.
/// 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.
}
Expr *ArgEx = (Expr *)TyOrEx;
- Action::OwningExprResult Result
+ ExprResult Result
= CreateSizeOfAlignOfExpr(ArgEx, OpLoc, isSizeof, ArgEx->getSourceRange());
if (Result.isInvalid())
-Action::OwningExprResult
+ExprResult
Sema::ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
tok::TokenKind Kind, Expr *Input) {
UnaryOperator::Opcode Opc;
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();
}
-Action::OwningExprResult
+ExprResult
Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
Expr *Idx, SourceLocation RLoc) {
Expr *LHSExp = Base;
return GDecl;
}
-Sema::OwningExprResult
+ExprResult
Sema::ActOnDependentMemberExpr(Expr *BaseExpr, QualType BaseType,
bool IsArrow, SourceLocation OpLoc,
const CXXScopeSpec &SS,
return false;
}
-Sema::OwningExprResult
+ExprResult
Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType,
SourceLocation OpLoc, bool IsArrow,
CXXScopeSpec &SS,
// Explicit member accesses.
} else {
- OwningExprResult Result =
+ ExprResult Result =
LookupMemberExpr(R, Base, IsArrow, OpLoc,
SS, /*ObjCImpDecl*/ 0, TemplateArgs != 0);
R, TemplateArgs);
}
-Sema::OwningExprResult
+ExprResult
Sema::BuildMemberReferenceExpr(Expr *BaseExpr, QualType BaseExprType,
SourceLocation OpLoc, bool IsArrow,
const CXXScopeSpec &SS,
///
/// 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,
<< QualType(Fun, 0)
<< FixItHint::CreateInsertion(Loc, "()");
- OwningExprResult NewBase
+ ExprResult NewBase
= ActOnCallExpr(0, BaseExpr, Loc,
MultiExprArg(*this, 0, 0), 0, Loc);
BaseExpr = 0;
/// \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,
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();
return move(Result);
}
-Sema::OwningExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc,
+ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc,
FunctionDecl *FD,
ParmVarDecl *Param) {
if (Param->hasUnparsedDefaultArg()) {
InstantiatingTemplate Inst(*this, CallLoc, Param, Innermost.first,
Innermost.second);
- OwningExprResult Result = SubstExpr(UninstExpr, ArgList);
+ ExprResult Result = SubstExpr(UninstExpr, ArgList);
if (Result.isInvalid())
return ExprError();
InitializedEntity Entity =
Param? InitializedEntity::InitializeParameter(Param)
: InitializedEntity::InitializeParameter(ProtoArgType);
- OwningExprResult ArgE = PerformCopyInitialization(Entity,
+ ExprResult ArgE = PerformCopyInitialization(Entity,
SourceLocation(),
Owned(Arg));
if (ArgE.isInvalid())
} else {
ParmVarDecl *Param = FDecl->getParamDecl(i);
- OwningExprResult ArgExpr =
+ ExprResult ArgExpr =
BuildCXXDefaultArgExpr(CallLoc, FDecl, Param);
if (ArgExpr.isInvalid())
return true;
/// 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();
/// 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,
return MaybeBindToTemporary(TheCall);
}
-Action::OwningExprResult
+ExprResult
Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty,
SourceLocation RParenLoc, Expr *InitExpr) {
assert((Ty != 0) && "ActOnCompoundLiteral(): missing type");
return BuildCompoundLiteralExpr(LParenLoc, TInfo, RParenLoc, InitExpr);
}
-Action::OwningExprResult
+ExprResult
Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo,
SourceLocation RParenLoc, Expr *literalExpr) {
QualType literalType = TInfo->getType();
= 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())
literalExpr, isFileScope));
}
-Action::OwningExprResult
+ExprResult
Sema::ActOnInitList(SourceLocation LBraceLoc, MultiExprArg initlist,
SourceLocation RBraceLoc) {
unsigned NumInit = initlist.size();
return false;
}
-Action::OwningExprResult
+ExprResult
Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc, ParsedType Ty,
SourceLocation RParenLoc, Expr *castExpr) {
assert((Ty != 0) && (castExpr != 0) &&
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;
/// 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(),
return ActOnParenExpr(E->getLParenLoc(), E->getRParenLoc(), Result.get());
}
-Action::OwningExprResult
+ExprResult
Sema::ActOnCastOfParenListExpr(Scope *S, SourceLocation LParenLoc,
SourceLocation RParenLoc, Expr *Op,
TypeSourceInfo *TInfo) {
} 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) {
/// 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) {
/// 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.
}
// 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);
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 &&
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);
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() &&
}
// 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.
Context.getPointerType(Context.VoidTy)));
}
-Sema::OwningExprResult
+ExprResult
Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt,
SourceLocation RPLoc) { // "({..})"
assert(SubStmt && isa<CompoundStmt>(SubStmt) && "Invalid action invocation!");
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,
Exprs.data(), Exprs.size(), RParenLoc));
}
-Sema::OwningExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
+ExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
SourceLocation BuiltinLoc,
SourceLocation TypeLoc,
ParsedType argty,
}
-Sema::OwningExprResult Sema::ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
+ExprResult Sema::ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
ParsedType arg1,ParsedType arg2,
SourceLocation RPLoc) {
TypeSourceInfo *argTInfo1;
return BuildTypesCompatibleExpr(BuiltinLoc, argTInfo1, argTInfo2, RPLoc);
}
-Sema::OwningExprResult
+ExprResult
Sema::BuildTypesCompatibleExpr(SourceLocation BuiltinLoc,
TypeSourceInfo *argTInfo1,
TypeSourceInfo *argTInfo2,
}
-Sema::OwningExprResult Sema::ActOnChooseExpr(SourceLocation BuiltinLoc,
+ExprResult Sema::ActOnChooseExpr(SourceLocation BuiltinLoc,
Expr *CondExpr,
Expr *LHSExpr, Expr *RHSExpr,
SourceLocation RPLoc) {
/// 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)
return Owned(Result);
}
-Sema::OwningExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc,
+ExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc,
Expr *expr, ParsedType type,
SourceLocation RPLoc) {
TypeSourceInfo *TInfo;
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;
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;
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();
}
/// \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) {
}
/// \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) {
}
/// 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.
}
/// 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!");
}
/// 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();
InitializedEntity Entity =
InitializedEntity::InitializeException(ThrowLoc, E->getType(),
/*NRVO=*/false);
- OwningExprResult Res = PerformCopyInitialization(Entity,
+ ExprResult Res = PerformCopyInitialization(Entity,
SourceLocation(),
Owned(E));
if (Res.isInvalid())
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.
/// 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,
: 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?
/// 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,
ConstructorRParen);
}
-Sema::OwningExprResult
+ExprResult
Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal,
SourceLocation PlacementLParen,
MultiExprArg PlacementArgs,
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)
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();
// 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(),
/// @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:
/// \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();
return false;
}
-static Sema::OwningExprResult BuildCXXCastArgument(Sema &S,
+static ExprResult BuildCXXCastArgument(Sema &S,
SourceLocation CastLoc,
QualType Ty,
CastExpr::CastKind Kind,
CastLoc, ConstructorArgs))
return S.ExprError();
- Sema::OwningExprResult Result =
+ ExprResult Result =
S.BuildCXXConstructExpr(CastLoc, Ty, cast<CXXConstructorDecl>(Method),
move_arg(ConstructorArgs));
if (Result.isInvalid())
return true;
}
- OwningExprResult CastArg
+ ExprResult CastArg
= BuildCXXCastArgument(*this,
From->getLocStart(),
ToType.getNonReferenceType(),
/*FIXME:ConstructLoc*/SourceLocation(),
ConstructorArgs))
return true;
- OwningExprResult FromResult =
+ ExprResult FromResult =
BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(),
ToType, SCS.CopyConstructor,
move_arg(ConstructorArgs));
From = FromResult.takeAs<Expr>();
return false;
}
- OwningExprResult FromResult =
+ ExprResult FromResult =
BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(),
ToType, SCS.CopyConstructor,
MultiExprArg(*this, &From, 1));
return false;
}
-Sema::OwningExprResult Sema::ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
+ExprResult Sema::ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
SourceLocation KWLoc,
SourceLocation LParen,
ParsedType Ty,
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;
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())
}
// 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();
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();
return Composite2;
}
-Sema::OwningExprResult Sema::MaybeBindToTemporary(Expr *E) {
+ExprResult Sema::MaybeBindToTemporary(Expr *E) {
if (!Context.getLangOptions().CPlusPlus)
return Owned(E);
return E;
}
-Sema::OwningExprResult
-Sema::MaybeCreateCXXExprWithTemporaries(OwningExprResult SubExpr) {
+ExprResult
+Sema::MaybeCreateCXXExprWithTemporaries(ExprResult SubExpr) {
if (SubExpr.isInvalid())
return ExprError();
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();
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)
/*RPLoc*/ ExpectedLParenLoc);
}
-Sema::OwningExprResult Sema::BuildPseudoDestructorExpr(Expr *Base,
+ExprResult Sema::BuildPseudoDestructorExpr(Expr *Base,
SourceLocation OpLoc,
tok::TokenKind OpKind,
const CXXScopeSpec &SS,
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,
return CE;
}
-Sema::OwningExprResult Sema::ActOnFinishFullExpr(Expr *FullExpr) {
+ExprResult Sema::ActOnFinishFullExpr(Expr *FullExpr) {
if (!FullExpr) return ExprError();
return MaybeCreateCXXExprWithTemporaries(FullExpr);
}
return true;
InitializedEntity Entity = InitializedEntity::InitializeParameter(Param);
- OwningExprResult ArgE = PerformCopyInitialization(Entity,
+ ExprResult ArgE = PerformCopyInitialization(Entity,
SourceLocation(),
Owned(argExpr->Retain()));
if (ArgE.isInvalid())
/// 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) {
-Action::OwningExprResult Sema::
+ExprResult Sema::
ActOnClassPropertyRefExpr(IdentifierInfo &receiverName,
IdentifierInfo &propertyName,
SourceLocation receiverNameLoc,
return ObjCInstanceMessage;
}
-Sema::OwningExprResult Sema::ActOnSuperMessage(Scope *S,
+ExprResult Sema::ActOnSuperMessage(Scope *S,
SourceLocation SuperLoc,
Selector Sel,
SourceLocation LBracLoc,
/// \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,
// 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,
/// \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,
// 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();
return;
}
- Sema::OwningExprResult MemberInit
+ ExprResult MemberInit
= InitSeq.Perform(SemaRef, MemberEntity, Kind,
Sema::MultiExprArg(SemaRef, 0, 0));
if (MemberInit.isInvalid()) {
return;
}
- Sema::OwningExprResult ElementInit
+ ExprResult ElementInit
= InitSeq.Perform(SemaRef, ElementEntity, Kind,
Sema::MultiExprArg(SemaRef, 0, 0));
if (ElementInit.isInvalid()) {
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())
return;
}
- Sema::OwningExprResult Result =
+ ExprResult Result =
SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(),
SemaRef.Owned(expr));
return;
}
- Sema::OwningExprResult Result =
+ ExprResult Result =
SemaRef.PerformCopyInitialization(Entity, expr->getLocStart(),
SemaRef.Owned(expr));
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;
/// \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();
}
}
-Action::OwningExprResult
+ExprResult
InitializationSequence::Perform(Sema &S,
const InitializedEntity &Entity,
const InitializationKind &Kind,
}
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);
*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");
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;
//===----------------------------------------------------------------------===//
// Initialization helper functions
//===----------------------------------------------------------------------===//
-Sema::OwningExprResult
+ExprResult
Sema::PerformCopyInitialization(const InitializedEntity &Entity,
SourceLocation EqualLoc,
- OwningExprResult Init) {
+ ExprResult Init) {
if (Init.isInvalid())
return ExprError();
Expr *IvarRefExpr =
new (Context) ObjCIvarRefExpr(Ivar, Ivar->getType(), AtLoc,
SelfExpr, true, true);
- OwningExprResult Res =
+ ExprResult Res =
PerformCopyInitialization(InitializedEntity::InitializeResult(
SourceLocation(),
getterMethod->getResultType(),
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>());
}
}
///
/// \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,
/// 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,
// 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)
/// 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,
/// by CreateOverloadedUnaryOp().
///
/// \param input The input argument.
-Sema::OwningExprResult
+ExprResult
Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
const UnresolvedSetImpl &Fns,
Expr *Input) {
return ExprError();
} else {
// Convert the arguments.
- OwningExprResult InputInit
+ ExprResult InputInit
= PerformCopyInitialization(InitializedEntity::InitializeParameter(
FnDecl->getParamDecl(0)),
SourceLocation(),
///
/// \param LHS Left-hand argument.
/// \param RHS Right-hand argument.
-Sema::OwningExprResult
+ExprResult
Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
unsigned OpcIn,
const UnresolvedSetImpl &Fns,
// 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)),
Args[1] = RHS = Arg1.takeAs<Expr>();
} else {
// Convert the arguments.
- OwningExprResult Arg0
+ ExprResult Arg0
= PerformCopyInitialization(
InitializedEntity::InitializeParameter(
FnDecl->getParamDecl(0)),
if (Arg0.isInvalid())
return ExprError();
- OwningExprResult Arg1
+ ExprResult Arg1
= PerformCopyInitialization(
InitializedEntity::InitializeParameter(
FnDecl->getParamDecl(1)),
// 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)
return CreateBuiltinBinOp(OpLoc, Opc, Args[0], Args[1]);
}
-Action::OwningExprResult
+ExprResult
Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
SourceLocation RLoc,
Expr *Base, Expr *Idx) {
return ExprError();
// Convert the arguments.
- OwningExprResult InputInit
+ ExprResult InputInit
= PerformCopyInitialization(InitializedEntity::InitializeParameter(
FnDecl->getParamDecl(0)),
SourceLocation(),
/// 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,
// Pass the argument.
- OwningExprResult InputInit
+ ExprResult InputInit
= PerformCopyInitialization(InitializedEntity::InitializeParameter(
Method->getParamDecl(i)),
SourceLocation(), Arg);
IsError |= InputInit.isInvalid();
Arg = InputInit.takeAs<Expr>();
} else {
- OwningExprResult DefArg
+ ExprResult DefArg
= BuildCXXDefaultArgExpr(LParenLoc, Method, Method->getParamDecl(i));
if (DefArg.isInvalid()) {
IsError = true;
/// 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");
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));
}
#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
}
-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>();
DiagRuntimeBehavior(Loc, PDiag(DiagID) << R1 << R2);
}
-Action::OwningStmtResult
+StmtResult
Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R,
MultiStmtArg elts, bool isStmtExpr) {
unsigned NumElts = elts.size();
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) {
CS->setSubStmt(SubStmt);
}
-Action::OwningStmtResult
+StmtResult
Sema::ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc,
Stmt *SubStmt, Scope *CurScope) {
if (getSwitchStack().empty()) {
return Owned(DS);
}
-Action::OwningStmtResult
+StmtResult
Sema::ActOnLabelStmt(SourceLocation IdentLoc, IdentifierInfo *II,
SourceLocation ColonLoc, Stmt *SubStmt) {
// Look up the record for this label identifier.
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) {
return expr->getType();
}
-Action::OwningStmtResult
+StmtResult
Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, Expr *Cond,
Decl *CondVar) {
- OwningExprResult CondResult;
+ ExprResult CondResult;
VarDecl *ConditionVar = 0;
if (CondVar) {
return Owned(SS);
}
-Action::OwningStmtResult
+StmtResult
Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
Stmt *BodyStmt) {
SwitchStmt *SS = cast<SwitchStmt>(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) {
Body, WhileLoc));
}
-Action::OwningStmtResult
+StmtResult
Sema::ActOnDoStmt(SourceLocation DoLoc, Stmt *Body,
SourceLocation WhileLoc, SourceLocation CondLParen,
Expr *Cond, SourceLocation CondRParen) {
if (CheckBooleanCondition(Cond, DoLoc))
return StmtError();
- OwningExprResult CondResult = MaybeCreateCXXExprWithTemporaries(Cond);
+ ExprResult CondResult = MaybeCreateCXXExprWithTemporaries(Cond);
if (CondResult.isInvalid())
return StmtError();
Cond = CondResult.take();
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,
}
}
- OwningExprResult SecondResult(second.release());
+ ExprResult SecondResult(second.release());
VarDecl *ConditionVar = 0;
if (secondVar) {
ConditionVar = cast<VarDecl>(secondVar);
RParenLoc));
}
-Action::OwningStmtResult
+StmtResult
Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc,
SourceLocation LParenLoc,
Stmt *First, Expr *Second,
ForLoc, RParenLoc));
}
-Action::OwningStmtResult
+StmtResult
Sema::ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc,
IdentifierInfo *LabelII) {
// Look up the record for this label identifier.
return Owned(new (Context) GotoStmt(LabelDecl, GotoLoc, LabelLoc));
}
-Action::OwningStmtResult
+StmtResult
Sema::ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc,
Expr *E) {
// Convert operand to void*
return Owned(new (Context) IndirectGotoStmt(GotoLoc, StarLoc, E));
}
-Action::OwningStmtResult
+StmtResult
Sema::ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope) {
Scope *S = CurScope->getContinueParent();
if (!S) {
return Owned(new (Context) ContinueStmt(ContinueLoc));
}
-Action::OwningStmtResult
+StmtResult
Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) {
Scope *S = CurScope->getBreakParent();
if (!S) {
/// 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.
// 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),
return Owned(Result);
}
-Action::OwningStmtResult
+StmtResult
Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
if (getCurBlock())
return ActOnBlockReturnStmt(ReturnLoc, 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),
}
-Sema::OwningStmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
+StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc,
bool IsSimple,
bool IsVolatile,
unsigned NumOutputs,
return Owned(NS);
}
-Action::OwningStmtResult
+StmtResult
Sema::ActOnObjCAtCatchStmt(SourceLocation AtLoc,
SourceLocation RParen, Decl *Parm,
Stmt *Body) {
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();
Finally));
}
-Sema::OwningStmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc,
+StmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc,
Expr *Throw) {
if (Throw) {
QualType ThrowType = Throw->getType();
return Owned(new (Context) ObjCAtThrowStmt(AtLoc, Throw));
}
-Action::OwningStmtResult
+StmtResult
Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw,
Scope *CurScope) {
if (!Throw) {
return BuildObjCAtThrowStmt(AtLoc, Throw);
}
-Action::OwningStmtResult
+StmtResult
Sema::ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SyncExpr,
Stmt *SyncBody) {
setFunctionHasBranchProtectedScope();
/// 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.
/// 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();
/// 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,
return BuildDependentDeclRefExpr(SS, NameInfo, TemplateArgs);
}
-Sema::OwningExprResult
+ExprResult
Sema::BuildDependentDeclRefExpr(const CXXScopeSpec &SS,
const DeclarationNameInfo &NameInfo,
const TemplateArgumentListInfo *TemplateArgs) {
return ParsedType::make(ElabType);
}
-Sema::OwningExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS,
+ExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS,
LookupResult &R,
bool RequiresADL,
const TemplateArgumentListInfo &TemplateArgs) {
}
// We actually only call this from template instantiation.
-Sema::OwningExprResult
+ExprResult
Sema::BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS,
const DeclarationNameInfo &NameInfo,
const TemplateArgumentListInfo &TemplateArgs) {
/// 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,
if (!NonTypeParm->hasDefaultArgument())
return TemplateArgumentLoc();
- OwningExprResult Arg = SubstDefaultTemplateArgument(*this, Template,
+ ExprResult Arg = SubstDefaultTemplateArgument(*this, Template,
TemplateLoc,
RAngleLoc,
NonTypeParm,
break;
}
- Sema::OwningExprResult E = SubstDefaultTemplateArgument(*this, Template,
+ ExprResult E = SubstDefaultTemplateArgument(*this, Template,
TemplateLoc,
RAngleLoc,
NTTP,
/// 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) {
ClassType.getTypePtr());
CXXScopeSpec SS;
SS.setScopeRep(Qualifier);
- OwningExprResult RefExpr = BuildDeclRefExpr(VD,
+ ExprResult RefExpr = BuildDeclRefExpr(VD,
VD->getType().getNonReferenceType(),
Loc,
&SS);
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();
/// 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 &&
return Rebuilder.TransformType(T);
}
-OwningExprResult Sema::RebuildExprInCurrentInstantiation(Expr *E) {
+ExprResult Sema::RebuildExprInCurrentInstantiation(Expr *E) {
CurrentInstantiationRebuilder Rebuilder(*this, E->getExprLoc(),
DeclarationName());
return Rebuilder.TransformExpr(E);
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,
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);
NNS, T);
}
-Sema::OwningExprResult
+ExprResult
TemplateInstantiator::TransformPredefinedExpr(PredefinedExpr *E) {
if (!E->isTypeDependent())
return SemaRef.Owned(E->Retain());
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
}
-Sema::OwningExprResult
+ExprResult
TemplateInstantiator::TransformDeclRefExpr(DeclRefExpr *E) {
NamedDecl *D = E->getDecl();
if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(D)) {
return TreeTransform<TemplateInstantiator>::TransformDeclRefExpr(E);
}
-Sema::OwningExprResult TemplateInstantiator::TransformCXXDefaultArgExpr(
+ExprResult TemplateInstantiator::TransformCXXDefaultArgExpr(
CXXDefaultArgExpr *E) {
assert(!cast<FunctionDecl>(E->getParam()->getDeclContext())->
getDescribedFunctionTemplate() &&
TSK);
}
-Sema::OwningStmtResult
+StmtResult
Sema::SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs) {
if (!S)
return Owned(S);
return Instantiator.TransformStmt(S);
}
-Sema::OwningExprResult
+ExprResult
Sema::SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs) {
if (!E)
return Owned(E);
const MultiLevelTemplateArgumentList &TemplateArgs;
public:
- typedef Sema::OwningExprResult OwningExprResult;
-
TemplateDeclInstantiator(Sema &SemaRef, DeclContext *Owner,
const MultiLevelTemplateArgumentList &TemplateArgs)
: SemaRef(SemaRef), Owner(Owner), TemplateArgs(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>());
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;
}
}
- Sema::OwningExprResult Result = S.SubstExpr(Init, TemplateArgs);
+ ExprResult Result = S.SubstExpr(Init, TemplateArgs);
if (Result.isInvalid())
return true;
// 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;
// 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(),
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,
}
// Instantiate the function body.
- OwningStmtResult Body = SubstStmt(Pattern, TemplateArgs);
+ StmtResult Body = SubstStmt(Pattern, TemplateArgs);
if (Body.isInvalid())
Function->setInvalidDecl();
Sema &SemaRef;
public:
- typedef Sema::OwningStmtResult OwningStmtResult;
- typedef Sema::OwningExprResult OwningExprResult;
typedef Sema::MultiExprArg MultiExprArg;
typedef Sema::MultiStmtArg MultiStmtArg;
return static_cast<const Derived&>(*this);
}
- static inline OwningExprResult Owned(Expr *E) { return E; }
- static inline OwningStmtResult Owned(Stmt *S) { return S; }
+ static inline ExprResult Owned(Expr *E) { return E; }
+ static inline StmtResult Owned(Stmt *S) { return S; }
/// \brief Retrieves a reference to the semantic analysis object used for
/// this tree transform.
/// other mechanism.
///
/// \returns the transformed statement.
- OwningStmtResult TransformStmt(Stmt *S);
+ StmtResult TransformStmt(Stmt *S);
/// \brief Transform the given expression.
///
/// other mechanism.
///
/// \returns the transformed expression.
- OwningExprResult TransformExpr(Expr *E);
+ ExprResult TransformExpr(Expr *E);
/// \brief Transform the given declaration, which is referenced from a type
/// or expression.
TransformTemplateSpecializationType(const TemplateSpecializationType *T,
QualType ObjectType);
- OwningStmtResult TransformCompoundStmt(CompoundStmt *S, bool IsStmtExpr);
- OwningExprResult TransformCXXNamedCastExpr(CXXNamedCastExpr *E);
+ StmtResult TransformCompoundStmt(CompoundStmt *S, bool IsStmtExpr);
+ ExprResult TransformCXXNamedCastExpr(CXXNamedCastExpr *E);
#define STMT(Node, Parent) \
- OwningStmtResult Transform##Node(Node *S);
+ StmtResult Transform##Node(Node *S);
#define EXPR(Node, Parent) \
- OwningExprResult Transform##Node(Node *E);
+ ExprResult Transform##Node(Node *E);
#define ABSTRACT_STMT(Stmt)
#include "clang/AST/StmtNodes.inc"
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildCompoundStmt(SourceLocation LBraceLoc,
+ StmtResult RebuildCompoundStmt(SourceLocation LBraceLoc,
MultiStmtArg Statements,
SourceLocation RBraceLoc,
bool IsStmtExpr) {
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildCaseStmt(SourceLocation CaseLoc,
+ StmtResult RebuildCaseStmt(SourceLocation CaseLoc,
Expr *LHS,
SourceLocation EllipsisLoc,
Expr *RHS,
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildCaseStmtBody(Stmt *S, Stmt *Body) {
+ StmtResult RebuildCaseStmtBody(Stmt *S, Stmt *Body) {
getSema().ActOnCaseStmtBody(S, Body);
return S;
}
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildDefaultStmt(SourceLocation DefaultLoc,
+ StmtResult RebuildDefaultStmt(SourceLocation DefaultLoc,
SourceLocation ColonLoc,
Stmt *SubStmt) {
return getSema().ActOnDefaultStmt(DefaultLoc, ColonLoc, SubStmt,
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildLabelStmt(SourceLocation IdentLoc,
+ StmtResult RebuildLabelStmt(SourceLocation IdentLoc,
IdentifierInfo *Id,
SourceLocation ColonLoc,
Stmt *SubStmt) {
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildIfStmt(SourceLocation IfLoc, Sema::FullExprArg Cond,
+ StmtResult RebuildIfStmt(SourceLocation IfLoc, Sema::FullExprArg Cond,
VarDecl *CondVar, Stmt *Then,
SourceLocation ElseLoc, Stmt *Else) {
return getSema().ActOnIfStmt(IfLoc, Cond, CondVar, Then, ElseLoc, Else);
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildSwitchStmtStart(SourceLocation SwitchLoc,
+ StmtResult RebuildSwitchStmtStart(SourceLocation SwitchLoc,
Expr *Cond, VarDecl *CondVar) {
return getSema().ActOnStartOfSwitchStmt(SwitchLoc, Cond,
CondVar);
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildSwitchStmtBody(SourceLocation SwitchLoc,
+ StmtResult RebuildSwitchStmtBody(SourceLocation SwitchLoc,
Stmt *Switch, Stmt *Body) {
return getSema().ActOnFinishSwitchStmt(SwitchLoc, Switch, Body);
}
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildWhileStmt(SourceLocation WhileLoc,
+ StmtResult RebuildWhileStmt(SourceLocation WhileLoc,
Sema::FullExprArg Cond,
VarDecl *CondVar,
Stmt *Body) {
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildDoStmt(SourceLocation DoLoc, Stmt *Body,
+ StmtResult RebuildDoStmt(SourceLocation DoLoc, Stmt *Body,
SourceLocation WhileLoc,
SourceLocation LParenLoc,
Expr *Cond,
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildForStmt(SourceLocation ForLoc,
+ StmtResult RebuildForStmt(SourceLocation ForLoc,
SourceLocation LParenLoc,
Stmt *Init, Sema::FullExprArg Cond,
VarDecl *CondVar, Sema::FullExprArg Inc,
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildGotoStmt(SourceLocation GotoLoc,
+ StmtResult RebuildGotoStmt(SourceLocation GotoLoc,
SourceLocation LabelLoc,
LabelStmt *Label) {
return getSema().ActOnGotoStmt(GotoLoc, LabelLoc, Label->getID());
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildIndirectGotoStmt(SourceLocation GotoLoc,
+ StmtResult RebuildIndirectGotoStmt(SourceLocation GotoLoc,
SourceLocation StarLoc,
Expr *Target) {
return getSema().ActOnIndirectGotoStmt(GotoLoc, StarLoc, Target);
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildReturnStmt(SourceLocation ReturnLoc,
+ StmtResult RebuildReturnStmt(SourceLocation ReturnLoc,
Expr *Result) {
return getSema().ActOnReturnStmt(ReturnLoc, Result);
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildDeclStmt(Decl **Decls, unsigned NumDecls,
+ StmtResult RebuildDeclStmt(Decl **Decls, unsigned NumDecls,
SourceLocation StartLoc,
SourceLocation EndLoc) {
return getSema().Owned(
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildAsmStmt(SourceLocation AsmLoc,
+ StmtResult RebuildAsmStmt(SourceLocation AsmLoc,
bool IsSimple,
bool IsVolatile,
unsigned NumOutputs,
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildObjCAtTryStmt(SourceLocation AtLoc,
+ StmtResult RebuildObjCAtTryStmt(SourceLocation AtLoc,
Stmt *TryBody,
MultiStmtArg CatchStmts,
Stmt *Finally) {
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildObjCAtCatchStmt(SourceLocation AtLoc,
+ StmtResult RebuildObjCAtCatchStmt(SourceLocation AtLoc,
SourceLocation RParenLoc,
VarDecl *Var,
Stmt *Body) {
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildObjCAtFinallyStmt(SourceLocation AtLoc,
+ StmtResult RebuildObjCAtFinallyStmt(SourceLocation AtLoc,
Stmt *Body) {
return getSema().ActOnObjCAtFinallyStmt(AtLoc, Body);
}
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildObjCAtThrowStmt(SourceLocation AtLoc,
+ StmtResult RebuildObjCAtThrowStmt(SourceLocation AtLoc,
Expr *Operand) {
return getSema().BuildObjCAtThrowStmt(AtLoc, Operand);
}
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildObjCAtSynchronizedStmt(SourceLocation AtLoc,
+ StmtResult RebuildObjCAtSynchronizedStmt(SourceLocation AtLoc,
Expr *Object,
Stmt *Body) {
return getSema().ActOnObjCAtSynchronizedStmt(AtLoc, Object,
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildObjCForCollectionStmt(SourceLocation ForLoc,
+ StmtResult RebuildObjCForCollectionStmt(SourceLocation ForLoc,
SourceLocation LParenLoc,
Stmt *Element,
Expr *Collection,
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildCXXCatchStmt(SourceLocation CatchLoc,
+ StmtResult RebuildCXXCatchStmt(SourceLocation CatchLoc,
VarDecl *ExceptionDecl,
Stmt *Handler) {
return Owned(new (getSema().Context) CXXCatchStmt(CatchLoc, ExceptionDecl,
///
/// By default, performs semantic analysis to build the new statement.
/// Subclasses may override this routine to provide different behavior.
- OwningStmtResult RebuildCXXTryStmt(SourceLocation TryLoc,
+ StmtResult RebuildCXXTryStmt(SourceLocation TryLoc,
Stmt *TryBlock,
MultiStmtArg Handlers) {
return getSema().ActOnCXXTryBlock(TryLoc, TryBlock, move(Handlers));
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildDeclarationNameExpr(const CXXScopeSpec &SS,
+ ExprResult RebuildDeclarationNameExpr(const CXXScopeSpec &SS,
LookupResult &R,
bool RequiresADL) {
return getSema().BuildDeclarationNameExpr(SS, R, RequiresADL);
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildDeclRefExpr(NestedNameSpecifier *Qualifier,
+ ExprResult RebuildDeclRefExpr(NestedNameSpecifier *Qualifier,
SourceRange QualifierRange,
ValueDecl *VD,
const DeclarationNameInfo &NameInfo,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildParenExpr(Expr *SubExpr, SourceLocation LParen,
+ ExprResult RebuildParenExpr(Expr *SubExpr, SourceLocation LParen,
SourceLocation RParen) {
return getSema().ActOnParenExpr(LParen, RParen, SubExpr);
}
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXPseudoDestructorExpr(Expr *Base,
+ ExprResult RebuildCXXPseudoDestructorExpr(Expr *Base,
SourceLocation OperatorLoc,
bool isArrow,
NestedNameSpecifier *Qualifier,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildUnaryOperator(SourceLocation OpLoc,
+ ExprResult RebuildUnaryOperator(SourceLocation OpLoc,
UnaryOperator::Opcode Opc,
Expr *SubExpr) {
return getSema().BuildUnaryOp(/*Scope=*/0, OpLoc, Opc, SubExpr);
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildOffsetOfExpr(SourceLocation OperatorLoc,
+ ExprResult RebuildOffsetOfExpr(SourceLocation OperatorLoc,
TypeSourceInfo *Type,
Action::OffsetOfComponent *Components,
unsigned NumComponents,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildSizeOfAlignOf(TypeSourceInfo *TInfo,
+ ExprResult RebuildSizeOfAlignOf(TypeSourceInfo *TInfo,
SourceLocation OpLoc,
bool isSizeOf, SourceRange R) {
return getSema().CreateSizeOfAlignOfExpr(TInfo, OpLoc, isSizeOf, R);
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildSizeOfAlignOf(Expr *SubExpr, SourceLocation OpLoc,
+ ExprResult RebuildSizeOfAlignOf(Expr *SubExpr, SourceLocation OpLoc,
bool isSizeOf, SourceRange R) {
- OwningExprResult Result
+ ExprResult Result
= getSema().CreateSizeOfAlignOfExpr(SubExpr, OpLoc, isSizeOf, R);
if (Result.isInvalid())
return getSema().ExprError();
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildArraySubscriptExpr(Expr *LHS,
+ ExprResult RebuildArraySubscriptExpr(Expr *LHS,
SourceLocation LBracketLoc,
Expr *RHS,
SourceLocation RBracketLoc) {
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCallExpr(Expr *Callee, SourceLocation LParenLoc,
+ ExprResult RebuildCallExpr(Expr *Callee, SourceLocation LParenLoc,
MultiExprArg Args,
SourceLocation *CommaLocs,
SourceLocation RParenLoc) {
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildMemberExpr(Expr *Base, SourceLocation OpLoc,
+ ExprResult RebuildMemberExpr(Expr *Base, SourceLocation OpLoc,
bool isArrow,
NestedNameSpecifier *Qualifier,
SourceRange QualifierRange,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildBinaryOperator(SourceLocation OpLoc,
+ ExprResult RebuildBinaryOperator(SourceLocation OpLoc,
BinaryOperator::Opcode Opc,
Expr *LHS, Expr *RHS) {
return getSema().BuildBinOp(/*Scope=*/0, OpLoc, Opc, LHS, RHS);
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildConditionalOperator(Expr *Cond,
+ ExprResult RebuildConditionalOperator(Expr *Cond,
SourceLocation QuestionLoc,
Expr *LHS,
SourceLocation ColonLoc,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCStyleCastExpr(SourceLocation LParenLoc,
+ ExprResult RebuildCStyleCastExpr(SourceLocation LParenLoc,
TypeSourceInfo *TInfo,
SourceLocation RParenLoc,
Expr *SubExpr) {
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCompoundLiteralExpr(SourceLocation LParenLoc,
+ ExprResult RebuildCompoundLiteralExpr(SourceLocation LParenLoc,
TypeSourceInfo *TInfo,
SourceLocation RParenLoc,
Expr *Init) {
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildExtVectorElementExpr(Expr *Base,
+ ExprResult RebuildExtVectorElementExpr(Expr *Base,
SourceLocation OpLoc,
SourceLocation AccessorLoc,
IdentifierInfo &Accessor) {
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildInitList(SourceLocation LBraceLoc,
+ ExprResult RebuildInitList(SourceLocation LBraceLoc,
MultiExprArg Inits,
SourceLocation RBraceLoc,
QualType ResultTy) {
- OwningExprResult Result
+ ExprResult Result
= SemaRef.ActOnInitList(LBraceLoc, move(Inits), RBraceLoc);
if (Result.isInvalid() || ResultTy->isDependentType())
return move(Result);
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildDesignatedInitExpr(Designation &Desig,
+ ExprResult RebuildDesignatedInitExpr(Designation &Desig,
MultiExprArg ArrayExprs,
SourceLocation EqualOrColonLoc,
bool GNUSyntax,
Expr *Init) {
- OwningExprResult Result
+ ExprResult Result
= SemaRef.ActOnDesignatedInitializer(Desig, EqualOrColonLoc, GNUSyntax,
Init);
if (Result.isInvalid())
/// By default, builds the implicit value initialization without performing
/// any semantic analysis. Subclasses may override this routine to provide
/// different behavior.
- OwningExprResult RebuildImplicitValueInitExpr(QualType T) {
+ ExprResult RebuildImplicitValueInitExpr(QualType T) {
return SemaRef.Owned(new (SemaRef.Context) ImplicitValueInitExpr(T));
}
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildVAArgExpr(SourceLocation BuiltinLoc,
+ ExprResult RebuildVAArgExpr(SourceLocation BuiltinLoc,
Expr *SubExpr, TypeSourceInfo *TInfo,
SourceLocation RParenLoc) {
return getSema().BuildVAArgExpr(BuiltinLoc,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildParenListExpr(SourceLocation LParenLoc,
+ ExprResult RebuildParenListExpr(SourceLocation LParenLoc,
MultiExprArg SubExprs,
SourceLocation RParenLoc) {
return getSema().ActOnParenOrParenListExpr(LParenLoc, RParenLoc,
/// By default, performs semantic analysis, using the name of the label
/// rather than attempting to map the label statement itself.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildAddrLabelExpr(SourceLocation AmpAmpLoc,
+ ExprResult RebuildAddrLabelExpr(SourceLocation AmpAmpLoc,
SourceLocation LabelLoc,
LabelStmt *Label) {
return getSema().ActOnAddrLabel(AmpAmpLoc, LabelLoc, Label->getID());
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildStmtExpr(SourceLocation LParenLoc,
+ ExprResult RebuildStmtExpr(SourceLocation LParenLoc,
Stmt *SubStmt,
SourceLocation RParenLoc) {
return getSema().ActOnStmtExpr(LParenLoc, SubStmt, RParenLoc);
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildTypesCompatibleExpr(SourceLocation BuiltinLoc,
+ ExprResult RebuildTypesCompatibleExpr(SourceLocation BuiltinLoc,
TypeSourceInfo *TInfo1,
TypeSourceInfo *TInfo2,
SourceLocation RParenLoc) {
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildChooseExpr(SourceLocation BuiltinLoc,
+ ExprResult RebuildChooseExpr(SourceLocation BuiltinLoc,
Expr *Cond, Expr *LHS, Expr *RHS,
SourceLocation RParenLoc) {
return SemaRef.ActOnChooseExpr(BuiltinLoc,
/// operator call into a use of a builtin operator, performing
/// argument-dependent lookup, etc. Subclasses may override this routine to
/// provide different behavior.
- OwningExprResult RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
+ ExprResult RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
SourceLocation OpLoc,
Expr *Callee,
Expr *First,
/// By default, this routine dispatches to one of the more-specific routines
/// for a particular named case, e.g., RebuildCXXStaticCastExpr().
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXNamedCastExpr(SourceLocation OpLoc,
+ ExprResult RebuildCXXNamedCastExpr(SourceLocation OpLoc,
Stmt::StmtClass Class,
SourceLocation LAngleLoc,
TypeSourceInfo *TInfo,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXStaticCastExpr(SourceLocation OpLoc,
+ ExprResult RebuildCXXStaticCastExpr(SourceLocation OpLoc,
SourceLocation LAngleLoc,
TypeSourceInfo *TInfo,
SourceLocation RAngleLoc,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXDynamicCastExpr(SourceLocation OpLoc,
+ ExprResult RebuildCXXDynamicCastExpr(SourceLocation OpLoc,
SourceLocation LAngleLoc,
TypeSourceInfo *TInfo,
SourceLocation RAngleLoc,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXReinterpretCastExpr(SourceLocation OpLoc,
+ ExprResult RebuildCXXReinterpretCastExpr(SourceLocation OpLoc,
SourceLocation LAngleLoc,
TypeSourceInfo *TInfo,
SourceLocation RAngleLoc,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXConstCastExpr(SourceLocation OpLoc,
+ ExprResult RebuildCXXConstCastExpr(SourceLocation OpLoc,
SourceLocation LAngleLoc,
TypeSourceInfo *TInfo,
SourceLocation RAngleLoc,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXFunctionalCastExpr(SourceRange TypeRange,
+ ExprResult RebuildCXXFunctionalCastExpr(SourceRange TypeRange,
TypeSourceInfo *TInfo,
SourceLocation LParenLoc,
Expr *Sub,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXTypeidExpr(QualType TypeInfoType,
+ ExprResult RebuildCXXTypeidExpr(QualType TypeInfoType,
SourceLocation TypeidLoc,
TypeSourceInfo *Operand,
SourceLocation RParenLoc) {
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXTypeidExpr(QualType TypeInfoType,
+ ExprResult RebuildCXXTypeidExpr(QualType TypeInfoType,
SourceLocation TypeidLoc,
Expr *Operand,
SourceLocation RParenLoc) {
/// By default, builds a new "this" expression without performing any
/// semantic analysis. Subclasses may override this routine to provide
/// different behavior.
- OwningExprResult RebuildCXXThisExpr(SourceLocation ThisLoc,
+ ExprResult RebuildCXXThisExpr(SourceLocation ThisLoc,
QualType ThisType,
bool isImplicit) {
return getSema().Owned(
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXThrowExpr(SourceLocation ThrowLoc, Expr *Sub) {
+ ExprResult RebuildCXXThrowExpr(SourceLocation ThrowLoc, Expr *Sub) {
return getSema().ActOnCXXThrow(ThrowLoc, Sub);
}
/// By default, builds a new default-argument expression, which does not
/// require any semantic analysis. Subclasses may override this routine to
/// provide different behavior.
- OwningExprResult RebuildCXXDefaultArgExpr(SourceLocation Loc,
+ ExprResult RebuildCXXDefaultArgExpr(SourceLocation Loc,
ParmVarDecl *Param) {
return getSema().Owned(CXXDefaultArgExpr::Create(getSema().Context, Loc,
Param));
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXScalarValueInitExpr(SourceLocation TypeStartLoc,
+ ExprResult RebuildCXXScalarValueInitExpr(SourceLocation TypeStartLoc,
SourceLocation LParenLoc,
QualType T,
SourceLocation RParenLoc) {
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXNewExpr(SourceLocation StartLoc,
+ ExprResult RebuildCXXNewExpr(SourceLocation StartLoc,
bool UseGlobal,
SourceLocation PlacementLParen,
MultiExprArg PlacementArgs,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXDeleteExpr(SourceLocation StartLoc,
+ ExprResult RebuildCXXDeleteExpr(SourceLocation StartLoc,
bool IsGlobalDelete,
bool IsArrayForm,
Expr *Operand) {
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildUnaryTypeTrait(UnaryTypeTrait Trait,
+ ExprResult RebuildUnaryTypeTrait(UnaryTypeTrait Trait,
SourceLocation StartLoc,
SourceLocation LParenLoc,
QualType T,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildDependentScopeDeclRefExpr(NestedNameSpecifier *NNS,
+ ExprResult RebuildDependentScopeDeclRefExpr(NestedNameSpecifier *NNS,
SourceRange QualifierRange,
const DeclarationNameInfo &NameInfo,
const TemplateArgumentListInfo *TemplateArgs) {
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildTemplateIdExpr(const CXXScopeSpec &SS,
+ ExprResult RebuildTemplateIdExpr(const CXXScopeSpec &SS,
LookupResult &R,
bool RequiresADL,
const TemplateArgumentListInfo &TemplateArgs) {
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXConstructExpr(QualType T,
+ ExprResult RebuildCXXConstructExpr(QualType T,
SourceLocation Loc,
CXXConstructorDecl *Constructor,
bool IsElidable,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXTemporaryObjectExpr(SourceLocation TypeBeginLoc,
+ ExprResult RebuildCXXTemporaryObjectExpr(SourceLocation TypeBeginLoc,
QualType T,
SourceLocation LParenLoc,
MultiExprArg Args,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXUnresolvedConstructExpr(SourceLocation TypeBeginLoc,
+ ExprResult RebuildCXXUnresolvedConstructExpr(SourceLocation TypeBeginLoc,
QualType T,
SourceLocation LParenLoc,
MultiExprArg Args,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildCXXDependentScopeMemberExpr(Expr *BaseE,
+ ExprResult RebuildCXXDependentScopeMemberExpr(Expr *BaseE,
QualType BaseType,
bool IsArrow,
SourceLocation OperatorLoc,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildUnresolvedMemberExpr(Expr *BaseE,
+ ExprResult RebuildUnresolvedMemberExpr(Expr *BaseE,
QualType BaseType,
SourceLocation OperatorLoc,
bool IsArrow,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildObjCEncodeExpr(SourceLocation AtLoc,
+ ExprResult RebuildObjCEncodeExpr(SourceLocation AtLoc,
TypeSourceInfo *EncodeTypeInfo,
SourceLocation RParenLoc) {
return SemaRef.Owned(SemaRef.BuildObjCEncodeExpression(AtLoc, EncodeTypeInfo,
}
/// \brief Build a new Objective-C class message.
- OwningExprResult RebuildObjCMessageExpr(TypeSourceInfo *ReceiverTypeInfo,
+ ExprResult RebuildObjCMessageExpr(TypeSourceInfo *ReceiverTypeInfo,
Selector Sel,
ObjCMethodDecl *Method,
SourceLocation LBracLoc,
}
/// \brief Build a new Objective-C instance message.
- OwningExprResult RebuildObjCMessageExpr(Expr *Receiver,
+ ExprResult RebuildObjCMessageExpr(Expr *Receiver,
Selector Sel,
ObjCMethodDecl *Method,
SourceLocation LBracLoc,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildObjCIvarRefExpr(Expr *BaseArg, ObjCIvarDecl *Ivar,
+ ExprResult RebuildObjCIvarRefExpr(Expr *BaseArg, ObjCIvarDecl *Ivar,
SourceLocation IvarLoc,
bool IsArrow, bool IsFreeIvar) {
// FIXME: We lose track of the IsFreeIvar bit.
Expr *Base = BaseArg;
LookupResult R(getSema(), Ivar->getDeclName(), IvarLoc,
Sema::LookupMemberName);
- OwningExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
+ ExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
/*FIME:*/IvarLoc,
SS, 0,
false);
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildObjCPropertyRefExpr(Expr *BaseArg,
+ ExprResult RebuildObjCPropertyRefExpr(Expr *BaseArg,
ObjCPropertyDecl *Property,
SourceLocation PropertyLoc) {
CXXScopeSpec SS;
LookupResult R(getSema(), Property->getDeclName(), PropertyLoc,
Sema::LookupMemberName);
bool IsArrow = false;
- OwningExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
+ ExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
/*FIME:*/PropertyLoc,
SS, 0, false);
if (Result.isInvalid())
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildObjCImplicitSetterGetterRefExpr(
+ ExprResult RebuildObjCImplicitSetterGetterRefExpr(
ObjCMethodDecl *Getter,
QualType T,
ObjCMethodDecl *Setter,
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildObjCIsaExpr(Expr *BaseArg, SourceLocation IsaLoc,
+ ExprResult RebuildObjCIsaExpr(Expr *BaseArg, SourceLocation IsaLoc,
bool IsArrow) {
CXXScopeSpec SS;
Expr *Base = BaseArg;
LookupResult R(getSema(), &getSema().Context.Idents.get("isa"), IsaLoc,
Sema::LookupMemberName);
- OwningExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
+ ExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
/*FIME:*/IsaLoc,
SS, 0, false);
if (Result.isInvalid())
///
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
- OwningExprResult RebuildShuffleVectorExpr(SourceLocation BuiltinLoc,
+ ExprResult RebuildShuffleVectorExpr(SourceLocation BuiltinLoc,
MultiExprArg SubExprs,
SourceLocation RParenLoc) {
// Find the declaration for __builtin_shufflevector
Subs, NumSubExprs,
Builtin->getCallResultType(),
RParenLoc);
- OwningExprResult OwnedCall(SemaRef.Owned(TheCall));
+ ExprResult OwnedCall(SemaRef.Owned(TheCall));
// Type-check the __builtin_shufflevector expression.
- OwningExprResult Result = SemaRef.SemaBuiltinShuffleVector(TheCall);
+ ExprResult Result = SemaRef.SemaBuiltinShuffleVector(TheCall);
if (Result.isInvalid())
return SemaRef.ExprError();
};
template<typename Derived>
-Sema::OwningStmtResult TreeTransform<Derived>::TransformStmt(Stmt *S) {
+StmtResult TreeTransform<Derived>::TransformStmt(Stmt *S) {
if (!S)
return SemaRef.Owned(S);
#define EXPR(Node, Parent) case Stmt::Node##Class:
#include "clang/AST/StmtNodes.inc"
{
- Sema::OwningExprResult E = getDerived().TransformExpr(cast<Expr>(S));
+ ExprResult E = getDerived().TransformExpr(cast<Expr>(S));
if (E.isInvalid())
return getSema().StmtError();
template<typename Derived>
-Sema::OwningExprResult TreeTransform<Derived>::TransformExpr(Expr *E) {
+ExprResult TreeTransform<Derived>::TransformExpr(Expr *E) {
if (!E)
return SemaRef.Owned(E);
if (SourceExpr) {
EnterExpressionEvaluationContext Unevaluated(getSema(),
Action::Unevaluated);
- Sema::OwningExprResult E = getDerived().TransformExpr(SourceExpr);
+ ExprResult E = getDerived().TransformExpr(SourceExpr);
SourceExpr = (E.isInvalid() ? 0 : E.take());
}
Expr *InputExpr = Input.getSourceExpression();
if (!InputExpr) InputExpr = Input.getArgument().getAsExpr();
- Sema::OwningExprResult E
+ ExprResult E
= getDerived().TransformExpr(InputExpr);
if (E.isInvalid()) return true;
Output = TemplateArgumentLoc(TemplateArgument(E.take()), E.take());
// Array bounds are not potentially evaluated contexts
EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
- Sema::OwningExprResult SizeResult
+ ExprResult SizeResult
= getDerived().TransformExpr(T->getSizeExpr());
if (SizeResult.isInvalid())
return QualType();
// Array bounds are not potentially evaluated contexts
EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
- Sema::OwningExprResult SizeResult
+ ExprResult SizeResult
= getDerived().TransformExpr(T->getSizeExpr());
if (SizeResult.isInvalid())
return QualType();
// Vector sizes are not potentially evaluated contexts
EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
- Sema::OwningExprResult Size = getDerived().TransformExpr(T->getSizeExpr());
+ ExprResult Size = getDerived().TransformExpr(T->getSizeExpr());
if (Size.isInvalid())
return QualType();
// typeof expressions are not potentially evaluated contexts
EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
- Sema::OwningExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
+ ExprResult E = getDerived().TransformExpr(TL.getUnderlyingExpr());
if (E.isInvalid())
return QualType();
// decltype expressions are not potentially evaluated contexts
EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
- Sema::OwningExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
+ ExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
if (E.isInvalid())
return QualType();
// Statement transformation
//===----------------------------------------------------------------------===//
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformNullStmt(NullStmt *S) {
return SemaRef.Owned(S->Retain());
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformCompoundStmt(CompoundStmt *S) {
return getDerived().TransformCompoundStmt(S, false);
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformCompoundStmt(CompoundStmt *S,
bool IsStmtExpr) {
bool SubStmtChanged = false;
ASTOwningVector<Stmt*> Statements(getSema());
for (CompoundStmt::body_iterator B = S->body_begin(), BEnd = S->body_end();
B != BEnd; ++B) {
- OwningStmtResult Result = getDerived().TransformStmt(*B);
+ StmtResult Result = getDerived().TransformStmt(*B);
if (Result.isInvalid())
return getSema().StmtError();
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) {
- OwningExprResult LHS, RHS;
+ ExprResult LHS, RHS;
{
// The case value expressions are not potentially evaluated.
EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
// Build the case statement.
// Case statements are always rebuilt so that they will attached to their
// transformed switch statement.
- OwningStmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
+ StmtResult Case = getDerived().RebuildCaseStmt(S->getCaseLoc(),
LHS.get(),
S->getEllipsisLoc(),
RHS.get(),
return SemaRef.StmtError();
// Transform the statement following the case
- OwningStmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt());
+ StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt());
if (SubStmt.isInvalid())
return SemaRef.StmtError();
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformDefaultStmt(DefaultStmt *S) {
// Transform the statement following the default case
- OwningStmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt());
+ StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt());
if (SubStmt.isInvalid())
return SemaRef.StmtError();
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformLabelStmt(LabelStmt *S) {
- OwningStmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt());
+ StmtResult SubStmt = getDerived().TransformStmt(S->getSubStmt());
if (SubStmt.isInvalid())
return SemaRef.StmtError();
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
// Transform the condition
- OwningExprResult Cond;
+ ExprResult Cond;
VarDecl *ConditionVar = 0;
if (S->getConditionVariable()) {
ConditionVar
// Convert the condition to a boolean value.
if (S->getCond()) {
- OwningExprResult CondE = getSema().ActOnBooleanCondition(0,
+ ExprResult CondE = getSema().ActOnBooleanCondition(0,
S->getIfLoc(),
Cond.get());
if (CondE.isInvalid())
return SemaRef.StmtError();
// Transform the "then" branch.
- OwningStmtResult Then = getDerived().TransformStmt(S->getThen());
+ StmtResult Then = getDerived().TransformStmt(S->getThen());
if (Then.isInvalid())
return SemaRef.StmtError();
// Transform the "else" branch.
- OwningStmtResult Else = getDerived().TransformStmt(S->getElse());
+ StmtResult Else = getDerived().TransformStmt(S->getElse());
if (Else.isInvalid())
return SemaRef.StmtError();
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
// Transform the condition.
- OwningExprResult Cond;
+ ExprResult Cond;
VarDecl *ConditionVar = 0;
if (S->getConditionVariable()) {
ConditionVar
}
// Rebuild the switch statement.
- OwningStmtResult Switch
+ StmtResult Switch
= getDerived().RebuildSwitchStmtStart(S->getSwitchLoc(), Cond.get(),
ConditionVar);
if (Switch.isInvalid())
return SemaRef.StmtError();
// Transform the body of the switch statement.
- OwningStmtResult Body = getDerived().TransformStmt(S->getBody());
+ StmtResult Body = getDerived().TransformStmt(S->getBody());
if (Body.isInvalid())
return SemaRef.StmtError();
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
// Transform the condition
- OwningExprResult Cond;
+ ExprResult Cond;
VarDecl *ConditionVar = 0;
if (S->getConditionVariable()) {
ConditionVar
if (S->getCond()) {
// Convert the condition to a boolean value.
- OwningExprResult CondE = getSema().ActOnBooleanCondition(0,
+ ExprResult CondE = getSema().ActOnBooleanCondition(0,
S->getWhileLoc(),
Cond.get());
if (CondE.isInvalid())
return SemaRef.StmtError();
// Transform the body
- OwningStmtResult Body = getDerived().TransformStmt(S->getBody());
+ StmtResult Body = getDerived().TransformStmt(S->getBody());
if (Body.isInvalid())
return SemaRef.StmtError();
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformDoStmt(DoStmt *S) {
// Transform the body
- OwningStmtResult Body = getDerived().TransformStmt(S->getBody());
+ StmtResult Body = getDerived().TransformStmt(S->getBody());
if (Body.isInvalid())
return SemaRef.StmtError();
// Transform the condition
- OwningExprResult Cond = getDerived().TransformExpr(S->getCond());
+ ExprResult Cond = getDerived().TransformExpr(S->getCond());
if (Cond.isInvalid())
return SemaRef.StmtError();
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
// Transform the initialization statement
- OwningStmtResult Init = getDerived().TransformStmt(S->getInit());
+ StmtResult Init = getDerived().TransformStmt(S->getInit());
if (Init.isInvalid())
return SemaRef.StmtError();
// Transform the condition
- OwningExprResult Cond;
+ ExprResult Cond;
VarDecl *ConditionVar = 0;
if (S->getConditionVariable()) {
ConditionVar
if (S->getCond()) {
// Convert the condition to a boolean value.
- OwningExprResult CondE = getSema().ActOnBooleanCondition(0,
+ ExprResult CondE = getSema().ActOnBooleanCondition(0,
S->getForLoc(),
Cond.get());
if (CondE.isInvalid())
return SemaRef.StmtError();
// Transform the increment
- OwningExprResult Inc = getDerived().TransformExpr(S->getInc());
+ ExprResult Inc = getDerived().TransformExpr(S->getInc());
if (Inc.isInvalid())
return SemaRef.StmtError();
return SemaRef.StmtError();
// Transform the body
- OwningStmtResult Body = getDerived().TransformStmt(S->getBody());
+ StmtResult Body = getDerived().TransformStmt(S->getBody());
if (Body.isInvalid())
return SemaRef.StmtError();
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformGotoStmt(GotoStmt *S) {
// Goto statements must always be rebuilt, to resolve the label.
return getDerived().RebuildGotoStmt(S->getGotoLoc(), S->getLabelLoc(),
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformIndirectGotoStmt(IndirectGotoStmt *S) {
- OwningExprResult Target = getDerived().TransformExpr(S->getTarget());
+ ExprResult Target = getDerived().TransformExpr(S->getTarget());
if (Target.isInvalid())
return SemaRef.StmtError();
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformContinueStmt(ContinueStmt *S) {
return SemaRef.Owned(S->Retain());
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformBreakStmt(BreakStmt *S) {
return SemaRef.Owned(S->Retain());
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformReturnStmt(ReturnStmt *S) {
- Sema::OwningExprResult Result = getDerived().TransformExpr(S->getRetValue());
+ ExprResult Result = getDerived().TransformExpr(S->getRetValue());
if (Result.isInvalid())
return SemaRef.StmtError();
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformDeclStmt(DeclStmt *S) {
bool DeclChanged = false;
llvm::SmallVector<Decl *, 4> Decls;
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformSwitchCase(SwitchCase *S) {
assert(false && "SwitchCase is abstract and cannot be transformed");
return SemaRef.Owned(S->Retain());
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformAsmStmt(AsmStmt *S) {
ASTOwningVector<Expr*> Constraints(getSema());
ASTOwningVector<Expr*> Exprs(getSema());
llvm::SmallVector<IdentifierInfo *, 4> Names;
- OwningExprResult AsmString;
+ ExprResult AsmString;
ASTOwningVector<Expr*> Clobbers(getSema());
bool ExprsChanged = false;
// Transform the output expr.
Expr *OutputExpr = S->getOutputExpr(I);
- OwningExprResult Result = getDerived().TransformExpr(OutputExpr);
+ ExprResult Result = getDerived().TransformExpr(OutputExpr);
if (Result.isInvalid())
return SemaRef.StmtError();
// Transform the input expr.
Expr *InputExpr = S->getInputExpr(I);
- OwningExprResult Result = getDerived().TransformExpr(InputExpr);
+ ExprResult Result = getDerived().TransformExpr(InputExpr);
if (Result.isInvalid())
return SemaRef.StmtError();
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformObjCAtTryStmt(ObjCAtTryStmt *S) {
// Transform the body of the @try.
- OwningStmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
+ StmtResult TryBody = getDerived().TransformStmt(S->getTryBody());
if (TryBody.isInvalid())
return SemaRef.StmtError();
bool AnyCatchChanged = false;
ASTOwningVector<Stmt*> CatchStmts(SemaRef);
for (unsigned I = 0, N = S->getNumCatchStmts(); I != N; ++I) {
- OwningStmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
+ StmtResult Catch = getDerived().TransformStmt(S->getCatchStmt(I));
if (Catch.isInvalid())
return SemaRef.StmtError();
if (Catch.get() != S->getCatchStmt(I))
}
// Transform the @finally statement (if present).
- OwningStmtResult Finally;
+ StmtResult Finally;
if (S->getFinallyStmt()) {
Finally = getDerived().TransformStmt(S->getFinallyStmt());
if (Finally.isInvalid())
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) {
// Transform the @catch parameter, if there is one.
VarDecl *Var = 0;
return SemaRef.StmtError();
}
- OwningStmtResult Body = getDerived().TransformStmt(S->getCatchBody());
+ StmtResult Body = getDerived().TransformStmt(S->getCatchBody());
if (Body.isInvalid())
return SemaRef.StmtError();
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
// Transform the body.
- OwningStmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
+ StmtResult Body = getDerived().TransformStmt(S->getFinallyBody());
if (Body.isInvalid())
return SemaRef.StmtError();
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformObjCAtThrowStmt(ObjCAtThrowStmt *S) {
- OwningExprResult Operand;
+ ExprResult Operand;
if (S->getThrowExpr()) {
Operand = getDerived().TransformExpr(S->getThrowExpr());
if (Operand.isInvalid())
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformObjCAtSynchronizedStmt(
ObjCAtSynchronizedStmt *S) {
// Transform the object we are locking.
- OwningExprResult Object = getDerived().TransformExpr(S->getSynchExpr());
+ ExprResult Object = getDerived().TransformExpr(S->getSynchExpr());
if (Object.isInvalid())
return SemaRef.StmtError();
// Transform the body.
- OwningStmtResult Body = getDerived().TransformStmt(S->getSynchBody());
+ StmtResult Body = getDerived().TransformStmt(S->getSynchBody());
if (Body.isInvalid())
return SemaRef.StmtError();
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformObjCForCollectionStmt(
ObjCForCollectionStmt *S) {
// Transform the element statement.
- OwningStmtResult Element = getDerived().TransformStmt(S->getElement());
+ StmtResult Element = getDerived().TransformStmt(S->getElement());
if (Element.isInvalid())
return SemaRef.StmtError();
// Transform the collection expression.
- OwningExprResult Collection = getDerived().TransformExpr(S->getCollection());
+ ExprResult Collection = getDerived().TransformExpr(S->getCollection());
if (Collection.isInvalid())
return SemaRef.StmtError();
// Transform the body.
- OwningStmtResult Body = getDerived().TransformStmt(S->getBody());
+ StmtResult Body = getDerived().TransformStmt(S->getBody());
if (Body.isInvalid())
return SemaRef.StmtError();
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) {
// Transform the exception declaration, if any.
VarDecl *Var = 0;
}
// Transform the actual exception handler.
- OwningStmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
+ StmtResult Handler = getDerived().TransformStmt(S->getHandlerBlock());
if (Handler.isInvalid())
return SemaRef.StmtError();
}
template<typename Derived>
-Sema::OwningStmtResult
+StmtResult
TreeTransform<Derived>::TransformCXXTryStmt(CXXTryStmt *S) {
// Transform the try block itself.
- OwningStmtResult TryBlock
+ StmtResult TryBlock
= getDerived().TransformCompoundStmt(S->getTryBlock());
if (TryBlock.isInvalid())
return SemaRef.StmtError();
bool HandlerChanged = false;
ASTOwningVector<Stmt*> Handlers(SemaRef);
for (unsigned I = 0, N = S->getNumHandlers(); I != N; ++I) {
- OwningStmtResult Handler
+ StmtResult Handler
= getDerived().TransformCXXCatchStmt(S->getHandler(I));
if (Handler.isInvalid())
return SemaRef.StmtError();
// Expression transformation
//===----------------------------------------------------------------------===//
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformPredefinedExpr(PredefinedExpr *E) {
return SemaRef.Owned(E->Retain());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *E) {
NestedNameSpecifier *Qualifier = 0;
if (E->getQualifier()) {
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformIntegerLiteral(IntegerLiteral *E) {
return SemaRef.Owned(E->Retain());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformFloatingLiteral(FloatingLiteral *E) {
return SemaRef.Owned(E->Retain());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformImaginaryLiteral(ImaginaryLiteral *E) {
return SemaRef.Owned(E->Retain());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformStringLiteral(StringLiteral *E) {
return SemaRef.Owned(E->Retain());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCharacterLiteral(CharacterLiteral *E) {
return SemaRef.Owned(E->Retain());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformParenExpr(ParenExpr *E) {
- OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
+ ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
if (SubExpr.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformUnaryOperator(UnaryOperator *E) {
- OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
+ ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
if (SubExpr.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformOffsetOfExpr(OffsetOfExpr *E) {
// Transform the type.
TypeSourceInfo *Type = getDerived().TransformType(E->getTypeSourceInfo());
switch (ON.getKind()) {
case Node::Array: {
Expr *FromIndex = E->getIndexExpr(ON.getArrayExprIndex());
- OwningExprResult Index = getDerived().TransformExpr(FromIndex);
+ ExprResult Index = getDerived().TransformExpr(FromIndex);
if (Index.isInvalid())
return getSema().ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformSizeOfAlignOfExpr(SizeOfAlignOfExpr *E) {
if (E->isArgumentType()) {
TypeSourceInfo *OldT = E->getArgumentTypeInfo();
E->getSourceRange());
}
- Sema::OwningExprResult SubExpr;
+ ExprResult SubExpr;
{
// C++0x [expr.sizeof]p1:
// The operand is either an expression, which is an unevaluated operand
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformArraySubscriptExpr(ArraySubscriptExpr *E) {
- OwningExprResult LHS = getDerived().TransformExpr(E->getLHS());
+ ExprResult LHS = getDerived().TransformExpr(E->getLHS());
if (LHS.isInvalid())
return SemaRef.ExprError();
- OwningExprResult RHS = getDerived().TransformExpr(E->getRHS());
+ ExprResult RHS = getDerived().TransformExpr(E->getRHS());
if (RHS.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCallExpr(CallExpr *E) {
// Transform the callee.
- OwningExprResult Callee = getDerived().TransformExpr(E->getCallee());
+ ExprResult Callee = getDerived().TransformExpr(E->getCallee());
if (Callee.isInvalid())
return SemaRef.ExprError();
ASTOwningVector<Expr*> Args(SemaRef);
llvm::SmallVector<SourceLocation, 4> FakeCommaLocs;
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
- OwningExprResult Arg = getDerived().TransformExpr(E->getArg(I));
+ ExprResult Arg = getDerived().TransformExpr(E->getArg(I));
if (Arg.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformMemberExpr(MemberExpr *E) {
- OwningExprResult Base = getDerived().TransformExpr(E->getBase());
+ ExprResult Base = getDerived().TransformExpr(E->getBase());
if (Base.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformBinaryOperator(BinaryOperator *E) {
- OwningExprResult LHS = getDerived().TransformExpr(E->getLHS());
+ ExprResult LHS = getDerived().TransformExpr(E->getLHS());
if (LHS.isInvalid())
return SemaRef.ExprError();
- OwningExprResult RHS = getDerived().TransformExpr(E->getRHS());
+ ExprResult RHS = getDerived().TransformExpr(E->getRHS());
if (RHS.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCompoundAssignOperator(
CompoundAssignOperator *E) {
return getDerived().TransformBinaryOperator(E);
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformConditionalOperator(ConditionalOperator *E) {
- OwningExprResult Cond = getDerived().TransformExpr(E->getCond());
+ ExprResult Cond = getDerived().TransformExpr(E->getCond());
if (Cond.isInvalid())
return SemaRef.ExprError();
- OwningExprResult LHS = getDerived().TransformExpr(E->getLHS());
+ ExprResult LHS = getDerived().TransformExpr(E->getLHS());
if (LHS.isInvalid())
return SemaRef.ExprError();
- OwningExprResult RHS = getDerived().TransformExpr(E->getRHS());
+ ExprResult RHS = getDerived().TransformExpr(E->getRHS());
if (RHS.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformImplicitCastExpr(ImplicitCastExpr *E) {
// Implicit casts are eliminated during transformation, since they
// will be recomputed by semantic analysis after transformation.
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCStyleCastExpr(CStyleCastExpr *E) {
TypeSourceInfo *OldT;
TypeSourceInfo *NewT;
return SemaRef.ExprError();
}
- OwningExprResult SubExpr
+ ExprResult SubExpr
= getDerived().TransformExpr(E->getSubExprAsWritten());
if (SubExpr.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCompoundLiteralExpr(CompoundLiteralExpr *E) {
TypeSourceInfo *OldT = E->getTypeSourceInfo();
TypeSourceInfo *NewT = getDerived().TransformType(OldT);
if (!NewT)
return SemaRef.ExprError();
- OwningExprResult Init = getDerived().TransformExpr(E->getInitializer());
+ ExprResult Init = getDerived().TransformExpr(E->getInitializer());
if (Init.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformExtVectorElementExpr(ExtVectorElementExpr *E) {
- OwningExprResult Base = getDerived().TransformExpr(E->getBase());
+ ExprResult Base = getDerived().TransformExpr(E->getBase());
if (Base.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformInitListExpr(InitListExpr *E) {
bool InitChanged = false;
ASTOwningVector<Expr*, 4> Inits(SemaRef);
for (unsigned I = 0, N = E->getNumInits(); I != N; ++I) {
- OwningExprResult Init = getDerived().TransformExpr(E->getInit(I));
+ ExprResult Init = getDerived().TransformExpr(E->getInit(I));
if (Init.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformDesignatedInitExpr(DesignatedInitExpr *E) {
Designation Desig;
// transform the initializer value
- OwningExprResult Init = getDerived().TransformExpr(E->getInit());
+ ExprResult Init = getDerived().TransformExpr(E->getInit());
if (Init.isInvalid())
return SemaRef.ExprError();
}
if (D->isArrayDesignator()) {
- OwningExprResult Index = getDerived().TransformExpr(E->getArrayIndex(*D));
+ ExprResult Index = getDerived().TransformExpr(E->getArrayIndex(*D));
if (Index.isInvalid())
return SemaRef.ExprError();
}
assert(D->isArrayRangeDesignator() && "New kind of designator?");
- OwningExprResult Start
+ ExprResult Start
= getDerived().TransformExpr(E->getArrayRangeStart(*D));
if (Start.isInvalid())
return SemaRef.ExprError();
- OwningExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(*D));
+ ExprResult End = getDerived().TransformExpr(E->getArrayRangeEnd(*D));
if (End.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformImplicitValueInitExpr(
ImplicitValueInitExpr *E) {
TemporaryBase Rebase(*this, E->getLocStart(), DeclarationName());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformVAArgExpr(VAArgExpr *E) {
TypeSourceInfo *TInfo = getDerived().TransformType(E->getWrittenTypeInfo());
if (!TInfo)
return SemaRef.ExprError();
- OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
+ ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
if (SubExpr.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformParenListExpr(ParenListExpr *E) {
bool ArgumentChanged = false;
ASTOwningVector<Expr*, 4> Inits(SemaRef);
for (unsigned I = 0, N = E->getNumExprs(); I != N; ++I) {
- OwningExprResult Init = getDerived().TransformExpr(E->getExpr(I));
+ ExprResult Init = getDerived().TransformExpr(E->getExpr(I));
if (Init.isInvalid())
return SemaRef.ExprError();
/// rebuilds the expression, so that the label identifier can be resolved to
/// the corresponding label statement by semantic analysis.
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformAddrLabelExpr(AddrLabelExpr *E) {
return getDerived().RebuildAddrLabelExpr(E->getAmpAmpLoc(), E->getLabelLoc(),
E->getLabel());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformStmtExpr(StmtExpr *E) {
- OwningStmtResult SubStmt
+ StmtResult SubStmt
= getDerived().TransformCompoundStmt(E->getSubStmt(), true);
if (SubStmt.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformTypesCompatibleExpr(TypesCompatibleExpr *E) {
TypeSourceInfo *TInfo1;
TypeSourceInfo *TInfo2;
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *E) {
- OwningExprResult Cond = getDerived().TransformExpr(E->getCond());
+ ExprResult Cond = getDerived().TransformExpr(E->getCond());
if (Cond.isInvalid())
return SemaRef.ExprError();
- OwningExprResult LHS = getDerived().TransformExpr(E->getLHS());
+ ExprResult LHS = getDerived().TransformExpr(E->getLHS());
if (LHS.isInvalid())
return SemaRef.ExprError();
- OwningExprResult RHS = getDerived().TransformExpr(E->getRHS());
+ ExprResult RHS = getDerived().TransformExpr(E->getRHS());
if (RHS.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformGNUNullExpr(GNUNullExpr *E) {
return SemaRef.Owned(E->Retain());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
switch (E->getOperator()) {
case OO_New:
assert(E->getNumArgs() >= 1 && "Object call is missing arguments");
// Transform the object itself.
- OwningExprResult Object = getDerived().TransformExpr(E->getArg(0));
+ ExprResult Object = getDerived().TransformExpr(E->getArg(0));
if (Object.isInvalid())
return SemaRef.ExprError();
if (getDerived().DropCallArgument(E->getArg(I)))
break;
- OwningExprResult Arg = getDerived().TransformExpr(E->getArg(I));
+ ExprResult Arg = getDerived().TransformExpr(E->getArg(I));
if (Arg.isInvalid())
return SemaRef.ExprError();
return SemaRef.ExprError();
}
- OwningExprResult Callee = getDerived().TransformExpr(E->getCallee());
+ ExprResult Callee = getDerived().TransformExpr(E->getCallee());
if (Callee.isInvalid())
return SemaRef.ExprError();
- OwningExprResult First = getDerived().TransformExpr(E->getArg(0));
+ ExprResult First = getDerived().TransformExpr(E->getArg(0));
if (First.isInvalid())
return SemaRef.ExprError();
- OwningExprResult Second;
+ ExprResult Second;
if (E->getNumArgs() == 2) {
Second = getDerived().TransformExpr(E->getArg(1));
if (Second.isInvalid())
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXMemberCallExpr(CXXMemberCallExpr *E) {
return getDerived().TransformCallExpr(E);
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXNamedCastExpr(CXXNamedCastExpr *E) {
TypeSourceInfo *OldT;
TypeSourceInfo *NewT;
return SemaRef.ExprError();
}
- OwningExprResult SubExpr
+ ExprResult SubExpr
= getDerived().TransformExpr(E->getSubExprAsWritten());
if (SubExpr.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXStaticCastExpr(CXXStaticCastExpr *E) {
return getDerived().TransformCXXNamedCastExpr(E);
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXDynamicCastExpr(CXXDynamicCastExpr *E) {
return getDerived().TransformCXXNamedCastExpr(E);
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXReinterpretCastExpr(
CXXReinterpretCastExpr *E) {
return getDerived().TransformCXXNamedCastExpr(E);
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXConstCastExpr(CXXConstCastExpr *E) {
return getDerived().TransformCXXNamedCastExpr(E);
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXFunctionalCastExpr(
CXXFunctionalCastExpr *E) {
TypeSourceInfo *OldT;
return SemaRef.ExprError();
}
- OwningExprResult SubExpr
+ ExprResult SubExpr
= getDerived().TransformExpr(E->getSubExprAsWritten());
if (SubExpr.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXTypeidExpr(CXXTypeidExpr *E) {
if (E->isTypeOperand()) {
TypeSourceInfo *TInfo
EnterExpressionEvaluationContext Unevaluated(SemaRef,
Action::PotentiallyPotentiallyEvaluated);
- OwningExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
+ ExprResult SubExpr = getDerived().TransformExpr(E->getExprOperand());
if (SubExpr.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {
return SemaRef.Owned(E->Retain());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXNullPtrLiteralExpr(
CXXNullPtrLiteralExpr *E) {
return SemaRef.Owned(E->Retain());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXThisExpr(CXXThisExpr *E) {
TemporaryBase Rebase(*this, E->getLocStart(), DeclarationName());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *E) {
- OwningExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
+ ExprResult SubExpr = getDerived().TransformExpr(E->getSubExpr());
if (SubExpr.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
ParmVarDecl *Param
= cast_or_null<ParmVarDecl>(getDerived().TransformDecl(E->getLocStart(),
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {
TemporaryBase Rebase(*this, E->getTypeBeginLoc(), DeclarationName());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
// Transform the type that we're allocating
TemporaryBase Rebase(*this, E->getLocStart(), DeclarationName());
return SemaRef.ExprError();
// Transform the size of the array we're allocating (if any).
- OwningExprResult ArraySize = getDerived().TransformExpr(E->getArraySize());
+ ExprResult ArraySize = getDerived().TransformExpr(E->getArraySize());
if (ArraySize.isInvalid())
return SemaRef.ExprError();
bool ArgumentChanged = false;
ASTOwningVector<Expr*> PlacementArgs(SemaRef);
for (unsigned I = 0, N = E->getNumPlacementArgs(); I != N; ++I) {
- OwningExprResult Arg = getDerived().TransformExpr(E->getPlacementArg(I));
+ ExprResult Arg = getDerived().TransformExpr(E->getPlacementArg(I));
if (Arg.isInvalid())
return SemaRef.ExprError();
if (getDerived().DropCallArgument(E->getConstructorArg(I)))
break;
- OwningExprResult Arg = getDerived().TransformExpr(E->getConstructorArg(I));
+ ExprResult Arg = getDerived().TransformExpr(E->getConstructorArg(I));
if (Arg.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *E) {
- OwningExprResult Operand = getDerived().TransformExpr(E->getArgument());
+ ExprResult Operand = getDerived().TransformExpr(E->getArgument());
if (Operand.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
CXXPseudoDestructorExpr *E) {
- OwningExprResult Base = getDerived().TransformExpr(E->getBase());
+ ExprResult Base = getDerived().TransformExpr(E->getBase());
if (Base.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformUnresolvedLookupExpr(
UnresolvedLookupExpr *Old) {
TemporaryBase Rebase(*this, Old->getNameLoc(), DeclarationName());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformUnaryTypeTraitExpr(UnaryTypeTraitExpr *E) {
TemporaryBase Rebase(*this, /*FIXME*/E->getLocStart(), DeclarationName());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformDependentScopeDeclRefExpr(
DependentScopeDeclRefExpr *E) {
NestedNameSpecifier *NNS
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXConstructExpr(CXXConstructExpr *E) {
// CXXConstructExprs are always implicit, so when we have a
// 1-argument construction we just transform that argument.
break;
}
- OwningExprResult TransArg = getDerived().TransformExpr(*Arg);
+ ExprResult TransArg = getDerived().TransformExpr(*Arg);
if (TransArg.isInvalid())
return SemaRef.ExprError();
/// Since CXXBindTemporaryExpr nodes are implicitly generated, we just
/// transform the subexpression and return that.
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
return getDerived().TransformExpr(E->getSubExpr());
}
/// Since CXXBindReferenceExpr nodes are implicitly generated, we just
/// transform the subexpression and return that.
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXBindReferenceExpr(CXXBindReferenceExpr *E) {
return getDerived().TransformExpr(E->getSubExpr());
}
/// Since CXXExprWithTemporaries nodes are implicitly generated, we
/// just transform the subexpression and return that.
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXExprWithTemporaries(
CXXExprWithTemporaries *E) {
return getDerived().TransformExpr(E->getSubExpr());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
CXXTemporaryObjectExpr *E) {
TemporaryBase Rebase(*this, E->getTypeBeginLoc(), DeclarationName());
break;
}
- OwningExprResult TransArg = getDerived().TransformExpr(*Arg);
+ ExprResult TransArg = getDerived().TransformExpr(*Arg);
if (TransArg.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXUnresolvedConstructExpr(
CXXUnresolvedConstructExpr *E) {
TemporaryBase Rebase(*this, E->getTypeBeginLoc(), DeclarationName());
for (CXXUnresolvedConstructExpr::arg_iterator Arg = E->arg_begin(),
ArgEnd = E->arg_end();
Arg != ArgEnd; ++Arg) {
- OwningExprResult TransArg = getDerived().TransformExpr(*Arg);
+ ExprResult TransArg = getDerived().TransformExpr(*Arg);
if (TransArg.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
CXXDependentScopeMemberExpr *E) {
// Transform the base of the expression.
- OwningExprResult Base((Expr*) 0);
+ ExprResult Base((Expr*) 0);
Expr *OldBase;
QualType BaseType;
QualType ObjectType;
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old) {
// Transform the base of the expression.
- OwningExprResult Base((Expr*) 0);
+ ExprResult Base((Expr*) 0);
QualType BaseType;
if (!Old->isImplicitAccess()) {
Base = getDerived().TransformExpr(Old->getBase());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformObjCStringLiteral(ObjCStringLiteral *E) {
return SemaRef.Owned(E->Retain());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformObjCEncodeExpr(ObjCEncodeExpr *E) {
TypeSourceInfo *EncodedTypeInfo
= getDerived().TransformType(E->getEncodedTypeSourceInfo());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *E) {
// Transform arguments.
bool ArgChanged = false;
ASTOwningVector<Expr*> Args(SemaRef);
for (unsigned I = 0, N = E->getNumArgs(); I != N; ++I) {
- OwningExprResult Arg = getDerived().TransformExpr(E->getArg(I));
+ ExprResult Arg = getDerived().TransformExpr(E->getArg(I));
if (Arg.isInvalid())
return SemaRef.ExprError();
// Instance message: transform the receiver
assert(E->getReceiverKind() == ObjCMessageExpr::Instance &&
"Only class and instance messages may be instantiated");
- OwningExprResult Receiver
+ ExprResult Receiver
= getDerived().TransformExpr(E->getInstanceReceiver());
if (Receiver.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformObjCSelectorExpr(ObjCSelectorExpr *E) {
return SemaRef.Owned(E->Retain());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformObjCProtocolExpr(ObjCProtocolExpr *E) {
return SemaRef.Owned(E->Retain());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformObjCIvarRefExpr(ObjCIvarRefExpr *E) {
// Transform the base expression.
- OwningExprResult Base = getDerived().TransformExpr(E->getBase());
+ ExprResult Base = getDerived().TransformExpr(E->getBase());
if (Base.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
// Transform the base expression.
- OwningExprResult Base = getDerived().TransformExpr(E->getBase());
+ ExprResult Base = getDerived().TransformExpr(E->getBase());
if (Base.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformObjCImplicitSetterGetterRefExpr(
ObjCImplicitSetterGetterRefExpr *E) {
// If this implicit setter/getter refers to class methods, it cannot have any
return SemaRef.Owned(E->Retain());
// Transform the base expression.
- OwningExprResult Base = getDerived().TransformExpr(E->getBase());
+ ExprResult Base = getDerived().TransformExpr(E->getBase());
if (Base.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformObjCSuperExpr(ObjCSuperExpr *E) {
// Can never occur in a dependent context.
return SemaRef.Owned(E->Retain());
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformObjCIsaExpr(ObjCIsaExpr *E) {
// Transform the base expression.
- OwningExprResult Base = getDerived().TransformExpr(E->getBase());
+ ExprResult Base = getDerived().TransformExpr(E->getBase());
if (Base.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformShuffleVectorExpr(ShuffleVectorExpr *E) {
bool ArgumentChanged = false;
ASTOwningVector<Expr*> SubExprs(SemaRef);
for (unsigned I = 0, N = E->getNumSubExprs(); I != N; ++I) {
- OwningExprResult SubExpr = getDerived().TransformExpr(E->getExpr(I));
+ ExprResult SubExpr = getDerived().TransformExpr(E->getExpr(I));
if (SubExpr.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) {
SourceLocation CaretLoc(E->getExprLoc());
}
// Transform the body
- OwningStmtResult Body = getDerived().TransformStmt(E->getBody());
+ StmtResult Body = getDerived().TransformStmt(E->getBody());
if (Body.isInvalid())
return SemaRef.ExprError();
// Set the parameters on the block decl.
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::TransformBlockDeclRefExpr(BlockDeclRefExpr *E) {
NestedNameSpecifier *Qualifier = 0;
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
SourceLocation OpLoc,
Expr *OrigCallee,
// Neither of the arguments is an overloadable type, so try to
// create a built-in binary operation.
BinaryOperator::Opcode Opc = BinaryOperator::getOverloadedOpcode(Op);
- OwningExprResult Result
+ ExprResult Result
= SemaRef.CreateBuiltinBinOp(OpLoc, Opc, First, Second);
if (Result.isInvalid())
return SemaRef.ExprError();
// Create the overloaded operator invocation for binary operators.
BinaryOperator::Opcode Opc =
BinaryOperator::getOverloadedOpcode(Op);
- OwningExprResult Result
+ ExprResult Result
= SemaRef.CreateOverloadedBinOp(OpLoc, Opc, Functions, Args[0], Args[1]);
if (Result.isInvalid())
return SemaRef.ExprError();
}
template<typename Derived>
-Sema::OwningExprResult
+ExprResult
TreeTransform<Derived>::RebuildCXXPseudoDestructorExpr(Expr *Base,
SourceLocation OperatorLoc,
bool isArrow,