aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2009-03-15 17:47:39 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2009-03-15 17:47:39 +0000
commitf53597fb16142bdb4a66901f8c0b768db4f2a548 (patch)
treeb1d6b9bccdbcf7c2eccac31709a90eee515a1342
parent3e287c2a53e88d583fa2e0cafc33dbb49772db05 (diff)
Convert a bunch of actions to smart pointers, and also bring PrintParserCallbacks a bit more in line with reality.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67029 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Driver/PrintParserCallbacks.cpp241
-rw-r--r--include/clang/Parse/Action.h173
-rw-r--r--lib/Parse/MinimalAction.cpp2
-rw-r--r--lib/Parse/ParseCXXInlineMethods.cpp2
-rw-r--r--lib/Parse/ParseDecl.cpp4
-rw-r--r--lib/Parse/ParseExpr.cpp14
-rw-r--r--lib/Parse/ParseExprCXX.cpp37
-rw-r--r--lib/Sema/Sema.h142
-rw-r--r--lib/Sema/SemaDeclCXX.cpp23
-rw-r--r--lib/Sema/SemaExpr.cpp130
-rw-r--r--lib/Sema/SemaExprCXX.cpp198
-rw-r--r--lib/Sema/SemaNamedCast.cpp25
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp22
13 files changed, 614 insertions, 399 deletions
diff --git a/Driver/PrintParserCallbacks.cpp b/Driver/PrintParserCallbacks.cpp
index 760037806a..f9399e2e1e 100644
--- a/Driver/PrintParserCallbacks.cpp
+++ b/Driver/PrintParserCallbacks.cpp
@@ -584,58 +584,235 @@ namespace {
//===--------------------- GNU Extension Expressions ------------------===//
- virtual ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc,
- IdentifierInfo *LabelII) { // "&&foo"
+ virtual OwningExprResult ActOnAddrLabel(SourceLocation OpLoc,
+ SourceLocation LabLoc,
+ IdentifierInfo *LabelII) {// "&&foo"
llvm::cout << __FUNCTION__ << "\n";
- return 0;
+ return ExprEmpty();
}
-
- virtual ExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtTy *SubStmt,
- SourceLocation RPLoc) { // "({..})"
+
+ virtual OwningExprResult ActOnStmtExpr(SourceLocation LPLoc,
+ StmtArg SubStmt,
+ SourceLocation RPLoc) { // "({..})"
llvm::cout << __FUNCTION__ << "\n";
- return 0;
+ return ExprEmpty();
}
-
- virtual ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc,
- SourceLocation TypeLoc, TypeTy *Arg1,
- OffsetOfComponent *CompPtr,
- unsigned NumComponents,
- SourceLocation RParenLoc) {
+
+ virtual OwningExprResult ActOnBuiltinOffsetOf(Scope *S,
+ SourceLocation BuiltinLoc,
+ SourceLocation TypeLoc,
+ TypeTy *Arg1,
+ OffsetOfComponent *CompPtr,
+ unsigned NumComponents,
+ SourceLocation RParenLoc) {
llvm::cout << __FUNCTION__ << "\n";
- return 0;
+ return ExprEmpty();
}
-
+
// __builtin_types_compatible_p(type1, type2)
- virtual ExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
- TypeTy *arg1, TypeTy *arg2,
- SourceLocation RPLoc) {
+ virtual OwningExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
+ TypeTy *arg1,TypeTy *arg2,
+ SourceLocation RPLoc) {
llvm::cout << __FUNCTION__ << "\n";
- return 0;
+ return ExprEmpty();
}
// __builtin_choose_expr(constExpr, expr1, expr2)
- virtual ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
- ExprTy *cond, ExprTy *expr1, ExprTy *expr2,
- SourceLocation RPLoc) {
+ virtual OwningExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
+ ExprArg cond, ExprArg expr1,
+ ExprArg expr2,
+ SourceLocation RPLoc) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return ExprEmpty();
+ }
+
+ // __builtin_va_arg(expr, type)
+ virtual OwningExprResult ActOnVAArg(SourceLocation BuiltinLoc,
+ ExprArg expr, TypeTy *type,
+ SourceLocation RPLoc) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return ExprEmpty();
+ }
+
+ virtual OwningExprResult ActOnGNUNullExpr(SourceLocation TokenLoc) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return ExprEmpty();
+ }
+
+ virtual void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope) {
+ llvm::cout << __FUNCTION__ << "\n";
+ }
+
+ virtual void ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope) {
+ llvm::cout << __FUNCTION__ << "\n";
+ }
+
+ virtual void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope) {
+ llvm::cout << __FUNCTION__ << "\n";
+ }
+
+ virtual OwningExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc,
+ StmtArg Body,
+ Scope *CurScope) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return ExprEmpty();
+ }
+
+ virtual DeclTy *ActOnStartNamespaceDef(Scope *S, SourceLocation IdentLoc,
+ IdentifierInfo *Ident,
+ SourceLocation LBrace) {
llvm::cout << __FUNCTION__ << "\n";
return 0;
}
- // __builtin_overload(...)
- virtual ExprResult ActOnOverloadExpr(ExprTy **Args, unsigned NumArgs,
- SourceLocation *CommaLocs,
- SourceLocation BuiltinLoc,
- SourceLocation RPLoc) {
+
+ virtual void ActOnFinishNamespaceDef(DeclTy *Dcl,SourceLocation RBrace) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return;
+ }
+
+#if 0
+ // FIXME: AttrList should be deleted by this function, but the definition
+ // would have to be available.
+ virtual DeclTy *ActOnUsingDirective(Scope *CurScope,
+ SourceLocation UsingLoc,
+ SourceLocation NamespcLoc,
+ const CXXScopeSpec &SS,
+ SourceLocation IdentLoc,
+ IdentifierInfo *NamespcName,
+ AttributeList *AttrList) {
llvm::cout << __FUNCTION__ << "\n";
return 0;
}
-
+#endif
- // __builtin_va_arg(expr, type)
- virtual ExprResult ActOnVAArg(SourceLocation BuiltinLoc,
- ExprTy *expr, TypeTy *type,
- SourceLocation RPLoc) {
+ virtual void ActOnParamDefaultArgument(DeclTy *param,
+ SourceLocation EqualLoc,
+ ExprArg defarg) {
+ llvm::cout << __FUNCTION__ << "\n";
+ }
+
+ virtual void ActOnParamUnparsedDefaultArgument(DeclTy *param,
+ SourceLocation EqualLoc) {
+ llvm::cout << __FUNCTION__ << "\n";
+ }
+
+ virtual void ActOnParamDefaultArgumentError(DeclTy *param) {
+ llvm::cout << __FUNCTION__ << "\n";
+ }
+
+ virtual void AddCXXDirectInitializerToDecl(DeclTy *Dcl,
+ SourceLocation LParenLoc,
+ MultiExprArg Exprs,
+ SourceLocation *CommaLocs,
+ SourceLocation RParenLoc) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return;
+ }
+
+ virtual void ActOnStartDelayedCXXMethodDeclaration(Scope *S, DeclTy *Method)
+ {
+ llvm::cout << __FUNCTION__ << "\n";
+ }
+
+ virtual void ActOnDelayedCXXMethodParameter(Scope *S, DeclTy *Param) {
+ llvm::cout << __FUNCTION__ << "\n";
+ }
+
+ virtual void ActOnFinishDelayedCXXMethodDeclaration(Scope *S,
+ DeclTy *Method) {
+ llvm::cout << __FUNCTION__ << "\n";
+ }
+
+ virtual DeclTy *ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
+ ExprArg AssertExpr,
+ ExprArg AssertMessageExpr,
+ SourceLocation RParenLoc) {
llvm::cout << __FUNCTION__ << "\n";
return 0;
}
+
+ virtual OwningExprResult ActOnCXXNamedCast(SourceLocation OpLoc,
+ tok::TokenKind Kind,
+ SourceLocation LAngleBracketLoc,
+ TypeTy *Ty,
+ SourceLocation RAngleBracketLoc,
+ SourceLocation LParenLoc,
+ ExprArg Op,
+ SourceLocation RParenLoc) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return ExprEmpty();
+ }
+
+ virtual OwningExprResult ActOnCXXTypeid(SourceLocation OpLoc,
+ SourceLocation LParenLoc,
+ bool isType, void *TyOrExpr,
+ SourceLocation RParenLoc) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return ExprEmpty();
+ }
+
+ virtual OwningExprResult ActOnCXXThis(SourceLocation ThisLoc) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return ExprEmpty();
+ }
+
+ virtual OwningExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc,
+ tok::TokenKind Kind) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return ExprEmpty();
+ }
+
+ virtual OwningExprResult ActOnCXXThrow(SourceLocation OpLoc, ExprArg Op) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return ExprEmpty();
+ }
+
+ virtual OwningExprResult ActOnCXXTypeConstructExpr(SourceRange TypeRange,
+ TypeTy *TypeRep,
+ SourceLocation LParenLoc,
+ MultiExprArg Exprs,
+ SourceLocation *CommaLocs,
+ SourceLocation RParenLoc) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return ExprEmpty();
+ }
+
+ virtual OwningExprResult ActOnCXXConditionDeclarationExpr(Scope *S,
+ SourceLocation StartLoc,
+ Declarator &D,
+ SourceLocation EqualLoc,
+ ExprArg AssignExprVal) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return ExprEmpty();
+ }
+
+ virtual OwningExprResult ActOnCXXNew(SourceLocation StartLoc,
+ bool UseGlobal,
+ SourceLocation PlacementLParen,
+ MultiExprArg PlacementArgs,
+ SourceLocation PlacementRParen,
+ bool ParenTypeId, Declarator &D,
+ SourceLocation ConstructorLParen,
+ MultiExprArg ConstructorArgs,
+ SourceLocation ConstructorRParen) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return ExprEmpty();
+ }
+
+ virtual OwningExprResult ActOnCXXDelete(SourceLocation StartLoc,
+ bool UseGlobal, bool ArrayForm,
+ ExprArg Operand) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return ExprEmpty();
+ }
+
+ virtual OwningExprResult ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
+ SourceLocation KWLoc,
+ SourceLocation LParen,
+ TypeTy *Ty,
+ SourceLocation RParen) {
+ llvm::cout << __FUNCTION__ << "\n";
+ return ExprEmpty();
+ }
};
}
diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h
index 3df0d1dd7d..f33918eae8 100644
--- a/include/clang/Parse/Action.h
+++ b/include/clang/Parse/Action.h
@@ -730,16 +730,17 @@ public:
//===---------------------- GNU Extension Expressions -------------------===//
- virtual ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc,
- IdentifierInfo *LabelII) { // "&&foo"
- return 0;
+ virtual OwningExprResult ActOnAddrLabel(SourceLocation OpLoc,
+ SourceLocation LabLoc,
+ IdentifierInfo *LabelII) { // "&&foo"
+ return ExprEmpty();
}
-
- virtual ExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtTy *SubStmt,
- SourceLocation RPLoc) { // "({..})"
- return 0;
+
+ virtual OwningExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtArg SubStmt,
+ SourceLocation RPLoc) { // "({..})"
+ return ExprEmpty();
}
-
+
// __builtin_offsetof(type, identifier(.identifier|[expr])*)
struct OffsetOfComponent {
SourceLocation LocStart, LocEnd;
@@ -749,39 +750,41 @@ public:
ExprTy *E;
} U;
};
-
- virtual ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc,
- SourceLocation TypeLoc, TypeTy *Arg1,
- OffsetOfComponent *CompPtr,
- unsigned NumComponents,
- SourceLocation RParenLoc) {
- return 0;
+
+ virtual OwningExprResult ActOnBuiltinOffsetOf(Scope *S,
+ SourceLocation BuiltinLoc,
+ SourceLocation TypeLoc,
+ TypeTy *Arg1,
+ OffsetOfComponent *CompPtr,
+ unsigned NumComponents,
+ SourceLocation RParenLoc) {
+ return ExprEmpty();
}
-
+
// __builtin_types_compatible_p(type1, type2)
- virtual ExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
- TypeTy *arg1, TypeTy *arg2,
- SourceLocation RPLoc) {
- return 0;
+ virtual OwningExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
+ TypeTy *arg1, TypeTy *arg2,
+ SourceLocation RPLoc) {
+ return ExprEmpty();
}
// __builtin_choose_expr(constExpr, expr1, expr2)
- virtual ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
- ExprTy *cond, ExprTy *expr1, ExprTy *expr2,
- SourceLocation RPLoc) {
- return 0;
+ virtual OwningExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
+ ExprArg cond, ExprArg expr1,
+ ExprArg expr2, SourceLocation RPLoc){
+ return ExprEmpty();
}
// __builtin_va_arg(expr, type)
- virtual ExprResult ActOnVAArg(SourceLocation BuiltinLoc,
- ExprTy *expr, TypeTy *type,
- SourceLocation RPLoc) {
- return 0;
+ virtual OwningExprResult ActOnVAArg(SourceLocation BuiltinLoc,
+ ExprArg expr, TypeTy *type,
+ SourceLocation RPLoc) {
+ return ExprEmpty();
}
/// ActOnGNUNullExpr - Parsed the GNU __null expression, the token
/// for which is at position TokenLoc.
- virtual ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc) {
- return 0;
+ virtual OwningExprResult ActOnGNUNullExpr(SourceLocation TokenLoc) {
+ return ExprEmpty();
}
//===------------------------- "Block" Extension ------------------------===//
@@ -793,15 +796,18 @@ public:
/// ActOnBlockArguments - This callback allows processing of block arguments.
/// If there are no arguments, this is still invoked.
virtual void ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope) {}
-
+
/// ActOnBlockError - If there is an error parsing a block, this callback
/// is invoked to pop the information about the block from the action impl.
virtual void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope) {}
-
+
/// ActOnBlockStmtExpr - This is called when the body of a block statement
/// literal was successfully completed. ^(int x){...}
- virtual ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, StmtTy *Body,
- Scope *CurScope) { return 0; }
+ virtual OwningExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc,
+ StmtArg Body,
+ Scope *CurScope) {
+ return ExprEmpty();
+ }
//===------------------------- C++ Declarations -------------------------===//
@@ -831,7 +837,7 @@ public:
/// ActOnParamDefaultArgument - Parse default argument for function parameter
virtual void ActOnParamDefaultArgument(DeclTy *param,
SourceLocation EqualLoc,
- ExprTy *defarg) {
+ ExprArg defarg) {
}
/// ActOnParamUnparsedDefaultArgument - We've seen a default
@@ -850,12 +856,12 @@ public:
/// e.g: "int x(1);"
virtual void AddCXXDirectInitializerToDecl(DeclTy *Dcl,
SourceLocation LParenLoc,
- ExprTy **Exprs, unsigned NumExprs,
+ MultiExprArg Exprs,
SourceLocation *CommaLocs,
SourceLocation RParenLoc) {
return;
}
-
+
/// ActOnStartDelayedCXXMethodDeclaration - We have completed
/// parsing a top-level (non-nested) C++ class, and we are now
/// parsing those parts of the given Method declaration that could
@@ -881,76 +887,78 @@ public:
/// ActOnStartOfFunctionDef action later (not necessarily
/// immediately!) for this method, if it was also defined inside the
/// class body.
- virtual void ActOnFinishDelayedCXXMethodDeclaration(Scope *S, DeclTy *Method) {
+ virtual void ActOnFinishDelayedCXXMethodDeclaration(Scope *S, DeclTy *Method){
}
/// ActOnStaticAssertDeclaration - Parse a C++0x static_assert declaration.
- virtual DeclTy *ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
+ virtual DeclTy *ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
ExprArg AssertExpr,
ExprArg AssertMessageExpr,
SourceLocation RParenLoc) {
return 0;
}
-
-
+
+
//===------------------------- C++ Expressions --------------------------===//
-
+
/// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's.
- virtual ExprResult ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
- SourceLocation LAngleBracketLoc, TypeTy *Ty,
- SourceLocation RAngleBracketLoc,
- SourceLocation LParenLoc, ExprTy *Op,
- SourceLocation RParenLoc) {
- return 0;
+ virtual OwningExprResult ActOnCXXNamedCast(SourceLocation OpLoc,
+ tok::TokenKind Kind,
+ SourceLocation LAngleBracketLoc,
+ TypeTy *Ty,
+ SourceLocation RAngleBracketLoc,
+ SourceLocation LParenLoc,
+ ExprArg Op,
+ SourceLocation RParenLoc) {
+ return ExprEmpty();
}
/// ActOnCXXTypeidOfType - Parse typeid( type-id ).
- virtual ExprResult ActOnCXXTypeid(SourceLocation OpLoc,
- SourceLocation LParenLoc, bool isType,
- void *TyOrExpr, SourceLocation RParenLoc) {
- return 0;
+ virtual OwningExprResult ActOnCXXTypeid(SourceLocation OpLoc,
+ SourceLocation LParenLoc, bool isType,
+ void *TyOrExpr,
+ SourceLocation RParenLoc) {
+ return ExprEmpty();
}
/// ActOnCXXThis - Parse the C++ 'this' pointer.
- virtual ExprResult ActOnCXXThis(SourceLocation ThisLoc) {
- return 0;
+ virtual OwningExprResult ActOnCXXThis(SourceLocation ThisLoc) {
+ return ExprEmpty();
}
/// ActOnCXXBoolLiteral - Parse {true,false} literals.
- virtual ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc,
+ virtual OwningExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc,
tok::TokenKind Kind) {
- return 0;
+ return ExprEmpty();
}
/// ActOnCXXThrow - Parse throw expressions.
- virtual ExprResult ActOnCXXThrow(SourceLocation OpLoc,
- ExprTy *Op = 0) {
- return 0;
+ virtual OwningExprResult ActOnCXXThrow(SourceLocation OpLoc, ExprArg Op) {
+ return ExprEmpty();
}
/// ActOnCXXTypeConstructExpr - Parse construction of a specified type.
/// 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 ExprResult ActOnCXXTypeConstructExpr(SourceRange TypeRange,
- TypeTy *TypeRep,
- SourceLocation LParenLoc,
- ExprTy **Exprs,
- unsigned NumExprs,
- SourceLocation *CommaLocs,
- SourceLocation RParenLoc) {
- return 0;
+ virtual OwningExprResult ActOnCXXTypeConstructExpr(SourceRange TypeRange,
+ TypeTy *TypeRep,
+ SourceLocation LParenLoc,
+ MultiExprArg Exprs,
+ SourceLocation *CommaLocs,
+ SourceLocation RParenLoc) {
+ return ExprEmpty();
}
/// ActOnCXXConditionDeclarationExpr - Parsed a condition declaration of a
/// C++ if/switch/while/for statement.
/// e.g: "if (int x = f()) {...}"
- virtual ExprResult ActOnCXXConditionDeclarationExpr(Scope *S,
+ virtual OwningExprResult ActOnCXXConditionDeclarationExpr(Scope *S,
SourceLocation StartLoc,
Declarator &D,
SourceLocation EqualLoc,
- ExprTy *AssignExprVal) {
- return 0;
+ ExprArg AssignExprVal) {
+ return ExprEmpty();
}
/// ActOnCXXNew - Parsed a C++ 'new' expression. UseGlobal is true if the
@@ -958,23 +966,24 @@ public:
/// @code new (p1, p2) type(c1, c2) @endcode
/// the p1 and p2 expressions will be in PlacementArgs and the c1 and c2
/// expressions in ConstructorArgs. The type is passed as a declarator.
- virtual ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
- SourceLocation PlacementLParen,
- ExprTy **PlacementArgs, unsigned NumPlaceArgs,
- SourceLocation PlacementRParen,
- bool ParenTypeId, Declarator &D,
- SourceLocation ConstructorLParen,
- ExprTy **ConstructorArgs, unsigned NumConsArgs,
- SourceLocation ConstructorRParen) {
- return 0;
+ virtual OwningExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
+ SourceLocation PlacementLParen,
+ MultiExprArg PlacementArgs,
+ SourceLocation PlacementRParen,
+ bool ParenTypeId, Declarator &D,
+ SourceLocation ConstructorLParen,
+ MultiExprArg ConstructorArgs,
+ SourceLocation ConstructorRParen) {
+ return ExprEmpty();
}
/// 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 ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
- bool ArrayForm, ExprTy *Operand) {
- return 0;
+ virtual OwningExprResult ActOnCXXDelete(SourceLocation StartLoc,
+ bool UseGlobal, bool ArrayForm,
+ ExprArg Operand) {
+ return ExprEmpty();
}
virtual OwningExprResult ActOnUnaryTypeTrait(UnaryTypeTrait OTT,
diff --git a/lib/Parse/MinimalAction.cpp b/lib/Parse/MinimalAction.cpp
index 41ad36c83e..fbda832836 100644
--- a/lib/Parse/MinimalAction.cpp
+++ b/lib/Parse/MinimalAction.cpp
@@ -19,7 +19,7 @@
#include "llvm/Support/raw_ostream.h"
using namespace clang;
-/// Out-of-line virtual destructor to provide home for Action class.
+/// Out-of-line virtual destructor to provide home for ActionBase class.
ActionBase::~ActionBase() {}
/// Out-of-line virtual destructor to provide home for Action class.
diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp
index cc61f0f6fd..3ed9802026 100644
--- a/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/lib/Parse/ParseCXXInlineMethods.cpp
@@ -98,7 +98,7 @@ void Parser::ParseLexedMethodDeclarations() {
Actions.ActOnParamDefaultArgumentError(LM.DefaultArgs[I].Param);
else
Actions.ActOnParamDefaultArgument(LM.DefaultArgs[I].Param, EqualLoc,
- DefArgResult.release());
+ move(DefArgResult));
delete Toks;
LM.DefaultArgs[I].Toks = 0;
}
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 56a1decb59..aa96db540a 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -346,7 +346,7 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
assert(!Exprs.empty() && Exprs.size()-1 == CommaLocs.size() &&
"Unexpected number of commas!");
Actions.AddCXXDirectInitializerToDecl(LastDeclInGroup, LParenLoc,
- Exprs.take(), Exprs.size(),
+ move_arg(Exprs),
&CommaLocs[0], RParenLoc);
}
} else {
@@ -2184,7 +2184,7 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D,
} else {
// Inform the actions module about the default argument
Actions.ActOnParamDefaultArgument(Param, EqualLoc,
- DefArgResult.release());
+ move(DefArgResult));
}
}
}
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 000cb9d606..f2892c1367 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -625,7 +625,7 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
case tok::kw___builtin_types_compatible_p:
return ParseBuiltinPrimaryExpression();
case tok::kw___null:
- return Owned(Actions.ActOnGNUNullExpr(ConsumeToken()));
+ return Actions.ActOnGNUNullExpr(ConsumeToken());
break;
case tok::plusplus: // unary-expression: '++' unary-expression
case tok::minusminus: { // unary-expression: '--' unary-expression
@@ -995,8 +995,7 @@ Parser::OwningExprResult Parser::ParseBuiltinPrimaryExpression() {
if (Ty.isInvalid())
Res = ExprError();
else
- Res = Actions.ActOnVAArg(StartLoc, Expr.release(), Ty.get(),
- ConsumeParen());
+ Res = Actions.ActOnVAArg(StartLoc, move(Expr), Ty.get(), ConsumeParen());
break;
}
case tok::kw___builtin_offsetof: {
@@ -1092,8 +1091,8 @@ Parser::OwningExprResult Parser::ParseBuiltinPrimaryExpression() {
Diag(Tok, diag::err_expected_rparen);
return ExprError();
}
- Res = Actions.ActOnChooseExpr(StartLoc, Cond.release(), Expr1.release(),
- Expr2.release(), ConsumeParen());
+ Res = Actions.ActOnChooseExpr(StartLoc, move(Cond), move(Expr1),
+ move(Expr2), ConsumeParen());
break;
}
case tok::kw___builtin_types_compatible_p:
@@ -1151,8 +1150,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType,
// If the substmt parsed correctly, build the AST node.
if (!Stmt.isInvalid() && Tok.is(tok::r_paren))
- Result = Actions.ActOnStmtExpr(
- OpenLoc, Stmt.release(), Tok.getLocation());
+ Result = Actions.ActOnStmtExpr(OpenLoc, move(Stmt), Tok.getLocation());
} else if (ExprType >= CompoundLiteral && isTypeIdInParens()) {
// Otherwise, this is a compound literal expression or cast expression.
@@ -1344,7 +1342,7 @@ Parser::OwningExprResult Parser::ParseBlockLiteralExpression() {
if (Tok.is(tok::l_brace)) {
OwningStmtResult Stmt(ParseCompoundStatementBody());
if (!Stmt.isInvalid()) {
- Result = Actions.ActOnBlockStmtExpr(CaretLoc, Stmt.release(), CurScope);
+ Result = Actions.ActOnBlockStmtExpr(CaretLoc, move(Stmt), CurScope);
} else {
Actions.ActOnBlockError(CaretLoc, CurScope);
}
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index 50e6657ad8..e1b5db9c44 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -328,9 +328,9 @@ Parser::OwningExprResult Parser::ParseCXXCasts() {
if (!Result.isInvalid() && !CastTy.isInvalid())
Result = Actions.ActOnCXXNamedCast(OpLoc, Kind,
- LAngleBracketLoc, CastTy.get(),
+ LAngleBracketLoc, CastTy.get(),
RAngleBracketLoc,
- LParenLoc, Result.release(), RParenLoc);
+ LParenLoc, move(Result), RParenLoc);
return move(Result);
}
@@ -390,7 +390,7 @@ Parser::OwningExprResult Parser::ParseCXXTypeid() {
/// 'false'
Parser::OwningExprResult Parser::ParseCXXBoolLiteral() {
tok::TokenKind Kind = Tok.getKind();
- return Owned(Actions.ActOnCXXBoolLiteral(ConsumeToken(), Kind));
+ return Actions.ActOnCXXBoolLiteral(ConsumeToken(), Kind);
}
/// ParseThrowExpression - This handles the C++ throw expression.
@@ -411,12 +411,12 @@ Parser::OwningExprResult Parser::ParseThrowExpression() {
case tok::r_brace:
case tok::colon:
case tok::comma:
- return Owned(Actions.ActOnCXXThrow(ThrowLoc));
+ return Actions.ActOnCXXThrow(ThrowLoc, ExprArg(Actions));
default:
OwningExprResult Expr(ParseAssignmentExpression());
if (Expr.isInvalid()) return move(Expr);
- return Owned(Actions.ActOnCXXThrow(ThrowLoc, Expr.release()));
+ return Actions.ActOnCXXThrow(ThrowLoc, move(Expr));
}
}
@@ -428,7 +428,7 @@ Parser::OwningExprResult Parser::ParseThrowExpression() {
Parser::OwningExprResult Parser::ParseCXXThis() {
assert(Tok.is(tok::kw_this) && "Not 'this'!");
SourceLocation ThisLoc = ConsumeToken();
- return Owned(Actions.ActOnCXXThis(ThisLoc));
+ return Actions.ActOnCXXThis(ThisLoc);
}
/// ParseCXXTypeConstructExpression - Parse construction of a specified type.
@@ -463,10 +463,9 @@ Parser::ParseCXXTypeConstructExpression(const DeclSpec &DS) {
assert((Exprs.size() == 0 || Exprs.size()-1 == CommaLocs.size())&&
"Unexpected number of commas!");
- return Owned(Actions.ActOnCXXTypeConstructExpr(DS.getSourceRange(), TypeRep,
- LParenLoc,
- Exprs.take(), Exprs.size(),
- &CommaLocs[0], RParenLoc));
+ return Actions.ActOnCXXTypeConstructExpr(DS.getSourceRange(), TypeRep,
+ LParenLoc, move_arg(Exprs),
+ &CommaLocs[0], RParenLoc);
}
/// ParseCXXCondition - if/switch/while/for condition expression.
@@ -518,9 +517,9 @@ Parser::OwningExprResult Parser::ParseCXXCondition() {
if (AssignExpr.isInvalid())
return ExprError();
- return Owned(Actions.ActOnCXXConditionDeclarationExpr(CurScope, StartLoc,
- DeclaratorInfo,EqualLoc,
- AssignExpr.release()));
+ return Actions.ActOnCXXConditionDeclarationExpr(CurScope, StartLoc,
+ DeclaratorInfo,EqualLoc,
+ move(AssignExpr));
}
/// ParseCXXSimpleTypeSpecifier - [C++ 7.1.5.2] Simple type specifiers.
@@ -883,11 +882,10 @@ Parser::ParseCXXNewExpression(bool UseGlobal, SourceLocation Start) {
}
}
- return Owned(Actions.ActOnCXXNew(Start, UseGlobal, PlacementLParen,
- PlacementArgs.take(), PlacementArgs.size(),
- PlacementRParen, ParenTypeId, DeclaratorInfo,
- ConstructorLParen, ConstructorArgs.take(),
- ConstructorArgs.size(), ConstructorRParen));
+ return Actions.ActOnCXXNew(Start, UseGlobal, PlacementLParen,
+ move_arg(PlacementArgs), PlacementRParen,
+ ParenTypeId, DeclaratorInfo, ConstructorLParen,
+ move_arg(ConstructorArgs), ConstructorRParen);
}
/// ParseDirectNewDeclarator - Parses a direct-new-declarator. Intended to be
@@ -977,8 +975,7 @@ Parser::ParseCXXDeleteExpression(bool UseGlobal, SourceLocation Start) {
if (Operand.isInvalid())
return move(Operand);