Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Jan 2016 20:02:26 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r293250 - in vendor/clang/dist: . cmake/caches include/clang/AST include/clang/Basic include/clang/Driver include/clang/Frontend include/clang/Sema lib/AST lib/Basic lib/CodeGen lib/Dri...
Message-ID:  <201601062002.u06K2QpX084165@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Jan  6 20:02:26 2016
New Revision: 293250
URL: https://svnweb.freebsd.org/changeset/base/293250

Log:
  Vendor import of clang trunk r256945:
  https://llvm.org/svn/llvm-project/cfe/trunk@256945

Added:
  vendor/clang/dist/cmake/caches/PGO-stage2-instrumented.cmake
  vendor/clang/dist/cmake/caches/PGO-stage2.cmake
  vendor/clang/dist/cmake/caches/PGO.cmake
  vendor/clang/dist/lib/Headers/pkuintrin.h   (contents, props changed)
  vendor/clang/dist/test/Analysis/Inputs/qt-simulator.h   (contents, props changed)
  vendor/clang/dist/test/Analysis/qt_malloc.cpp   (contents, props changed)
  vendor/clang/dist/test/CodeGen/pku.c   (contents, props changed)
  vendor/clang/dist/test/CodeGenCXX/optnone-and-attributes.cpp   (contents, props changed)
  vendor/clang/dist/test/CodeGenCXX/optnone-class-members.cpp   (contents, props changed)
  vendor/clang/dist/test/CodeGenCXX/optnone-templates.cpp   (contents, props changed)
  vendor/clang/dist/test/Driver/ps4-analyzer-defaults.cpp   (contents, props changed)
  vendor/clang/dist/test/Modules/tag-injection.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/schedule_codegen.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_codegen_registration.cpp   (contents, props changed)
  vendor/clang/dist/test/OpenMP/target_codegen_registration_naming.cpp   (contents, props changed)
Deleted:
  vendor/clang/dist/test/Profile/c-attributes.c
