PSARC/2013/188 Clang/LLVM
authorStefan Teleman <stefan.teleman@oracle.com>
Wed, 10 Feb 2016 11:54:12 -0800
changeset 5434 9f55c805ce9d
parent 5428 3c05d530e67e
child 5435 cdf2fdc8edc0
PSARC/2013/188 Clang/LLVM 15777690 clang/llvm compiler infrastructure in Solaris 21851513 severe memory corruption in the LLVM command-line parsing module 22031298 toxic bugs in LLVM ilist/plist end up eliminating entire MachineBasicBlocks 22065707 LLVM SPARC assembler generator emits wrong ELF Section flags 22346218 LLVM's assembler printer on SPARC needs a lot of work 21870061 partial template specializations in CommandLine.h are buggy 21874261 the Google Test Harness doesn't know how to count threads in Solaris 21697459 memory corruption in LLVM IR Code Generator 21341968 llc on SPARC should not need to be passed -march=sparc or -march=sparcv9 21870103 TableGen makes incorrect assumptions about anonymous namespace instantiation 21870087 naming convention for the InputFile key is inconsistent across LLVM utilities 21870099 128 bytes for a filesystem path is definitely not enough 21870067 lli makes incorrect assumptions about anonymous namespace instantiation order 21870065 llc makes incorrect assumptions about anonymous namespace instantiation order 21870283 llvm::sys::Process::GetArgumentVector should overload for std::vector 21874221 clang C++ does not properly initialize the C++ Standard Library's iostreams
components/llvm/Makefile
components/llvm/clang-build.p5m
components/llvm/clang.p5m
components/llvm/cxa_finalize/Makefile
components/llvm/cxa_finalize/cxa_finalize.c
components/llvm/cxa_finalize/cxa_finalize.h
components/llvm/llvm-build.p5m
components/llvm/llvm.license
components/llvm/llvm.p5m
components/llvm/patches/000-AutoRegen.sh.patch
components/llvm/patches/001-Makefile.config.in.patch
components/llvm/patches/002-Makefile.patch
components/llvm/patches/003-Makefile.rules.patch
components/llvm/patches/004-configure.ac.patch
components/llvm/patches/005-Makefile.patch
components/llvm/patches/006-clang-D10272.patch
components/llvm/patches/007-TemplateBase.patch
components/llvm/patches/008-DeclTemplate.patch
components/llvm/patches/009-InitPreprocessor.patch
components/llvm/patches/010-linker-mapfiles.patch
components/llvm/patches/011-gxx-abi-version.patch
components/llvm/patches/012-TypeLocBuilder.cpp.patch
components/llvm/patches/013-llvm-alignments.patch
components/llvm/patches/014-clang-gcc-toolchain.patch
components/llvm/patches/015-llvm-clang-memory-corruption.patch
components/llvm/patches/016-llvm-21851513-memory-corruption.patch
components/llvm/patches/017-lli-21870067.patch
components/llvm/patches/018-21870283-llvm-GetArgumentVector.patch
components/llvm/patches/019-21870099-clang.patch
components/llvm/patches/020-21874221-clang-llvm-sparc-assembler.patch
components/llvm/patches/021-llvm-ilist-iterator-22031298.patch
components/llvm/patches/022-google-test-harness-22643565.patch
components/llvm/patches/023-Makefile.config.in.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/Makefile	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,336 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+export PARFAIT_BUILD=no
+COMPILER=gcc
+
+include ../../make-rules/shared-macros.mk
+
+COMPONENT_NAME=		llvm
+COMPONENT_VERSION=	3.6.2
+COMPONENT_PROJECT_URL=	http://llvm.org/
+COMPONENT_SRC=		$(COMPONENT_NAME)
+COMPONENT_BUGDB=	utility/llvm
+
+COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
+COMPONENT_SRC_NAME=	$(COMPONENT_SRC).src
+COMPONENT_ARCHIVE=	$(COMPONENT_SRC_NAME).tar.xz
+COMPONENT_ARCHIVE_HASH=	\
+    sha256:f60dc158bfda6822de167e87275848969f0558b3134892ff54fced87e4667b94
+COMPONENT_ARCHIVE_URL=	$(COMPONENT_PROJECT_URL)/releases/$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
+
+TPNO=			24358
+
+COMPONENT_NAME_1 =	clang
+COMPONENT_SRC_1 =	cfe-$(COMPONENT_VERSION).src
+COMPONENT_ARCHIVE_1 =	$(COMPONENT_SRC_1).tar.xz
+COMPONENT_ARCHIVE_HASH_1 = \
+	sha256:ae9180466a23acb426d12444d866b266ff2289b266064d362462e44f8d4699f3
+COMPONENT_ARCHIVE_URL_1 = $(COMPONENT_PROJECT_URL)/releases/$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE_1)
+
+COMPONENT_POST_UNPACK_ACTION = \
+       ( $(MV) $(COMPONENT_SRC_NAME) $(COMPONENT_SRC) )
+
+COMPONENT_POST_UNPACK_ACTION_1 = \
+	 ( $(RM) -rf $(COMPONENT_SRC)/tools/$(COMPONENT_NAME_1) ; \
+	 $(CP) -rp $(COMPONENT_SRC_1) \
+	    $(COMPONENT_SRC)/tools/$(COMPONENT_NAME_1) )
+
+COMPONENT_PRE_CONFIGURE_ACTION = \
+	 ( cd $(SOURCE_DIR) ; \
+	 $(CHMOD) 0755 ./autoconf/AutoRegen.sh ; \
+	 ./autoconf/AutoRegen.sh )
+
+COMPONENT_POST_BUILD_ACTION = \
+      if test -d $(COMPONENT_DIR)/cxa_finalize ; then \
+      $(GMAKE) -C $(COMPONENT_DIR)/cxa_finalize build ; \
+      fi
+
+COMPONENT_POST_INSTALL_ACTION = \
+	if test -d $(COMPONENT_DIR)/cxa_finalize ; then \
+	$(GMAKE) -C $(COMPONENT_DIR)/cxa_finalize install ; \
+	fi;
+
+include $(WS_MAKE_RULES)/prep.mk
+include $(WS_MAKE_RULES)/configure.mk
+include $(WS_MAKE_RULES)/ips.mk
+
+PATCH_LEVEL := 0
+DEBUG_BUILD := 0
+GCC_VERSION := 4.9
+
+# We need GCC version 4.9, and not another version.
+CC=/usr/gcc/$(GCC_VERSION)/bin/gcc
+CXX=/usr/gcc/$(GCC_VERSION)/bin/g++
+
+# We need the specific C++ runtime that clang/llvm was built and
+# linked with, and not some random and incompatible stuff from
+# /usr/lib.
+LLVM_RUNPATH_32 = /usr/gcc/$(GCC_VERSION)/lib
+LLVM_RUNPATH_64 = /usr/gcc/$(GCC_VERSION)/lib/$(MACH64)
+LLVM_RUNPATH = $(LLVM_RUNPATH_$(BITS))
+
+# -O0 for now. Ideally we want -O2.
+OFLAG="-O0"
+GFLAG=""
+
+ifeq ($(DEBUG_BUILD), 1)
+  OFLAG="-O0"
+  GFLAG="-g3"
+endif
+
+export PATH=/usr/gnu/bin:/usr/xpg4/bin:/usr/bin:/usr/perl5/5.16/bin
+
+# Because LLVM's install target doesn't install everything that
+# needs to be installed.
+EXTRA_INSTALL_BITS=llvm-lto arcmt-test c-arcmt-test c-index-test diagtool
+LLVM_BINDIR=$(BUILD_DIR_64)/Release/bin
+
+ifeq ($(DEBUG_BUILD), 1)
+  LLVM_BINDIR=$(BUILD_DIR_64)/Debug+Asserts+Checks/bin
+endif
+
+COMPONENT_POST_INSTALL_ACTION += \
+	list1='$(EXTRA_INSTALL_BITS)' ; for f in $$list1 ; do \
+	    $(INSTALL) --mode=755 $(LLVM_BINDIR)/$$f $(PROTOUSRBINDIR)/$$f ; \
+	done;
+
+# No ASLR for compilers.
+ASLR_MODE = $(ASLR_DISABLE)
+
+# GCC options used:
+# -ftree-vectorize | -fno-tree-vectorize:
+# Enable/disable loop vectorization in optimizations. For details:
+# https://gcc.gnu.org/projects/tree-ssa/vectorization.html
+# Disabled in debug builds, will be enabled in production/optimized
+# builds at some point in the future..
+#
+# -ftree-slp-vectorize | -fno-tree-slp-vectorize:
+# Enable/disable Basic Block tree vectorization.
+# Less aggressive vectorization than -ftree-vectorize, but useful
+# in case -ftree-slp-vectorize misses some vectorization opportunities.
+# Documentation at the same URL as above.
+# Disabled in debug builds, will be enabled in production/optimized
+# builds at some point in the future.
+#
+# -freorder-blocks | -fno-reorder-blocks
+# Enable/disable BasicBlock reordering as an optimization.
+# Disabled in debug builds, will be enabled in production/optimized
+# builds at some point in the future.
+# Documented here:
+# https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
+#
+# -ftoplevel-reorder | -fno-toplevel-reorder
+# Another BasiBlock depentent optimization option.
+# Disabled in debug builds, will be enabled in production/optimized
+# builds at some point in the future.
+# Documented here:
+# https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
+#
+# -fstack-protector-all:
+# Enable stack smashing (stack corruption) protection and detection.
+# This flag should always be used in conjunction with -Wstack-protector.
+# -Wstack-protector acts at compile-time, -fstack-protector-all acts
+# at runtime. -fstack-protector-all enables linking with libssp.so.
+# This flag carries significant runtime overhead, but is very useful.
+# Always enabled for now. May be removed in the future.
+#
+# -g3: Enable macro visibility in GDB. With just -g, debug builds will
+# not record the expanded values of macros. With -g3, the values of
+# expanded macros will be recorded, and macros will be observable in
+# GDB.
+#
+# -mno-unaligned-doubles:
+# Assume that the code does not make use of misaligned doubles on SPARC.
+# On SPARC, doubles must align on 8. This flag makes GCC assume that
+# there is no misaligned double use in the code, and GCC will not
+# attempt to correct such misaligned loads/stores. If, however, there
+# is such broken code when using this flag, the program will SIGBUS
+# at runtime. This is a very useful debugging flag.
+#
+# -mhard-float:
+# Use hardware floating-point operations when available. Compilers
+# generally make very little use of floating-point, but this is
+# a valuable/low-cost optimization for those rare cases where
+# floating-point operations are used. No-op for quad-floating-point
+# and UltraSPARC-1/2/3 because on those ISA's quad-floating-point
+# ops are always done in software. But quad-floating-point ops in a
+# compiler are virtually non-existent.
+#
+# -mptr32 | -mptr64:
+#  Tell GCC the size of a pointer on SPARC.
+#
+# -mimpure-text:
+# When used in addition to -shared on SPARC, this tells GCC to not pass
+# -z text to the linker when linking a shared object.
+# There is some suspicious interaction happening here between GCC/GAS
+# and the Sun linker. Technically, and in theory, this flag should not
+# be needed when compiling -fPIC. However, extensive documented use
+# and practice has shown that it is indeed needed. The disadvantage
+# of using this flag is that it triggers copy-on-write relocations.
+#
+# -mno-sse3 -mno-ssse3:
+# Do not use SSE3/SSSE3 instructions on Intel. These might not be
+# available. Building for Opteron - which implies SSE2 - is adequate
+# for performance purposes.
+
+CFLAGS = -m$(BITS) $(GFLAG) $(OFLAG) -pthread -std=c99 -fno-strict-aliasing
+CFLAGS += -fno-tree-slp-vectorize -fno-tree-vectorize
+CFLAGS += -fno-reorder-blocks -fno-toplevel-reorder
+CFLAGS += -Wall -Wcast-align -Wno-long-long -Woverflow
+CFLAGS += -Wstack-protector -fdata-sections -fstack-protector-all
+CFLAGS += -fkeep-static-consts -ffunction-sections
+CFLAGS += -Wl,-z -Wl,relax=common -Wl,-z -Wl,relax=secadj
+CFLAGS += -Wl,-z -Wl,relax=transtls -Wl,-R -Wl,$(LLVM_RUNPATH)
+CFLAGS.i386 += -mtune=opteron -mno-sse3 -mno-ssse3 -fno-common
+CFLAGS.sparc += -mtune=ultrasparc -mcpu=ultrasparc -mvis -mhard-float
+CFLAGS.sparc += -mptr$(BITS) -fdata-sections -falign-functions=8
+CFLAGS.sparc += -mno-unaligned-doubles -mimpure-text
+CFLAGS += $(CFLAGS.$(MACH))
+
+CXXFLAGS = -m$(BITS) $(GFLAG) $(OFLAG) -pthread -fno-strict-aliasing
+CXXFLAGS += -fexceptions -frtti -fstack-protector-all
+CXXFLAGS += -fno-tree-vectorize -fno-tree-slp-vectorize
+CXXFLAGS += -fno-reorder-blocks -fno-toplevel-reorder
+CXXFLAGS += -Wall -Wcast-align -Wno-long-long -Woverflow
+CXXFLAGS += -Wstack-protector -fkeep-static-consts
+CXXFLAGS += -std=c++11 -fdata-sections -ffunction-sections
+CXXFLAGS += -Wl,-z -Wl,relax=common -Wl,-z -Wl,relax=secadj
+CXXFLAGS += -Wl,-z -Wl,relax=transtls -Wl,-R -Wl,$(LLVM_RUNPATH)
+CXXFLAGS.sparc += -mptr$(BITS)
+CXXFLAGS += $(CFLAGS.$(MACH))
+
+CPPFLAGS = -D_GNU_SOURCE -DLLVM_SOLARIS -I/usr/gnu/include
+
+ifeq ($(DEBUG_BUILD), 1)
+  CPPFLAGS += -D_DEBUG
+endif
+
+CPPFLAGS += -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D__EXTENSIONS__=1
+CPPFLAGS += -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
+CPPFLAGS += -D__STDC_LIMIT_MACROS -DHAVE_POSIX_MEMALIGN
+CPPFLAGS += -D_GLIBCXX_FULLY_DYNAMIC_STRING=1
+CPPFLAGS.i386 = -DLLVM_INTEL
+CPPFLAGS.sparc = -DLLVM_SPARC
+CPPFLAGS += $(CPPFLAGS.$(MACH))
+
+LLVM_LIBDIR_32 = /usr/lib
+LLVM_LIBDIR_64 = /usr/lib/$(MACH64)
+LLVM_LIBDIR = $(LLVM_LIBDIR_$(BITS))
+
+LLVM_LIBEXECDIR_32 = /usr/libexec
+LLVM_LIBEXECDIR_64 = /usr/libexec/$(MACH64)
+LLVM_LIBEXECDIR = $(LLVM_LIBEXECDIR_$(BITS))
+
+CONFIGURE_SCRIPT = $(SOURCE_DIR)/configure
+CONFIGURE_OPTIONS += CC="$(CC)"
+CONFIGURE_OPTIONS += CXX="$(CXX)"
+CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)"
+CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)"
+CONFIGURE_OPTIONS += CXXFLAGS="$(CXXFLAGS)"
+CONFIGURE_OPTIONS += --libdir=$(LLVM_LIBDIR)
+CONFIGURE_OPTIONS += --libexecdir=$(LLVM_LIBEXECDIR)
+CONFIGURE_OPTIONS += --sharedstatedir=/tmp
+CONFIGURE_OPTIONS += --localstatedir=/var
+CONFIGURE_OPTIONS += --enable-compiler-version-checks=yes
+CONFIGURE_OPTIONS += --enable-clang-static-analyzer=yes
+
+ifeq ($(DEBUG_BUILD), 1)
+  CONFIGURE_OPTIONS += --enable-assertions=yes
+  CONFIGURE_OPTIONS += --enable-optimized=no
+  CONFIGURE_OPTIONS += --enable-expensive-checks=yes
+  CONFIGURE_OPTIONS += --enable-debug-runtime=yes
+  CONFIGURE_OPTIONS += --enable-debug-symbols=yes
+else
+  CONFIGURE_OPTIONS += --enable-assertions=no
+  CONFIGURE_OPTIONS += --enable-optimized=yes
+  CONFIGURE_OPTIONS += --enable-expensive-checks=no
+  CONFIGURE_OPTIONS += --enable-debug-runtime=no
+  CONFIGURE_OPTIONS += --enable-debug-symbols=no
+endif
+
+CONFIGURE_OPTIONS += --enable-keep-symbols=yes
+CONFIGURE_OPTIONS += --enable-jit=yes
+CONFIGURE_OPTIONS += --disable-docs
+CONFIGURE_OPTIONS += --disable-doxygen
+CONFIGURE_OPTIONS += --enable-threads=yes
+CONFIGURE_OPTIONS += --enable-pthreads=yes
+CONFIGURE_OPTIONS += --enable-shared=yes
+CONFIGURE_OPTIONS += --enable-zlib=yes
+CONFIGURE_OPTIONS += --enable-pic=yes
+CONFIGURE_OPTIONS += --enable-timestamps
+CONFIGURE_OPTIONS += --enable-backtraces
+CONFIGURE_OPTIONS += --enable-bindings=auto
+CONFIGURE_OPTIONS += --enable-libffi=yes
+CONFIGURE_OPTIONS += --enable-terminfo=yes
+CONFIGURE_OPTIONS += --enable-ltdl-install=no
+CONFIGURE_OPTIONS += --with-python=$(PYTHON)
+
+ifeq ($(MACH),sparc)
+  CONFIGURE_OPTIONS += --with-extra-ld-options='-lkstat'
+endif
+CONFIGURE_OPTIONS += --with-gcc-toolchain=/usr/gcc/$(GCC_VERSION)
+CONFIGURE_OPTIONS += --with-optimize-option="$(OFLAG) $(GFLAG)"
+
+# Enable the cross-compiler in 3.8.X.
+CONFIGURE_OPTIONS.i386 += --enable-targets="x86"
+CONFIGURE_OPTIONS.sparc += --enable-targets="sparc"
+CONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(MACH))
+
+# Put this here for now until the gpatch problems are resolved.
+COMPONENT_BUILD_ARGS += -j8
+
+# use bash(1) to run the install recipes otherwise clang header installation
+# fails
+COMPONENT_INSTALL_ARGS += SHELL=/bin/bash
+
+# common targets
+configure:	$(CONFIGURE_64)
+
+build:		$(BUILD_64)
+
+install:	$(INSTALL_64)
+
+# There are no master test results yet. TBDL in 3.8.X.
+test:
+	@echo "Tests not yet implemented (wait for 3.8.X)."
+
+system-test:    $(SYSTEM_TESTS_NOT_IMPLEMENTED)
+
+REQUIRED_PACKAGES += developer/gcc-4/gcc-common-49
+REQUIRED_PACKAGES += developer/gnu-binutils
+REQUIRED_PACKAGES += library/libedit
+REQUIRED_PACKAGES += library/libffi
+REQUIRED_PACKAGES += library/libxml2
+REQUIRED_PACKAGES += library/zlib
+REQUIRED_PACKAGES += runtime/python-27
+REQUIRED_PACKAGES += system/core-os
+REQUIRED_PACKAGES += system/header
+REQUIRED_PACKAGES += system/library
+REQUIRED_PACKAGES += system/library/gcc/gcc-c++-runtime-49
+REQUIRED_PACKAGES += system/library/gcc/gcc-gobjcc-runtime-49
+REQUIRED_PACKAGES += system/library/math
+REQUIRED_PACKAGES += system/linker
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/clang-build.p5m	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,501 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+
+set name=pkg.fmri \
+    value=pkg:/developer/llvm/[email protected]$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+set name=pkg.summary \
+    value="clang $(COMPONENT_VERSION) Development Files and Libraries"
+set name=com.oracle.info.description \
+    value="clang - The C/C++/Objective-C/Objective-C++ compiler based on the LLVM Compiler Infrastructure Framework - Development Files and Libraries"
+set name=com.oracle.info.tpno value=$(TPNO)
+set name=info.classification value=org.opensolaris.category.2008:Development/C \
+    value=org.opensolaris.category.2008:Development/C++ \
+    value=org.opensolaris.category.2008:Development/GNU \
+    value="org.opensolaris.category.2008:Development/Objective C"
+set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
+set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
+set name=org.opensolaris.arc-caseid value=PSARC/2013/188
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+file path=usr/bin/arcmt-test
+file path=usr/bin/c-arcmt-test
+file path=usr/bin/c-index-test
+file path=usr/bin/diagtool
+file path=usr/include/clang-c/BuildSystem.h
+file path=usr/include/clang-c/CXCompilationDatabase.h
+file path=usr/include/clang-c/CXErrorCode.h
+file path=usr/include/clang-c/CXString.h
+file path=usr/include/clang-c/Documentation.h
+file path=usr/include/clang-c/Index.h
+file path=usr/include/clang-c/Platform.h
+file path=usr/include/clang-c/module.modulemap
+file path=usr/include/clang/ARCMigrate/ARCMT.h
+file path=usr/include/clang/ARCMigrate/ARCMTActions.h
+file path=usr/include/clang/ARCMigrate/FileRemapper.h
+file path=usr/include/clang/AST/APValue.h
+file path=usr/include/clang/AST/AST.h
+file path=usr/include/clang/AST/ASTConsumer.h
+file path=usr/include/clang/AST/ASTContext.h
+file path=usr/include/clang/AST/ASTDiagnostic.h
+file path=usr/include/clang/AST/ASTFwd.h
+file path=usr/include/clang/AST/ASTImporter.h
+file path=usr/include/clang/AST/ASTLambda.h
+file path=usr/include/clang/AST/ASTMutationListener.h
+file path=usr/include/clang/AST/ASTTypeTraits.h
+file path=usr/include/clang/AST/ASTUnresolvedSet.h
+file path=usr/include/clang/AST/ASTVector.h
+file path=usr/include/clang/AST/Attr.h
+file path=usr/include/clang/AST/AttrDump.inc
+file path=usr/include/clang/AST/AttrImpl.inc
+file path=usr/include/clang/AST/AttrIterator.h
+file path=usr/include/clang/AST/AttrVisitor.inc
+file path=usr/include/clang/AST/Attrs.inc
+file path=usr/include/clang/AST/BaseSubobject.h
+file path=usr/include/clang/AST/BuiltinTypes.def
+file path=usr/include/clang/AST/CXXInheritance.h
+file path=usr/include/clang/AST/CanonicalType.h
+file path=usr/include/clang/AST/CharUnits.h
+file path=usr/include/clang/AST/Comment.h
+file path=usr/include/clang/AST/CommentBriefParser.h
+file path=usr/include/clang/AST/CommentCommandInfo.inc
+file path=usr/include/clang/AST/CommentCommandList.inc
+file path=usr/include/clang/AST/CommentCommandTraits.h
+file path=usr/include/clang/AST/CommentDiagnostic.h
+file path=usr/include/clang/AST/CommentHTMLNamedCharacterReferences.inc
+file path=usr/include/clang/AST/CommentHTMLTags.inc
+file path=usr/include/clang/AST/CommentHTMLTagsProperties.inc
+file path=usr/include/clang/AST/CommentLexer.h
+file path=usr/include/clang/AST/CommentNodes.inc
+file path=usr/include/clang/AST/CommentParser.h
+file path=usr/include/clang/AST/CommentSema.h
+file path=usr/include/clang/AST/CommentVisitor.h
+file path=usr/include/clang/AST/DataRecursiveASTVisitor.h
+file path=usr/include/clang/AST/Decl.h
+file path=usr/include/clang/AST/DeclAccessPair.h
+file path=usr/include/clang/AST/DeclBase.h
+file path=usr/include/clang/AST/DeclCXX.h
+file path=usr/include/clang/AST/DeclContextInternals.h
+file path=usr/include/clang/AST/DeclFriend.h
+file path=usr/include/clang/AST/DeclGroup.h
+file path=usr/include/clang/AST/DeclLookups.h
+file path=usr/include/clang/AST/DeclNodes.inc
+file path=usr/include/clang/AST/DeclObjC.h
+file path=usr/include/clang/AST/DeclOpenMP.h
+file path=usr/include/clang/AST/DeclTemplate.h
+file path=usr/include/clang/AST/DeclVisitor.h
+file path=usr/include/clang/AST/DeclarationName.h
+file path=usr/include/clang/AST/DependentDiagnostic.h
+file path=usr/include/clang/AST/EvaluatedExprVisitor.h
+file path=usr/include/clang/AST/Expr.h
+file path=usr/include/clang/AST/ExprCXX.h
+file path=usr/include/clang/AST/ExprObjC.h
+file path=usr/include/clang/AST/ExternalASTSource.h
+file path=usr/include/clang/AST/GlobalDecl.h
+file path=usr/include/clang/AST/LambdaCapture.h
+file path=usr/include/clang/AST/Mangle.h
+file path=usr/include/clang/AST/MangleNumberingContext.h
+file path=usr/include/clang/AST/NSAPI.h
+file path=usr/include/clang/AST/NestedNameSpecifier.h
+file path=usr/include/clang/AST/OpenMPClause.h
+file path=usr/include/clang/AST/OperationKinds.h
+file path=usr/include/clang/AST/ParentMap.h
+file path=usr/include/clang/AST/PrettyPrinter.h
+file path=usr/include/clang/AST/RawCommentList.h
+file path=usr/include/clang/AST/RecordLayout.h
+file path=usr/include/clang/AST/RecursiveASTVisitor.h
+file path=usr/include/clang/AST/Redeclarable.h
+file path=usr/include/clang/AST/SelectorLocationsKind.h
+file path=usr/include/clang/AST/Stmt.h
+file path=usr/include/clang/AST/StmtCXX.h
+file path=usr/include/clang/AST/StmtGraphTraits.h
+file path=usr/include/clang/AST/StmtIterator.h
+file path=usr/include/clang/AST/StmtNodes.inc
+file path=usr/include/clang/AST/StmtObjC.h
+file path=usr/include/clang/AST/StmtOpenMP.h
+file path=usr/include/clang/AST/StmtVisitor.h
+file path=usr/include/clang/AST/TemplateBase.h
+file path=usr/include/clang/AST/TemplateName.h
+file path=usr/include/clang/AST/Type.h
+file path=usr/include/clang/AST/TypeLoc.h
+file path=usr/include/clang/AST/TypeLocNodes.def
+file path=usr/include/clang/AST/TypeLocVisitor.h
+file path=usr/include/clang/AST/TypeNodes.def
+file path=usr/include/clang/AST/TypeOrdering.h
+file path=usr/include/clang/AST/TypeVisitor.h
+file path=usr/include/clang/AST/UnresolvedSet.h
+file path=usr/include/clang/AST/VTTBuilder.h
+file path=usr/include/clang/AST/VTableBuilder.h
+file path=usr/include/clang/ASTMatchers/ASTMatchFinder.h
+file path=usr/include/clang/ASTMatchers/ASTMatchers.h
+file path=usr/include/clang/ASTMatchers/ASTMatchersInternal.h
+file path=usr/include/clang/ASTMatchers/ASTMatchersMacros.h
+file path=usr/include/clang/ASTMatchers/Dynamic/Diagnostics.h
+file path=usr/include/clang/ASTMatchers/Dynamic/Parser.h
+file path=usr/include/clang/ASTMatchers/Dynamic/Registry.h
+file path=usr/include/clang/ASTMatchers/Dynamic/VariantValue.h
+file path=usr/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h
+file path=usr/include/clang/Analysis/Analyses/Consumed.h
+file path=usr/include/clang/Analysis/Analyses/Dominators.h
+file path=usr/include/clang/Analysis/Analyses/FormatString.h
+file path=usr/include/clang/Analysis/Analyses/LiveVariables.h
+file path=usr/include/clang/Analysis/Analyses/PostOrderCFGView.h
+file path=usr/include/clang/Analysis/Analyses/PseudoConstantAnalysis.h
+file path=usr/include/clang/Analysis/Analyses/ReachableCode.h
+file path=usr/include/clang/Analysis/Analyses/ThreadSafety.h
+file path=usr/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
+file path=usr/include/clang/Analysis/Analyses/ThreadSafetyLogical.h
+file path=usr/include/clang/Analysis/Analyses/ThreadSafetyOps.def
+file path=usr/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
+file path=usr/include/clang/Analysis/Analyses/ThreadSafetyTraverse.h
+file path=usr/include/clang/Analysis/Analyses/ThreadSafetyUtil.h
+file path=usr/include/clang/Analysis/Analyses/UninitializedValues.h
+file path=usr/include/clang/Analysis/AnalysisContext.h
+file path=usr/include/clang/Analysis/AnalysisDiagnostic.h
+file path=usr/include/clang/Analysis/CFG.h
+file path=usr/include/clang/Analysis/CFGStmtMap.h
+file path=usr/include/clang/Analysis/CallGraph.h
+file path=usr/include/clang/Analysis/CodeInjector.h
+file path=usr/include/clang/Analysis/DomainSpecific/CocoaConventions.h
+file path=usr/include/clang/Analysis/DomainSpecific/ObjCNoReturn.h
+file path=usr/include/clang/Analysis/FlowSensitive/DataflowValues.h
+file path=usr/include/clang/Analysis/ProgramPoint.h
+file path=usr/include/clang/Analysis/Support/BumpVector.h
+file path=usr/include/clang/Basic/ABI.h
+file path=usr/include/clang/Basic/AddressSpaces.h
+file path=usr/include/clang/Basic/AllDiagnostics.h
+file path=usr/include/clang/Basic/AttrHasAttributeImpl.inc
+file path=usr/include/clang/Basic/AttrKinds.h
+file path=usr/include/clang/Basic/AttrList.inc
+file path=usr/include/clang/Basic/Attributes.h
+file path=usr/include/clang/Basic/Builtins.def
+file path=usr/include/clang/Basic/Builtins.h
+file path=usr/include/clang/Basic/BuiltinsAArch64.def
+file path=usr/include/clang/Basic/BuiltinsARM.def
+file path=usr/include/clang/Basic/BuiltinsHexagon.def
+file path=usr/include/clang/Basic/BuiltinsLe64.def
+file path=usr/include/clang/Basic/BuiltinsMips.def
+file path=usr/include/clang/Basic/BuiltinsNEON.def
+file path=usr/include/clang/Basic/BuiltinsNVPTX.def
+file path=usr/include/clang/Basic/BuiltinsPPC.def
+file path=usr/include/clang/Basic/BuiltinsR600.def
+file path=usr/include/clang/Basic/BuiltinsX86.def
+file path=usr/include/clang/Basic/BuiltinsXCore.def
+file path=usr/include/clang/Basic/CapturedStmt.h
+file path=usr/include/clang/Basic/CharInfo.h
+file path=usr/include/clang/Basic/CommentOptions.h
+file path=usr/include/clang/Basic/Diagnostic.h
+file path=usr/include/clang/Basic/DiagnosticASTKinds.inc
+file path=usr/include/clang/Basic/DiagnosticAnalysisKinds.inc
+file path=usr/include/clang/Basic/DiagnosticCategories.h
+file path=usr/include/clang/Basic/DiagnosticCommentKinds.inc
+file path=usr/include/clang/Basic/DiagnosticCommonKinds.inc
+file path=usr/include/clang/Basic/DiagnosticDriverKinds.inc
+file path=usr/include/clang/Basic/DiagnosticFrontendKinds.inc
+file path=usr/include/clang/Basic/DiagnosticGroups.inc
+file path=usr/include/clang/Basic/DiagnosticIDs.h
+file path=usr/include/clang/Basic/DiagnosticIndexName.inc
+file path=usr/include/clang/Basic/DiagnosticLexKinds.inc
+file path=usr/include/clang/Basic/DiagnosticOptions.def
+file path=usr/include/clang/Basic/DiagnosticOptions.h
+file path=usr/include/clang/Basic/DiagnosticParseKinds.inc
+file path=usr/include/clang/Basic/DiagnosticSemaKinds.inc
+file path=usr/include/clang/Basic/DiagnosticSerializationKinds.inc
+file path=usr/include/clang/Basic/ExceptionSpecificationType.h
+file path=usr/include/clang/Basic/ExpressionTraits.h
+file path=usr/include/clang/Basic/FileManager.h
+file path=usr/include/clang/Basic/FileSystemOptions.h
+file path=usr/include/clang/Basic/FileSystemStatCache.h
+file path=usr/include/clang/Basic/IdentifierTable.h
+file path=usr/include/clang/Basic/LLVM.h
+file path=usr/include/clang/Basic/Lambda.h
+file path=usr/include/clang/Basic/LangOptions.def
+file path=usr/include/clang/Basic/LangOptions.h
+file path=usr/include/clang/Basic/Linkage.h
+file path=usr/include/clang/Basic/MacroBuilder.h
+file path=usr/include/clang/Basic/Module.h
+file path=usr/include/clang/Basic/ObjCRuntime.h
+file path=usr/include/clang/Basic/OpenCLExtensions.def
+file path=usr/include/clang/Basic/OpenMPKinds.def
+file path=usr/include/clang/Basic/OpenMPKinds.h
+file path=usr/include/clang/Basic/OperatorKinds.def
+file path=usr/include/clang/Basic/OperatorKinds.h
+file path=usr/include/clang/Basic/OperatorPrecedence.h
+file path=usr/include/clang/Basic/PartialDiagnostic.h
+file path=usr/include/clang/Basic/PlistSupport.h
+file path=usr/include/clang/Basic/PrettyStackTrace.h
+file path=usr/include/clang/Basic/SanitizerBlacklist.h
+file path=usr/include/clang/Basic/Sanitizers.def
+file path=usr/include/clang/Basic/Sanitizers.h
+file path=usr/include/clang/Basic/SourceLocation.h
+file path=usr/include/clang/Basic/SourceManager.h
+file path=usr/include/clang/Basic/SourceManagerInternals.h
+file path=usr/include/clang/Basic/Specifiers.h
+file path=usr/include/clang/Basic/TargetBuiltins.h
+file path=usr/include/clang/Basic/TargetCXXABI.h
+file path=usr/include/clang/Basic/TargetInfo.h
+file path=usr/include/clang/Basic/TargetOptions.h
+file path=usr/include/clang/Basic/TemplateKinds.h
+file path=usr/include/clang/Basic/TokenKinds.def
+file path=usr/include/clang/Basic/TokenKinds.h
+file path=usr/include/clang/Basic/TypeTraits.h
+file path=usr/include/clang/Basic/Version.h
+file path=usr/include/clang/Basic/Version.inc
+file path=usr/include/clang/Basic/VersionTuple.h
+file path=usr/include/clang/Basic/VirtualFileSystem.h
+file path=usr/include/clang/Basic/Visibility.h
+file path=usr/include/clang/Basic/arm_neon.inc
+file path=usr/include/clang/CodeGen/BackendUtil.h
+file path=usr/include/clang/CodeGen/CGFunctionInfo.h
+file path=usr/include/clang/CodeGen/CodeGenABITypes.h
+file path=usr/include/clang/CodeGen/CodeGenAction.h
+file path=usr/include/clang/CodeGen/ModuleBuilder.h
+file path=usr/include/clang/Config/config.h
+file path=usr/include/clang/Driver/Action.h
+file path=usr/include/clang/Driver/Compilation.h
+file path=usr/include/clang/Driver/Driver.h
+file path=usr/include/clang/Driver/DriverDiagnostic.h
+file path=usr/include/clang/Driver/Job.h
+file path=usr/include/clang/Driver/Multilib.h
+file path=usr/include/clang/Driver/Options.h
+file path=usr/include/clang/Driver/Options.inc
+file path=usr/include/clang/Driver/Phases.h
+file path=usr/include/clang/Driver/SanitizerArgs.h
+file path=usr/include/clang/Driver/Tool.h
+file path=usr/include/clang/Driver/ToolChain.h
+file path=usr/include/clang/Driver/Types.def
+file path=usr/include/clang/Driver/Types.h
+file path=usr/include/clang/Driver/Util.h
+file path=usr/include/clang/Edit/Commit.h
+file path=usr/include/clang/Edit/EditedSource.h
+file path=usr/include/clang/Edit/EditsReceiver.h
+file path=usr/include/clang/Edit/FileOffset.h
+file path=usr/include/clang/Edit/Rewriters.h
+file path=usr/include/clang/Format/Format.h
+file path=usr/include/clang/Frontend/ASTConsumers.h
+file path=usr/include/clang/Frontend/ASTUnit.h
+file path=usr/include/clang/Frontend/ChainedDiagnosticConsumer.h
+file path=usr/include/clang/Frontend/CodeGenOptions.def
+file path=usr/include/clang/Frontend/CodeGenOptions.h
+file path=usr/include/clang/Frontend/CommandLineSourceLoc.h
+file path=usr/include/clang/Frontend/CompilerInstance.h
+file path=usr/include/clang/Frontend/CompilerInvocation.h
+file path=usr/include/clang/Frontend/DependencyOutputOptions.h
+file path=usr/include/clang/Frontend/DiagnosticRenderer.h
+file path=usr/include/clang/Frontend/FrontendAction.h
+file path=usr/include/clang/Frontend/FrontendActions.h
+file path=usr/include/clang/Frontend/FrontendDiagnostic.h
+file path=usr/include/clang/Frontend/FrontendOptions.h
+file path=usr/include/clang/Frontend/FrontendPluginRegistry.h
+file path=usr/include/clang/Frontend/LangStandard.h
+file path=usr/include/clang/Frontend/LangStandards.def
+file path=usr/include/clang/Frontend/LayoutOverrideSource.h
+file path=usr/include/clang/Frontend/LogDiagnosticPrinter.h
+file path=usr/include/clang/Frontend/MigratorOptions.h
+file path=usr/include/clang/Frontend/MultiplexConsumer.h
+file path=usr/include/clang/Frontend/PreprocessorOutputOptions.h
+file path=usr/include/clang/Frontend/SerializedDiagnosticPrinter.h
+file path=usr/include/clang/Frontend/SerializedDiagnosticReader.h
+file path=usr/include/clang/Frontend/SerializedDiagnostics.h
+file path=usr/include/clang/Frontend/TextDiagnostic.h
+file path=usr/include/clang/Frontend/TextDiagnosticBuffer.h
+file path=usr/include/clang/Frontend/TextDiagnosticPrinter.h
+file path=usr/include/clang/Frontend/Utils.h
+file path=usr/include/clang/Frontend/VerifyDiagnosticConsumer.h
+file path=usr/include/clang/FrontendTool/Utils.h
+file path=usr/include/clang/Index/CommentToXML.h
+file path=usr/include/clang/Index/USRGeneration.h
+file path=usr/include/clang/Lex/CodeCompletionHandler.h
+file path=usr/include/clang/Lex/DirectoryLookup.h
+file path=usr/include/clang/Lex/ExternalPreprocessorSource.h
+file path=usr/include/clang/Lex/HeaderMap.h
+file path=usr/include/clang/Lex/HeaderSearch.h
+file path=usr/include/clang/Lex/HeaderSearchOptions.h
+file path=usr/include/clang/Lex/LexDiagnostic.h
+file path=usr/include/clang/Lex/Lexer.h
+file path=usr/include/clang/Lex/LiteralSupport.h
+file path=usr/include/clang/Lex/MacroArgs.h
+file path=usr/include/clang/Lex/MacroInfo.h
+file path=usr/include/clang/Lex/ModuleLoader.h
+file path=usr/include/clang/Lex/ModuleMap.h
+file path=usr/include/clang/Lex/MultipleIncludeOpt.h
+file path=usr/include/clang/Lex/PPCallbacks.h
+file path=usr/include/clang/Lex/PPConditionalDirectiveRecord.h
+file path=usr/include/clang/Lex/PTHLexer.h
+file path=usr/include/clang/Lex/PTHManager.h
+file path=usr/include/clang/Lex/Pragma.h
+file path=usr/include/clang/Lex/PreprocessingRecord.h
+file path=usr/include/clang/Lex/Preprocessor.h
+file path=usr/include/clang/Lex/PreprocessorLexer.h
+file path=usr/include/clang/Lex/PreprocessorOptions.h
+file path=usr/include/clang/Lex/ScratchBuffer.h
+file path=usr/include/clang/Lex/Token.h
+file path=usr/include/clang/Lex/TokenConcatenation.h
+file path=usr/include/clang/Lex/TokenLexer.h
+file path=usr/include/clang/Parse/AttrParserStringSwitches.inc
+file path=usr/include/clang/Parse/ParseAST.h
+file path=usr/include/clang/Parse/ParseDiagnostic.h
+file path=usr/include/clang/Parse/Parser.h
+file path=usr/include/clang/Rewrite/Core/DeltaTree.h
+file path=usr/include/clang/Rewrite/Core/HTMLRewrite.h
+file path=usr/include/clang/Rewrite/Core/RewriteRope.h
+file path=usr/include/clang/Rewrite/Core/Rewriter.h
+file path=usr/include/clang/Rewrite/Core/TokenRewriter.h
+file path=usr/include/clang/Rewrite/Frontend/ASTConsumers.h
+file path=usr/include/clang/Rewrite/Frontend/FixItRewriter.h
+file path=usr/include/clang/Rewrite/Frontend/FrontendActions.h
+file path=usr/include/clang/Rewrite/Frontend/Rewriters.h
+file path=usr/include/clang/Sema/AnalysisBasedWarnings.h
+file path=usr/include/clang/Sema/AttrParsedAttrImpl.inc
+file path=usr/include/clang/Sema/AttrParsedAttrKinds.inc
+file path=usr/include/clang/Sema/AttrParsedAttrList.inc
+file path=usr/include/clang/Sema/AttrSpellingListIndex.inc
+file path=usr/include/clang/Sema/AttrTemplateInstantiate.inc
+file path=usr/include/clang/Sema/AttributeList.h
+file path=usr/include/clang/Sema/CXXFieldCollector.h
+file path=usr/include/clang/Sema/CodeCompleteConsumer.h
+file path=usr/include/clang/Sema/CodeCompleteOptions.h
+file path=usr/include/clang/Sema/DeclSpec.h
+file path=usr/include/clang/Sema/DelayedDiagnostic.h
+file path=usr/include/clang/Sema/Designator.h
+file path=usr/include/clang/Sema/ExternalSemaSource.h
+file path=usr/include/clang/Sema/IdentifierResolver.h
+file path=usr/include/clang/Sema/Initialization.h
+file path=usr/include/clang/Sema/LocInfoType.h
+file path=usr/include/clang/Sema/Lookup.h
+file path=usr/include/clang/Sema/LoopHint.h
+file path=usr/include/clang/Sema/MultiplexExternalSemaSource.h
+file path=usr/include/clang/Sema/ObjCMethodList.h
+file path=usr/include/clang/Sema/Overload.h
+file path=usr/include/clang/Sema/Ownership.h
+file path=usr/include/clang/Sema/ParsedTemplate.h
+file path=usr/include/clang/Sema/PrettyDeclStackTrace.h
+file path=usr/include/clang/Sema/Scope.h
+file path=usr/include/clang/Sema/ScopeInfo.h
+file path=usr/include/clang/Sema/Sema.h
+file path=usr/include/clang/Sema/SemaConsumer.h
+file path=usr/include/clang/Sema/SemaDiagnostic.h
+file path=usr/include/clang/Sema/SemaFixItUtils.h
+file path=usr/include/clang/Sema/SemaInternal.h
+file path=usr/include/clang/Sema/SemaLambda.h
+file path=usr/include/clang/Sema/Template.h
+file path=usr/include/clang/Sema/TemplateDeduction.h
+file path=usr/include/clang/Sema/TypoCorrection.h
+file path=usr/include/clang/Sema/Weak.h
+file path=usr/include/clang/Serialization/ASTBitCodes.h
+file path=usr/include/clang/Serialization/ASTDeserializationListener.h
+file path=usr/include/clang/Serialization/ASTReader.h
+file path=usr/include/clang/Serialization/ASTWriter.h
+file path=usr/include/clang/Serialization/AttrPCHRead.inc
+file path=usr/include/clang/Serialization/AttrPCHWrite.inc
+file path=usr/include/clang/Serialization/ContinuousRangeMap.h
+file path=usr/include/clang/Serialization/GlobalModuleIndex.h
+file path=usr/include/clang/Serialization/Module.h
+file path=usr/include/clang/Serialization/ModuleManager.h
+file path=usr/include/clang/Serialization/SerializationDiagnostic.h
+file path=usr/include/clang/StaticAnalyzer/Checkers/ClangCheckers.h
+file path=usr/include/clang/StaticAnalyzer/Checkers/LocalCheckers.h
+file path=usr/include/clang/StaticAnalyzer/Checkers/ObjCRetainCount.h
+file path=usr/include/clang/StaticAnalyzer/Core/Analyses.def
+file path=usr/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
+file path=usr/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
+file path=usr/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitor.h
+file path=usr/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
+file path=usr/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h
+file path=usr/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
+file path=usr/include/clang/StaticAnalyzer/Core/Checker.h
+file path=usr/include/clang/StaticAnalyzer/Core/CheckerManager.h
+file path=usr/include/clang/StaticAnalyzer/Core/CheckerOptInfo.h
+file path=usr/include/clang/StaticAnalyzer/Core/CheckerRegistry.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/BlockCounter.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeInfo.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/FunctionSummary.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/StoreRef.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/SummaryManager.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/TaintManager.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/TaintTag.h
+file path=usr/include/clang/StaticAnalyzer/Core/PathSensitive/WorkList.h
+file path=usr/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h
+file path=usr/include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h
+file path=usr/include/clang/StaticAnalyzer/Frontend/FrontendActions.h
+file path=usr/include/clang/StaticAnalyzer/Frontend/ModelConsumer.h
+file path=usr/include/clang/Tooling/ArgumentsAdjusters.h
+file path=usr/include/clang/Tooling/CommonOptionsParser.h
+file path=usr/include/clang/Tooling/CompilationDatabase.h
+file path=usr/include/clang/Tooling/CompilationDatabasePluginRegistry.h
+file path=usr/include/clang/Tooling/Core/Replacement.h
+file path=usr/include/clang/Tooling/FileMatchTrie.h
+file path=usr/include/clang/Tooling/JSONCompilationDatabase.h
+file path=usr/include/clang/Tooling/Refactoring.h
+file path=usr/include/clang/Tooling/RefactoringCallbacks.h
+file path=usr/include/clang/Tooling/ReplacementsYaml.h
+file path=usr/include/clang/Tooling/Tooling.h
+file path=usr/lib/$(MACH64)/libclang.a
+file path=usr/lib/$(MACH64)/libclangARCMigrate.a
+file path=usr/lib/$(MACH64)/libclangAST.a
+file path=usr/lib/$(MACH64)/libclangASTMatchers.a
+file path=usr/lib/$(MACH64)/libclangAnalysis.a
+file path=usr/lib/$(MACH64)/libclangBasic.a
+file path=usr/lib/$(MACH64)/libclangCodeGen.a
+file path=usr/lib/$(MACH64)/libclangDriver.a
+file path=usr/lib/$(MACH64)/libclangDynamicASTMatchers.a
+file path=usr/lib/$(MACH64)/libclangEdit.a
+file path=usr/lib/$(MACH64)/libclangFormat.a
+file path=usr/lib/$(MACH64)/libclangFrontend.a
+file path=usr/lib/$(MACH64)/libclangFrontendTool.a
+file path=usr/lib/$(MACH64)/libclangIndex.a
+file path=usr/lib/$(MACH64)/libclangLex.a
+file path=usr/lib/$(MACH64)/libclangParse.a
+file path=usr/lib/$(MACH64)/libclangRewrite.a
+file path=usr/lib/$(MACH64)/libclangRewriteFrontend.a
+file path=usr/lib/$(MACH64)/libclangSema.a
+file path=usr/lib/$(MACH64)/libclangSerialization.a
+file path=usr/lib/$(MACH64)/libclangStaticAnalyzerCheckers.a
+file path=usr/lib/$(MACH64)/libclangStaticAnalyzerCore.a
+file path=usr/lib/$(MACH64)/libclangStaticAnalyzerFrontend.a
+file path=usr/lib/$(MACH64)/libclangTooling.a
+file path=usr/lib/$(MACH64)/libclangToolingCore.a
+license llvm.license license="University of Illinois/NCSA"
+depend type=require fmri=pkg:/developer/llvm/llvm-build
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/clang.p5m	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,107 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+
+set name=pkg.fmri \
+    value=pkg:/developer/llvm/[email protected]$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+set name=pkg.summary \
+    value="clang $(COMPONENT_VERSION) runtime - The clang LLVM Compiler"
+set name=com.oracle.info.description \
+    value="clang - The C/C++/Objective-C/Objective-C++ compiler based on the LLVM Compiler Infrastructure Framework"
+set name=com.oracle.info.tpno value=$(TPNO)
+set name=info.classification value=org.opensolaris.category.2008:Development/C \
+    value=org.opensolaris.category.2008:Development/C++ \
+    value=org.opensolaris.category.2008:Development/GNU \
+    value="org.opensolaris.category.2008:Development/Objective C"
+set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
+set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
+set name=org.opensolaris.arc-caseid value=PSARC/2013/188
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+file path=usr/bin/clang
+hardlink path=usr/bin/clang++ target=clang
+file path=usr/bin/clang-check
+file path=usr/bin/clang-format
+file path=usr/bin/clang-tblgen
+file path=usr/lib/$(MACH64)/libclang.so
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/Intrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/__stddef_max_align_t.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/__wmmintrin_aes.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/__wmmintrin_pclmul.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/adxintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/altivec.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/ammintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/arm_acle.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/arm_neon.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/avx2intrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/avx512bwintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/avx512erintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/avx512fintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/avx512vlbwintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/avx512vlintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/avxintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/bmi2intrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/bmiintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/cpuid.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/emmintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/f16cintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/float.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/fma4intrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/fmaintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/ia32intrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/immintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/iso646.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/limits.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/lzcntintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/mm3dnow.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/mm_malloc.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/mmintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/module.modulemap
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/nmmintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/pmmintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/popcntintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/prfchwintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/rdseedintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/rtmintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/shaintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/smmintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/stdalign.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/stdarg.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/stdatomic.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/stdbool.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/stddef.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/stdint.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/stdnoreturn.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/tbmintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/tgmath.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/tmmintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/unwind.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/vadefs.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/varargs.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/wmmintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/x86intrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/xmmintrin.h
+file path=usr/lib/clang/$(COMPONENT_VERSION)/include/xopintrin.h
+license llvm.license license="University of Illinois/NCSA"
+depend type=require fmri=pkg:/system/header
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/cxa_finalize/Makefile	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,128 @@
+#
+## CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+
+COMPILER=gcc
+
+include ../../../make-rules/shared-macros.mk
+
+include $(WS_MAKE_RULES)/prep.mk
+include $(WS_MAKE_RULES)/configure.mk
+include $(WS_MAKE_RULES)/ips.mk
+
+COMPONENT_DIR := $(shell pwd)/..
+
+COMPONENT_PRE_BUILD_ACTION = \
+     ( $(MKDIR) build/$(MACH) ; \
+     $(MKDIR) build/$(MACH64) )
+
+OBJECTS = cxa_finalize-32.o cxa_finalize-64.o \
+	  cxa_finalize_pic-32.o cxa_finalize_pic-64.o
+
+include $(WS_MAKE_RULES)/prep.mk
+
+RELEASE_LIST=Debug+Asserts+Checks Debug+Asserts Debug Release+Debug Release Unoptimized
+
+CFLAGS = -g -O2 -std=c99 -Wall -Wextra -Wcast-align
+ARCH = $(shell uname -p)
+
+ifeq ($(ARCH),sparc)
+  CFLAGS += -mtune=ultrasparc -mcpu=ultrasparc -mvis
+endif
+
+ifeq ($(ARCH),i386)
+  CFLAGS += -mtune=opteron -march=opteron
+endif
+
+all:: $(OBJECTS)
+
+cxa_finalize-32.o: cxa_finalize.c
+	$(CC) -m32 $(CFLAGS) -c $< -o [email protected]
+
+cxa_finalize_pic-32.o: cxa_finalize.c
+	$(CC) -m32 $(CFLAGS) -fPIC -c $< -o [email protected]
+
+cxa_finalize-64.o: cxa_finalize.c
+	$(CC) -m64 $(CFLAGS) -c $< -o [email protected]
+
+cxa_finalize_pic-64.o: cxa_finalize.c
+	$(CC) -m64 $(CFLAGS) -fPIC -c $< -o [email protected]
+
+cxa_atexit-32.o: cxa_atexit.c
+	$(CC) -m32 $(CFLAGS) -c $< -o [email protected]
+
+cxa_atexit-64.o: cxa_atexit.c
+	$(CC) -m64 $(CFLAGS) -c $< -o [email protected]
+
+clean::
+	rm -f $(OBJECTS)
+
+check::	build
+	$(MKDIR) build/$(MACH)
+	$(MKDIR) build/$(MACH64)
+
+build: all
+
+install: build
+	$(MKDIR) $(PROTOUSRLIBDIR)/clang
+	$(MKDIR) $(PROTOUSRLIBDIR)/clang/$(MACH64)
+	$(CP) cxa_finalize-32.o \
+	  $(PROTOUSRLIBDIR)/clang/cxa_finalize.o
+	$(CP) cxa_finalize_pic-32.o \
+	  $(PROTOUSRLIBDIR)/clang/cxa_finalize_pic.o
+	$(CP) cxa_finalize-64.o \
+	  $(PROTOUSRLIBDIR)/clang/$(MACH64)/cxa_finalize.o
+	$(CP) cxa_finalize_pic-64.o \
+	  $(PROTOUSRLIBDIR)/clang/$(MACH64)/cxa_finalize_pic.o
+	list='$(RELEASE_LIST)'; for f in $$list; do \
+	     if test -d $(BUILD_DIR_32)/$$f/lib ; then \
+	     echo "Installing cxa_finalize in $(BUILD_DIR_32)/$$f/lib..." ; \
+	     $(MKDIR)  $(BUILD_DIR_32)/$$f/lib/$(MACH64) ; \
+	     $(CP) cxa_finalize-32.o \
+	     $(BUILD_DIR_32)/$$f/lib/cxa_finalize.o ; \
+	     $(CP) cxa_finalize_pic-32.o \
+	     $(BUILD_DIR_32)/$$f/lib/cxa_finalize_pic.o ; \
+	     $(CP) cxa_finalize-64.o \
+	     $(BUILD_DIR_32)/$$f/lib/$(MACH64)/cxa_finalize.o ; \
+	     $(CP) cxa_finalize_pic-64.o \
+	     $(BUILD_DIR_32)/$$f/lib/$(MACH64)/cxa_finalize_pic.o ; \
+	     fi ; \
+	     if test -d $(BUILD_DIR_64)/$$f/lib ; then \
+	     echo "Installing cxa_finalize in $(BUILD_DIR_64)/$$f/lib..." ; \
+	     $(MKDIR)  $(BUILD_DIR_64)/$$f/lib/$(MACH64) ; \
+	     $(CP) cxa_finalize-32.o \
+	     $(BUILD_DIR_64)/$$f/lib/cxa_finalize.o ; \
+	     $(CP) cxa_finalize_pic-32.o \
+	     $(BUILD_DIR_64)/$$f/lib/cxa_finalize_pic.o ; \
+	     $(CP) cxa_finalize-64.o \
+	     $(BUILD_DIR_64)/$$f/lib/$(MACH64)/cxa_finalize.o ; \
+	     $(CP) cxa_finalize_pic-64.o \
+	     $(BUILD_DIR_64)/$$f/lib/$(MACH64)/cxa_finalize_pic.o ; \
+	     fi ; \
+	     done
+
+test:
+	echo "No tests."
+
+system-test:
+	echo "No system tests."
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/cxa_finalize/cxa_finalize.c	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,280 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ */
+
+/* A Solaris implementation of the Itanium C++ ABI __cxa_atexit
+ * and __cxa_finalize functions.
+ */
+
+#include <stdlib.h>
+#include <pthread.h>
+
+#include "cxa_finalize.h"
+
+#define __CXA_FUNC_CALLBACK 0
+#define __CXA_FUNC_DONE     1
+#define __CXA_ATEXIT_CHUNK  64
+
+#define __DSO_TYPE_DESTRUCTOR 1
+#define __DSO_TYPE_DLCLOSE    2
+
+#define __DSO_SCOPE_LOCAL  4
+#define __DSO_SCOPE_GLOBAL 8
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct __cxxabi_atexit {
+  void (*cxa_func)(void*);
+  uint32_t type;
+  uint32_t dso_type;
+  uint32_t dso_scope;
+  void* arg;
+  void* dso;
+} cxxabi_atexit;
+
+typedef struct __cxxabi_atexit_list {
+  uint32_t size;
+  uint32_t nelem;
+  cxxabi_atexit* list;
+} cxxabi_atexit_list;
+
+__attribute__((__visibility__("hidden")))
+extern void* __dso_handle;
+
+static cxxabi_atexit_list _list;
+static pthread_mutex_t _mtx = PTHREAD_MUTEX_INITIALIZER;
+static uint32_t _registered = 0;
+static uint32_t _initialized = 0;
+
+static int __register_with_atexit(const cxxabi_atexit* cxa);
+static int __init_cxxabi_list(cxxabi_atexit** list);
+static int __resize_cxxabi_list(const cxxabi_atexit* oldlist, uint32_t nelem,
+                                cxxabi_atexit** newlist, uint32_t newsize);
+void __cxa_atexit_callback(void);
+static void __attribute__((destructor)) __do_cleanup(void);
+
+int __init_cxxabi_list(cxxabi_atexit** list) {
+  cxxabi_atexit* __p =
+    (cxxabi_atexit *) malloc (__CXA_ATEXIT_CHUNK * sizeof(cxxabi_atexit));
+
+  if (__p == NULL)
+    return -1;
+
+  *list = __p;
+  return 0;
+}
+
+int __resize_cxxabi_list(const cxxabi_atexit* oldlist, uint32_t nelem,
+                         cxxabi_atexit** newlist, uint32_t newsize) {
+  register cxxabi_atexit* __p =
+    (cxxabi_atexit *) malloc (newsize * sizeof(cxxabi_atexit));
+
+  if (__p == NULL)
+    return -1;
+
+  const cxxabi_atexit* __l = oldlist;
+
+  for (uint32_t i = 0; i < nelem; ++i)
+    *(__p + i) = *(__l + i);
+
+  *newlist = __p;
+
+  return 0;
+}
+
+int __register_with_atexit(const cxxabi_atexit* cxa) {
+  int ret = 0;
+
+  if (cxa == NULL)
+    return -1;
+
+  pthread_mutex_lock(&_mtx);
+
+  if (_initialized == 0) {
+    _list.nelem = 0;
+
+    ret = __init_cxxabi_list(&_list.list);
+
+    if (ret == -1) {
+      pthread_mutex_unlock(&_mtx);
+      return ret;
+    }
+
+    _list.size = __CXA_ATEXIT_CHUNK;
+    _initialized = 1;
+  }
+
+  if (_list.nelem == _list.size) {
+    uint32_t newsize = _list.size * 2;
+    cxxabi_atexit* __p;
+
+    ret = __resize_cxxabi_list(_list.list, _list.nelem, &__p, newsize);
+
+    if (ret == -1) {
+      free (_list.list);
+      _list.list = NULL;
+      _list.size = 0;
+      _list.nelem = 0;
+      pthread_mutex_unlock(&_mtx);
+      return ret;
+    }
+
+    _list.list = __p;
+    _list.size = newsize;
+  }
+
+  if (_registered == 0) {
+    ret = atexit(__cxa_atexit_callback);
+    _registered = (ret == 0);
+  }
+
+  if (_registered != 1) {
+    free (_list.list);
+    _list.list = NULL;
+    _list.size = 0;
+    _list.nelem = 0;
+    pthread_mutex_unlock(&_mtx);
+    return ret;
+  }
+
+  register cxxabi_atexit* __p = _list.list + _list.nelem;
+  *__p = *cxa;
+  ++_list.nelem;
+
+  pthread_mutex_unlock(&_mtx);
+  return ret;
+}
+
+void __cxa_atexit_callback(void) {
+  cxxabi_atexit* __e = _list.list + (_list.nelem - 1);
+  cxxabi_atexit* __p = __e;
+
+  if (__p == NULL)
+    return;
+
+  /* destroy local scope objects first */
+  for (int i = _list.nelem; i > 0; --i) {
+    if ((__p->type == __CXA_FUNC_CALLBACK) && 
+        (__p->dso_scope == __DSO_SCOPE_LOCAL)) {
+      __p->type = __CXA_FUNC_DONE;
+      __p->cxa_func(__p->arg);
+    }
+    --__p;
+  }
+
+  __p = __e;
+
+  /* destroy global scope objects last */
+  for (int i = _list.nelem; i > 0; --i) {
+    if ((__p->type == __CXA_FUNC_CALLBACK) &&
+        (__p->dso_scope == __DSO_SCOPE_GLOBAL)) {
+      __p->type = __CXA_FUNC_DONE;
+      __p->cxa_func(__p->arg);
+    }
+    --__p;
+  }
+}
+
+int __cxa_atexit(void (*destructor)(void*), void* arg, void* dso) {
+  cxxabi_atexit cxa;
+
+  cxa.type = __CXA_FUNC_CALLBACK;
+
+  /* get dso_type from dso object itself */
+  cxa.dso_type = __DSO_TYPE_DESTRUCTOR;
+
+  /* get dso scope from dso object */
+  cxa.dso_scope = __DSO_SCOPE_GLOBAL;
+  cxa.cxa_func = destructor;
+  cxa.arg = arg;
+  cxa.dso = dso;
+
+  return __register_with_atexit(&cxa);
+}
+
+int __cxa_finalize(void* dso) {
+  uint32_t i;
+  pthread_mutex_lock(&_mtx);
+
+  if (_initialized == 0) {
+    pthread_mutex_unlock(&_mtx);
+    return -1;
+  }
+
+  cxxabi_atexit* __p = _list.list;
+  pthread_mutex_unlock(&_mtx);
+
+  if (__p == NULL)
+    return -1;
+
+  if (dso == NULL) {
+    __p = _list.list + (_list.nelem - 1);
+
+    pthread_mutex_lock(&_mtx);
+
+    for (i = _list.nelem; i > 0; --i) {
+      if (__p->type == __CXA_FUNC_DONE) {
+        --__p;
+        continue;
+      }
+
+      uint32_t __type = __p->type;
+      __p->type = __CXA_FUNC_DONE;
+      pthread_mutex_unlock(&_mtx);
+
+      if (__type == __CXA_FUNC_CALLBACK)
+        __p->cxa_func(__p->arg);
+
+      --__p;
+      pthread_mutex_lock(&_mtx);
+    }
+
+    pthread_mutex_unlock(&_mtx);
+  } else {
+    i = 0;
+    do {
+      if (__p->dso == dso) {
+        pthread_mutex_lock(&_mtx);
+        uint32_t __type = __p->type;
+        __p->type = __CXA_FUNC_DONE;
+        pthread_mutex_unlock(&_mtx);
+
+        if (__type == __CXA_FUNC_CALLBACK)
+          __p->cxa_func(__p->arg);
+      }
+      ++__p; ++i;
+    } while (i < _list.nelem);
+  }
+
+  return 0;
+}
+
+void __attribute__((destructor)) __do_cleanup(void) {
+  __cxa_finalize(__dso_handle);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/cxa_finalize/cxa_finalize.h	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ */
+
+/* A Solaris implementation of the Itanium C++ ABI __cxa_atexit
+ * and __cxa_finalize functions.
+ */
+
+#ifndef _CXA_FINALIZE_H
+#define _CXA_FINALIZE_H
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int
+__attribute__((visibility("hidden")))
+__cxa_atexit(void (*destructor)(void*), void* arg, void* dso);
+
+extern int __attribute__((visibility("hidden")))
+__cxa_finalize(void* dso);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CXA_FINALIZE_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/llvm-build.p5m	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,745 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+
+set name=pkg.fmri \
+    value=pkg:/developer/llvm/[email protected]$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+set name=pkg.summary \
+    value="LLVM $(COMPONENT_VERSION) Development Files and Libraries"
+set name=com.oracle.info.description \
+    value="LLVM - The Low Level Virtual Machine Compiler Infrastructure Framework - Development Files and Libraries"
+set name=com.oracle.info.tpno value=$(TPNO)
+set name=info.classification value=org.opensolaris.category.2008:Development/C \
+    value=org.opensolaris.category.2008:Development/C++ \
+    value=org.opensolaris.category.2008:Development/GNU \
+    value="org.opensolaris.category.2008:Development/Objective C"
+set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
+set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
+set name=org.opensolaris.arc-caseid value=PSARC/2013/188
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+file path=usr/include/llvm-c/Analysis.h
+file path=usr/include/llvm-c/BitReader.h
+file path=usr/include/llvm-c/BitWriter.h
+file path=usr/include/llvm-c/Core.h
+file path=usr/include/llvm-c/Disassembler.h
+file path=usr/include/llvm-c/ExecutionEngine.h
+file path=usr/include/llvm-c/IRReader.h
+file path=usr/include/llvm-c/Initialization.h
+file path=usr/include/llvm-c/LinkTimeOptimizer.h
+file path=usr/include/llvm-c/Linker.h
+file path=usr/include/llvm-c/Object.h
+file path=usr/include/llvm-c/Support.h
+file path=usr/include/llvm-c/Target.h
+file path=usr/include/llvm-c/TargetMachine.h
+file path=usr/include/llvm-c/Transforms/IPO.h
+file path=usr/include/llvm-c/Transforms/PassManagerBuilder.h
+file path=usr/include/llvm-c/Transforms/Scalar.h
+file path=usr/include/llvm-c/Transforms/Vectorize.h
+file path=usr/include/llvm-c/lto.h
+file path=usr/include/llvm/ADT/APFloat.h
+file path=usr/include/llvm/ADT/APInt.h
+file path=usr/include/llvm/ADT/APSInt.h
+file path=usr/include/llvm/ADT/ArrayRef.h
+file path=usr/include/llvm/ADT/BitVector.h
+file path=usr/include/llvm/ADT/DAGDeltaAlgorithm.h
+file path=usr/include/llvm/ADT/DeltaAlgorithm.h
+file path=usr/include/llvm/ADT/DenseMap.h
+file path=usr/include/llvm/ADT/DenseMapInfo.h
+file path=usr/include/llvm/ADT/DenseSet.h
+file path=usr/include/llvm/ADT/DepthFirstIterator.h
+file path=usr/include/llvm/ADT/EquivalenceClasses.h
+file path=usr/include/llvm/ADT/FoldingSet.h
+file path=usr/include/llvm/ADT/GraphTraits.h
+file path=usr/include/llvm/ADT/Hashing.h
+file path=usr/include/llvm/ADT/ImmutableList.h
+file path=usr/include/llvm/ADT/ImmutableMap.h
+file path=usr/include/llvm/ADT/ImmutableSet.h
+file path=usr/include/llvm/ADT/IndexedMap.h
+file path=usr/include/llvm/ADT/IntEqClasses.h
+file path=usr/include/llvm/ADT/IntervalMap.h
+file path=usr/include/llvm/ADT/IntrusiveRefCntPtr.h
+file path=usr/include/llvm/ADT/MapVector.h
+file path=usr/include/llvm/ADT/None.h
+file path=usr/include/llvm/ADT/Optional.h
+file path=usr/include/llvm/ADT/PackedVector.h
+file path=usr/include/llvm/ADT/PointerIntPair.h
+file path=usr/include/llvm/ADT/PointerUnion.h
+file path=usr/include/llvm/ADT/PostOrderIterator.h
+file path=usr/include/llvm/ADT/PriorityQueue.h
+file path=usr/include/llvm/ADT/SCCIterator.h
+file path=usr/include/llvm/ADT/STLExtras.h
+file path=usr/include/llvm/ADT/ScopedHashTable.h
+file path=usr/include/llvm/ADT/SetOperations.h
+file path=usr/include/llvm/ADT/SetVector.h
+file path=usr/include/llvm/ADT/SmallBitVector.h
+file path=usr/include/llvm/ADT/SmallPtrSet.h
+file path=usr/include/llvm/ADT/SmallSet.h
+file path=usr/include/llvm/ADT/SmallString.h
+file path=usr/include/llvm/ADT/SmallVector.h
+file path=usr/include/llvm/ADT/SparseBitVector.h
+file path=usr/include/llvm/ADT/SparseMultiSet.h
+file path=usr/include/llvm/ADT/SparseSet.h
+file path=usr/include/llvm/ADT/Statistic.h
+file path=usr/include/llvm/ADT/StringExtras.h
+file path=usr/include/llvm/ADT/StringMap.h
+file path=usr/include/llvm/ADT/StringRef.h
+file path=usr/include/llvm/ADT/StringSet.h
+file path=usr/include/llvm/ADT/StringSwitch.h
+file path=usr/include/llvm/ADT/TinyPtrVector.h
+file path=usr/include/llvm/ADT/Triple.h
+file path=usr/include/llvm/ADT/Twine.h
+file path=usr/include/llvm/ADT/UniqueVector.h
+file path=usr/include/llvm/ADT/VariadicFunction.h
+file path=usr/include/llvm/ADT/edit_distance.h
+file path=usr/include/llvm/ADT/ilist.h
+file path=usr/include/llvm/ADT/ilist_node.h
+file path=usr/include/llvm/ADT/iterator.h
+file path=usr/include/llvm/ADT/iterator_range.h
+file path=usr/include/llvm/Analysis/AliasAnalysis.h
+file path=usr/include/llvm/Analysis/AliasSetTracker.h
+file path=usr/include/llvm/Analysis/AssumptionCache.h
+file path=usr/include/llvm/Analysis/BlockFrequencyInfo.h
+file path=usr/include/llvm/Analysis/BlockFrequencyInfoImpl.h
+file path=usr/include/llvm/Analysis/BranchProbabilityInfo.h
+file path=usr/include/llvm/Analysis/CFG.h
+file path=usr/include/llvm/Analysis/CFGPrinter.h
+file path=usr/include/llvm/Analysis/CGSCCPassManager.h
+file path=usr/include/llvm/Analysis/CallGraph.h
+file path=usr/include/llvm/Analysis/CallGraphSCCPass.h
+file path=usr/include/llvm/Analysis/CallPrinter.h
+file path=usr/include/llvm/Analysis/CaptureTracking.h
+file path=usr/include/llvm/Analysis/CodeMetrics.h
+file path=usr/include/llvm/Analysis/ConstantFolding.h
+file path=usr/include/llvm/Analysis/ConstantsScanner.h
+file path=usr/include/llvm/Analysis/DOTGraphTraitsPass.h
+file path=usr/include/llvm/Analysis/DependenceAnalysis.h
+file path=usr/include/llvm/Analysis/DomPrinter.h
+file path=usr/include/llvm/Analysis/DominanceFrontier.h
+file path=usr/include/llvm/Analysis/DominanceFrontierImpl.h
+file path=usr/include/llvm/Analysis/FunctionTargetTransformInfo.h
+file path=usr/include/llvm/Analysis/IVUsers.h
+file path=usr/include/llvm/Analysis/InlineCost.h
+file path=usr/include/llvm/Analysis/InstructionSimplify.h
+file path=usr/include/llvm/Analysis/Interval.h
+file path=usr/include/llvm/Analysis/IntervalIterator.h
+file path=usr/include/llvm/Analysis/IntervalPartition.h
+file path=usr/include/llvm/Analysis/JumpInstrTableInfo.h
+file path=usr/include/llvm/Analysis/LazyCallGraph.h
+file path=usr/include/llvm/Analysis/LazyValueInfo.h
+file path=usr/include/llvm/Analysis/LibCallAliasAnalysis.h
+file path=usr/include/llvm/Analysis/LibCallSemantics.h
+file path=usr/include/llvm/Analysis/Lint.h
+file path=usr/include/llvm/Analysis/Loads.h
+file path=usr/include/llvm/Analysis/LoopInfo.h
+file path=usr/include/llvm/Analysis/LoopInfoImpl.h
+file path=usr/include/llvm/Analysis/LoopIterator.h
+file path=usr/include/llvm/Analysis/LoopPass.h
+file path=usr/include/llvm/Analysis/MemoryBuiltins.h
+file path=usr/include/llvm/Analysis/MemoryDependenceAnalysis.h
+file path=usr/include/llvm/Analysis/PHITransAddr.h
+file path=usr/include/llvm/Analysis/Passes.h
+file path=usr/include/llvm/Analysis/PostDominators.h
+file path=usr/include/llvm/Analysis/PtrUseVisitor.h
+file path=usr/include/llvm/Analysis/RegionInfo.h
+file path=usr/include/llvm/Analysis/RegionInfoImpl.h
+file path=usr/include/llvm/Analysis/RegionIterator.h
+file path=usr/include/llvm/Analysis/RegionPass.h
+file path=usr/include/llvm/Analysis/RegionPrinter.h
+file path=usr/include/llvm/Analysis/ScalarEvolution.h
+file path=usr/include/llvm/Analysis/ScalarEvolutionExpander.h
+file path=usr/include/llvm/Analysis/ScalarEvolutionExpressions.h
+file path=usr/include/llvm/Analysis/ScalarEvolutionNormalization.h
+file path=usr/include/llvm/Analysis/SparsePropagation.h
+file path=usr/include/llvm/Analysis/TargetFolder.h
+file path=usr/include/llvm/Analysis/TargetTransformInfo.h
+file path=usr/include/llvm/Analysis/Trace.h
+file path=usr/include/llvm/Analysis/ValueTracking.h
+file path=usr/include/llvm/AsmParser/Parser.h
+file path=usr/include/llvm/Bitcode/BitCodes.h
+file path=usr/include/llvm/Bitcode/BitcodeWriterPass.h
+file path=usr/include/llvm/Bitcode/BitstreamReader.h
+file path=usr/include/llvm/Bitcode/BitstreamWriter.h
+file path=usr/include/llvm/Bitcode/LLVMBitCodes.h
+file path=usr/include/llvm/Bitcode/ReaderWriter.h
+file path=usr/include/llvm/CodeGen/Analysis.h
+file path=usr/include/llvm/CodeGen/AsmPrinter.h
+file path=usr/include/llvm/CodeGen/CalcSpillWeights.h
+file path=usr/include/llvm/CodeGen/CallingConvLower.h
+file path=usr/include/llvm/CodeGen/CommandFlags.h
+file path=usr/include/llvm/CodeGen/DAGCombine.h
+file path=usr/include/llvm/CodeGen/DFAPacketizer.h
+file path=usr/include/llvm/CodeGen/DIE.h
+file path=usr/include/llvm/CodeGen/EdgeBundles.h
+file path=usr/include/llvm/CodeGen/FastISel.h
+file path=usr/include/llvm/CodeGen/ForwardControlFlowIntegrity.h
+file path=usr/include/llvm/CodeGen/FunctionLoweringInfo.h
+file path=usr/include/llvm/CodeGen/GCMetadata.h
+file path=usr/include/llvm/CodeGen/GCMetadataPrinter.h
+file path=usr/include/llvm/CodeGen/GCStrategy.h
+file path=usr/include/llvm/CodeGen/GCs.h
+file path=usr/include/llvm/CodeGen/ISDOpcodes.h
+file path=usr/include/llvm/CodeGen/IntrinsicLowering.h
+file path=usr/include/llvm/CodeGen/JumpInstrTables.h
+file path=usr/include/llvm/CodeGen/LatencyPriorityQueue.h
+file path=usr/include/llvm/CodeGen/LexicalScopes.h
+file path=usr/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
+file path=usr/include/llvm/CodeGen/LinkAllCodegenComponents.h
+file path=usr/include/llvm/CodeGen/LiveInterval.h
+file path=usr/include/llvm/CodeGen/LiveIntervalAnalysis.h
+file path=usr/include/llvm/CodeGen/LiveIntervalUnion.h
+file path=usr/include/llvm/CodeGen/LivePhysRegs.h
+file path=usr/include/llvm/CodeGen/LiveRangeEdit.h
+file path=usr/include/llvm/CodeGen/LiveRegMatrix.h
+file path=usr/include/llvm/CodeGen/LiveStackAnalysis.h
+file path=usr/include/llvm/CodeGen/LiveVariables.h
+file path=usr/include/llvm/CodeGen/MachORelocation.h
+file path=usr/include/llvm/CodeGen/MachineBasicBlock.h
+file path=usr/include/llvm/CodeGen/MachineBlockFrequencyInfo.h
+file path=usr/include/llvm/CodeGen/MachineBranchProbabilityInfo.h
+file path=usr/include/llvm/CodeGen/MachineCombinerPattern.h
+file path=usr/include/llvm/CodeGen/MachineConstantPool.h
+file path=usr/include/llvm/CodeGen/MachineDominanceFrontier.h
+file path=usr/include/llvm/CodeGen/MachineDominators.h
+file path=usr/include/llvm/CodeGen/MachineFrameInfo.h
+file path=usr/include/llvm/CodeGen/MachineFunction.h
+file path=usr/include/llvm/CodeGen/MachineFunctionAnalysis.h
+file path=usr/include/llvm/CodeGen/MachineFunctionPass.h
+file path=usr/include/llvm/CodeGen/MachineInstr.h
+file path=usr/include/llvm/CodeGen/MachineInstrBuilder.h
+file path=usr/include/llvm/CodeGen/MachineInstrBundle.h
+file path=usr/include/llvm/CodeGen/MachineJumpTableInfo.h
+file path=usr/include/llvm/CodeGen/MachineLoopInfo.h
+file path=usr/include/llvm/CodeGen/MachineMemOperand.h
+file path=usr/include/llvm/CodeGen/MachineModuleInfo.h
+file path=usr/include/llvm/CodeGen/MachineModuleInfoImpls.h
+file path=usr/include/llvm/CodeGen/MachineOperand.h
+file path=usr/include/llvm/CodeGen/MachinePassRegistry.h
+file path=usr/include/llvm/CodeGen/MachinePostDominators.h
+file path=usr/include/llvm/CodeGen/MachineRegionInfo.h
+file path=usr/include/llvm/CodeGen/MachineRegisterInfo.h
+file path=usr/include/llvm/CodeGen/MachineSSAUpdater.h
+file path=usr/include/llvm/CodeGen/MachineScheduler.h
+file path=usr/include/llvm/CodeGen/MachineTraceMetrics.h
+file path=usr/include/llvm/CodeGen/MachineValueType.h
+file path=usr/include/llvm/CodeGen/PBQP/CostAllocator.h
+file path=usr/include/llvm/CodeGen/PBQP/Graph.h
+file path=usr/include/llvm/CodeGen/PBQP/Math.h
+file path=usr/include/llvm/CodeGen/PBQP/ReductionRules.h
+file path=usr/include/llvm/CodeGen/PBQP/Solution.h
+file path=usr/include/llvm/CodeGen/PBQPRAConstraint.h
+file path=usr/include/llvm/CodeGen/Passes.h
+file path=usr/include/llvm/CodeGen/PseudoSourceValue.h
+file path=usr/include/llvm/CodeGen/RegAllocPBQP.h
+file path=usr/include/llvm/CodeGen/RegAllocRegistry.h
+file path=usr/include/llvm/CodeGen/RegisterClassInfo.h
+file path=usr/include/llvm/CodeGen/RegisterPressure.h
+file path=usr/include/llvm/CodeGen/RegisterScavenging.h
+file path=usr/include/llvm/CodeGen/ResourcePriorityQueue.h
+file path=usr/include/llvm/CodeGen/RuntimeLibcalls.h
+file path=usr/include/llvm/CodeGen/ScheduleDAG.h
+file path=usr/include/llvm/CodeGen/ScheduleDAGInstrs.h
+file path=usr/include/llvm/CodeGen/ScheduleDFS.h
+file path=usr/include/llvm/CodeGen/ScheduleHazardRecognizer.h
+file path=usr/include/llvm/CodeGen/SchedulerRegistry.h
+file path=usr/include/llvm/CodeGen/ScoreboardHazardRecognizer.h
+file path=usr/include/llvm/CodeGen/SelectionDAG.h
+file path=usr/include/llvm/CodeGen/SelectionDAGISel.h
+file path=usr/include/llvm/CodeGen/SelectionDAGNodes.h
+file path=usr/include/llvm/CodeGen/SlotIndexes.h
+file path=usr/include/llvm/CodeGen/StackMapLivenessAnalysis.h
+file path=usr/include/llvm/CodeGen/StackMaps.h
+file path=usr/include/llvm/CodeGen/StackProtector.h
+file path=usr/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
+file path=usr/include/llvm/CodeGen/TargetSchedule.h
+file path=usr/include/llvm/CodeGen/ValueTypes.h
+file path=usr/include/llvm/CodeGen/ValueTypes.td
+file path=usr/include/llvm/CodeGen/VirtRegMap.h
+file path=usr/include/llvm/Config/AsmParsers.def
+file path=usr/include/llvm/Config/AsmPrinters.def
+file path=usr/include/llvm/Config/Disassemblers.def
+file path=usr/include/llvm/Config/Targets.def
+file path=usr/include/llvm/Config/config.h
+file path=usr/include/llvm/Config/llvm-config.h
+file path=usr/include/llvm/DebugInfo/DIContext.h
+file path=usr/include/llvm/DebugInfo/DWARFAbbreviationDeclaration.h
+file path=usr/include/llvm/DebugInfo/DWARFAcceleratorTable.h
+file path=usr/include/llvm/DebugInfo/DWARFCompileUnit.h
+file path=usr/include/llvm/DebugInfo/DWARFContext.h
+file path=usr/include/llvm/DebugInfo/DWARFDebugAbbrev.h
+file path=usr/include/llvm/DebugInfo/DWARFDebugArangeSet.h
+file path=usr/include/llvm/DebugInfo/DWARFDebugAranges.h
+file path=usr/include/llvm/DebugInfo/DWARFDebugFrame.h
+file path=usr/include/llvm/DebugInfo/DWARFDebugInfoEntry.h
+file path=usr/include/llvm/DebugInfo/DWARFDebugLine.h
+file path=usr/include/llvm/DebugInfo/DWARFDebugLoc.h
+file path=usr/include/llvm/DebugInfo/DWARFDebugRangeList.h
+file path=usr/include/llvm/DebugInfo/DWARFFormValue.h
+file path=usr/include/llvm/DebugInfo/DWARFRelocMap.h
+file path=usr/include/llvm/DebugInfo/DWARFSection.h
+file path=usr/include/llvm/DebugInfo/DWARFTypeUnit.h
+file path=usr/include/llvm/DebugInfo/DWARFUnit.h
+file path=usr/include/llvm/ExecutionEngine/ExecutionEngine.h
+file path=usr/include/llvm/ExecutionEngine/GenericValue.h
+file path=usr/include/llvm/ExecutionEngine/Interpreter.h
+file path=usr/include/llvm/ExecutionEngine/JITEventListener.h
+file path=usr/include/llvm/ExecutionEngine/MCJIT.h
+file path=usr/include/llvm/ExecutionEngine/OProfileWrapper.h
+file path=usr/include/llvm/ExecutionEngine/ObjectCache.h
+file path=usr/include/llvm/ExecutionEngine/RTDyldMemoryManager.h
+file path=usr/include/llvm/ExecutionEngine/RuntimeDyld.h
+file path=usr/include/llvm/ExecutionEngine/RuntimeDyldChecker.h
+file path=usr/include/llvm/ExecutionEngine/SectionMemoryManager.h
+file path=usr/include/llvm/IR/Argument.h
+file path=usr/include/llvm/IR/AssemblyAnnotationWriter.h
+file path=usr/include/llvm/IR/Attributes.h
+file path=usr/include/llvm/IR/AutoUpgrade.h
+file path=usr/include/llvm/IR/BasicBlock.h
+file path=usr/include/llvm/IR/CFG.h
+file path=usr/include/llvm/IR/CallSite.h
+file path=usr/include/llvm/IR/CallingConv.h
+file path=usr/include/llvm/IR/Comdat.h
+file path=usr/include/llvm/IR/Constant.h
+file path=usr/include/llvm/IR/ConstantFolder.h
+file path=usr/include/llvm/IR/ConstantRange.h
+file path=usr/include/llvm/IR/Constants.h
+file path=usr/include/llvm/IR/DIBuilder.h
+file path=usr/include/llvm/IR/DataLayout.h
+file path=usr/include/llvm/IR/DebugInfo.h
+file path=usr/include/llvm/IR/DebugLoc.h
+file path=usr/include/llvm/IR/DerivedTypes.h
+file path=usr/include/llvm/IR/DiagnosticInfo.h
+file path=usr/include/llvm/IR/DiagnosticPrinter.h
+file path=usr/include/llvm/IR/Dominators.h
+file path=usr/include/llvm/IR/Function.h
+file path=usr/include/llvm/IR/GVMaterializer.h
+file path=usr/include/llvm/IR/GetElementPtrTypeIterator.h
+file path=usr/include/llvm/IR/GlobalAlias.h
+file path=usr/include/llvm/IR/GlobalObject.h
+file path=usr/include/llvm/IR/GlobalValue.h
+file path=usr/include/llvm/IR/GlobalVariable.h
+file path=usr/include/llvm/IR/IRBuilder.h
+file path=usr/include/llvm/IR/IRPrintingPasses.h
+file path=usr/include/llvm/IR/InlineAsm.h
+file path=usr/include/llvm/IR/InstIterator.h
+file path=usr/include/llvm/IR/InstVisitor.h
+file path=usr/include/llvm/IR/InstrTypes.h
+file path=usr/include/llvm/IR/Instruction.def
+file path=usr/include/llvm/IR/Instruction.h
+file path=usr/include/llvm/IR/Instructions.h
+file path=usr/include/llvm/IR/IntrinsicInst.h
+file path=usr/include/llvm/IR/Intrinsics.gen
+file path=usr/include/llvm/IR/Intrinsics.h
+file path=usr/include/llvm/IR/Intrinsics.td
+file path=usr/include/llvm/IR/IntrinsicsAArch64.td
+file path=usr/include/llvm/IR/IntrinsicsARM.td
+file path=usr/include/llvm/IR/IntrinsicsHexagon.td
+file path=usr/include/llvm/IR/IntrinsicsMips.td
+file path=usr/include/llvm/IR/IntrinsicsNVVM.td
+file path=usr/include/llvm/IR/IntrinsicsPowerPC.td
+file path=usr/include/llvm/IR/IntrinsicsR600.td
+file path=usr/include/llvm/IR/IntrinsicsX86.td
+file path=usr/include/llvm/IR/IntrinsicsXCore.td
+file path=usr/include/llvm/IR/LLVMContext.h
+file path=usr/include/llvm/IR/LegacyPassManager.h
+file path=usr/include/llvm/IR/LegacyPassManagers.h
+file path=usr/include/llvm/IR/LegacyPassNameParser.h
+file path=usr/include/llvm/IR/MDBuilder.h
+file path=usr/include/llvm/IR/Mangler.h
+file path=usr/include/llvm/IR/Metadata.def
+file path=usr/include/llvm/IR/Metadata.h
+file path=usr/include/llvm/IR/MetadataTracking.h
+file path=usr/include/llvm/IR/Module.h
+file path=usr/include/llvm/IR/NoFolder.h
+file path=usr/include/llvm/IR/OperandTraits.h
+file path=usr/include/llvm/IR/Operator.h
+file path=usr/include/llvm/IR/PassManager.h
+file path=usr/include/llvm/IR/PassManagerInternal.h
+file path=usr/include/llvm/IR/PatternMatch.h
+file path=usr/include/llvm/IR/PredIteratorCache.h
+file path=usr/include/llvm/IR/Statepoint.h
+file path=usr/include/llvm/IR/SymbolTableListTraits.h
+file path=usr/include/llvm/IR/TrackingMDRef.h
+file path=usr/include/llvm/IR/Type.h
+file path=usr/include/llvm/IR/TypeBuilder.h
+file path=usr/include/llvm/IR/TypeFinder.h
+file path=usr/include/llvm/IR/Use.h
+file path=usr/include/llvm/IR/UseListOrder.h
+file path=usr/include/llvm/IR/User.h
+file path=usr/include/llvm/IR/Value.h
+file path=usr/include/llvm/IR/ValueHandle.h
+file path=usr/include/llvm/IR/ValueMap.h
+file path=usr/include/llvm/IR/ValueSymbolTable.h
+file path=usr/include/llvm/IR/Verifier.h
+file path=usr/include/llvm/IRReader/IRReader.h
+file path=usr/include/llvm/InitializePasses.h
+file path=usr/include/llvm/LTO/LTOCodeGenerator.h
+file path=usr/include/llvm/LTO/LTOModule.h
+file path=usr/include/llvm/LineEditor/LineEditor.h
+file path=usr/include/llvm/LinkAllIR.h
+file path=usr/include/llvm/LinkAllPasses.h
+file path=usr/include/llvm/Linker/Linker.h
+file path=usr/include/llvm/MC/ConstantPools.h
+file path=usr/include/llvm/MC/MCAsmBackend.h
+file path=usr/include/llvm/MC/MCAsmInfo.h
+file path=usr/include/llvm/MC/MCAsmInfoCOFF.h
+file path=usr/include/llvm/MC/MCAsmInfoDarwin.h
+file path=usr/include/llvm/MC/MCAsmInfoELF.h
+file path=usr/include/llvm/MC/MCAsmLayout.h
+file path=usr/include/llvm/MC/MCAssembler.h
+file path=usr/include/llvm/MC/MCCodeEmitter.h
+file path=usr/include/llvm/MC/MCCodeGenInfo.h
+file path=usr/include/llvm/MC/MCContext.h
+file path=usr/include/llvm/MC/MCDirectives.h
+file path=usr/include/llvm/MC/MCDisassembler.h
+file path=usr/include/llvm/MC/MCDwarf.h
+file path=usr/include/llvm/MC/MCELF.h
+file path=usr/include/llvm/MC/MCELFObjectWriter.h
+file path=usr/include/llvm/MC/MCELFStreamer.h
+file path=usr/include/llvm/MC/MCELFSymbolFlags.h
+file path=usr/include/llvm/MC/MCExpr.h
+file path=usr/include/llvm/MC/MCExternalSymbolizer.h
+file path=usr/include/llvm/MC/MCFixedLenDisassembler.h
+file path=usr/include/llvm/MC/MCFixup.h
+file path=usr/include/llvm/MC/MCFixupKindInfo.h
+file path=usr/include/llvm/MC/MCInst.h
+file path=usr/include/llvm/MC/MCInstBuilder.h
+file path=usr/include/llvm/MC/MCInstPrinter.h
+file path=usr/include/llvm/MC/MCInstrAnalysis.h
+file path=usr/include/llvm/MC/MCInstrDesc.h
+file path=usr/include/llvm/MC/MCInstrInfo.h
+file path=usr/include/llvm/MC/MCInstrItineraries.h
+file path=usr/include/llvm/MC/MCLabel.h
+file path=usr/include/llvm/MC/MCLinkerOptimizationHint.h
+file path=usr/include/llvm/MC/MCMachOSymbolFlags.h
+file path=usr/include/llvm/MC/MCMachObjectWriter.h
+file path=usr/include/llvm/MC/MCObjectFileInfo.h
+file path=usr/include/llvm/MC/MCObjectStreamer.h
+file path=usr/include/llvm/MC/MCObjectWriter.h
+file path=usr/include/llvm/MC/MCParser/AsmCond.h
+file path=usr/include/llvm/MC/MCParser/AsmLexer.h
+file path=usr/include/llvm/MC/MCParser/MCAsmLexer.h
+file path=usr/include/llvm/MC/MCParser/MCAsmParser.h
+file path=usr/include/llvm/MC/MCParser/MCAsmParserExtension.h
+file path=usr/include/llvm/MC/MCParser/MCParsedAsmOperand.h
+file path=usr/include/llvm/MC/MCRegisterInfo.h
+file path=usr/include/llvm/MC/MCRelocationInfo.h
+file path=usr/include/llvm/MC/MCSchedule.h
+file path=usr/include/llvm/MC/MCSection.h
+file path=usr/include/llvm/MC/MCSectionCOFF.h
+file path=usr/include/llvm/MC/MCSectionELF.h
+file path=usr/include/llvm/MC/MCSectionMachO.h
+file path=usr/include/llvm/MC/MCStreamer.h
+file path=usr/include/llvm/MC/MCSubtargetInfo.h
+file path=usr/include/llvm/MC/MCSymbol.h
+file path=usr/include/llvm/MC/MCSymbolizer.h
+file path=usr/include/llvm/MC/MCTargetAsmParser.h
+file path=usr/include/llvm/MC/MCTargetOptions.h
+file path=usr/include/llvm/MC/MCTargetOptionsCommandFlags.h
+file path=usr/include/llvm/MC/MCValue.h
+file path=usr/include/llvm/MC/MCWin64EH.h
+file path=usr/include/llvm/MC/MCWinCOFFObjectWriter.h
+file path=usr/include/llvm/MC/MCWinCOFFStreamer.h
+file path=usr/include/llvm/MC/MCWinEH.h
+file path=usr/include/llvm/MC/MachineLocation.h
+file path=usr/include/llvm/MC/SectionKind.h
+file path=usr/include/llvm/MC/StringTableBuilder.h
+file path=usr/include/llvm/MC/SubtargetFeature.h
+file path=usr/include/llvm/MC/YAML.h
+file path=usr/include/llvm/Object/Archive.h
+file path=usr/include/llvm/Object/Binary.h
+file path=usr/include/llvm/Object/COFF.h
+file path=usr/include/llvm/Object/COFFYAML.h
+file path=usr/include/llvm/Object/ELF.h
+file path=usr/include/llvm/Object/ELFObjectFile.h
+file path=usr/include/llvm/Object/ELFTypes.h
+file path=usr/include/llvm/Object/ELFYAML.h
+file path=usr/include/llvm/Object/Error.h
+file path=usr/include/llvm/Object/IRObjectFile.h
+file path=usr/include/llvm/Object/MachO.h
+file path=usr/include/llvm/Object/MachOUniversal.h
+file path=usr/include/llvm/Object/ObjectFile.h
+file path=usr/include/llvm/Object/RelocVisitor.h
+file path=usr/include/llvm/Object/SymbolicFile.h
+file path=usr/include/llvm/Option/Arg.h
+file path=usr/include/llvm/Option/ArgList.h
+file path=usr/include/llvm/Option/OptParser.td
+file path=usr/include/llvm/Option/OptSpecifier.h
+file path=usr/include/llvm/Option/OptTable.h
+file path=usr/include/llvm/Option/Option.h
+file path=usr/include/llvm/Pass.h
+file path=usr/include/llvm/PassAnalysisSupport.h
+file path=usr/include/llvm/PassInfo.h
+file path=usr/include/llvm/PassManager.h
+file path=usr/include/llvm/PassRegistry.h
+file path=usr/include/llvm/PassSupport.h
+file path=usr/include/llvm/ProfileData/CoverageMapping.h
+file path=usr/include/llvm/ProfileData/CoverageMappingReader.h
+file path=usr/include/llvm/ProfileData/CoverageMappingWriter.h
+file path=usr/include/llvm/ProfileData/InstrProf.h
+file path=usr/include/llvm/ProfileData/InstrProfReader.h
+file path=usr/include/llvm/ProfileData/InstrProfWriter.h
+file path=usr/include/llvm/ProfileData/SampleProf.h
+file path=usr/include/llvm/ProfileData/SampleProfReader.h
+file path=usr/include/llvm/ProfileData/SampleProfWriter.h
+file path=usr/include/llvm/Support/AIXDataTypesFix.h
+file path=usr/include/llvm/Support/ARMBuildAttributes.h
+file path=usr/include/llvm/Support/ARMEHABI.h
+file path=usr/include/llvm/Support/ARMWinEH.h
+file path=usr/include/llvm/Support/AlignOf.h
+file path=usr/include/llvm/Support/Allocator.h
+file path=usr/include/llvm/Support/ArrayRecycler.h
+file path=usr/include/llvm/Support/Atomic.h
+file path=usr/include/llvm/Support/BlockFrequency.h
+file path=usr/include/llvm/Support/BranchProbability.h
+file path=usr/include/llvm/Support/CBindingWrapping.h
+file path=usr/include/llvm/Support/COFF.h
+file path=usr/include/llvm/Support/Capacity.h
+file path=usr/include/llvm/Support/Casting.h
+file path=usr/include/llvm/Support/CodeGen.h
+file path=usr/include/llvm/Support/CommandLine.h
+file path=usr/include/llvm/Support/Compiler.h
+file path=usr/include/llvm/Support/Compression.h
+file path=usr/include/llvm/Support/ConvertUTF.h
+file path=usr/include/llvm/Support/CrashRecoveryContext.h
+file path=usr/include/llvm/Support/DOTGraphTraits.h
+file path=usr/include/llvm/Support/DataExtractor.h
+file path=usr/include/llvm/Support/DataStream.h
+file path=usr/include/llvm/Support/DataTypes.h
+file path=usr/include/llvm/Support/Debug.h
+file path=usr/include/llvm/Support/Dwarf.h
+file path=usr/include/llvm/Support/DynamicLibrary.h
+file path=usr/include/llvm/Support/ELF.h
+file path=usr/include/llvm/Support/ELFRelocs/AArch64.def
+file path=usr/include/llvm/Support/ELFRelocs/ARM.def
+file path=usr/include/llvm/Support/ELFRelocs/Hexagon.def
+file path=usr/include/llvm/Support/ELFRelocs/Mips.def
+file path=usr/include/llvm/Support/ELFRelocs/PowerPC.def
+file path=usr/include/llvm/Support/ELFRelocs/PowerPC64.def
+file path=usr/include/llvm/Support/ELFRelocs/Sparc.def
+file path=usr/include/llvm/Support/ELFRelocs/SystemZ.def
+file path=usr/include/llvm/Support/ELFRelocs/i386.def
+file path=usr/include/llvm/Support/ELFRelocs/x86_64.def
+file path=usr/include/llvm/Support/Endian.h
+file path=usr/include/llvm/Support/EndianStream.h
+file path=usr/include/llvm/Support/Errc.h
+file path=usr/include/llvm/Support/Errno.h
+file path=usr/include/llvm/Support/ErrorHandling.h
+file path=usr/include/llvm/Support/ErrorOr.h
+file path=usr/include/llvm/Support/FileOutputBuffer.h
+file path=usr/include/llvm/Support/FileSystem.h
+file path=usr/include/llvm/Support/FileUtilities.h
+file path=usr/include/llvm/Support/Format.h
+file path=usr/include/llvm/Support/FormattedStream.h
+file path=usr/include/llvm/Support/GCOV.h
+file path=usr/include/llvm/Support/GenericDomTree.h
+file path=usr/include/llvm/Support/GenericDomTreeConstruction.h
+file path=usr/include/llvm/Support/GraphWriter.h
+file path=usr/include/llvm/Support/Host.h
+file path=usr/include/llvm/Support/LEB128.h
+file path=usr/include/llvm/Support/LICENSE.TXT
+file path=usr/include/llvm/Support/LineIterator.h
+file path=usr/include/llvm/Support/Locale.h
+file path=usr/include/llvm/Support/LockFileManager.h
+file path=usr/include/llvm/Support/MD5.h
+file path=usr/include/llvm/Support/MachO.h
+file path=usr/include/llvm/Support/ManagedStatic.h
+file path=usr/include/llvm/Support/MathExtras.h
+file path=usr/include/llvm/Support/Memory.h
+file path=usr/include/llvm/Support/MemoryBuffer.h
+file path=usr/include/llvm/Support/MemoryObject.h
+file path=usr/include/llvm/Support/Mutex.h
+file path=usr/include/llvm/Support/MutexGuard.h
+file path=usr/include/llvm/Support/OnDiskHashTable.h
+file path=usr/include/llvm/Support/Options.h
+file path=usr/include/llvm/Support/OutputBuffer.h
+file path=usr/include/llvm/Support/Path.h
+file path=usr/include/llvm/Support/PluginLoader.h
+file path=usr/include/llvm/Support/PointerLikeTypeTraits.h
+file path=usr/include/llvm/Support/PrettyStackTrace.h
+file path=usr/include/llvm/Support/Process.h
+file path=usr/include/llvm/Support/Program.h
+file path=usr/include/llvm/Support/RWMutex.h
+file path=usr/include/llvm/Support/RandomNumberGenerator.h
+file path=usr/include/llvm/Support/Recycler.h
+file path=usr/include/llvm/Support/RecyclingAllocator.h
+file path=usr/include/llvm/Support/Regex.h
+file path=usr/include/llvm/Support/Registry.h
+file path=usr/include/llvm/Support/RegistryParser.h
+file path=usr/include/llvm/Support/SMLoc.h
+file path=usr/include/llvm/Support/SaveAndRestore.h
+file path=usr/include/llvm/Support/ScaledNumber.h
+file path=usr/include/llvm/Support/Signals.h
+file path=usr/include/llvm/Support/Solaris.h
+file path=usr/include/llvm/Support/SourceMgr.h
+file path=usr/include/llvm/Support/SpecialCaseList.h
+file path=usr/include/llvm/Support/StreamingMemoryObject.h
+file path=usr/include/llvm/Support/StringPool.h
+file path=usr/include/llvm/Support/SwapByteOrder.h
+file path=usr/include/llvm/Support/SystemUtils.h
+file path=usr/include/llvm/Support/TargetRegistry.h
+file path=usr/include/llvm/Support/TargetSelect.h
+file path=usr/include/llvm/Support/ThreadLocal.h
+file path=usr/include/llvm/Support/Threading.h
+file path=usr/include/llvm/Support/TimeValue.h
+file path=usr/include/llvm/Support/Timer.h
+file path=usr/include/llvm/Support/ToolOutputFile.h
+file path=usr/include/llvm/Support/Unicode.h
+file path=usr/include/llvm/Support/UnicodeCharRanges.h
+file path=usr/include/llvm/Support/UniqueLock.h
+file path=usr/include/llvm/Support/Valgrind.h
+file path=usr/include/llvm/Support/Watchdog.h
+file path=usr/include/llvm/Support/Win64EH.h
+file path=usr/include/llvm/Support/WindowsError.h
+file path=usr/include/llvm/Support/YAMLParser.h
+file path=usr/include/llvm/Support/YAMLTraits.h
+file path=usr/include/llvm/Support/circular_raw_ostream.h
+file path=usr/include/llvm/Support/raw_os_ostream.h
+file path=usr/include/llvm/Support/raw_ostream.h
+file path=usr/include/llvm/Support/type_traits.h
+file path=usr/include/llvm/TableGen/Error.h
+file path=usr/include/llvm/TableGen/Main.h
+file path=usr/include/llvm/TableGen/Record.h
+file path=usr/include/llvm/TableGen/SetTheory.h
+file path=usr/include/llvm/TableGen/StringMatcher.h
+file path=usr/include/llvm/TableGen/StringToOffsetTable.h
+file path=usr/include/llvm/TableGen/TableGenBackend.h
+file path=usr/include/llvm/Target/CostTable.h
+file path=usr/include/llvm/Target/Target.td
+file path=usr/include/llvm/Target/TargetCallingConv.h
+file path=usr/include/llvm/Target/TargetCallingConv.td
+file path=usr/include/llvm/Target/TargetFrameLowering.h
+file path=usr/include/llvm/Target/TargetInstrInfo.h
+file path=usr/include/llvm/Target/TargetIntrinsicInfo.h
+file path=usr/include/llvm/Target/TargetItinerary.td
+file path=usr/include/llvm/Target/TargetLibraryInfo.h
+file path=usr/include/llvm/Target/TargetLowering.h
+file path=usr/include/llvm/Target/TargetLoweringObjectFile.h
+file path=usr/include/llvm/Target/TargetMachine.h
+file path=usr/include/llvm/Target/TargetOpcodes.h
+file path=usr/include/llvm/Target/TargetOptions.h
+file path=usr/include/llvm/Target/TargetRegisterInfo.h
+file path=usr/include/llvm/Target/TargetSchedule.td
+file path=usr/include/llvm/Target/TargetSelectionDAG.td
+file path=usr/include/llvm/Target/TargetSelectionDAGInfo.h
+file path=usr/include/llvm/Target/TargetSubtargetInfo.h
+file path=usr/include/llvm/Transforms/IPO.h
+file path=usr/include/llvm/Transforms/IPO/InlinerPass.h
+file path=usr/include/llvm/Transforms/IPO/PassManagerBuilder.h
+file path=usr/include/llvm/Transforms/Instrumentation.h
+file path=usr/include/llvm/Transforms/ObjCARC.h
+file path=usr/include/llvm/Transforms/Scalar.h
+file path=usr/include/llvm/Transforms/Utils/ASanStackFrameLayout.h
+file path=usr/include/llvm/Transforms/Utils/BasicBlockUtils.h
+file path=usr/include/llvm/Transforms/Utils/BuildLibCalls.h
+file path=usr/include/llvm/Transforms/Utils/BypassSlowDivision.h
+file path=usr/include/llvm/Transforms/Utils/Cloning.h
+file path=usr/include/llvm/Transforms/Utils/CmpInstAnalysis.h
+file path=usr/include/llvm/Transforms/Utils/CodeExtractor.h
+file path=usr/include/llvm/Transforms/Utils/CtorUtils.h
+file path=usr/include/llvm/Transforms/Utils/GlobalStatus.h
+file path=usr/include/llvm/Transforms/Utils/IntegerDivision.h
+file path=usr/include/llvm/Transforms/Utils/Local.h
+file path=usr/include/llvm/Transforms/Utils/LoopUtils.h
+file path=usr/include/llvm/Transforms/Utils/ModuleUtils.h
+file path=usr/include/llvm/Transforms/Utils/PromoteMemToReg.h
+file path=usr/include/llvm/Transforms/Utils/SSAUpdater.h
+file path=usr/include/llvm/Transforms/Utils/SSAUpdaterImpl.h
+file path=usr/include/llvm/Transforms/Utils/SimplifyIndVar.h
+file path=usr/include/llvm/Transforms/Utils/SimplifyLibCalls.h
+file path=usr/include/llvm/Transforms/Utils/SymbolRewriter.h
+file path=usr/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
+file path=usr/include/llvm/Transforms/Utils/UnrollLoop.h
+file path=usr/include/llvm/Transforms/Utils/ValueMapper.h
+file path=usr/include/llvm/Transforms/Utils/VectorUtils.h
+file path=usr/include/llvm/Transforms/Vectorize.h
+file path=usr/lib/$(MACH64)/libLLVMAnalysis.a
+file path=usr/lib/$(MACH64)/libLLVMAsmParser.a
+file path=usr/lib/$(MACH64)/libLLVMAsmPrinter.a
+file path=usr/lib/$(MACH64)/libLLVMBitReader.a
+file path=usr/lib/$(MACH64)/libLLVMBitWriter.a
+file path=usr/lib/$(MACH64)/libLLVMCodeGen.a
+file path=usr/lib/$(MACH64)/libLLVMCore.a
+file path=usr/lib/$(MACH64)/libLLVMDebugInfo.a
+file path=usr/lib/$(MACH64)/libLLVMExecutionEngine.a
+file path=usr/lib/$(MACH64)/libLLVMIRReader.a
+file path=usr/lib/$(MACH64)/libLLVMInstCombine.a
+file path=usr/lib/$(MACH64)/libLLVMInstrumentation.a
+file path=usr/lib/$(MACH64)/libLLVMInterpreter.a
+file path=usr/lib/$(MACH64)/libLLVMLTO.a
+file path=usr/lib/$(MACH64)/libLLVMLineEditor.a
+file path=usr/lib/$(MACH64)/libLLVMLinker.a
+file path=usr/lib/$(MACH64)/libLLVMMC.a
+file path=usr/lib/$(MACH64)/libLLVMMCDisassembler.a
+file path=usr/lib/$(MACH64)/libLLVMMCJIT.a
+file path=usr/lib/$(MACH64)/libLLVMMCParser.a
+file path=usr/lib/$(MACH64)/libLLVMObjCARCOpts.a
+file path=usr/lib/$(MACH64)/libLLVMObject.a
+file path=usr/lib/$(MACH64)/libLLVMOption.a
+file path=usr/lib/$(MACH64)/libLLVMProfileData.a
+file path=usr/lib/$(MACH64)/libLLVMRuntimeDyld.a
+file path=usr/lib/$(MACH64)/libLLVMScalarOpts.a
+file path=usr/lib/$(MACH64)/libLLVMSelectionDAG.a
+file path=usr/lib/$(MACH64)/libLLVMSparcAsmParser.a variant.arch=sparc
+file path=usr/lib/$(MACH64)/libLLVMSparcAsmPrinter.a variant.arch=sparc
+file path=usr/lib/$(MACH64)/libLLVMSparcCodeGen.a variant.arch=sparc
+file path=usr/lib/$(MACH64)/libLLVMSparcDesc.a variant.arch=sparc
+file path=usr/lib/$(MACH64)/libLLVMSparcDisassembler.a variant.arch=sparc
+file path=usr/lib/$(MACH64)/libLLVMSparcInfo.a variant.arch=sparc
+file path=usr/lib/$(MACH64)/libLLVMSupport.a
+file path=usr/lib/$(MACH64)/libLLVMTableGen.a
+file path=usr/lib/$(MACH64)/libLLVMTarget.a
+file path=usr/lib/$(MACH64)/libLLVMTransformUtils.a
+file path=usr/lib/$(MACH64)/libLLVMVectorize.a
+file path=usr/lib/$(MACH64)/libLLVMX86AsmParser.a variant.arch=i386
+file path=usr/lib/$(MACH64)/libLLVMX86AsmPrinter.a variant.arch=i386
+file path=usr/lib/$(MACH64)/libLLVMX86CodeGen.a variant.arch=i386
+file path=usr/lib/$(MACH64)/libLLVMX86Desc.a variant.arch=i386
+file path=usr/lib/$(MACH64)/libLLVMX86Disassembler.a variant.arch=i386
+file path=usr/lib/$(MACH64)/libLLVMX86Info.a variant.arch=i386
+file path=usr/lib/$(MACH64)/libLLVMX86Utils.a variant.arch=i386
+file path=usr/lib/$(MACH64)/libLLVMipa.a
+file path=usr/lib/$(MACH64)/libLLVMipo.a
+file path=usr/lib/$(MACH64)/libLTO.a
+file path=usr/share/llvm/cmake/AddLLVM.cmake
+file path=usr/share/llvm/cmake/AddLLVMDefinitions.cmake
+file path=usr/share/llvm/cmake/AddOCaml.cmake
+file path=usr/share/llvm/cmake/AddSphinxTarget.cmake
+file path=usr/share/llvm/cmake/ChooseMSVCCRT.cmake
+file path=usr/share/llvm/cmake/CrossCompile.cmake
+file path=usr/share/llvm/cmake/FindOCaml.cmake
+file path=usr/share/llvm/cmake/FindSphinx.cmake
+file path=usr/share/llvm/cmake/GetSVN.cmake
+file path=usr/share/llvm/cmake/HandleLLVMOptions.cmake
+file path=usr/share/llvm/cmake/HandleLLVMStdlib.cmake
+file path=usr/share/llvm/cmake/LLVM-Config.cmake
+file path=usr/share/llvm/cmake/LLVMConfig.cmake
+file path=usr/share/llvm/cmake/LLVMConfigVersion.cmake
+file path=usr/share/llvm/cmake/LLVMExports.cmake
+file path=usr/share/llvm/cmake/LLVMParseArguments.cmake
+file path=usr/share/llvm/cmake/LLVMProcessSources.cmake
+file path=usr/share/llvm/cmake/TableGen.cmake
+license llvm.license license="University of Illinois/NCSA"
+depend type=require fmri=pkg:/developer/llvm/clang
+depend type=require fmri=pkg:/developer/llvm/llvm
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/llvm.license	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,225 @@
+Clang/LLVM copyrights and licenses:
+
+1. NCSA License: http://opensource.org/licenses/NCSA
+
+==============================================================================
+LLVM Release License
+==============================================================================
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2003-2012 University of Illinois at Urbana-Champaign.
+All rights reserved.
+
+Developed by:
+	LLVM Team
+	University of Illinois at Urbana-Champaign
+	http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+	* Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimers.
+
+	* Redistributions in binary form must reproduce the above copyright 	notice, this list of conditions and the following disclaimers in the 	documentation and/or other materials provided with the distribution.
+
+	* Neither the names of the LLVM Team, University of Illinois at
+	Urbana-Champaign, nor the names of its contributors may be used to
+	endorse or promote products derived from this Software without specific
+	prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
+
+==============================================================================
+Copyrights and Licenses for Third Party Software Distributed with LLVM:
+==============================================================================
+The LLVM software contains code written by third parties.  Such software will
+have its own individual LICENSE.TXT file in the directory in which it appears.
+This file will describe the copyrights, license, and restrictions which apply
+to that code.
+
+The disclaimer of warranty in the University of Illinois Open Source License
+applies to all code in the LLVM Distribution, and nothing in any of the
+other licenses gives permission to use the names of the LLVM Team or the
+University of Illinois to endorse or promote products derived from this
+Software.
+
+The following pieces of software have additional or alternate copyrights,
+licenses, and/or restrictions:
+
+Program             Directory
+-------             ---------
+Autoconf            llvm/autoconf
+                    llvm/projects/ModuleMaker/autoconf
+                    llvm/projects/sample/autoconf
+CellSPU backend     llvm/lib/Target/CellSPU/README.txt
+Google Test         llvm/utils/unittest/googletest
+OpenBSD regex       llvm/lib/Support/{reg*, COPYRIGHT.regex}
+pyyaml tests        llvm/test/YAMLParser/{*.data, LICENSE.TXT}
+
+
+2. Clang/LLVM Autoconf License:
+------------------------------------------------------------------------------
+Autoconf Files
+------------------------------------------------------------------------------
+All autoconf files are licensed under the LLVM license with the following
+additions:
+
+llvm/autoconf/install-sh:
+	This script is licensed under the LLVM license, with the following
+	additional copyrights and restrictions:
+
+	Copyright 1991 by the Massachusetts Institute of Technology
+
+	Permission to use, copy, modify, distribute, and sell this software
+	and its documentation for any purpose is hereby granted without fee,
+	provided that the above copyright notice appear in all copies and
+	that both that copyright notice and this permission notice appear
+	in supporting documentation, and that the name of M.I.T. not be used
+	in advertising or publicity pertaining to distribution of the software
+	without specific, written prior permission.  M.I.T. makes no
+	representations about the suitability of this software for any
+	purpose.  It is provided "as is" without express or implied warranty.
+
+	Please see the source files for additional copyrights.
+
+
+3. CellSPU backend License:
+
+This code was contributed by a team from the Computer Systems Research
+Department in The Aerospace Corporation:
+
+- Scott Michel (head bottle washer and much of the non-floating point
+  instructions)
+- Mark Thomas (floating point instructions)
+- Michael AuYeung (intrinsics)
+- Chandler Carruth (LLVM expertise)
+- Nehal Desai (debugging, i32 operations, RoadRunner SPU expertise)
+
+Some minor fixes added by Kalle Raiskila.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR
+OTHERWISE.  IN NO EVENT SHALL THE AEROSPACE CORPORATION BE LIABLE FOR DAMAGES
+OF ANY KIND OR NATURE WHETHER BASED IN CONTRACT, TORT, OR OTHERWISE ARISING
+OUT OF OR IN CONNECTION WITH THE USE OF THE SOFTWARE INCLUDING, WITHOUT
+LIMITATION, DAMAGES RESULTING FROM LOST OR CONTAMINATED DATA, LOST PROFITS OR
+REVENUE, COMPUTER MALFUNCTION, OR FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL,
+OR PUNITIVE  DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR
+SUCH DAMAGES ARE FORESEEABLE.
+
+
+4. Google License:
+
+Copyright 2008, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+    * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+5. OpenBSD License:
+
+$OpenBSD: COPYRIGHT,v 1.3 2003/06/02 20:18:36 millert Exp $
+
+Copyright 1992, 1993, 1994 Henry Spencer.  All rights reserved.
+This software is not subject to any license of the American Telephone
+and Telegraph Company or of the Regents of the University of California.
+
+Permission is granted to anyone to use this software for any purpose on
+any computer system, and to alter it and redistribute it, subject
+to the following restrictions:
+
+1. The author is not responsible for the consequences of use of this
+   software, no matter how awful, even if they arise from flaws in it.
+
+2. The origin of this software must not be misrepresented, either by
+   explicit claim or by omission.  Since few users ever read sources,
+   credits must appear in the documentation.
+
+3. Altered versions must be plainly marked as such, and must not be
+   misrepresented as being the original software.  Since few users
+   ever read sources, credits must appear in the documentation.
+
+4. This notice may not be removed or altered.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+/*-
+ * Copyright (c) 1994
+ *      The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *      @(#)COPYRIGHT   8.1 (Berkeley) 3/16/94
+ */
+
+6. pyyaml tests License:
+
+Copyright (c) 2006 Kirill Simonov
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/llvm.p5m	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,88 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+
+set name=pkg.fmri \
+    value=pkg:/developer/llvm/[email protected]$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
+set name=pkg.summary \
+    value="LLVM $(COMPONENT_VERSION) runtime - The Low Level Virtual Machine"
+set name=com.oracle.info.description \
+    value="LLVM - The Low Level Virtual Machine Compiler Infrastructure Framework"
+set name=com.oracle.info.tpno value=$(TPNO)
+set name=info.classification value=org.opensolaris.category.2008:Development/C \
+    value=org.opensolaris.category.2008:Development/C++ \
+    value=org.opensolaris.category.2008:Development/GNU \
+    value="org.opensolaris.category.2008:Development/Objective C"
+set name=info.source-url value=$(COMPONENT_ARCHIVE_URL)
+set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
+set name=org.opensolaris.arc-caseid value=PSARC/2013/188
+set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
+file path=usr/bin/FileCheck
+file path=usr/bin/bugpoint
+file path=usr/bin/count
+file path=usr/bin/llc
+file path=usr/bin/lli
+file path=usr/bin/lli-child-target
+file path=usr/bin/llvm-ar
+file path=usr/bin/llvm-as
+file path=usr/bin/llvm-bcanalyzer
+file path=usr/bin/llvm-config
+file path=usr/bin/llvm-cov
+file path=usr/bin/llvm-diff
+file path=usr/bin/llvm-dis
+file path=usr/bin/llvm-dsymutil
+file path=usr/bin/llvm-dwarfdump
+file path=usr/bin/llvm-extract
+file path=usr/bin/llvm-link
+file path=usr/bin/llvm-lto
+file path=usr/bin/llvm-mc
+file path=usr/bin/llvm-mcmarkup
+file path=usr/bin/llvm-nm
+file path=usr/bin/llvm-objdump
+file path=usr/bin/llvm-profdata
+hardlink path=usr/bin/llvm-ranlib target=llvm-ar
+file path=usr/bin/llvm-readobj
+file path=usr/bin/llvm-rtdyld
+file path=usr/bin/llvm-size
+file path=usr/bin/llvm-stress
+file path=usr/bin/llvm-symbolizer
+file path=usr/bin/llvm-tblgen
+file path=usr/bin/llvm-vtabledump
+file path=usr/bin/macho-dump
+file path=usr/bin/not
+file path=usr/bin/obj2yaml
+file path=usr/bin/opt
+file path=usr/bin/verify-uselistorder
+file path=usr/bin/yaml2obj
+file path=usr/lib/$(MACH64)/BugpointPasses.so
+file path=usr/lib/$(MACH64)/LLVMHello.so
+link path=usr/lib/$(MACH64)/libLLVM-$(COMPONENT_VERSION).so \
+    target=libLLVM-3.6.so
+file path=usr/lib/$(MACH64)/libLLVM-3.6.so
+file path=usr/lib/$(MACH64)/libLTO.so
+license llvm.license license="University of Illinois/NCSA"
+depend type=require fmri=pkg:/developer/gcc-49
+depend type=require fmri=pkg:/developer/gnu-binutils
+depend type=require fmri=pkg:/system/library/gcc/gcc-runtime-49
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/000-AutoRegen.sh.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,26 @@
+# Solaris autoconf-based build.
+# https://llvm.org/bugs/show_bug.cgi?id=24641
+--- autoconf/AutoRegen.sh	2014-02-28 13:17:54.000000000 -0500
++++ autoconf/AutoRegen.sh	2015-07-18 15:03:22.104835693 -0400
[email protected]@ -19,6 +19,21 @@
+ want_aclocal_version='1\.9\.6'
+ ### END NOTE #########################################################
+ 
++UNAMES="`uname -s`"
++UNAMER="`uname -r`"
++
++if [ "${UNAMES}" = "SunOS" ] ; then
++  if [ "${UNAMER}" = "5.11" ] ; then
++    want_autoconf_version='2\.68'
++    want_autoheader_version=$want_autoconf_version
++    want_aclocal_version='1\.11\.2'
++  elif [ "${UNAMER}" = "5.12" ] ; then
++    want_autoconf_version='2\.69'
++    want_autoheader_version=$want_autoconf_version
++    want_aclocal_version='1\.15'
++  fi
++fi
++
+ outfile=configure
+ configfile=configure.ac
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/001-Makefile.config.in.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,43 @@
+# Solaris autoconf-based build.
+# https://llvm.org/bugs/show_bug.cgi?id=24641
+--- Makefile.config.in	2014-11-04 16:35:15.000000000 -0800
++++ Makefile.config.in	2015-08-31 09:18:01.367776683 -0700
[email protected]@ -12,6 +12,8 @@
+ #
+ #===------------------------------------------------------------------------===#
+ 
++MACH = $(shell uname -p)
++
+ # Define LLVM specific info and directories based on the autoconf variables
+ LLVMPackageName   := @[email protected]
+ LLVMVersion       := @[email protected]
[email protected]@ -220,6 +222,12 @@
+ 
+ LIBS       := @[email protected]
+ 
++ifeq ($(HOST_OS), $(filter $(HOST_OS), SunOS))
++  ifeq ($(MACH),sparc)
++    LIBS += -lkstat
++  endif
++endif
++
+ # Targets that are possible to build
+ ALL_TARGETS := @[email protected]
+ 
[email protected]@ -337,14 +345,14 @@
+ ENABLE_EMBED_STDCXX := @[email protected]
+ 
+ # Use -fvisibility-inlines-hidden?
+-ENABLE_VISIBILITY_INLINES_HIDDEN := @[email protected]
++ENABLE_VISIBILITY_INLINES_HIDDEN := 0
+ 
+ # Do we want to allow timestamping information into builds?
+ ENABLE_TIMESTAMPS := @[email protected]
+ 
+ # This option tells the Makefiles to produce verbose output.
+ # It essentially prints the commands that make is executing
+-#VERBOSE = 1
++VERBOSE := 1
+ 
+ # Enable JIT for this platform
+ TARGET_HAS_JIT = @[email protected]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/002-Makefile.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,15 @@
+# Solaris autoconf-based build.
+# https://llvm.org/bugs/show_bug.cgi?id=24641
+--- tools/llvm-shlib/Makefile	2014-07-31 23:16:03.000000000 -0700
++++ tools/llvm-shlib/Makefile	2015-06-07 11:01:59.791190596 -0700
[email protected]@ -71,7 +71,9 @@
+ 
+ ifeq ($(HOST_OS),SunOS)
+     # add -z allextract ahead of other libraries on Solaris
+-    LLVMLibsOptions := -Wl,-z -Wl,allextract $(LLVMLibsOptions)
++    LLVMLibsOptions := -Wl,-z -Wl,rescan -Wl,-z -Wl,allextract $(LLVMLibsOptions)
++    LLVMLibsOptions += -Wl,-h -Wl,lib$(LIBRARYNAME)$(SHLIBEXT)
++    LLVMLibsOptions += -Wl,-z -Wl,defaultextract -Wl,-z -Wl,defs
+ endif
+ 
+ ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/003-Makefile.rules.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,18 @@
+# Strip unused sections in Solaris.
+# https://llvm.org/bugs/show_bug.cgi?id=24641
+--- Makefile.rules	2014-11-04 16:35:15.000000000 -0800
++++ Makefile.rules	2015-07-17 18:28:25.379220132 -0700
[email protected]@ -638,9 +638,12 @@
+   ifeq ($(HOST_OS),Darwin)
+     LD.Flags += -Wl,-dead_strip
+   else
+-    ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
++    ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW SunOS))
+       LD.Flags += -Wl,--gc-sections
+     endif
++    ifeq ($(HOST_OS), $(filter $(HOST_OS), SunOS))
++      LD.Flags += -Wl,-z -Wl,discard-unused=sections
++    endif
+   endif
+ endif
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/004-configure.ac.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,27 @@
+# Solaris autoconf-based build.
+# https://llvm.org/bugs/show_bug.cgi?id=24641
+--- autoconf/configure.ac	2015-05-01 21:17:33.000000000 -0700
++++ autoconf/configure.ac	2015-06-01 09:30:27.734038335 -0700
[email protected]@ -1486,8 +1486,11 @@
+ fi
+ 
+ dnl mallinfo is optional; the code can compile (minus features) without it
++dnl Explicitly disable on Solaris.
++if test "$llvm_cv_target_os_type" != "SunOS" ; then
+ AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1],
+                [Define if mallinfo() is available on this platform.]))
++fi
+ 
+ dnl pthread locking functions are optional - but llvm will not be thread-safe
+ dnl without locks.
[email protected]@ -1965,7 +1968,10 @@
+ fi
+ 
+ dnl Determine whether the compiler supports -fvisibility-inlines-hidden.
++dnl Explicitly disable on Solaris.
++if test "$llvm_cv_target_os_type" != "SunOS" ; then
+ AC_CXX_USE_VISIBILITY_INLINES_HIDDEN
++fi
+ 
+ dnl Determine linker rpath flag
+ if test "$llvm_cv_link_use_r" = "yes" ; then
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/005-Makefile.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,22 @@
+# Solaris autoconf-based build.
+# https://llvm.org/bugs/show_bug.cgi?id=24641
+--- tools/clang/tools/libclang/Makefile	2014-10-29 11:55:09.000000000 -0700
++++ tools/clang/tools/libclang/Makefile	2015-06-10 15:18:27.471754914 -0700
[email protected]@ -33,10 +33,16 @@
+ include $(CLANG_LEVEL)/Makefile
+ 
+ # Add soname to the library.
+-ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD GNU GNU/kFreeBSD))
++ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux FreeBSD GNU GNU/kFreeBSD SunOS))
+         LLVMLibsOptions += -Wl,-soname,lib$(LIBRARYNAME)$(SHLIBEXT)
+ endif
+ 
++# Extract everything necessary from Solaris *.a archives
++ifeq ($(HOST_OS), $(filter $(HOST_OS), SunOS))
++  SharedLinkOptions += -Wl,-z -Wl,rescan-now -Wl,-z -Wl,allextract
++  LLVMLibsOptions += -Wl,-z -Wl,defaultextract
++endif
++
+ ifeq ($(ENABLE_CLANG_ARCMT),1)
+   CXX.Flags += -DCLANG_ENABLE_ARCMT
+ endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/006-clang-D10272.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,1767 @@
+# Giant clang 3.6.2 patch for correcting misalignments.
+# Patch is from: http://reviews.llvm.org/D10272
+# Adjustments were made for 3.6.2 (the original does not apply cleanly).
+--- include/llvm/Support/Compiler.h	2014-11-18 17:17:30.000000000 -0500
++++ include/llvm/Support/Compiler.h	2015-07-17 23:43:07.143745400 -0400
[email protected]@ -303,6 +303,37 @@
+ # define LLVM_ASSUME_ALIGNED(p, a) (p)
+ #endif
+ 
++/// \macro LLVM_ALIGNAS
++/// \brief Used to specify a minimum alignment for a structure or variable. The
++/// alignment must be a constant integer. Use LLVM_PTR_SIZE to compute
++/// alignments in terms of the size of a pointer.
++///
++/// Note that __declspec(align) has special quirks, it's not legal to pass a
++/// structure with __declspec(align) as a formal parameter.
++#ifdef _MSC_VER
++# define LLVM_ALIGNAS(x) __declspec(align(x))
++#elif __GNUC__ && !__has_feature(cxx_alignas) && !LLVM_GNUC_PREREQ(4, 8, 0)
++# define LLVM_ALIGNAS(x) __attribute__((aligned(x)))
++#else
++# define LLVM_ALIGNAS(x) alignas(x)
++#endif
++
++/// \macro LLVM_PTR_SIZE
++/// \brief A constant integer equivalent to the value of sizeof(void*).
++/// Generally used in combination with LLVM_ALIGNAS or when doing computation in
++/// the preprocessor.
++#ifdef __SIZEOF_POINTER__
++# define LLVM_PTR_SIZE __SIZEOF_POINTER__
++#elif defined(_WIN64)
++# define LLVM_PTR_SIZE 8
++#elif defined(_WIN32)
++# define LLVM_PTR_SIZE 4
++#elif defined(_MSC_VER)
++# error "could not determine LLVM_PTR_SIZE as a constant int for MSVC"
++#else
++# define LLVM_PTR_SIZE sizeof(void *)
++#endif
++
+ /// \macro LLVM_FUNCTION_NAME
+ /// \brief Expands to __func__ on compilers which support it.  Otherwise,
+ /// expands to a compiler-dependent replacement.
+--- tools/clang/include/clang/AST/Decl.h	2015-01-13 16:31:13.000000000 -0800
++++ tools/clang/include/clang/AST/Decl.h	2015-07-17 16:43:46.474996996 -0700
[email protected]@ -3658,6 +3658,9 @@
+   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
+   static bool classofKind(Kind K) { return K == Import; }
+ };
++static_assert(llvm::AlignOf<ImportDecl>::Alignment >=
++                  llvm::AlignOf<SourceLocation>::Alignment,
++              "Alignment is insufficient for objects appended to ImportDecl");
+ 
+ /// \brief Represents an empty-declaration.
+ class EmptyDecl : public Decl {
+--- tools/clang/include/clang/AST/DeclBase.h	2014-11-17 15:36:45.000000000 -0800
++++ tools/clang/include/clang/AST/DeclBase.h	2015-07-17 16:43:46.476997606 -0700
[email protected]@ -69,6 +69,9 @@
+ /// Decl - This represents one declaration (or definition), e.g. a variable,
+ /// typedef, function, struct, etc.
+ ///
++/// Note: There are objects tacked on before the *beginning* of Decl
++/// (and its subclasses) in its Decl::operator new(). Proper alignment
++/// for all subclasses is asserted in DeclBase.cpp.
+ class Decl {
+ public:
+   /// \brief Lists the kind of concrete classes of Decl.
+--- tools/clang/include/clang/AST/DeclCXX.h	2014-12-10 12:04:48.000000000 -0800
++++ tools/clang/include/clang/AST/DeclCXX.h	2015-07-17 16:43:46.479237326 -0700
[email protected]@ -2130,6 +2130,10 @@
+   /// \brief Get the initializer.
+   Expr *getInit() const { return static_cast<Expr*>(Init); }
+ };
++static_assert(
++    llvm::AlignOf<CXXCtorInitializer>::Alignment >=
++        llvm::AlignOf<VarDecl *>::Alignment,
++    "Alignment is insufficient for objects appended to CXXCtorInitializer");
+ 
+ /// \brief Represents a C++ constructor within a class.
+ ///
+--- tools/clang/include/clang/AST/DeclFriend.h	2014-07-16 18:59:34.000000000 -0700
++++ tools/clang/include/clang/AST/DeclFriend.h	2015-07-17 16:43:46.480506828 -0700
[email protected]@ -172,6 +172,9 @@
+   friend class ASTDeclReader;
+   friend class ASTDeclWriter;
+ };
++static_assert(llvm::AlignOf<FriendDecl>::Alignment >=
++                  llvm::AlignOf<TemplateParameterList *>::Alignment,
++              "Alignment is insufficient for objects appended to FriendDecl");
+ 
+ /// An iterator over the friend declarations of a class.
+ class CXXRecordDecl::friend_iterator {
+--- tools/clang/include/clang/AST/DeclGroup.h	2014-05-05 23:48:52.000000000 -0700
++++ tools/clang/include/clang/AST/DeclGroup.h	2015-07-17 16:43:46.481808784 -0700
[email protected]@ -14,6 +14,7 @@
+ #ifndef LLVM_CLANG_AST_DECLGROUP_H
+ #define LLVM_CLANG_AST_DECLGROUP_H
+ 
++#include "llvm/Support/AlignOf.h"
+ #include "llvm/Support/DataTypes.h"
+ #include <cassert>
+ 
[email protected]@ -51,6 +52,9 @@
+     return ((Decl* const*) (this+1))[i];
+   }
+ };
++static_assert(llvm::AlignOf<DeclGroup>::Alignment >=
++                  llvm::AlignOf<Decl *>::Alignment,
++              "Alignment is insufficient for objects appended to DeclGroup");
+ 
+ class DeclGroupRef {
+   // Note this is not a PointerIntPair because we need the address of the
+--- tools/clang/include/clang/AST/DeclOpenMP.h	2014-11-10 20:05:39.000000000 -0800
++++ tools/clang/include/clang/AST/DeclOpenMP.h	2015-07-17 16:43:46.482893197 -0700
[email protected]@ -84,6 +84,10 @@
+   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
+   static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
+ };
++static_assert(
++    llvm::AlignOf<OMPThreadPrivateDecl>::Alignment >=
++        llvm::AlignOf<Expr *>::Alignment,
++    "Alignment is insufficient for objects appended to OMPThreadPrivateDecl");
+ 
+ }  // end namespace clang
+ 
+--- tools/clang/include/clang/AST/DeclTemplate.h	2014-08-30 09:55:39.000000000 -0700
++++ tools/clang/include/clang/AST/DeclTemplate.h	2015-07-17 16:43:46.485713092 -0700
[email protected]@ -43,7 +43,7 @@
+ 
+ /// \brief Stores a list of template parameters for a TemplateDecl and its
+ /// derived classes.
+-class TemplateParameterList {
++class LLVM_ALIGNAS(/*alignof(void*)*/ LLVM_PTR_SIZE) TemplateParameterList {
+   /// The location of the 'template' keyword.
+   SourceLocation TemplateLoc;
+ 
[email protected]@ -131,6 +131,10 @@
+     return SourceRange(TemplateLoc, RAngleLoc);
+   }
+ };
++static_assert(
++    llvm::AlignOf<TemplateParameterList>::Alignment >=
++        llvm::AlignOf<NamedDecl *>::Alignment,
++    "Alignment is insufficient for objects appended to TemplateParameterList");
+ 
+ /// \brief Stores a list of template parameters for a TemplateDecl and its
+ /// derived classes. Suitable for creating on the stack.
[email protected]@ -460,27 +464,20 @@
+ ///     friend void foo<>(T);
+ ///   };
+ /// \endcode
+-class DependentFunctionTemplateSpecializationInfo {
+-  struct CA {
++class LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8)
++    DependentFunctionTemplateSpecializationInfo {
+     /// The number of potential template candidates.
+     unsigned NumTemplates;
+ 
+     /// The number of template arguments.
+     unsigned NumArgs;
+-  };
+-
+-  union {
+-    // Force sizeof to be a multiple of sizeof(void*) so that the
+-    // trailing data is aligned.
+-    void *Aligner;
+-    struct CA d;
+-  };
+ 
+   /// The locations of the left and right angle brackets.
+   SourceRange AngleLocs;
+ 
+   FunctionTemplateDecl * const *getTemplates() const {
+-    return reinterpret_cast<FunctionTemplateDecl*const*>(this+1);
++    return reinterpret_cast<FunctionTemplateDecl *const *>(
++        &getTemplateArgs()[NumArgs]);
+   }
+ 
+ public:
[email protected]@ -490,9 +487,7 @@
+ 
+   /// \brief Returns the number of function templates that this might
+   /// be a specialization of.
+-  unsigned getNumTemplates() const {
+-    return d.NumTemplates;
+-  }
++  unsigned getNumTemplates() const { return NumTemplates; }
+ 
+   /// \brief Returns the i'th template candidate.
+   FunctionTemplateDecl *getTemplate(unsigned I) const {
[email protected]@ -502,14 +497,11 @@
+ 
+   /// \brief Returns the explicit template arguments that were given.
+   const TemplateArgumentLoc *getTemplateArgs() const {
+-    return reinterpret_cast<const TemplateArgumentLoc*>(
+-                                            &getTemplates()[getNumTemplates()]);
++    return reinterpret_cast<const TemplateArgumentLoc *>(this + 1);
+   }
+ 
+   /// \brief Returns the number of explicit template arguments that were given.
+-  unsigned getNumTemplateArgs() const {
+-    return d.NumArgs;
+-  }
++  unsigned getNumTemplateArgs() const { return NumArgs; }
+ 
+   /// \brief Returns the nth template argument.
+   const TemplateArgumentLoc &getTemplateArg(unsigned I) const {
[email protected]@ -525,6 +517,15 @@
+     return AngleLocs.getEnd();
+   }
+ };
++static_assert(
++    llvm::AlignOf<DependentFunctionTemplateSpecializationInfo>::Alignment >=
++        llvm::AlignOf<TemplateArgumentLoc>::Alignment,
++    "Alignment is insufficient for objects appended to "
++    "DependentFunctionTemplateSpecializationInfo");
++static_assert(llvm::AlignOf<TemplateArgumentLoc>::Alignment >=
++                  llvm::AlignOf<FunctionTemplateDecl *>::Alignment,
++              "Alignment is insufficient for objects appended to "
++              "DependentFunctionTemplateSpecializationInfo");
+ 
+ /// Declaration of a redeclarable template.
+ class RedeclarableTemplateDecl : public TemplateDecl, 
[email protected]@ -1203,6 +1204,10 @@
+   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
+   static bool classofKind(Kind K) { return K == NonTypeTemplateParm; }
+ };
++static_assert(llvm::AlignOf<NonTypeTemplateParmDecl>::Alignment >=
++                  llvm::AlignOf<void *>::Alignment,
++              "Alignment is insufficient for objects appended to "
++              "NonTypeTemplateParmDecl");
+ 
+ /// TemplateTemplateParmDecl - Declares a template template parameter,
+ /// e.g., "T" in
[email protected]@ -1369,6 +1374,10 @@
+   friend class ASTDeclReader;
+   friend class ASTDeclWriter;
+ };
++static_assert(llvm::AlignOf<TemplateTemplateParmDecl>::Alignment >=
++                  llvm::AlignOf<TemplateParameterList *>::Alignment,
++              "Alignment is insufficient for objects appended to "
++              "TemplateTemplateParmDecl");
+ 
+ /// \brief Represents a class template specialization, which refers to
+ /// a class template with a given set of template arguments.
+--- tools/clang/include/clang/AST/EvaluatedExprVisitor.h	2014-12-03 13:00:20.000000000 -0800
++++ tools/clang/include/clang/AST/EvaluatedExprVisitor.h	2015-07-17 16:43:46.487103645 -0700
[email protected]@ -85,7 +85,7 @@
+ 
+   void VisitLambdaExpr(LambdaExpr *LE) {
+     // Only visit the capture initializers, and not the body.
+-    for (LambdaExpr::capture_init_iterator I = LE->capture_init_begin(),
++    for (LambdaExpr::const_capture_init_iterator I = LE->capture_init_begin(),
+                                            E = LE->capture_init_end();
+          I != E; ++I)
+       if (*I)
+--- tools/clang/include/clang/AST/Expr.h	2015-01-12 02:17:46.000000000 -0800
++++ tools/clang/include/clang/AST/Expr.h	2015-07-17 16:43:46.491602160 -0700
[email protected]@ -894,7 +894,7 @@
+ ///   DeclRefExprBits.RefersToEnclosingVariableOrCapture
+ ///       Specifies when this declaration reference expression (validly)
+ ///       refers to an enclosed local or a captured variable.
+-class DeclRefExpr : public Expr {
++class LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) DeclRefExpr : public Expr {
+   /// \brief The declaration that we are referencing.
+   ValueDecl *D;
+ 
[email protected]@ -1048,13 +1048,17 @@
+     if (!hasTemplateKWAndArgsInfo())
+       return nullptr;
+ 
+-    if (hasFoundDecl())
++    if (hasFoundDecl()) {
+       return reinterpret_cast<ASTTemplateKWAndArgsInfo *>(
+-        &getInternalFoundDecl() + 1);
++          llvm::alignAddr(&getInternalFoundDecl() + 1,
++                          llvm::alignOf<ASTTemplateKWAndArgsInfo>()));
++    }
+ 
+-    if (hasQualifier())
++    if (hasQualifier()) {
+       return reinterpret_cast<ASTTemplateKWAndArgsInfo *>(
+-        &getInternalQualifierLoc() + 1);
++          llvm::alignAddr(&getInternalQualifierLoc() + 1,
++                          llvm::alignOf<ASTTemplateKWAndArgsInfo>()));
++    }
+ 
+     return reinterpret_cast<ASTTemplateKWAndArgsInfo *>(this + 1);
+   }
[email protected]@ -1167,6 +1171,16 @@
+   friend class ASTStmtReader;
+   friend class ASTStmtWriter;
+ };
++static_assert(llvm::AlignOf<DeclRefExpr>::Alignment >=
++                  llvm::AlignOf<NestedNameSpecifierLoc>::Alignment,
++              "Alignment is insufficient for objects appended to DeclRefExpr");
++static_assert(llvm::AlignOf<NestedNameSpecifierLoc>::Alignment >=
++                  llvm::AlignOf<NamedDecl *>::Alignment,
++              "Alignment is insufficient for objects appended to DeclRefExpr");
++// Code re-aligns before ASTTemplateKWAndArgsInfo
++static_assert(llvm::AlignOf<DeclRefExpr>::Alignment >=
++                  llvm::AlignOf<ASTTemplateKWAndArgsInfo>::Alignment,
++              "Alignment is insufficient for objects appended to DeclRefExpr");
+ 
+ /// \brief [C99 6.4.2.2] - A predefined identifier such as __func__.
+ class PredefinedExpr : public Expr {
[email protected]@ -1968,6 +1982,12 @@
+     return child_range(begin, begin + NumExprs);
+   }
+ };
++static_assert(llvm::AlignOf<OffsetOfExpr>::Alignment >=
++                  llvm::AlignOf<OffsetOfExpr::OffsetOfNode *>::Alignment,
++              "Alignment is insufficient for objects appended to OffsetOfExpr");
++static_assert(llvm::AlignOf<OffsetOfExpr::OffsetOfNode>::Alignment >=
++                  llvm::AlignOf<Expr *>::Alignment,
++              "Alignment is insufficient for objects appended to OffsetOfExpr");
+ 
+ /// UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated)
+ /// expression operand.  Used for sizeof/alignof (C99 6.5.3.4) and
[email protected]@ -2309,9 +2329,10 @@
+ 
+ /// MemberExpr - [C99 6.5.2.3] Structure and Union Members.  X->F and X.F.
+ ///
+-class MemberExpr : public Expr {
++class LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) MemberExpr : public Expr {
++public:
+   /// Extra data stored in some member expressions.
+-  struct MemberNameQualifier {
++  struct LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) MemberNameQualifier {
+     /// \brief The nested-name-specifier that qualifies the name, including
+     /// source-location information.
+     NestedNameSpecifierLoc QualifierLoc;
[email protected]@ -2321,6 +2342,7 @@
+     DeclAccessPair FoundDecl;
+   };
+ 
++private:
+   /// Base - the expression for the base pointer or structure references.  In
+   /// X.F, this is "X".
+   Stmt *Base;
[email protected]@ -2591,6 +2613,12 @@
+   friend class ASTReader;
+   friend class ASTStmtWriter;
+ };
++static_assert(llvm::AlignOf<MemberExpr>::Alignment >=
++                  llvm::AlignOf<MemberExpr::MemberNameQualifier>::Alignment,
++              "Alignment is insufficient for objects appended to MemberExpr");
++static_assert(llvm::AlignOf<MemberExpr::MemberNameQualifier>::Alignment >=
++                  llvm::AlignOf<ASTTemplateKWAndArgsInfo>::Alignment,
++              "Alignment is insufficient for objects appended to MemberExpr");
+ 
+ /// CompoundLiteralExpr - [C99 6.5.2.5]
+ ///
[email protected]@ -2747,6 +2775,11 @@
+   // Iterators
+   child_range children() { return child_range(&Op, &Op+1); }
+ };
++static_assert(llvm::AlignOf<CastExpr>::Alignment >=
++                  llvm::AlignOf<CXXBaseSpecifier *>::Alignment,
++              "Alignment is insufficient for objects appended to CastExpr");
++// (Note that the data is actually tacked onto one of its subclasses,
++// but they'll inherit alignment)
+ 
+ /// ImplicitCastExpr - Allows us to explicitly represent implicit type
+ /// conversions, which have no direct representation in the original
[email protected]@ -4272,6 +4305,10 @@
+     return child_range(begin, begin + NumSubExprs);
+   }
+ };
++static_assert(
++    llvm::AlignOf<DesignatedInitExpr>::Alignment >=
++        llvm::AlignOf<Stmt *>::Alignment,
++    "Alignment is insufficient for objects appended to DesignatedInitExpr");
+ 
+ /// \brief Represents an implicitly-generated value initialization of
+ /// an object of a given type.
[email protected]@ -4749,6 +4786,10 @@
+     return T->getStmtClass() == PseudoObjectExprClass;
+   }
+ };
++static_assert(
++    llvm::AlignOf<PseudoObjectExpr>::Alignment >=
++        llvm::AlignOf<Expr *>::Alignment,
++    "Alignment is insufficient for objects appended to PseudoObjectExpr");
+ 
+ /// AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*,
+ /// __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the
+--- tools/clang/include/clang/AST/ExprCXX.h	2015-01-14 03:29:14.000000000 -0800
++++ tools/clang/include/clang/AST/ExprCXX.h	2015-07-18 11:25:29.503136056 -0700
[email protected]@ -933,6 +933,10 @@
+   friend class ASTStmtReader;
+   friend class ASTStmtWriter;
+ };
++static_assert(
++    llvm::AlignOf<CXXDefaultArgExpr>::Alignment >=
++        llvm::AlignOf<Expr *>::Alignment,
++    "Alignment is insufficient for objects appended to CXXDefaultArgExpr");
+ 
+ /// \brief A use of a default initializer in a constructor or in aggregate
+ /// initialization.
[email protected]@ -1395,23 +1399,38 @@
+     getStoredStmts()[NumCaptures] = nullptr;
+   }
+   
+-  Stmt **getStoredStmts() const {
++  Stmt **getStoredStmts() {
+     return reinterpret_cast<Stmt **>(const_cast<LambdaExpr *>(this) + 1);
+   }
+   
++  Stmt *const *getStoredStmts() const {
++    return reinterpret_cast<Stmt *const *>(this + 1);
++  }
++  
+   /// \brief Retrieve the mapping from captures to the first array index
+   /// variable.
+-  unsigned *getArrayIndexStarts() const {
++  unsigned *getArrayIndexStarts() {
+     return reinterpret_cast<unsigned *>(getStoredStmts() + NumCaptures + 1);
+   }
+   
++  const unsigned *getArrayIndexStarts() const {
++    return reinterpret_cast<const unsigned *>(getStoredStmts() + NumCaptures + 1);
++  }
++  
+   /// \brief Retrieve the complete set of array-index variables.
+-  VarDecl **getArrayIndexVars() const {
++  VarDecl **getArrayIndexVars() {
+     unsigned ArrayIndexSize =
+         llvm::RoundUpToAlignment(sizeof(unsigned) * (NumCaptures + 1),
+                                  llvm::alignOf<VarDecl*>());
+     return reinterpret_cast<VarDecl **>(
+-        reinterpret_cast<char*>(getArrayIndexStarts()) + ArrayIndexSize);
++        reinterpret_cast<unsigned char*>(getArrayIndexStarts()) + ArrayIndexSize);
++  }
++
++  VarDecl *const *getArrayIndexVars() const {
++    unsigned ArrayIndexSize = llvm::RoundUpToAlignment(
++        sizeof(unsigned) * (NumCaptures + 1), llvm::alignOf<VarDecl *>());
++    return reinterpret_cast<VarDecl *const *>(
++        reinterpret_cast<const unsigned char *>(getArrayIndexStarts()) + ArrayIndexSize);
+   }
+ 
+ public:
[email protected]@ -1492,21 +1511,43 @@
+   /// arguments.
+   typedef Expr **capture_init_iterator;
+ 
++  /// \brief Const iterator that walks over the capture initialization
++  /// arguments.
++  typedef Expr *const *const_capture_init_iterator;
++
+   /// \brief Retrieve the initialization expressions for this lambda's captures.
+-  llvm::iterator_range<capture_init_iterator> capture_inits() const {
++  llvm::iterator_range<capture_init_iterator> capture_inits() {
+     return llvm::iterator_range<capture_init_iterator>(capture_init_begin(),
+                                                        capture_init_end());
+   }
+ 
++  /// \brief Retrieve the initialization expressions for this lambda's captures.
++  llvm::iterator_range<const_capture_init_iterator> capture_inits() const {
++    return llvm::iterator_range<const_capture_init_iterator>(
++        capture_init_begin(), capture_init_end());
++  }
++
+   /// \brief Retrieve the first initialization argument for this
+   /// lambda expression (which initializes the first capture field).
+-  capture_init_iterator capture_init_begin() const {
++  capture_init_iterator capture_init_begin() {
+     return reinterpret_cast<Expr **>(getStoredStmts());
+   }
+ 
++  /// \brief Retrieve the first initialization argument for this
++  /// lambda expression (which initializes the first capture field).
++  const_capture_init_iterator capture_init_begin() const {
++    return reinterpret_cast<Expr *const *>(getStoredStmts());
++  }
++
+   /// \brief Retrieve the iterator pointing one past the last
+   /// initialization argument for this lambda expression.
+-  capture_init_iterator capture_init_end() const {
++  capture_init_iterator capture_init_end() {
++    return capture_init_begin() + NumCaptures;
++  }
++
++  /// \brief Retrieve the iterator pointing one past the last
++  /// initialization argument for this lambda expression.
++  const_capture_init_iterator capture_init_end() const {
+     return capture_init_begin() + NumCaptures;    
+   }
+ 
[email protected]@ -1515,7 +1556,8 @@
+   ///
+   /// \param Iter The iterator that points at the capture initializer for 
+   /// which we are extracting the corresponding index variables.
+-  ArrayRef<VarDecl *> getCaptureInitIndexVars(capture_init_iterator Iter) const;
++  ArrayRef<VarDecl *>
++  getCaptureInitIndexVars(const_capture_init_iterator Iter) const;
+   
+   /// \brief Retrieve the source range covering the lambda introducer,
+   /// which contains the explicit capture list surrounded by square
[email protected]@ -1570,6 +1612,16 @@
+   friend class ASTStmtReader;
+   friend class ASTStmtWriter;
+ };
++static_assert(llvm::AlignOf<LambdaExpr>::Alignment >=
++                  llvm::AlignOf<Stmt *>::Alignment,
++              "Alignment is insufficient for objects appended to LambdaExpr");
++static_assert(llvm::AlignOf<Stmt *>::Alignment >=
++                  llvm::AlignOf<unsigned>::Alignment,
++              "Alignment is insufficient for objects appended to LambdaExpr");
++// Code re-aligns before VarDecl *[]
++static_assert(llvm::AlignOf<LambdaExpr>::Alignment >=
++                  llvm::AlignOf<VarDecl *>::Alignment,
++              "Alignment is insufficient for objects appended to LambdaExpr");
+ 
+ /// An expression "T()" which creates a value-initialized rvalue of type
+ /// T, which is a non-class type.  See (C++98 [5.2.3p2]).
[email protected]@ -2157,6 +2209,10 @@
+   friend class ASTStmtWriter;
+ 
+ };
++static_assert(
++    llvm::AlignOf<TypeTraitExpr>::Alignment >=
++        llvm::AlignOf<TypeSourceInfo *>::Alignment,
++    "Alignment is insufficient for objects appended to TypeTraitExpr");
+ 
+ /// \brief An Embarcadero array type trait, as used in the implementation of
+ /// __array_rank and __array_extent.
[email protected]@ -2289,7 +2345,7 @@
+ 
+ /// \brief A reference to an overloaded function set, either an
+ /// \c UnresolvedLookupExpr or an \c UnresolvedMemberExpr.
+-class OverloadExpr : public Expr {
++class LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) OverloadExpr : public Expr {
+   /// \brief The common name of these declarations.
+   DeclarationNameInfo NameInfo;
+ 
[email protected]@ -2578,6 +2634,10 @@
+     return T->getStmtClass() == UnresolvedLookupExprClass;
+   }
+ };
++static_assert(
++    llvm::AlignOf<UnresolvedLookupExpr>::Alignment >=
++        llvm::AlignOf<ASTTemplateKWAndArgsInfo>::Alignment,
++    "Alignment is insufficient for objects appended to UnresolvedLookupExpr");
+ 
+ /// \brief A qualified reference to a name whose declaration cannot
+ /// yet be resolved.
[email protected]@ -2593,7 +2653,8 @@
+ /// qualifier (X<T>::) and the name of the entity being referenced
+ /// ("value"). Such expressions will instantiate to a DeclRefExpr once the
+ /// declaration can be found.
+-class DependentScopeDeclRefExpr : public Expr {
++class LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) DependentScopeDeclRefExpr
++    : public Expr {
+   /// \brief The nested-name-specifier that qualifies this unresolved
+   /// declaration name.
+   NestedNameSpecifierLoc QualifierLoc;
[email protected]@ -2739,6 +2800,10 @@
+   friend class ASTStmtReader;
+   friend class ASTStmtWriter;
+ };
++static_assert(llvm::AlignOf<DependentScopeDeclRefExpr>::Alignment >=
++                  llvm::AlignOf<ASTTemplateKWAndArgsInfo>::Alignment,
++              "Alignment is insufficient for objects appended to "
++              "DependentScopeDeclRefExpr");
+ 
+ /// Represents an expression -- generally a full-expression -- that
+ /// introduces cleanups to be run at the end of the sub-expression's
[email protected]@ -2810,6 +2875,10 @@
+   // Iterators
+   child_range children() { return child_range(&SubExpr, &SubExpr + 1); }
+ };
++static_assert(
++    llvm::AlignOf<ExprWithCleanups>::Alignment >=
++        llvm::AlignOf<ExprWithCleanups::CleanupObject>::Alignment,
++    "Alignment is insufficient for objects appended to ExprWithCleanups");
+ 
+ /// \brief Describes an explicit type conversion that uses functional
+ /// notion but could not be resolved because one or more arguments are
[email protected]@ -2930,6 +2999,10 @@
+     return child_range(begin, begin + NumArgs);
+   }
+ };
++static_assert(llvm::AlignOf<CXXUnresolvedConstructExpr>::Alignment >=
++                  llvm::AlignOf<Expr *>::Alignment,
++              "Alignment is insufficient for objects appended to "
++              "CXXUnresolvedConstructExpr");
+ 
+ /// \brief Represents a C++ member access expression where the actual
+ /// member referenced could not be resolved because the base
[email protected]@ -2938,7 +3011,8 @@
+ /// Like UnresolvedMemberExprs, these can be either implicit or
+ /// explicit accesses.  It is only possible to get one of these with
+ /// an implicit access if a qualifier is provided.
+-class CXXDependentScopeMemberExpr : public Expr {
++class LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) CXXDependentScopeMemberExpr
++    : public Expr {
+   /// \brief The expression for the base pointer or class reference,
+   /// e.g., the \c x in x.f.  Can be null in implicit accesses.
+   Stmt *Base;
[email protected]@ -3177,6 +3251,10 @@
+   friend class ASTStmtReader;
+   friend class ASTStmtWriter;
+ };
++static_assert(llvm::AlignOf<CXXDependentScopeMemberExpr>::Alignment >=
++                  llvm::AlignOf<ASTTemplateKWAndArgsInfo>::Alignment,
++              "Alignment is insufficient for objects appended to "
++              "CXXDependentScopeMemberExpr");
+ 
+ /// \brief Represents a C++ member access expression for which lookup
+ /// produced a set of overloaded functions.
[email protected]@ -3193,7 +3271,8 @@
+ /// In the final AST, an explicit access always becomes a MemberExpr.
+ /// An implicit access may become either a MemberExpr or a
+ /// DeclRefExpr, depending on whether the member is static.
+-class UnresolvedMemberExpr : public OverloadExpr {
++class LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) UnresolvedMemberExpr
++    : public OverloadExpr {
+   /// \brief Whether this member expression used the '->' operator or
+   /// the '.' operator.
+   bool IsArrow : 1;
[email protected]@ -3316,6 +3395,21 @@
+     return child_range(&Base, &Base + 1);
+   }
+ };
++static_assert(
++    llvm::AlignOf<UnresolvedMemberExpr>::Alignment >=
++        llvm::AlignOf<ASTTemplateKWAndArgsInfo>::Alignment,
++    "Alignment is insufficient for objects appended to UnresolvedMemberExpr");
++
++inline ASTTemplateKWAndArgsInfo *OverloadExpr::getTemplateKWAndArgsInfo() {
++  if (!HasTemplateKWAndArgsInfo)
++    return nullptr;
++  if (isa<UnresolvedLookupExpr>(this))
++    return reinterpret_cast<ASTTemplateKWAndArgsInfo *>(
++        cast<UnresolvedLookupExpr>(this) + 1);
++  else
++    return reinterpret_cast<ASTTemplateKWAndArgsInfo *>(
++        cast<UnresolvedMemberExpr>(this) + 1);
++}
+ 
+ /// \brief Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
+ ///
[email protected]@ -3438,15 +3532,6 @@
+   }
+ };
+ 
+-inline ASTTemplateKWAndArgsInfo *OverloadExpr::getTemplateKWAndArgsInfo() {
+-  if (!HasTemplateKWAndArgsInfo) return nullptr;
+-  if (isa<UnresolvedLookupExpr>(this))
+-    return reinterpret_cast<ASTTemplateKWAndArgsInfo*>
+-      (cast<UnresolvedLookupExpr>(this) + 1);
+-  else
+-    return reinterpret_cast<ASTTemplateKWAndArgsInfo*>
+-      (cast<UnresolvedMemberExpr>(this) + 1);
+-}
+ 
+ /// \brief Represents an expression that computes the length of a parameter
+ /// pack.
[email protected]@ -3709,6 +3794,10 @@
+ 
+   child_range children() { return child_range(); }
+ };
++static_assert(
++    llvm::AlignOf<FunctionParmPackExpr>::Alignment >=
++        llvm::AlignOf<ParmVarDecl *>::Alignment,
++    "Alignment is insufficient for objects appended to FunctionParmPackExpr");
+ 
+ /// \brief Represents a prvalue temporary that is written into memory so that
+ /// a reference can bind to it.
+--- tools/clang/include/clang/AST/ExprObjC.h	2014-12-18 09:13:56.000000000 -0800
++++ tools/clang/include/clang/AST/ExprObjC.h	2015-07-17 16:43:46.499286743 -0700
[email protected]@ -201,6 +201,10 @@
+     
+   friend class ASTStmtReader;
+ };
++static_assert(
++    llvm::AlignOf<ObjCArrayLiteral>::Alignment >=
++        llvm::AlignOf<Expr *>::Alignment,
++    "Alignment is insufficient for objects appended to ObjCArrayLiteral");
+ 
+ /// \brief An element in an Objective-C dictionary literal.
+ ///
[email protected]@ -231,6 +235,7 @@
+ /// ObjCDictionaryLiteral - AST node to represent objective-c dictionary 
+ /// literals; as in:  @{@"name" : NSUserName(), @"date" : [NSDate date] };
+ class ObjCDictionaryLiteral : public Expr {
++public:
+   /// \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.
[email protected]@ -251,6 +256,7 @@
+     unsigned NumExpansionsPlusOne;
+   };
+ 
++private:
+   /// \brief The number of elements in this dictionary literal.
+   unsigned NumElements : 31;
+   
[email protected]@ -341,6 +347,7 @@
+   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, "");
+     return child_range(reinterpret_cast<Stmt **>(this + 1),
+                        reinterpret_cast<Stmt **>(this + 1) + NumElements * 2);
+   }
[email protected]@ -348,7 +355,14 @@
+   friend class ASTStmtReader;
+   friend class ASTStmtWriter;
+ };
+-
++static_assert(
++    llvm::AlignOf<ObjCDictionaryLiteral>::Alignment >=
++        llvm::AlignOf<ObjCDictionaryLiteral::KeyValuePair>::Alignment,
++    "Alignment is insufficient for objects appended to ObjCDictionaryLiteral");
++static_assert(
++    llvm::AlignOf<ObjCDictionaryLiteral::KeyValuePair>::Alignment >=
++        llvm::AlignOf<ObjCDictionaryLiteral::ExpansionData>::Alignment,
++    "Alignment is insufficient for objects appended to ObjCDictionaryLiteral");
+ 
+ /// ObjCEncodeExpr, used for \@encode in Objective-C.  \@encode has the same
+ /// type and behavior as StringLiteral except that the string initializer is
[email protected]@ -1394,6 +1408,17 @@
+   friend class ASTStmtReader;
+   friend class ASTStmtWriter;
+ };
++static_assert(
++    llvm::AlignOf<ObjCMessageExpr>::Alignment >=
++        llvm::AlignOf<void *>::Alignment,
++    "Alignment is insufficient for objects appended to ObjCMessageExpr");
++static_assert(
++    llvm::AlignOf<void *>::Alignment >= llvm::AlignOf<Expr *>::Alignment,
++    "Alignment is insufficient for objects appended to ObjCMessageExpr");
++static_assert(
++    llvm::AlignOf<Expr *>::Alignment >=
++        llvm::AlignOf<SourceLocation>::Alignment,
++    "Alignment is insufficient for objects appended to ObjCMessageExpr");
+ 
+ /// ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
+ /// (similar in spirit to MemberExpr).
+--- tools/clang/include/clang/AST/Stmt.h	2015-01-12 02:17:46.000000000 -0800
++++ tools/clang/include/clang/AST/Stmt.h	2015-07-17 16:43:46.502138721 -0700
[email protected]@ -865,7 +865,10 @@
+     return T->getStmtClass() == AttributedStmtClass;
+   }
+ };
+-
++static_assert(
++    llvm::AlignOf<AttributedStmt>::Alignment >=
++        llvm::AlignOf<Attr *>::Alignment,
++    "Alignment is insufficient for objects appended to AttributedStmt");
+ 
+ /// IfStmt - This represents an if/then/else.
+ ///
[email protected]@ -2070,8 +2073,10 @@
+   /// \brief Construct an empty captured statement.
+   CapturedStmt(EmptyShell Empty, unsigned NumCaptures);
+ 
+-  Stmt **getStoredStmts() const {
+-    return reinterpret_cast<Stmt **>(const_cast<CapturedStmt *>(this) + 1);
++  Stmt **getStoredStmts() { return reinterpret_cast<Stmt **>(this + 1); }
++
++  Stmt *const *getStoredStmts() const {
++    return reinterpret_cast<Stmt *const *>(this + 1);
+   }
+ 
+   Capture *getStoredCaptures() const;
[email protected]@ -2090,14 +2095,12 @@
+ 
+   /// \brief Retrieve the statement being captured.
+   Stmt *getCapturedStmt() { return getStoredStmts()[NumCaptures]; }
+-  const Stmt *getCapturedStmt() const {
+-    return const_cast<CapturedStmt *>(this)->getCapturedStmt();
+-  }
++  const Stmt *getCapturedStmt() const { return getStoredStmts()[NumCaptures]; }
+ 
+   /// \brief Retrieve the outlined function declaration.
+   CapturedDecl *getCapturedDecl() { return CapDeclAndKind.getPointer(); }
+   const CapturedDecl *getCapturedDecl() const {
+-    return const_cast<CapturedStmt *>(this)->getCapturedDecl();
++    return CapDeclAndKind.getPointer();
+   }
+ 
+   /// \brief Set the outlined function declaration.
[email protected]@ -2158,18 +2161,36 @@
+   typedef Expr **capture_init_iterator;
+   typedef llvm::iterator_range<capture_init_iterator> capture_init_range;
+ 
+-  capture_init_range capture_inits() const {
++  /// \brief Const iterator that walks over the capture initialization
++  /// arguments.
++  typedef Expr *const *const_capture_init_iterator;
++  typedef llvm::iterator_range<const_capture_init_iterator>
++      const_capture_init_range;
++
++  capture_init_range capture_inits() {
+     return capture_init_range(capture_init_begin(), capture_init_end());
+   }
+ 
++  const_capture_init_range capture_inits() const {
++    return const_capture_init_range(capture_init_begin(), capture_init_end());
++  }
++
+   /// \brief Retrieve the first initialization argument.
+-  capture_init_iterator capture_init_begin() const {
++  capture_init_iterator capture_init_begin() {
+     return reinterpret_cast<Expr **>(getStoredStmts());
+   }
+ 
++  const_capture_init_iterator capture_init_begin() const {
++    return reinterpret_cast<Expr *const *>(getStoredStmts());
++  }
++
+   /// \brief Retrieve the iterator pointing one past the last initialization
+   /// argument.
+-  capture_init_iterator capture_init_end() const {
++  capture_init_iterator capture_init_end() {
++    return capture_init_begin() + NumCaptures;
++  }
++
++  const_capture_init_iterator capture_init_end() const {
+     return capture_init_begin() + NumCaptures;
+   }
+ 
[email protected]@ -2191,6 +2212,13 @@
+ 
+   friend class ASTStmtReader;
+ };
++static_assert(llvm::AlignOf<CapturedStmt>::Alignment >=
++                  llvm::AlignOf<Stmt *>::Alignment,
++              "Alignment is insufficient for objects appended to CapturedStmt");
++// Code re-aligns before Capture[]
++static_assert(llvm::AlignOf<CapturedStmt>::Alignment >=
++                  llvm::AlignOf<CapturedStmt::Capture>::Alignment,
++              "Alignment is insufficient for objects appended to CapturedStmt");
+ 
+ }  // end namespace clang
+ 
+--- tools/clang/include/clang/AST/StmtCXX.h	2014-05-05 23:48:52.000000000 -0700
++++ tools/clang/include/clang/AST/StmtCXX.h	2015-07-17 16:43:46.503758907 -0700
[email protected]@ -118,6 +118,9 @@
+ 
+   friend class ASTStmtReader;
+ };
++static_assert(llvm::AlignOf<CXXTryStmt>::Alignment >=
++                  llvm::AlignOf<Stmt *>::Alignment,
++              "Alignment is insufficient for objects appended to CXXTryStmt");
+ 
+ /// CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for
+ /// statement, represented as 'for (range-declarator : range-expression)'.
+--- tools/clang/include/clang/AST/StmtObjC.h	2014-05-05 23:48:52.000000000 -0700
++++ tools/clang/include/clang/AST/StmtObjC.h	2015-07-17 16:43:46.505254168 -0700
[email protected]@ -249,6 +249,9 @@
+                        getStmts() + 1 + NumCatchStmts + HasFinally);
+   }
+ };
++static_assert(
++    llvm::AlignOf<ObjCAtTryStmt>::Alignment >= llvm::AlignOf<Stmt *>::Alignment,
++    "Alignment is insufficient for objects appended to ObjCAtTryStmt");
+ 
+ /// \brief Represents Objective-C's \@synchronized statement.
+ ///
+--- tools/clang/include/clang/AST/TemplateBase.h	2015-01-14 03:29:14.000000000 -0800
++++ tools/clang/include/clang/AST/TemplateBase.h	2015-07-17 16:43:46.506876445 -0700
[email protected]@ -360,6 +360,20 @@
+   void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) const;
+ };
+ 
++static_assert(llvm::AlignOf<TemplateSpecializationType>::Alignment >=
++                  llvm::AlignOf<TemplateArgument>::Alignment,
++              "Alignment is insufficient for objects appended to "
++              "TemplateSpecializationType");
++static_assert(llvm::AlignOf<TemplateArgument>::Alignment >=
++                  llvm::AlignOf<QualType>::Alignment,
++              "Alignment is insufficient for objects appended to "
++              "TemplateSpecializationType");
++
++static_assert(llvm::AlignOf<DependentTemplateSpecializationType>::Alignment >=
++                  llvm::AlignOf<TemplateArgument>::Alignment,
++              "Alignment is insufficient for objects appended to "
++              "DependentTemplateSpecializationType");
++
+ /// Location information for a TemplateArgument.
+ struct TemplateArgumentLocInfo {
+ private:
[email protected]@ -604,6 +618,10 @@
+   void copyInto(TemplateArgumentListInfo &List) const;
+   static std::size_t sizeFor(unsigned NumTemplateArgs);
+ };
++static_assert(llvm::AlignOf<ASTTemplateArgumentListInfo>::Alignment >=
++                  llvm::AlignOf<TemplateArgumentLoc>::Alignment,
++              "Alignment is insufficient for objects appended to "
++              "ASTTemplateArgumentListInfo");
+ 
+ /// \brief Extends ASTTemplateArgumentListInfo with the source location
+ /// information for the template keyword; this is used as part of the
[email protected]@ -640,6 +658,18 @@
+ 
+   static std::size_t sizeFor(unsigned NumTemplateArgs);
+ };
++static_assert(llvm::AlignOf<ASTTemplateKWAndArgsInfo>::Alignment >=
++                  llvm::AlignOf<TemplateArgumentLoc>::Alignment,
++              "Alignment is insufficient for objects appended to "
++              "ASTTemplateKWAndArgsInfo");
++static_assert(llvm::AlignOf<ASTTemplateKWAndArgsInfo>::Alignment >=
++                  llvm::AlignOf<SourceLocation>::Alignment,
++              "Alignment is insufficient for objects appended to "
++              "ASTTemplateKWAndArgsInfo");
++static_assert(llvm::AlignOf<TemplateArgumentLoc>::Alignment >=
++                  llvm::AlignOf<SourceLocation>::Alignment,
++              "Alignment is insufficient for objects appended to "
++              "ASTTemplateKWAndArgsInfo");
+ 
+ const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
+                                     const TemplateArgument &Arg);
+--- tools/clang/include/clang/AST/TemplateName.h	2014-05-10 13:57:56.000000000 -0700
++++ tools/clang/include/clang/AST/TemplateName.h	2015-07-17 16:43:46.508333537 -0700
[email protected]@ -108,6 +108,10 @@
+   iterator begin() const { return getStorage(); }
+   iterator end() const { return getStorage() + size(); }
+ };
++static_assert(llvm::AlignOf<OverloadedTemplateStorage>::Alignment >=
++                  llvm::AlignOf<NamedDecl *>::Alignment,
++              "Alignment is insufficient for objects appended to "
++              "OverloadedTemplateStorage");
+ 
+ /// \brief A structure for storing an already-substituted template template
+ /// parameter pack.
+--- tools/clang/include/clang/AST/Type.h	2015-01-14 03:29:14.000000000 -0800
++++ tools/clang/include/clang/AST/Type.h	2015-07-17 16:43:46.512517865 -0700
[email protected]@ -2991,11 +2991,13 @@
+     assert(hasAnyConsumedParams());
+ 
+     // Find the end of the exceptions.
+-    Expr *const *eh_end = reinterpret_cast<Expr *const *>(param_type_end());
+-    if (getExceptionSpecType() != EST_ComputedNoexcept)
+-      eh_end += NumExceptions;
+-    else
++    Expr *const *eh_end = reinterpret_cast<Expr *const *>(exception_end());
++    if (getExceptionSpecType() == EST_ComputedNoexcept)
+       eh_end += 1; // NoexceptExpr
++    // The memory layout of these types isn't handled here, so
++    // hopefully this is never called for them?
++    assert(getExceptionSpecType() != EST_Uninstantiated &&
++           getExceptionSpecType() != EST_Unevaluated);
+ 
+     return reinterpret_cast<const bool*>(eh_end);
+   }
[email protected]@ -3167,7 +3169,29 @@
+                       param_type_iterator ArgTys, unsigned NumArgs,
+                       const ExtProtoInfo &EPI, const ASTContext &Context);
+ };
+-
++static_assert(
++    llvm::AlignOf<FunctionProtoType>::Alignment >=
++        llvm::AlignOf<QualType>::Alignment,
++    "Alignment is insufficient for objects appended to FunctionProtoType");
++// After QualType[], there can be one of 4 options: more QualType, Expr*, 2x
++// FunctionDecl*, FunctionDecl*
++static_assert(
++    llvm::AlignOf<QualType>::Alignment >= llvm::AlignOf<Expr *>::Alignment,
++    "Alignment is insufficient for objects appended to FunctionProtoType");
++static_assert(
++    llvm::AlignOf<QualType>::Alignment >=
++        llvm::AlignOf<FunctionDecl *>::Alignment,
++    "Alignment is insufficient for objects appended to FunctionProtoType");
++// And then, after any of those options, comes bool[]
++static_assert(
++    llvm::AlignOf<QualType>::Alignment >= llvm::AlignOf<bool>::Alignment,
++    "Alignment is insufficient for objects appended to FunctionProtoType");
++static_assert(
++    llvm::AlignOf<Expr *>::Alignment >= llvm::AlignOf<bool>::Alignment,
++    "Alignment is insufficient for objects appended to FunctionProtoType");
++static_assert(
++    llvm::AlignOf<FunctionDecl *>::Alignment >= llvm::AlignOf<bool>::Alignment,
++    "Alignment is insufficient for objects appended to FunctionProtoType");
+ 
+ /// \brief Represents the dependent type named by a dependently-scoped
+ /// typename using declaration, e.g.
[email protected]@ -3777,8 +3801,9 @@
+ /// TemplateArguments, followed by a QualType representing the
+ /// non-canonical aliased type when the template is a type alias
+ /// template.
+-class TemplateSpecializationType
+-  : public Type, public llvm::FoldingSetNode {
++class LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) TemplateSpecializationType
++    : public Type,
++      public llvm::FoldingSetNode {
+   /// \brief The name of the template being specialized.  This is
+   /// either a TemplateName::Template (in which case it is a
+   /// ClassTemplateDecl*, a TemplateTemplateParmDecl*, or a
[email protected]@ -3900,6 +3925,13 @@
+     return T->getTypeClass() == TemplateSpecialization;
+   }
+ };
++// static_assert(llvm::AlignOf<TemplateSpecializationType>::Alignment >=
++// llvm::AlignOf<TemplateArgument>::Alignment, "Alignment is insufficient for
++// objects appended to TemplateSpecializationType");
++// static_assert(llvm::AlignOf<TemplateArgument>::Alignment >=
++// llvm::AlignOf<QualType>::Alignment, "Alignment is insufficient for objects
++// appended to TemplateSpecializationType");
++// ^ Moved after class TemplateArgument, as it is is forward declared here.
+ 
+ /// \brief The injected class name of a C++ class template or class
+ /// template partial specialization.  Used to record that a type was
[email protected]@ -4175,8 +4207,9 @@
+ /// DependentTemplateSpecializationType - Represents a template
+ /// specialization type whose template cannot be resolved, e.g.
+ ///   A<T>::template B<T>
+-class DependentTemplateSpecializationType :
+-  public TypeWithKeyword, public llvm::FoldingSetNode {
++class LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) DependentTemplateSpecializationType
++    : public TypeWithKeyword,
++      public llvm::FoldingSetNode {
+ 
+   /// \brief The nested name specifier containing the qualifier.
+   NestedNameSpecifier *NNS;
[email protected]@ -4241,6 +4274,10 @@
+     return T->getTypeClass() == DependentTemplateSpecialization;
+   }
+ };
++// static_assert(llvm::AlignOf<DependentTemplateSpecializationType>::Alignment
++// >= llvm::AlignOf<TemplateArgument>::Alignment, "Alignment is insufficient for
++// objects appended to DependentTemplateSpecializationType");
++// ^ Moved after class TemplateArgument, as it is is forward declared here.
+ 
+ /// \brief Represents a pack expansion of types.
+ ///
[email protected]@ -4456,6 +4493,10 @@
+                       ObjCProtocolDecl *const *protocols,
+                       unsigned NumProtocols);
+ };
++static_assert(
++    llvm::AlignOf<ObjCObjectTypeImpl>::Alignment >=
++        llvm::AlignOf<ObjCProtocolDecl *>::Alignment,
++    "Alignment is insufficient for objects appended to ObjCObjectTypeImpl");
+ 
+ inline ObjCProtocolDecl **ObjCObjectType::getProtocolStorage() {
+   return reinterpret_cast<ObjCProtocolDecl**>(
+--- tools/clang/include/clang/AST/TypeLoc.h	2014-10-24 06:52:55.000000000 -0700
++++ tools/clang/include/clang/AST/TypeLoc.h	2015-07-17 16:43:46.514327822 -0700
[email protected]@ -199,6 +199,7 @@
+ 
+ /// \brief Return the TypeLoc for a type source info.
+ inline TypeLoc TypeSourceInfo::getTypeLoc() const {
++  // TODO: is this alignment already sufficient?
+   return TypeLoc(Ty, const_cast<void*>(static_cast<const void*>(this + 1)));
+ }
+ 
+--- tools/clang/include/clang/CodeGen/CGFunctionInfo.h	2014-12-12 15:41:25.000000000 -0800
++++ tools/clang/include/clang/CodeGen/CGFunctionInfo.h	2015-07-17 16:43:46.515714903 -0700
[email protected]@ -333,11 +333,13 @@
+ /// CGFunctionInfo - Class to encapsulate the information about a
+ /// function definition.
+ class CGFunctionInfo : public llvm::FoldingSetNode {
++public:
+   struct ArgInfo {
+     CanQualType type;
+     ABIArgInfo info;
+   };
+ 
++private:
+   /// The LLVM::CallingConv to use for this function (as specified by the
+   /// user).
+   unsigned CallingConvention : 8;
[email protected]@ -500,6 +502,10 @@
+     }
+   }
+ };
++static_assert(
++    llvm::AlignOf<CGFunctionInfo>::Alignment >=
++        llvm::AlignOf<CGFunctionInfo::ArgInfo>::Alignment,
++    "Alignment is insufficient for objects appended to CGFunctionInfo");
+ 
+ }  // end namespace CodeGen
+ }  // end namespace clang
+--- tools/clang/include/clang/Lex/MacroArgs.h	2014-08-13 12:25:19.000000000 -0400
++++ tools/clang/include/clang/Lex/MacroArgs.h	2015-07-17 22:23:39.000000000 -0400
[email protected]@ -15,13 +15,13 @@
+ #define LLVM_CLANG_LEX_MACROARGS_H
+ 
+ #include "clang/Basic/LLVM.h"
++#include "clang/Lex/Token.h"
+ #include "llvm/ADT/ArrayRef.h"
+ #include <vector>
+ 
+ namespace clang {
+   class MacroInfo;
+   class Preprocessor;
+-  class Token;
+   class SourceLocation;
+ 
+ /// MacroArgs - An instance of this class captures information about
[email protected]@ -120,6 +120,9 @@
+   /// its freelist.
+   MacroArgs *deallocate();
+ };
++static_assert(llvm::AlignOf<MacroArgs>::Alignment >=
++                  llvm::AlignOf<Token>::Alignment,
++              "Alignment is insufficient for objects appended to MacroArgs");
+ 
+ }  // end namespace clang
+ 
+--- tools/clang/include/clang/Lex/MacroInfo.h	2014-08-13 12:25:19.000000000 -0400
++++ tools/clang/include/clang/Lex/MacroInfo.h	2015-07-18 01:52:39.590867365 -0400
[email protected]@ -17,11 +17,15 @@
+ 
+ #include "clang/Lex/Token.h"
+ #include "llvm/ADT/ArrayRef.h"
++#include "llvm/ADT/FoldingSet.h"
++#include "llvm/ADT/PointerIntPair.h"
+ #include "llvm/ADT/SmallVector.h"
+ #include "llvm/Support/Allocator.h"
+ #include <cassert>
+ 
+ namespace clang {
++class Module;
++class ModuleMacro;
+ class Preprocessor;
+ 
+ /// \brief Encapsulates the data about a macro definition (e.g. its tokens).
[email protected]@ -294,6 +298,9 @@
+ 
+   friend class Preprocessor;
+ };
++static_assert(llvm::AlignOf<MacroInfo>::Alignment >=
++                  llvm::AlignOf<unsigned>::Alignment,
++              "Alignment is insufficient for objects appended to MacroInfo");
+ 
+ class DefMacroDirective;
+ 
[email protected]@ -517,6 +524,75 @@
+   static bool classof(const DefMacroDirective *) { return true; }
+ };
+ 
++/// \brief Represents a macro directive exported by a module.
++///
++/// There's an instance of this class for every macro #define or #undef that is
++/// the final directive for a macro name within a module. These entities also
++/// represent the macro override graph.
++///
++/// These are stored in a FoldingSet in the preprocessor.
++class ModuleMacro : public llvm::FoldingSetNode {
++  /// The name defined by the macro.
++  IdentifierInfo *II;
++  /// The body of the #define, or nullptr if this is a #undef.
++  MacroInfo *Macro;
++  /// The module that exports this macro.
++  Module *OwningModule;
++  /// The number of module macros that override this one.
++  unsigned NumOverriddenBy;
++  /// The number of modules whose macros are directly overridden by this one.
++  unsigned NumOverrides;
++  // ModuleMacro *OverriddenMacros[NumOverrides];
++
++  friend class Preprocessor;
++
++  ModuleMacro(Module *OwningModule, IdentifierInfo *II, MacroInfo *Macro,
++              ArrayRef<ModuleMacro *> Overrides)
++      : II(II), Macro(Macro), OwningModule(OwningModule), NumOverriddenBy(0),
++        NumOverrides(Overrides.size()) {
++    std::copy(Overrides.begin(), Overrides.end(),
++              reinterpret_cast<ModuleMacro **>(this + 1));
++  }
++
++public:
++  static ModuleMacro *create(Preprocessor &PP, Module *OwningModule,
++                             IdentifierInfo *II, MacroInfo *Macro,
++                             ArrayRef<ModuleMacro *> Overrides);
++
++  void Profile(llvm::FoldingSetNodeID &ID) const {
++    return Profile(ID, OwningModule, II);
++  }
++  static void Profile(llvm::FoldingSetNodeID &ID, Module *OwningModule,
++                      IdentifierInfo *II) {
++    ID.AddPointer(OwningModule);
++    ID.AddPointer(II);
++  }
++
++  /// Get the ID of the module that exports this macro.
++  Module *getOwningModule() const { return OwningModule; }
++
++  /// Get definition for this exported #define, or nullptr if this
++  /// represents a #undef.
++  MacroInfo *getMacroInfo() const { return Macro; }
++
++  /// Iterators over the overridden module IDs.
++  /// \{
++  typedef ModuleMacro *const *overrides_iterator;
++  overrides_iterator overrides_begin() const {
++    return reinterpret_cast<overrides_iterator>(this + 1);
++  }
++  overrides_iterator overrides_end() const {
++    return overrides_begin() + NumOverrides;
++  }
++  ArrayRef<ModuleMacro *> overrides() const {
++    return llvm::makeArrayRef(overrides_begin(), overrides_end());
++  }
++  /// \}
++
++  /// Get the number of macros that override this one.
++  unsigned getNumOverridingMacros() const { return NumOverriddenBy; }
++};
++
+ /// \brief A directive for an undefined macro.
+ class UndefMacroDirective : public MacroDirective  {
+ public:
[email protected]@ -550,6 +626,9 @@
+   }
+   static bool classof(const VisibilityMacroDirective *) { return true; }
+ };
++static_assert(llvm::AlignOf<ModuleMacro>::Alignment >=
++                  llvm::AlignOf<ModuleMacro *>::Alignment,
++              "Alignment is insufficient for objects appended to ModuleMacro");
+ 
+ inline unsigned *MacroDirective::getModuleDataStart() {
+   if (auto *Def = dyn_cast<DefMacroDirective>(this))
+--- tools/clang/include/clang/Sema/AttributeList.h	2015-01-20 11:27:49.000000000 -0800
++++ tools/clang/include/clang/Sema/AttributeList.h	2015-07-17 16:43:46.520539511 -0700
[email protected]@ -135,9 +135,7 @@
+   AttributeList *NextInPool;
+ 
+   /// Arguments, if any, are stored immediately following the object.
+-  ArgsUnion *getArgsBuffer() {
+-    return reinterpret_cast<ArgsUnion*>(this+1);
+-  }
++  ArgsUnion *getArgsBuffer() { return reinterpret_cast<ArgsUnion *>(this + 1); }
+   ArgsUnion const *getArgsBuffer() const {
+     return reinterpret_cast<ArgsUnion const *>(this+1);
+   }
[email protected]@ -468,6 +466,26 @@
+   /// a Spelling enumeration, the value UINT_MAX is returned.
+   unsigned getSemanticSpelling() const;
+ };
++static_assert(
++    llvm::AlignOf<AttributeList>::Alignment >=
++        llvm::AlignOf<ArgsUnion>::Alignment,
++    "Alignment is insufficient for objects appended to AttributeList");
++static_assert(
++    llvm::AlignOf<ArgsUnion>::Alignment >=
++        llvm::AlignOf<AvailabilityChange>::Alignment,
++    "Alignment is insufficient for objects appended to AttributeList");
++static_assert(
++    llvm::AlignOf<ArgsUnion>::Alignment >=
++        llvm::AlignOf<AttributeList::TypeTagForDatatypeData>::Alignment,
++    "Alignment is insufficient for objects appended to AttributeList");
++static_assert(
++    llvm::AlignOf<AttributeList>::Alignment >=
++        llvm::AlignOf<ParsedType>::Alignment,
++    "Alignment is insufficient for objects appended to AttributeList");
++static_assert(
++    llvm::AlignOf<AttributeList>::Alignment >=
++        llvm::AlignOf<AttributeList::PropertyData>::Alignment,
++    "Alignment is insufficient for objects appended to AttributeList");
+ 
+ /// A factory, from which one makes pools, from which one creates
+ /// individual attributes which are deallocated with the pool.
+--- tools/clang/include/clang/Sema/CodeCompleteConsumer.h	2014-05-05 23:48:52.000000000 -0700
++++ tools/clang/include/clang/Sema/CodeCompleteConsumer.h	2015-07-17 16:43:46.522097320 -0700
[email protected]@ -493,6 +493,14 @@
+   /// which is mainly useful for debugging.
+   std::string getAsString() const;
+ };
++static_assert(
++    llvm::AlignOf<CodeCompletionString>::Alignment >=
++        llvm::AlignOf<CodeCompletionString::Chunk>::Alignment,
++    "Alignment is insufficient for objects appended to CodeCompletionString");
++static_assert(
++    llvm::AlignOf<CodeCompletionString::Chunk>::Alignment >=
++        llvm::AlignOf<const char *>::Alignment,
++    "Alignment is insufficient for objects appended to CodeCompletionString");
+ 
+ /// \brief An allocator used specifically for the purpose of code completion.
+ class CodeCompletionAllocator : public llvm::BumpPtrAllocator {
+--- tools/clang/include/clang/Sema/ParsedTemplate.h	2014-05-05 23:48:52.000000000 -0700
++++ tools/clang/include/clang/Sema/ParsedTemplate.h	2015-07-17 16:43:46.523177530 -0700
[email protected]@ -205,6 +205,10 @@
+       free(this); 
+     }
+   };
++  static_assert(
++      llvm::AlignOf<TemplateIdAnnotation>::Alignment >=
++          llvm::AlignOf<ParsedTemplateArgument>::Alignment,
++      "Alignment is insufficient for objects appended to TemplateIdAnnotation");
+ 
+   /// Retrieves the range of the given template parameter lists.
+   SourceRange getTemplateParamsRange(TemplateParameterList const *const *Params,
+--- tools/clang/lib/AST/Decl.cpp	2015-05-04 11:23:59.000000000 -0700
++++ tools/clang/lib/AST/Decl.cpp	2015-07-17 16:43:46.525788978 -0700
[email protected]@ -3064,8 +3064,8 @@
+                              const TemplateArgumentListInfo &TemplateArgs) {
+   assert(TemplateOrSpecialization.isNull());
+   size_t Size = sizeof(DependentFunctionTemplateSpecializationInfo);
+-  Size += Templates.size() * sizeof(FunctionTemplateDecl*);
+   Size += TemplateArgs.size() * sizeof(TemplateArgumentLoc);
++  Size += Templates.size() * sizeof(FunctionTemplateDecl *);
+   void *Buffer = Context.Allocate(Size);
+   DependentFunctionTemplateSpecializationInfo *Info =
+     new (Buffer) DependentFunctionTemplateSpecializationInfo(Templates,
[email protected]@ -3078,8 +3078,8 @@
+                                       const TemplateArgumentListInfo &TArgs)
+   : AngleLocs(TArgs.getLAngleLoc(), TArgs.getRAngleLoc()) {
+ 
+-  d.NumTemplates = Ts.size();
+-  d.NumArgs = TArgs.size();
++  NumTemplates = Ts.size();
++  NumArgs = TArgs.size();
+ 
+   FunctionTemplateDecl **TsArray =
+     const_cast<FunctionTemplateDecl**>(getTemplates());
+--- tools/clang/lib/AST/DeclBase.cpp	2014-11-17 15:36:45.000000000 -0800
++++ tools/clang/lib/AST/DeclBase.cpp	2015-07-17 17:03:06.999226816 -0700
[email protected]@ -45,14 +45,28 @@
+   getASTContext().getExternalSource()->updateOutOfDateIdentifier(II);
+ }
+ 
++#define DECL(DERIVED, BASE)                                                    \
++  static_assert(llvm::AlignOf<uint64_t>::Alignment >=                          \
++                    llvm::AlignOf<DERIVED##Decl>::Alignment,                   \
++                "Alignment is insufficient for objects appended to all Decl "  \
++                "subclasses");
++#define ABSTRACT_DECL(DECL)
++#include "clang/AST/DeclNodes.inc"
++
+ void *Decl::operator new(std::size_t Size, const ASTContext &Context,
+                          unsigned ID, std::size_t Extra) {
+   // Allocate an extra 8 bytes worth of storage, which ensures that the
+   // resulting pointer will still be 8-byte aligned. 
+-  void *Start = Context.Allocate(Size + Extra + 8);
+-  void *Result = (char*)Start + 8;
++  static_assert(sizeof(unsigned) * 2 >= llvm::AlignOf<uint64_t>::Alignment,
++      "sizeof(unsigned) * 2 < llvm::AlignOf<uint64_t>::Alignment!");
++
++  void *Start = Context.Allocate(Size + Extra + 8, 8U);
++  void *Result = reinterpret_cast<void*>(
++      reinterpret_cast<unsigned char*>(
++        reinterpret_cast<unsigned char*>(Start) + 8));
+ 
+-  unsigned *PrefixPtr = (unsigned *)Result - 2;
++  unsigned *PrefixPtr =
++    reinterpret_cast<unsigned*>(reinterpret_cast<unsigned*>(Result) - 2);
+ 
+   // Zero out the first 4 bytes; this is used to store the owning module ID.
+   PrefixPtr[0] = 0;
+--- tools/clang/lib/AST/Expr.cpp	2015-01-12 02:17:46.000000000 -0800
++++ tools/clang/lib/AST/Expr.cpp	2015-07-17 16:43:46.530620842 -0700
[email protected]@ -399,10 +399,15 @@
+     Size += sizeof(NestedNameSpecifierLoc);
+   if (FoundD)
+     Size += sizeof(NamedDecl *);
+-  if (TemplateArgs)
++  if (TemplateArgs) {
++    Size = llvm::RoundUpToAlignment(Size,
++                                    llvm::alignOf<ASTTemplateKWAndArgsInfo>());
+     Size += ASTTemplateKWAndArgsInfo::sizeFor(TemplateArgs->size());
+-  else if (TemplateKWLoc.isValid())
++  } else if (TemplateKWLoc.isValid()) {
++    Size = llvm::RoundUpToAlignment(Size,
++                                    llvm::alignOf<ASTTemplateKWAndArgsInfo>());
+     Size += ASTTemplateKWAndArgsInfo::sizeFor(0);
++  }
+ 
+   void *Mem = Context.Allocate(Size, llvm::alignOf<DeclRefExpr>());
+   return new (Mem) DeclRefExpr(Context, QualifierLoc, TemplateKWLoc, D,
[email protected]@ -420,8 +425,11 @@
+     Size += sizeof(NestedNameSpecifierLoc);
+   if (HasFoundDecl)
+     Size += sizeof(NamedDecl *);
+-  if (HasTemplateKWAndArgsInfo)
++  if (HasTemplateKWAndArgsInfo) {
++    Size = llvm::RoundUpToAlignment(Size,
++                                    llvm::alignOf<ASTTemplateKWAndArgsInfo>());
+     Size += ASTTemplateKWAndArgsInfo::sizeFor(NumTemplateArgs);
++  }
+ 
+   void *Mem = Context.Allocate(Size, llvm::alignOf<DeclRefExpr>());
+   return new (Mem) DeclRefExpr(EmptyShell());
[email protected]@ -3871,7 +3879,8 @@
+                            SourceLocation ColonOrEqualLoc,
+                            bool UsesColonSyntax, Expr *Init) {
+   void *Mem = C.Allocate(sizeof(DesignatedInitExpr) +
+-                         sizeof(Stmt *) * (IndexExprs.size() + 1), 8);
++                             sizeof(Stmt *) * (IndexExprs.size() + 1),
++                         llvm::alignOf<DesignatedInitExpr>());
+   return new (Mem) DesignatedInitExpr(C, C.VoidTy, NumDesignators, Designators,
+                                       ColonOrEqualLoc, UsesColonSyntax,
+                                       IndexExprs, Init);
+--- tools/clang/lib/AST/ExprCXX.cpp	2014-09-25 17:28:20.000000000 -0700
++++ tools/clang/lib/AST/ExprCXX.cpp	2015-07-17 16:43:46.532400798 -0700
[email protected]@ -1070,14 +1070,14 @@
+ }
+ 
+ ArrayRef<VarDecl *> 
+-LambdaExpr::getCaptureInitIndexVars(capture_init_iterator Iter) const {
++LambdaExpr::getCaptureInitIndexVars(const_capture_init_iterator Iter) const {
+   assert(HasArrayIndexVars && "No array index-var data?");
+   
+   unsigned Index = Iter - capture_init_begin();
+   assert(Index < getLambdaClass()->getLambdaData().NumCaptures &&
+          "Capture index out-of-range");
+-  VarDecl **IndexVars = getArrayIndexVars();
+-  unsigned *IndexStarts = getArrayIndexStarts();
++  VarDecl *const *IndexVars = getArrayIndexVars();
++  const unsigned *IndexStarts = getArrayIndexStarts();
+   return llvm::makeArrayRef(IndexVars + IndexStarts[Index],
+                             IndexVars + IndexStarts[Index + 1]);
+ }
[email protected]@ -1098,8 +1098,12 @@
+ }
+ 
+ CompoundStmt *LambdaExpr::getBody() const {
++  // FIXME: this mutation in getBody is bogus. It should be
++  // initialized in ASTStmtReader::VisitLambdaExpr, but for reasons I
++  // don't understand, that doesn't work.
+   if (!getStoredStmts()[NumCaptures])
+-    getStoredStmts()[NumCaptures] = getCallOperator()->getBody();
++    *const_cast<clang::Stmt **>(&getStoredStmts()[NumCaptures]) =
++        getCallOperator()->getBody();
+     
+   return reinterpret_cast<CompoundStmt *>(getStoredStmts()[NumCaptures]);
+ }
+--- tools/clang/lib/AST/Stmt.cpp	2014-12-14 23:07:06.000000000 -0800
++++ tools/clang/lib/AST/Stmt.cpp	2015-07-17 16:43:46.536947418 -0700
[email protected]@ -816,7 +816,7 @@
+ CXXTryStmt *CXXTryStmt::Create(const ASTContext &C, SourceLocation tryLoc,
+                                Stmt *tryBlock, ArrayRef<Stmt*> handlers) {
+   std::size_t Size = sizeof(CXXTryStmt);
+-  Size += ((handlers.size() + 1) * sizeof(Stmt));
++  Size += ((handlers.size() + 1) * sizeof(Stmt *));
+ 
+   void *Mem = C.Allocate(Size, llvm::alignOf<CXXTryStmt>());
+   return new (Mem) CXXTryStmt(tryLoc, tryBlock, handlers);
[email protected]@ -825,7 +825,7 @@
+ CXXTryStmt *CXXTryStmt::Create(const ASTContext &C, EmptyShell Empty,
+                                unsigned numHandlers) {
+   std::size_t Size = sizeof(CXXTryStmt);
+-  Size += ((numHandlers + 1) * sizeof(Stmt));
++  Size += ((numHandlers + 1) * sizeof(Stmt *));
+ 
+   void *Mem = C.Allocate(Size, llvm::alignOf<CXXTryStmt>());
+   return new (Mem) CXXTryStmt(Empty, numHandlers);
[email protected]@ -2027,4 +2027,3 @@
+       C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
+   return new (Mem) OMPTeamsDirective(NumClauses);
+ }
+-
+--- tools/clang/lib/Basic/IdentifierTable.cpp	2014-12-11 04:18:08.000000000 -0800
++++ tools/clang/lib/Basic/IdentifierTable.cpp	2015-07-17 16:43:46.538457921 -0700
[email protected]@ -376,6 +376,11 @@
+     Profile(ID, keyword_begin(), getNumArgs());
+   }
+ };
++static_assert(
++    llvm::AlignOf<MultiKeywordSelector>::Alignment >=
++        llvm::AlignOf<IdentifierInfo *>::Alignment,
++    "Alignment is insufficient for objects appended to MultiKeywordSelector");
++
+ } // end namespace clang.
+ 
+ unsigned Selector::getNumArgs() const {
+--- tools/clang/lib/CodeGen/CGCleanup.h	2014-11-18 23:49:47.000000000 -0800
++++ tools/clang/lib/CodeGen/CGCleanup.h	2015-07-17 16:43:46.540112662 -0700
[email protected]@ -211,9 +211,12 @@
+     return Scope->getKind() == Catch;
+   }
+ };
++static_assert(llvm::AlignOf<EHCatchScope>::Alignment >=
++                  llvm::AlignOf<EHCatchScope::Handler *>::Alignment,
++              "Alignment is insufficient for objects appended to EHCatchScope");
+ 
+ /// A cleanup scope which generates the cleanup blocks lazily.
+-class EHCleanupScope : public EHScope {
++class LLVM_ALIGNAS(/*alignof(uint64_t)*/ 8) EHCleanupScope : public EHScope {
+   /// The nearest normal cleanup scope enclosing this one.
+   EHScopeStack::stable_iterator EnclosingNormal;
+ 
[email protected]@ -391,6 +394,13 @@
+     return (Scope->getKind() == Cleanup);
+   }
+ };
++// Assert objects tacked on the end of EHCleanupScope won't be
++// misaligned.  NOTE: there's actually a bunch of different data
++// classes tacked on, so let's just ensure alignment good enough for
++// uint64_t bytes.
++static_assert(llvm::AlignOf<EHCleanupScope>::Alignment >=
++                  llvm::AlignOf<uint64_t>::Alignment,
++              "");
+ 
+ /// An exceptions scope which filters exceptions thrown through it.
+ /// Only exceptions matching the filter types will be permitted to be
[email protected]@ -435,6 +445,10 @@
+     return scope->getKind() == Filter;
+   }
+ };
++static_assert(
++    llvm::AlignOf<EHFilterScope>::Alignment >=
++        llvm::AlignOf<llvm::Value *>::Alignment,
++    "Alignment is insufficient for objects appended to EHFilterScope");
+ 
+ /// An exceptions scope which calls std::terminate if any exception
+ /// reaches it.
[email protected]@ -467,27 +481,27 @@
+   EHScope &operator*() const { return *get(); }
+ 
+   iterator &operator++() {
++    size_t Size;
+     switch (get()->getKind()) {
+     case EHScope::Catch:
+-      Ptr += EHCatchScope::getSizeForNumHandlers(
++      Size = EHCatchScope::getSizeForNumHandlers(
+           static_cast<const EHCatchScope*>(get())->getNumHandlers());
+       break;
+ 
+     case EHScope::Filter:
+-      Ptr += EHFilterScope::getSizeForNumFilters(
++      Size = EHFilterScope::getSizeForNumFilters(
+           static_cast<const EHFilterScope*>(get())->getNumFilters());
+       break;
+ 
+     case EHScope::Cleanup:
+-      Ptr += static_cast<const EHCleanupScope*>(get())
+-        ->getAllocatedSize();
++      Size = static_cast<const EHCleanupScope *>(get())->getAllocatedSize();
+       break;
+ 
+     case EHScope::Terminate:
+-      Ptr += EHTerminateScope::getSize();
++      Size = EHTerminateScope::getSize();
+       break;
+     }
+-
++    Ptr += llvm::RoundUpToAlignment(Size, ScopeStackAlignment);
+     return *this;
+   }
+ 
[email protected]@ -523,7 +537,7 @@
+ 
+   EHCatchScope &scope = cast<EHCatchScope>(*begin());
+   InnermostEHScope = scope.getEnclosingEHScope();
+-  StartOfData += EHCatchScope::getSizeForNumHandlers(scope.getNumHandlers());
++  unallocate(EHCatchScope::getSizeForNumHandlers(scope.getNumHandlers()));
+ }
+ 
+ inline void EHScopeStack::popTerminate() {
[email protected]@ -531,7 +545,7 @@
+ 
+   EHTerminateScope &scope = cast<EHTerminateScope>(*begin());
+   InnermostEHScope = scope.getEnclosingEHScope();
+-  StartOfData += EHTerminateScope::getSize();
++  unallocate(EHTerminateScope::getSize());
+ }
+ 
+ inline EHScopeStack::iterator EHScopeStack::find(stable_iterator sp) const {
+--- tools/clang/lib/CodeGen/CGCleanup.cpp	2015-01-13 23:38:27.000000000 -0800
++++ tools/clang/lib/CodeGen/CGCleanup.cpp	2015-07-17 17:08:23.853121118 -0700
[email protected]@ -94,6 +94,7 @@
+ 
+ /// Push an entry of the given size onto this protected-scope stack.
+ char *EHScopeStack::allocate(size_t Size) {
++  Size = llvm::RoundUpToAlignment(Size, ScopeStackAlignment);
+   if (!StartOfBuffer) {
+     unsigned Capacity = 1024;
+     while (Capacity < Size) Capacity *= 2;
[email protected]@ -123,6 +124,10 @@
+   return StartOfData;
+ }
+ 
++void EHScopeStack::unallocate(size_t Size) {
++  StartOfData += llvm::RoundUpToAlignment(Size, ScopeStackAlignment);
++}
++
+ EHScopeStack::stable_iterator
+ EHScopeStack::getInnermostActiveNormalCleanup() const {
+   for (stable_iterator si = getInnermostNormalCleanup(), se = stable_end();
[email protected]@ -153,7 +158,6 @@
+ 
+ 
+ void *EHScopeStack::pushCleanup(CleanupKind Kind, size_t Size) {
+-  assert(((Size % sizeof(void*)) == 0) && "cleanup type is misaligned");
+   char *Buffer = allocate(EHCleanupScope::getSizeForCleanupSize(Size));
+   bool IsNormalCleanup = Kind & NormalCleanup;
+   bool IsEHCleanup = Kind & EHCleanup;
[email protected]@ -181,7 +185,7 @@
+   EHCleanupScope &Cleanup = cast<EHCleanupScope>(*begin());
+   InnermostNormalCleanup = Cleanup.getEnclosingNormalCleanup();
+   InnermostEHScope = Cleanup.getEnclosingEHScope();
+-  StartOfData += Cleanup.getAllocatedSize();
++  unallocate(Cleanup.getAllocatedSize());
+ 
+   // Destroy the cleanup.
+   Cleanup.Destroy();
[email protected]@ -211,7 +215,7 @@
+   assert(!empty() && "popping exception stack when not empty");
+ 
+   EHFilterScope &filter = cast<EHFilterScope>(*begin());
+-  StartOfData += EHFilterScope::getSizeForNumFilters(filter.getNumFilters());
++  unallocate(EHFilterScope::getSizeForNumFilters(filter.getNumFilters()));
+ 
+   InnermostEHScope = filter.getEnclosingEHScope();
+ }
+--- tools/clang/lib/CodeGen/CGExprCXX.cpp	2015-01-13 23:38:27.000000000 -0800
++++ tools/clang/lib/CodeGen/CGExprCXX.cpp	2015-07-17 16:43:46.544527492 -0700
[email protected]@ -1129,6 +1129,10 @@
+       EmitNewDeleteCall(CGF, OperatorDelete, FPT, DeleteArgs);
+     }
+   };
++  static_assert(
++      llvm::AlignOf<CallDeleteDuringNew>::Alignment >=
++          llvm::AlignOf<RValue>::Alignment,
++      "Alignment is insufficient for objects appended to CallDeleteDuringNew");
+ 
+   /// A cleanup to call the given 'operator delete' function upon
+   /// abnormal exit from a new expression when the new expression is
[email protected]@ -1188,6 +1192,10 @@
+       EmitNewDeleteCall(CGF, OperatorDelete, FPT, DeleteArgs);
+     }
+   };
++  static_assert(
++      llvm::AlignOf<CallDeleteDuringConditionalNew>::Alignment >=
++          llvm::AlignOf<DominatingValue<RValue>::saved_type>::Alignment,
++      "Alignment is insufficient for objects appended to CallDeleteDuringNew");
+ }
+ 
+ /// Enter a cleanup to call 'operator delete' if the initializer in a
[email protected]@ -1819,7 +1827,7 @@
+       MakeAddrLValue(Slot.getAddr(), E->getType(), Slot.getAlignment());
+ 
+   CXXRecordDecl::field_iterator CurField = E->getLambdaClass()->field_begin();
+-  for (LambdaExpr::capture_init_iterator i = E->capture_init_begin(),
++  for (LambdaExpr::const_capture_init_iterator i = E->capture_init_begin(),
+                                          e = E->capture_init_end();
+        i != e; ++i, ++CurField) {
+     // Emit initialization
+--- tools/clang/lib/CodeGen/CGStmt.cpp	2015-01-13 23:38:27.000000000 -0800
++++ tools/clang/lib/CodeGen/CGStmt.cpp	2015-07-17 16:43:46.546244580 -0700
[email protected]@ -2122,7 +2122,7 @@
+       CreateMemTemp(RecordTy, "agg.captured"), RecordTy);
+ 
+   RecordDecl::field_iterator CurField = RD->field_begin();
+-  for (CapturedStmt::capture_init_iterator I = S.capture_init_begin(),
++  for (CapturedStmt::const_capture_init_iterator I = S.capture_init_begin(),
+                                            E = S.capture_init_end();
+        I != E; ++I, ++CurField) {
+     LValue LV = EmitLValueForFieldInitialization(SlotLV, *CurField);
+--- tools/clang/lib/CodeGen/EHScopeStack.h	2014-10-31 19:33:56.000000000 -0400
++++ tools/clang/lib/CodeGen/EHScopeStack.h	2015-07-18 01:53:43.588447919 -0400
[email protected]@ -89,6 +89,8 @@
+ /// and catch blocks.
+ class EHScopeStack {
+ public:
++  enum { ScopeStackAlignment = llvm::AlignOf<uint64_t>::Alignment };
++
+   /// A saved depth on the scope stack.  This is necessary because
+   /// pushing scopes onto the stack invalidates iterators.
+   class stable_iterator {
[email protected]@ -297,6 +299,7 @@
+   SmallVector<BranchFixup, 8> BranchFixups;
+ 
+   char *allocate(size_t Size);
++  void unallocate(size_t Size);
+ 
+   void *pushCleanup(CleanupKind K, size_t DataSize);
+ 
[email protected]@ -311,6 +314,8 @@
+   /// Push a lazily-created cleanup on the stack.
+   template <class T>
+   void pushCleanup(CleanupKind Kind) {
++    static_assert(llvm::AlignOf<T>::Alignment <= ScopeStackAlignment,
++        "Insufficient Alignment!");
+     void *Buffer = pushCleanup(Kind, sizeof(T));
+     Cleanup *Obj = new(Buffer) T();
+     (void) Obj;
[email protected]@ -319,6 +324,8 @@
+   /// Push a lazily-created cleanup on the stack.
+   template <class T, class A0>
+   void pushCleanup(CleanupKind Kind, A0 a0) {
++    static_assert(llvm::AlignOf<T>::Alignment <= ScopeStackAlignment,
++        "Insufficient Alignment!");
+     void *Buffer = pushCleanup(Kind, sizeof(T));
+     Cleanup *Obj = new(Buffer) T(a0);
+     (void) Obj;
[email protected]@ -327,6 +334,8 @@
+   /// Push a lazily-created cleanup on the stack.
+   template <class T, class A0, class A1>
+   void pushCleanup(CleanupKind Kind, A0 a0, A1 a1) {
++    static_assert(llvm::AlignOf<T>::Alignment <= ScopeStackAlignment,
++        "Insufficient Alignment!");
+     void *Buffer = pushCleanup(Kind, sizeof(T));
+     Cleanup *Obj = new(Buffer) T(a0, a1);
+     (void) Obj;
[email protected]@ -335,6 +344,8 @@
+   /// Push a lazily-created cleanup on the stack.
+   template <class T, class A0, class A1, class A2>
+   void pushCleanup(CleanupKind Kind, A0 a0, A1 a1, A2 a2) {
++    static_assert(llvm::AlignOf<T>::Alignment <= ScopeStackAlignment,
++        "Insufficient Alignment!");
+     void *Buffer = pushCleanup(Kind, sizeof(T));
+     Cleanup *Obj = new(Buffer) T(a0, a1, a2);
+     (void) Obj;
[email protected]@ -343,6 +354,8 @@
+   /// Push a lazily-created cleanup on the stack.
+   template <class T, class A0, class A1, class A2, class A3>
+   void pushCleanup(CleanupKind Kind, A0 a0, A1 a1, A2 a2, A3 a3) {
++    static_assert(llvm::AlignOf<T>::Alignment <= ScopeStackAlignment,
++        "Insufficient Alignment!");
+     void *Buffer = pushCleanup(Kind, sizeof(T));
+     Cleanup *Obj = new(Buffer) T(a0, a1, a2, a3);
+     (void) Obj;
[email protected]@ -351,11 +364,24 @@
+   /// Push a lazily-created cleanup on the stack.
+   template <class T, class A0, class A1, class A2, class A3, class A4>
+   void pushCleanup(CleanupKind Kind, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
++    static_assert(llvm::AlignOf<T>::Alignment <= ScopeStackAlignment,
++        "Insufficient Alignment!");
+     void *Buffer = pushCleanup(Kind, sizeof(T));
+     Cleanup *Obj = new(Buffer) T(a0, a1, a2, a3, a4);
+     (void) Obj;
+   }
+ 
++  /// Push a lazily-created cleanup on the stack. Tuple version.
++  template <class T, class... As>
++  void pushCleanupTuple(CleanupKind Kind, std::tuple<As...> A) {
++    static_assert(llvm::AlignOf<T>::Alignment <= ScopeStackAlignment,
++        "Insufficient Alignment!");
++    void *Buffer = pushCleanup(Kind, sizeof(T));
++    Cleanup *Obj = new (Buffer) T(std::move(A));
++    (void) Obj;
++  }
++
++
+   // Feel free to add more variants of the following:
+ 
+   /// Push a cleanup with non-constant storage requirements on the
[email protected]@ -371,6 +397,8 @@
+   /// stack is modified.
+   template <class T, class A0, class A1, class A2>
+   T *pushCleanupWithExtra(CleanupKind Kind, size_t N, A0 a0, A1 a1, A2 a2) {
++    static_assert(llvm::AlignOf<T>::Alignment <= ScopeStackAlignment,
++        "Insufficient Alignment!");
+     void *Buffer = pushCleanup(Kind, sizeof(T) + T::getExtraSize(N));
+     return new (Buffer) T(N, a0, a1, a2);
+   }
+--- tools/clang/lib/Lex/PPDirectives.cpp	2014-12-27 23:42:49.000000000 -0800
++++ tools/clang/lib/Lex/PPDirectives.cpp	2015-07-17 16:43:46.550148988 -0700
[email protected]@ -48,8 +48,6 @@
+ 
+ MacroInfo *Preprocessor::AllocateDeserializedMacroInfo(SourceLocation L,
+                                                        unsigned SubModuleID) {
+-  static_assert(llvm::AlignOf<MacroInfo>::Alignment >= sizeof(SubModuleID),
+-                "alignment for MacroInfo is less than the ID");
+   DeserializedMacroInfoChain *MIChain =
+       BP.Allocate<DeserializedMacroInfoChain>();
+   MIChain->Next = DeserialMIChainHead;
+--- tools/clang/lib/Sema/SemaExceptionSpec.cpp	2014-11-21 19:09:05.000000000 -0800
++++ tools/clang/lib/Sema/SemaExceptionSpec.cpp	2015-07-17 16:43:46.552022232 -0700
[email protected]@ -971,7 +971,8 @@
+   case Expr::LambdaExprClass: {
+     const LambdaExpr *Lambda = cast<LambdaExpr>(E);
+     CanThrowResult CT = CT_Cannot;
+-    for (LambdaExpr::capture_init_iterator Cap = Lambda->capture_init_begin(),
++    for (LambdaExpr::const_capture_init_iterator
++             Cap = Lambda->capture_init_begin(),
+                                         CapEnd = Lambda->capture_init_end();
+          Cap != CapEnd; ++Cap)
+       CT = mergeCanThrow(CT, canThrow(*Cap));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/007-TemplateBase.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,224 @@
+# 1. RAII - Resource Acquisition Is Initialization.
+# 2. Default bit-copying or assigning union member bitfields
+#    between unions of different types or size is undefined behavior.
+# 3. Default bit-copying or assigning unions of different types or
+#    size is undefined behavior.
+# 4. Default bit-copying or assigning nested unions is undefined behavior.
+# https://llvm.org/bugs/show_bug.cgi?id=24608
+--- tools/clang/include/clang/AST/TemplateBase.h	2015-07-17 16:43:46.506876445 -0700
++++ tools/clang/include/clang/AST/TemplateBase.h	2015-07-17 17:39:04.239131360 -0700
[email protected]@ -22,6 +22,7 @@
+ #include "llvm/ADT/iterator_range.h"
+ #include "llvm/Support/Compiler.h"
+ #include "llvm/Support/ErrorHandling.h"
++#include <cstring>
+ 
+ namespace llvm {
+   class FoldingSetNodeID;
[email protected]@ -84,8 +85,8 @@
+     // We store a decomposed APSInt with the data allocated by ASTContext if
+     // BitWidth > 64. The memory may be shared between multiple
+     // TemplateArgument instances.
+-    unsigned BitWidth : 31;
+-    unsigned IsUnsigned : 1;
++    unsigned BitWidth;
++    bool IsUnsigned;
+     union {
+       uint64_t VAL;          ///< Used to store the <= 64 bits integer value.
+       const uint64_t *pVal;  ///< Used to store the >64 bits integer value.
[email protected]@ -112,6 +113,7 @@
+     struct A Args;
+     struct TA TemplateArg;
+     struct TV TypeOrValue;
++    uint64_t Buffer[8];
+   };
+ 
+   TemplateArgument(TemplateName, bool) LLVM_DELETED_FUNCTION;
[email protected]@ -119,12 +121,27 @@
+ public:
+   /// \brief Construct an empty, invalid template argument.
+   TemplateArgument() {
++    (void) std::memset(Buffer, 0, sizeof(Buffer));
+     TypeOrValue.Kind = Null;
+     TypeOrValue.V = 0;
+   }
+ 
++  TemplateArgument(const TemplateArgument &RHS) {
++    (void) std::memset(Buffer, 0, sizeof(Buffer));
++    (void) std::memcpy(Buffer, RHS.Buffer, sizeof(Buffer));
++  }
++
++  TemplateArgument &operator=(const TemplateArgument &RHS) {
++    if (this != &RHS) {
++      (void) std::memset(Buffer, 0, sizeof(Buffer));
++      (void) std::memcpy(Buffer, RHS.Buffer, sizeof(Buffer));
++    }
++    return *this;
++  }
++
+   /// \brief Construct a template type argument.
+   TemplateArgument(QualType T, bool isNullPtr = false) {
++    (void) std::memset(Buffer, 0, sizeof(Buffer));
+     TypeOrValue.Kind = isNullPtr ? NullPtr : Type;
+     TypeOrValue.V = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
+   }
[email protected]@ -134,6 +151,7 @@
+   /// template declaration.
+   TemplateArgument(ValueDecl *D, QualType QT) {
+     assert(D && "Expected decl");
++    (void) std::memset(Buffer, 0, sizeof(Buffer));
+     DeclArg.Kind = Declaration;
+     DeclArg.QT = QT.getAsOpaquePtr();
+     DeclArg.D = D;
[email protected]@ -146,6 +164,7 @@
+   /// \brief Construct an integral constant template argument with the same
+   /// value as Other but a different type.
+   TemplateArgument(const TemplateArgument &Other, QualType Type) {
++    (void) std::memset(Buffer, 0, sizeof(Buffer));
+     Integer = Other.Integer;
+     Integer.Type = Type.getAsOpaquePtr();
+   }
[email protected]@ -159,6 +178,7 @@
+   ///
+   /// \param Name The template name.
+   TemplateArgument(TemplateName Name) {
++    (void) std::memset(Buffer, 0, sizeof(Buffer));
+     TemplateArg.Kind = Template;
+     TemplateArg.Name = Name.getAsVoidPointer();
+     TemplateArg.NumExpansions = 0;
[email protected]@ -176,6 +196,7 @@
+   /// \param NumExpansions The number of expansions that will be generated by
+   /// instantiating
+   TemplateArgument(TemplateName Name, Optional<unsigned> NumExpansions) {
++    (void) std::memset(Buffer, 0, sizeof(Buffer));
+     TemplateArg.Kind = TemplateExpansion;
+     TemplateArg.Name = Name.getAsVoidPointer();
+     if (NumExpansions)
[email protected]@ -190,6 +211,7 @@
+   /// lists used for dependent types and for expression; it will not
+   /// occur in a non-dependent, canonical template argument list.
+   TemplateArgument(Expr *E) {
++    (void) std::memset(Buffer, 0, sizeof(Buffer));
+     TypeOrValue.Kind = Expression;
+     TypeOrValue.V = reinterpret_cast<uintptr_t>(E);
+   }
[email protected]@ -199,6 +221,7 @@
+   /// We assume that storage for the template arguments provided
+   /// outlives the TemplateArgument itself.
+   TemplateArgument(const TemplateArgument *Args, unsigned NumArgs) {
++    (void) std::memset(Buffer, 0, sizeof(Buffer));
+     this->Args.Kind = Pack;
+     this->Args.Args = Args;
+     this->Args.NumArgs = NumArgs;
[email protected]@ -391,25 +414,55 @@
+     struct T Template;
+     Expr *Expression;
+     TypeSourceInfo *Declarator;
++    unsigned long Buffer[4];
+   };
+ 
+ public:
+   TemplateArgumentLocInfo();
+   
+-  TemplateArgumentLocInfo(TypeSourceInfo *TInfo) : Declarator(TInfo) {}
++  TemplateArgumentLocInfo(TypeSourceInfo *TInfo) {
++    (void) std::memset(Buffer, 0, sizeof(Buffer));
++    Declarator = TInfo;
++  }
+   
+-  TemplateArgumentLocInfo(Expr *E) : Expression(E) {}
++  TemplateArgumentLocInfo(Expr *E) {
++    (void) std::memset(Buffer, 0, sizeof(Buffer));
++    Expression = E;
++  }
+   
+   TemplateArgumentLocInfo(NestedNameSpecifierLoc QualifierLoc,
+                           SourceLocation TemplateNameLoc,
+-                          SourceLocation EllipsisLoc)
+-  {
++                          SourceLocation EllipsisLoc) {
++    (void) std::memset(Buffer, 0, sizeof(Buffer));
+     Template.Qualifier = QualifierLoc.getNestedNameSpecifier();
+     Template.QualifierLocData = QualifierLoc.getOpaqueData();
+     Template.TemplateNameLoc = TemplateNameLoc.getRawEncoding();
+     Template.EllipsisLoc = EllipsisLoc.getRawEncoding();
+   }
+ 
++  TemplateArgumentLocInfo(const TemplateArgumentLocInfo &RHS) {
++    (void) std::memset(Buffer, 0, sizeof(Buffer));
++    Template.Qualifier = RHS.Template.Qualifier;
++    Template.QualifierLocData = RHS.Template.QualifierLocData;
++    Template.TemplateNameLoc = RHS.Template.TemplateNameLoc;
++    Template.EllipsisLoc = RHS.Template.EllipsisLoc;
++    Expression = RHS.Expression;
++    Declarator = RHS.Declarator;
++  }
++
++  TemplateArgumentLocInfo &operator=(const TemplateArgumentLocInfo &RHS) {
++    if (this != &RHS) {
++      (void) std::memset(Buffer, 0, sizeof(Buffer));
++      Template.Qualifier = RHS.Template.Qualifier;
++      Template.QualifierLocData = RHS.Template.QualifierLocData;
++      Template.TemplateNameLoc = RHS.Template.TemplateNameLoc;
++      Template.EllipsisLoc = RHS.Template.EllipsisLoc;
++      Expression = RHS.Expression;
++      Declarator = RHS.Declarator;
++    }
++    return *this;
++  }
++
+   TypeSourceInfo *getAsTypeSourceInfo() const {
+     return Declarator;
+   }
+# 1. RAII - Resource Acquisition Is Initialization.
+# 2. Allocate memory with suitable alignment for uint64_t.
+# 3. reinterpret_cast<> from void* to <type*>.
+--- tools/clang/lib/AST/TemplateBase.cpp	2015-01-08 16:58:16.000000000 -0800
++++ tools/clang/lib/AST/TemplateBase.cpp	2015-07-17 17:42:51.744142395 -0700
[email protected]@ -71,6 +71,7 @@
+ 
+ TemplateArgument::TemplateArgument(ASTContext &Ctx, const llvm::APSInt &Value,
+                                    QualType Type) {
++  (void) std::memset(Buffer, '\0', sizeof(Buffer));
+   Integer.Kind = Integral;
+   // Copy the APSInt value into our decomposed form.
+   Integer.BitWidth = Value.getBitWidth();
[email protected]@ -78,9 +79,9 @@
+   // If the value is large, we have to get additional memory from the ASTContext
+   unsigned NumWords = Value.getNumWords();
+   if (NumWords > 1) {
+-    void *Mem = Ctx.Allocate(NumWords * sizeof(uint64_t));
+-    std::memcpy(Mem, Value.getRawData(), NumWords * sizeof(uint64_t));
+-    Integer.pVal = static_cast<uint64_t *>(Mem);
++    void *Mem = Ctx.Allocate(NumWords * sizeof(uint64_t), alignof(uint64_t));
++    (void) std::memcpy(Mem, Value.getRawData(), NumWords * sizeof(uint64_t));
++    Integer.pVal = reinterpret_cast<uint64_t *>(Mem);
+   } else {
+     Integer.VAL = Value.getZExtValue();
+   }
[email protected]@ -422,7 +423,9 @@
+ //===----------------------------------------------------------------------===//
+ 
+ TemplateArgumentLocInfo::TemplateArgumentLocInfo() {
+-  memset((void*)this, 0, sizeof(TemplateArgumentLocInfo));
++  (void) std::memset(Buffer, 0, sizeof(Buffer));
++  Expression = nullptr;
++  Declarator = nullptr;
+ }
+ 
+ SourceRange TemplateArgumentLoc::getSourceRange() const {
+# 1. Pointer Arithmetic Paranoia.
+--- tools/clang/lib/AST/Type.cpp	2014-12-28 01:18:54.000000000 -0800
++++ tools/clang/lib/AST/Type.cpp	2015-07-17 17:43:57.848813992 -0700
[email protected]@ -1464,7 +1464,10 @@
+     if (Args[I].containsUnexpandedParameterPack())
+       setContainsUnexpandedParameterPack();
+ 
+-    new (&getArgBuffer()[I]) TemplateArgument(Args[I]);
++    TemplateArgument *TA = getArgBuffer();
++    TA = &(TA[I]);
++    TA = new (TA) TemplateArgument();
++    *TA = Args[I];
+   }
+ }
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/008-DeclTemplate.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,26 @@
+# 1. Write copy-constructor and assignment operator.
+# https://llvm.org/bugs/show_bug.cgi?id=24608
+--- tools/clang/include/clang/AST/DeclTemplate.h	2015-07-17 16:43:46.485713092 -0700
++++ tools/clang/include/clang/AST/DeclTemplate.h	2015-07-17 17:55:26.681560803 -0700
[email protected]@ -485,6 +485,21 @@
+                                  const UnresolvedSetImpl &Templates,
+                                  const TemplateArgumentListInfo &TemplateArgs);
+ 
++  DependentFunctionTemplateSpecializationInfo(
++            const DependentFunctionTemplateSpecializationInfo &RHS) 
++  : NumTemplates(RHS.NumTemplates), NumArgs(RHS.NumArgs),
++  AngleLocs(RHS.AngleLocs) { }
++
++  DependentFunctionTemplateSpecializationInfo
++  &operator=(const DependentFunctionTemplateSpecializationInfo &RHS) {
++    if (this != &RHS) {
++      NumTemplates = RHS.NumTemplates;
++      NumArgs = RHS.NumArgs;
++      AngleLocs = RHS.AngleLocs;
++    }
++    return *this;
++  }
++
+   /// \brief Returns the number of function templates that this might
+   /// be a specialization of.
+   unsigned getNumTemplates() const { return NumTemplates; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/009-InitPreprocessor.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,69 @@
+# The anonymous std::string temporary created by getClangFullRepositoryVersion
+# goes out-of-scope in C++11 because COW std::string is not allowed.
+# I.e. the std::string buffer of the anonymous temporary goes out of scope.
+# Because of this, the buffer referenced by the underlying StringRef in
+# llvm::Twine is invalid as soon as the std::string temporary expires.
+# The tagged clang version string must be created as a data segment global
+# constant via macro, just like all the other clang version macro identifiers.
+# https://llvm.org/bugs/show_bug.cgi?id=24684
+--- tools/clang/include/clang/Basic/Version.inc.in	2010-06-25 13:33:46.000000000 -0400
++++ tools/clang/include/clang/Basic/Version.inc.in	2015-07-05 14:20:27.771128865 -0400
[email protected]@ -4,3 +4,4 @@
+ #if @[email protected]
+ #define CLANG_VERSION_PATCHLEVEL @[email protected]
+ #endif
++#define CLANG_VERSION_TAGGED_STRING @[email protected]
+--- tools/clang/include/clang/Basic/Makefile	2014-03-31 09:14:44.000000000 -0400
++++ tools/clang/include/clang/Basic/Makefile	2015-07-05 14:19:58.972485543 -0400
[email protected]@ -16,8 +16,18 @@
+ 
+ INPUT_TDS = $(wildcard $(PROJ_SRC_DIR)/Diagnostic*.td)
+ 
++SVN_OR_RC :=
++
+ # Compute the Clang version from the LLVM version, unless specified explicitly.
+ ifndef CLANG_VERSION
++ifeq ($(LLVMVersion), $(findstring svn, $(LLVMVersion)), svn)
++  SVN_OR_RC := "svn"
++endif
++
++ifeq ($(LLVMVersion), $(findstring rc, $(LLVMVersion)), rc)
++  SVN_OR_RC := "rc"
++endif
++
+ CLANG_VERSION := $(subst svn,,$(LLVMVersion))
+ CLANG_VERSION := $(subst rc,,$(CLANG_VERSION))
+ endif
[email protected]@ -26,6 +36,14 @@
+ CLANG_VERSION_MAJOR := $(word 1,$(CLANG_VERSION_COMPONENTS))
+ CLANG_VERSION_MINOR := $(word 2,$(CLANG_VERSION_COMPONENTS))
+ CLANG_VERSION_PATCHLEVEL := $(word 3,$(CLANG_VERSION_COMPONENTS))
++CLANG_VERSION_TAGGED_STRING :=
++
++ifeq ($(SVN_OR_RC),)
++CLANG_VERSION_TAGGED_STRING := "\"\(tags/RELEASE_$(CLANG_VERSION_MAJOR)$(CLANG_VERSION_MINOR)$(CLANG_VERSION_PATCHLEVEL)/final\)\""
++else
++CLANG_VERSION_TAGGED_STRING := "\"\(tags/RELEASE_$(CLANG_VERSION_MAJOR)$(CLANG_VERSION_MINOR)$(CLANG_VERSION_PATCHLEVEL)/$(SVN_OR_RC)\)\""
++endif
++
+ ifeq ($(CLANG_VERSION_PATCHLEVEL),)
+ CLANG_HAS_VERSION_PATCHLEVEL := 0
+ else
[email protected]@ -67,4 +85,5 @@
+ 	           -e "s#@[email protected]#$(CLANG_VERSION_MINOR)#g" \
+ 	           -e "s#@[email protected]#$(CLANG_VERSION_PATCHLEVEL)#g" \
+ 	           -e "s#@[email protected]#$(CLANG_HAS_VERSION_PATCHLEVEL)#g" \
++	           -e "s#@[email protected]#$(CLANG_VERSION_TAGGED_STRING:' '='')#g" \
+ 	           $< > [email protected]
+--- tools/clang/lib/Frontend/InitPreprocessor.cpp	2015-04-27 04:12:42.000000000 -0400
++++ tools/clang/lib/Frontend/InitPreprocessor.cpp	2015-07-05 14:24:20.804334574 -0400
[email protected]@ -470,8 +470,7 @@
+   Builder.defineMacro("__clang_patchlevel__", "0");
+ #endif
+   Builder.defineMacro("__clang_version__", 
+-                      "\"" CLANG_VERSION_STRING " "
+-                      + getClangFullRepositoryVersion() + "\"");
++                      "\"" CLANG_VERSION_STRING " " CLANG_VERSION_TAGGED_STRING "\"");
+ #undef TOSTR
+ #undef TOSTR2
+   if (!LangOpts.MSVCCompat) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/010-linker-mapfiles.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,130 @@
+# 1. Enable the linker map files provided by clang/llvm for symbol
+# scope and visibility in shared libraries.
+# 2. We must use our own linker map file for compatibility with
+# the GNU linkers and GNU Binutils (libbfd).
+# Solaris autoconf-based build.
+# https://llvm.org/bugs/show_bug.cgi?id=24641
+--- Makefile.rules	2015-07-17 19:12:32.515872699 -0700
++++ Makefile.rules	2015-07-17 19:17:40.294355307 -0700
[email protected]@ -643,6 +643,7 @@
+     endif
+     ifeq ($(HOST_OS), $(filter $(HOST_OS), SunOS))
+       LD.Flags += -Wl,-z -Wl,discard-unused=sections
++      LD.Flags += -Wl,-M -Wl,$(PROJ_SRC_ROOT)/mapfiles/map.gnu-sections
+     endif
+   endif
+ endif
[email protected]@ -655,6 +656,10 @@
+   ifneq ($(HOST_OS), Darwin)
+     ifdef TOOLNAME
+       LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
++      ifeq ($(HOST_OS), $(filter $(HOST_OS), SunOS))
++        LD.Flags += -Wl,-z -Wl,discard-unused=sections
++        LD.Flags += -Wl,-M -Wl,$(PROJ_SRC_ROOT)/mapfiles/map.gnu-sections
++      endif
+     endif
+   else
+     ifneq ($(DARWIN_MAJVERS),4)
[email protected]@ -1122,11 +1127,26 @@
+ clean-local::
+ 	-$(Verb) $(RM) -f $(NativeExportsFile)
+ else
++ifeq ($(HOST_OS), $(filter $(HOST_OS), SunOS))
++# Solaris ld requires a version script rather than a plain list.
++NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
++$(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
++	$(Verb) echo "{" > [email protected]
++	$(Verb) grep -q '[[:alnum:]_]' $< && echo "  global:" >> [email protected] || :
++	$(Verb) sed -e 's/$$/;/' -e 's/^/    /' < $< >> [email protected]
++ifneq ($(HOST_OS),OpenBSD)
++	$(Verb) echo "  local: *;" >> [email protected]
++endif
++	$(Verb) echo "};" >> [email protected]
++clean-local::
++	-$(Verb) $(RM) -f $(NativeExportsFile)
++else
+ # Default behavior: just use the exports file verbatim.
+ NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
+ endif
+ endif
+ endif
++endif
+ 
+ # Now add the linker command-line options to use the native export file.
+ 
[email protected]@ -1146,6 +1166,11 @@
+ SharedLinkOptions += $(NativeExportsFile)
+ endif
+ 
++# Solaris
++ifeq ($(HOST_OS), $(filter $(HOST_OS), SunOS))
++LLVMLibsOptions += -Wl,-M -Wl,$(NativeExportsFile)
++endif
++
+ endif
+ 
+ ###############################################################################
+--- /dev/null	2015-07-08 19:15:05.000000000 -0700
++++ mapfiles/map.gnu-sections	2015-07-08 19:13:41.905920797 -0700
[email protected]@ -0,0 +1,61 @@
++$mapfile_version 2
++
++# Emulate the rules used by the GNU ld and gold linkers for merging input
++# sections into output sections in executables and shared objects. From
++# Ian Lance Taylor and Cary Coutant.
++
++# gcc 4.3 generates the following sorts of section names when it
++# needs a section name specific to a function:
++#   .text.FN
++#   .rodata.FN
++#   .sdata2.FN
++#   .data.FN
++#   .data.rel.FN
++#   .data.rel.local.FN
++#   .data.rel.ro.FN
++#   .data.rel.ro.local.FN
++#   .sdata.FN
++#   .bss.FN
++#   .sbss.FN
++#   .tdata.FN
++#   .tbss.FN
++#
++# The GNU linker maps all of those to the part before the .FN,
++# except that .data.rel.local.FN is mapped to .data, and
++# .data.rel.ro.local.FN is mapped to .data.rel.ro.  The sections
++# beginning with .data.rel.ro.local are grouped together.
++#
++# For an anonymous namespace, the string FN can contain a '.'.
++#
++# Also of interest: .rodata.strN.N, .rodata.cstN, both of which the
++# GNU linker maps to .rodata.
++
++$if _ET_DYN || _ET_EXEC
++
++LOAD_SEGMENT text {
++	ASSIGN_SECTION {
++		IS_NAME = MATCH(g/.data.rel.local.*/);
++		FLAGS = ALLOC !WRITE;
++		OUTPUT_SECTION { NAME = .data };
++	};
++	ASSIGN_SECTION {
++		IS_NAME = MATCH(r/^\.(text|rodata|sdata2|data\.rel\.ro|data\.rel|data|sdata|bss|sbss|tdata|tbss)\./);
++		FLAGS = ALLOC !WRITE;
++		OUTPUT_SECTION { NAME = MATCHREF(/.${n1}/) };
++	};
++};
++
++LOAD_SEGMENT data {
++	ASSIGN_SECTION {
++		IS_NAME = MATCH(g/.data.rel.local.*/);
++		FLAGS = ALLOC WRITE;
++		OUTPUT_SECTION { NAME = .data };
++	};
++	ASSIGN_SECTION {
++		IS_NAME = MATCH(r/^\.(text|rodata|sdata2|data\.rel\.ro|data\.rel|data|sdata|bss|sbss|tdata|tbss)\./);
++		FLAGS = ALLOC WRITE;
++		OUTPUT_SECTION { NAME = MATCHREF(/.${n1}/) };
++	};
++};
++
++$endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/011-gxx-abi-version.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,85 @@
+# Add an implementation for -fabi-version=<N> in clang.
+# This is useful and required for testing the GNU C++
+# Standard Library for GCC >= 5.0.
+# https://llvm.org/bugs/show_bug.cgi?id=24685
+--- tools/clang/include/clang/Basic/LangOptions.def	2014-12-03 16:53:36.000000000 -0500
++++ tools/clang/include/clang/Basic/LangOptions.def	2015-07-11 11:35:34.710878157 -0400
[email protected]@ -134,6 +134,8 @@
+               "default struct packing maximum alignment")
+ VALUE_LANGOPT(MaxTypeAlign  , 32, 0,
+               "default maximum alignment for types")
++VALUE_LANGOPT(GXXABIVersion , 32, 0,
++              "Use specified GNU C++ Standard Library ABI version")
+ VALUE_LANGOPT(PICLevel    , 2, 0, "__PIC__ level")
+ VALUE_LANGOPT(PIELevel    , 2, 0, "__PIE__ level")
+ LANGOPT(GNUInline         , 1, 0, "GNU inline semantics")
+--- tools/clang/lib/Frontend/InitPreprocessor.cpp	2015-09-01 06:51:55.849518525 -0700
++++ tools/clang/lib/Frontend/InitPreprocessor.cpp	2015-09-02 13:53:24.781943196 -0700
[email protected]@ -479,7 +479,31 @@
+     Builder.defineMacro("__GNUC_MINOR__", "2");
+     Builder.defineMacro("__GNUC_PATCHLEVEL__", "1");
+     Builder.defineMacro("__GNUC__", "4");
++    // GCC provides a number of C++ ABI Versions in:
++    // ${top_srcdir}/gcc/c-family/c-cppbuiltin.c
++    // Currently valid GXX ABI Versions are documented here:
++    // https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html
++    // clang only supports a subset.
++    switch (LangOpts.GXXABIVersion) {
++    default:
+     Builder.defineMacro("__GXX_ABI_VERSION", "1002");
++      break;
++    case 4:
++      Builder.defineMacro("__GXX_ABI_VERSION", "1004");
++      break;
++    case 5:
++      Builder.defineMacro("__GXX_ABI_VERSION", "1005");
++      break;
++    case 6:
++      Builder.defineMacro("__GXX_ABI_VERSION", "1006");
++      break;
++    case 7:
++      Builder.defineMacro("__GXX_ABI_VERSION", "1007");
++      break;
++    case 8:
++      Builder.defineMacro("__GXX_ABI_VERSION", "1008");
++      break;
++    }
+   }
+ 
+   // Define macros for the C11 / C++11 memory orderings
+--- tools/clang/lib/Frontend/CompilerInvocation.cpp	2015-05-04 14:23:43.000000000 -0400
++++ tools/clang/lib/Frontend/CompilerInvocation.cpp	2015-07-11 15:40:20.580031428 -0400
[email protected]@ -1539,6 +1539,7 @@
+   Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls);
+   Opts.PackStruct = getLastArgIntValue(Args, OPT_fpack_struct_EQ, 0, Diags);
+   Opts.MaxTypeAlign = getLastArgIntValue(Args, OPT_fmax_type_align_EQ, 0, Diags);
++  Opts.GXXABIVersion = getLastArgIntValue(Args, OPT_fabi_version_EQ, 0, Diags);
+   Opts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags);
+   Opts.PIELevel = getLastArgIntValue(Args, OPT_pie_level, 0, Diags);
+   Opts.Static = Args.hasArg(OPT_static_define);
+--- tools/clang/include/clang/Driver/Options.td	2015-01-26 18:17:18.000000000 -0500
++++ tools/clang/include/clang/Driver/Options.td	2015-07-11 15:44:39.660620608 -0400
[email protected]@ -574,6 +574,8 @@
+ def ffp_contract : Joined<["-"], "ffp-contract=">, Group<f_Group>,
+   Flags<[CC1Option]>, HelpText<"Form fused FP ops (e.g. FMAs): fast (everywhere)"
+   " | on (according to FP_CONTRACT pragma, default) | off (never fuse)">;
++def fabi_version_EQ : Joined<["-"], "fabi-version=">, Group<f_Group>,
++  Flags<[CC1Option]>, HelpText<"Use specified GNU C++ ABI version">;
+ 
+ def ffor_scope : Flag<["-"], "ffor-scope">, Group<f_Group>;
+ def fno_for_scope : Flag<["-"], "fno-for-scope">, Group<f_Group>;
+--- tools/clang/lib/Driver/Tools.cpp	2015-02-03 17:57:34.000000000 -0500
++++ tools/clang/lib/Driver/Tools.cpp	2015-07-11 23:36:17.198486944 -0400
[email protected]@ -2812,6 +2812,12 @@
+     CmdArgs.push_back(A->getValue());
+   }
+ 
++  if (Arg *A = Args.getLastArg(options::OPT_fabi_version_EQ)) {
++    StringRef v = A->getValue();
++    CmdArgs.push_back(Args.MakeArgString("-fabi-version=" + v));
++    A->claim();
++  }
++
+   if (Arg *A = Args.getLastArg(options::OPT_fpcc_struct_return,
+                                options::OPT_freg_struct_return)) {
+     if (getToolChain().getArch() != llvm::Triple::x86) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/012-TypeLocBuilder.cpp.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,73 @@
+# https://llvm.org/bugs/show_bug.cgi?id=24615
+--- tools/clang/lib/Sema/TypeLocBuilder.h	2014-08-13 09:25:19.000000000 -0700
++++ tools/clang/lib/Sema/TypeLocBuilder.h	2015-08-28 16:45:41.733661825 -0700
[email protected]@ -39,7 +39,7 @@
+ #endif
+     
+   /// The inline buffer.
+-  enum { BufferMaxAlignment = llvm::AlignOf<void*>::Alignment };
++  enum { BufferMaxAlignment = llvm::AlignOf<uint64_t>::Alignment };
+   llvm::AlignedCharArray<BufferMaxAlignment, InlineCapacity> InlineBuffer;
+   unsigned NumBytesAtAlign4, NumBytesAtAlign8;
+ 
[email protected]@ -52,7 +52,7 @@
+ 
+   ~TypeLocBuilder() {
+     if (Buffer != InlineBuffer.buffer)
+-      delete[] Buffer;
++      std::free(Buffer);
+   }
+ 
+   /// Ensures that this buffer has at least as much capacity as described.
+--- tools/clang/lib/Sema/TypeLocBuilder.cpp	2014-05-25 23:22:03.000000000 -0700
++++ tools/clang/lib/Sema/TypeLocBuilder.cpp	2015-08-25 18:53:43.000000000 -0700
[email protected]@ -13,6 +13,8 @@
+ //===----------------------------------------------------------------------===//
+ 
+ #include "TypeLocBuilder.h"
++#include <cstring>
++#include <stdlib.h>
+ 
+ using namespace clang;
+ 
[email protected]@ -46,14 +48,36 @@
+   assert(NewCapacity > Capacity);
+ 
+   // Allocate the new buffer and copy the old data into it.
+-  char *NewBuffer = new char[NewCapacity];
++  char *NewBuffer;
++
++#if defined(_MSC_VER)
++  NewBuffer = _aligned_malloc(NewCapacity, (size_t) BufferMaxAlignment);
++  assert(NewBuffer && "_aligned_malloc failed!");
++  if (!NewBuffer) {
++    llvm::errs() << __PRETTY_FUNCTION__ << ": _aligned_malloc failed!\n";
++    abort();
++  }
++#else
++  int R = posix_memalign((void**) &NewBuffer,
++                         (size_t) BufferMaxAlignment, NewCapacity);
++  assert((R == 0) && "posix_memalign failed!");
++  assert(NewBuffer && "posix_memalign failed!");
++  if ((R != 0) || (!NewBuffer)) {
++    llvm::errs() << __PRETTY_FUNCTION__ << ": posix_memalign failed!\n";
++    abort();
++  }
++#endif
++
++  (void) std::memset(NewBuffer, 0, NewCapacity);
++
+   unsigned NewIndex = Index + NewCapacity - Capacity;
+-  memcpy(&NewBuffer[NewIndex],
++  (void) std::memcpy(&NewBuffer[NewIndex],
+          &Buffer[Index],
+          Capacity - Index);
+ 
+-  if (Buffer != InlineBuffer.buffer)
+-    delete[] Buffer;
++  if (Buffer != InlineBuffer.buffer) {
++    std::free(Buffer);
++  }
+ 
+   Buffer = NewBuffer;
+   Capacity = NewCapacity;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/013-llvm-alignments.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,127 @@
+# http://reviews.llvm.org/D10271
+# Backported to 3.6.2.
+--- include/llvm/IR/DerivedTypes.h	2014-11-21 14:03:35.000000000 -0500
++++ include/llvm/IR/DerivedTypes.h	2015-08-23 17:27:29.355504909 -0400
[email protected]@ -140,7 +140,8 @@
+     return T->getTypeID() == FunctionTyID;
+   }
+ };
+-
++static_assert(AlignOf<FunctionType>::Alignment >= AlignOf<Type *>::Alignment,
++              "Insufficient alignment for objects appended to FunctionType");
+ 
+ /// CompositeType - Common super class of ArrayType, StructType, PointerType
+ /// and VectorType.
+--- include/llvm/IR/User.h	2014-10-15 16:39:05.000000000 -0400
++++ include/llvm/IR/User.h	2015-08-23 17:27:29.365505148 -0400
[email protected]@ -22,6 +22,7 @@
+ #include "llvm/ADT/iterator.h"
+ #include "llvm/ADT/iterator_range.h"
+ #include "llvm/IR/Value.h"
++#include "llvm/Support/AlignOf.h"
+ #include "llvm/Support/ErrorHandling.h"
+ 
+ namespace llvm {
[email protected]@ -172,6 +173,11 @@
+     return isa<Instruction>(V) || isa<Constant>(V);
+   }
+ };
++// Either Use objects, or a Use pointer can be prepended to User.
++static_assert(AlignOf<Use>::Alignment >= AlignOf<User>::Alignment,
++              "Insufficient alignment after objects prepended to User");
++static_assert(AlignOf<Use *>::Alignment >= AlignOf<User>::Alignment,
++              "Insufficient alignment after objects prepended to User");
+ 
+ template<> struct simplify_type<User::op_iterator> {
+   typedef Value* SimpleType;
+--- include/llvm/Support/AlignOf.h	2014-01-08 22:28:55.000000000 -0500
++++ include/llvm/Support/AlignOf.h	2015-08-23 17:27:29.365505148 -0400
[email protected]@ -36,9 +36,18 @@
+ ///  compile-time constant (e.g., for template instantiation).
+ template <typename T>
+ struct AlignOf {
++#ifndef _MSC_VER
++  // Avoid warnings from GCC like:
++  //   comparison between 'enum llvm::AlignOf<X>::<anonymous>' and 'enum
++  //   llvm::AlignOf<Y>::<anonymous>' [-Wenum-compare]
++  // by using constexpr instead of enum.
++  // (except on MSVC, since it doesn't support constexpr yet).
++  static constexpr unsigned Alignment =
++      static_cast<unsigned int>(sizeof(AlignmentCalcImpl<T>) - sizeof(T));
++#else
+   enum { Alignment =
+          static_cast<unsigned int>(sizeof(AlignmentCalcImpl<T>) - sizeof(T)) };
+-
++#endif
+   enum { Alignment_GreaterEqual_2Bytes = Alignment >= 2 ? 1 : 0 };
+   enum { Alignment_GreaterEqual_4Bytes = Alignment >= 4 ? 1 : 0 };
+   enum { Alignment_GreaterEqual_8Bytes = Alignment >= 8 ? 1 : 0 };
[email protected]@ -50,6 +59,10 @@
+   enum { Alignment_LessEqual_16Bytes = Alignment <= 16 ? 1 : 0 };
+ };
+ 
++#ifndef _MSC_VER
++template <typename T> constexpr unsigned AlignOf<T>::Alignment;
++#endif
++
+ /// alignOf - A templated function that returns the minimum alignment of
+ ///  of a type.  This provides no extra functionality beyond the AlignOf
+ ///  class besides some cosmetic cleanliness.  Example usage:
+--- lib/IR/AttributeImpl.h	2014-08-13 12:26:38.000000000 -0400
++++ lib/IR/AttributeImpl.h	2015-08-23 17:27:29.366505172 -0400
[email protected]@ -180,6 +180,9 @@
+       AttrList[I].Profile(ID);
+   }
+ };
++static_assert(AlignOf<AttributeSetNode>::Alignment >=
++                  AlignOf<Attribute>::Alignment,
++              "Insufficient alignment for objects appended to AttributeSetNode");
+ 
+ //===----------------------------------------------------------------------===//
+ /// \class
[email protected]@ -188,9 +191,11 @@
+ class AttributeSetImpl : public FoldingSetNode {
+   friend class AttributeSet;
+ 
+-  LLVMContext &Context;
+-
++public:
+   typedef std::pair<unsigned, AttributeSetNode*> IndexAttrPair;
++
++private:
++  LLVMContext &Context;
+   unsigned NumAttrs; ///< Number of entries in this set.
+ 
+   /// \brief Return a pointer to the IndexAttrPair for the specified slot.
[email protected]@ -205,6 +210,7 @@
+   AttributeSetImpl(LLVMContext &C,
+                    ArrayRef<std::pair<unsigned, AttributeSetNode *> > Attrs)
+       : Context(C), NumAttrs(Attrs.size()) {
++
+ #ifndef NDEBUG
+     if (Attrs.size() >= 2) {
+       for (const std::pair<unsigned, AttributeSetNode *> *i = Attrs.begin() + 1,
[email protected]@ -266,6 +272,9 @@
+ 
+   void dump() const;
+ };
++static_assert(AlignOf<AttributeSetImpl>::Alignment >=
++                  AlignOf<AttributeSetImpl::IndexAttrPair>::Alignment,
++              "Insufficient alignment for objects appended to AttributeSetImpl");
+ 
+ } // end llvm namespace
+ 
+--- lib/IR/User.cpp	2015-08-23 17:27:29.366505172 -0400
++++ lib/IR/User.cpp	2015-08-23 17:34:56.427494589 -0400
[email protected]@ -40,6 +40,11 @@
+ //===----------------------------------------------------------------------===//
+ 
+ Use *User::allocHungoffUses(unsigned N) const {
++  static_assert(AlignOf<Use>::Alignment >= AlignOf<Use::UserRef>::Alignment,
++                "Insufficient alignment for hung-off-uses objects");
++  static_assert(AlignOf<Use::UserRef>::Alignment >=
++                AlignOf<BasicBlock*>::Alignment,
++                "Insufficient alignment for hung-off-uses objects");
+   // Allocate the array of Uses, followed by a pointer (with bottom bit set) to
+   // the User.
+   size_t size = N * sizeof(Use) + sizeof(Use::UserRef);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/014-clang-gcc-toolchain.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,2323 @@
+# Solaris GCC Toolchain discovery.
+# https://llvm.org/bugs/show_bug.cgi?id=24606
+--- lib/Support/Host.cpp	2014-12-16 19:38:04.000000000 -0800
++++ lib/Support/Host.cpp	2016-02-09 09:59:19.281147309 -0800
[email protected]@ -39,6 +39,11 @@
+ #include <mach/machine.h>
+ #endif
+ 
++#if defined(sun) || defined(__sun) || defined(__sun__)
++#include <cstring>
++#include <kstat.h>
++#endif
++
+ #define DEBUG_TYPE "host-detection"
+ 
+ //===----------------------------------------------------------------------===//
[email protected]@ -674,6 +679,43 @@
+   
+   return "generic";
+ }
++#elif ((defined(sun) || defined(__sun) || defined(__sun__)) && \
++       (defined(sparc) || defined(__sparc) || defined(__sparc__)))
++StringRef sys::getHostCPUName() {
++  kstat_ctl_t *KC = 0;
++  kstat_t *KSP = 0;
++  kstat_named_t *KNP = 0;
++  static char Buffer[256];
++  static bool Init = false;
++  const char *Value;
++
++  if (!Init) {
++    KC = kstat_open();
++    if (KC) {
++      KSP = kstat_lookup(KC, "cpu_info", -1, "cpu_info0");
++      kstat_read(KC, KSP, NULL);
++      KNP = reinterpret_cast<kstat_named_t*>(kstat_data_lookup(KSP, "brand"));
++      Value = (const char *) KNP->value.str.addr.ptr;
++      (void) std::sprintf(Buffer, "%s (", Value);
++
++      KNP =
++        reinterpret_cast<kstat_named_t*>(kstat_data_lookup(KSP, "cpu_type"));
++      Value = (const char*) KNP->value.c;
++      (void) std::strcat(Buffer, Value);
++      (void) std::strcat(Buffer, ") ");
++
++      KNP =
++        reinterpret_cast<kstat_named_t*>(kstat_data_lookup(KSP,
++                                                           "implementation"));
++      Value = (const char*) KNP->value.str.addr.ptr;
++      (void) std::strcat(Buffer, Value);
++      Init = true;
++      kstat_close(KC);
++    }
++  }
++
++  return Buffer;
++}
+ #else
+ StringRef sys::getHostCPUName() {
+   return "generic";
+--- tools/clang/include/clang/Driver/Options.td	Sat Jul 18 11:44:46 2015
++++ tools/clang/include/clang/Driver/Options.td	Thu Aug 20 22:46:37 2015
[email protected]@ -1129,6 +1129,11 @@
+ def mthread_model : Separate<["-"], "mthread-model">, Group<m_Group>, Flags<[CC1Option]>,
+   HelpText<"The thread model to use, e.g. posix, single (posix by default)">;
+ 
++def mvis : Flag<["-"], "mvis">, Group<m_Group>;
++def mvis2 : Flag<["-"], "mvis2">, Group<m_Group>;
++def mvis3 : Flag<["-"], "mvis3">, Group<m_Group>;
++def mimpure_text: Flag<["-"], "mimpure-text">, Group<m_Group>;
++
+ def mmmx : Flag<["-"], "mmmx">, Group<m_x86_Features_Group>;
+ def mno_3dnowa : Flag<["-"], "mno-3dnowa">, Group<m_x86_Features_Group>;
+ def mno_3dnow : Flag<["-"], "mno-3dnow">, Group<m_x86_Features_Group>;
[email protected]@ -1690,6 +1695,7 @@
+ defm profile_use : BooleanFFlag<"profile-use">, Group<clang_ignored_gcc_optimization_f_Group>;
+ def fprofile_use_EQ : Joined<["-"], "fprofile-use=">, Group<clang_ignored_gcc_optimization_f_Group>;
+ def fuse_ld_EQ : Joined<["-"], "fuse-ld=">, Group<f_Group>;
++def fuse_as_EQ : Joined<["-"], "fuse-as=">, Group<f_Group>;
+ 
+ defm align_functions : BooleanFFlag<"align-functions">, Group<clang_ignored_gcc_optimization_f_Group>;
+ def falign_functions_EQ : Joined<["-"], "falign-functions=">, Group<clang_ignored_gcc_optimization_f_Group>;
+--- tools/clang/lib/Frontend/InitHeaderSearch.cpp	Thu Dec  4 16:22:48 2014
++++ tools/clang/lib/Frontend/InitHeaderSearch.cpp	Fri Aug 21 23:23:27 2015
[email protected]@ -122,7 +122,7 @@
+   // Add the path with sysroot prepended, if desired and this is a system header
+   // group.
+   if (HasSysroot) {
+-    SmallString<256> MappedPathStorage;
++    SmallString<PATH_MAX> MappedPathStorage;
+     StringRef MappedPathStr = Path.toStringRef(MappedPathStorage);
+     if (CanPrefixSysroot(MappedPathStr)) {
+       AddUnmappedPath(IncludeSysroot + Path, Group, isFramework);
[email protected]@ -138,7 +138,7 @@
+   assert(!Path.isTriviallyEmpty() && "can't handle empty path here");
+ 
+   FileManager &FM = Headers.getFileMgr();
+-  SmallString<256> MappedPathStorage;
++  SmallString<PATH_MAX> MappedPathStorage;
+   StringRef MappedPathStr = Path.toStringRef(MappedPathStorage);
+ 
+   // Compute the DirectoryLookup type.
[email protected]@ -187,12 +187,16 @@
+ 
+   // Add the multilib dirs
+   llvm::Triple::ArchType arch = triple.getArch();
+-  bool is64bit = arch == llvm::Triple::ppc64 || arch == llvm::Triple::x86_64;
++  bool is64bit = arch == llvm::Triple::ppc64 || arch == llvm::Triple::x86_64 ||
++    arch == llvm::Triple::sparcv9;
+   if (is64bit)
+     AddPath(Base + "/" + ArchDir + "/" + Dir64, CXXSystem, false);
+   else
+     AddPath(Base + "/" + ArchDir + "/" + Dir32, CXXSystem, false);
+ 
++  // Add GCC's "C" include dir
++  AddPath(Base + "/include", CXXSystem, false);
++
+   // Add the backward dir
+   AddPath(Base + "/backward", CXXSystem, false);
+ }
[email protected]@ -442,8 +446,7 @@
+                                 "", "", "", triple);
+     break;
+   case llvm::Triple::Solaris:
+-    AddGnuCPlusPlusIncludePaths("/usr/gcc/4.5/include/c++/4.5.2/",
+-                                "i386-pc-solaris2.11", "", "", triple);
++    // All of this is handled in the driver.
+     break;
+   default:
+     break;
[email protected]@ -462,6 +465,7 @@
+     break; // Everything else continues to use this routine's logic.
+ 
+   case llvm::Triple::Linux:
++  case llvm::Triple::Solaris:
+     return;
+ 
+   case llvm::Triple::Win32:
[email protected]@ -484,7 +488,7 @@
+           // Remove clang from foo/lib/clang
+           StringRef Lib = llvm::sys::path::parent_path(NoVer);
+           // Remove lib from foo/lib
+-          SmallString<128> P = llvm::sys::path::parent_path(Lib);
++          SmallString<PATH_MAX> P = llvm::sys::path::parent_path(Lib);
+ 
+           // Get foo/include/c++/v1
+           llvm::sys::path::append(P, "include", "c++", "v1");
[email protected]@ -491,10 +495,6 @@
+           AddUnmappedPath(P.str(), CXXSystem, false);
+         }
+       }
+-      // On Solaris, include the support directory for things like xlocale and
+-      // fudged system headers.
+-      if (triple.getOS() == llvm::Triple::Solaris) 
+-        AddPath("/usr/include/c++/v1/support/solaris", CXXSystem, false);
+       
+       AddPath("/usr/include/c++/v1", CXXSystem, false);
+     } else {
+--- tools/clang/lib/Driver/Tools.h	Wed Jan 28 15:52:21 2015
++++ tools/clang/lib/Driver/Tools.h	Thu Aug 20 22:46:37 2015
[email protected]@ -529,6 +529,9 @@
+ 
+     bool hasIntegratedCPP() const override { return false; }
+ 
++    void RenderExtraToolArgs(const JobAction &JA,
++                             ArgStringList &CmdArgs) const;
++
+     void ConstructJob(Compilation &C, const JobAction &JA,
+                       const InputInfo &Output, const InputInfoList &Inputs,
+                       const llvm::opt::ArgList &TCArgs,
[email protected]@ -541,6 +544,9 @@
+     bool hasIntegratedCPP() const override { return false; }
+     bool isLinkJob() const override { return true; }
+ 
++    void RenderExtraToolArgs(const JobAction &JA,
++                             ArgStringList &CmdArgs) const;
++
+     void ConstructJob(Compilation &C, const JobAction &JA,
+                       const InputInfo &Output, const InputInfoList &Inputs,
+                       const llvm::opt::ArgList &TCArgs,
+--- tools/clang/lib/Driver/Tools.cpp	Sat Jul 18 11:44:46 2015
++++ tools/clang/lib/Driver/Tools.cpp	Sat Aug 22 17:26:16 2015
[email protected]@ -60,6 +60,12 @@
+   }
+ }
+ 
++static void AddLibgcc(const llvm::Triple &Triple, const Driver &D,
++                      ArgStringList &CmdArgs, const ArgList &Args);
++
++static void AddLibgcc(const Driver &D, ArgStringList &CmdArgs,
++                       const ArgList &Args, const std::string& Exec);
++
+ /// CheckPreprocessingOptions - Perform some validation of preprocessing
+ /// arguments that is shared with gcc.
+ static void CheckPreprocessingOptions(const Driver &D, const ArgList &Args) {
[email protected]@ -1360,14 +1366,30 @@
+   return "";
+ }
+ 
++static const char *getSparcTargetCPU(const ArgList &Args,
++                                     const llvm::Triple &Triple);
++
++static const char *getSparcTargetCPUFeature(const char* CPU,
++                                            const ArgList &Args,
++                                            const llvm::Triple &Triple);
++
+ static void getSparcTargetFeatures(const ArgList &Args,
+-                                   std::vector<const char *> &Features) {
+-  bool SoftFloatABI = true;
++                                   std::vector<const char *> &Features,
++                                   const llvm::Triple &Triple) {
++  bool SoftFloatABI;
++
++  if ((Triple.getOS() == llvm::Triple::Solaris) ||
++      (Triple.getOS() == llvm::Triple::Linux))
++    SoftFloatABI = false;
++  else
++    SoftFloatABI = true;
++
+   if (Arg *A =
+           Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float)) {
+     if (A->getOption().matches(options::OPT_mhard_float))
+       SoftFloatABI = false;
+   }
++
+   if (SoftFloatABI)
+     Features.push_back("+soft-float");
+ }
[email protected]@ -1375,17 +1397,31 @@
+ void Clang::AddSparcTargetArgs(const ArgList &Args,
+                              ArgStringList &CmdArgs) const {
+   const Driver &D = getToolChain().getDriver();
++  const llvm::Triple &T = getToolChain().getTriple();
+ 
+   // Select the float ABI as determined by -msoft-float and -mhard-float.
++  // There is no support for soft-float ABI in Solaris.
+   StringRef FloatABI;
+   if (Arg *A = Args.getLastArg(options::OPT_msoft_float,
+                                options::OPT_mhard_float)) {
+-    if (A->getOption().matches(options::OPT_msoft_float))
++    if (A->getOption().matches(options::OPT_msoft_float)) {
++      if ((T.getOS() == llvm::Triple::Solaris) ||
++          (T.getOS() == llvm::Triple::Linux)) {
++        D.Diag(diag::warn_drv_clang_unsupported) << "-msoft-float";
++        D.Diag(diag::warn_drv_overriding_flag_option) <<
++          "-msoft-float" << "-mhard-float";
++        FloatABI = "hard";
++      } else {
+       FloatABI = "soft";
+-    else if (A->getOption().matches(options::OPT_mhard_float))
++      }
++    } else if (A->getOption().matches(options::OPT_mhard_float))
+       FloatABI = "hard";
+   }
+ 
++  if (((T.getOS() == llvm::Triple::Solaris) ||
++       (T.getOS() == llvm::Triple::Linux)) && FloatABI.empty())
++    FloatABI = "hard";
++
+   // If unspecified, choose the default based on the platform.
+   if (FloatABI.empty()) {
+     // Assume "soft", but warn the user we are guessing.
[email protected]@ -1400,10 +1436,93 @@
+     CmdArgs.push_back("-msoft-float");
+   } else {
+     assert(FloatABI == "hard" && "Invalid float abi!");
+-    CmdArgs.push_back("-mhard-float");
+   }
++
++  std::string Feature;
++  if (Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
++    Feature = "-march=";
++    Feature += A->getValue();
++    CmdArgs.push_back(Args.MakeArgString("-target-feature"));
++    CmdArgs.push_back(Args.MakeArgString(Feature.c_str()));
+ }
+ 
++  if (Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) {
++    Feature = "-mtune=";
++    Feature += A->getValue();
++    CmdArgs.push_back(Args.MakeArgString("-target-feature"));
++    CmdArgs.push_back(Args.MakeArgString(Feature.c_str()));
++  }
++
++  if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
++    Feature = "-mcpu=";
++    Feature += A->getValue();
++    CmdArgs.push_back(Args.MakeArgString("-target-feature"));
++    CmdArgs.push_back(Args.MakeArgString(Feature.c_str()));
++  }
++}
++
++static const char *getSparcTargetCPU(const ArgList &Args,
++                                     const llvm::Triple &Triple) {
++    StringRef V;
++
++    if (Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
++      V = A->getValue();
++      switch (Triple.getOS()) {
++      case llvm::Triple::Solaris:
++      case llvm::Triple::Linux:
++        if (V == "v8plus" || V == "v8plusa" ||
++            V == "v8plusb" || V == "v9" ||
++            V == "v9a" || V == "v9b" ||
++            V == "sparcmaf" || V == "sparc4" )
++          return Args.MakeArgString(V);
++        break;
++      default:
++        return Args.MakeArgString("v8plusa");
++        break;
++      }
++    }
++
++    if (Arg *AA = Args.getLastArg(options::OPT_m64))
++      return "v9a";
++
++    return "v8plusa";
++}
++
++static const char *getSparcTargetCPUFeature(const char* CPU,
++                                            const ArgList &Args,
++                                            const llvm::Triple &Triple) {
++  StringRef V;
++  if (Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) {
++    V = A->getValue();
++
++    if (V.empty())
++      if (Arg *AA = Args.getLastArg(options::OPT_m64))
++        return "vis";
++
++    if (V == "ultrasparc" || V == "ultrasparc2" ||
++        V == "ultrasparc3" || V == "sparcmaf" || V == "sparc4" )
++      return Args.MakeArgString(A->getValue());
++  }
++
++  if (!CPU)
++    return 0;
++
++  std::string C = CPU;
++
++  if (C == "v8plus" || C == "v9")
++    return "";
++
++  if (C == "v8plusa" || C == "v9a")
++    return "vis1";
++  else if (C == "v8plusb" || C == "v9b")
++    return "vis2";
++  else if (C == "sparcmaf" || C == "sparc4")
++    return "vis3";
++
++  return 0;
++}
++
++
+ static const char *getSystemZTargetCPU(const ArgList &Args) {
+   if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
+     return A->getValue();
[email protected]@ -1872,7 +1991,7 @@
+     break;
+   case llvm::Triple::sparc:
+   case llvm::Triple::sparcv9:
+-    getSparcTargetFeatures(Args, Features);
++    getSparcTargetFeatures(Args, Features, Triple);
+     break;
+   case llvm::Triple::aarch64:
+   case llvm::Triple::aarch64_be:
[email protected]@ -2695,6 +2814,23 @@
+     }
+   }
+ 
++  // Solaris-specific defaults for PIE
++  if (getToolChain().getTriple().getOS() == llvm::Triple::Solaris) {
++    switch (getToolChain().getTriple().getArch()) {
++    case llvm::Triple::x86:
++      IsPICLevelTwo = false; // "-fpie"
++      break;
++    case llvm::Triple::sparc:
++    case llvm::Triple::x86_64:
++    case llvm::Triple::sparcv9:
++      IsPICLevelTwo = true; // "-fPIE"
++      break;
++
++    default:
++      break;
++    }
++  }
++
+   // For the PIC and PIE flag options, this logic is different from the
+   // legacy logic in very old versions of GCC, as that logic was just
+   // a bug no one had ever fixed. This logic is both more rational and
[email protected]@ -2740,6 +2876,47 @@
+   if (Args.hasArg(options::OPT_static))
+     PIC = PIE = false;
+ 
++  if (Triple.getOS() == llvm::Triple::Solaris) {
++    if (Arg *A = Args.getLastArg(options::OPT_shared)) {
++      PIC = true;
++      PIE = false;
++      CmdArgs.push_back("-mrelocation-model");
++      CmdArgs.push_back("pic");
++      if (IsPICLevelTwo) {
++        CmdArgs.push_back("-pic-level");
++        CmdArgs.push_back("2");
++      }
++    } else if (PIC) {
++      PIC = true;
++      PIE = false;
++      CmdArgs.push_back("-mrelocation-model");
++      CmdArgs.push_back("pic");
++      if (IsPICLevelTwo) {
++        CmdArgs.push_back("-pic-level");
++        CmdArgs.push_back("2");
++      }
++    } else if (PIE) {
++      PIC = PIE = true;
++      CmdArgs.push_back("-mrelocation-model");
++      CmdArgs.push_back("pic");
++      if (IsPICLevelTwo) {
++        CmdArgs.push_back("-pie-level");
++        CmdArgs.push_back("2");
++      }
++    } else if (Args.hasArg(options::OPT_static)) {
++      // Solaris doesn't to static relocations.
++      PIC = PIE = false;
++      CmdArgs.push_back("-mrelocation-model");
++      CmdArgs.push_back("dynamic-no-pic");
++    } else {
++      // This is a Solaris non-PIE executable.
++      // Solaris doesn't to static relocations.
++      PIC = PIE = false;
++      CmdArgs.push_back("-mrelocation-model");
++      CmdArgs.push_back("dynamic-no-pic");
++    }
++  }
++
+   if (Arg *A = Args.getLastArg(options::OPT_mdynamic_no_pic)) {
+     // This is a very special mode. It trumps the other modes, almost no one
+     // uses it, and it isn't even valid on any OS but Darwin.
[email protected]@ -2762,6 +2939,8 @@
+   } else {
+     // Currently, LLVM only knows about PIC vs. static; the PIE differences are
+     // handled in Clang's IRGen by the -pie-level flag.
++    // Solaris already took care of PIC/PIE/non-PIC above.
++    if (Triple.getOS() != llvm::Triple::Solaris) {
+     CmdArgs.push_back("-mrelocation-model");
+     CmdArgs.push_back(PIC ? "pic" : "static");
+ 
[email protected]@ -2774,6 +2953,7 @@
+       }
+     }
+   }
++  }
+ 
+   CmdArgs.push_back("-mthread-model");
+   if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
[email protected]@ -3180,12 +3360,13 @@
+       // FIXME: we should support specifying dwarf version with
+       // -gline-tables-only.
+       CmdArgs.push_back("-gline-tables-only");
+-      // Default is dwarf-2 for Darwin, OpenBSD, FreeBSD and Solaris.
++      // Default is dwarf-2 for Darwin, OpenBSD and FreeBSD.
+       const llvm::Triple &Triple = getToolChain().getTriple();
+       if (Triple.isOSDarwin() || Triple.getOS() == llvm::Triple::OpenBSD ||
+-          Triple.getOS() == llvm::Triple::FreeBSD ||
+-          Triple.getOS() == llvm::Triple::Solaris)
++          Triple.getOS() == llvm::Triple::FreeBSD)
+         CmdArgs.push_back("-gdwarf-2");
++      else if (Triple.getOS() == llvm::Triple::Solaris)
++        CmdArgs.push_back("-gdwarf-4");
+     } else if (A->getOption().matches(options::OPT_gdwarf_2))
+       CmdArgs.push_back("-gdwarf-2");
+     else if (A->getOption().matches(options::OPT_gdwarf_3))
[email protected]@ -3194,12 +3375,13 @@
+       CmdArgs.push_back("-gdwarf-4");
+     else if (!A->getOption().matches(options::OPT_g0) &&
+              !A->getOption().matches(options::OPT_ggdb0)) {
+-      // Default is dwarf-2 for Darwin, OpenBSD, FreeBSD and Solaris.
++      // Default is dwarf-2 for Darwin, OpenBSD and FreeBSD.
+       const llvm::Triple &Triple = getToolChain().getTriple();
+       if (Triple.isOSDarwin() || Triple.getOS() == llvm::Triple::OpenBSD ||
+-          Triple.getOS() == llvm::Triple::FreeBSD ||
+-          Triple.getOS() == llvm::Triple::Solaris)
++          Triple.getOS() == llvm::Triple::FreeBSD)
+         CmdArgs.push_back("-gdwarf-2");
++      else if (Triple.getOS() == llvm::Triple::Solaris)
++        CmdArgs.push_back("-gdwarf-4");
+       else
+         CmdArgs.push_back("-g");
+     }
[email protected]@ -3594,6 +3776,7 @@
+     // If -fmessage-length=N was not specified, determine whether this is a
+     // terminal and, if so, implicitly define -fmessage-length appropriately.
+     unsigned N = llvm::sys::Process::StandardErrColumns();
++    if (N == 0) N = 72U;
+     CmdArgs.push_back(Args.MakeArgString(Twine(N)));
+   }
+ 
[email protected]@ -3735,6 +3918,7 @@
+     CmdArgs.push_back("-backend-option");
+     CmdArgs.push_back("-force-align-stack");
+   }
++
+   if (!Args.hasFlag(options::OPT_mno_stackrealign, options::OPT_mstackrealign,
+                    false)) {
+     CmdArgs.push_back(Args.MakeArgString("-mstackrealign"));
[email protected]@ -3743,6 +3927,10 @@
+   if (Args.hasArg(options::OPT_mstack_alignment)) {
+     StringRef alignment = Args.getLastArgValue(options::OPT_mstack_alignment);
+     CmdArgs.push_back(Args.MakeArgString("-mstack-alignment=" + alignment));
++  } else {
++    if ((getToolChain().getTriple().getArch() == llvm::Triple::sparc) ||
++        (getToolChain().getTriple().getArch() == llvm::Triple::sparcv9))
++      CmdArgs.push_back("-mstack-alignment=16");
+   }
+ 
+   if (getToolChain().getTriple().getArch() == llvm::Triple::aarch64 ||
[email protected]@ -6049,6 +6237,10 @@
+   C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs));
+ }
+ 
++void solaris::Assemble::RenderExtraToolArgs(const JobAction &JA,
++                                            ArgStringList &CmdArgs) const {
++}
++
+ void solaris::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
+                                       const InputInfo &Output,
+                                       const InputInfoList &Inputs,
[email protected]@ -6055,61 +6247,321 @@
+                                       const ArgList &Args,
+                                       const char *LinkingOutput) const {
+   claimNoWarnArgs(Args);
++
++  const toolchains::Solaris &TC =
++    static_cast<const toolchains::Solaris&>(getToolChain());
++
++  if (!TC.isValid()) {
++    llvm::errs() << "Invalid GCC installation!\n";
++    return;
++  }
++
++  const llvm::Triple &TT = TC.getTriple();
++  const Driver &D = TC.getDriver();
++  llvm::Triple::ArchType Arch = TT.getArch();
++  StringRef Assembler = TC.getAssembler();
++  bool m32 = true;
++
++  std::string march;
++  std::string mtune;
++  std::string mcpu;
++
+   ArgStringList CmdArgs;
+ 
+-  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
+-                       options::OPT_Xassembler);
++  if (Arg *A = Args.getLastArg(options::OPT_march_EQ))
++    march = A->getValue();
++  else
++    march = TC.getMArch();
+ 
++  if (Arg *A = Args.getLastArg(options::OPT_mtune_EQ))
++    mtune = A->getValue();
++  else
++    mtune = TC.getMTune();
++
++  if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
++    mcpu = A->getValue();
++  else
++    mcpu = TC.getMCpu();
++
++  if (Arg *A = Args.getLastArg(options::OPT_m64))
++    m32 = false;
++
++  if (Args.hasArg(options::OPT_v))
++    CmdArgs.push_back("-V");
++
++  switch (Arch) {
++  case llvm::Triple::x86:
++  case llvm::Triple::x86_64:
++    if (m32)
++      CmdArgs.push_back("--32");
++    else
++      CmdArgs.push_back("--64");
++    break;
++  case llvm::Triple::sparc:
++  case llvm::Triple::sparcv9:
++    if (m32) {
++      CmdArgs.push_back("-32");
++      march="v8plusa";
++      mcpu="v8plusa";
++    } else {
++      CmdArgs.push_back("-64");
++      march="v9a";
++      mcpu="v9a";
++    }
++    break;
++  default:
++    D.Diag(diag::err_target_unsupported_arch) << TT.getArchName()
++      << TT.getTriple();
++    break;
++  }
++
++  std::string xarch;
++
++  switch (Arch) {
++    case llvm::Triple::sparc:
++    case llvm::Triple::sparcv9:
++      if (!march.empty()) {
++        xarch = "-xarch=";
++        xarch += march;
++        CmdArgs.push_back(Args.MakeArgString(xarch.c_str()));
++      } else if (!mtune.empty()) {
++        xarch = "-xarch=";
++        xarch += mtune;
++        CmdArgs.push_back(Args.MakeArgString(xarch.c_str()));
++      } else if (!mcpu.empty()) {
++        xarch = "-xarch=";
++        xarch += mcpu;
++        CmdArgs.push_back(Args.MakeArgString(xarch.c_str()));
++      }
++
++      addAssemblerKPIC(Args, CmdArgs);
++
++      if (Args.hasArg(options::OPT_mstrict_align))
++        CmdArgs.push_back("--enforce-aligned-data");
++      break;
++    case llvm::Triple::x86:
++    case llvm::Triple::x86_64:
++      if (!march.empty()) {
++        xarch = "-mtune=";
++        xarch += march;
++        CmdArgs.push_back(Args.MakeArgString(xarch.c_str()));
++      } else if (!mtune.empty()) {
++        xarch = "-mtune=";
++        xarch += mtune;
++        CmdArgs.push_back(Args.MakeArgString(xarch.c_str()));
++      }
++      if (!mcpu.empty()) {
++        xarch = "-march=";
++        xarch += mcpu;
++        CmdArgs.push_back(Args.MakeArgString(xarch.c_str()));
++      }
++      break;
++    default:
++      D.Diag(diag::err_target_unsupported_arch) << TT.getArchName()
++        << TT.getTriple();
++      break;
++  }
++
++  if (Args.hasArg(options::OPT_g_Flag) || Args.hasArg(options::OPT_g0) ||
++      Args.hasArg(options::OPT_g1) || Args.hasArg(options::OPT_g2) ||
++      Args.hasArg(options::OPT_g3))
++    CmdArgs.push_back("--gen-debug");
++
++  if (Output.isFilename()) {
+   CmdArgs.push_back("-o");
+   CmdArgs.push_back(Output.getFilename());
++  } else {
++    D.Diag(diag::err_drv_invalid_gcc_output_type) << "<unspecified>";
++    CmdArgs.push_back("-fsyntax-only");
++  }
+ 
+-  for (const auto &II : Inputs)
++  RenderExtraToolArgs(JA, CmdArgs);
++
++  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
++                       options::OPT_Xassembler);
++
++  for (const auto &II : Inputs) {
++    if (II.getType() == types::TY_LLVM_IR ||
++        II.getType() == types::TY_LTO_IR ||
++        II.getType() == types::TY_LLVM_BC || II.getType() == types::TY_LTO_BC)
++      D.Diag(clang::diag::err_drv_no_linker_llvm_support)
++        << getToolChain().getTripleString();
++    else if (II.getType() == types::TY_AST)
++      D.Diag(clang::diag::err_drv_no_ast_support)
++        << getToolChain().getTripleString();
++    else if (II.getType() == types::TY_ModuleFile)
++      D.Diag(diag::err_drv_no_module_support)
++        << getToolChain().getTripleString();
++
++    if (II.isFilename())
+     CmdArgs.push_back(II.getFilename());
++    else
++      II.getInputArg().render(Args, CmdArgs);
++  }
+ 
+-  const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
+-  C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs));
++  C.addCommand(llvm::make_unique<Command>(JA, *this,
++                                          Args.MakeArgString(Assembler),
++                                          CmdArgs));
+ }
+ 
++
++void solaris::Link::RenderExtraToolArgs(const JobAction &JA,
++                                        ArgStringList &CmdArgs) const {
++}
++
+ void solaris::Link::ConstructJob(Compilation &C, const JobAction &JA,
+                                   const InputInfo &Output,
+                                   const InputInfoList &Inputs,
+                                   const ArgList &Args,
+                                   const char *LinkingOutput) const {
+-  // FIXME: Find a real GCC, don't hard-code versions here
+-  std::string GCCLibPath = "/usr/gcc/4.5/lib/gcc/";
+-  const llvm::Triple &T = getToolChain().getTriple();
+-  std::string LibPath = "/usr/lib/";
++  const toolchains::Solaris& TC =
++    static_cast<const toolchains::Solaris&>(getToolChain());
++
++  if (!TC.isValid()) {
++    llvm::errs() << "Invalid GCC installation!\n";
++    return;
++  }
++
++  const llvm::Triple &T = TC.getTriple();
++  const Driver &D = TC.getDriver();
+   llvm::Triple::ArchType Arch = T.getArch();
++  bool m32 = true;
++  StringRef Linker = TC.getLinker();
++
++  if (Arg *A = Args.getLastArg(options::OPT_m64))
++    m32 = false;
++
++  std::string GCCLibPath;
++  std::string YPPath;
++  GCCLibPath += "/lib/gcc/";
++  std::string LibPath = "/usr/lib/";
++  std::string ShortLibPath = "/lib/";
++  std::string ClangLibPath;
++  const char* moption;
++
+   switch (Arch) {
+   case llvm::Triple::x86:
+-    GCCLibPath +=
+-        ("i386-" + T.getVendorName() + "-" + T.getOSName()).str() + "/4.5.2/";
++    if (m32) {
++      GCCLibPath = TC.getGCCInternalLibDir().str();
++      GCCLibPath += "/";
++      moption = "-32";
++      YPPath = "/lib:/usr/lib";
++      ClangLibPath = "/usr/lib/clang/";
++    } else {
++      GCCLibPath = TC.getGCCInternalMultiLibDir().str();
++      GCCLibPath += "/";
++      LibPath += "amd64/";
++      ShortLibPath += "amd64/";
++      moption = "-64";
++      YPPath = "/lib/amd64:/usr/lib/amd64";
++      ClangLibPath = "/usr/lib/clang/amd64/";
++    }
+     break;
++  case llvm::Triple::sparc:
++    if (m32) {
++      GCCLibPath = TC.getGCCInternalLibDir().str();
++      GCCLibPath += "/";
++      moption = "-32";
++      YPPath = "/lib:/usr/lib";
++      ClangLibPath = "/usr/lib/clang/";
++    } else {
++      GCCLibPath = TC.getGCCInternalMultiLibDir().str();
++      GCCLibPath += "/";
++      LibPath += "sparcv9/";
++      ShortLibPath += "sparcv9/";
++      moption = "-64";
++      YPPath = "/lib/sparcv9:/usr/lib/sparcv9";
++      ClangLibPath = "/usr/lib/clang/sparcv9/";
++    }
++    break;
+   case llvm::Triple::x86_64:
+-    GCCLibPath += ("i386-" + T.getVendorName() + "-" + T.getOSName()).str();
+-    GCCLibPath += "/4.5.2/amd64/";
++    if (m32) {
++      GCCLibPath = TC.getGCCInternalMultiLibDir().str();
++      GCCLibPath += "/";
++      moption = "-32";
++      YPPath = "/lib:/usr/lib";
++      ClangLibPath = "/usr/lib/clang/";
++    } else {
++      GCCLibPath = TC.getGCCInternalLibDir().str();
++      GCCLibPath += "/";
+     LibPath += "amd64/";
++      ShortLibPath += "amd64/";
++      moption = "-64";
++      YPPath = "/lib/amd64:/usr/lib/amd64";
++      ClangLibPath = "/usr/lib/clang/amd64/";
++    }
+     break;
++  case llvm::Triple::sparcv9:
++    if (m32) {
++      GCCLibPath = TC.getGCCInternalMultiLibDir().str();
++      GCCLibPath += "/";
++      moption = "-32";
++      YPPath = "/lib:/usr/lib";
++      ClangLibPath = "/usr/lib/clang/";
++    } else {
++      GCCLibPath = TC.getGCCInternalLibDir().str();
++      GCCLibPath += "/";
++      LibPath += "sparcv9/";
++      ShortLibPath += "sparcv9/";
++      moption = "-64";
++      YPPath = "/lib/sparcv9:/usr/lib/sparcv9";
++      ClangLibPath = "/usr/lib/clang/sparcv9/";
++    }
++    break;
+   default:
+-    llvm_unreachable("Unsupported architecture");
++    D.Diag(diag::err_target_unsupported_arch) << T.getArchName()
++      << T.getTriple();
++    break;
+   }
+ 
+   ArgStringList CmdArgs;
+ 
+-  // Demangle C++ names in errors
+-  CmdArgs.push_back("-C");
++  CmdArgs.push_back(Args.MakeArgString("-zignore"));
+ 
+-  if ((!Args.hasArg(options::OPT_nostdlib)) &&
+-      (!Args.hasArg(options::OPT_shared))) {
+-    CmdArgs.push_back("-e");
+-    CmdArgs.push_back("_start");
++  Arg *PIEArg = Args.getLastArg(options::OPT_fPIE, options::OPT_fpie);
++  if (PIEArg) {
++    if (PIEArg->getOption().matches(options::OPT_fPIE) ||
++        PIEArg->getOption().matches(options::OPT_fpie)) {
++      CmdArgs.push_back(Args.MakeArgString("-Qy"));
++      CmdArgs.push_back(Args.MakeArgString("-zdirect"));
++      CmdArgs.push_back(Args.MakeArgString("-ztextwarn"));
++      CmdArgs.push_back(Args.MakeArgString("-ztype=pie"));
++      CmdArgs.push_back(Args.MakeArgString("-zaslr=enable"));
+   }
++  }
+ 
++  // Silence warning for "-g: argument not used during compilation
++  Args.ClaimAllArgs(options::OPT_g_Group);
++
++  // Language options
++  Args.ClaimAllArgs(options::OPT_emit_llvm);
++  Args.ClaimAllArgs(options::OPT_w);
++
++  if (Args.hasArg(options::OPT_s))
++    CmdArgs.push_back("-s");
++
++  const std::vector<std::string> &ExtraOpts = TC.getExtraOpts();
++
++  // Handle extra options
++  if (ExtraOpts.size()) {
++    for (std::vector<std::string>::const_iterator I = ExtraOpts.begin(),
++         E = ExtraOpts.end(); I != E; ++I)
++      CmdArgs.push_back((*I).c_str());
++  }
++
++  // Demangle C++ names
++  if (Linker == "/usr/gnu/bin/ld.bfd" || Linker == "/usr/gnu/bin/ld.gold" ||
++      Linker == "/usr/gnu/bin/ld" || Linker == "/usr/bin/gld")
++    CmdArgs.push_back("--demangle");
++  else if (Linker == "/usr/bin/ld")
++    CmdArgs.push_back("-C");
++
+   if (Args.hasArg(options::OPT_static)) {
+     CmdArgs.push_back("-Bstatic");
+     CmdArgs.push_back("-dn");
+   } else {
+     CmdArgs.push_back("-Bdynamic");
++    CmdArgs.push_back("-dy");
+     if (Args.hasArg(options::OPT_shared)) {
+       CmdArgs.push_back("-shared");
+     } else {
[email protected]@ -6125,41 +6577,261 @@
+     assert(Output.isNothing() && "Invalid output.");
+   }
+ 
++  const char* Values = "values-Xa.o";
++  const char* Xpg = "values-xpg4.o";
++
++  Arg *STDArg = Args.getLastArg(options::OPT_std_EQ);
++  if (STDArg) {
++    if (STDArg->getOption().matches(options::OPT_std_EQ)) {
++      std::string Lang = STDArg->getValue();
++      if ((Lang == "c99") || (Lang == "c11") ||
++          (Lang == "c++11") || (Lang == "c++14")) {
++        Values = "values-Xc.o";
++        Xpg = "values-xpg6.o";
++      }
++    }
++  }
++
++  const char *gldm = 0;
++  if (Linker == "/usr/gnu/bin/ld.bfd" || Linker == "/usr/gnu/bin/ld.gold" ||
++      Linker == "/usr/gnu/bin/ld" || Linker == "/usr/bin/gld") {
++    switch (Arch) {
++    case llvm::Triple::x86:
++      if (m32)
++        gldm = "-m elf_i386";
++      else
++        gldm = "-m elf_x86_64";
++      break;
++    case llvm::Triple::x86_64:
++      if (m32)
++        gldm = "-m elf_i386";
++      else
++        gldm = "-m elf_x86_64";
++      break;
++    case llvm::Triple::sparc:
++      if (m32)
++        gldm = "-m elf32_sparc";
++      else
++        gldm = "-m elf64_sparc";
++      break;
++    case llvm::Triple::sparcv9:
++      if (m32)
++        gldm = "-m elf32_sparc";
++      else
++        gldm = "-m elf64_sparc";
++      break;
++    default:
++      break;
++    }
++
++    if (gldm)
++      CmdArgs.push_back(Args.MakeArgString(StringRef(gldm)));
++
++    if (Linker == "/usr/gnu/bin/ld.gold") {
++      if (Args.hasArg(options::OPT_O))
++        Args.AddAllArgs(CmdArgs, options::OPT_O);
++    }
++  }
++
++  if (Args.hasArg(options::OPT_v))
++    CmdArgs.push_back(Args.MakeArgString(StringRef("-V")));
++
++  CmdArgs.push_back(Args.MakeArgString(StringRef("-Qy")));
++  if (Linker == "/usr/bin/ld") {
++    CmdArgs.push_back(Args.MakeArgString(StringRef("-Y")));
++    CmdArgs.push_back(Args.MakeArgString(StringRef("P," + YPPath)));
++  } else {
++    CmdArgs.push_back(Args.MakeArgString(StringRef("-Y")));
++    CmdArgs.push_back(Args.MakeArgString(StringRef(YPPath)));
++  }
++
++  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
++
++  std::string P = GCCLibPath;
++  P += "../../..";
++  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + P));
++
++  std::string crt1o;
++
+   if (!Args.hasArg(options::OPT_nostdlib) &&
+       !Args.hasArg(options::OPT_nostartfiles)) {
+     if (!Args.hasArg(options::OPT_shared)) {
+-      CmdArgs.push_back(Args.MakeArgString(LibPath + "crt1.o"));
++      switch (Arch) {
++      case llvm::Triple::sparc:
++      case llvm::Triple::sparcv9:
++        crt1o = GCCLibPath;
++        break;
++      case llvm::Triple::x86:
++      case llvm::Triple::x86_64:
++        crt1o = LibPath;
++        break;
++      default:
++        D.Diag(diag::err_target_unsupported_arch) << T.getArchName()
++          << T.getTriple();
++        break;
++      }
++
++      crt1o += "/crt1.o";
++
++      CmdArgs.push_back(Args.MakeArgString(crt1o.c_str()));
+       CmdArgs.push_back(Args.MakeArgString(LibPath + "crti.o"));
+-      CmdArgs.push_back(Args.MakeArgString(LibPath + "values-Xa.o"));
++      CmdArgs.push_back(Args.MakeArgString(LibPath + Values));
++      CmdArgs.push_back(Args.MakeArgString(LibPath + Xpg));
++      CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + GCCLibPath));
++      CmdArgs.push_back(Args.MakeArgString("-L" + P));
+       CmdArgs.push_back(Args.MakeArgString(GCCLibPath + "crtbegin.o"));
+     } else {
+       CmdArgs.push_back(Args.MakeArgString(LibPath + "crti.o"));
+-      CmdArgs.push_back(Args.MakeArgString(LibPath + "values-Xa.o"));
++      CmdArgs.push_back(Args.MakeArgString(LibPath + Values));
++      CmdArgs.push_back(Args.MakeArgString(LibPath + Xpg));
++      CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + GCCLibPath));
++      CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + P));
+       CmdArgs.push_back(Args.MakeArgString(GCCLibPath + "crtbegin.o"));
+     }
+-    if (getToolChain().getDriver().CCCIsCXX())
+-      CmdArgs.push_back(Args.MakeArgString(LibPath + "cxa_finalize.o"));
++  } else if (Args.hasArg(options::OPT_nostdlib) &&
++             !Args.hasArg(options::OPT_nostartfiles)) {
++    if (Args.hasArg(options::OPT_shared)) {
++      CmdArgs.push_back(Args.MakeArgString(LibPath + "crti.o"));
++      CmdArgs.push_back(Args.MakeArgString(LibPath + Values));
++      CmdArgs.push_back(Args.MakeArgString(LibPath + Xpg));
++      CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + GCCLibPath));
++      CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + P));
++      CmdArgs.push_back(Args.MakeArgString(GCCLibPath + "crtbegin.o"));
++    } else {
++      CmdArgs.push_back(Args.MakeArgString(crt1o.c_str()));
++      CmdArgs.push_back(Args.MakeArgString(LibPath + "crti.o"));
++      CmdArgs.push_back(Args.MakeArgString(LibPath + Values));
++      CmdArgs.push_back(Args.MakeArgString(LibPath + Xpg));
++      CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + GCCLibPath));
++      CmdArgs.push_back(Args.MakeArgString("-L" + P));
+   }
++  } else if (!Args.hasArg(options::OPT_nostdlib) &&
++             Args.hasArg(options::OPT_nostartfiles)) {
++    if (Args.hasArg(options::OPT_shared)) {
++      CmdArgs.push_back(Args.MakeArgString(GCCLibPath + "crtend.o"));
++    }
++  }
+ 
+-  CmdArgs.push_back(Args.MakeArgString("-L" + GCCLibPath));
++  // Itanium C++ ABI.
++  std::string CXAFinalize;
++  bool HasSystemCXAFinalize = false;
+ 
++  if (!Args.hasArg(options::OPT_shared)) {
++    if (PIEArg) {
++      if (PIEArg->getOption().matches(options::OPT_fPIE) ||
++          PIEArg->getOption().matches(options::OPT_fpie)) {
++        CXAFinalize = ClangLibPath + "cxa_finalize_pic.o";
++      }
++    } else {
++      CXAFinalize = ClangLibPath + "cxa_finalize.o";
++    }
++
++    HasSystemCXAFinalize = llvm::sys::fs::exists(CXAFinalize.c_str());
++
++    if (D.CCCIsCXX() && HasSystemCXAFinalize)
++      CmdArgs.push_back(Args.MakeArgString(CXAFinalize.c_str()));
++  }
++
++  CmdArgs.push_back(Args.MakeArgString(StringRef("-L" + GCCLibPath)));
++  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
++  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + ShortLibPath));
++
+   Args.AddAllArgs(CmdArgs, options::OPT_L);
++  const ToolChain::path_list Paths = TC.getFilePaths();
++  for (ToolChain::path_list::const_iterator B = Paths.begin(), E = Paths.end();
++       B != E; ++B) {
++    CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + *B));
++
++    // Itanium C++ ABI.
++    if (!Args.hasArg(options::OPT_shared)) {
++      if (D.CCCIsCXX() && !HasSystemCXAFinalize) {
++        if (PIEArg) {
++          if (PIEArg->getOption().matches(options::OPT_fPIE) ||
++              PIEArg->getOption().matches(options::OPT_fpie)) {
++            CXAFinalize = *B + "/cxa_finalize_pic.o";
++          }
++        } else {
++          CXAFinalize = *B + "/cxa_finalize.o";
++        }
++
++        if (llvm::sys::fs::exists(CXAFinalize.c_str()))
++          CmdArgs.push_back(Args.MakeArgString(CXAFinalize.c_str()));
++      }
++    }
++  }
++
+   Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
+   Args.AddAllArgs(CmdArgs, options::OPT_e);
++  Args.AddAllArgs(CmdArgs, options::OPT_s);
++  Args.AddAllArgs(CmdArgs, options::OPT_t);
+   Args.AddAllArgs(CmdArgs, options::OPT_r);
+ 
+-  AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
++  std::vector<std::string>  zoptions = Args.getAllArgValues(options::OPT_z);
++  std::string zoption;
+ 
++  for (std::vector<std::string>::const_iterator B = zoptions.begin(),
++      E = zoptions.end(); B != E; ++B) {
++    zoption = "-z";
++    zoption += *B;
++    CmdArgs.push_back(Args.MakeArgString(StringRef(zoption)));
++  }
++
++  if (!Args.hasArg(options::OPT_mimpure_text) &&
++      !Args.hasArg(options::OPT_fpie) &&
++      !Args.hasArg(options::OPT_fPIE))
++    CmdArgs.push_back(Args.MakeArgString(StringRef("-ztext")));
++
++  // Itanium C++ ABI.
++  if (D.CCCIsCXX()) {
++    if (!Args.hasArg(options::OPT_shared)) {
++      const char* zfiniarray = "-zfiniarray=__cxa_finalize";
++      CmdArgs.push_back(Args.MakeArgString(zfiniarray));
++    }
++  }
++
++  if (Linker == "/usr/gnu/bin/ld.gold" || Linker == "/usr/gnu/bin/ld" ||
++      Linker == "/usr/gnu/bin/ld.bfd") {
++    CmdArgs.push_back("-plugin");
++    std::string Plugin = D.Dir + "/../lib/LLVMgold.so";
++    CmdArgs.push_back(Args.MakeArgString(Plugin));
++  } else {
++    CmdArgs.push_back(moption);
++  }
++
++  if (Arg *A = Args.getLastArg(options::OPT_rpath)) {
++    StringRef V = A->getValue();
++    if (Linker == "/usr/gnu/bin/ld.gold" || Linker == "/usr/gnu/bin/ld" ||
++        Linker == "/usr/gnu/bin/ld.bfd") {
++      CmdArgs.push_back(Args.MakeArgString("-rpath"));
++      CmdArgs.push_back(Args.MakeArgString(V));
++    } else {
++      CmdArgs.push_back(Args.MakeArgString("-R"));
++      CmdArgs.push_back(Args.MakeArgString(V));
++    }
++  }
++
++  AddLinkerInputs(TC, Inputs, Args, CmdArgs);
++  AddLibgcc(D, CmdArgs, Args, Linker.str());
++
+   if (!Args.hasArg(options::OPT_nostdlib) &&
+       !Args.hasArg(options::OPT_nodefaultlibs)) {
+-    if (getToolChain().getDriver().CCCIsCXX())
+-      getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
+-    CmdArgs.push_back("-lgcc_s");
+-    if (!Args.hasArg(options::OPT_shared)) {
+-      CmdArgs.push_back("-lgcc");
++    if (D.CCCIsCXX())
++      TC.AddCXXStdlibLibArgs(Args, CmdArgs);
++
+       CmdArgs.push_back("-lc");
+       CmdArgs.push_back("-lm");
++    CmdArgs.push_back("-lgcc_s");
++
++    if (Args.hasArg(options::OPT_static)) {
++      CmdArgs.push_back("-lgcc");
++      CmdArgs.push_back("-lgcc_eh");
+     }
++  } else if (Args.hasArg(options::OPT_nostdlib) &&
++             (!Args.hasArg(options::OPT_nodefaultlibs))) {
++    CmdArgs.push_back("-lgcc_s");
++
++    if (Args.hasArg(options::OPT_static))
++      CmdArgs.push_back("-lgcc_eh");
+   }
+ 
+   if (!Args.hasArg(options::OPT_nostdlib) &&
[email protected]@ -6166,15 +6838,17 @@
+       !Args.hasArg(options::OPT_nostartfiles)) {
+     CmdArgs.push_back(Args.MakeArgString(GCCLibPath + "crtend.o"));
+   }
++
+   CmdArgs.push_back(Args.MakeArgString(LibPath + "crtn.o"));
+ 
+-  addProfileRT(getToolChain(), Args, CmdArgs);
++  addProfileRT(TC, Args, CmdArgs);
+ 
+-  const char *Exec =
+-    Args.MakeArgString(getToolChain().GetLinkerPath());
+-  C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs));
++  C.addCommand(llvm::make_unique<Command>(JA, *this,
++                                          Args.MakeArgString(Linker),
++                                          CmdArgs));
+ }
+ 
++
+ void openbsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
+                                      const InputInfo &Output,
+                                      const InputInfoList &Inputs,
[email protected]@ -7280,6 +7954,40 @@
+   if (isAndroid && !StaticLibgcc)
+     CmdArgs.push_back("-ldl");
+ }
++
++static void AddLibgcc(const Driver &D, ArgStringList &CmdArgs,
++                      const ArgList &Args, const std::string& Exec) {
++  bool StaticLibgcc = Args.hasArg(options::OPT_static) ||
++    Args.hasArg(options::OPT_static_libgcc);
++  if (!D.CCCIsCXX())
++    CmdArgs.push_back("-lgcc");
++
++  if (StaticLibgcc) {
++    if (D.CCCIsCXX())
++      CmdArgs.push_back("-lgcc");
++  } else {
++    if ((!D.CCCIsCXX()) && ((Exec == "/usr/bin/gld") ||
++                            (Exec == "/usr/gnu/bin/ld") ||
++                            (Exec == "/usr/gnu/bin/ld.bfd") ||
++                            (Exec == "/usr/gnu/bin/ld.gold")))
++      CmdArgs.push_back("--as-needed");
++
++    CmdArgs.push_back("-lgcc_s");
++    if ((!D.CCCIsCXX()) && ((Exec == "/usr/bin/gld") ||
++                            (Exec == "/usr/gnu/bin/ld") ||
++                            (Exec == "/usr/gnu/bin/ld.bfd") ||
++                            (Exec == "/usr/gnu/bin/ld.gold")))
++      CmdArgs.push_back("--no-as-needed");
++  }
++
++  if (StaticLibgcc)
++    CmdArgs.push_back("-lgcc_eh");
++  else if (!Args.hasArg(options::OPT_shared) && D.CCCIsCXX())
++    CmdArgs.push_back("-lgcc");
++
++  if (!StaticLibgcc)
++    CmdArgs.push_back("-ldl");
++}
+ 
+ static std::string getLinuxDynamicLinker(const ArgList &Args,
+                                          const toolchains::Linux &ToolChain) {
+--- tools/clang/lib/Driver/ToolChains.h	2015-08-29 19:24:32.064113013 -0700
++++ tools/clang/lib/Driver/ToolChains.h	2015-08-30 12:42:03.657485673 -0700
[email protected]@ -508,16 +508,106 @@
+                              llvm::opt::ArgStringList &CC1Args) const override;
+ };
+ 
+-class LLVM_LIBRARY_VISIBILITY Solaris : public Generic_GCC {
++class LLVM_LIBRARY_VISIBILITY Solaris : public Generic_ELF {
+ public:
+   Solaris(const Driver &D, const llvm::Triple &Triple,
+           const llvm::opt::ArgList &Args);
+ 
+-  bool IsIntegratedAssemblerDefault() const override { return true; }
++  bool IsIntegratedAssemblerDefault() const override { return !UseGnuAs; }
++
++  std::string computeSysRoot() const;
++
++  bool addLibStdCXXIncludePaths(Twine Base, Twine Suffix,
++                                StringRef GCCTriple,
++                                StringRef GCCMultiarchTriple,
++                                StringRef TargetMultiarchTriple,
++                                Twine IncludeSuffix,
++                                const llvm::opt::ArgList &DriverArgs,
++                                llvm::opt::ArgStringList &CC1Args) const;
++
++  void addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir,
++                                const llvm::opt::ArgList &DriverArgs,
++                                llvm::opt::ArgStringList &CC1Args) const;
++
++  void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
++                                    llvm::opt::ArgStringList &CC1Args) const override;
++
++  void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
++                                 llvm::opt::ArgStringList &CC1Args) const override;
++
++  void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
++                             llvm::opt::ArgStringList &CC1Args) const override;
++
++  void findGCCMajorMinor() const;
++  void findGCCMajorMinorMicro(const llvm::Triple &Triple) const;
++  void findGCCIncludeDirs(const llvm::Triple &Triple,
++                          const llvm::opt::ArgList &Args) const;
++  void findGCCInternalLibDir(const llvm::Triple &Triple,
++                             const llvm::opt::ArgList &Args) const;
++  void findSpecifiedGCCToolchain(const char *StartingPath,
++                                 const llvm::Triple &Triple,
++                                 const llvm::opt::ArgList &Args) const;
++
++  StringRef getAssembler() const { return Assembler.c_str(); }
++  StringRef getLinker() const { return Linker.c_str(); }
++  StringRef getGCCInstallDir() const { return GCCInstallDir.c_str(); }
++  StringRef getGCCMajorMinor() const { return GCCMajorMinor.c_str(); }
++  StringRef getMArch() const { return march.c_str(); }
++  StringRef getMTune() const { return mtune.c_str(); }
++  StringRef getMCpu() const { return mcpu.c_str(); }
++  StringRef getGCCInternalLibDir() const { return GCCInternalLibDir; }
++
++  StringRef getGCCInternalMultiLibDir() const {
++    return GCCInternalMultiLibDir;
++  }
++
++  StringRef getGCCMajorMinorMicro() const {
++    return GCCMajorMinorMicro.c_str();
++  }
++
++  const std::vector<std::string> &getGCCIncludeDirs() const {
++    return GCCIncludeDirs;
++  }
++
++  const std::vector<std::string> &getExtraOpts() const {
++    return ExtraOpts;
++  }
++
++  bool isValid() const { return IsValid; }
++
++  void print(raw_ostream &OS) const;
++
+ protected:
+   Tool *buildAssembler() const override;
+   Tool *buildLinker() const override;
++  void validate();
++
++private:
++  bool UseGnuAs;
++  bool UseGnuLd;
++  bool UseGoldLd;
++  bool UseSunLd;
++  mutable bool UseMediatedGCCToolChainPath;
++  mutable bool UseSpecifiedGCCToolChainPath;
++  bool IsValid;
++
++protected:
++  mutable std::string GCCInstallDir;
++  mutable std::string GCCMajorMinor;
++  mutable std::string GCCMajorMinorMicro;
++  mutable std::string GCCInternalLibDir;
++  mutable std::string GCCInternalMultiLibDir;
++  mutable std::vector<std::string> GCCIncludeDirs;
++
++  mutable std::string Assembler;
++  mutable std::string Linker;
++  mutable std::string mtune;
++  mutable std::string march;
++  mutable std::string mcpu;
+ 
++  mutable std::vector<std::string> ExtraOpts;
++  static const char *MediatedGCCToolChainPath;
++  static const bool SupportsClangLibCPlusPlus;
+ };
+ 
+ 
+--- tools/clang/lib/Driver/ToolChains.cpp	2015-04-27 01:13:25.000000000 -0700
++++ tools/clang/lib/Driver/ToolChains.cpp	2015-08-30 13:11:52.217344511 -0700
[email protected]@ -28,8 +28,10 @@
+ #include "llvm/Support/FileSystem.h"
+ #include "llvm/Support/MemoryBuffer.h"
+ #include "llvm/Support/Path.h"
++#include "llvm/Support/Host.h"
+ #include "llvm/Support/Program.h"
+ #include "llvm/Support/raw_ostream.h"
++
+ #include <cstdlib> // ::getenv
+ #include <system_error>
+ 
[email protected]@ -38,6 +40,19 @@
+ using namespace clang;
+ using namespace llvm::opt;
+ 
++#if defined(LLVM_ON_UNIX)
++#include <cstring>
++#include <cctype>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <dirent.h>
++#include <unistd.h>
++#endif
++
++/// \brief Get our best guess at the multiarch triple for a target.
++static std::string getMultiarchTriple(const llvm::Triple &TargetTriple,
++                                      StringRef SysRoot);
++
+ MachO::MachO(const Driver &D, const llvm::Triple &Triple,
+                        const ArgList &Args)
+   : ToolChain(D, Triple, Args) {
[email protected]@ -1214,6 +1229,11 @@
+     // If we have a SysRoot, try that first.
+     if (!D.SysRoot.empty()) {
+       Prefixes.push_back(D.SysRoot);
++
++      // Add Solaris-specific GCC locations.
++      if (TargetTriple.getOS() == llvm::Triple::Solaris)
++        Prefixes.push_back("/usr/gcc");
++
+       Prefixes.push_back(D.SysRoot + "/usr");
+     }
+ 
[email protected]@ -1303,20 +1323,24 @@
+   static const char *const ARMebHFTriples[] = { "armeb-linux-gnueabihf",
+                                                 "armebv7hl-redhat-linux-gnueabi" };
+ 
+-  static const char *const X86_64LibDirs[] = { "/lib64", "/lib" };
++  static const char *const X86_64LibDirs[] = { "/lib64", "/lib/amd64",
++                                               "/lib/64", "/lib" };
+   static const char *const X86_64Triples[] = {
+     "x86_64-linux-gnu", "x86_64-unknown-linux-gnu", "x86_64-pc-linux-gnu",
+     "x86_64-redhat-linux6E", "x86_64-redhat-linux", "x86_64-suse-linux",
+     "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", "x86_64-slackware-linux",
+-    "x86_64-linux-android", "x86_64-unknown-linux"
++    "x86_64-linux-android", "x86_64-unknown-linux", "x86_64-pc-solaris2.11",
++    "x86_64-pc-solaris2.12", "x86_64-pc-solaris2.13"
+   };
++
+   static const char *const X32LibDirs[] = { "/libx32" };
+   static const char *const X86LibDirs[] = { "/lib32", "/lib" };
+   static const char *const X86Triples[] = {
+     "i686-linux-gnu", "i686-pc-linux-gnu", "i486-linux-gnu", "i386-linux-gnu",
+     "i386-redhat-linux6E", "i686-redhat-linux", "i586-redhat-linux",
+     "i386-redhat-linux", "i586-suse-linux", "i486-slackware-linux",
+-    "i686-montavista-linux", "i686-linux-android", "i586-linux-gnu"
++    "i686-montavista-linux", "i686-linux-android", "i586-linux-gnu",
++    "i386-pc-solaris2.11", "i386-pc-solaris2.12", "i386-pc-solaris2.13"
+   };
+ 
+   static const char *const MIPSLibDirs[] = { "/lib" };
[email protected]@ -1358,10 +1382,18 @@
+ 
+   static const char *const SPARCv8LibDirs[] = { "/lib32", "/lib" };
+   static const char *const SPARCv8Triples[] = { "sparc-linux-gnu",
+-                                                "sparcv8-linux-gnu" };
+-  static const char *const SPARCv9LibDirs[] = { "/lib64", "/lib" };
++                                                "sparcv8-linux-gnu",
++                                                "sparc-sun-solaris2.11",
++                                                "sparc-sun-solaris2.12",
++                                                "sparc-sun-solaris2.13" };
++
++  static const char *const SPARCv9LibDirs[] = { "/lib64", "/lib/sparcv9",
++    "/lib/64", "/lib" };
+   static const char *const SPARCv9Triples[] = { "sparc64-linux-gnu",
+-                                                "sparcv9-linux-gnu" };
++                                                "sparcv9-linux-gnu",
++                                                "sparcv9-sun-solaris2.11",
++                                                "sparcv9-sun-solaris2.12",
++                                                "sparcv9-sun-solaris2.13" };
+ 
+   static const char *const SystemZLibDirs[] = { "/lib64", "/lib" };
+   static const char *const SystemZTriples[] = {
[email protected]@ -2649,16 +2681,703 @@
+ 
+ /// Solaris - Solaris tool chain which can call as(1) and ld(1) directly.
+ 
++const char *Solaris::MediatedGCCToolChainPath =
++"/path/to/mediated/gcc/toolchain";
++const bool Solaris::SupportsClangLibCPlusPlus = false;
++
+ Solaris::Solaris(const Driver &D, const llvm::Triple& Triple,
+-                 const ArgList &Args)
+-  : Generic_GCC(D, Triple, Args) {
++                 const llvm::opt::ArgList &Args)
++  : Generic_ELF(D, Triple, Args),
++  UseGnuAs(true),
++  UseGnuLd(false),
++  UseGoldLd(false),
++  UseSunLd(true),
++  UseMediatedGCCToolChainPath(false),
++  UseSpecifiedGCCToolChainPath(false),
++  IsValid(false),
++  GCCInstallDir("/usr/gcc/"),
++  GCCMajorMinor(""),
++  GCCMajorMinorMicro(""),
++  GCCInternalLibDir(""),
++  GCCInternalMultiLibDir(""),
++  GCCIncludeDirs(),
++  Assembler("/usr/gnu/bin/as"),
++  Linker("/usr/bin/ld"),
++  mtune(""),
++  march(""),
++  mcpu(""),
++  ExtraOpts() {
++    if (Arg *A = Args.getLastArg(options::OPT_gcc_toolchain)) {
++      GCCInstallDir = A->getValue();
++      if (!llvm::sys::fs::exists(GCCInstallDir))
++        D.Diag(diag::err_drv_no_such_file) << GCCInstallDir;
++      else {
++        findSpecifiedGCCToolchain(GCCInstallDir.c_str(), Triple, Args);
+ 
+-  getProgramPaths().push_back(getDriver().getInstalledDir());
++        if (!UseSpecifiedGCCToolChainPath) {
++          D.Diag(diag::err_drv_unsupported_rtlib_for_platform)
++            << GCCInstallDir << Triple.getTriple();
++        } else {
++          findGCCIncludeDirs(Triple, Args);
++          findGCCInternalLibDir(Triple, Args);
++        }
++      }
++    } else if (llvm::sys::fs::exists(Solaris::MediatedGCCToolChainPath)) {
++      GCCInstallDir = Solaris::MediatedGCCToolChainPath;
++      UseMediatedGCCToolChainPath = true;
++    } else {
++      findGCCMajorMinor();
++      findGCCMajorMinorMicro(Triple);
++      findGCCIncludeDirs(Triple, Args);
++      findGCCInternalLibDir(Triple, Args);
++    }
++
++    if (Arg *A = Args.getLastArg(options::OPT_fuse_ld_EQ)) {
++      Linker = A->getValue();
++      if (Linker == "bfd")
++        Linker = "/usr/gnu/bin/ld";
++      else if (Linker == "gold")
++        Linker = "/usr/gnu/bin/ld.gold";
++
++      if ((Linker == "/usr/gnu/bin/ld") || (Linker == "/usr/gnu/bin/ld.bfd") ||
++          (Linker == "/usr/bin/gld") || (Linker == "/usr/bin/gld.bfd")) {
++        UseGnuLd = true;
++        UseGoldLd = false;
++        UseSunLd = false;
++      } else if ((Linker == "/usr/gnu/bin/ld.gold") ||
++                 (Linker == "/usr/bin/gld.gold") ||
++                 (Linker == "/usr/bin/ld.gold")) {
++        UseGnuLd = false;
++        UseSunLd = false;
++        UseGoldLd = true;
++      }
++    }
++
++    if (Arg *A = Args.getLastArg(options::OPT_fuse_as_EQ)) {
++      Assembler = A->getValue();
++      if (Assembler == "llvm")
++        UseGnuAs = false;
++      else if ((Assembler == "/usr/gnu/bin/as") ||
++               (Assembler == "/usr/bin/gas"))
++        UseGnuAs = true;
++      else if (Assembler == "gas") {
++        Assembler = "/usr/gnu/bin/as";
++        UseGnuAs = true;
++      } else if ((Assembler == "/usr/bin/as") || (Assembler == "sun") ||
++                 (Assembler == "solaris"))
++        D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
++    }
++
++    getProgramPaths().push_back(GCCInstallDir);
+   if (getDriver().getInstalledDir() != getDriver().Dir)
+     getProgramPaths().push_back(getDriver().Dir);
+ 
++    llvm::Triple::ArchType Arch = Triple.getArch();
++
++    switch (Arch) {
++    case llvm::Triple::x86:
++      getFilePaths().push_back(getDriver().Dir + "/../lib");
++      getFilePaths().push_back("/usr/lib");
++      march = mtune = "i686";
++      break;
++    case llvm::Triple::sparc:
++      getFilePaths().push_back(getDriver().Dir + "/../lib");
++      getFilePaths().push_back("/usr/lib");
++      mcpu = "ultrasparc";
++      mtune = "ultrasparc";
++      march = "v8plusa";
++      break;
++    case llvm::Triple::x86_64:
++      getFilePaths().push_back(getDriver().Dir + "/../lib/amd64");
++      getFilePaths().push_back("/usr/lib/amd64");
++      march = mtune = "opteron";
++      break;
++    case llvm::Triple::sparcv9:
++      getFilePaths().push_back(getDriver().Dir + "/../lib/sparcv9");
++      getFilePaths().push_back("/usr/lib/sparcv9");
++      mcpu = "ultrasparc";
++      mtune = "ultrasparc";
++      march = "v9a";
++      break;
++    default:
+   getFilePaths().push_back(getDriver().Dir + "/../lib");
+   getFilePaths().push_back("/usr/lib");
++      break;
++    }
++
++    validate();
++
++    if (Args.hasArg(options::OPT_v))
++      this->print(llvm::errs());
++}
++
++std::string Solaris::computeSysRoot() const {
++  if (!getDriver().SysRoot.empty())
++    return getDriver().SysRoot;
++
++  return std::string("/");
++}
++
++bool Solaris::addLibStdCXXIncludePaths(Twine Base, Twine Suffix,
++                                       StringRef GCCTriple,
++                                       StringRef GCCMultiarchTriple,
++                                       StringRef TargetMultiarchTriple,
++                                       Twine IncludeSuffix,
++                                       const llvm::opt::ArgList &DriverArgs,
++                                       llvm::opt::ArgStringList &CC1Args) const {
++  if (!llvm::sys::fs::exists(Base + Suffix))
++        return false;
++
++  addSystemInclude(DriverArgs, CC1Args, Base);
++  addSystemInclude(DriverArgs, CC1Args, Base + Suffix);
++
++  if ((GCCMultiarchTriple.empty() && TargetMultiarchTriple.empty()) ||
++      llvm::sys::fs::exists(Base + Suffix + "/" + GCCTriple + IncludeSuffix)) {
++    addSystemInclude(DriverArgs,
++                     CC1Args, Base + Suffix + "/" + GCCTriple + IncludeSuffix);
++  } else {
++    addSystemInclude(DriverArgs, CC1Args,
++                     Base + "/" + GCCMultiarchTriple + Suffix + IncludeSuffix);
++    addSystemInclude(DriverArgs, CC1Args,
++                     Base + "/" + TargetMultiarchTriple + Suffix);
++  }
++
++  addSystemInclude(DriverArgs, CC1Args, Base + "/backward");
++  addSystemInclude(DriverArgs, CC1Args, Base + Suffix + "/backward");
++  return true;
++}
++
++void Solaris::AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
++                                           llvm::opt::ArgStringList &CC1Args) const {
++  if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
++      DriverArgs.hasArg(options::OPT_nostdincxx))
++    return;
++
++  const Driver &D = getDriver();
++
++  // Check for Clang libc++
++  if (GetCXXStdlibType(DriverArgs) == ToolChain::CST_Libcxx) {
++    if (!Solaris::SupportsClangLibCPlusPlus) {
++      D.Diag(diag::err_drv_invalid_stdlib_name) << "libc++";
++      return;
++    }
++
++    StringRef IncludePath = "/usr/include/libc++/v1";
++    if (!llvm::sys::fs::exists(IncludePath)) {
++      D.Diag(diag::err_drv_no_such_file) << IncludePath;
++      return;
++    }
++
++    addSystemInclude(DriverArgs, CC1Args, IncludePath);
++    return;
++  }
++
++  for (std::vector<std::string>::const_iterator B =
++      getGCCIncludeDirs().begin(), E = getGCCIncludeDirs().end();
++      B != E; ++B) {
++    llvm::Twine IncludePath((*B));
++    addSystemInclude(DriverArgs, CC1Args, IncludePath);
++  }
++}
++
++void Solaris::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
++                                        ArgStringList &CC1Args) const {
++  const Driver &D = getDriver();
++
++  if (DriverArgs.hasArg(options::OPT_nostdinc))
++    return;
++
++  std::string SysRoot = computeSysRoot();
++
++  if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
++    SmallString<PATH_MAX> P(D.ResourceDir);
++    llvm::sys::path::append(P, "/include");
++    addSystemInclude(DriverArgs, CC1Args, P.str());
++  }
++
++  if (DriverArgs.hasArg(options::OPT_nostdlibinc))
++    return;
++
++  StringRef CIncludeDirs(C_INCLUDE_DIRS);
++  if (CIncludeDirs != "") {
++    SmallVector<StringRef, 5> dirs;
++    CIncludeDirs.split(dirs, ":");
++    for (SmallVectorImpl<StringRef>::iterator I = dirs.begin(), E = dirs.end();
++         I != E; ++I) {
++      StringRef Prefix =
++        llvm::sys::path::is_absolute(*I) ? StringRef(SysRoot) : "";
++      addExternCSystemInclude(DriverArgs, CC1Args, Prefix + *I);
++    }
++  }
++
++  addExternCSystemInclude(DriverArgs, CC1Args, "/usr/include");
++}
++
++void Solaris::addClangTargetOptions(const ArgList &DriverArgs,
++                                    ArgStringList &CC1Args) const {
++  const llvm::Triple& TT = getTriple();
++  llvm::Triple::ArchType Arch = TT.getArch();
++
++  if (Arg *A = DriverArgs.getLastArg(options::OPT_mtune_EQ)) {
++    StringRef V = A->getValue();
++    if (!V.empty())
++      mtune = V.str();
++
++    // FIXME: Impplement SPARC target features.
++    CC1Args.push_back(DriverArgs.MakeArgString("-target-feature"));
++    if (Arch == llvm::Triple::sparc || Arch == llvm::Triple::sparcv9) {
++      std::string S = "mtune=";
++      S += mtune;
++      CC1Args.push_back(DriverArgs.MakeArgString(S.c_str()));
++    } else {
++      CC1Args.push_back(DriverArgs.MakeArgString(mtune.c_str()));
++    }
++  }
++
++  if (Arg *A = DriverArgs.getLastArg(options::OPT_march_EQ)) {
++    StringRef V = A->getValue();
++    if (!V.empty())
++      march = V.str();
++
++    CC1Args.push_back(DriverArgs.MakeArgString("-target-feature"));
++
++    if ((Arch == llvm::Triple::sparc) || (Arch == llvm::Triple::sparcv9)) {
++      std::string S = "march=";
++      S += mtune;
++      CC1Args.push_back(DriverArgs.MakeArgString(S.c_str()));
++    } else {
++      CC1Args.push_back(DriverArgs.MakeArgString(march.c_str()));
++    }
++  }
++
++  if (Arch == llvm::Triple::sparc || Arch == llvm::Triple::sparcv9) {
++    if (Arg *A = DriverArgs.getLastArg(options::OPT_mcpu_EQ)) {
++      StringRef V = A->getValue();
++      if (!V.empty())
++        mcpu = V.str();
++      else
++        mcpu = "ultrasparc";
++    }
++
++    CC1Args.push_back(DriverArgs.MakeArgString("-target-feature"));
++    std::string S = "mcpu=";
++    S += mcpu;
++    CC1Args.push_back(DriverArgs.MakeArgString(S.c_str()));
++
++    if (Arg *A = DriverArgs.getLastArg(options::OPT_mvis)) {
++      CC1Args.push_back(DriverArgs.MakeArgString("-target-feature"));
++      CC1Args.push_back(DriverArgs.MakeArgString("vis"));
++    } else if (Arg *A = DriverArgs.getLastArg(options::OPT_mvis2)) {
++      CC1Args.push_back(DriverArgs.MakeArgString("-target-feature"));
++      CC1Args.push_back(DriverArgs.MakeArgString("vis2"));
++    } else if (Arg *A = DriverArgs.getLastArg(options::OPT_mvis3)) {
++      CC1Args.push_back(DriverArgs.MakeArgString("-target-feature"));
++      CC1Args.push_back(DriverArgs.MakeArgString("vis3"));
++    }
++  }
++}
++
++void Solaris::findGCCMajorMinor() const {
++  // FIXME: Add 5.2 after testing the ABI.
++  static const char* const GCCMM[] = { "4.8", "4.9" };
++
++  const char* P;
++  std::string Path;
++
++  if (UseMediatedGCCToolChainPath) {
++    // FIXME: IMPLEMENT.
++    // Needs spec.
++  }
++
++  Path.reserve(std::string::size_type(PATH_MAX));
++
++  for (int I = (llvm::array_lengthof(GCCMM) - 1); I >= 0; --I) {
++    if ((P = GCCMM[I]) != NULL) {
++      Path = GCCInstallDir;
++      Path.append(P);
++      Path.append("/");
++
++      if (llvm::sys::fs::exists(Path.c_str())) {
++        GCCMajorMinor = P;
++        break;
++      }
++    }
++  }
++}
++
++void Solaris::findGCCMajorMinorMicro(const llvm::Triple& T) const {
++  // FIXME: Add 5.2.0 after testing the ABI.
++  static const char* const GCCMMM[] = { "4.8.2", "4.8.5", "4.9.3" };
++
++  const char* P;
++  std::string Path;
++  std::string TripleString = llvm::sys::getDefaultTargetTriple();
++  llvm::Triple::ArchType Arch = T.getArch();
++
++  if (UseMediatedGCCToolChainPath) {
++    // FIXME: IMPLEMENT.
++    // Needs spec.
++  }
++
++  Path.reserve(std::string::size_type(PATH_MAX));
++
++  for (int I = (llvm::array_lengthof(GCCMMM) - 1); I >= 0; --I) {
++    if ((P = GCCMMM[I]) != NULL) {
++      if ((P[0] == GCCMajorMinor[0]) && (P[2] == GCCMajorMinor[2])) {
++        Path = GCCInstallDir;
++        Path.append("/");
++        Path.append(GCCMajorMinor);
++        Path.append("/lib/gcc/");
++        Path.append(TripleString);
++        Path.append("/");
++        Path.append(P);
++
++        if (llvm::sys::fs::exists(Path.c_str())) {
++          std::string Test;
++          // Check if this is a real GCC installation and not just
++          // an empty directory tree
++          switch (Arch) {
++              case llvm::Triple::x86:
++              case llvm::Triple::sparc:
++                Test = Path + "/crtbegin.o";
++                break;
++              case llvm::Triple::x86_64:
++                Test = Path + "/amd64/crtbegin.o";
++                break;
++              case llvm::Triple::sparcv9:
++                Test = Path + "/sparcv9/crtbegin.o";
++                break;
++              default:
++                break;
++          }
++
++          if (llvm::sys::fs::exists(Test.c_str())) {
++            GCCMajorMinorMicro = P;
++            break;
++          }
++        }
++      }
++    }
++  }
++}
++
++void Solaris::findSpecifiedGCCToolchain(const char *StartingPath,
++                                        const llvm::Triple &Triple,
++                                        const llvm::opt::ArgList &Args) const {
++  DIR *TopLD = 0;
++  DIR *LibLD = 0;
++  DIR *GccLD = 0;
++  DIR *TripleLD = 0;
++  struct dirent *TopDE = 0;
++  struct dirent *LibDE = 0;
++  struct dirent *GccDE = 0;
++  struct dirent *TripleDE = 0;
++  std::string LibDir;
++  std::string GccDir;
++  std::string TripleDir;
++  std::string TripleVersionDir;
++  const char *DName;
++
++  assert(StartingPath && "Invalid GCC Toolchain starting search path!");
++
++  GCCMajorMinor = "";
++  GCCMajorMinorMicro = "";
++  UseSpecifiedGCCToolChainPath = false;
++
++  LibDir.reserve(std::string::size_type(PATH_MAX));
++  GccDir.reserve(std::string::size_type(PATH_MAX));
++  TripleDir.reserve(std::string::size_type(PATH_MAX));
++  TripleVersionDir.reserve(std::string::size_type(PATH_MAX));
++
++  if (llvm::sys::fs::exists(StartingPath) &&
++      llvm::sys::fs::is_directory(StartingPath)) {
++    TopLD = opendir(StartingPath);
++    assert(TopLD && "Cannot obtain a valid toplevel DIR handle!");
++
++    while ((TopDE = readdir(TopLD)) != NULL) {
++      if (TopDE->d_name[0] == '.')
++        continue;
++
++      DName = reinterpret_cast<const char*>(&TopDE->d_name[0]);
++      if (std::strcmp(DName, "lib") == 0) {
++        LibDir = StartingPath;
++        LibDir.append("/");
++        LibDir.append(DName);
++
++        if (!llvm::sys::fs::is_directory(LibDir.c_str()))
++          continue;
++
++        LibLD = opendir(LibDir.c_str());
++        assert(LibLD && "Could not obtain a valid lib DIR handle!");
++
++        while ((LibDE = readdir(LibLD)) != NULL) {
++          if (LibDE->d_name[0] == '.')
++            continue;
++
++          DName = reinterpret_cast<const char*>(&LibDE->d_name[0]);
++          if (std::strcmp(DName, "gcc") == 0) {
++            GccDir = LibDir;
++            GccDir.append("/");
++            GccDir.append(DName);
++
++            if (!llvm::sys::fs::is_directory(GccDir.c_str()))
++              continue;
++
++            GccLD = opendir(GccDir.c_str());
++            assert(GccLD && "Could not obtain a valid gcc DIR handle!");
++
++            while ((GccDE = readdir(GccLD)) != NULL) {
++              if (GccDE->d_name[0] == '.')
++                continue;
++
++              DName = reinterpret_cast<const char*>(&GccDE->d_name[0]);
++              TripleDir = GccDir;
++              TripleDir.append("/");
++              TripleDir.append(DName);
++
++              if (!llvm::sys::fs::is_directory(TripleDir.c_str()))
++                continue;
++
++              if ((std::strncmp(DName, "sparc", 5) == 0) ||
++                  (std::strncmp(DName, "i386", 4) == 0) ||
++                  (std::strncmp(DName, "sparcv9", 7) == 0) ||
++                  (std::strncmp(DName, "x86_64", 6) == 0)) {
++                TripleLD = opendir(TripleDir.c_str());
++                assert(TripleLD &&
++                       "Could not obtain a valid Triple DIR handle!");
++
++                while ((TripleDE = readdir(TripleLD)) != NULL) {
++                  if (TripleDE->d_name[0] == '.')
++                    continue;
++
++                  DName = reinterpret_cast<const char*>(&TripleDE->d_name[0]);
++                  TripleVersionDir = TripleDir;
++                  TripleVersionDir.append("/");
++                  TripleVersionDir.append(DName);
++
++                  if (!llvm::sys::fs::is_directory(TripleVersionDir.c_str()))
++                    continue;
++
++                  if ((std::isdigit(DName[0])) && (DName[1] == '.') &&
++                      (std::isdigit(DName[2])) && (DName[3] == '.') &&
++                      (std::isdigit(DName[4])) && (DName[5] == '\0')) {
++                    GCCMajorMinorMicro = DName;
++                    GCCMajorMinor = GCCMajorMinorMicro.substr(0, 3);
++                    UseSpecifiedGCCToolChainPath = true;
++                    goto done;
++                  }
++                }
++              }
++            }
++          }
++        }
++      }
++    }
++  }
++
++done:
++  if (TripleLD) {
++    rewinddir(TripleLD);
++    closedir(TripleLD);
++  }
++
++  if (GccLD) {
++    rewinddir(GccLD);
++    closedir(GccLD);
++  }
++
++  if (LibLD) {
++    rewinddir(LibLD);
++    closedir(LibLD);
++  }
++
++  if (TopLD) {
++    rewinddir(TopLD);
++    closedir(TopLD);
++  }
++}
++
++
++
++void Solaris::findGCCIncludeDirs(const llvm::Triple &Triple,
++                                 const llvm::opt::ArgList &Args) const {
++  std::string GCCInstallPath;
++  if (UseSpecifiedGCCToolChainPath)
++    GCCInstallPath = GCCInstallDir;
++  else if (UseMediatedGCCToolChainPath)
++    GCCInstallPath = Solaris::MediatedGCCToolChainPath;
++  else
++    GCCInstallPath = GCCInstallDir + GCCMajorMinor;
++
++  std::string GCCIncludeDir =
++    GCCInstallPath + "/include/c++/" + GCCMajorMinorMicro;
++  GCCIncludeDirs.push_back(GCCIncludeDir);
++
++  llvm::Triple::ArchType Arch = Triple.getArch();
++  GCCIncludeDir += "/";
++
++  switch (Arch) {
++    case llvm::Triple::x86:
++      GCCIncludeDir += Triple.getTriple();
++      if (Arg *A = Args.getLastArg(options::OPT_m64))
++        GCCIncludeDir += "/amd64";
++      break;
++    case llvm::Triple::sparc:
++      GCCIncludeDir += Triple.getTriple();
++      if (Arg *A = Args.getLastArg(options::OPT_m64))
++        GCCIncludeDir += "/sparcv9";
++      break;
++    case llvm::Triple::x86_64:
++      GCCIncludeDir += "i386-pc-";
++      GCCIncludeDir += Triple.getOSName();
++      if (Arg *A = Args.getLastArg(options::OPT_m64))
++        GCCIncludeDir += "/amd64";
++      break;
++    case llvm::Triple::sparcv9:
++      GCCIncludeDir += "sparc-sun-";
++      GCCIncludeDir += Triple.getOSName();
++      if (Arg *A = Args.getLastArg(options::OPT_m64))
++        GCCIncludeDir += "/sparcv9";
++      break;
++    default:
++      getDriver().Diag(diag::err_target_unsupported_arch)
++        << Triple.getArchName() << Triple.getTriple();
++      break;
++  }
++
++  GCCIncludeDirs.push_back(GCCIncludeDir);
++
++  GCCIncludeDir = GCCInstallPath + "/include/c++/" +
++    GCCMajorMinorMicro + "/backward";
++
++  GCCIncludeDirs.push_back(GCCIncludeDir);
++}
++
++void Solaris::findGCCInternalLibDir(const llvm::Triple &Triple,
++                                    const llvm::opt::ArgList &Args) const {
++  std::string GCCInstallPath;
++  if (UseSpecifiedGCCToolChainPath)
++    GCCInstallPath = GCCInstallDir;
++  else if (UseMediatedGCCToolChainPath)
++    GCCInstallPath = Solaris::MediatedGCCToolChainPath;
++  else
++    GCCInstallPath = GCCInstallDir + GCCMajorMinor;
++
++  GCCInternalLibDir = GCCInstallPath + "/lib/gcc/";
++
++  llvm::Triple::ArchType Arch = Triple.getArch();
++
++  switch (Arch) {
++    case llvm::Triple::x86:
++      GCCInternalLibDir += Triple.getTriple();
++      GCCInternalLibDir += "/";
++      GCCInternalLibDir += GCCMajorMinorMicro;
++      if (Arg *A = Args.getLastArg(options::OPT_m64)) {
++        GCCInternalMultiLibDir = GCCInternalLibDir;
++        GCCInternalLibDir += "/amd64";
++      } else if (Arg *A = Args.getLastArg(options::OPT_m32)) {
++        GCCInternalMultiLibDir = GCCInternalLibDir;
++        GCCInternalMultiLibDir += "/amd64";
++      } else {
++        GCCInternalMultiLibDir = GCCInternalLibDir;
++        GCCInternalMultiLibDir += "/amd64";
++      }
++
++      break;
++    case llvm::Triple::sparc:
++      GCCInternalLibDir += Triple.getTriple();
++      GCCInternalLibDir += "/";
++      GCCInternalLibDir += GCCMajorMinorMicro;
++      if (Arg *A = Args.getLastArg(options::OPT_m64)) {
++        GCCInternalMultiLibDir = GCCInternalLibDir;
++        GCCInternalLibDir += "/sparcv9";
++      } else if (Arg *A = Args.getLastArg(options::OPT_m32)) {
++        GCCInternalMultiLibDir = GCCInternalLibDir;
++        GCCInternalMultiLibDir += "/sparcv9";
++      } else {
++        GCCInternalMultiLibDir = GCCInternalLibDir;
++        GCCInternalMultiLibDir += "/sparcv9";
++      }
++      break;
++    case llvm::Triple::x86_64:
++      GCCInternalLibDir += "i386-pc-";
++      GCCInternalLibDir += Triple.getOSName();
++      GCCInternalLibDir += "/";
++      GCCInternalLibDir += GCCMajorMinorMicro;
++      GCCInternalMultiLibDir = GCCInternalLibDir;
++      if (Arg *A = Args.getLastArg(options::OPT_m64))
++        GCCInternalLibDir += "/amd64";
++      else if (Arg *A = Args.getLastArg(options::OPT_m32))
++        GCCInternalMultiLibDir += "/amd64";
++      else
++        GCCInternalLibDir += "/amd64";
++      break;
++    case llvm::Triple::sparcv9:
++      GCCInternalLibDir += "sparc-sun-";
++      GCCInternalLibDir += Triple.getOSName();
++      GCCInternalLibDir += "/";
++      GCCInternalLibDir += GCCMajorMinorMicro;
++      GCCInternalMultiLibDir = GCCInternalLibDir;
++      if (Arg *A = Args.getLastArg(options::OPT_m64))
++        GCCInternalLibDir += "/sparcv9";
++      else if (Arg *A = Args.getLastArg(options::OPT_m32))
++        GCCInternalMultiLibDir += "/sparcv9";
++      else
++        GCCInternalLibDir += "/sparcv9";
++      break;
++    default:
++      getDriver().Diag(diag::err_target_unsupported_arch)
++        << Triple.getArchName() << Triple.getTriple();
++      break;
++  }
++}
++
++void Solaris::print(raw_ostream &OS) const {
++  OS << "UseGnuAs: " << (UseGnuAs ? "true" : "false") << "\n";
++  OS << "UseGnuLd: " << (UseGnuLd ? "true" : "false") << "\n";
++  OS << "UseGoldLd: " << (UseGoldLd ? "true" : "false") << "\n";
++  OS << "UseSunLd: " << (UseSunLd ? "true" : "false") << "\n";
++  OS << "UseMediatedGCCToolChainPath: "
++    << (UseMediatedGCCToolChainPath ? "true" : "false") << "\n";
++  OS << "UseSpecifiedGCCToolChainPath: "
++    << (UseSpecifiedGCCToolChainPath ? "true" : "false") << "\n";
++  OS << "GCCInstallDir: " << GCCInstallDir.c_str() << "\n";
++  OS << "GCCMajorMinor: " << GCCMajorMinor.c_str() << "\n";
++  OS << "GCCMajorMinorMicro: " << GCCMajorMinorMicro.c_str() << "\n";
++  OS << "GCCInternalLibDir: " << GCCInternalLibDir.c_str() << "\n";
++  OS << "GCCInternalMultiLibDir: " << GCCInternalMultiLibDir.c_str() << "\n";
++  OS << "MediatedGCCToolChainPath: " << MediatedGCCToolChainPath << "\n";
++  OS << "GCCIncludeDirs: ";
++
++  if (GCCIncludeDirs.size()) {
++    std::string IncludePath;
++    for (std::vector<std::string>::const_iterator B = GCCIncludeDirs.begin(),
++        E = GCCIncludeDirs.end(); B != E; ++B) {
++      IncludePath = "-I";
++      IncludePath += (*B);
++      OS << IncludePath.c_str() << " ";
++    }
++
++    OS << "\n";
++  }
++
++  OS << "Assembler: " << Assembler.c_str() << "\n";
++  OS << "Linker: " << Linker.c_str() << "\n";
++  OS << "mtune: " << mtune.c_str() << "\n";
++  OS << "march: " << march.c_str() << "\n";
++  OS << "mcpu: " << mcpu.c_str() << "\n";
++
++  if (ExtraOpts.size()) {
++    OS << "ExtraOpts: ";
++    for (std::vector<std::string>::const_iterator B = ExtraOpts.begin(),
++        E = ExtraOpts.end(); B != E; ++B) {
++      OS << (*B).c_str() << " ";
++    }
++
++    OS << "\n";
++  }
++
++  OS << "Valid: " << (IsValid ? "true" : "false") << "\n";
+ }
+ 
+ Tool *Solaris::buildAssembler() const {
[email protected]@ -2669,6 +3388,21 @@
+   return new tools::solaris::Link(*this);
+ }
+ 
++void Solaris::validate() {
++  IsValid = llvm::sys::fs::exists(GCCInstallDir.c_str());
++  if (!IsValid) return;
++  IsValid = llvm::sys::fs::exists(GCCInternalLibDir.c_str());
++  if (!IsValid) return;
++  IsValid = llvm::sys::fs::exists(GCCInternalMultiLibDir.c_str());
++  if (!IsValid) return;
++
++  for (std::vector<std::string>::const_iterator B = GCCIncludeDirs.begin(),
++      E = GCCIncludeDirs.end(); B != E; ++B) {
++    IsValid = llvm::sys::fs::exists((*B).c_str());
++    if (!IsValid) return;
++  }
++}
++
+ /// Distribution (very bare-bones at the moment).
+ 
+ enum Distro {
[email protected]@ -2696,6 +3430,27 @@
+   UbuntuRaring,
+   UbuntuSaucy,
+   UbuntuTrusty,
++  Solaris_11,
++  Solaris_11_1,
++  Solaris_11_2,
++  Solaris_11_3,
++  Solaris_11_4,
++  Solaris_11_5,
++  Solaris_11_6,
++  Solaris_11_7,
++  Solaris_11_8,
++  Solaris_11_9,
++  Solaris_12,
++  Solaris_12_1,
++  Solaris_12_2,
++  Solaris_12_3,
++  Solaris_12_4,
++  Solaris_12_5,
++  Solaris_12_6,
++  Solaris_12_7,
++  Solaris_12_8,
++  Solaris_12_9,
++  Solaris_13,
+   UnknownDistro
+ };
+ 
[email protected]@ -2715,6 +3470,10 @@
+   return Distro >= UbuntuHardy && Distro <= UbuntuTrusty;
+ }
+ 
++static bool IsSolaris(enum Distro Distro) {
++  return Distro >= Solaris_11 && Distro <= Solaris_13;
++}
++
+ static Distro DetectDistro(llvm::Triple::ArchType Arch) {
+   llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> File =
+       llvm::MemoryBuffer::getFile("/etc/lsb-release");
[email protected]@ -2774,6 +3533,59 @@
+     return UnknownDistro;
+   }
+ 
++  File = llvm::MemoryBuffer::getFile("/etc/release");
++  if (File) {
++    StringRef Data = File.get()->getBuffer();
++    SmallVector<StringRef, 8> Lines;
++    Data.split(Lines, "\n");
++    for (unsigned I = 0, S = Lines.size(); I != S; ++I) {
++      if (Lines[I].find("Oracle Solaris") != std::string::npos) {
++        if (Lines[I].find("Solaris 11.0") != std::string::npos)
++          return Solaris_11;
++        else if (Lines[I].find("Solaris 11.1") != std::string::npos)
++          return Solaris_11_1;
++        else if (Lines[I].find("Solaris 11.2") != std::string::npos)
++          return Solaris_11_2;
++        else if (Lines[I].find("Solaris 11.3") != std::string::npos)
++          return Solaris_11_3;
++        else if (Lines[I].find("Solaris 11.4") != std::string::npos)
++          return Solaris_11_4;
++        else if (Lines[I].find("Solaris 11.5") != std::string::npos)
++          return Solaris_11_5;
++        else if (Lines[I].find("Solaris 11.6") != std::string::npos)
++          return Solaris_11_6;
++        else if (Lines[I].find("Solaris 11.7") != std::string::npos)
++          return Solaris_11_7;
++        else if (Lines[I].find("Solaris 11.8") != std::string::npos)
++          return Solaris_11_8;
++        else if (Lines[I].find("Solaris 11.9") != std::string::npos)
++          return Solaris_11_9;
++        else if (Lines[I].find("Solaris 12.0") != std::string::npos)
++          return Solaris_12;
++        else if (Lines[I].find("Solaris 12.1") != std::string::npos)
++          return Solaris_12_1;
++        else if (Lines[I].find("Solaris 12.2") != std::string::npos)
++          return Solaris_12_2;
++        else if (Lines[I].find("Solaris 12.3") != std::string::npos)
++          return Solaris_12_3;
++        else if (Lines[I].find("Solaris 12.4") != std::string::npos)
++          return Solaris_12_4;
++        else if (Lines[I].find("Solaris 12.5") != std::string::npos)
++          return Solaris_12_5;
++        else if (Lines[I].find("Solaris 12.6") != std::string::npos)
++          return Solaris_12_6;
++        else if (Lines[I].find("Solaris 12.7") != std::string::npos)
++          return Solaris_12_7;
++        else if (Lines[I].find("Solaris 12.8") != std::string::npos)
++          return Solaris_12_8;
++        else if (Lines[I].find("Solaris 12.9") != std::string::npos)
++          return Solaris_12_9;
++      }
++    }
++
++    return UnknownDistro;
++  }
++
+   if (llvm::sys::fs::exists("/etc/SuSE-release"))
+     return OpenSUSE;
+ 
+--- tools/llvm-shlib/Makefile	Sat Jul 18 11:44:45 2015
++++ tools/llvm-shlib/Makefile	Thu Aug 20 23:40:28 2015
[email protected]@ -74,6 +74,7 @@
+     LLVMLibsOptions := -Wl,-z -Wl,rescan -Wl,-z -Wl,allextract $(LLVMLibsOptions)
+     LLVMLibsOptions += -Wl,-h -Wl,lib$(LIBRARYNAME)$(SHLIBEXT)
+     LLVMLibsOptions += -Wl,-z -Wl,defaultextract -Wl,-z -Wl,defs
++    LLVMLibsOptions += -lkstat
+ endif
+ 
+ ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+--- tools/clang/lib/Basic/Targets.cpp	2015-08-26 11:44:48.659904739 -0700
++++ tools/clang/lib/Basic/Targets.cpp	2015-08-26 11:47:36.318310023 -0700
[email protected]@ -530,28 +530,60 @@
+ template<typename Target>
+ class SolarisTargetInfo : public OSTargetInfo<Target> {
+ protected:
+-  void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
++  virtual void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
+                     MacroBuilder &Builder) const override {
+     DefineStd(Builder, "sun", Opts);
+     DefineStd(Builder, "unix", Opts);
+     Builder.defineMacro("__ELF__");
+     Builder.defineMacro("__svr4__");
+     Builder.defineMacro("__SVR4");
+-    // Solaris headers require _XOPEN_SOURCE to be set to 600 for C99 and
+-    // newer, but to 500 for everything else.  feature_test.h has a check to
+-    // ensure that you are not using C99 with an old version of X/Open or C89
+-    // with a new version.
+-    if (Opts.C99)
++
++    if (Opts.C99 || Opts.CPlusPlus11) {
++      if (Opts.C99) {
+       Builder.defineMacro("_XOPEN_SOURCE", "600");
+-    else
++        Builder.defineMacro("_XPG6", "1");
++      }
++
++      Builder.defineMacro("__STDC_VERSION__", "199901L");
++      Builder.defineMacro("_STDC_C99", "1");
++      Builder.defineMacro("__C99FEATURES__", "1");
++    }
++
++    if (Opts.CPlusPlus11)
++      Builder.defineMacro("__cplusplus", "201103L");
++    else if (Opts.CPlusPlus14)
++      Builder.defineMacro("__cplusplus", "201402L");
++
++    if (Opts.CPlusPlus11) {
++      Builder.defineMacro("_STDC_C11", "1");
++      Builder.defineMacro("_STDC_C11_BCI", "1");
++      Builder.defineMacro("__XPG7_THREAD_MODEL__", "1");
++      Builder.defineMacro("_XPG7", "1");
++      Builder.defineMacro("_XOPEN_SOURCE", "700");
++    } else if (Opts.C11 || Opts.CPlusPlus14) {
++      Builder.defineMacro("__STDC_VERSION__", "201112L");
++      Builder.defineMacro("_STDC_C11", "1");
++      Builder.defineMacro("_STDC_C11_BCI", "1");
++      Builder.defineMacro("__XPG7_THREAD_MODEL__", "1");
++      Builder.defineMacro("_XPG7", "1");
++      Builder.defineMacro("_XOPEN_SOURCE", "700");
++    } else {
+       Builder.defineMacro("_XOPEN_SOURCE", "500");
+-    if (Opts.CPlusPlus)
+-      Builder.defineMacro("__C99FEATURES__");
++      Builder.defineMacro("__STDC_VERSION__", "199409L");
++      if (Opts.CPlusPlus && !Opts.CPlusPlus11 && !Opts.CPlusPlus14)
++        Builder.defineMacro("__cplusplus", "199711L");
++    }
++
++    if ((Triple.getArchName() == "i386") || (Triple.getArchName() == "sparc"))
+     Builder.defineMacro("_LARGEFILE_SOURCE");
++    else if ((Triple.getArchName() == "x86_64") ||
++             (Triple.getArchName() == "sparcv9"))
+     Builder.defineMacro("_LARGEFILE64_SOURCE");
+-    Builder.defineMacro("__EXTENSIONS__");
++
++    Builder.defineMacro("__EXTENSIONS__", "1");
+     Builder.defineMacro("_REENTRANT");
+   }
++
+ public:
+   SolarisTargetInfo(const llvm::Triple &Triple) : OSTargetInfo<Target>(Triple) {
+     this->UserLabelPrefix = "";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/015-llvm-clang-memory-corruption.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,782 @@
+# Memory corruption in LLVM.
+# https://llvm.org/bugs/show_bug.cgi?id=24607
+--- include/llvm/ADT/DenseMap.h	2014-12-06 14:22:44.000000000 -0500
++++ include/llvm/ADT/DenseMap.h	2015-08-25 21:45:36.712994054 -0400
[email protected]@ -254,7 +254,7 @@
+   DenseMapBase() {}
+ 
+   void destroyAll() {
+-    if (getNumBuckets() == 0) // Nothing to do.
++    if ((getNumBuckets() == 0) || empty()) // Nothing to do.
+       return;
+ 
+     const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey();
+--- include/llvm/IR/Attributes.h	2014-09-03 19:38:05.000000000 -0400
++++ include/llvm/IR/Attributes.h	2015-08-25 11:24:38.160033797 -0400
[email protected]@ -406,18 +406,27 @@
+   uint64_t Alignment;
+   uint64_t StackAlignment;
+   uint64_t DerefBytes;
++
+ public:
+-  AttrBuilder() : Attrs(0), Alignment(0), StackAlignment(0), DerefBytes(0) {}
++  AttrBuilder() : Attrs(0), TargetDepAttrs(), Alignment(0),
++  StackAlignment(0), DerefBytes(0) {}
++
+   explicit AttrBuilder(uint64_t Val)
+-    : Attrs(0), Alignment(0), StackAlignment(0), DerefBytes(0) {
++    : Attrs(0), TargetDepAttrs(), Alignment(0),
++    StackAlignment(0), DerefBytes(0) {
+     addRawValue(Val);
+   }
++
+   AttrBuilder(const Attribute &A)
+-    : Attrs(0), Alignment(0), StackAlignment(0), DerefBytes(0) {
++    : Attrs(0), TargetDepAttrs(), Alignment(0), StackAlignment(0),
++    DerefBytes (0) {
+     addAttribute(A);
+   }
++
+   AttrBuilder(AttributeSet AS, unsigned Idx);
+ 
++  ~AttrBuilder() { }
++
+   void clear();
+ 
+   /// \brief Add an attribute to the builder.
+--- include/llvm/IR/Metadata.h	2015-02-08 19:35:35.000000000 -0800
++++ include/llvm/IR/Metadata.h	2015-08-26 21:27:54.937575563 -0700
[email protected]@ -24,6 +24,7 @@
+ #include "llvm/IR/MetadataTracking.h"
+ #include "llvm/IR/Value.h"
+ #include "llvm/Support/ErrorHandling.h"
++#include "llvm/Support/raw_ostream.h"
+ #include <type_traits>
+ 
+ namespace llvm {
[email protected]@ -42,13 +43,15 @@
+ /// This is a root class for typeless data in the IR.
+ class Metadata {
+   friend class ReplaceableMetadataImpl;
++  friend class MDNode;
+ 
+   /// \brief RTTI.
+   const unsigned char SubclassID;
+ 
+ protected:
+   /// \brief Storage flag for non-uniqued, otherwise unowned, metadata.
+-  bool IsDistinctInContext : 1;
++  bool IsDistinctInContext;
++
+   // TODO: expose remaining bits to subclasses.
+ 
+   unsigned short SubclassData16;
[email protected]@ -149,7 +152,7 @@
+   SmallDenseMap<void *, std::pair<OwnerTy, uint64_t>, 4> UseMap;
+ 
+ public:
+-  ReplaceableMetadataImpl() : NextIndex(0) {}
++  ReplaceableMetadataImpl() : NextIndex(0), UseMap() {}
+   ~ReplaceableMetadataImpl() {
+     assert(UseMap.empty() && "Cannot destroy in-use replaceable metadata");
+   }
[email protected]@ -583,9 +586,11 @@
+ //===----------------------------------------------------------------------===//
+ /// \brief Tuple of metadata.
+ class MDNode : public Metadata {
++  friend class MDNodeFwdDecl;
++  friend class MDTuple;
++
+   MDNode(const MDNode &) LLVM_DELETED_FUNCTION;
+   void operator=(const MDNode &) LLVM_DELETED_FUNCTION;
+-  void *operator new(size_t) LLVM_DELETED_FUNCTION;
+ 
+   LLVMContext &Context;
+   unsigned NumOperands;
[email protected]@ -593,17 +598,21 @@
+ protected:
+   unsigned MDNodeSubclassData;
+ 
+-  void *operator new(size_t Size, unsigned NumOps);
+-  void operator delete(void *Mem);
++  static void *operator new(size_t Size, unsigned NumOps) throw();
++  static void operator delete(void *Mem) throw();
+ 
+   /// \brief Required by std, but never called.
+-  void operator delete(void *, unsigned) {
+-    llvm_unreachable("Constructor throws?");
++  static void operator delete(void *, unsigned) {
++    llvm::errs() << __PRETTY_FUNCTION__
++      << ": This should never be called!\n";
++    abort();
+   }
+ 
+   /// \brief Required by std, but never called.
+-  void operator delete(void *, unsigned, bool) {
+-    llvm_unreachable("Constructor throws?");
++  static void operator delete(void *, unsigned, bool) {
++    llvm::errs() << __PRETTY_FUNCTION__
++      << ": This should never be called!\n";
++    abort();
+   }
+ 
+   MDNode(LLVMContext &Context, unsigned ID, ArrayRef<Metadata *> MDs);
[email protected]@ -715,6 +724,8 @@
+ class UniquableMDNode : public MDNode {
+   friend class ReplaceableMetadataImpl;
+   friend class MDNode;
++  friend class MDTuple;
++  friend class MDLocation;
+   friend class LLVMContextImpl;
+ 
+   /// \brief Support RAUW as long as one of its arguments is replaceable.
[email protected]@ -796,10 +807,14 @@
+   static MDTuple *get(LLVMContext &Context, ArrayRef<Metadata *> MDs) {
+     return getImpl(Context, MDs, /* ShouldCreate */ true);
+   }
++
+   static MDTuple *getIfExists(LLVMContext &Context, ArrayRef<Metadata *> MDs) {
+     return getImpl(Context, MDs, /* ShouldCreate */ false);
+   }
+ 
++  void *operator new(size_t Size, unsigned NumOps) throw();
++  void operator delete(void *Mem) throw();
++
+   /// \brief Return a distinct node.
+   ///
+   /// Return a distinct node -- i.e., a node that is not uniqued.
[email protected]@ -847,6 +862,9 @@
+   void replaceOperandWith(unsigned I, Metadata *New) LLVM_DELETED_FUNCTION;
+ 
+ public:
++  void *operator new(size_t Size, unsigned NumOps) throw();
++  void operator delete(void* Mem) throw();
++
+   static MDLocation *get(LLVMContext &Context, unsigned Line, unsigned Column,
+                          Metadata *Scope, Metadata *InlinedAt = nullptr) {
+     return getImpl(Context, Line, Column, Scope, InlinedAt,
[email protected]@ -885,18 +903,18 @@
+ /// Forward declaration of metadata, in the form of a basic tuple.  Unlike \a
+ /// MDTuple, this class has full support for RAUW, is not owned, is not
+ /// uniqued, and is suitable for forward references.
+-class MDNodeFwdDecl : public MDNode, ReplaceableMetadataImpl {
++class MDNodeFwdDecl : public MDNode, public ReplaceableMetadataImpl {
+   friend class Metadata;
+   friend class ReplaceableMetadataImpl;
+ 
+   MDNodeFwdDecl(LLVMContext &C, ArrayRef<Metadata *> Vals)
+-      : MDNode(C, MDNodeFwdDeclKind, Vals) {}
++  : MDNode(C, MDNodeFwdDeclKind, Vals), ReplaceableMetadataImpl() {}
+ 
+ public:
+   ~MDNodeFwdDecl() { dropAllReferences(); }
+ 
+-  // MSVC doesn't see the alternative: "using MDNode::operator delete".
+-  void operator delete(void *Mem) { MDNode::operator delete(Mem); }
++  void *operator new(size_t Size, unsigned NumOps) throw();
++  void operator delete(void *Mem) throw();
+ 
+   static MDNodeFwdDecl *get(LLVMContext &Context, ArrayRef<Metadata *> MDs) {
+     return new (MDs.size()) MDNodeFwdDecl(Context, MDs);
+--- lib/IR/Attributes.cpp	2014-09-03 19:38:05.000000000 -0400
++++ lib/IR/Attributes.cpp	2015-08-26 00:21:40.551873740 -0400
[email protected]@ -1004,7 +1004,8 @@
+ //===----------------------------------------------------------------------===//
+ 
+ AttrBuilder::AttrBuilder(AttributeSet AS, unsigned Index)
+-  : Attrs(0), Alignment(0), StackAlignment(0), DerefBytes(0) {
++  : Attrs(0), TargetDepAttrs(), Alignment(0),
++  StackAlignment(0), DerefBytes(0) {
+   AttributeSetImpl *pImpl = AS.pImpl;
+   if (!pImpl) return;
+ 
[email protected]@ -1052,7 +1053,9 @@
+ }
+ 
+ AttrBuilder &AttrBuilder::addAttribute(StringRef A, StringRef V) {
+-  TargetDepAttrs[A] = V;
++  std::string AS = A.str();
++  std::string VS = V.str();
++  TargetDepAttrs[AS] = VS;
+   return *this;
+ }
+ 
[email protected]@ -1094,8 +1097,9 @@
+         DerefBytes = 0;
+     } else {
+       assert(Attr.isStringAttribute() && "Invalid attribute type!");
+-      std::map<std::string, std::string>::iterator
+-        Iter = TargetDepAttrs.find(Attr.getKindAsString());
++      std::string AS = Attr.getKindAsString().str();
++      std::map<std::string, std::string>::iterator Iter =
++        TargetDepAttrs.find(AS);
+       if (Iter != TargetDepAttrs.end())
+         TargetDepAttrs.erase(Iter);
+     }
[email protected]@ -1105,7 +1109,8 @@
+ }
+ 
+ AttrBuilder &AttrBuilder::removeAttribute(StringRef A) {
+-  std::map<std::string, std::string>::iterator I = TargetDepAttrs.find(A);
++  std::map<std::string, std::string>::iterator I =
++    TargetDepAttrs.find(A.str());
+   if (I != TargetDepAttrs.end())
+     TargetDepAttrs.erase(I);
+   return *this;
[email protected]@ -1163,7 +1168,7 @@
+ }
+ 
+ bool AttrBuilder::contains(StringRef A) const {
+-  return TargetDepAttrs.find(A) != TargetDepAttrs.end();
++  return TargetDepAttrs.find(A.str()) != TargetDepAttrs.end();
+ }
+ 
+ bool AttrBuilder::hasAttributes() const {
[email protected]@ -1188,7 +1193,8 @@
+         return true;
+     } else {
+       assert(Attr.isStringAttribute() && "Invalid attribute kind!");
+-      return TargetDepAttrs.find(Attr.getKindAsString())!=TargetDepAttrs.end();
++      std::string AS = Attr.getKindAsString().str();
++      return TargetDepAttrs.find(AS) != TargetDepAttrs.end();
+     }
+   }
+ 
+--- lib/IR/Metadata.cpp	2015-02-08 19:35:35.000000000 -0800
++++ lib/IR/Metadata.cpp	2015-08-28 23:18:08.062765258 -0700
[email protected]@ -379,24 +379,84 @@
+ // MDNode implementation.
+ //
+ 
+-void *MDNode::operator new(size_t Size, unsigned NumOps) {
+-  void *Ptr = ::operator new(Size + NumOps * sizeof(MDOperand));
+-  MDOperand *O = static_cast<MDOperand *>(Ptr);
+-  for (MDOperand *E = O + NumOps; O != E; ++O)
+-    (void)new (O) MDOperand;
+-  return O;
+-}
++void *MDNode::operator new(size_t Size, unsigned NumOps) throw() {
++  assert((Size >= sizeof(MDNode)) && "Insufficient size to operator new!");
++
++  // MDNode wants to construct its ancillary MDOperands ** BEFORE **
++  // itself. 
++  //
++  // Allocate extra space for an uintptr_t at the beginning of the
++  // buffer.  This uintptr_t is where we will store the address of
++  // the memory-aligned storage buffer. It will be plasced immediately
++  // after the last MDOperand.
++  // This address will be computed by the matching operator delete.
++  // The total amount of space allocated must include the Size
++  // parameter passed in. This parameter value is not necessarily
++  // equal to sizeof(MDTuple), it can be greater.
++  std::size_t OSize = NumOps * sizeof(MDOperand);
++  OSize = RoundUpToAlignment(OSize, llvm::alignOf<uint64_t>());
++
++  std::size_t RSize = Size + OSize + sizeof(Metadata) + sizeof(uintptr_t);
++  RSize = RoundUpToAlignment(RSize, llvm::alignOf<uint64_t>());
++  std::size_t Alignment = llvm::alignOf<uint64_t>();
++
++  void *P;
++
++#if defined(_MSC_VER)
++  P = _aligned_malloc(RSize, Alignment);
++  assert(P && "_aligned_malloc failed!");
++  if (!P) return 0;
++#else
++  int R = posix_memalign(&P, Alignment, RSize);
++  assert((R == 0) && "posix_memalign failed!");
++  if (R != 0) return 0;
++#endif
++
++  (void) std::memset(P, 0, RSize);
++  unsigned char *UC = static_cast<unsigned char*>(P);
++  MDNode *MN = reinterpret_cast<MDNode*>((UC + RSize) - Size);
++
++  MDOperand *O = reinterpret_cast<MDOperand*>(MN);
++  MDOperand *MO;
++
++  for (MDOperand *E = O - NumOps; O != E; --O) {
++    MO = new (O - 1) MDOperand();
++    assert(MO && "MDOperand placement new failed!");
++  }
++
++  // We store the address of the aligned allocated buffer
++  // in the last extra element of the buffer. This address
++  // will be used by the corresponding operator delete to
++  // free the correct address.
++  uintptr_t *U = reinterpret_cast<uintptr_t*>(O - 1);
++  *U = reinterpret_cast<uintptr_t>(P);
++  return MN;
++}
++
++void MDNode::operator delete(void *Mem) throw() {
++  MDNode *MN = reinterpret_cast<MDNode *>(Mem);
++  Metadata *MTD = static_cast<Metadata*>(MN);
++  std::size_t OSize = MN->NumOperands * sizeof(MDOperand);
++  OSize = RoundUpToAlignment(OSize, llvm::alignOf<uint64_t>());
+ 
+-void MDNode::operator delete(void *Mem) {
+-  MDNode *N = static_cast<MDNode *>(Mem);
+   MDOperand *O = static_cast<MDOperand *>(Mem);
+-  for (MDOperand *E = O - N->NumOperands; O != E; --O)
+-    (O - 1)->~MDOperand();
+-  ::operator delete(O);
++
++  for (MDOperand *E = O - MN->NumOperands; O != E; --O) {
++    MDOperand *MO = (O - 1);
++    MO->~MDOperand();
+ }
+ 
+-MDNode::MDNode(LLVMContext &Context, unsigned ID, ArrayRef<Metadata *> MDs)
+-    : Metadata(ID), Context(Context), NumOperands(MDs.size()),
++  MTD->~Metadata();
++  MN->~MDNode();
++
++  // This is the address of the allocated buffer in the
++  // extra buffer space allocated by operator new.
++  uintptr_t *U = reinterpret_cast<uintptr_t*>(O - 1);
++  std::free(reinterpret_cast<void*>(*U));
++}
++
++MDNode::MDNode(LLVMContext &Ctx, unsigned ID, ArrayRef<Metadata *> MDs)
++  : Metadata(ID), Context(Ctx), NumOperands(MDs.size()),
+       MDNodeSubclassData(0) {
+   for (unsigned I = 0, E = MDs.size(); I != E; ++I)
+     setOperand(I, MDs[I]);
[email protected]@ -416,7 +476,7 @@
+ 
+ UniquableMDNode::UniquableMDNode(LLVMContext &C, unsigned ID,
+                                  ArrayRef<Metadata *> Vals, bool AllowRAUW)
+-    : MDNode(C, ID, Vals) {
++  : MDNode(C, ID, Vals), ReplaceableUses() {
+   if (!AllowRAUW)
+     return;
+ 
[email protected]@ -428,7 +488,7 @@
+   if (!NumUnresolved)
+     return;
+ 
+-  ReplaceableUses.reset(new ReplaceableMetadataImpl);
++  ReplaceableUses.reset(new ReplaceableMetadataImpl());
+   SubclassData32 = NumUnresolved;
+ }
+ 
[email protected]@ -577,6 +637,9 @@
+     llvm_unreachable("Invalid subclass of UniquableMDNode");
+ #define HANDLE_UNIQUABLE_LEAF(CLASS)                                           \
+   case CLASS##Kind:                                                            \
++    static_assert(llvm::AlignOf<uint64_t>::Alignment >=             \
++        llvm::AlignOf<CLASS>::Alignment,                            \
++        "Insufficient alignment for objects prepended to " #CLASS); \
+     delete cast<CLASS>(this);                                                  \
+     break;
+ #include "llvm/IR/Metadata.def"
[email protected]@ -589,6 +652,9 @@
+     llvm_unreachable("Invalid subclass of UniquableMDNode");
+ #define HANDLE_UNIQUABLE_LEAF(CLASS)                                           \
+   case CLASS##Kind:                                                            \
++    static_assert(llvm::AlignOf<uint64_t>::Alignment >=             \
++        llvm::AlignOf<CLASS>::Alignment,                            \
++        "Insufficient alignment for objects prepended to " #CLASS); \
+     return cast<CLASS>(this)->uniquifyImpl();
+ #include "llvm/IR/Metadata.def"
+   }
[email protected]@ -600,6 +666,9 @@
+     llvm_unreachable("Invalid subclass of UniquableMDNode");
+ #define HANDLE_UNIQUABLE_LEAF(CLASS)                                           \
+   case CLASS##Kind:                                                            \
++    static_assert(llvm::AlignOf<uint64_t>::Alignment >=             \
++        llvm::AlignOf<CLASS>::Alignment,                            \
++        "Insufficient alignment for objects prepended to " #CLASS); \
+     cast<CLASS>(this)->eraseFromStoreImpl();                                   \
+     break;
+ #include "llvm/IR/Metadata.def"
[email protected]@ -643,7 +712,91 @@
+   return *I;
+ }
+ 
+-void MDTuple::eraseFromStoreImpl() { getContext().pImpl->MDTuples.erase(this); }
++void MDTuple::eraseFromStoreImpl() {
++  getContext().pImpl->MDTuples.erase(this);
++}
++
++void *MDTuple::operator new(size_t Size, unsigned NumOps) throw() {
++  assert((Size >= sizeof(MDTuple)) && "Insufficient size to operator new!");
++
++  std::size_t OSize = NumOps * sizeof(MDOperand);
++  OSize = RoundUpToAlignment(OSize, llvm::alignOf<uint64_t>());
++
++  // Allocate extra space for an uintptr_t at the beginning of the
++  // buffer.  This uintptr_t is where we will store the address of
++  // the memory-aligned storage buffer. It will be plasced immediately
++  // after the last MDOperand.
++  // This address will be computed by the matching operator delete.
++  // The total amount of space allocated must include the Size
++  // parameter passed in. This parameter value is not necessarily
++  // equal to sizeof(MDTuple), it can be greater.
++  std::size_t RSize = Size + OSize + sizeof(UniquableMDNode) +
++    sizeof(uintptr_t);
++  RSize = RoundUpToAlignment(RSize, llvm::alignOf<uint64_t>());
++  std::size_t Alignment = llvm::alignOf<uint64_t>();
++
++  void *P;
++
++#if defined(_MSC_VER)
++  P = _aligned_malloc(RSize, Alignment);
++  assert(P && "_aligned_malloc failed!");
++  if (!P) return 0;
++#else
++  int R = posix_memalign(&P, Alignment, RSize);
++  assert((R == 0) && "posix_memalign failed!");
++  if (R != 0) return 0;
++#endif
++
++  (void) std::memset(P, 0, RSize);
++
++  // Set a valid pointer to the address which will be returned
++  // by this operator. This will be a pointer to a MDTuple.
++  unsigned char *UC = static_cast<unsigned char*>(P);
++  MDTuple *MDT = reinterpret_cast<MDTuple*>((UC + RSize) - Size);
++  MDNode *MN = static_cast<MDNode*>(MDT);
++
++  MDOperand *O = reinterpret_cast<MDOperand*>(MN);
++  MDOperand *MO;
++
++  for (MDOperand *E = O - NumOps; O != E; --O) {
++    MO = new (O - 1) MDOperand();
++    assert(MO && "MDOperand placement new failed!");
++  }
++
++  // We store the address of the aligned allocated buffer
++  // in the last extra element of the buffer. This address
++  // will be used by the corresponding operator delete to
++  // free the correct address.
++  uintptr_t *U = reinterpret_cast<uintptr_t*>(O - 1);
++  *U = reinterpret_cast<uintptr_t>(P);
++  return MDT;
++}
++
++void MDTuple::operator delete(void *Mem) throw() {
++  MDTuple *MDT = reinterpret_cast<MDTuple*>(Mem);
++  UniquableMDNode *UMN = static_cast<UniquableMDNode*>(MDT);
++  MDNode *MN = static_cast<MDNode*>(UMN);
++  unsigned NumOperands = MN->getNumOperands();
++
++  std::size_t OSize = NumOperands * sizeof(MDOperand);
++  OSize = RoundUpToAlignment(OSize, llvm::alignOf<uint64_t>());
++
++  MDOperand *O =
++    reinterpret_cast<MDOperand*>(reinterpret_cast<void*>(MN));
++  for (MDOperand *E = O - NumOperands; O != E; --O) {
++    MDOperand *MO = (O - 1);
++    MO->~MDOperand();
++  }
++
++  // This is teh address of the allocated buffer in the
++  // extra space allocated by operator new in RSize.
++  uintptr_t *U = reinterpret_cast<uintptr_t*>(O - 1);
++
++  UMN->~UniquableMDNode();
++  MDT->~MDTuple();
++  std::free(reinterpret_cast<void*>(*U));
++}
++
+ 
+ MDLocation::MDLocation(LLVMContext &C, unsigned Line, unsigned Column,
+                        ArrayRef<Metadata *> MDs, bool AllowRAUW)
[email protected]@ -675,6 +828,88 @@
+     Line = 0;
+ }
+ 
++void *MDLocation::operator new(size_t Size, unsigned NumOps) throw() {
++  assert((Size >= sizeof(MDLocation)) && "Insufficient size to operator new!");
++
++  std::size_t OSize = NumOps * sizeof(MDOperand);
++  OSize = RoundUpToAlignment(OSize, llvm::alignOf<uint64_t>());
++
++  // Allocate extra space for an uintptr_t at the beginning of the
++  // buffer.  This uintptr_t is where we will store the address of
++  // the memory-aligned storage buffer. It will be plasced immediately
++  // after the last MDOperand.
++  // This address will be computed by the matching operator delete.
++  // The total amount of space allocated must include the Size
++  // parameter passed in. This parameter value is not necessarily
++  // equal to sizeof(MDLocation), it can be greater.
++  std::size_t RSize =
++    Size + OSize + sizeof(UniquableMDNode) + sizeof(uintptr_t);
++  RSize = RoundUpToAlignment(RSize, llvm::alignOf<uint64_t>());
++  std::size_t Alignment = llvm::alignOf<uint64_t>();
++
++  void *P;
++
++#if defined(_MSC_VER)
++  P = _aligned_malloc(RSize, Alignment);
++  assert(P && "_aligned_malloc failed!");
++  if (!P) return 0;
++#else
++  int R = posix_memalign(&P, Alignment, RSize);
++  assert((R == 0) && "posix_memalign failed!");
++  if (R != 0) return 0;
++#endif
++
++  (void) std::memset(P, 0, RSize);
++
++
++  // Set a valid pointer to the address which will be returned
++  // by this operator. This will be a pointer to a MDLocation.
++  unsigned char *UC = static_cast<unsigned char*>(P);
++  MDLocation *MDL = reinterpret_cast<MDLocation*>((UC + RSize) - Size);
++  MDNode *MN = static_cast<MDNode*>(MDL);
++
++  MDOperand *O = reinterpret_cast<MDOperand*>(MN);
++  MDOperand *MO;
++
++  for (MDOperand *E = O - NumOps; O != E; --O) {
++    MO = new (O - 1) MDOperand();
++    assert(MO && "MDOperand placement new failed!");
++  }
++
++  // We store the address of the aligned allocated buffer
++  // in the last extra element of the buffer. This address
++  // will be used by the corresponding operator delete to
++  // free the correct address.
++  uintptr_t *U = reinterpret_cast<uintptr_t*>(O - 1);
++  *U = reinterpret_cast<uintptr_t>(P);
++  return MDL;
++}
++
++void MDLocation::operator delete(void *Mem) throw() {
++  MDLocation *MDL = reinterpret_cast<MDLocation*>(Mem);
++  UniquableMDNode *UMN = static_cast<UniquableMDNode*>(MDL);
++  MDNode *MN = static_cast<MDNode*>(UMN);
++  unsigned NumOperands = MN->getNumOperands();
++
++  std::size_t OSize = NumOperands * sizeof(MDOperand);
++  OSize = RoundUpToAlignment(OSize, llvm::alignOf<uint64_t>());
++
++  MDOperand *O =
++    reinterpret_cast<MDOperand*>(reinterpret_cast<void*>(MN));
++  for (MDOperand *E = O - NumOperands; O != E; --O) {
++    MDOperand *MO = (O - 1);
++    MO->~MDOperand();
++  }
++
++  // This is the address of the allocated buffer in the
++  // extra space allocated by operator new in RSize.
++  uintptr_t *U = reinterpret_cast<uintptr_t*>(O - 1);
++
++  MDL->~MDLocation();
++  UMN->~UniquableMDNode();
++  std::free(reinterpret_cast<void*>(*U));
++}
++
+ static void adjustColumn(unsigned &Column) {
+   // Set to unknown on overflow.  Still use 8 bits for now.
+   if (Column >= (1u << 8))
[email protected]@ -969,6 +1204,96 @@
+ }
+ 
+ //===----------------------------------------------------------------------===//
++// MDNodeFwdDecl implementation.
++//
++
++void *MDNodeFwdDecl::operator new(size_t Size, unsigned NumOps) throw() {
++  assert((Size >= sizeof(MDNodeFwdDecl)) && "Insufficient space to operator new!");
++
++  std::size_t OSize = NumOps * sizeof(MDOperand);
++  OSize = RoundUpToAlignment(OSize, llvm::alignOf<uint64_t>());
++
++  // Allocate extra space for an uintptr_t at the beginning of the
++  // buffer.  This uintptr_t is where we will store the address of
++  // the memory-aligned storage buffer. It will be plasced immediately
++  // after the last MDOperand.
++  // This address will be computed by the matching operator delete.
++  // The total amount of space allocated must include the Size
++  // parameter passed in. This parameter value is not necessarily
++  // equal to sizeof(MDTuple), it can be greater.
++  std::size_t RSize =
++    Size +  OSize + sizeof(MDNode) + sizeof(ReplaceableMetadataImpl) +
++    sizeof(uintptr_t);
++  RSize = RoundUpToAlignment(RSize, llvm::alignOf<uint64_t>());
++  std::size_t Alignment = llvm::alignOf<uint64_t>();
++
++  void *P;
++
++#if defined(_MSC_VER)
++  P = _aligned_malloc(RSize, Alignment);
++  assert(P && "_aligned_malloc failed!");
++  if (!P) return 0;
++#else
++  int R = posix_memalign(&P, Alignment, RSize);
++  assert((R == 0) && "posix_memalign failed!");
++  if (R != 0) return 0;
++#endif
++
++  (void) std::memset(P, 0, RSize);
++
++  // Set a valid pointer to the address which will be returned
++  // by this operator. This will be a pointer to a MDNodeFwdDecl.
++  unsigned char *UC = static_cast<unsigned char*>(P);
++  MDNodeFwdDecl *MFD =
++    reinterpret_cast<MDNodeFwdDecl*>((UC + RSize) -
++        (Size + sizeof(ReplaceableMetadataImpl)));
++  MDNode *MN = static_cast<MDNode*>(MFD);
++  ReplaceableMetadataImpl *RMI = static_cast<ReplaceableMetadataImpl*>(MFD);
++
++  MDOperand *O = reinterpret_cast<MDOperand*>(MN);
++  MDOperand *MO;
++
++  for (MDOperand *E = O - NumOps; O != E; --O) {
++    MO = new (O - 1) MDOperand();
++    assert(MO && "MDOperand placement new failed!");
++  }
++
++  // We store the address of the aligned allocated buffer
++  // in the last extra element of the buffer. This address
++  // will be used by the corresponding operator delete to
++  // free the correct address.
++  uintptr_t *U = reinterpret_cast<uintptr_t*>(O - 1);
++  *U = reinterpret_cast<uintptr_t>(P);
++  return MFD;
++}
++
++void MDNodeFwdDecl::operator delete(void *Mem) throw() {
++  MDNodeFwdDecl *MFD = reinterpret_cast<MDNodeFwdDecl*>(Mem);
++  ReplaceableMetadataImpl *RMI =
++    static_cast<ReplaceableMetadataImpl*>(MFD);
++  MDNode *MN = static_cast<MDNode*>(MFD);
++
++  std::size_t OSize = MN->getNumOperands() * sizeof(MDOperand);
++  OSize = RoundUpToAlignment(OSize, llvm::alignOf<uint64_t>());
++
++  MDOperand *O =
++    reinterpret_cast<MDOperand*>(reinterpret_cast<void*>(MN));
++  for (MDOperand *E = O - MN->getNumOperands(); O != E; --O) {
++    MDOperand *MO = (O - 1);
++    MO->~MDOperand();
++  }
++
++  // This is the address of the allocated buffer in the
++  // extra space allocated by operator new in RSize.
++  uintptr_t *U = reinterpret_cast<uintptr_t*>(O - 1);
++
++  // Do not perform a full canonical destructor sequence here because
++  // MDNodeFwdDecl's are being deleted by ReplaceableMetadataImpl's
++  // destructor, which gets called from MDNode::deleteTemporary().
++  std::free(reinterpret_cast<void*>(*U));
++}
++
++//===----------------------------------------------------------------------===//
+ // NamedMDNode implementation.
+ //
+ 
+--- lib/Support/SmallVector.cpp	2012-08-21 17:11:07.000000000 -0700
++++ lib/Support/SmallVector.cpp	2015-08-26 21:28:23.352666372 -0700
[email protected]@ -11,9 +11,13 @@
+ //
+ //===----------------------------------------------------------------------===//
+ 
++#include "llvm/Support/MathExtras.h"
++#include "llvm/Support/raw_ostream.h"
+ #include "llvm/ADT/SmallVector.h"
+ using namespace llvm;
+ 
++#include <stdlib.h>
++
+ /// grow_pod - This is an implementation of the grow() method which only works
+ /// on POD-like datatypes and is out of line to reduce code duplication.
+ void SmallVectorBase::grow_pod(void *FirstEl, size_t MinSizeInBytes,
[email protected]@ -23,15 +27,42 @@
+   if (NewCapacityInBytes < MinSizeInBytes)
+     NewCapacityInBytes = MinSizeInBytes;
+ 
++  NewCapacityInBytes =
++    llvm::RoundUpToAlignment(NewCapacityInBytes, llvm::alignOf<uint64_t>());
++
+   void *NewElts;
+   if (BeginX == FirstEl) {
+-    NewElts = malloc(NewCapacityInBytes);
++    unsigned Alignment = llvm::alignOf<uint64_t>();
++#if defined(_MSC_VER)
++    NewElts = _aligned_malloc(Alignment, NewCapacityInBytes);
++    assert(NewElts && "_aligned_malloc failed!");
++#else
++    int R = posix_memalign(&NewElts, Alignment, NewCapacityInBytes);
++    assert((R == 0) && "posix_memalign failed!");
++#endif
++
++    assert(NewElts && "Invalid pointer after aligned allocation!");
++    (void) std::memset(NewElts, 0, NewCapacityInBytes);
+ 
+     // Copy the elements over.  No need to run dtors on PODs.
+-    memcpy(NewElts, this->BeginX, CurSizeBytes);
++    (void) std::memcpy(NewElts, this->BeginX, CurSizeBytes);
+   } else {
+     // If this wasn't grown from the inline copy, grow the allocated space.
+-    NewElts = realloc(this->BeginX, NewCapacityInBytes);
++    unsigned Alignment = llvm::alignOf<uint64_t>();
++#if defined(_MSC_VER)
++    NewElts = _aligned_malloc(Alignment, NewCapacityInBytes);
++    assert(NewElts && "_aligned_malloc failed!");
++#else
++    int R = posix_memalign(&NewElts, Alignment, NewCapacityInBytes);
++    assert((R == 0) && "posix_memalign failed!");
++#endif
++
++    assert(NewElts && "Invalid pointer after aligned allocation!");
++    (void) std::memset(NewElts, 0, NewCapacityInBytes);
++
++    // Copy the elements over.  No need to run dtors on PODs.
++    (void) std::memcpy(NewElts, this->BeginX, CurSizeBytes);
++    std::free(this->BeginX);
+   }
+ 
+   this->EndX = (char*)NewElts+CurSizeBytes;
+--- tools/clang/lib/AST/NestedNameSpecifier.cpp	2014-09-25 17:28:20.000000000 -0700
++++ tools/clang/lib/AST/NestedNameSpecifier.cpp	2015-08-26 08:27:36.324291508 -0700
[email protected]@ -437,20 +437,37 @@
+               unsigned &BufferCapacity) {
+     if (BufferSize + (End - Start) > BufferCapacity) {
+       // Reallocate the buffer.
+-      unsigned NewCapacity 
+-      = std::max((unsigned)(BufferCapacity? BufferCapacity * 2 
+-                            : sizeof(void*) * 2),
+-                 (unsigned)(BufferSize + (End - Start)));
+-      char *NewBuffer = static_cast<char *>(malloc(NewCapacity));
+-      memcpy(NewBuffer, Buffer, BufferSize);
++      unsigned NewCapacity =
++        std::max((unsigned)(BufferCapacity? BufferCapacity * 2 
++              : sizeof(void*) * 2), (unsigned)(BufferSize + (End - Start)));
++      NewCapacity =
++        llvm::RoundUpToAlignment(NewCapacity, llvm::alignOf<uint64_t>());
++      unsigned Alignment = ((NewCapacity < 5) ? 4 : 8);
++      if (NewCapacity < Alignment)
++        NewCapacity = Alignment;
+       
+-      if (BufferCapacity)
++      char *NewBuffer;
++#if defined(_MSC_VER)
++      NewBuffer = _aligned_malloc((size_t) NewCapacity, (size_t) Alignment);
++      assert(NewBuffer && "_aligned_malloc failed!");
++#else
++      int R = posix_memalign((void**) &NewBuffer, Alignment, NewCapacity);
++
++      assert((R == 0) && "posix_memalign failed!");
++      assert(NewBuffer && "Memory allocation failed!");
++#endif
++
++      if ((Buffer != 0) && (BufferSize > 0))
++        (void) std::memcpy(NewBuffer, Buffer, BufferSize);
++
++      if ((Buffer != 0) && (BufferSize > 0))
+         free(Buffer);
++
+       Buffer = NewBuffer;
+       BufferCapacity = NewCapacity;
+     }
+     
+-    memcpy(Buffer + BufferSize, Start, End - Start);
++    (void) std::memcpy(Buffer + BufferSize, Start, End - Start);
+     BufferSize += End-Start;
+   }
+   
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/016-llvm-21851513-memory-corruption.patch	Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,3107 @@
+# 21851513 severe memory corruption in the LLVM command-line parsing module
+# 21870103 TableGen makes incorrect assumptions about anonymous namespace instantiation
+# 21870087 naming convention for the InputFile key is inconsistent across LLVM utilities
+# 21870099 128 bytes for a filesystem path is definitely not enough
+# clang makes incorrect assumptions about anonymous namespace instantiation order
+# For upstream - maybe.
+--- include/llvm/Support/ThreadLocal.h	2014-12-14 17:04:45.000000000 -0800
++++ include/llvm/Support/ThreadLocal.h	2015-09-16 14:08:58.000000000 -0700
[email protected]@ -21,24 +21,22 @@
+ namespace llvm {
+   namespace sys {
+     // ThreadLocalImpl - Common base class of all ThreadLocal instantiations.
+     // YOU SHOULD NEVER USE THIS DIRECTLY.
+     class ThreadLocalImpl {
+       typedef uint64_t ThreadLocalDataTy;
+       /// \brief Platform-specific thread local data.
+       ///
+       /// This is embedded in the class and we avoid malloc'ing/free'ing it,
+       /// to make this class more safe for use along with CrashRecoveryContext.
+-      union {
+-        char data[sizeof(ThreadLocalDataTy)];
+-        ThreadLocalDataTy align_data;
+-      };
++      uint64_t data[2];
++
+     public:
+       ThreadLocalImpl();
+       virtual ~ThreadLocalImpl();
+       void setInstance(const void* d);
+       void *getInstance();
+       void removeInstance();
+     };
+ 
+     /// ThreadLocal - A class used to abstract thread-local storage.  It holds,
+     /// for each thread, a pointer a single object of type T.
+--- lib/Support/MemoryBuffer.cpp	2014-12-12 14:27:53.000000000 -0800
++++ lib/Support/MemoryBuffer.cpp	2015-09-19 14:20:06.472430028 -0700
[email protected]@ -21,25 +21,29 @@
+ #include "llvm/Support/Path.h"
+ #include "llvm/Support/Process.h"
+ #include "llvm/Support/Program.h"
+ #include <cassert>
+ #include <cerrno>
+ #include <cstdio>
+ #include <cstring>
+ #include <new>
+ #include <sys/types.h>
+ #include <system_error>
++
+ #if !defined(_MSC_VER) && !defined(__MINGW32__)
+ #include <unistd.h>
+ #else
+ #include <io.h>
+ #endif
++
++#include <climits>
++
+ using namespace llvm;
+ 
+ //===----------------------------------------------------------------------===//
+ // MemoryBuffer implementation itself.
+ //===----------------------------------------------------------------------===//
+ 
+ MemoryBuffer::~MemoryBuffer() { }
+ 
+ /// init - Initialize this MemoryBuffer as a reference to externally allocated
+ /// memory, memory that we know is already null terminated.
[email protected]@ -63,21 +67,21 @@
+ }
+ 
+ namespace {
+ struct NamedBufferAlloc {
+   const Twine &Name;
+   NamedBufferAlloc(const Twine &Name) : Name(Name) {}
+ };
+ }
+ 
+ void *operator new(size_t N, const NamedBufferAlloc &Alloc) {
+-  SmallString<256> NameBuf;
++  SmallString<PATH_MAX> NameBuf;
+   StringRef NameRef = Alloc.Name.toStringRef(NameBuf);
+ 
+   char *Mem = static_cast<char *>(operator new(N + NameRef.size() + 1));
+   CopyStringRef(Mem + N, NameRef);
+   return Mem;
+ }
+ 
+ namespace {
+ /// MemoryBufferMem - Named MemoryBuffer pointing to a block of memory.
+ class MemoryBufferMem : public MemoryBuffer {
[email protected]@ -156,21 +160,21 @@
+ MemoryBuffer::getNewMemBuffer(size_t Size, StringRef BufferName) {
+   std::unique_ptr<MemoryBuffer> SB = getNewUninitMemBuffer(Size, BufferName);
+   if (!SB)
+     return nullptr;
+   memset(const_cast<char*>(SB->getBufferStart()), 0, Size);
+   return SB;
+ }
+ 
+ ErrorOr<std::unique_ptr<MemoryBuffer>>
+ MemoryBuffer::getFileOrSTDIN(const Twine &Filename, int64_t FileSize) {
+-  SmallString<256> NameBuf;
++  SmallString<PATH_MAX> NameBuf;
+   StringRef NameRef = Filename.toStringRef(NameBuf);
+ 
+   if (NameRef == "-")
+     return getSTDIN();
+   return getFile(Filename, FileSize);
+ }
+ 
+ ErrorOr<std::unique_ptr<MemoryBuffer>>
+ MemoryBuffer::getFileSlice(const Twine &FilePath, uint64_t MapSize, 
+                            uint64_t Offset) {
+--- lib/Support/Unix/Program.inc	2014-12-01 16:52:01.000000000 -0800
++++ lib/Support/Unix/Program.inc	2015-09-19 15:34:57.144042911 -0700
[email protected]@ -31,23 +31,20 @@
+ #if HAVE_SIGNAL_H
+ #include <signal.h>
+ #endif
+ #if HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
+ #if HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+ #ifdef HAVE_POSIX_SPAWN
+-#ifdef __sun__
+-#define  _RESTRICT_KYWD
+-#endif
+ #include <spawn.h>
+ #if !defined(__APPLE__)
+   extern char **environ;
+ #else
+ #include <crt_externs.h> // _NSGetEnviron
+ #endif
+ #endif
+ 
+ namespace llvm {
+ 
+--- lib/TableGen/Main.cpp	2014-12-10 23:04:54.000000000 -0800
++++ lib/TableGen/Main.cpp	2015-09-19 18:04:08.147911223 -0700
[email protected]@ -21,97 +21,118 @@
+ #include "llvm/Support/MemoryBuffer.h"
+ #include "llvm/Support/ToolOutputFile.h"
+ #include "llvm/TableGen/Error.h"
+ #include "llvm/TableGen/Main.h"
+ #include "llvm/TableGen/Record.h"
+ #include <algorithm>
+ #include <cstdio>
+ #include <system_error>
+ using namespace llvm;
+ 
+-namespace {
+-  cl::opt<std::string>
+-  OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"),
+-                 cl::init("-"));
+-
+-  cl::opt<std::string>
+-  DependFilename("d",
+-                 cl::desc("Dependency filename"),
+-                 cl::value_desc("filename"),
+-                 cl::init(""));
+-
+-  cl::opt<std::string>
+-  InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"));
+-
+-  cl::list<std::string>
+-  IncludeDirs("I", cl::desc("Directory of include files"),
+-              cl::value_desc("directory"), cl::Prefix);
+-}
++static cl::opt<std::string>
++OutputFilename(cl::Prefix, "o",
++               cl::desc("Output filename"),
++               cl::value_desc("filename"),
++               cl::NotHidden,
++               cl::Optional,
++               cl::init("-"),
++               cl::ValueRequired);
++
++static cl::opt<std::string>
++DependFilename(cl::Prefix, "d",
++               cl::desc("Dependency filename"),
++               cl::value_desc("filename"),
++               cl::NotHidden,
++               cl::Optional,
++               cl::init(""),
++               cl::ValueRequired);
++
++static cl::opt<std::string>
++InputFilename(cl::Positional, "<input file>",
++              cl::desc("<input file>"),
++              cl::value_desc("Input filename"),
++              cl::NotHidden,
++              cl::Optional,
++              cl::init("-"),
++              cl::ValuePositionalNoArgs);
++
++static cl::list<std::string>
++IncludeDirs(cl::Prefix, "I",
++            cl::desc("Directory of include files"),
++            cl::value_desc("directory"),
++            cl::NotHidden,
++            cl::ZeroOrMore,
++            cl::ValueRequired);
+ 
+ /// \brief Create a dependency file for `-d` option.
+ ///
+ /// This functionality is really only for the benefit of the build system.
+ /// It is similar to GCC's `-M*` family of options.
+ static int createDependencyFile(const TGParser &Parser, const char *argv0) {
+   if (OutputFilename == "-") {
+     errs() << argv0 << ": the option -d must be used together with -o\n";
+     return 1;
+   }
+   std::error_code EC;
+   tool_output_file DepOut(DependFilename, EC, sys::fs::F_Text);
+   if (EC) {
+     errs() << argv0 << ": error opening " << DependFilename << ":"
+            << EC.message() << "\n";
+     return 1;
+   }
++
+   DepOut.os() << OutputFilename << ":";
++
+   for (const auto &Dep : Parser.getDependencies()) {
+     DepOut.os() << ' ' << Dep.first;
+   }
+   DepOut.os() << "\n";
+   DepOut.keep();
+   return 0;
+ }
+ 
+ namespace llvm {
+ 
+ int TableGenMain(char *argv0, TableGenMainFn *MainFn) {
+   RecordKeeper Records;
+ 
+   // Parse the input file.
++  llvm::Twine TFN(InputFilename);
+   ErrorOr<std::unique_ptr<MemoryBuffer>> FileOrErr =
+-      MemoryBuffer::getFileOrSTDIN(InputFilename);
++      MemoryBuffer::getFileOrSTDIN(TFN);
++
+   if (std::error_code EC = FileOrErr.getError()) {
+     errs() << "Could not open input file '" << InputFilename
+-           << "': " << EC.message() << "\n";
++      << "': " << EC.message() << "\n";
+     return 1;
+   }
+ 
+   // Tell SrcMgr about this buffer, which is what TGParser will pick up.
+   SrcMgr.AddNewSourceBuffer(std::move(*FileOrErr), SMLoc());
+ 
+   // Record the location of the include directory so that the lexer can find
+   // it later.
+-  SrcMgr.setIncludeDirs(IncludeDirs);
++  SrcMgr.setIncludeDirs(IncludeDirs.getStorage());
+ 
+   TGParser Parser(SrcMgr, Records);
+ 
+   if (Parser.ParseFile())
+     return 1;
+ 
+   std::error_code EC;
+   tool_output_file Out(OutputFilename, EC, sys::fs::F_Text);
+   if (EC) {
+     errs() << argv0 << ": error opening " << OutputFilename << ":"
+            << EC.message() << "\n";
+     return 1;
+   }
++
+   if (!DependFilename.empty()) {
+     if (int Ret = createDependencyFile(Parser, argv0))
+       return Ret;
+   }
+ 
+   if (MainFn(Out.os(), Records))
+     return 1;
+ 
+   if (ErrorsPrinted > 0) {
+     errs() << argv0 << ": " << ErrorsPrinted << " errors.\n";
+--- utils/TableGen/TableGen.cpp	2014-12-10 23:04:54.000000000 -0800
++++ utils/TableGen/TableGen.cpp	2015-09-14 16:23:45.000000000 -0700
[email protected]@ -37,67 +37,67 @@
+   GenFastISel,
+   GenSubtarget,
+   GenIntrinsic,
+   GenTgtIntrinsic,
+   PrintEnums,
+   PrintSets,
+   GenOptParserDefs,
+   GenCTags
+ };
+ 
+-namespace {
+-  cl::opt<ActionType>
+-  Action(cl::desc("Action to perform:"),
+-         cl::values(clEnumValN(PrintRecords, "print-records",
+-                               "Print all records to stdout (default)"),
+-                    clEnumValN(GenEmitter, "gen-emitter",
+-                               "Generate machine code emitter"),
+-                    clEnumValN(GenRegisterInfo, "gen-register-info",
+-                               "Generate registers and register classes info"),
+-                    clEnumValN(GenInstrInfo, "gen-instr-info",
+-                               "Generate instruction descriptions"),
+-                    clEnumValN(GenCallingConv, "gen-callingconv",
+-                               "Generate calling convention descriptions"),
+-                    clEnumValN(GenAsmWriter, "gen-asm-writer",
+-                               "Generate assembly writer"),
+-                    clEnumValN(GenDisassembler, "gen-disassembler",
+-                               "Generate disassembler"),
+-                    clEnumValN(GenPseudoLowering, "gen-pseudo-lowering",
+-                               "Generate pseudo instruction lowering"),
+-                    clEnumValN(GenAsmMatcher, "gen-asm-matcher",
+-                               "Generate assembly instruction matcher"),
+-                    clEnumValN(GenDAGISel, "gen-dag-isel",
+-                               "Generate a DAG instruction selector"),
+-                    clEnumValN(GenDFAPacketizer, "gen-dfa-packetizer",
+-                               "Generate DFA Packetizer for VLIW targets"),
+-                    clEnumValN(GenFastISel, "gen-fast-isel",
+-                               "Generate a \"fast\" instruction selector"),
+-                    clEnumValN(GenSubtarget, "gen-subtarget",
+-                               "Generate subtarget enumerations"),
+-                    clEnumValN(GenIntrinsic, "gen-intrinsic",
+-                               "Generate intrinsic information"),
+-                    clEnumValN(GenTgtIntrinsic, "gen-tgt-intrinsic",
+-                               "Generate target intrinsic information"),
+-                    clEnumValN(PrintEnums, "print-enums",
+-                               "Print enum values for a class"),
+-                    clEnumValN(PrintSets, "print-sets",
+-                               "Print expanded sets for testing DAG exprs"),
+-                    clEnumValN(GenOptParserDefs, "gen-opt-parser-defs",
+-                               "Generate option definitions"),
+-                    clEnumValN(GenCTags, "gen-ctags",
+-                               "Generate ctags-compatible index"),
+-                    clEnumValEnd));
++static cl::opt<ActionType>
++Action(cl::desc("Action to perform:"),
++       cl::values(clEnumValN(PrintRecords, "print-records",
++                             "Print all records to stdout (default)"),
++                  clEnumValN(GenEmitter, "gen-emitter",
++                             "Generate machine code emitter"),
++                  clEnumValN(GenRegisterInfo, "gen-register-info",
++                             "Generate registers and register classes info"),
++                  clEnumValN(GenInstrInfo, "gen-instr-info",
++                             "Generate instruction descriptions"),
++                  clEnumValN(GenCallingConv, "gen-callingconv",
++                             "Generate calling convention descriptions"),
++                  clEnumValN(GenAsmWriter, "gen-asm-writer",
++                             "Generate assembly writer"),
++                  clEnumValN(GenDisassembler, "gen-disassembler",
++                             "Generate disassembler"),
++                  clEnumValN(GenPseudoLowering, "gen-pseudo-lowering",
++                             "Generate pseudo instruction lowering"),
++                  clEnumValN(GenAsmMatcher, "gen-asm-matcher",
++                             "Generate assembly instruction matcher"),
++                  clEnumValN(GenDAGISel, "gen-dag-isel",
++                             "Generate a DAG instruction selector"),
++                  clEnumValN(GenDFAPacketizer, "gen-dfa-packetizer",
++                             "Generate DFA Packetizer for VLIW targets"),
++                  clEnumValN(GenFastISel, "gen-fast-isel",
++                             "Generate a \"fast\" instruction selector"),
++                  clEnumValN(GenSubtarget, "gen-subtarget",
++                             "Generate subtarget enumerations"),
++                  clEnumValN(GenIntrinsic, "gen-intrinsic",
++                             "Generate intrinsic information"),
++                  clEnumValN(GenTgtIntrinsic, "gen-tgt-intrinsic",
++                             "Generate target intrinsic information"),
++                  clEnumValN(PrintEnums, "print-enums",
++                             "Print enum values for a class"),
++                  clEnumValN(PrintSets, "print-sets",
++                             "Print expanded sets for testing DAG exprs"),
++                  clEnumValN(GenOptParserDefs, "gen-opt-parser-defs",
++                             "Generate option definitions"),
++                  clEnumValN(GenCTags, "gen-ctags",
++                             "Generate ctags-compatible index"),
++                  clEnumValEnd));
+ 
+-  cl::opt<std::string>
+-  Class("class", cl::desc("Print Enum list for this class"),
+-          cl::value_desc("class name"));
++static cl::opt<std::string>
++Class("class", cl::desc("Print Enum list for this class"),
++      cl::value_desc("class name"));
+ 
++namespace {
+ bool LLVMTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
+   switch (Action) {
+   case PrintRecords:
+     OS << Records;           // No argument, dump all contents
+     break;
+   case GenEmitter:
+     EmitCodeEmitter(Records, OS);
+     break;
+   case GenRegisterInfo:
+     EmitRegisterInfo(Records, OS);
+--- tools/clang/utils/TableGen/TableGen.cpp	2015-09-19 19:30:26.983452195 -0700
++++ tools/clang/utils/TableGen/TableGen.cpp	2015-09-19 23:12:38.299907988 -0700
[email protected]@ -48,101 +48,99 @@
+   GenClangCommentHTMLTagsProperties,
+   GenClangCommentHTMLNamedCharacterReferences,
+   GenClangCommentCommandInfo,
+   GenClangCommentCommandList,
+   GenArmNeon,
+   GenArmNeonSema,
+   GenArmNeonTest,
+   GenAttrDocs
+ };
+ 
+-namespace {
+-cl::opt<ActionType> Action(
+-    cl::desc("Action to perform:"),
+-    cl::values(
+-        clEnumValN(GenClangAttrClasses, "gen-clang-attr-classes",
+-                   "Generate clang attribute clases"),
+-        clEnumValN(GenClangAttrParserStringSwitches,
+-                   "gen-clang-attr-parser-string-switches",
+-                   "Generate all parser-related attribute string switches"),
+-        clEnumValN(GenClangAttrImpl, "gen-clang-attr-impl",
+-                   "Generate clang attribute implementations"),
+-        clEnumValN(GenClangAttrList, "gen-clang-attr-list",
+-                   "Generate a clang attribute list"),
+-        clEnumValN(GenClangAttrPCHRead, "gen-clang-attr-pch-read",
+-                   "Generate clang PCH attribute reader"),
+-        clEnumValN(GenClangAttrPCHWrite, "gen-clang-attr-pch-write",
+-                   "Generate clang PCH attribute writer"),
+-        clEnumValN(GenClangAttrHasAttributeImpl,
+-                   "gen-clang-attr-has-attribute-impl",
+-                   "Generate a clang attribute spelling list"),
+-        clEnumValN(GenClangAttrSpellingListIndex,
+-                   "gen-clang-attr-spelling-index",
+-                   "Generate a clang attribute spelling index"),
+-        clEnumValN(GenClangAttrASTVisitor,
+-                   "gen-clang-attr-ast-visitor",
+-                   "Generate a recursive AST visitor for clang attributes"),
+-        clEnumValN(GenClangAttrTemplateInstantiate,
+-                   "gen-clang-attr-template-instantiate",
+-                   "Generate a clang template instantiate code"),
+-        clEnumValN(GenClangAttrParsedAttrList,
+-                   "gen-clang-attr-parsed-attr-list",
+-                   "Generate a clang parsed attribute list"),
+-        clEnumValN(GenClangAttrParsedAttrImpl,
+-                   "gen-clang-attr-parsed-attr-impl",
+-                   "Generate the clang parsed attribute helpers"),
+-        clEnumValN(GenClangAttrParsedAttrKinds,
+-                   "gen-clang-attr-parsed-attr-kinds",
+-                   "Generate a clang parsed attribute kinds"),
+-        clEnumValN(GenClangAttrDump, "gen-clang-attr-dump",
+-                   "Generate clang attribute dumper"),
+-        clEnumValN(GenClangDiagsDefs, "gen-clang-diags-defs",
+-                   "Generate Clang diagnostics definitions"),
+-        clEnumValN(GenClangDiagGroups, "gen-clang-diag-groups",
+-                   "Generate Clang diagnostic groups"),
+-        clEnumValN(GenClangDiagsIndexName, "gen-clang-diags-index-name",
+-                   "Generate Clang diagnostic name index"),
+-        clEnumValN(GenClangCommentNodes, "gen-clang-comment-nodes",
+-                   "Generate Clang AST comment nodes"),
+-        clEnumValN(GenClangDeclNodes, "gen-clang-decl-nodes",
+-                   "Generate Clang AST declaration nodes"),
+-        clEnumValN(GenClangStmtNodes, "gen-clang-stmt-nodes",
+-                   "Generate Clang AST statement nodes"),
+-        clEnumValN(GenClangSACheckers, "gen-clang-sa-checkers",
+-                   "Generate Clang Static Analyzer checkers"),
+-        clEnumValN(GenClangCommentHTMLTags, "gen-clang-comment-html-tags",
+-                   "Generate efficient matchers for HTML tag "
+-                   "names that are used in documentation comments"),
+-        clEnumValN(GenClangCommentHTMLTagsProperties,
+-                   "gen-clang-comment-html-tags-properties",
+-                   "Generate efficient matchers for HTML tag "
+-                   "properties"),
+-        clEnumValN(GenClangCommentHTMLNamedCharacterReferences,
+-                   "gen-clang-comment-html-named-character-references",
+-                   "Generate function to translate named character "
+-                   "references to UTF-8 sequences"),
+-        clEnumValN(GenClangCommentCommandInfo, "gen-clang-comment-command-info",
+-                   "Generate command properties for commands that "
+-                   "are used in documentation comments"),
+-        clEnumValN(GenClangCommentCommandList, "gen-clang-comment-command-list",
+-                   "Generate list of commands that are used in "