From owner-svn-src-projects@freebsd.org Wed Jan 6 20:20:50 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 533E5A661FD for ; Wed, 6 Jan 2016 20:20:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0A7919E7; Wed, 6 Jan 2016 20:20:49 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u06KKnOK088323; Wed, 6 Jan 2016 20:20:49 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u06KKmfW088316; Wed, 6 Jan 2016 20:20:48 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201601062020.u06KKmfW088316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 6 Jan 2016 20:20:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r293266 - in projects/clang380-import/contrib/llvm/tools/clang: include/clang/AST include/clang/Basic include/clang/Driver include/clang/Frontend include/clang/Sema lib/AST lib/Basic li... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2016 20:20:50 -0000 Author: dim Date: Wed Jan 6 20:20:48 2016 New Revision: 293266 URL: https://svnweb.freebsd.org/changeset/base/293266 Log: Update clang to trunk r256945. Added: projects/clang380-import/contrib/llvm/tools/clang/lib/Headers/pkuintrin.h - copied unchanged from r293265, vendor/clang/dist/lib/Headers/pkuintrin.h Modified: projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/DeclarationName.h projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/Expr.h projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/ExprCXX.h projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/ExprObjC.h projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/Mangle.h projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/OpenMPClause.h projects/clang380-import/contrib/llvm/tools/clang/include/clang/Basic/Builtins.h projects/clang380-import/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def projects/clang380-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticDriverKinds.td projects/clang380-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticParseKinds.td projects/clang380-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td projects/clang380-import/contrib/llvm/tools/clang/include/clang/Basic/LangOptions.def projects/clang380-import/contrib/llvm/tools/clang/include/clang/Basic/LangOptions.h projects/clang380-import/contrib/llvm/tools/clang/include/clang/Basic/OpenMPKinds.def projects/clang380-import/contrib/llvm/tools/clang/include/clang/Driver/CC1Options.td projects/clang380-import/contrib/llvm/tools/clang/include/clang/Driver/Options.td projects/clang380-import/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h projects/clang380-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h projects/clang380-import/contrib/llvm/tools/clang/include/clang/Sema/TemplateDeduction.h projects/clang380-import/contrib/llvm/tools/clang/lib/AST/ASTContext.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/AST/Expr.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/AST/ExprCXX.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/AST/ExprObjC.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/AST/OpenMPClause.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Basic/Builtins.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Basic/LangOptions.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Basic/Targets.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/CodeGen/CGCall.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/CodeGen/CGObjCMac.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.h projects/clang380-import/contrib/llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/CodeGen/CGVTables.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.h projects/clang380-import/contrib/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/CodeGen/CodeGenModule.h projects/clang380-import/contrib/llvm/tools/clang/lib/CodeGen/CodeGenPGO.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/CodeGen/CoverageMappingGen.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Driver/Driver.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Driver/Tools.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Driver/Tools.h projects/clang380-import/contrib/llvm/tools/clang/lib/Format/ContinuationIndenter.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Format/FormatToken.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Format/FormatToken.h projects/clang380-import/contrib/llvm/tools/clang/lib/Format/TokenAnnotator.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Frontend/CodeGenOptions.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Headers/ia32intrin.h projects/clang380-import/contrib/llvm/tools/clang/lib/Headers/immintrin.h projects/clang380-import/contrib/llvm/tools/clang/lib/Parse/ParseExpr.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Parse/ParseStmtAsm.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Sema/SemaChecking.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Sema/SemaExprObjC.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Sema/SemaOpenMP.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Sema/SemaStmtAsm.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplateDeduction.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Serialization/ASTReader.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Serialization/ASTReaderStmt.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/Serialization/ASTWriter.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp projects/clang380-import/contrib/llvm/tools/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp projects/clang380-import/contrib/llvm/tools/clang/utils/TableGen/TableGen.cpp Directory Properties: projects/clang380-import/contrib/llvm/tools/clang/ (props changed) Modified: projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/DeclarationName.h ============================================================================== --- projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/DeclarationName.h Wed Jan 6 20:19:13 2016 (r293265) +++ projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/DeclarationName.h Wed Jan 6 20:20:48 2016 (r293266) @@ -395,7 +395,7 @@ struct DeclarationNameLoc { // Locations (if any) for the tilde (destructor) or operator keyword // (conversion) are stored elsewhere. struct NT { - TypeSourceInfo* TInfo; + TypeSourceInfo *TInfo; }; // The location (if any) of the operator keyword is stored elsewhere. Modified: projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/Expr.h ============================================================================== --- projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/Expr.h Wed Jan 6 20:19:13 2016 (r293265) +++ projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/Expr.h Wed Jan 6 20:20:48 2016 (r293266) @@ -2190,7 +2190,8 @@ public: return reinterpret_cast(SubExprs+getNumPreArgs()+PREARGS_START); } const Expr *const *getArgs() const { - return const_cast(this)->getArgs(); + return reinterpret_cast(SubExprs + getNumPreArgs() + + PREARGS_START); } /// getArg - Return the specified argument. @@ -3926,7 +3927,9 @@ public: /// which covers @c [2].y=1.0. This DesignatedInitExpr will have two /// designators, one array designator for @c [2] followed by one field /// designator for @c .y. The initialization expression will be 1.0. -class DesignatedInitExpr : public Expr { +class DesignatedInitExpr final + : public Expr, + private llvm::TrailingObjects { public: /// \brief Forward declaration of the Designator class. class Designator; @@ -4206,12 +4209,12 @@ public: Expr *getSubExpr(unsigned Idx) const { assert(Idx < NumSubExprs && "Subscript out of range"); - return cast(reinterpret_cast(this + 1)[Idx]); + return cast(getTrailingObjects()[Idx]); } void setSubExpr(unsigned Idx, Expr *E) { assert(Idx < NumSubExprs && "Subscript out of range"); - reinterpret_cast(this + 1)[Idx] = E; + getTrailingObjects()[Idx] = E; } /// \brief Replaces the designator at index @p Idx with the series @@ -4230,9 +4233,11 @@ public: // Iterators child_range children() { - Stmt **begin = reinterpret_cast(this + 1); + Stmt **begin = getTrailingObjects(); return child_range(begin, begin + NumSubExprs); } + + friend TrailingObjects; }; /// \brief Represents a place-holder for an object not to be initialized by @@ -4683,7 +4688,9 @@ public: /// equivalent to a particular message send, and this is very much /// part of the user model. The name of this class encourages this /// modelling design. -class PseudoObjectExpr : public Expr { +class PseudoObjectExpr final + : public Expr, + private llvm::TrailingObjects { // PseudoObjectExprBits.NumSubExprs - The number of sub-expressions. // Always at least two, because the first sub-expression is the // syntactic form. @@ -4695,13 +4702,11 @@ class PseudoObjectExpr : public Expr { // in to Create, which is an index within the semantic forms. // Note also that ASTStmtWriter assumes this encoding. - Expr **getSubExprsBuffer() { return reinterpret_cast(this + 1); } + Expr **getSubExprsBuffer() { return getTrailingObjects(); } const Expr * const *getSubExprsBuffer() const { - return reinterpret_cast(this + 1); + return getTrailingObjects(); } - friend class ASTStmtReader; - PseudoObjectExpr(QualType type, ExprValueKind VK, Expr *syntactic, ArrayRef semantic, unsigned resultIndex); @@ -4798,6 +4803,9 @@ public: static bool classof(const Stmt *T) { return T->getStmtClass() == PseudoObjectExprClass; } + + friend TrailingObjects; + friend class ASTStmtReader; }; /// AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, Modified: projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/ExprCXX.h ============================================================================== --- projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/ExprCXX.h Wed Jan 6 20:19:13 2016 (r293265) +++ projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/ExprCXX.h Wed Jan 6 20:20:48 2016 (r293266) @@ -951,7 +951,9 @@ public: /// This wraps up a function call argument that was created from the /// corresponding parameter's default argument, when the call did not /// explicitly supply arguments for all of the parameters. -class CXXDefaultArgExpr : public Expr { +class CXXDefaultArgExpr final + : public Expr, + private llvm::TrailingObjects { /// \brief The parameter whose default is being used. /// /// When the bit is set, the subexpression is stored after the @@ -977,7 +979,7 @@ class CXXDefaultArgExpr : public Expr { SubExpr->getValueKind(), SubExpr->getObjectKind(), false, false, false, false), Param(param, true), Loc(Loc) { - *reinterpret_cast(this + 1) = SubExpr; + *getTrailingObjects() = SubExpr; } public: @@ -1002,12 +1004,12 @@ public: // Retrieve the actual argument to the function call. const Expr *getExpr() const { if (Param.getInt()) - return *reinterpret_cast (this + 1); + return *getTrailingObjects(); return getParam()->getDefaultArg(); } Expr *getExpr() { if (Param.getInt()) - return *reinterpret_cast (this + 1); + return *getTrailingObjects(); return getParam()->getDefaultArg(); } @@ -1031,6 +1033,7 @@ public: return child_range(child_iterator(), child_iterator()); } + friend TrailingObjects; friend class ASTStmtReader; friend class ASTStmtWriter; }; @@ -1441,7 +1444,9 @@ public: /// C++1y introduces a new form of "capture" called an init-capture that /// includes an initializing expression (rather than capturing a variable), /// and which can never occur implicitly. -class LambdaExpr : public Expr { +class LambdaExpr final + : public Expr, + private llvm::TrailingObjects { /// \brief The source range that covers the lambda introducer ([...]). SourceRange IntroducerRange; @@ -1476,23 +1481,21 @@ class LambdaExpr : public Expr { /// module file just to determine the source range. SourceLocation ClosingBrace; - // Note: The capture initializers are stored directly after the lambda - // expression, along with the index variables used to initialize by-copy - // array captures. + size_t numTrailingObjects(OverloadToken) const { + return NumCaptures + 1; + } - typedef LambdaCapture Capture; + size_t numTrailingObjects(OverloadToken) const { + return HasArrayIndexVars ? NumCaptures + 1 : 0; + } /// \brief Construct a lambda expression. LambdaExpr(QualType T, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, - SourceLocation CaptureDefaultLoc, - ArrayRef Captures, - bool ExplicitParams, - bool ExplicitResultType, - ArrayRef CaptureInits, - ArrayRef ArrayIndexVars, - ArrayRef ArrayIndexStarts, - SourceLocation ClosingBrace, + SourceLocation CaptureDefaultLoc, ArrayRef Captures, + bool ExplicitParams, bool ExplicitResultType, + ArrayRef CaptureInits, ArrayRef ArrayIndexVars, + ArrayRef ArrayIndexStarts, SourceLocation ClosingBrace, bool ContainsUnexpandedParameterPack); /// \brief Construct an empty lambda expression. @@ -1503,53 +1506,35 @@ class LambdaExpr : public Expr { getStoredStmts()[NumCaptures] = nullptr; } - Stmt **getStoredStmts() { return reinterpret_cast(this + 1); } + Stmt **getStoredStmts() { return getTrailingObjects(); } - Stmt *const *getStoredStmts() const { - return reinterpret_cast(this + 1); - } + Stmt *const *getStoredStmts() const { return getTrailingObjects(); } /// \brief Retrieve the mapping from captures to the first array index /// variable. - unsigned *getArrayIndexStarts() { - return reinterpret_cast(getStoredStmts() + NumCaptures + 1); - } + unsigned *getArrayIndexStarts() { return getTrailingObjects(); } const unsigned *getArrayIndexStarts() const { - return reinterpret_cast(getStoredStmts() + NumCaptures + - 1); + return getTrailingObjects(); } /// \brief Retrieve the complete set of array-index variables. - VarDecl **getArrayIndexVars() { - unsigned ArrayIndexSize = llvm::RoundUpToAlignment( - sizeof(unsigned) * (NumCaptures + 1), llvm::alignOf()); - return reinterpret_cast( - reinterpret_cast(getArrayIndexStarts()) + ArrayIndexSize); - } + VarDecl **getArrayIndexVars() { return getTrailingObjects(); } VarDecl *const *getArrayIndexVars() const { - unsigned ArrayIndexSize = llvm::RoundUpToAlignment( - sizeof(unsigned) * (NumCaptures + 1), llvm::alignOf()); - return reinterpret_cast( - reinterpret_cast(getArrayIndexStarts()) + ArrayIndexSize); + return getTrailingObjects(); } public: /// \brief Construct a new lambda expression. - static LambdaExpr *Create(const ASTContext &C, - CXXRecordDecl *Class, - SourceRange IntroducerRange, - LambdaCaptureDefault CaptureDefault, - SourceLocation CaptureDefaultLoc, - ArrayRef Captures, - bool ExplicitParams, - bool ExplicitResultType, - ArrayRef CaptureInits, - ArrayRef ArrayIndexVars, - ArrayRef ArrayIndexStarts, - SourceLocation ClosingBrace, - bool ContainsUnexpandedParameterPack); + static LambdaExpr * + Create(const ASTContext &C, CXXRecordDecl *Class, SourceRange IntroducerRange, + LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, + ArrayRef Captures, bool ExplicitParams, + bool ExplicitResultType, ArrayRef CaptureInits, + ArrayRef ArrayIndexVars, + ArrayRef ArrayIndexStarts, SourceLocation ClosingBrace, + bool ContainsUnexpandedParameterPack); /// \brief Construct a new lambda expression that will be deserialized from /// an external source. @@ -1572,7 +1557,7 @@ public: /// \brief An iterator that walks over the captures of the lambda, /// both implicit and explicit. - typedef const Capture *capture_iterator; + typedef const LambdaCapture *capture_iterator; /// \brief An iterator over a range of lambda captures. typedef llvm::iterator_range capture_range; @@ -1709,9 +1694,11 @@ public: SourceLocation getLocEnd() const LLVM_READONLY { return ClosingBrace; } child_range children() { + // Includes initialization exprs plus body stmt return child_range(getStoredStmts(), getStoredStmts() + NumCaptures + 1); } + friend TrailingObjects; friend class ASTStmtReader; friend class ASTStmtWriter; }; @@ -2226,7 +2213,9 @@ public: /// __is_enum(std::string) == false /// __is_trivially_constructible(vector, int*, int*) /// \endcode -class TypeTraitExpr : public Expr { +class TypeTraitExpr final + : public Expr, + private llvm::TrailingObjects { /// \brief The location of the type trait keyword. SourceLocation Loc; @@ -2243,16 +2232,10 @@ class TypeTraitExpr : public Expr { TypeTraitExpr(EmptyShell Empty) : Expr(TypeTraitExprClass, Empty) { } - /// \brief Retrieve the argument types. - TypeSourceInfo **getTypeSourceInfos() { - return reinterpret_cast(this+1); - } - - /// \brief Retrieve the argument types. - TypeSourceInfo * const *getTypeSourceInfos() const { - return reinterpret_cast(this+1); + size_t numTrailingObjects(OverloadToken) const { + return getNumArgs(); } - + public: /// \brief Create a new type trait expression. static TypeTraitExpr *Create(const ASTContext &C, QualType T, @@ -2284,22 +2267,9 @@ public: } /// \brief Retrieve the argument types. - ArrayRef getArgs() const { - return llvm::makeArrayRef(getTypeSourceInfos(), getNumArgs()); - } - - typedef TypeSourceInfo **arg_iterator; - arg_iterator arg_begin() { - return getTypeSourceInfos(); - } - arg_iterator arg_end() { - return getTypeSourceInfos() + getNumArgs(); - } - - typedef TypeSourceInfo const * const *arg_const_iterator; - arg_const_iterator arg_begin() const { return getTypeSourceInfos(); } - arg_const_iterator arg_end() const { - return getTypeSourceInfos() + getNumArgs(); + ArrayRef getArgs() const { + return llvm::makeArrayRef(getTrailingObjects(), + getNumArgs()); } SourceLocation getLocStart() const LLVM_READONLY { return Loc; } @@ -2314,9 +2284,9 @@ public: return child_range(child_iterator(), child_iterator()); } + friend TrailingObjects; friend class ASTStmtReader; friend class ASTStmtWriter; - }; /// \brief An Embarcadero array type trait, as used in the implementation of @@ -2899,7 +2869,9 @@ public: /// This expression also tracks whether the sub-expression contains a /// potentially-evaluated block literal. The lifetime of a block /// literal is the extent of the enclosing scope. -class ExprWithCleanups : public Expr { +class ExprWithCleanups final + : public Expr, + private llvm::TrailingObjects { public: /// The type of objects that are kept in the cleanup. /// It's useful to remember the set of blocks; we could also @@ -2913,12 +2885,7 @@ private: ExprWithCleanups(EmptyShell, unsigned NumObjects); ExprWithCleanups(Expr *SubExpr, ArrayRef Objects); - CleanupObject *getObjectsBuffer() { - return reinterpret_cast(this + 1); - } - const CleanupObject *getObjectsBuffer() const { - return reinterpret_cast(this + 1); - } + friend TrailingObjects; friend class ASTStmtReader; public: @@ -2929,7 +2896,8 @@ public: ArrayRef objects); ArrayRef getObjects() const { - return llvm::makeArrayRef(getObjectsBuffer(), getNumObjects()); + return llvm::makeArrayRef(getTrailingObjects(), + getNumObjects()); } unsigned getNumObjects() const { return ExprWithCleanupsBits.NumObjects; } @@ -2981,7 +2949,9 @@ public: /// When the returned expression is instantiated, it may resolve to a /// constructor call, conversion function call, or some kind of type /// conversion. -class CXXUnresolvedConstructExpr : public Expr { +class CXXUnresolvedConstructExpr final + : public Expr, + private llvm::TrailingObjects { /// \brief The type being constructed. TypeSourceInfo *Type; @@ -3002,6 +2972,7 @@ class CXXUnresolvedConstructExpr : publi CXXUnresolvedConstructExpr(EmptyShell Empty, unsigned NumArgs) : Expr(CXXUnresolvedConstructExprClass, Empty), Type(), NumArgs(NumArgs) { } + friend TrailingObjects; friend class ASTStmtReader; public: @@ -3036,13 +3007,11 @@ public: unsigned arg_size() const { return NumArgs; } typedef Expr** arg_iterator; - arg_iterator arg_begin() { return reinterpret_cast(this + 1); } + arg_iterator arg_begin() { return getTrailingObjects(); } arg_iterator arg_end() { return arg_begin() + NumArgs; } typedef const Expr* const * const_arg_iterator; - const_arg_iterator arg_begin() const { - return reinterpret_cast(this + 1); - } + const_arg_iterator arg_begin() const { return getTrailingObjects(); } const_arg_iterator arg_end() const { return arg_begin() + NumArgs; } @@ -3075,7 +3044,7 @@ public: // Iterators child_range children() { - Stmt **begin = reinterpret_cast(this+1); + Stmt **begin = reinterpret_cast(arg_begin()); return child_range(begin, begin + NumArgs); } }; @@ -3608,7 +3577,9 @@ public: /// static const unsigned value = sizeof...(Types); /// }; /// \endcode -class SizeOfPackExpr : public Expr { +class SizeOfPackExpr final + : public Expr, + private llvm::TrailingObjects { /// \brief The location of the \c sizeof keyword. SourceLocation OperatorLoc; @@ -3633,6 +3604,7 @@ class SizeOfPackExpr : public Expr { /// \brief The parameter pack. NamedDecl *Pack; + friend TrailingObjects; friend class ASTStmtReader; friend class ASTStmtWriter; @@ -3649,7 +3621,7 @@ class SizeOfPackExpr : public Expr { Length(Length ? *Length : PartialArgs.size()), Pack(Pack) { assert((!Length || PartialArgs.empty()) && "have partial args for non-dependent sizeof... expression"); - TemplateArgument *Args = reinterpret_cast(this + 1); + TemplateArgument *Args = getTrailingObjects(); std::uninitialized_copy(PartialArgs.begin(), PartialArgs.end(), Args); } @@ -3700,8 +3672,7 @@ public: /// \brief Get ArrayRef getPartialArguments() const { assert(isPartiallySubstituted()); - const TemplateArgument *Args = - reinterpret_cast(this + 1); + const TemplateArgument *Args = getTrailingObjects(); return llvm::makeArrayRef(Args, Args + Length); } @@ -3837,7 +3808,9 @@ public: /// }; /// template struct S; /// \endcode -class FunctionParmPackExpr : public Expr { +class FunctionParmPackExpr final + : public Expr, + private llvm::TrailingObjects { /// \brief The function parameter pack which was referenced. ParmVarDecl *ParamPack; @@ -3851,6 +3824,7 @@ class FunctionParmPackExpr : public Expr SourceLocation NameLoc, unsigned NumParams, ParmVarDecl *const *Params); + friend TrailingObjects; friend class ASTReader; friend class ASTStmtReader; @@ -3871,7 +3845,7 @@ public: /// \brief Iterators over the parameters which the parameter pack expanded /// into. typedef ParmVarDecl * const *iterator; - iterator begin() const { return reinterpret_cast(this+1); } + iterator begin() const { return getTrailingObjects(); } iterator end() const { return begin() + NumParameters; } /// \brief Get the number of parameters in this parameter pack. Modified: projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/ExprObjC.h ============================================================================== --- projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/ExprObjC.h Wed Jan 6 20:19:13 2016 (r293265) +++ projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/ExprObjC.h Wed Jan 6 20:20:48 2016 (r293266) @@ -141,15 +141,17 @@ public: /// ObjCArrayLiteral - used for objective-c array containers; as in: /// @[@"Hello", NSApp, [NSNumber numberWithInt:42]]; -class ObjCArrayLiteral : public Expr { +class ObjCArrayLiteral final + : public Expr, + private llvm::TrailingObjects { unsigned NumElements; SourceRange Range; ObjCMethodDecl *ArrayWithObjectsMethod; - + ObjCArrayLiteral(ArrayRef Elements, QualType T, ObjCMethodDecl * Method, SourceRange SR); - + explicit ObjCArrayLiteral(EmptyShell Empty, unsigned NumElements) : Expr(ObjCArrayLiteralClass, Empty), NumElements(NumElements) {} @@ -171,11 +173,11 @@ public: } /// \brief Retrieve elements of array of literals. - Expr **getElements() { return reinterpret_cast(this + 1); } + Expr **getElements() { return getTrailingObjects(); } /// \brief Retrieve elements of array of literals. - const Expr * const *getElements() const { - return reinterpret_cast(this + 1); + const Expr * const *getElements() const { + return getTrailingObjects(); } /// getNumElements - Return number of elements of objective-c array literal. @@ -196,11 +198,12 @@ public: } // Iterators - child_range children() { - return child_range((Stmt **)getElements(), - (Stmt **)getElements() + NumElements); + child_range children() { + return child_range(reinterpret_cast(getElements()), + reinterpret_cast(getElements()) + NumElements); } - + + friend TrailingObjects; friend class ASTStmtReader; }; @@ -230,32 +233,35 @@ template <> struct isPodLike { /// \brief The number of elements in this dictionary literal. unsigned NumElements : 31; - + /// \brief Determine whether this dictionary literal has any pack expansions. /// /// If the dictionary literal has pack expansions, then there will @@ -264,10 +270,17 @@ class ObjCDictionaryLiteral : public Exp /// any) and number of elements in the expansion (if known). If /// there are no pack expansions, we optimize away this storage. unsigned HasPackExpansions : 1; - + SourceRange Range; ObjCMethodDecl *DictWithObjectsMethod; - + + typedef ObjCDictionaryLiteral_KeyValuePair KeyValuePair; + typedef ObjCDictionaryLiteral_ExpansionData ExpansionData; + + size_t numTrailingObjects(OverloadToken) const { + return NumElements; + } + ObjCDictionaryLiteral(ArrayRef VK, bool HasPackExpansions, QualType T, ObjCMethodDecl *method, @@ -278,28 +291,6 @@ class ObjCDictionaryLiteral : public Exp : Expr(ObjCDictionaryLiteralClass, Empty), NumElements(NumElements), HasPackExpansions(HasPackExpansions) {} - KeyValuePair *getKeyValues() { - return reinterpret_cast(this + 1); - } - - const KeyValuePair *getKeyValues() const { - return reinterpret_cast(this + 1); - } - - ExpansionData *getExpansionData() { - if (!HasPackExpansions) - return nullptr; - - return reinterpret_cast(getKeyValues() + NumElements); - } - - const ExpansionData *getExpansionData() const { - if (!HasPackExpansions) - return nullptr; - - return reinterpret_cast(getKeyValues()+NumElements); - } - public: static ObjCDictionaryLiteral *Create(const ASTContext &C, ArrayRef VK, @@ -317,10 +308,11 @@ public: ObjCDictionaryElement getKeyValueElement(unsigned Index) const { assert((Index < NumElements) && "Arg access out of range!"); - const KeyValuePair &KV = getKeyValues()[Index]; + const KeyValuePair &KV = getTrailingObjects()[Index]; ObjCDictionaryElement Result = { KV.Key, KV.Value, SourceLocation(), None }; if (HasPackExpansions) { - const ExpansionData &Expansion = getExpansionData()[Index]; + const ExpansionData &Expansion = + getTrailingObjects()[Index]; Result.EllipsisLoc = Expansion.EllipsisLoc; if (Expansion.NumExpansionsPlusOne > 0) Result.NumExpansions = Expansion.NumExpansionsPlusOne - 1; @@ -340,17 +332,20 @@ public: } // Iterators - child_range children() { + child_range children() { // Note: we're taking advantage of the layout of the KeyValuePair struct // here. If that struct changes, this code will need to change as well. static_assert(sizeof(KeyValuePair) == sizeof(Stmt *) * 2, "KeyValuePair is expected size"); - return child_range(reinterpret_cast(this + 1), - reinterpret_cast(this + 1) + NumElements * 2); + return child_range( + reinterpret_cast(getTrailingObjects()), + reinterpret_cast(getTrailingObjects()) + + NumElements * 2); } friend class ASTStmtReader; friend class ASTStmtWriter; + friend TrailingObjects; }; @@ -797,13 +792,6 @@ public: explicit ObjCSubscriptRefExpr(EmptyShell Empty) : Expr(ObjCSubscriptRefExprClass, Empty) {} - static ObjCSubscriptRefExpr *Create(const ASTContext &C, - Expr *base, - Expr *key, QualType T, - ObjCMethodDecl *getMethod, - ObjCMethodDecl *setMethod, - SourceLocation RB); - SourceLocation getRBracket() const { return RBracket; } void setRBracket(SourceLocation RB) { RBracket = RB; } @@ -865,7 +853,13 @@ private: /// All four kinds of message sends are modeled by the ObjCMessageExpr /// class, and can be distinguished via \c getReceiverKind(). Example: /// -class ObjCMessageExpr : public Expr { +/// The "void *" trailing objects are actually ONE void * (the +/// receiver pointer), and NumArgs Expr *. But due to the +/// implementation of children(), these must be together contiguously. + +class ObjCMessageExpr final + : public Expr, + private llvm::TrailingObjects { /// \brief Stores either the selector that this message is sending /// to (when \c HasMethod is zero) or an \c ObjCMethodDecl pointer /// referring to the method that we type-checked against. @@ -877,11 +871,6 @@ class ObjCMessageExpr : public Expr { /// including the receiver. unsigned NumArgs : NumArgsBitWidth; - void setNumArgs(unsigned Num) { - assert((Num >> NumArgsBitWidth) == 0 && "Num of args is out of range!"); - NumArgs = Num; - } - /// \brief The kind of message send this is, which is one of the /// ReceiverKind values. /// @@ -915,6 +904,13 @@ class ObjCMessageExpr : public Expr { /// brackets ('[' and ']', respectively). SourceLocation LBracLoc, RBracLoc; + size_t numTrailingObjects(OverloadToken) const { return NumArgs + 1; } + + void setNumArgs(unsigned Num) { + assert((Num >> NumArgsBitWidth) == 0 && "Num of args is out of range!"); + NumArgs = Num; + } + ObjCMessageExpr(EmptyShell Empty, unsigned NumArgs) : Expr(ObjCMessageExprClass, Empty), SelectorOrMethod(0), Kind(0), HasMethod(0), IsDelegateInitCall(0), IsImplicit(0), SelLocsKind(0) { @@ -959,14 +955,11 @@ class ObjCMessageExpr : public Expr { SelectorLocationsKind SelLocsK); /// \brief Retrieve the pointer value of the message receiver. - void *getReceiverPointer() const { - return *const_cast( - reinterpret_cast(this + 1)); - } + void *getReceiverPointer() const { return *getTrailingObjects(); } /// \brief Set the pointer value of the message receiver. void setReceiverPointer(void *Value) { - *reinterpret_cast(this + 1) = Value; + *getTrailingObjects() = Value; } SelectorLocationsKind getSelLocsKind() const { @@ -979,10 +972,10 @@ class ObjCMessageExpr : public Expr { /// \brief Get a pointer to the stored selector identifiers locations array. /// No locations will be stored if HasStandardSelLocs is true. SourceLocation *getStoredSelLocs() { - return reinterpret_cast(getArgs() + getNumArgs()); + return getTrailingObjects(); } const SourceLocation *getStoredSelLocs() const { - return reinterpret_cast(getArgs() + getNumArgs()); + return getTrailingObjects(); } /// \brief Get the number of stored selector identifiers locations. @@ -1286,20 +1279,21 @@ public: /// \brief Retrieve the arguments to this message, not including the /// receiver. Expr **getArgs() { - return reinterpret_cast(this + 1) + 1; + return reinterpret_cast(getTrailingObjects() + 1); } const Expr * const *getArgs() const { - return reinterpret_cast(this + 1) + 1; + return reinterpret_cast(getTrailingObjects() + + 1); } /// getArg - Return the specified argument. Expr *getArg(unsigned Arg) { assert(Arg < NumArgs && "Arg access out of range!"); - return cast(getArgs()[Arg]); + return getArgs()[Arg]; } const Expr *getArg(unsigned Arg) const { assert(Arg < NumArgs && "Arg access out of range!"); - return cast(getArgs()[Arg]); + return getArgs()[Arg]; } /// setArg - Set the specified argument. void setArg(unsigned Arg, Expr *ArgExpr) { @@ -1379,6 +1373,7 @@ public: return reinterpret_cast(getArgs() + NumArgs); } + friend TrailingObjects; friend class ASTStmtReader; friend class ASTStmtWriter; }; Modified: projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/Mangle.h ============================================================================== --- projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/Mangle.h Wed Jan 6 20:19:13 2016 (r293265) +++ projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/Mangle.h Wed Jan 6 20:20:48 2016 (r293266) @@ -216,9 +216,6 @@ public: uint32_t NVOffset, int32_t VBPtrOffset, uint32_t VBIndex, raw_ostream &Out) = 0; - virtual void mangleCXXCatchHandlerType(QualType T, uint32_t Flags, - raw_ostream &Out) = 0; - virtual void mangleCXXRTTIBaseClassDescriptor( const CXXRecordDecl *Derived, uint32_t NVOffset, int32_t VBPtrOffset, uint32_t VBTableOffset, uint32_t Flags, raw_ostream &Out) = 0; Modified: projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/OpenMPClause.h ============================================================================== --- projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/OpenMPClause.h Wed Jan 6 20:19:13 2016 (r293265) +++ projects/clang380-import/contrib/llvm/tools/clang/include/clang/AST/OpenMPClause.h Wed Jan 6 20:20:48 2016 (r293266) @@ -84,21 +84,15 @@ protected: /// \brief Fetches list of variables associated with this clause. MutableArrayRef getVarRefs() { return MutableArrayRef( - reinterpret_cast( - reinterpret_cast(this) + - llvm::RoundUpToAlignment(sizeof(T), llvm::alignOf())), - NumVars); + static_cast(this)->template getTrailingObjects(), NumVars); } /// \brief Sets the list of variables for this clause. void setVarRefs(ArrayRef VL) { assert(VL.size() == NumVars && "Number of variables is not the same as the preallocated buffer"); - std::copy( - VL.begin(), VL.end(), - reinterpret_cast( - reinterpret_cast(this) + - llvm::RoundUpToAlignment(sizeof(T), llvm::alignOf()))); + std::copy(VL.begin(), VL.end(), + static_cast(this)->template getTrailingObjects()); } /// \brief Build a clause with \a N variables @@ -142,9 +136,7 @@ public: /// \brief Fetches list of all variables in the clause. ArrayRef getVarRefs() const { return llvm::makeArrayRef( - reinterpret_cast( - reinterpret_cast(this) + - llvm::RoundUpToAlignment(sizeof(T), llvm::alignOf())), + static_cast(this)->template getTrailingObjects(), NumVars); } }; @@ -1160,7 +1152,11 @@ public: /// In this example directive '#pragma omp parallel' has clause 'private' /// with the variables 'a' and 'b'. /// -class OMPPrivateClause : public OMPVarListClause { +class OMPPrivateClause final + : public OMPVarListClause, + private llvm::TrailingObjects { + friend TrailingObjects; + friend OMPVarListClause; friend class OMPClauseReader; /// \brief Build clause with number of variables \a N. /// @@ -1252,7 +1248,11 @@ public: /// In this example directive '#pragma omp parallel' has clause 'firstprivate' /// with the variables 'a' and 'b'. /// -class OMPFirstprivateClause : public OMPVarListClause { +class OMPFirstprivateClause final + : public OMPVarListClause, + private llvm::TrailingObjects { + friend TrailingObjects; + friend OMPVarListClause; friend class OMPClauseReader; /// \brief Build clause with number of variables \a N. @@ -1372,7 +1372,9 @@ public: /// \endcode /// In this example directive '#pragma omp simd' has clause 'lastprivate' /// with the variables 'a' and 'b'. -class OMPLastprivateClause : public OMPVarListClause { +class OMPLastprivateClause final + : public OMPVarListClause, + private llvm::TrailingObjects { // There are 4 additional tail-allocated arrays at the end of the class: // 1. Contains list of pseudo variables with the default initialization for // each non-firstprivate variables. Used in codegen for initialization of @@ -1390,6 +1392,8 @@ class OMPLastprivateClause : public OMPV // Required for proper codegen of final assignment performed by the // lastprivate clause. // + friend TrailingObjects; + friend OMPVarListClause; friend class OMPClauseReader; /// \brief Build clause with number of variables \a N. @@ -1557,7 +1561,11 @@ public: /// In this example directive '#pragma omp parallel' has clause 'shared' /// with the variables 'a' and 'b'. /// -class OMPSharedClause : public OMPVarListClause { +class OMPSharedClause final + : public OMPVarListClause, + private llvm::TrailingObjects { + friend TrailingObjects; + friend OMPVarListClause; /// \brief Build clause with number of variables \a N. /// /// \param StartLoc Starting location of the clause. @@ -1617,7 +1625,11 @@ public: /// In this example directive '#pragma omp parallel' has clause 'reduction' /// with operator '+' and the variables 'a' and 'b'. /// -class OMPReductionClause : public OMPVarListClause { +class OMPReductionClause final + : public OMPVarListClause, + private llvm::TrailingObjects { + friend TrailingObjects; + friend OMPVarListClause; friend class OMPClauseReader; /// \brief Location of ':'. SourceLocation ColonLoc; @@ -1819,7 +1831,11 @@ public: /// In this example directive '#pragma omp simd' has clause 'linear' /// with variables 'a', 'b' and linear step '2'. /// -class OMPLinearClause : public OMPVarListClause { +class OMPLinearClause final + : public OMPVarListClause, + private llvm::TrailingObjects { + friend TrailingObjects; + friend OMPVarListClause; friend class OMPClauseReader; /// \brief Modifier of 'linear' clause. OpenMPLinearClauseKind Modifier; @@ -2039,7 +2055,11 @@ public: /// In this example directive '#pragma omp simd' has clause 'aligned' /// with variables 'a', 'b' and alignment '8'. /// -class OMPAlignedClause : public OMPVarListClause { +class OMPAlignedClause final + : public OMPVarListClause, + private llvm::TrailingObjects { + friend TrailingObjects; + friend OMPVarListClause; friend class OMPClauseReader; /// \brief Location of ':'. SourceLocation ColonLoc; @@ -2123,7 +2143,9 @@ public: /// In this example directive '#pragma omp parallel' has clause 'copyin' /// with the variables 'a' and 'b'. /// -class OMPCopyinClause : public OMPVarListClause { +class OMPCopyinClause final + : public OMPVarListClause, + private llvm::TrailingObjects { // Class has 3 additional tail allocated arrays: // 1. List of helper expressions for proper generation of assignment operation // required for copyin clause. This list represents sources. @@ -2137,6 +2159,8 @@ class OMPCopyinClause : public OMPVarLis // threadprivate variables to local instances of that variables in other // implicit threads. + friend TrailingObjects; + friend OMPVarListClause; friend class OMPClauseReader; /// \brief Build clause with number of variables \a N. /// @@ -2282,7 +2306,11 @@ public: /// In this example directive '#pragma omp single' has clause 'copyprivate' /// with the variables 'a' and 'b'. /// -class OMPCopyprivateClause : public OMPVarListClause { +class OMPCopyprivateClause final + : public OMPVarListClause, + private llvm::TrailingObjects { + friend TrailingObjects; + friend OMPVarListClause; friend class OMPClauseReader; /// \brief Build clause with number of variables \a N. /// @@ -2431,7 +2459,11 @@ public: /// In this example directive '#pragma omp flush' has implicit clause 'flush' /// with the variables 'a' and 'b'. /// -class OMPFlushClause : public OMPVarListClause { +class OMPFlushClause final + : public OMPVarListClause, + private llvm::TrailingObjects { *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***