Modified:
  vendor/clang/dist/CMakeLists.txt
  vendor/clang/dist/include/clang/AST/DeclarationName.h
  vendor/clang/dist/include/clang/AST/Expr.h
  vendor/clang/dist/include/clang/AST/ExprCXX.h
  vendor/clang/dist/include/clang/AST/ExprObjC.h
  vendor/clang/dist/include/clang/AST/Mangle.h
  vendor/clang/dist/include/clang/AST/OpenMPClause.h
  vendor/clang/dist/include/clang/Basic/Builtins.h
  vendor/clang/dist/include/clang/Basic/BuiltinsX86.def
  vendor/clang/dist/include/clang/Basic/DiagnosticDriverKinds.td
  vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td
  vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td
  vendor/clang/dist/include/clang/Basic/LangOptions.def
  vendor/clang/dist/include/clang/Basic/LangOptions.h
  vendor/clang/dist/include/clang/Basic/OpenMPKinds.def
  vendor/clang/dist/include/clang/Driver/CC1Options.td
  vendor/clang/dist/include/clang/Driver/Options.td
  vendor/clang/dist/include/clang/Frontend/CodeGenOptions.h
  vendor/clang/dist/include/clang/Sema/Sema.h
  vendor/clang/dist/include/clang/Sema/TemplateDeduction.h
  vendor/clang/dist/lib/AST/ASTContext.cpp
  vendor/clang/dist/lib/AST/Expr.cpp
  vendor/clang/dist/lib/AST/ExprCXX.cpp
  vendor/clang/dist/lib/AST/ExprObjC.cpp
  vendor/clang/dist/lib/AST/MicrosoftMangle.cpp
  vendor/clang/dist/lib/AST/OpenMPClause.cpp
  vendor/clang/dist/lib/Basic/Builtins.cpp
  vendor/clang/dist/lib/Basic/LangOptions.cpp
  vendor/clang/dist/lib/Basic/Targets.cpp
  vendor/clang/dist/lib/CodeGen/BackendUtil.cpp
  vendor/clang/dist/lib/CodeGen/CGCall.cpp
  vendor/clang/dist/lib/CodeGen/CGObjCMac.cpp
  vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp
  vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h
  vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp
  vendor/clang/dist/lib/CodeGen/CGVTables.cpp
  vendor/clang/dist/lib/CodeGen/CodeGenFunction.h
  vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp
  vendor/clang/dist/lib/CodeGen/CodeGenModule.h
  vendor/clang/dist/lib/CodeGen/CodeGenPGO.cpp
  vendor/clang/dist/lib/CodeGen/CoverageMappingGen.cpp
  vendor/clang/dist/lib/Driver/Driver.cpp
  vendor/clang/dist/lib/Driver/ToolChains.cpp
  vendor/clang/dist/lib/Driver/Tools.cpp
  vendor/clang/dist/lib/Driver/Tools.h
  vendor/clang/dist/lib/Format/ContinuationIndenter.cpp
  vendor/clang/dist/lib/Format/FormatToken.cpp
  vendor/clang/dist/lib/Format/FormatToken.h
  vendor/clang/dist/lib/Format/TokenAnnotator.cpp
  vendor/clang/dist/lib/Frontend/CodeGenOptions.cpp
  vendor/clang/dist/lib/Frontend/CompilerInvocation.cpp
  vendor/clang/dist/lib/Headers/CMakeLists.txt
  vendor/clang/dist/lib/Headers/ia32intrin.h
  vendor/clang/dist/lib/Headers/immintrin.h
  vendor/clang/dist/lib/Parse/ParseExpr.cpp
  vendor/clang/dist/lib/Parse/ParseStmtAsm.cpp
  vendor/clang/dist/lib/Sema/SemaChecking.cpp
  vendor/clang/dist/lib/Sema/SemaDecl.cpp
  vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp
  vendor/clang/dist/lib/Sema/SemaExprObjC.cpp
  vendor/clang/dist/lib/Sema/SemaOpenMP.cpp
  vendor/clang/dist/lib/Sema/SemaOverload.cpp
  vendor/clang/dist/lib/Sema/SemaStmtAsm.cpp
  vendor/clang/dist/lib/Sema/SemaTemplateDeduction.cpp
  vendor/clang/dist/lib/Serialization/ASTReader.cpp
  vendor/clang/dist/lib/Serialization/ASTReaderStmt.cpp
  vendor/clang/dist/lib/Serialization/ASTWriter.cpp
  vendor/clang/dist/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
  vendor/clang/dist/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  vendor/clang/dist/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  vendor/clang/dist/test/Analysis/Inputs/system-header-simulator-cxx.h
  vendor/clang/dist/test/Analysis/inlining/stl.cpp
  vendor/clang/dist/test/Analysis/null-deref-ps.c
  vendor/clang/dist/test/Analysis/nullptr.cpp
  vendor/clang/dist/test/CXX/drs/dr5xx.cpp
  vendor/clang/dist/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp
  vendor/clang/dist/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
  vendor/clang/dist/test/CodeGen/2007-04-14-FNoBuiltin.c
  vendor/clang/dist/test/CodeGen/aarch64-v8.1a-neon-intrinsics.c
  vendor/clang/dist/test/CodeGen/arm-target-features.c
  vendor/clang/dist/test/CodeGen/arm-v8.1a-neon-intrinsics.c
  vendor/clang/dist/test/CodeGen/libcalls-complex.c
  vendor/clang/dist/test/CodeGen/libcalls-fno-builtin.c
  vendor/clang/dist/test/CodeGen/nobuiltin.c
  vendor/clang/dist/test/CodeGenCXX/ms-inline-asm-fields.cpp
  vendor/clang/dist/test/CodeGenCXX/optnone-def-decl.cpp
  vendor/clang/dist/test/CoverageMapping/ir.c
  vendor/clang/dist/test/Driver/aarch64-cpus.c
  vendor/clang/dist/test/Driver/arm-cortex-cpus.c
  vendor/clang/dist/test/Driver/arm-no-movt.c
  vendor/clang/dist/test/Driver/debug-options.c
  vendor/clang/dist/test/Driver/fortran.f95
  vendor/clang/dist/test/Driver/instrprof-ld.c
  vendor/clang/dist/test/Index/cindex-test-inclusions.c
  vendor/clang/dist/test/Modules/ModuleDebugInfo.cpp
  vendor/clang/dist/test/OpenMP/for_simd_ast_print.cpp
  vendor/clang/dist/test/OpenMP/for_simd_codegen.cpp
  vendor/clang/dist/test/OpenMP/for_simd_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/nesting_of_regions.cpp
  vendor/clang/dist/test/OpenMP/ordered_codegen.cpp
  vendor/clang/dist/test/OpenMP/parallel_for_simd_ast_print.cpp
  vendor/clang/dist/test/OpenMP/parallel_for_simd_codegen.cpp
  vendor/clang/dist/test/OpenMP/parallel_for_simd_loop_messages.cpp
  vendor/clang/dist/test/OpenMP/parallel_for_simd_messages.cpp
  vendor/clang/dist/test/OpenMP/target_codegen.cpp
  vendor/clang/dist/test/OpenMP/target_codegen_global_capture.cpp
  vendor/clang/dist/test/OpenMP/target_map_codegen.cpp
  vendor/clang/dist/test/OpenMP/target_messages.cpp
  vendor/clang/dist/test/Preprocessor/aarch64-target-features.c
  vendor/clang/dist/test/Profile/func-entry.c
  vendor/clang/dist/test/Sema/attr-ownership.c
  vendor/clang/dist/test/Sema/implicit-builtin-freestanding.c
  vendor/clang/dist/test/Sema/warn-documentation-crlf.c
  vendor/clang/dist/test/SemaCXX/attr-no-sanitize-address.cpp
  vendor/clang/dist/test/SemaCXX/attr-no-sanitize-memory.cpp
  vendor/clang/dist/test/SemaCXX/attr-no-sanitize-thread.cpp
  vendor/clang/dist/test/SemaCXX/dllexport.cpp
  vendor/clang/dist/test/SemaCXX/warn-literal-conversion.cpp
  vendor/clang/dist/test/SemaOpenCL/cond.cl
  vendor/clang/dist/test/SemaOpenCL/func_ptr.cl
  vendor/clang/dist/test/SemaTemplate/deduction.cpp
  vendor/clang/dist/tools/c-index-test/c-index-test.c
  vendor/clang/dist/tools/libclang/CIndexInclusionStack.cpp
  vendor/clang/dist/unittests/Format/FormatTest.cpp
  vendor/clang/dist/unittests/Format/FormatTestJS.cpp
  vendor/clang/dist/unittests/Format/FormatTestProto.cpp
  vendor/clang/dist/utils/TableGen/TableGen.cpp

