From 62b95d88dc14f832101568d9b5ca62338c01f59a Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 23 Aug 2012 21:35:17 +0000 Subject: [PATCH] Rip out remnants of move semantic emulation and smart pointers in Sema. These were nops for quite a while and only lead to confusion. ASTMultiPtr now behaves like a proper dumb array reference. llvm-svn: 162475 --- clang/include/clang/Sema/Ownership.h | 168 ++---------------- clang/include/clang/Sema/ParsedTemplate.h | 5 - clang/include/clang/Sema/Sema.h | 2 +- clang/lib/Parse/ParseCXXInlineMethods.cpp | 4 +- clang/lib/Parse/ParseDecl.cpp | 2 +- clang/lib/Parse/ParseDeclCXX.cpp | 4 +- clang/lib/Parse/ParseExpr.cpp | 60 +++---- clang/lib/Parse/ParseExprCXX.cpp | 20 +-- clang/lib/Parse/ParseInit.cpp | 6 +- clang/lib/Parse/ParseObjc.cpp | 26 +-- clang/lib/Parse/ParseStmt.cpp | 38 ++-- clang/lib/Parse/ParseTemplate.cpp | 2 - clang/lib/Parse/Parser.cpp | 6 +- clang/lib/Sema/SemaCast.cpp | 6 +- clang/lib/Sema/SemaChecking.cpp | 8 +- clang/lib/Sema/SemaDecl.cpp | 23 ++- clang/lib/Sema/SemaDeclCXX.cpp | 40 ++--- clang/lib/Sema/SemaExpr.cpp | 29 ++- clang/lib/Sema/SemaExprCXX.cpp | 29 ++- clang/lib/Sema/SemaExprMember.cpp | 6 +- clang/lib/Sema/SemaExprObjC.cpp | 18 +- clang/lib/Sema/SemaInit.cpp | 64 +++---- clang/lib/Sema/SemaOverload.cpp | 6 +- clang/lib/Sema/SemaStmt.cpp | 4 +- clang/lib/Sema/SemaTemplate.cpp | 22 +-- clang/lib/Sema/SemaTemplateInstantiate.cpp | 2 +- .../lib/Sema/SemaTemplateInstantiateDecl.cpp | 2 +- clang/lib/Sema/TreeTransform.h | 89 +++++----- 28 files changed, 263 insertions(+), 428 deletions(-) diff --git a/clang/include/clang/Sema/Ownership.h b/clang/include/clang/Sema/Ownership.h index fb9e368dde9f..84d55f425166 100644 --- a/clang/include/clang/Sema/Ownership.h +++ b/clang/include/clang/Sema/Ownership.h @@ -30,6 +30,7 @@ namespace clang { class DeclGroupRef; class Expr; class NestedNameSpecifier; + class ParsedTemplateArgument; class QualType; class Sema; class Stmt; @@ -112,96 +113,6 @@ namespace llvm { struct isPodLike > { static const bool value = true; }; } - - -// -------------------------- About Move Emulation -------------------------- // -// The smart pointer classes in this file attempt to emulate move semantics -// as they appear in C++0x with rvalue references. Since C++03 doesn't have -// rvalue references, some tricks are needed to get similar results. -// Move semantics in C++0x have the following properties: -// 1) "Moving" means transferring the value of an object to another object, -// similar to copying, but without caring what happens to the old object. -// In particular, this means that the new object can steal the old object's -// resources instead of creating a copy. -// 2) Since moving can modify the source object, it must either be explicitly -// requested by the user, or the modifications must be unnoticeable. -// 3) As such, C++0x moving is only allowed in three contexts: -// * By explicitly using std::move() to request it. -// * From a temporary object, since that object cannot be accessed -// afterwards anyway, thus making the state unobservable. -// * On function return, since the object is not observable afterwards. -// -// To sum up: moving from a named object should only be possible with an -// explicit std::move(), or on function return. Moving from a temporary should -// be implicitly done. Moving from a const object is forbidden. -// -// The emulation is not perfect, and has the following shortcomings: -// * move() is not in namespace std. -// * move() is required on function return. -// * There are difficulties with implicit conversions. -// * Microsoft's compiler must be given the /Za switch to successfully compile. -// -// -------------------------- Implementation -------------------------------- // -// The move emulation relies on the peculiar reference binding semantics of -// C++03: as a rule, a non-const reference may not bind to a temporary object, -// except for the implicit object parameter in a member function call, which -// can refer to a temporary even when not being const. -// The moveable object has five important functions to facilitate moving: -// * A private, unimplemented constructor taking a non-const reference to its -// own class. This constructor serves a two-fold purpose. -// - It prevents the creation of a copy constructor that takes a const -// reference. Temporaries would be able to bind to the argument of such a -// constructor, and that would be bad. -// - Named objects will bind to the non-const reference, but since it's -// private, this will fail to compile. This prevents implicit moving from -// named objects. -// There's also a copy assignment operator for the same purpose. -// * An implicit, non-const conversion operator to a special mover type. This -// type represents the rvalue reference of C++0x. Being a non-const member, -// its implicit this parameter can bind to temporaries. -// * A constructor that takes an object of this mover type. This constructor -// performs the actual move operation. There is an equivalent assignment -// operator. -// There is also a free move() function that takes a non-const reference to -// an object and returns a temporary. Internally, this function uses explicit -// constructor calls to move the value from the referenced object to the return -// value. -// -// There are now three possible scenarios of use. -// * Copying from a const object. Constructor overload resolution will find the -// non-const copy constructor, and the move constructor. The first is not -// viable because the const object cannot be bound to the non-const reference. -// The second fails because the conversion to the mover object is non-const. -// Moving from a const object fails as intended. -// * Copying from a named object. Constructor overload resolution will select -// the non-const copy constructor, but fail as intended, because this -// constructor is private. -// * Copying from a temporary. Constructor overload resolution cannot select -// the non-const copy constructor, because the temporary cannot be bound to -// the non-const reference. It thus selects the move constructor. The -// temporary can be bound to the implicit this parameter of the conversion -// operator, because of the special binding rule. Construction succeeds. -// Note that the Microsoft compiler, as an extension, allows binding -// temporaries against non-const references. The compiler thus selects the -// non-const copy constructor and fails, because the constructor is private. -// Passing /Za (disable extensions) disables this behaviour. -// The free move() function is used to move from a named object. -// -// Note that when passing an object of a different type (the classes below -// have OwningResult and OwningPtr, which should be mixable), you get a problem. -// Argument passing and function return use copy initialization rules. The -// effect of this is that, when the source object is not already of the target -// type, the compiler will first seek a way to convert the source object to the -// target type, and only then attempt to copy the resulting object. This means -// that when passing an OwningResult where an OwningPtr is expected, the -// compiler will first seek a conversion from OwningResult to OwningPtr, then -// copy the OwningPtr. The resulting conversion sequence is: -// OwningResult object -> ResultMover -> OwningResult argument to -// OwningPtr(OwningResult) -> OwningPtr -> PtrMover -> final OwningPtr -// This conversion sequence is too complex to be allowed. Thus the special -// move_* functions, which help the compiler out with some explicit -// conversions. - namespace clang { // Basic class DiagnosticBuilder; @@ -239,6 +150,7 @@ namespace clang { bool isUsable() const { return !Invalid && Val; } PtrTy get() const { return Val; } + // FIXME: Replace with get. PtrTy release() const { return Val; } PtrTy take() const { return Val; } template T *takeAs() { return static_cast(get()); } @@ -282,6 +194,7 @@ namespace clang { void *VP = reinterpret_cast(PtrWithInvalid & ~0x01); return PtrTraits::getFromVoidPointer(VP); } + // FIXME: Replace with get. PtrTy take() const { return get(); } PtrTy release() const { return get(); } template T *takeAs() { return static_cast(get()); } @@ -300,23 +213,21 @@ namespace clang { } }; - /// ASTMultiPtr - A moveable smart pointer to multiple AST nodes. Only owns - /// the individual pointers, not the array holding them. - template class ASTMultiPtr; - + /// ASTMultiPtr - A pointer to multiple AST nodes. template class ASTMultiPtr { PtrTy *Nodes; unsigned Count; public: - // Normal copying implicitly defined ASTMultiPtr() : Nodes(0), Count(0) {} + ASTMultiPtr(SmallVectorImpl &v) + : Nodes(v.data()), Count(v.size()) {} + ASTMultiPtr(PtrTy *nodes, unsigned count) : Nodes(nodes), Count(count) {} + // FIXME: Remove these. explicit ASTMultiPtr(Sema &) : Nodes(0), Count(0) {} ASTMultiPtr(Sema &, PtrTy *nodes, unsigned count) : Nodes(nodes), Count(count) {} - // Fake mover in Parse/AstGuard.h needs this: - ASTMultiPtr(PtrTy *nodes, unsigned count) : Nodes(nodes), Count(count) {} /// Access to the raw pointers. PtrTy *get() const { return Nodes; } @@ -324,47 +235,8 @@ namespace clang { /// Access to the count. unsigned size() const { return Count; } - PtrTy *release() { - return Nodes; - } - }; - - class ParsedTemplateArgument; - - class ASTTemplateArgsPtr { - ParsedTemplateArgument *Args; - mutable unsigned Count; - - public: - ASTTemplateArgsPtr(Sema &actions, ParsedTemplateArgument *args, - unsigned count) : - Args(args), Count(count) { } - - // FIXME: Lame, not-fully-type-safe emulation of 'move semantics'. - ASTTemplateArgsPtr(ASTTemplateArgsPtr &Other) : - Args(Other.Args), Count(Other.Count) { - } - - // FIXME: Lame, not-fully-type-safe emulation of 'move semantics'. - ASTTemplateArgsPtr& operator=(ASTTemplateArgsPtr &Other) { - Args = Other.Args; - Count = Other.Count; - return *this; - } - - ParsedTemplateArgument *getArgs() const { return Args; } - unsigned size() const { return Count; } - - void reset(ParsedTemplateArgument *args, unsigned count) { - Args = args; - Count = count; - } - - const ParsedTemplateArgument &operator[](unsigned Arg) const; - - ParsedTemplateArgument *release() const { - return Args; - } + /// Access to the elements. + const PtrTy &operator[](unsigned Arg) const { return Nodes[Arg]; } }; /// \brief A small vector that owns a set of AST nodes. @@ -397,22 +269,6 @@ namespace clang { /// A SmallVector of types. typedef ASTOwningVector TypeVector; - template inline - ASTMultiPtr move_arg(ASTOwningVector &vec) { - return ASTMultiPtr(vec.take(), vec.size()); - } - - // These versions are hopefully no-ops. - template - inline ActionResult move(ActionResult &ptr) { - return ptr; - } - - template inline - ASTMultiPtr& move(ASTMultiPtr &ptr) { - return ptr; - } - // We can re-use the low bit of expression, statement, base, and // member-initializer pointers for the "invalid" flag of // ActionResult. @@ -438,11 +294,9 @@ namespace clang { typedef ActionResult DeclResult; typedef OpaquePtr ParsedTemplateTy; - inline Expr *move(Expr *E) { return E; } - inline Stmt *move(Stmt *S) { return S; } - typedef ASTMultiPtr MultiExprArg; typedef ASTMultiPtr MultiStmtArg; + typedef ASTMultiPtr ASTTemplateArgsPtr; typedef ASTMultiPtr MultiTypeArg; typedef ASTMultiPtr MultiTemplateParamsArg; diff --git a/clang/include/clang/Sema/ParsedTemplate.h b/clang/include/clang/Sema/ParsedTemplate.h index 69080ad9b1d7..94db454a8543 100644 --- a/clang/include/clang/Sema/ParsedTemplate.h +++ b/clang/include/clang/Sema/ParsedTemplate.h @@ -209,11 +209,6 @@ namespace clang { /// Retrieves the range of the given template parameter lists. SourceRange getTemplateParamsRange(TemplateParameterList const *const *Params, unsigned NumParams); - - inline const ParsedTemplateArgument & - ASTTemplateArgsPtr::operator[](unsigned Arg) const { - return Args[Arg]; - } } #endif diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 9c4bbcdd547e..996ce06a381c 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -2437,7 +2437,7 @@ public: FullExprArg(const FullExprArg& Other) : E(Other.E) {} ExprResult release() { - return move(E); + return E; } Expr *get() const { return E; } diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp index abce27c3f820..f29fc65a3987 100644 --- a/clang/lib/Parse/ParseCXXInlineMethods.cpp +++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp @@ -42,10 +42,10 @@ Decl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, D.setFunctionDefinitionKind(DefinitionKind); if (D.getDeclSpec().isFriendSpecified()) FnD = Actions.ActOnFriendFunctionDecl(getCurScope(), D, - move(TemplateParams)); + TemplateParams); else { FnD = Actions.ActOnCXXMemberDeclarator(getCurScope(), AS, D, - move(TemplateParams), 0, + TemplateParams, 0, VS, ICIS_NoInit); if (FnD) { Actions.ProcessDeclAttributeList(getCurScope(), FnD, AccessAttrs, diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 85d3f5a7da7b..2638e122004a 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -1694,7 +1694,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D, ExprResult Initializer = Actions.ActOnParenListExpr(T.getOpenLocation(), T.getCloseLocation(), - move_arg(Exprs)); + Exprs); Actions.AddInitializerToDecl(ThisDecl, Initializer.take(), /*DirectInit=*/true, TypeContainsAuto); } diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 3dc96cf0d294..d8fcd5680c2e 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -2052,11 +2052,11 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, if (DS.isFriendSpecified()) { // TODO: handle initializers, bitfields, 'delete' ThisDecl = Actions.ActOnFriendFunctionDecl(getCurScope(), DeclaratorInfo, - move(TemplateParams)); + TemplateParams); } else { ThisDecl = Actions.ActOnCXXMemberDeclarator(getCurScope(), AS, DeclaratorInfo, - move(TemplateParams), + TemplateParams, BitfieldSize.release(), VS, HasInClassInit); if (AccessAttrs) diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 8d4668b95481..6c4d6fbee80e 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -179,7 +179,7 @@ static prec::Level getBinOpPrecedence(tok::TokenKind Kind, /// \endverbatim ExprResult Parser::ParseExpression(TypeCastState isTypeCast) { ExprResult LHS(ParseAssignmentExpression(isTypeCast)); - return ParseRHSOfBinaryExpression(move(LHS), prec::Comma); + return ParseRHSOfBinaryExpression(LHS, prec::Comma); } /// This routine is called when the '@' is seen and consumed. @@ -190,7 +190,7 @@ ExprResult Parser::ParseExpression(TypeCastState isTypeCast) { ExprResult Parser::ParseExpressionWithLeadingAt(SourceLocation AtLoc) { ExprResult LHS(ParseObjCAtExpression(AtLoc)); - return ParseRHSOfBinaryExpression(move(LHS), prec::Comma); + return ParseRHSOfBinaryExpression(LHS, prec::Comma); } /// This routine is called when a leading '__extension__' is seen and @@ -210,7 +210,7 @@ Parser::ParseExpressionWithLeadingExtension(SourceLocation ExtLoc) { LHS = Actions.ActOnUnaryOp(getCurScope(), ExtLoc, tok::kw___extension__, LHS.take()); - return ParseRHSOfBinaryExpression(move(LHS), prec::Comma); + return ParseRHSOfBinaryExpression(LHS, prec::Comma); } /// \brief Parse an expr that doesn't include (top-level) commas. @@ -227,7 +227,7 @@ ExprResult Parser::ParseAssignmentExpression(TypeCastState isTypeCast) { ExprResult LHS = ParseCastExpression(/*isUnaryExpression=*/false, /*isAddressOfOperand=*/false, isTypeCast); - return ParseRHSOfBinaryExpression(move(LHS), prec::Assignment); + return ParseRHSOfBinaryExpression(LHS, prec::Assignment); } /// \brief Parse an assignment expression where part of an Objective-C message @@ -279,7 +279,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) { // because we are called recursively, or because the token is not a binop), // then we are done! if (NextTokPrec < MinPrec) - return move(LHS); + return LHS; // Consume the operator, saving the operator token for error reporting. Token OpToken = Tok; @@ -458,7 +458,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, isTypeCast); if (NotCastExpr) Diag(Tok, diag::err_expected_expression); - return move(Res); + return Res; } namespace { @@ -698,7 +698,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, case CastExpr: // We have parsed the cast-expression and no postfix-expr pieces are // following. - return move(Res); + return Res; } break; @@ -888,7 +888,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, Res = ParseCastExpression(!getLangOpts().CPlusPlus); if (!Res.isInvalid()) Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, Res.get()); - return move(Res); + return Res; } case tok::amp: { // unary-expression: '&' cast-expression // Special treatment because of member pointers @@ -896,7 +896,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, Res = ParseCastExpression(false, true); if (!Res.isInvalid()) Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, Res.get()); - return move(Res); + return Res; } case tok::star: // unary-expression: '*' cast-expression @@ -910,7 +910,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, Res = ParseCastExpression(false); if (!Res.isInvalid()) Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, Res.get()); - return move(Res); + return Res; } case tok::kw___extension__:{//unary-expression:'__extension__' cast-expr [GNU] @@ -920,7 +920,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, Res = ParseCastExpression(false); if (!Res.isInvalid()) Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, Res.get()); - return move(Res); + return Res; } case tok::kw__Alignof: // unary-expression: '_Alignof' '(' type-name ')' if (!getLangOpts().C11) @@ -946,7 +946,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, Tok.getLocation()); Res = Actions.ActOnAddrLabel(AmpAmpLoc, Tok.getLocation(), LD); ConsumeToken(); - return move(Res); + return Res; } case tok::kw_const_cast: case tok::kw_dynamic_cast: @@ -1132,7 +1132,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, if (!Result.isInvalid()) Result = Actions.ActOnNoexceptExpr(KeyLoc, T.getOpenLocation(), Result.take(), T.getCloseLocation()); - return move(Result); + return Result; } case tok::kw___is_abstract: // [GNU] unary-type-trait @@ -1270,7 +1270,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { switch (Tok.getKind()) { case tok::code_completion: if (InMessageExpression) - return move(LHS); + return LHS; Actions.CodeCompletePostfixExpression(getCurScope(), LHS); cutOffParsing(); @@ -1290,7 +1290,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { // Fall through; this isn't a message send. default: // Not a postfix-expression suffix. - return move(LHS); + return LHS; case tok::l_square: { // postfix-expression: p-e '[' expression ']' // If we have a array postfix expression that starts on a new line and // Objective-C is enabled, it is highly likely that the user forgot a @@ -1300,7 +1300,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { // expression and recover by pretending there is no suffix. if (getLangOpts().ObjC1 && Tok.isAtStartOfLine() && isSimpleObjCMessageExpression()) - return move(LHS); + return LHS; // Reject array indices starting with a lambda-expression. '[[' is // reserved for attributes. @@ -1372,7 +1372,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { if (!LHS.isInvalid()) { ExprResult ECResult = Actions.ActOnCUDAExecConfigExpr(getCurScope(), OpenLoc, - move_arg(ExecConfigExprs), + ExecConfigExprs, CloseLoc); if (ECResult.isInvalid()) LHS = ExprError(); @@ -1414,7 +1414,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { ArgExprs.size()-1 == CommaLocs.size())&& "Unexpected number of commas!"); LHS = Actions.ActOnCallExpr(getCurScope(), LHS.take(), Loc, - move_arg(ArgExprs), Tok.getLocation(), + ArgExprs, Tok.getLocation(), ExecConfig); PT.consumeClose(); } @@ -1583,7 +1583,7 @@ Parser::ParseExprAfterUnaryExprOrTypeTrait(const Token &OpTok, // If we get here, the operand to the typeof/sizeof/alignof was an expresion. isCastExpr = false; - return move(Operand); + return Operand; } @@ -1684,7 +1684,7 @@ ExprResult Parser::ParseUnaryExprOrTypeTraitExpression() { /*isType=*/false, Operand.release(), CastRange); - return move(Operand); + return Operand; } /// ParseBuiltinPrimaryExpression @@ -1796,7 +1796,7 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() { Res = ParseExpression(); if (Res.isInvalid()) { SkipUntil(tok::r_paren); - return move(Res); + return Res; } Comps.back().U.E = Res.release(); @@ -1823,7 +1823,7 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() { ExprResult Cond(ParseAssignmentExpression()); if (Cond.isInvalid()) { SkipUntil(tok::r_paren); - return move(Cond); + return Cond; } if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren)) return ExprError(); @@ -1831,7 +1831,7 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() { ExprResult Expr1(ParseAssignmentExpression()); if (Expr1.isInvalid()) { SkipUntil(tok::r_paren); - return move(Expr1); + return Expr1; } if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren)) return ExprError(); @@ -1839,7 +1839,7 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() { ExprResult Expr2(ParseAssignmentExpression()); if (Expr2.isInvalid()) { SkipUntil(tok::r_paren); - return move(Expr2); + return Expr2; } if (Tok.isNot(tok::r_paren)) { Diag(Tok, diag::err_expected_rparen); @@ -2083,7 +2083,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, DeclaratorInfo, CastTy, RParenLoc, Result.take()); } - return move(Result); + return Result; } Diag(Tok, diag::err_expected_lbrace_in_compound_literal); @@ -2099,7 +2099,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, if (!ParseExpressionList(ArgExprs, CommaLocs)) { ExprType = SimpleExpr; Result = Actions.ActOnParenListExpr(OpenLoc, Tok.getLocation(), - move_arg(ArgExprs)); + ArgExprs); } } else { InMessageExpressionRAIIObject InMessage(*this, false); @@ -2120,7 +2120,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, T.consumeClose(); RParenLoc = T.getCloseLocation(); - return move(Result); + return Result; } /// ParseCompoundLiteralExpression - We have parsed the parenthesized type-name @@ -2141,7 +2141,7 @@ Parser::ParseCompoundLiteralExpression(ParsedType Ty, ExprResult Result = ParseInitializer(); if (!Result.isInvalid() && Ty) return Actions.ActOnCompoundLiteral(LParenLoc, Ty, RParenLoc, Result.take()); - return move(Result); + return Result; } /// ParseStringLiteralExpression - This handles the various token types that @@ -2263,7 +2263,7 @@ ExprResult Parser::ParseGenericSelectionExpression() { return Actions.ActOnGenericSelectionExpr(KeyLoc, DefaultLoc, T.getCloseLocation(), ControllingExpr.release(), - move_arg(Types), move_arg(Exprs)); + Types, Exprs); } /// ParseExpressionList - Used for C/C++ (argument-)expression-list. @@ -2450,7 +2450,7 @@ ExprResult Parser::ParseBlockLiteralExpression() { Result = Actions.ActOnBlockStmtExpr(CaretLoc, Stmt.take(), getCurScope()); else Actions.ActOnBlockError(CaretLoc, getCurScope()); - return move(Result); + return Result; } /// ParseObjCBoolLiteral - This handles the objective-c Boolean literals. diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp index baad16681468..c1823426f185 100644 --- a/clang/lib/Parse/ParseExprCXX.cpp +++ b/clang/lib/Parse/ParseExprCXX.cpp @@ -966,7 +966,7 @@ ExprResult Parser::ParseCXXCasts() { T.getOpenLocation(), Result.take(), T.getCloseLocation()); - return move(Result); + return Result; } /// ParseCXXTypeid - This handles the C++ typeid expression. @@ -1032,7 +1032,7 @@ ExprResult Parser::ParseCXXTypeid() { } } - return move(Result); + return Result; } /// ParseCXXUuidof - This handles the Microsoft C++ __uuidof expression. @@ -1080,7 +1080,7 @@ ExprResult Parser::ParseCXXUuidof() { } } - return move(Result); + return Result; } /// \brief Parse a C++ pseudo-destructor expression after the base, @@ -1202,7 +1202,7 @@ ExprResult Parser::ParseThrowExpression() { default: ExprResult Expr(ParseAssignmentExpression()); - if (Expr.isInvalid()) return move(Expr); + if (Expr.isInvalid()) return Expr; return Actions.ActOnCXXThrow(getCurScope(), ThrowLoc, Expr.take()); } } @@ -1271,7 +1271,7 @@ Parser::ParseCXXTypeConstructExpression(const DeclSpec &DS) { assert((Exprs.size() == 0 || Exprs.size()-1 == CommaLocs.size())&& "Unexpected number of commas!"); return Actions.ActOnCXXTypeConstructExpr(TypeRep, T.getOpenLocation(), - move_arg(Exprs), + Exprs, T.getCloseLocation()); } } @@ -2304,7 +2304,7 @@ Parser::ParseCXXNewExpression(bool UseGlobal, SourceLocation Start) { } Initializer = Actions.ActOnParenListExpr(ConstructorLParen, ConstructorRParen, - move_arg(ConstructorArgs)); + ConstructorArgs); } else if (Tok.is(tok::l_brace) && getLangOpts().CPlusPlus0x) { Diag(Tok.getLocation(), diag::warn_cxx98_compat_generalized_initializer_lists); @@ -2314,7 +2314,7 @@ Parser::ParseCXXNewExpression(bool UseGlobal, SourceLocation Start) { return Initializer; return Actions.ActOnCXXNew(Start, UseGlobal, PlacementLParen, - move_arg(PlacementArgs), PlacementRParen, + PlacementArgs, PlacementRParen, TypeIdParens, DeclaratorInfo, Initializer.take()); } @@ -2428,7 +2428,7 @@ Parser::ParseCXXDeleteExpression(bool UseGlobal, SourceLocation Start) { ExprResult Operand(ParseCastExpression(false)); if (Operand.isInvalid()) - return move(Operand); + return Operand; return Actions.ActOnCXXDelete(Start, UseGlobal, ArrayDelete, Operand.take()); } @@ -2810,7 +2810,7 @@ Parser::ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType, Result = Actions.ActOnCastExpr(getCurScope(), Tracker.getOpenLocation(), DeclaratorInfo, CastTy, Tracker.getCloseLocation(), Result.take()); - return move(Result); + return Result; } // Not a compound literal, and not followed by a cast-expression. @@ -2829,5 +2829,5 @@ Parser::ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType, } Tracker.consumeClose(); - return move(Result); + return Result; } diff --git a/clang/lib/Parse/ParseInit.cpp b/clang/lib/Parse/ParseInit.cpp index 1c349fddbd57..3aadd263990c 100644 --- a/clang/lib/Parse/ParseInit.cpp +++ b/clang/lib/Parse/ParseInit.cpp @@ -313,7 +313,7 @@ ExprResult Parser::ParseInitializerWithPotentialDesignator() { Idx = ParseAssignmentExpression(); if (Idx.isInvalid()) { SkipUntil(tok::r_square); - return move(Idx); + return Idx; } } @@ -341,7 +341,7 @@ ExprResult Parser::ParseInitializerWithPotentialDesignator() { ExprResult RHS(ParseConstantExpression()); if (RHS.isInvalid()) { SkipUntil(tok::r_square); - return move(RHS); + return RHS; } Desig.AddDesignator(Designator::getArrayRange(Idx.release(), RHS.release(), @@ -476,7 +476,7 @@ ExprResult Parser::ParseBraceInitializer() { bool closed = !T.consumeClose(); if (InitExprsOk && closed) - return Actions.ActOnInitList(LBraceLoc, move_arg(InitExprs), + return Actions.ActOnInitList(LBraceLoc, InitExprs, T.getCloseLocation()); return ExprError(); // an error occurred. diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index db35a386c350..1fd60a266366 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -1894,7 +1894,7 @@ StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) { } return Actions.ActOnObjCAtTryStmt(atLoc, TryBody.take(), - move_arg(CatchStmts), + CatchStmts, FinallyStmt.take()); } @@ -2061,13 +2061,13 @@ ExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) { ExprResult Lit(Actions.ActOnNumericConstant(Tok)); if (Lit.isInvalid()) { - return move(Lit); + return Lit; } ConsumeToken(); // Consume the literal token. Lit = Actions.ActOnUnaryOp(getCurScope(), OpLoc, Kind, Lit.take()); if (Lit.isInvalid()) - return move(Lit); + return Lit; return ParsePostfixExpressionSuffix( Actions.BuildObjCNumericLiteral(AtLoc, Lit.take())); @@ -2346,7 +2346,7 @@ ExprResult Parser::ParseObjCMessageExpression() { ExprResult Res(ParseExpression()); if (Res.isInvalid()) { SkipUntil(tok::r_square); - return move(Res); + return Res; } return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(), @@ -2465,7 +2465,7 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc, // stop at the ']' when it skips to the ';'. We want it to skip beyond // the enclosing expression. SkipUntil(tok::r_square); - return move(Res); + return Res; } // We have a valid expression. @@ -2512,7 +2512,7 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc, // stop at the ']' when it skips to the ';'. We want it to skip beyond // the enclosing expression. SkipUntil(tok::r_square); - return move(Res); + return Res; } // We have a valid expression. @@ -2570,7 +2570,7 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc, ExprResult Parser::ParseObjCStringLiteral(SourceLocation AtLoc) { ExprResult Res(ParseStringLiteralExpression()); - if (Res.isInvalid()) return move(Res); + if (Res.isInvalid()) return Res; // @"foo" @"bar" is a valid concatenated string. Eat any subsequent string // expressions. At this point, we know that the only valid thing that starts @@ -2589,7 +2589,7 @@ ExprResult Parser::ParseObjCStringLiteral(SourceLocation AtLoc) { ExprResult Lit(ParseStringLiteralExpression()); if (Lit.isInvalid()) - return move(Lit); + return Lit; AtStrings.push_back(Lit.release()); } @@ -2615,7 +2615,7 @@ ExprResult Parser::ParseObjCBooleanLiteral(SourceLocation AtLoc, ExprResult Parser::ParseObjCCharacterLiteral(SourceLocation AtLoc) { ExprResult Lit(Actions.ActOnCharacterConstant(Tok)); if (Lit.isInvalid()) { - return move(Lit); + return Lit; } ConsumeToken(); // Consume the literal token. return Owned(Actions.BuildObjCNumericLiteral(AtLoc, Lit.take())); @@ -2629,7 +2629,7 @@ ExprResult Parser::ParseObjCCharacterLiteral(SourceLocation AtLoc) { ExprResult Parser::ParseObjCNumericLiteral(SourceLocation AtLoc) { ExprResult Lit(Actions.ActOnNumericConstant(Tok)); if (Lit.isInvalid()) { - return move(Lit); + return Lit; } ConsumeToken(); // Consume the literal token. return Owned(Actions.BuildObjCNumericLiteral(AtLoc, Lit.take())); @@ -2672,7 +2672,7 @@ ExprResult Parser::ParseObjCArrayLiteral(SourceLocation AtLoc) { // stop at the ']' when it skips to the ';'. We want it to skip beyond // the enclosing expression. SkipUntil(tok::r_square); - return move(Res); + return Res; } // Parse the ellipsis that indicates a pack expansion. @@ -2707,7 +2707,7 @@ ExprResult Parser::ParseObjCDictionaryLiteral(SourceLocation AtLoc) { // stop at the '}' when it skips to the ';'. We want it to skip beyond // the enclosing expression. SkipUntil(tok::r_brace); - return move(KeyExpr); + return KeyExpr; } } @@ -2723,7 +2723,7 @@ ExprResult Parser::ParseObjCDictionaryLiteral(SourceLocation AtLoc) { // stop at the '}' when it skips to the ';'. We want it to skip beyond // the enclosing expression. SkipUntil(tok::r_brace); - return move(ValueExpr); + return ValueExpr; } // Parse the ellipsis that designates this as a pack expansion. diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index 091d4aaaf208..37bfb03f356a 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -232,7 +232,7 @@ Retry: bool msAsm = false; Res = ParseAsmStatement(msAsm); Res = Actions.ActOnFinishFullStmt(Res.get()); - if (msAsm) return move(Res); + if (msAsm) return Res; SemiError = "asm"; break; } @@ -267,7 +267,7 @@ Retry: SkipUntil(tok::r_brace, true, true); } - return move(Res); + return Res; } /// \brief Parse an expression statement. @@ -324,7 +324,7 @@ StmtResult Parser::ParseSEHTryBlockCommon(SourceLocation TryLoc) { StmtResult TryBlock(ParseCompoundStatement()); if(TryBlock.isInvalid()) - return move(TryBlock); + return TryBlock; StmtResult Handler; if (Tok.is(tok::identifier) && @@ -339,7 +339,7 @@ StmtResult Parser::ParseSEHTryBlockCommon(SourceLocation TryLoc) { } if(Handler.isInvalid()) - return move(Handler); + return Handler; return Actions.ActOnSEHTryBlock(false /* IsCXXTry */, TryLoc, @@ -384,7 +384,7 @@ StmtResult Parser::ParseSEHExceptBlock(SourceLocation ExceptLoc) { StmtResult Block(ParseCompoundStatement()); if(Block.isInvalid()) - return move(Block); + return Block; return Actions.ActOnSEHExceptBlock(ExceptLoc, FilterExpr.take(), Block.take()); } @@ -401,7 +401,7 @@ StmtResult Parser::ParseSEHFinallyBlock(SourceLocation FinallyBlock) { StmtResult Block(ParseCompoundStatement()); if(Block.isInvalid()) - return move(Block); + return Block; return Actions.ActOnSEHFinallyBlock(FinallyBlock,Block.take()); } @@ -546,7 +546,7 @@ StmtResult Parser::ParseCaseStatement(bool MissingCase, ExprResult Expr) { // Otherwise we link it into the current chain. Stmt *NextDeepest = Case.get(); if (TopLevelCase.isInvalid()) - TopLevelCase = move(Case); + TopLevelCase = Case; else Actions.ActOnCaseStmtBody(DeepestParsedCaseStmt, Case.get()); DeepestParsedCaseStmt = NextDeepest; @@ -579,7 +579,7 @@ StmtResult Parser::ParseCaseStatement(bool MissingCase, ExprResult Expr) { Actions.ActOnCaseStmtBody(DeepestParsedCaseStmt, SubStmt.get()); // Return the top level parsed statement tree. - return move(TopLevelCase); + return TopLevelCase; } /// ParseDefaultStatement @@ -793,7 +793,7 @@ StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) { } return Actions.ActOnCompoundStmt(T.getOpenLocation(), CloseLoc, - move_arg(Stmts), isStmtExpr); + Stmts, isStmtExpr); } /// ParseParenExprOrCondition: @@ -1039,7 +1039,7 @@ StmtResult Parser::ParseSwitchStatement(SourceLocation *TrailingElseLoc) { SkipUntil(tok::r_brace, false, false); } else SkipUntil(tok::semi); - return move(Switch); + return Switch; } // C99 6.8.4p3 - In C99, the body of the switch statement is a scope, even if @@ -1523,7 +1523,7 @@ StmtResult Parser::ParseGotoStatement() { return StmtError(); } - return move(Res); + return Res; } /// ParseContinueStatement @@ -1758,8 +1758,8 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) { T.consumeClose(); return Actions.ActOnAsmStmt(AsmLoc, /*isSimple*/ true, isVolatile, /*NumOutputs*/ 0, /*NumInputs*/ 0, 0, - move_arg(Constraints), move_arg(Exprs), - AsmString.take(), move_arg(Clobbers), + Constraints, Exprs, + AsmString.take(), Clobbers, T.getCloseLocation()); } @@ -1823,8 +1823,8 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) { T.consumeClose(); return Actions.ActOnAsmStmt(AsmLoc, false, isVolatile, NumOutputs, NumInputs, Names.data(), - move_arg(Constraints), move_arg(Exprs), - AsmString.take(), move_arg(Clobbers), + Constraints, Exprs, + AsmString.take(), Clobbers, T.getCloseLocation()); } @@ -2017,7 +2017,7 @@ StmtResult Parser::ParseCXXTryBlockCommon(SourceLocation TryLoc) { StmtResult TryBlock(ParseCompoundStatement(/*isStmtExpr=*/false, Scope::DeclScope|Scope::TryScope)); if (TryBlock.isInvalid()) - return move(TryBlock); + return TryBlock; // Borland allows SEH-handlers with 'try' @@ -2035,7 +2035,7 @@ StmtResult Parser::ParseCXXTryBlockCommon(SourceLocation TryLoc) { Handler = ParseSEHFinallyBlock(Loc); } if(Handler.isInvalid()) - return move(Handler); + return Handler; return Actions.ActOnSEHTryBlock(true /* IsCXXTry */, TryLoc, @@ -2060,7 +2060,7 @@ StmtResult Parser::ParseCXXTryBlockCommon(SourceLocation TryLoc) { if (Handlers.empty()) return StmtError(); - return Actions.ActOnCXXTryBlock(TryLoc, TryBlock.take(),move_arg(Handlers)); + return Actions.ActOnCXXTryBlock(TryLoc, TryBlock.take(),Handlers); } } @@ -2112,7 +2112,7 @@ StmtResult Parser::ParseCXXCatchBlock() { // FIXME: Possible draft standard bug: attribute-specifier should be allowed? StmtResult Block(ParseCompoundStatement()); if (Block.isInvalid()) - return move(Block); + return Block; return Actions.ActOnCXXCatchBlock(CatchLoc, ExceptionDecl, Block.take()); } diff --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp index ade918fb221a..ffd01ea73b8b 100644 --- a/clang/lib/Parse/ParseTemplate.cpp +++ b/clang/lib/Parse/ParseTemplate.cpp @@ -942,8 +942,6 @@ bool Parser::AnnotateTemplateIdToken(TemplateTy Template, TemplateNameKind TNK, Tok.setLocation(TemplateKWLoc); else Tok.setLocation(TemplateNameLoc); - - TemplateArgsPtr.release(); } // Common fields for the annotation token diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 683c95439088..526da75e9d19 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -981,7 +981,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, D.setFunctionDefinitionKind(FDK_Definition); Decl *DP = Actions.HandleDeclarator(ParentScope, D, - move(TemplateParameterLists)); + TemplateParameterLists); D.complete(DP); D.getMutableDeclSpec().abort(); @@ -1015,7 +1015,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, D.setFunctionDefinitionKind(FDK_Definition); Decl *FuncDecl = Actions.HandleDeclarator(ParentScope, D, - move(TemplateParameterLists)); + TemplateParameterLists); D.complete(FuncDecl); D.getMutableDeclSpec().abort(); if (FuncDecl) { @@ -1288,7 +1288,7 @@ Parser::ExprResult Parser::ParseSimpleAsm(SourceLocation *EndLoc) { *EndLoc = T.getCloseLocation(); } - return move(Result); + return Result; } /// \brief Get the TemplateIdAnnotation from the token and put it in the diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp index 6c513b9669bc..42f097dda51f 100644 --- a/clang/lib/Sema/SemaCast.cpp +++ b/clang/lib/Sema/SemaCast.cpp @@ -227,7 +227,7 @@ Sema::ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, CheckExtraCXXDefaultArguments(D); } - return BuildCXXNamedCast(OpLoc, Kind, TInfo, move(E), + return BuildCXXNamedCast(OpLoc, Kind, TInfo, E, SourceRange(LAngleBracketLoc, RAngleBracketLoc), SourceRange(LParenLoc, RParenLoc)); } @@ -1343,7 +1343,7 @@ TryStaticImplicitCast(Sema &Self, ExprResult &SrcExpr, QualType DestType, else Kind = CK_NoOp; - SrcExpr = move(Result); + SrcExpr = Result; return TC_Success; } @@ -1513,7 +1513,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr, SingleFunctionExpr, Expr::getValueKindForType(DestType) == VK_RValue // Convert Fun to Ptr ) && SingleFunctionExpr.isUsable()) { - SrcExpr = move(SingleFunctionExpr); + SrcExpr = SingleFunctionExpr; SrcType = SrcExpr.get()->getType(); } else { return TC_NotApplicable; diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index c207c55c6037..5527d71f8032 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -266,11 +266,11 @@ Sema::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { case Builtin::BI__sync_swap_4: case Builtin::BI__sync_swap_8: case Builtin::BI__sync_swap_16: - return SemaBuiltinAtomicOverloaded(move(TheCallResult)); + return SemaBuiltinAtomicOverloaded(TheCallResult); #define BUILTIN(ID, TYPE, ATTRS) #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) \ case Builtin::BI##ID: \ - return SemaAtomicOpsOverloaded(move(TheCallResult), AtomicExpr::AO##ID); + return SemaAtomicOpsOverloaded(TheCallResult, AtomicExpr::AO##ID); #include "clang/Basic/Builtins.def" case Builtin::BI__builtin_annotation: if (SemaBuiltinAnnotation(*this, TheCall)) @@ -299,7 +299,7 @@ Sema::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { } } - return move(TheCallResult); + return TheCallResult; } // Get the valid immediate range for the specified NEON type code. @@ -1243,7 +1243,7 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) { // gracefully. TheCall->setType(ResultType); - return move(TheCallResult); + return TheCallResult; } /// CheckObjCString - Checks that the argument to the builtin diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index cd6a60b47b74..8d4d924439f0 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -708,7 +708,7 @@ Corrected: if (ObjCIvarDecl *Ivar = Result.getAsSingle()) { Result.clear(); ExprResult E(LookupInObjCMethod(Result, S, Ivar->getIdentifier())); - return move(E); + return E; } goto Corrected; @@ -3722,11 +3722,11 @@ Decl *Sema::HandleDeclarator(Scope *S, Declarator &D, New = ActOnTypedefDeclarator(S, D, DC, TInfo, Previous); } else if (R->isFunctionType()) { New = ActOnFunctionDeclarator(S, D, DC, TInfo, Previous, - move(TemplateParamLists), + TemplateParamLists, AddToScope); } else { New = ActOnVariableDeclarator(S, D, DC, TInfo, Previous, - move(TemplateParamLists)); + TemplateParamLists); } if (New == 0) @@ -4256,7 +4256,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, if (TemplateParamLists.size() > 0 && D.getCXXScopeSpec().isSet()) { NewVD->setTemplateParameterListsInfo(Context, TemplateParamLists.size(), - TemplateParamLists.release()); + TemplateParamLists.get()); } if (D.getDeclSpec().isConstexprSpecified()) @@ -5208,7 +5208,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, if (TemplateParamLists.size() > 1) { NewFD->setTemplateParameterListsInfo(Context, TemplateParamLists.size() - 1, - TemplateParamLists.release()); + TemplateParamLists.get()); } } else { // This is a function template specialization. @@ -5216,7 +5216,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // For source fidelity, store all the template param lists. NewFD->setTemplateParameterListsInfo(Context, TemplateParamLists.size(), - TemplateParamLists.release()); + TemplateParamLists.get()); // C++0x [temp.expl.spec]p20 forbids "template<> friend void foo(int);". if (isFriend) { @@ -5248,7 +5248,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // For source fidelity, store all the template param lists. NewFD->setTemplateParameterListsInfo(Context, TemplateParamLists.size(), - TemplateParamLists.release()); + TemplateParamLists.get()); } if (Invalid) { @@ -5527,7 +5527,6 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, TemplateId->NumArgs); translateTemplateArguments(TemplateArgsPtr, TemplateArgs); - TemplateArgsPtr.release(); HasExplicitTemplateArgs = true; @@ -7724,7 +7723,7 @@ void Sema::computeNRVO(Stmt *Body, FunctionScopeInfo *Scope) { } Decl *Sema::ActOnFinishFunctionBody(Decl *D, Stmt *BodyArg) { - return ActOnFinishFunctionBody(D, move(BodyArg), false); + return ActOnFinishFunctionBody(D, BodyArg, false); } Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, @@ -8310,8 +8309,8 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SS, Name, NameLoc, Attr, TemplateParams, AS, ModulePrivateLoc, - TemplateParameterLists.size() - 1, - (TemplateParameterList**) TemplateParameterLists.release()); + TemplateParameterLists.size()-1, + TemplateParameterLists.get()); return Result.get(); } else { // The "template<>" header is extraneous. @@ -8860,7 +8859,7 @@ CreateNewDecl: if (TemplateParameterLists.size() > 0) { New->setTemplateParameterListsInfo(Context, TemplateParameterLists.size(), - (TemplateParameterList**) TemplateParameterLists.release()); + TemplateParameterLists.get()); } } else diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index ce37eea6de3d..41e7525867e8 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -1548,7 +1548,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, // Member field could not be with "template" keyword. // So TemplateParameterLists should be empty in this case. if (TemplateParameterLists.size()) { - TemplateParameterList* TemplateParams = TemplateParameterLists.get()[0]; + TemplateParameterList* TemplateParams = TemplateParameterLists[0]; if (TemplateParams->size()) { // There is no such thing as a member field template. Diag(D.getIdentifierLoc(), diag::err_template_member) @@ -1588,7 +1588,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, } else { assert(InitStyle == ICIS_NoInit); - Member = HandleDeclarator(S, D, move(TemplateParameterLists)); + Member = HandleDeclarator(S, D, TemplateParameterLists); if (!Member) { return 0; } @@ -6565,10 +6565,10 @@ Decl *Sema::ActOnAliasDeclaration(Scope *S, if (TemplateParamLists.size() != 1) { Diag(UsingLoc, diag::err_alias_template_extra_headers) - << SourceRange(TemplateParamLists.get()[1]->getTemplateLoc(), - TemplateParamLists.get()[TemplateParamLists.size()-1]->getRAngleLoc()); + << SourceRange(TemplateParamLists[1]->getTemplateLoc(), + TemplateParamLists[TemplateParamLists.size()-1]->getRAngleLoc()); } - TemplateParameterList *TemplateParams = TemplateParamLists.get()[0]; + TemplateParameterList *TemplateParams = TemplateParamLists[0]; // Only consider previous declarations in the same scope. FilterLookupForScope(Previous, CurContext, S, /*ConsiderLinkage*/false, @@ -7882,12 +7882,12 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, if (NeedsCollectableMemCpy) Call = ActOnCallExpr(/*Scope=*/0, CollectableMemCpyRef, - Loc, move_arg(CallArgs), + Loc, CallArgs, Loc); else Call = ActOnCallExpr(/*Scope=*/0, BuiltinMemCpyRef, - Loc, move_arg(CallArgs), + Loc, CallArgs, Loc); assert(!Call.isInvalid() && "Call to __builtin_memcpy cannot fail!"); @@ -7937,7 +7937,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, StmtResult Body; { CompoundScopeRAII CompoundScope(*this); - Body = ActOnCompoundStmt(Loc, Loc, move_arg(Statements), + Body = ActOnCompoundStmt(Loc, Loc, Statements, /*isStmtExpr=*/false); assert(!Body.isInvalid() && "Compound statement creation cannot fail"); } @@ -8431,12 +8431,12 @@ void Sema::DefineImplicitMoveAssignment(SourceLocation CurrentLocation, if (NeedsCollectableMemCpy) Call = ActOnCallExpr(/*Scope=*/0, CollectableMemCpyRef, - Loc, move_arg(CallArgs), + Loc, CallArgs, Loc); else Call = ActOnCallExpr(/*Scope=*/0, BuiltinMemCpyRef, - Loc, move_arg(CallArgs), + Loc, CallArgs, Loc); assert(!Call.isInvalid() && "Call to __builtin_memcpy cannot fail!"); @@ -8486,7 +8486,7 @@ void Sema::DefineImplicitMoveAssignment(SourceLocation CurrentLocation, StmtResult Body; { CompoundScopeRAII CompoundScope(*this); - Body = ActOnCompoundStmt(Loc, Loc, move_arg(Statements), + Body = ActOnCompoundStmt(Loc, Loc, Statements, /*isStmtExpr=*/false); assert(!Body.isInvalid() && "Compound statement creation cannot fail"); } @@ -9017,12 +9017,12 @@ static bool hasOneRealArgument(MultiExprArg Args) { return false; default: - if (!Args.get()[1]->isDefaultArgument()) + if (!Args[1]->isDefaultArgument()) return false; // fall through case 1: - return !Args.get()[0]->isDefaultArgument(); + return !Args[0]->isDefaultArgument(); } return false; @@ -9055,7 +9055,7 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, } return BuildCXXConstructExpr(ConstructLoc, DeclInitType, Constructor, - Elidable, move(ExprArgs), HadMultipleCandidates, + Elidable, ExprArgs, HadMultipleCandidates, RequiresZeroInit, ConstructKind, ParenRange); } @@ -9070,7 +9070,7 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, unsigned ConstructKind, SourceRange ParenRange) { unsigned NumExprs = ExprArgs.size(); - Expr **Exprs = (Expr **)ExprArgs.release(); + Expr **Exprs = ExprArgs.get(); MarkFunctionReferenced(ConstructLoc, Constructor); return Owned(CXXConstructExpr::Create(Context, DeclInitType, ConstructLoc, @@ -9088,7 +9088,7 @@ bool Sema::InitializeVarWithConstructor(VarDecl *VD, // FIXME: Provide the correct paren SourceRange when available. ExprResult TempResult = BuildCXXConstructExpr(VD->getLocation(), VD->getType(), Constructor, - move(Exprs), HadMultipleCandidates, false, + Exprs, HadMultipleCandidates, false, CXXConstructExpr::CK_Complete, SourceRange()); if (TempResult.isInvalid()) return true; @@ -9919,7 +9919,7 @@ Decl *Sema::ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc, TemplateParams, AS_public, /*ModulePrivateLoc=*/SourceLocation(), TempParamLists.size() - 1, - (TemplateParameterList**) TempParamLists.release()).take(); + TempParamLists.get()).take(); } else { // The "template<>" header is extraneous. Diag(TemplateParams->getTemplateLoc(), diag::err_template_tag_noparams) @@ -9932,7 +9932,7 @@ Decl *Sema::ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc, bool isAllExplicitSpecializations = true; for (unsigned I = TempParamLists.size(); I-- > 0; ) { - if (TempParamLists.get()[I]->size()) { + if (TempParamLists[I]->size()) { isAllExplicitSpecializations = false; break; } @@ -10079,7 +10079,7 @@ Decl *Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, if (unsigned NumTempParamLists = TempParams.size()) D = FriendTemplateDecl::Create(Context, CurContext, Loc, NumTempParamLists, - TempParams.release(), + TempParams.get(), TSI, DS.getFriendSpecLoc()); else @@ -10321,7 +10321,7 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, bool AddToScope = true; NamedDecl *ND = ActOnFunctionDeclarator(DCScope, D, DC, TInfo, Previous, - move(TemplateParams), AddToScope); + TemplateParams, AddToScope); if (!ND) return 0; assert(ND->getDeclContext() == DC); diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 3875ba171366..1628e7f14b10 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -502,7 +502,7 @@ ExprResult Sema::DefaultFunctionArrayLvalueConversion(Expr *E) { Res = DefaultLvalueConversion(Res.take()); if (Res.isInvalid()) return ExprError(); - return move(Res); + return Res; } @@ -1098,8 +1098,8 @@ Sema::ActOnGenericSelectionExpr(SourceLocation KeyLoc, unsigned NumAssocs = ArgTypes.size(); assert(NumAssocs == ArgExprs.size()); - ParsedType *ParsedTypes = ArgTypes.release(); - Expr **Exprs = ArgExprs.release(); + ParsedType *ParsedTypes = ArgTypes.get(); + Expr **Exprs = ArgExprs.get(); TypeSourceInfo **Types = new TypeSourceInfo*[NumAssocs]; for (unsigned i = 0; i < NumAssocs; ++i) { @@ -1432,7 +1432,6 @@ Sema::DecomposeUnqualifiedId(const UnqualifiedId &Id, Id.TemplateId->getTemplateArgs(), Id.TemplateId->NumArgs); translateTemplateArguments(TemplateArgsPtr, Buffer); - TemplateArgsPtr.release(); TemplateName TName = Id.TemplateId->Template.get(); SourceLocation TNameLoc = Id.TemplateId->TemplateNameLoc; @@ -1797,7 +1796,7 @@ ExprResult Sema::ActOnIdExpression(Scope *S, // lookup fails and no expression will be built to reference it. if (!E.isInvalid() && !E.get()) return ExprError(); - return move(E); + return E; } } } @@ -3140,7 +3139,7 @@ Sema::ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc, Expr *ArgEx = (Expr *)TyOrEx; ExprResult Result = CreateUnaryExprOrTypeTraitExpr(ArgEx, OpLoc, ExprKind); - return move(Result); + return Result; } static QualType CheckRealImagOperand(Sema &S, ExprResult &V, SourceLocation Loc, @@ -3167,7 +3166,7 @@ static QualType CheckRealImagOperand(Sema &S, ExprResult &V, SourceLocation Loc, ExprResult PR = S.CheckPlaceholderExpr(V.get()); if (PR.isInvalid()) return QualType(); if (PR.get() != V.get()) { - V = move(PR); + V = PR; return CheckRealImagOperand(S, V, Loc, IsReal); } @@ -3783,7 +3782,7 @@ Sema::ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, if (Result.isInvalid()) return ExprError(); Fn = Result.take(); - Expr **Args = ArgExprs.release(); + Expr **Args = ArgExprs.get(); if (getLangOpts().CPlusPlus) { // If this is a pseudo-destructor expression, build the call immediately. @@ -4168,7 +4167,7 @@ ExprResult Sema::ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc) { unsigned NumInit = InitArgList.size(); - Expr **InitList = InitArgList.release(); + Expr **InitList = InitArgList.get(); // Immediately handle non-overload placeholders. Overloads can be // resolved contextually, but everything else here can't. @@ -4604,7 +4603,7 @@ ExprResult Sema::ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val) { unsigned nexprs = Val.size(); - Expr **exprs = reinterpret_cast(Val.release()); + Expr **exprs = Val.get(); assert((exprs != 0) && "ActOnParenOrParenListExpr() missing expr list"); Expr *expr = new (Context) ParenListExpr(Context, L, exprs, nexprs, R); return Owned(expr); @@ -4884,11 +4883,11 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, ExprResult LHSResult = CheckPlaceholderExpr(LHS.get()); if (!LHSResult.isUsable()) return QualType(); - LHS = move(LHSResult); + LHS = LHSResult; ExprResult RHSResult = CheckPlaceholderExpr(RHS.get()); if (!RHSResult.isUsable()) return QualType(); - RHS = move(RHSResult); + RHS = RHSResult; // C++ is sufficiently different to merit its own checker. if (getLangOpts().CPlusPlus) @@ -5910,7 +5909,7 @@ Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, !CheckObjCARCUnavailableWeakConversion(LHSType, RHS.get()->getType())) result = IncompatibleObjCWeakRef; - RHS = move(Res); + RHS = Res; return result; } @@ -7419,12 +7418,12 @@ inline QualType Sema::CheckLogicalOperands( // C99 6.5.[13,14] ExprResult LHSRes = PerformContextuallyConvertToBool(LHS.get()); if (LHSRes.isInvalid()) return InvalidOperands(Loc, LHS, RHS); - LHS = move(LHSRes); + LHS = LHSRes; ExprResult RHSRes = PerformContextuallyConvertToBool(RHS.get()); if (RHSRes.isInvalid()) return InvalidOperands(Loc, LHS, RHS); - RHS = move(RHSRes); + RHS = RHSRes; // C++ [expr.log.and]p2 // C++ [expr.log.or]p2 diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 27402599a401..88345ceaeb43 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -815,8 +815,6 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo, if (Ty->isDependentType() || CallExpr::hasAnyTypeDependentArguments( llvm::makeArrayRef(Exprs, NumExprs))) { - exprs.release(); - return Owned(CXXUnresolvedConstructExpr::Create(Context, TInfo, LParenLoc, Exprs, NumExprs, @@ -835,7 +833,6 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo, // corresponding cast expression. if (NumExprs == 1 && !ListInitialization) { Expr *Arg = Exprs[0]; - exprs.release(); return BuildCXXFunctionalCastExpr(TInfo, LParenLoc, Arg, RParenLoc); } @@ -865,7 +862,7 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo, : InitializationKind::CreateValue(TyBeginLoc, LParenLoc, RParenLoc); InitializationSequence InitSeq(*this, Entity, Kind, Exprs, NumExprs); - ExprResult Result = InitSeq.Perform(*this, Entity, Kind, move(exprs)); + ExprResult Result = InitSeq.Perform(*this, Entity, Kind, exprs); if (!Result.isInvalid() && ListInitialization && isa(Result.get())) { @@ -881,7 +878,7 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo, } // FIXME: Improve AST representation? - return move(Result); + return Result; } /// doesUsualArrayDeleteWantSize - Answers whether the usual @@ -1013,7 +1010,7 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, return BuildCXXNew(StartLoc, UseGlobal, PlacementLParen, - move(PlacementArgs), + PlacementArgs, PlacementRParen, TypeIdParens, AllocType, @@ -1432,8 +1429,6 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, } } - PlacementArgs.release(); - return Owned(new (Context) CXXNewExpr(Context, UseGlobal, OperatorNew, OperatorDelete, UsualArrayDeleteWantsSize, @@ -2100,7 +2095,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, ObjectPtrConversions.front()->getConversionType(), AA_Converting); if (Res.isUsable()) { - Ex = move(Res); + Ex = Res; Type = Ex.get()->getType(); } } @@ -2287,7 +2282,7 @@ ExprResult Sema::CheckConditionVariable(VarDecl *ConditionVar, return ExprError(); } - return move(Condition); + return Condition; } /// CheckCXXBooleanCondition - Returns true if a conversion to bool is invalid. @@ -2367,7 +2362,7 @@ static ExprResult BuildCXXCastArgument(Sema &S, ExprResult Result = S.BuildCXXConstructExpr(CastLoc, Ty, cast(Method), - move_arg(ConstructorArgs), + ConstructorArgs, HadMultipleCandidates, /*ZeroInit*/ false, CXXConstructExpr::CK_Complete, SourceRange()); if (Result.isInvalid()) @@ -2519,7 +2514,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, return ExprError(); return BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(), ToType, SCS.CopyConstructor, - move_arg(ConstructorArgs), + ConstructorArgs, /*HadMultipleCandidates*/ false, /*ZeroInit*/ false, CXXConstructExpr::CK_Complete, @@ -3774,7 +3769,7 @@ ExprResult Sema::ActOnExpressionTrait(ExpressionTrait ET, ExprResult Result = BuildExpressionTrait(ET, KWLoc, Queried, RParen); - return move(Result); + return Result; } static bool EvaluateExpressionTrait(ExpressionTrait ET, Expr *E) { @@ -4056,14 +4051,14 @@ static bool FindConditionalOverload(Sema &Self, ExprResult &LHS, ExprResult &RHS Best->Conversions[0], Sema::AA_Converting); if (LHSRes.isInvalid()) break; - LHS = move(LHSRes); + LHS = LHSRes; ExprResult RHSRes = Self.PerformImplicitConversion(RHS.get(), Best->BuiltinTypes.ParamTypes[1], Best->Conversions[1], Sema::AA_Converting); if (RHSRes.isInvalid()) break; - RHS = move(RHSRes); + RHS = RHSRes; if (Best->Function) Self.MarkFunctionReferenced(QuestionLoc, Best->Function); return false; @@ -4129,7 +4124,7 @@ QualType Sema::CXXCheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, ExprResult CondRes = CheckCXXBooleanCondition(Cond.take()); if (CondRes.isInvalid()) return QualType(); - Cond = move(CondRes); + Cond = CondRes; } // Assume r-value. @@ -4991,7 +4986,7 @@ Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, // type C (or of pointer to a class type C), the unqualified-id is looked // up in the scope of class C. [...] ObjectType = ParsedType::make(BaseType); - return move(Base); + return Base; } ExprResult Sema::DiagnoseDtorReference(SourceLocation NameLoc, diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp index 8f445e28648d..ec787d67a3f5 100644 --- a/clang/lib/Sema/SemaExprMember.cpp +++ b/clang/lib/Sema/SemaExprMember.cpp @@ -656,7 +656,7 @@ Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType, } if (Result.get()) - return move(Result); + return Result; // LookupMemberExpr can modify Base, and thus change BaseType BaseType = Base->getType(); @@ -1550,7 +1550,7 @@ ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base, Id.getKind() == UnqualifiedId::IK_DestructorName) return DiagnoseDtorReference(NameInfo.getLoc(), Result.get()); - return move(Result); + return Result; } ActOnMemberAccessExtraArgs ExtraArgs = {S, Id, ObjCImpDecl, HasTrailingLParen}; @@ -1560,7 +1560,7 @@ ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base, false, &ExtraArgs); } - return move(Result); + return Result; } static ExprResult diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 7c19a136474a..88f884e0aa75 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -1788,7 +1788,7 @@ ExprResult Sema::ActOnSuperMessage(Scope *S, SuperTy = Context.getObjCObjectPointerType(SuperTy); return BuildInstanceMessage(0, SuperTy, SuperLoc, Sel, /*Method=*/0, - LBracLoc, SelectorLocs, RBracLoc, move(Args)); + LBracLoc, SelectorLocs, RBracLoc, Args); } // Since we are in a class method, this is a class message to @@ -1796,7 +1796,7 @@ ExprResult Sema::ActOnSuperMessage(Scope *S, return BuildClassMessage(/*ReceiverTypeInfo=*/0, Context.getObjCInterfaceType(Super), SuperLoc, Sel, /*Method=*/0, - LBracLoc, SelectorLocs, RBracLoc, move(Args)); + LBracLoc, SelectorLocs, RBracLoc, Args); } @@ -1911,7 +1911,7 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, // If the receiver type is dependent, we can't type-check anything // at this point. Build a dependent expression. unsigned NumArgs = ArgsIn.size(); - Expr **Args = reinterpret_cast(ArgsIn.release()); + Expr **Args = ArgsIn.get(); assert(SuperLoc.isInvalid() && "Message to super with dependent type"); return Owned(ObjCMessageExpr::Create(Context, ReceiverType, VK_RValue, LBracLoc, ReceiverTypeInfo, @@ -1965,7 +1965,7 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, ExprValueKind VK = VK_RValue; unsigned NumArgs = ArgsIn.size(); - Expr **Args = reinterpret_cast(ArgsIn.release()); + Expr **Args = ArgsIn.get(); if (CheckMessageArgumentTypes(ReceiverType, Args, NumArgs, Sel, Method, true, SuperLoc.isValid(), LBracLoc, RBracLoc, ReturnType, VK)) @@ -2016,7 +2016,7 @@ ExprResult Sema::ActOnClassMessage(Scope *S, return BuildClassMessage(ReceiverTypeInfo, ReceiverType, /*SuperLoc=*/SourceLocation(), Sel, /*Method=*/0, - LBracLoc, SelectorLocs, RBracLoc, move(Args)); + LBracLoc, SelectorLocs, RBracLoc, Args); } ExprResult Sema::BuildInstanceMessageImplicit(Expr *Receiver, @@ -2095,7 +2095,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, // If the receiver is type-dependent, we can't type-check anything // at this point. Build a dependent expression. unsigned NumArgs = ArgsIn.size(); - Expr **Args = reinterpret_cast(ArgsIn.release()); + Expr **Args = ArgsIn.get(); assert(SuperLoc.isInvalid() && "Message to super with dependent type"); return Owned(ObjCMessageExpr::Create(Context, Context.DependentTy, VK_RValue, LBracLoc, Receiver, Sel, @@ -2282,7 +2282,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, LBracLoc, SelectorLocs, RBracLoc, - move(ArgsIn)); + ArgsIn); } else { // Reject other random receiver types (e.g. structs). Diag(Loc, diag::err_bad_receiver_type) @@ -2295,7 +2295,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, // Check the message arguments. unsigned NumArgs = ArgsIn.size(); - Expr **Args = reinterpret_cast(ArgsIn.release()); + Expr **Args = ArgsIn.get(); QualType ReturnType; ExprValueKind VK = VK_RValue; bool ClassMessage = (ReceiverType->isObjCClassType() || @@ -2448,7 +2448,7 @@ ExprResult Sema::ActOnInstanceMessage(Scope *S, return BuildInstanceMessage(Receiver, Receiver->getType(), /*SuperLoc=*/SourceLocation(), Sel, /*Method=*/0, - LBracLoc, SelectorLocs, RBracLoc, move(Args)); + LBracLoc, SelectorLocs, RBracLoc, Args); } enum ARCConversionTypeClass { diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index ee32c6bd8bd1..35442eb7d1c7 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -4413,7 +4413,7 @@ static ExprResult CopyObject(Sema &S, if (const RecordType *Record = T->getAs()) Class = cast(Record->getDecl()); if (!Class) - return move(CurInit); + return CurInit; // C++0x [class.copy]p32: // When certain criteria are met, an implementation is allowed to @@ -4435,7 +4435,7 @@ static ExprResult CopyObject(Sema &S, // Make sure that the type we are copying is complete. if (S.RequireCompleteType(Loc, T, diag::err_temp_copy_incomplete)) - return move(CurInit); + return CurInit; // Perform overload resolution using the class's copy/move constructors. // Only consider constructors and constructor templates. Per @@ -4460,7 +4460,7 @@ static ExprResult CopyObject(Sema &S, CandidateSet.NoteCandidates(S, OCD_AllCandidates, CurInitExpr); if (!IsExtraneousCopy || S.isSFINAEContext()) return ExprError(); - return move(CurInit); + return CurInit; case OR_Ambiguous: S.Diag(Loc, diag::err_temp_copy_ambiguous) @@ -4521,7 +4521,7 @@ static ExprResult CopyObject(Sema &S, // Actually perform the constructor call. CurInit = S.BuildCXXConstructExpr(Loc, T, Constructor, Elidable, - move_arg(ConstructorArgs), + ConstructorArgs, HadMultipleCandidates, /*ZeroInit*/ false, CXXConstructExpr::CK_Complete, @@ -4530,7 +4530,7 @@ static ExprResult CopyObject(Sema &S, // If we're supposed to bind temporaries, do so. if (!CurInit.isInvalid() && shouldBindAsTemporary(Entity)) CurInit = S.MaybeBindToTemporary(CurInit.takeAs()); - return move(CurInit); + return CurInit; } /// \brief Check whether elidable copy construction for binding a reference to @@ -4648,7 +4648,7 @@ PerformConstructorInitialization(Sema &S, // Determine the arguments required to actually perform the constructor // call. - if (S.CompleteConstructorCall(Constructor, move(Args), + if (S.CompleteConstructorCall(Constructor, Args, Loc, ConstructorArgs, AllowExplicitConv)) return ExprError(); @@ -4702,7 +4702,7 @@ PerformConstructorInitialization(Sema &S, if (Entity.allowsNRVO()) CurInit = S.BuildCXXConstructExpr(Loc, Entity.getType(), Constructor, /*Elidable=*/true, - move_arg(ConstructorArgs), + ConstructorArgs, HadMultipleCandidates, ConstructorInitRequiresZeroInit, ConstructKind, @@ -4710,7 +4710,7 @@ PerformConstructorInitialization(Sema &S, else CurInit = S.BuildCXXConstructExpr(Loc, Entity.getType(), Constructor, - move_arg(ConstructorArgs), + ConstructorArgs, HadMultipleCandidates, ConstructorInitRequiresZeroInit, ConstructKind, @@ -4727,7 +4727,7 @@ PerformConstructorInitialization(Sema &S, if (shouldBindAsTemporary(Entity)) CurInit = S.MaybeBindToTemporary(CurInit.takeAs()); - return move(CurInit); + return CurInit; } /// Determine whether the specified InitializedEntity definitely has a lifetime @@ -4775,7 +4775,7 @@ InitializationSequence::Perform(Sema &S, QualType *ResultType) { if (Failed()) { unsigned NumArgs = Args.size(); - Diagnose(S, Entity, Kind, (Expr **)Args.release(), NumArgs); + Diagnose(S, Entity, Kind, Args.get(), NumArgs); return ExprError(); } @@ -4795,7 +4795,7 @@ InitializationSequence::Perform(Sema &S, // introduced and such). So, we fall back to making the array // type a dependently-sized array type with no specified // bound. - if (isa((Expr *)Args.get()[0])) { + if (isa((Expr *)Args[0])) { SourceRange Brackets; // Scavange the location of the brackets from the entity, if we can. @@ -4823,12 +4823,12 @@ InitializationSequence::Perform(Sema &S, // Rebuild the ParenListExpr. SourceRange ParenRange = Kind.getParenRange(); return S.ActOnParenListExpr(ParenRange.getBegin(), ParenRange.getEnd(), - move(Args)); + Args); } assert(Kind.getKind() == InitializationKind::IK_Copy || Kind.isExplicitCast() || Kind.getKind() == InitializationKind::IK_DirectList); - return ExprResult(Args.release()[0]); + return ExprResult(Args[0]); } // No steps means no initialization. @@ -4836,22 +4836,22 @@ InitializationSequence::Perform(Sema &S, return S.Owned((Expr *)0); if (S.getLangOpts().CPlusPlus0x && Entity.getType()->isReferenceType() && - Args.size() == 1 && isa(Args.get()[0]) && + Args.size() == 1 && isa(Args[0]) && Entity.getKind() != InitializedEntity::EK_Parameter) { // Produce a C++98 compatibility warning if we are initializing a reference // from an initializer list. For parameters, we produce a better warning // elsewhere. - Expr *Init = Args.get()[0]; + Expr *Init = Args[0]; S.Diag(Init->getLocStart(), diag::warn_cxx98_compat_reference_list_init) << Init->getSourceRange(); } // Diagnose cases where we initialize a pointer to an array temporary, and the // pointer obviously outlives the temporary. - if (Args.size() == 1 && Args.get()[0]->getType()->isArrayType() && + if (Args.size() == 1 && Args[0]->getType()->isArrayType() && Entity.getType()->isPointerType() && InitializedEntityOutlivesFullExpression(Entity)) { - Expr *Init = Args.get()[0]; + Expr *Init = Args[0]; Expr::LValueClassification Kind = Init->ClassifyLValue(S.Context); if (Kind == Expr::LV_ClassTemporary || Kind == Expr::LV_ArrayTemporary) S.Diag(Init->getLocStart(), diag::warn_temporary_array_to_pointer_decay) @@ -4897,7 +4897,7 @@ InitializationSequence::Perform(Sema &S, case SK_ProduceObjCObject: case SK_StdInitializerList: { assert(Args.size() == 1); - CurInit = Args.get()[0]; + CurInit = Args[0]; if (!CurInit.get()) return ExprError(); break; } @@ -4924,7 +4924,7 @@ InitializationSequence::Perform(Sema &S, // initializer to reflect that choice. S.CheckAddressOfMemberAccess(CurInit.get(), Step->Function.FoundDecl); S.DiagnoseUseOfDecl(Step->Function.FoundDecl, Kind.getLocation()); - CurInit = S.FixOverloadedFunctionReference(move(CurInit), + CurInit = S.FixOverloadedFunctionReference(CurInit, Step->Function.FoundDecl, Step->Function.Function); break; @@ -5016,7 +5016,7 @@ InitializationSequence::Perform(Sema &S, break; case SK_ExtraneousCopyToTemporary: - CurInit = CopyObject(S, Step->Type, Entity, move(CurInit), + CurInit = CopyObject(S, Step->Type, Entity, CurInit, /*IsExtraneousCopy=*/true); break; @@ -5045,7 +5045,7 @@ InitializationSequence::Perform(Sema &S, // Build an expression that constructs a temporary. CurInit = S.BuildCXXConstructExpr(Loc, Step->Type, Constructor, - move_arg(ConstructorArgs), + ConstructorArgs, HadMultipleCandidates, /*ZeroInit*/ false, CXXConstructExpr::CK_Complete, @@ -5079,7 +5079,7 @@ InitializationSequence::Perform(Sema &S, FoundFn, Conversion); if(CurInitExprRes.isInvalid()) return ExprError(); - CurInit = move(CurInitExprRes); + CurInit = CurInitExprRes; // Build the actual call to the conversion function. CurInit = S.BuildCXXMemberCallExpr(CurInit.get(), FoundFn, Conversion, @@ -5115,7 +5115,7 @@ InitializationSequence::Perform(Sema &S, CurInit = S.MaybeBindToTemporary(CurInit.takeAs()); if (RequiresCopy) CurInit = CopyObject(S, Entity.getType().getNonReferenceType(), Entity, - move(CurInit), /*IsExtraneousCopy=*/false); + CurInit, /*IsExtraneousCopy=*/false); break; } @@ -5144,7 +5144,7 @@ InitializationSequence::Perform(Sema &S, getAssignmentAction(Entity), CCK); if (CurInitExprRes.isInvalid()) return ExprError(); - CurInit = move(CurInitExprRes); + CurInit = CurInitExprRes; break; } @@ -5195,13 +5195,13 @@ InitializationSequence::Perform(Sema &S, Entity.getType().getNonReferenceType()); bool UseTemporary = Entity.getType()->isReferenceType(); assert(Args.size() == 1 && "expected a single argument for list init"); - InitListExpr *InitList = cast(Args.get()[0]); + InitListExpr *InitList = cast(Args[0]); S.Diag(InitList->getExprLoc(), diag::warn_cxx98_compat_ctor_list_init) << InitList->getSourceRange(); MultiExprArg Arg(InitList->getInits(), InitList->getNumInits()); CurInit = PerformConstructorInitialization(S, UseTemporary ? TempEntity : Entity, - Kind, move(Arg), *Step, + Kind, Arg, *Step, ConstructorInitRequiresZeroInit); break; } @@ -5234,7 +5234,7 @@ InitializationSequence::Perform(Sema &S, bool UseTemporary = Entity.getType()->isReferenceType(); CurInit = PerformConstructorInitialization(S, UseTemporary ? TempEntity : Entity, - Kind, move(Args), *Step, + Kind, Args, *Step, ConstructorInitRequiresZeroInit); break; } @@ -5268,15 +5268,15 @@ InitializationSequence::Perform(Sema &S, case SK_CAssignment: { QualType SourceType = CurInit.get()->getType(); - ExprResult Result = move(CurInit); + ExprResult Result = CurInit; Sema::AssignConvertType ConvTy = S.CheckSingleAssignmentConstraints(Step->Type, Result); if (Result.isInvalid()) return ExprError(); - CurInit = move(Result); + CurInit = Result; // If this is a call, allow conversion to a transparent union. - ExprResult CurInitExprRes = move(CurInit); + ExprResult CurInitExprRes = CurInit; if (ConvTy != Sema::Compatible && Entity.getKind() == InitializedEntity::EK_Parameter && S.CheckTransparentUnionArgumentConstraints(Step->Type, CurInitExprRes) @@ -5284,7 +5284,7 @@ InitializationSequence::Perform(Sema &S, ConvTy = Sema::Compatible; if (CurInitExprRes.isInvalid()) return ExprError(); - CurInit = move(CurInitExprRes); + CurInit = CurInitExprRes; bool Complained; if (S.DiagnoseAssignmentResult(ConvTy, Kind.getLocation(), @@ -5415,7 +5415,7 @@ InitializationSequence::Perform(Sema &S, cast(Entity.getDecl()), CurInit.get()); - return move(CurInit); + return CurInit; } //===----------------------------------------------------------------------===// diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index efc5b6eb0d5a..4c23e4a54239 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -49,7 +49,7 @@ CreateFunctionRefExpr(Sema &S, FunctionDecl *Fn, bool HadMultipleCandidates, E = S.DefaultFunctionArrayConversion(E.take()); if (E.isInvalid()) return ExprError(); - return move(E); + return E; } static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType, @@ -10312,7 +10312,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc, if (Result.isInvalid()) CandidateSet.NoteCandidates(*this, OCD_AllCandidates, Args, BinaryOperator::getOpcodeStr(Opc), OpLoc); - return move(Result); + return Result; } case OR_Ambiguous: @@ -11008,7 +11008,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj, if (ObjRes.isInvalid()) IsError = true; else - Object = move(ObjRes); + Object = ObjRes; TheCall->setArg(0, Object.take()); // Check the argument types. diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 8367c1a22042..2113a66cd9e0 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -254,7 +254,7 @@ StmtResult Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R, MultiStmtArg elts, bool isStmtExpr) { unsigned NumElts = elts.size(); - Stmt **Elts = reinterpret_cast(elts.release()); + Stmt **Elts = elts.get(); // If we're in C89 mode, check that we don't have any decls after stmts. If // so, emit an extension diagnostic. if (!getLangOpts().C99 && !getLangOpts().CPlusPlus) { @@ -2539,7 +2539,7 @@ Sema::ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, getCurFunction()->setHasBranchProtectedScope(); unsigned NumCatchStmts = CatchStmts.size(); return Owned(ObjCAtTryStmt::Create(Context, AtLoc, Try, - CatchStmts.release(), + CatchStmts.get(), NumCatchStmts, Finally)); } diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 229d8c0a1659..61e002a7c836 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -2140,7 +2140,6 @@ Sema::ActOnTemplateIdType(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, } QualType Result = CheckTemplateIdType(Template, TemplateLoc, TemplateArgs); - TemplateArgsIn.release(); if (Result.isNull()) return true; @@ -4527,7 +4526,7 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, assert(!RefExpr.isInvalid() && Context.hasSameType(((Expr*) RefExpr.get())->getType(), ParamType.getUnqualifiedType())); - return move(RefExpr); + return RefExpr; } } @@ -4545,7 +4544,7 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, if (RefExpr.isInvalid()) return ExprError(); - return move(RefExpr); + return RefExpr; } // Take the address of everything else @@ -5176,7 +5175,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, // NOTE: KWLoc is the location of the tag keyword. This will instead // store the location of the outermost template keyword in the declaration. SourceLocation TemplateKWLoc = TemplateParameterLists.size() > 0 - ? TemplateParameterLists.get()[0]->getTemplateLoc() : SourceLocation(); + ? TemplateParameterLists[0]->getTemplateLoc() : SourceLocation(); // Find the class template we're specializing TemplateName Name = TemplateD.getAsVal(); @@ -5357,7 +5356,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, if (TemplateParameterLists.size() > 0) { Specialization->setTemplateParameterListsInfo(Context, TemplateParameterLists.size(), - (TemplateParameterList**) TemplateParameterLists.release()); + (TemplateParameterList**) TemplateParameterLists.get()); } PrevDecl = 0; CanonType = Context.getTypeDeclType(Specialization); @@ -5385,7 +5384,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TemplateParams, AS_none, /*ModulePrivateLoc=*/SourceLocation(), TemplateParameterLists.size() - 1, - (TemplateParameterList**) TemplateParameterLists.release()); + (TemplateParameterList**) TemplateParameterLists.get()); } // Create a new class template partial specialization declaration node. @@ -5409,7 +5408,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, if (TemplateParameterLists.size() > 1 && SS.isSet()) { Partial->setTemplateParameterListsInfo(Context, TemplateParameterLists.size() - 1, - (TemplateParameterList**) TemplateParameterLists.release()); + (TemplateParameterList**) TemplateParameterLists.get()); } if (!PrevPartial) @@ -5464,7 +5463,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, if (TemplateParameterLists.size() > 0) { Specialization->setTemplateParameterListsInfo(Context, TemplateParameterLists.size(), - (TemplateParameterList**) TemplateParameterLists.release()); + (TemplateParameterList**) TemplateParameterLists.get()); } if (!PrevDecl) @@ -5547,7 +5546,6 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, Specialization->setTypeAsWritten(WrittenTy); Specialization->setTemplateKeywordLoc(TemplateKWLoc); } - TemplateArgsIn.release(); // C++ [temp.expl.spec]p9: // A template explicit specialization is in the scope of the @@ -5582,7 +5580,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, Decl *Sema::ActOnTemplateDeclarator(Scope *S, MultiTemplateParamsArg TemplateParameterLists, Declarator &D) { - Decl *NewDecl = HandleDeclarator(S, D, move(TemplateParameterLists)); + Decl *NewDecl = HandleDeclarator(S, D, TemplateParameterLists); ActOnDocumentableDecl(NewDecl); return NewDecl; } @@ -5601,7 +5599,7 @@ Decl *Sema::ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope, D.setFunctionDefinitionKind(FDK_Definition); Decl *DP = HandleDeclarator(ParentScope, D, - move(TemplateParameterLists)); + TemplateParameterLists); if (FunctionTemplateDecl *FunctionTemplate = dyn_cast_or_null(DP)) return ActOnStartOfFunctionDef(FnBodyScope, @@ -6402,7 +6400,6 @@ Sema::ActOnExplicitInstantiation(Scope *S, TemplateArgs, Context.getTypeDeclType(Specialization)); Specialization->setTypeAsWritten(WrittenTy); - TemplateArgsIn.release(); // Set source locations for keywords. Specialization->setExternLoc(ExternLoc); @@ -6737,7 +6734,6 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S, TemplateId->NumArgs); translateTemplateArguments(TemplateArgsPtr, TemplateArgs); HasExplicitTemplateArgs = true; - TemplateArgsPtr.release(); } // C++ [temp.explicit]p1: diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 20e755fdaee1..d3367c4ee90a 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -835,7 +835,7 @@ namespace { ExprResult Result = TreeTransform::TransformCallExpr(CE); getSema().CallsUndergoingInstantiation.pop_back(); - return move(Result); + return Result; } ExprResult TransformLambdaExpr(LambdaExpr *E) { diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index bdbe71dd8aba..e73463483b36 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -3043,7 +3043,7 @@ ExprResult Sema::SubstInitializer(Expr *Init, // Build a ParenListExpr to represent anything else. // FIXME: Fake locations! SourceLocation Loc = PP.getLocForEndOfToken(Init->getLocStart()); - return ActOnParenListExpr(Loc, Loc, move_arg(NewArgs)); + return ActOnParenListExpr(Loc, Loc, NewArgs); } // TODO: this could be templated if the various decl types used the diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 391c0b3f3b5e..32c765e3e327 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -1174,7 +1174,7 @@ public: MultiExprArg Clobbers, SourceLocation RParenLoc) { return getSema().ActOnAsmStmt(AsmLoc, IsSimple, IsVolatile, NumOutputs, - NumInputs, Names, move(Constraints), + NumInputs, Names, Constraints, Exprs, AsmString, Clobbers, RParenLoc); } @@ -1198,7 +1198,7 @@ public: Stmt *TryBody, MultiStmtArg CatchStmts, Stmt *Finally) { - return getSema().ActOnObjCAtTryStmt(AtLoc, TryBody, move(CatchStmts), + return getSema().ActOnObjCAtTryStmt(AtLoc, TryBody, CatchStmts, Finally); } @@ -1324,7 +1324,7 @@ public: StmtResult RebuildCXXTryStmt(SourceLocation TryLoc, Stmt *TryBlock, MultiStmtArg Handlers) { - return getSema().ActOnCXXTryBlock(TryLoc, TryBlock, move(Handlers)); + return getSema().ActOnCXXTryBlock(TryLoc, TryBlock, Handlers); } /// \brief Build a new C++0x range-based for statement. @@ -1477,7 +1477,7 @@ public: if (Result.isInvalid()) return ExprError(); - return move(Result); + return Result; } /// \brief Build a new array subscript expression. @@ -1502,7 +1502,7 @@ public: SourceLocation RParenLoc, Expr *ExecConfig = 0) { return getSema().ActOnCallExpr(/*Scope=*/0, Callee, LParenLoc, - move(Args), RParenLoc, ExecConfig); + Args, RParenLoc, ExecConfig); } /// \brief Build a new member access expression. @@ -1637,15 +1637,15 @@ public: SourceLocation RBraceLoc, QualType ResultTy) { ExprResult Result - = SemaRef.ActOnInitList(LBraceLoc, move(Inits), RBraceLoc); + = SemaRef.ActOnInitList(LBraceLoc, Inits, RBraceLoc); if (Result.isInvalid() || ResultTy->isDependentType()) - return move(Result); + return Result; // Patch in the result type we were given, which may have been computed // when the initial InitListExpr was built. InitListExpr *ILE = cast((Expr *)Result.get()); ILE->setType(ResultTy); - return move(Result); + return Result; } /// \brief Build a new designated initializer expression. @@ -1663,8 +1663,7 @@ public: if (Result.isInvalid()) return ExprError(); - ArrayExprs.release(); - return move(Result); + return Result; } /// \brief Build a new value-initialized expression. @@ -1695,7 +1694,7 @@ public: ExprResult RebuildParenListExpr(SourceLocation LParenLoc, MultiExprArg SubExprs, SourceLocation RParenLoc) { - return getSema().ActOnParenListExpr(LParenLoc, RParenLoc, move(SubExprs)); + return getSema().ActOnParenListExpr(LParenLoc, RParenLoc, SubExprs); } /// \brief Build a new address-of-label expression. @@ -1994,7 +1993,7 @@ public: Expr *Initializer) { return getSema().BuildCXXNew(StartLoc, UseGlobal, PlacementLParen, - move(PlacementArgs), + PlacementArgs, PlacementRParen, TypeIdParens, AllocatedType, @@ -2120,12 +2119,12 @@ public: CXXConstructExpr::ConstructionKind ConstructKind, SourceRange ParenRange) { ASTOwningVector ConvertedArgs(SemaRef); - if (getSema().CompleteConstructorCall(Constructor, move(Args), Loc, + if (getSema().CompleteConstructorCall(Constructor, Args, Loc, ConvertedArgs)) return ExprError(); return getSema().BuildCXXConstructExpr(Loc, T, Constructor, IsElidable, - move_arg(ConvertedArgs), + ConvertedArgs, HadMultipleCandidates, RequiresZeroInit, ConstructKind, ParenRange); @@ -2141,7 +2140,7 @@ public: SourceLocation RParenLoc) { return getSema().BuildCXXTypeConstructExpr(TSInfo, LParenLoc, - move(Args), + Args, RParenLoc); } @@ -2155,7 +2154,7 @@ public: SourceLocation RParenLoc) { return getSema().BuildCXXTypeConstructExpr(TSInfo, LParenLoc, - move(Args), + Args, RParenLoc); } @@ -2287,7 +2286,7 @@ public: ReceiverTypeInfo->getType(), /*SuperLoc=*/SourceLocation(), Sel, Method, LBracLoc, SelectorLocs, - RBracLoc, move(Args)); + RBracLoc, Args); } /// \brief Build a new Objective-C instance message. @@ -2302,7 +2301,7 @@ public: Receiver->getType(), /*SuperLoc=*/SourceLocation(), Sel, Method, LBracLoc, SelectorLocs, - RBracLoc, move(Args)); + RBracLoc, Args); } /// \brief Build a new Objective-C ivar reference expression. @@ -2325,7 +2324,7 @@ public: return ExprError(); if (Result.get()) - return move(Result); + return Result; return getSema().BuildMemberReferenceExpr(Base.get(), Base.get()->getType(), /*FIXME:*/IvarLoc, IsArrow, @@ -2354,7 +2353,7 @@ public: return ExprError(); if (Result.get()) - return move(Result); + return Result; return getSema().BuildMemberReferenceExpr(Base.get(), Base.get()->getType(), /*FIXME:*/PropertyLoc, IsArrow, @@ -2397,7 +2396,7 @@ public: return ExprError(); if (Result.get()) - return move(Result); + return Result; return getSema().BuildMemberReferenceExpr(Base.get(), Base.get()->getType(), /*FIXME:*/IsaLoc, IsArrow, @@ -2433,7 +2432,7 @@ public: // Build the CallExpr unsigned NumSubExprs = SubExprs.size(); - Expr **Subs = (Expr **)SubExprs.release(); + Expr **Subs = SubExprs.get(); ExprResult TheCall = SemaRef.Owned( new (SemaRef.Context) CallExpr(SemaRef.Context, Callee.take(), Subs, NumSubExprs, @@ -2515,7 +2514,7 @@ public: // analysis here because we can't actually build an AtomicExpr until // we are sure it is semantically sound. unsigned NumSubExprs = SubExprs.size(); - Expr **Subs = (Expr **)SubExprs.release(); + Expr **Subs = SubExprs.get(); return new (SemaRef.Context) AtomicExpr(BuiltinLoc, Subs, NumSubExprs, RetTy, Op, RParenLoc); @@ -5125,7 +5124,7 @@ TreeTransform::TransformCompoundStmt(CompoundStmt *S, return SemaRef.Owned(S); return getDerived().RebuildCompoundStmt(S->getLBracLoc(), - move_arg(Statements), + Statements, S->getRBracLoc(), IsStmtExpr); } @@ -5595,10 +5594,10 @@ TreeTransform::TransformAsmStmt(AsmStmt *S) { S->getNumOutputs(), S->getNumInputs(), Names.data(), - move_arg(Constraints), - move_arg(Exprs), + Constraints, + Exprs, AsmString.get(), - move_arg(Clobbers), + Clobbers, S->getRParenLoc()); } @@ -5649,7 +5648,7 @@ TreeTransform::TransformObjCAtTryStmt(ObjCAtTryStmt *S) { // Build a new statement. return getDerived().RebuildObjCAtTryStmt(S->getAtTryLoc(), TryBody.get(), - move_arg(CatchStmts), Finally.get()); + CatchStmts, Finally.get()); } template @@ -5870,7 +5869,7 @@ TreeTransform::TransformCXXTryStmt(CXXTryStmt *S) { return SemaRef.Owned(S); return getDerived().RebuildCXXTryStmt(S->getTryLoc(), TryBlock.get(), - move_arg(Handlers)); + Handlers); } template @@ -6398,7 +6397,7 @@ TreeTransform::TransformCallExpr(CallExpr *E) { SourceLocation FakeLParenLoc = ((Expr *)Callee.get())->getSourceRange().getBegin(); return getDerived().RebuildCallExpr(Callee.get(), FakeLParenLoc, - move_arg(Args), + Args, E->getRParenLoc()); } @@ -6651,7 +6650,7 @@ TreeTransform::TransformInitListExpr(InitListExpr *E) { if (!getDerived().AlwaysRebuild() && !InitChanged) return SemaRef.Owned(E); - return getDerived().RebuildInitList(E->getLBraceLoc(), move_arg(Inits), + return getDerived().RebuildInitList(E->getLBraceLoc(), Inits, E->getRBraceLoc(), E->getType()); } @@ -6718,7 +6717,7 @@ TreeTransform::TransformDesignatedInitExpr(DesignatedInitExpr *E) { !ExprChanged) return SemaRef.Owned(E); - return getDerived().RebuildDesignatedInitExpr(Desig, move_arg(ArrayExprs), + return getDerived().RebuildDesignatedInitExpr(Desig, ArrayExprs, E->getEqualOrColonLoc(), E->usesGNUSyntax(), Init.get()); } @@ -6772,7 +6771,7 @@ TreeTransform::TransformParenListExpr(ParenListExpr *E) { return ExprError(); return getDerived().RebuildParenListExpr(E->getLParenLoc(), - move_arg(Inits), + Inits, E->getRParenLoc()); } @@ -6879,7 +6878,7 @@ TreeTransform::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) { return ExprError(); return getDerived().RebuildCallExpr(Object.get(), FakeLParenLoc, - move_arg(Args), + Args, E->getLocEnd()); } @@ -6962,7 +6961,7 @@ TreeTransform::TransformCUDAKernelCallExpr(CUDAKernelCallExpr *E) { SourceLocation FakeLParenLoc = ((Expr *)Callee.get())->getSourceRange().getBegin(); return getDerived().RebuildCallExpr(Callee.get(), FakeLParenLoc, - move_arg(Args), + Args, E->getRParenLoc(), EC.get()); } @@ -7311,7 +7310,7 @@ TreeTransform::TransformCXXNewExpr(CXXNewExpr *E) { return getDerived().RebuildCXXNewExpr(E->getLocStart(), E->isGlobalNew(), /*FIXME:*/E->getLocStart(), - move_arg(PlacementArgs), + PlacementArgs, /*FIXME:*/E->getLocStart(), E->getTypeIdParens(), AllocType, @@ -7811,7 +7810,7 @@ TreeTransform::TransformCXXConstructExpr(CXXConstructExpr *E) { return getDerived().RebuildCXXConstructExpr(T, /*FIXME:*/E->getLocStart(), Constructor, E->isElidable(), - move_arg(Args), + Args, E->hadMultipleCandidates(), E->requiresZeroInitialization(), E->getConstructionKind(), @@ -7872,7 +7871,7 @@ TreeTransform::TransformCXXTemporaryObjectExpr( return getDerived().RebuildCXXTemporaryObjectExpr(T, /*FIXME:*/T->getTypeLoc().getEndLoc(), - move_arg(Args), + Args, E->getLocEnd()); } @@ -8050,7 +8049,7 @@ TreeTransform::TransformCXXUnresolvedConstructExpr( // FIXME: we're faking the locations of the commas return getDerived().RebuildCXXUnresolvedConstructExpr(T, E->getLParenLoc(), - move_arg(Args), + Args, E->getRParenLoc()); } @@ -8600,7 +8599,7 @@ TreeTransform::TransformObjCMessageExpr(ObjCMessageExpr *E) { SelLocs, E->getMethodDecl(), E->getLeftLoc(), - move_arg(Args), + Args, E->getRightLoc()); } @@ -8625,7 +8624,7 @@ TreeTransform::TransformObjCMessageExpr(ObjCMessageExpr *E) { SelLocs, E->getMethodDecl(), E->getLeftLoc(), - move_arg(Args), + Args, E->getRightLoc()); } @@ -8749,7 +8748,7 @@ TreeTransform::TransformShuffleVectorExpr(ShuffleVectorExpr *E) { return SemaRef.Owned(E); return getDerived().RebuildShuffleVectorExpr(E->getBuiltinLoc(), - move_arg(SubExprs), + SubExprs, E->getRParenLoc()); } @@ -8862,7 +8861,7 @@ TreeTransform::TransformAtomicExpr(AtomicExpr *E) { !ArgumentChanged) return SemaRef.Owned(E); - return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), move_arg(SubExprs), + return getDerived().RebuildAtomicExpr(E->getBuiltinLoc(), SubExprs, RetTy, E->getOp(), E->getRParenLoc()); } @@ -9183,7 +9182,7 @@ TreeTransform::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op, if (Result.isInvalid()) return ExprError(); - return move(Result); + return Result; } } @@ -9238,7 +9237,7 @@ TreeTransform::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op, if (Result.isInvalid()) return ExprError(); - return move(Result); + return Result; } template