Modified: vendor/clang/dist/CMakeLists.txt
==============================================================================
--- vendor/clang/dist/CMakeLists.txt	Wed Jan  6 20:01:33 2016	(r293249)
+++ vendor/clang/dist/CMakeLists.txt	Wed Jan  6 20:02:26 2016	(r293250)
@@ -631,11 +631,19 @@ if (CLANG_ENABLE_BOOTSTRAP)
 
   string(REGEX MATCH "stage([0-9]*)" MATCHED_STAGE "${CLANG_STAGE}")
   if(MATCHED_STAGE)
-    math(EXPR STAGE_NUM "${MATCHED_STAGE} + 1")
-    set(NEXT_CLANG_STAGE stage${STAGE_NUM})
+    if(NOT LLVM_BUILD_INSTRUMENTED)
+      math(EXPR STAGE_NUM "${CMAKE_MATCH_1} + 1")
+      set(NEXT_CLANG_STAGE stage${STAGE_NUM})
+    else()
+      set(NEXT_CLANG_STAGE stage${CMAKE_MATCH_1})
+    endif()
   else()
     set(NEXT_CLANG_STAGE bootstrap)
   endif()
+
+  if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
+    set(NEXT_CLANG_STAGE ${NEXT_CLANG_STAGE}-instrumented)
+  endif()
   message(STATUS "Setting next clang stage to: ${NEXT_CLANG_STAGE}")
   
   
@@ -681,6 +689,26 @@ if (CLANG_ENABLE_BOOTSTRAP)
     set(RUNTIME_DEP compiler-rt)
   endif()
 
+  set(COMPILER_OPTIONS
+    -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
+    -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
+    -DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
+
+  if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED)
+    set(PGO_DEP llvm-profdata)
+    set(PGO_OPT -DLLVM_PROFDATA=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-profdata)
+  endif()
+
+  if(LLVM_BUILD_INSTRUMENTED)
+    set(PGO_DEP generate-profdata)
+    set(PGO_OPT -DLLVM_PROFDATA_FILE=${CMAKE_CURRENT_BINARY_DIR}/utils/perf-training/clang.profdata)
+    set(COMPILER_OPTIONS
+      -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+      -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+      -DCMAKE_ASM_COMPILER=${CMAKE_ASM_COMPILER})
+    set(RUNTIME_DEP) # Don't set runtime dependencies
+  endif()
+
   # Find all variables that start with BOOTSTRAP_ and populate a variable with
   # them.
   get_cmake_property(variableNames VARIABLES)
@@ -703,7 +731,7 @@ if (CLANG_ENABLE_BOOTSTRAP)
   endforeach()
 
   ExternalProject_Add(${NEXT_CLANG_STAGE}
-    DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP}
+    DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP} ${PGO_DEP}
     PREFIX ${NEXT_CLANG_STAGE}
     SOURCE_DIR ${CMAKE_SOURCE_DIR}
     STAMP_DIR ${STAMP_DIR}
@@ -715,11 +743,9 @@ if (CLANG_ENABLE_BOOTSTRAP)
                 -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
                 ${CLANG_BOOTSTRAP_CMAKE_ARGS}
                 ${PASSTHROUGH_VARIABLES}
-                -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++
-                -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
-                -DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
-                -DCLANG_STAGE=${NEXT_CLANG_STAGE}
-                ${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose}
+                 -DCLANG_STAGE=${NEXT_CLANG_STAGE}
+                ${COMPILER_OPTIONS}
+                ${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose} ${PGO_OPT}
     INSTALL_COMMAND ""
     STEP_TARGETS configure build
     ${cmake_3_4_USES_TERMINAL_OPTIONS}

Added: vendor/clang/dist/cmake/caches/PGO-stage2-instrumented.cmake
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/clang/dist/cmake/caches/PGO-stage2-instrumented.cmake	Wed Jan  6 20:02:26 2016	(r293250)
@@ -0,0 +1,9 @@
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
+
+set(CLANG_BOOTSTRAP_TARGETS check-all check-llvm check-clang test-suite CACHE STRING "")
+
+set(CLANG_BOOTSTRAP_CMAKE_ARGS
+  -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage2.cmake
+  CACHE STRING "")

Added: vendor/clang/dist/cmake/caches/PGO-stage2.cmake
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/clang/dist/cmake/caches/PGO-stage2.cmake	Wed Jan  6 20:02:26 2016	(r293250)
@@ -0,0 +1,2 @@
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")

Added: vendor/clang/dist/cmake/caches/PGO.cmake
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/clang/dist/cmake/caches/PGO.cmake	Wed Jan  6 20:02:26 2016	(r293250)
@@ -0,0 +1,17 @@
+set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
+set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
+
+set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "")
+set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_TARGETS
+  generate-profdata
+  stage2
+  stage2-check-all
+  stage2-check-llvm
+  stage2-check-clang
+  stage2-test-suite CACHE STRING "")
+
+set(CLANG_BOOTSTRAP_CMAKE_ARGS
+  -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage2-instrumented.cmake
+  CACHE STRING "")

Modified: vendor/clang/dist/include/clang/AST/DeclarationName.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/DeclarationName.h	Wed Jan  6 20:01:33 2016	(r293249)
+++ vendor/clang/dist/include/clang/AST/DeclarationName.h	Wed Jan  6 20:02:26 2016	(r293250)
@@ -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: vendor/clang/dist/include/clang/AST/Expr.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/Expr.h	Wed Jan  6 20:01:33 2016	(r293249)
+++ vendor/clang/dist/include/clang/AST/Expr.h	Wed Jan  6 20:02:26 2016	(r293250)
@@ -2190,7 +2190,8 @@ public:
     return reinterpret_cast<Expr **>(SubExprs+getNumPreArgs()+PREARGS_START);
   }
   const Expr *const *getArgs() const {
-    return const_cast<CallExpr*>(this)->getArgs();
+    return reinterpret_cast<Expr **>(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<DesignatedInitExpr, Stmt *> {
 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<Expr>(reinterpret_cast<Stmt *const *>(this + 1)[Idx]);
+    return cast<Expr>(getTrailingObjects<Stmt *>()[Idx]);
   }
 
   void setSubExpr(unsigned Idx, Expr *E) {
     assert(Idx < NumSubExprs && "Subscript out of range");
-    reinterpret_cast<Stmt **>(this + 1)[Idx] = E;
+    getTrailingObjects<Stmt *>()[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<Stmt**>(this + 1);
+    Stmt **begin = getTrailingObjects<Stmt *>();
     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<PseudoObjectExpr, Expr *> {
   // 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<Expr**>(this + 1); }
+  Expr **getSubExprsBuffer() { return getTrailingObjects<Expr *>(); }
   const Expr * const *getSubExprsBuffer() const {
-    return reinterpret_cast<const Expr * const *>(this + 1);
+    return getTrailingObjects<Expr *>();
   }
 
-  friend class ASTStmtReader;
-
   PseudoObjectExpr(QualType type, ExprValueKind VK,
                    Expr *syntactic, ArrayRef<Expr*> 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: vendor/clang/dist/include/clang/AST/ExprCXX.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/ExprCXX.h	Wed Jan  6 20:01:33 2016	(r293249)
+++ vendor/clang/dist/include/clang/AST/ExprCXX.h	Wed Jan  6 20:02:26 2016	(r293250)
@@ -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<CXXDefaultArgExpr, Expr *> {
   /// \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<Expr **>(this + 1) = SubExpr;
+    *getTrailingObjects<Expr *>() = 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<Expr const * const*> (this + 1);
+      return *getTrailingObjects<Expr *>();
     return getParam()->getDefaultArg();
   }
   Expr *getExpr() {
     if (Param.getInt())
-      return *reinterpret_cast<Expr **> (this + 1);
+      return *getTrailingObjects<Expr *>();
     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<LambdaExpr, Stmt *, unsigned, VarDecl *> {
   /// \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<Stmt *>) const {
+    return NumCaptures + 1;
+  }
 
-  typedef LambdaCapture Capture;
+  size_t numTrailingObjects(OverloadToken<unsigned>) const {
+    return HasArrayIndexVars ? NumCaptures + 1 : 0;
+  }
 
   /// \brief Construct a lambda expression.
   LambdaExpr(QualType T, SourceRange IntroducerRange,
              LambdaCaptureDefault CaptureDefault,
-             SourceLocation CaptureDefaultLoc,
-             ArrayRef<Capture> Captures,
-             bool ExplicitParams,
-             bool ExplicitResultType,
-             ArrayRef<Expr *> CaptureInits,
-             ArrayRef<VarDecl *> ArrayIndexVars,
-             ArrayRef<unsigned> ArrayIndexStarts,
-             SourceLocation ClosingBrace,
+             SourceLocation CaptureDefaultLoc, ArrayRef<LambdaCapture> Captures,
+             bool ExplicitParams, bool ExplicitResultType,
+             ArrayRef<Expr *> CaptureInits, ArrayRef<VarDecl *> ArrayIndexVars,
+             ArrayRef<unsigned> 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<Stmt **>(this + 1); }
+  Stmt **getStoredStmts() { return getTrailingObjects<Stmt *>(); }
 
-  Stmt *const *getStoredStmts() const {
-    return reinterpret_cast<Stmt *const *>(this + 1);
-  }
+  Stmt *const *getStoredStmts() const { return getTrailingObjects<Stmt *>(); }
 
   /// \brief Retrieve the mapping from captures to the first array index
   /// variable.
-  unsigned *getArrayIndexStarts() {
-    return reinterpret_cast<unsigned *>(getStoredStmts() + NumCaptures + 1);
-  }
+  unsigned *getArrayIndexStarts() { return getTrailingObjects<unsigned>(); }
 
   const unsigned *getArrayIndexStarts() const {
-    return reinterpret_cast<const unsigned *>(getStoredStmts() + NumCaptures +
-                                              1);
+    return getTrailingObjects<unsigned>();
   }
 
   /// \brief Retrieve the complete set of array-index variables.
-  VarDecl **getArrayIndexVars() {
-    unsigned ArrayIndexSize = llvm::RoundUpToAlignment(
-        sizeof(unsigned) * (NumCaptures + 1), llvm::alignOf<VarDecl *>());
-    return reinterpret_cast<VarDecl **>(
-        reinterpret_cast<char *>(getArrayIndexStarts()) + ArrayIndexSize);
-  }
+  VarDecl **getArrayIndexVars() { return getTrailingObjects<VarDecl *>(); }
 
   VarDecl *const *getArrayIndexVars() const {
-    unsigned ArrayIndexSize = llvm::RoundUpToAlignment(
-        sizeof(unsigned) * (NumCaptures + 1), llvm::alignOf<VarDecl *>());
-    return reinterpret_cast<VarDecl *const *>(
-        reinterpret_cast<const char *>(getArrayIndexStarts()) + ArrayIndexSize);
+    return getTrailingObjects<VarDecl *>();
   }
 
 public:
   /// \brief Construct a new lambda expression.
-  static LambdaExpr *Create(const ASTContext &C,
-                            CXXRecordDecl *Class,
-                            SourceRange IntroducerRange,
-                            LambdaCaptureDefault CaptureDefault,
-                            SourceLocation CaptureDefaultLoc,
-                            ArrayRef<Capture> Captures,
-                            bool ExplicitParams,
-                            bool ExplicitResultType,
-                            ArrayRef<Expr *> CaptureInits,
-                            ArrayRef<VarDecl *> ArrayIndexVars,
-                            ArrayRef<unsigned> ArrayIndexStarts,
-                            SourceLocation ClosingBrace,
-                            bool ContainsUnexpandedParameterPack);
+  static LambdaExpr *
+  Create(const ASTContext &C, CXXRecordDecl *Class, SourceRange IntroducerRange,
+         LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc,
+         ArrayRef<LambdaCapture> Captures, bool ExplicitParams,
+         bool ExplicitResultType, ArrayRef<Expr *> CaptureInits,
+         ArrayRef<VarDecl *> ArrayIndexVars,
+         ArrayRef<unsigned> 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_iterator> 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*, int*)
 /// \endcode
-class TypeTraitExpr : public Expr {
+class TypeTraitExpr final
+    : public Expr,
+      private llvm::TrailingObjects<TypeTraitExpr, TypeSourceInfo *> {
   /// \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<TypeSourceInfo **>(this+1);
-  }
-  
-  /// \brief Retrieve the argument types.
-  TypeSourceInfo * const *getTypeSourceInfos() const {
-    return reinterpret_cast<TypeSourceInfo * const*>(this+1);
+  size_t numTrailingObjects(OverloadToken<TypeSourceInfo *>) 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<TypeSourceInfo *> 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<TypeSourceInfo *> getArgs() const {
+    return llvm::makeArrayRef(getTrailingObjects<TypeSourceInfo *>(),
+                              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<ExprWithCleanups, BlockDecl *> {
 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<CleanupObject> Objects);
 
-  CleanupObject *getObjectsBuffer() {
-    return reinterpret_cast<CleanupObject*>(this + 1);
-  }
-  const CleanupObject *getObjectsBuffer() const {
-    return reinterpret_cast<const CleanupObject*>(this + 1);
-  }
+  friend TrailingObjects;
   friend class ASTStmtReader;
 
 public:
@@ -2929,7 +2896,8 @@ public:
                                   ArrayRef<CleanupObject> objects);
 
   ArrayRef<CleanupObject> getObjects() const {
-    return llvm::makeArrayRef(getObjectsBuffer(), getNumObjects());
+    return llvm::makeArrayRef(getTrailingObjects<CleanupObject>(),
+                              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<CXXUnresolvedConstructExpr, Expr *> {
   /// \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<Expr**>(this + 1); }
+  arg_iterator arg_begin() { return getTrailingObjects<Expr *>(); }
   arg_iterator arg_end() { return arg_begin() + NumArgs; }
 
   typedef const Expr* const * const_arg_iterator;
-  const_arg_iterator arg_begin() const {
-    return reinterpret_cast<const Expr* const *>(this + 1);
-  }
+  const_arg_iterator arg_begin() const { return getTrailingObjects<Expr *>(); }
   const_arg_iterator arg_end() const {
     return arg_begin() + NumArgs;
   }
@@ -3075,7 +3044,7 @@ public:
 
   // Iterators
   child_range children() {
-    Stmt **begin = reinterpret_cast<Stmt**>(this+1);
+    Stmt **begin = reinterpret_cast<Stmt **>(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<SizeOfPackExpr, TemplateArgument> {
   /// \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<TemplateArgument *>(this + 1);
+    TemplateArgument *Args = getTrailingObjects<TemplateArgument>();
     std::uninitialized_copy(PartialArgs.begin(), PartialArgs.end(), Args);
   }
 
@@ -3700,8 +3672,7 @@ public:
   /// \brief Get
   ArrayRef<TemplateArgument> getPartialArguments() const {
     assert(isPartiallySubstituted());
-    const TemplateArgument *Args =
-        reinterpret_cast<const TemplateArgument *>(this + 1);
+    const TemplateArgument *Args = getTrailingObjects<TemplateArgument>();
     return llvm::makeArrayRef(Args, Args + Length);
   }
 
@@ -3837,7 +3808,9 @@ public:
 /// };
 /// template struct S<int, int>;
 /// \endcode
-class FunctionParmPackExpr : public Expr {
+class FunctionParmPackExpr final
+    : public Expr,
+      private llvm::TrailingObjects<FunctionParmPackExpr, ParmVarDecl *> {
   /// \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<iterator>(this+1); }
+  iterator begin() const { return getTrailingObjects<ParmVarDecl *>(); }
   iterator end() const { return begin() + NumParameters; }
 
   /// \brief Get the number of parameters in this parameter pack.

Modified: vendor/clang/dist/include/clang/AST/ExprObjC.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/ExprObjC.h	Wed Jan  6 20:01:33 2016	(r293249)
+++ vendor/clang/dist/include/clang/AST/ExprObjC.h	Wed Jan  6 20:02:26 2016	(r293250)
@@ -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<ObjCArrayLiteral, Expr *> {
   unsigned NumElements;
   SourceRange Range;
   ObjCMethodDecl *ArrayWithObjectsMethod;
-  
+
   ObjCArrayLiteral(ArrayRef<Expr *> 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<Expr **>(this + 1); }
+  Expr **getElements() { return getTrailingObjects<Expr *>(); }
 
   /// \brief Retrieve elements of array of literals.
-  const Expr * const *getElements() const { 
-    return reinterpret_cast<const Expr * const*>(this + 1); 
+  const Expr * const *getElements() const {
+    return getTrailingObjects<Expr *>();
   }
 
   /// 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<Stmt **>(getElements()),
+                       reinterpret_cast<Stmt **>(getElements()) + NumElements);
   }
-    
+
+  friend TrailingObjects;
   friend class ASTStmtReader;
 };
 
@@ -230,32 +233,35 @@ template <> struct isPodLike<clang::ObjC
 }
 
 namespace clang {
-/// ObjCDictionaryLiteral - AST node to represent objective-c dictionary 
-/// literals; as in:  @{@"name" : NSUserName(), @"date" : [NSDate date] };
-class ObjCDictionaryLiteral : public Expr {
-  /// \brief Key/value pair used to store the key and value of a given element.
-  ///
-  /// Objects of this type are stored directly after the expression.
-  struct KeyValuePair {
-    Expr *Key;
-    Expr *Value;
-  };
-  
-  /// \brief Data that describes an element that is a pack expansion, used if any
-  /// of the elements in the dictionary literal are pack expansions.
-  struct ExpansionData {
-    /// \brief The location of the ellipsis, if this element is a pack
-    /// expansion.
-    SourceLocation EllipsisLoc;
-
-    /// \brief If non-zero, the number of elements that this pack
-    /// expansion will expand to (+1).
-    unsigned NumExpansionsPlusOne;
-  };
+/// \brief Internal struct for storing Key/value pair.
+struct ObjCDictionaryLiteral_KeyValuePair {
+  Expr *Key;
+  Expr *Value;
+};
+
+/// \brief Internal struct to describes an element that is a pack
+/// expansion, used if any of the elements in the dictionary literal
+/// are pack expansions.
+struct ObjCDictionaryLiteral_ExpansionData {
+  /// \brief The location of the ellipsis, if this element is a pack
+  /// expansion.
+  SourceLocation EllipsisLoc;
 
+  /// \brief If non-zero, the number of elements that this pack
+  /// expansion will expand to (+1).
+  unsigned NumExpansionsPlusOne;
+};
+
+/// ObjCDictionaryLiteral - AST node to represent objective-c dictionary
+/// literals; as in:  @{@"name" : NSUserName(), @"date" : [NSDate date] };
+class ObjCDictionaryLiteral final
+    : public Expr,
+      private llvm::TrailingObjects<ObjCDictionaryLiteral,
+                                    ObjCDictionaryLiteral_KeyValuePair,
+                                    ObjCDictionaryLiteral_ExpansionData> {
   /// \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<KeyValuePair>) const {
+    return NumElements;
+  }
+
   ObjCDictionaryLiteral(ArrayRef<ObjCDictionaryElement> 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<KeyValuePair *>(this + 1);
-  }
-  
-  const KeyValuePair *getKeyValues() const {
-    return reinterpret_cast<const KeyValuePair *>(this + 1);
-  }
-
-  ExpansionData *getExpansionData() {
-    if (!HasPackExpansions)
-      return nullptr;
-    
-    return reinterpret_cast<ExpansionData *>(getKeyValues() + NumElements);
-  }
-
-  const ExpansionData *getExpansionData() const {
-    if (!HasPackExpansions)
-      return nullptr;
-    
-    return reinterpret_cast<const ExpansionData *>(getKeyValues()+NumElements);
-  }
-
 public:
   static ObjCDictionaryLiteral *Create(const ASTContext &C,
                                        ArrayRef<ObjCDictionaryElement> 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<KeyValuePair>()[Index];
     ObjCDictionaryElement Result = { KV.Key, KV.Value, SourceLocation(), None };
     if (HasPackExpansions) {
-      const ExpansionData &Expansion = getExpansionData()[Index];
+      const ExpansionData &Expansion =
+          getTrailingObjects<ExpansionData>()[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<Stmt **>(this + 1),
-                       reinterpret_cast<Stmt **>(this + 1) + NumElements * 2);
+    return child_range(
+        reinterpret_cast<Stmt **>(getTrailingObjects<KeyValuePair>()),
+        reinterpret_cast<Stmt **>(getTrailingObjects<KeyValuePair>()) +
+            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<ObjCMessageExpr, void *, SourceLocation> {
   /// \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<void *>) 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<void **>(
-                             reinterpret_cast<const void * const*>(this + 1));
-  }
+  void *getReceiverPointer() const { return *getTrailingObjects<void *>(); }
 
   /// \brief Set the pointer value of the message receiver.
   void setReceiverPointer(void *Value) {
-    *reinterpret_cast<void **>(this + 1) = Value;
+    *getTrailingObjects<void *>() = 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<SourceLocation*>(getArgs() + getNumArgs());
+    return getTrailingObjects<SourceLocation>();
   }
   const SourceLocation *getStoredSelLocs() const {
-    return reinterpret_cast<const SourceLocation*>(getArgs() + getNumArgs());
+    return getTrailingObjects<SourceLocation>();
   }
 
   /// \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<Expr **>(this + 1) + 1;
+    return reinterpret_cast<Expr **>(getTrailingObjects<void *>() + 1);
   }
   const Expr * const *getArgs() const {
-    return reinterpret_cast<const Expr * const *>(this + 1) + 1;
+    return reinterpret_cast<const Expr *const *>(getTrailingObjects<void *>() +
+                                                 1);
   }
 
   /// getArg - Return the specified argument.
   Expr *getArg(unsigned Arg) {
     assert(Arg < NumArgs && "Arg access out of range!");
-    return cast<Expr>(getArgs()[Arg]);
+    return getArgs()[Arg];
   }
   const Expr *getArg(unsigned Arg) const {
     assert(Arg < NumArgs && "Arg access out of range!");
-    return cast<Expr>(getArgs()[Arg]);
+    return getArgs()[Arg];
   }
   /// setArg - Set the specified argument.
   void setArg(unsigned Arg, Expr *ArgExpr) {
@@ -1379,6 +1373,7 @@ public:
     return reinterpret_cast<Stmt const * const*>(getArgs() + NumArgs); 
   }
 
+  friend TrailingObjects;
   friend class ASTStmtReader;
   friend class ASTStmtWriter;
 };

Modified: vendor/clang/dist/include/clang/AST/Mangle.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/Mangle.h	Wed Jan  6 20:01:33 2016	(r293249)
+++ vendor/clang/dist/include/clang/AST/Mangle.h	Wed Jan  6 20:02:26 2016	(r293250)
@@ -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: vendor/clang/dist/include/clang/AST/OpenMPClause.h
==============================================================================
--- vendor/clang/dist/include/clang/AST/OpenMPClause.h	Wed Jan  6 20:01:33 2016	(r293249)
+++ vendor/clang/dist/include/clang/AST/OpenMPClause.h	Wed Jan  6 20:02:26 2016	(r293250)
@@ -84,21 +84,15 @@ protected:
   /// \brief Fetches list of variables associated with this clause.
   MutableArrayRef<Expr *> getVarRefs() {
     return MutableArrayRef<Expr *>(
-        reinterpret_cast<Expr **>(
-            reinterpret_cast<char *>(this) +
-            llvm::RoundUpToAlignment(sizeof(T), llvm::alignOf<Expr *>())),
-        NumVars);
+        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
   }
 
   /// \brief Sets the list of variables for this clause.
   void setVarRefs(ArrayRef<Expr *> VL) {
     assert(VL.size() == NumVars &&
            "Number of variables is not the same as the preallocated buffer");
-    std::copy(
-        VL.begin(), VL.end(),
-        reinterpret_cast<Expr **>(
-            reinterpret_cast<char *>(this) +
-            llvm::RoundUpToAlignment(sizeof(T), llvm::alignOf<Expr *>())));
+    std::copy(VL.begin(), VL.end(),
+              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
   }
 
   /// \brief Build a clause with \a N variables
@@ -142,9 +136,7 @@ public:
   /// \brief Fetches list of all variables in the clause.
   ArrayRef<const Expr *> getVarRefs() const {
     return llvm::makeArrayRef(
-        reinterpret_cast<const Expr *const *>(
-            reinterpret_cast<const char *>(this) +
-            llvm::RoundUpToAlignment(sizeof(T), llvm::alignOf<const Expr *>())),
+        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
         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<OMPPrivateClause> {
+class OMPPrivateClause final
+    : public OMPVarListClause<OMPPrivateClause>,
+      private llvm::TrailingObjects<OMPPrivateClause, Expr *> {
+  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<OMPFirstprivateClause> {
+class OMPFirstprivateClause final
+    : public OMPVarListClause<OMPFirstprivateClause>,
+      private llvm::TrailingObjects<OMPFirstprivateClause, Expr *> {
+  friend TrailingObjects;
+  friend OMPVarListClause;
   friend class OMPClauseReader;
 
   /// \brief Build clause with number of variables \a N.
@@ -1372,7 +1372,9 @@ public:

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601062002.u06K2QpX084165>