Merge commit 'b58f810669d9c17bcc025b7560de01d162856f34' into merge_20130226

Conflicts:
	include/clang/Basic/LangOptions.def
	lib/Sema/SemaDeclAttr.cpp

Change-Id: Ia10b4d3b2c949a72d328cb58b113f90237d4a5d5
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..3f5f0ba
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,33 @@
+LOCAL_PATH := $(call my-dir)
+CLANG_ROOT_PATH := $(LOCAL_PATH)
+
+include $(CLEAR_VARS)
+
+subdirs := $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
+  lib/Analysis \
+  lib/AST \
+  lib/ARCMigrate \
+  lib/Basic \
+  lib/CodeGen \
+  lib/Driver \
+  lib/Edit \
+  lib/Frontend \
+  lib/FrontendTool \
+  lib/Headers \
+  lib/Lex \
+  lib/Parse \
+  lib/Rewrite/Core \
+  lib/Rewrite/Frontend \
+  lib/Sema \
+  lib/Serialization \
+  lib/StaticAnalyzer/Checkers \
+  lib/StaticAnalyzer/Core \
+  lib/StaticAnalyzer/Frontend \
+  tools/driver \
+  utils/TableGen \
+  ))
+
+include $(LOCAL_PATH)/clang.mk
+include $(LOCAL_PATH)/host_shared_clang.mk
+
+include $(subdirs)
diff --git a/MODULE_LICENSE_BSD_LIKE b/MODULE_LICENSE_BSD_LIKE
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_BSD_LIKE
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..369204e
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,62 @@
+==============================================================================
+LLVM Release License
+==============================================================================
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2007-2011 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.
+
+==============================================================================
+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
+-------             ---------
+<none yet>
diff --git a/README.android b/README.android
new file mode 100644
index 0000000..32a4ecc
--- /dev/null
+++ b/README.android
@@ -0,0 +1,45 @@
+/*
+ * README.android describes in high-level the LLVM changes that we cannot push
+ * upstream to the llvm.org repository:
+ *  - Changes due to Android's build system.
+ *  - Changes due to Android's toolchain.
+ *  - Changes due to the limitations in Android-based consumer electronics.
+ *
+ * Some of them are to-dos. If and when they are done, there will no longer be
+ * merge conflicts with upstream on those parts.
+ *
+ * The file contains useful hints when we try to resolve future 3-way merge
+ * conflicts.
+ */
+
+* For Honeycomb: Synced to upstream r112347
+* For Honeycomb MR1: Synced to upstream r119349
+* For Honeycomb MR2: Synced to upstream r119349
+* For Ice Cream Sandwich: Synced to upstream r135574
+* For Ice Cream Sandwich MR1: Synced to upstream r142531
+* For Ice Cream Sandwich MR2: Synced to upstream r146715
+* For Jellybean: Synced to upstream r155088
+* For Jellybean MR1: Synced to upstream r162325.
+
+* Recent downstreaming on 2012/8/23: Synced to r162325 (srhines for merge questions)
+* Recent downstreaming on 2012/8/3: Synced to r160673 (sliao for merge questions)
+* Recent downstreaming on 2012/4/24: Synced to r155088 (sliao for merge questions)
+* Recent downstreaming on 2012/3/24: Synced to r153220 (sliao & srhines for merge questions)
+* Recent downstreaming on 2012/3/5: Synced to r152062 (srhines & sliao for merge questions)
+* Recent downstreaming on 2011/12/17: Synced to r146715 (loganchien & sliao for merge questions)
+* Recent downstreaming on 2011/11/26: Synced to r145117 (loganchien & sliao for merge questions)
+* Recent downstreaming on 2011/11/17: Synced to r144605 (loganchien & sliao for merge questions)
+* Recent downstreaming on 2011/11/14: Synced to r144355 (srhines for merge questions)
+* Recent downstreaming on 2011/10/22: Synced to r142531 (sliao & loganchien for merge questions)
+* Recent downstreaming on 2011/7/21:  Synced to r135574 (sliao & loganchien for merge questions)
+* Recent downstreaming on 2011/7/18:  Synced to r135359 (sliao for merge questions)
+* Recent downstreaming on 2011/7/2:   Synced to r134305 (sliao for merge questions)
+* Recent downstreaming on 2011/6/30:  Synced to r133721 (sliao for merge questions)
+* Recent downstreaming on 2011/6/22:  Synced to r133163 (sliao for merge questions)
+* Recent downstreaming on 2011/4/8:   Synced to r129173 (sliao for merge questions)
+* Recent downstreaming on 2011/3/11:  Synced from r119349 to r127120 (sliao for merge questions)
+
+* We add Android's *.mk files that are specific to Android's build system.
+
+* Changes for enabling both host and device builds.
+
diff --git a/clang-host-build.mk b/clang-host-build.mk
new file mode 100644
index 0000000..e0ba2e6
--- /dev/null
+++ b/clang-host-build.mk
@@ -0,0 +1,38 @@
+LOCAL_CFLAGS :=	\
+	-pedantic	\
+	-Wcast-qual	\
+	-Wno-long-long	\
+	$(LOCAL_CFLAGS)
+
+LOCAL_CPPFLAGS := \
+	-Wno-sign-promo \
+	$(LOCAL_CPPFLAGS)
+
+# Make sure bionic is first so we can include system headers.
+LOCAL_C_INCLUDES :=	\
+	$(CLANG_ROOT_PATH)/include	\
+        $(CLANG_ROOT_PATH)/lib/CodeGen    \
+	$(LOCAL_C_INCLUDES)
+
+LLVM_ROOT_PATH := external/llvm
+include $(LLVM_ROOT_PATH)/llvm.mk
+
+ifneq ($(LLVM_HOST_BUILD_MK),)
+include $(LLVM_HOST_BUILD_MK)
+endif
+
+###########################################################
+## Commands for running tblgen to compile a td file
+###########################################################
+define transform-host-clang-td-to-out
+@mkdir -p $(dir $@)
+@echo "Host Clang TableGen: $(TBLGEN_LOCAL_MODULE) (gen-$(1)) <= $<"
+$(hide) $(CLANG_TBLGEN) \
+	-I $(dir $<)	\
+	-I $(LLVM_ROOT_PATH)/include	\
+	-I $(LLVM_ROOT_PATH)/host/include	\
+	-I $(LLVM_ROOT_PATH)/lib/Target	\
+	$(if $(strip $(CLANG_ROOT_PATH)),-I $(CLANG_ROOT_PATH)/include,)	\
+	-gen-$(strip $(1))	\
+	-o $@ $<
+endef
diff --git a/clang-tblgen-rules.mk b/clang-tblgen-rules.mk
new file mode 100644
index 0000000..a680fc7
--- /dev/null
+++ b/clang-tblgen-rules.mk
@@ -0,0 +1,198 @@
+###########################################################
+## TableGen: Compile .td files to .inc.
+###########################################################
+ifeq ($(LOCAL_MODULE_CLASS),)
+    LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+endif
+
+ifneq ($(strip $(TBLGEN_TABLES)),)
+
+intermediates := $(call local-intermediates-dir)
+
+ifneq ($(findstring AttrDump.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/AST/AttrDump.inc
+$(intermediates)/include/clang/AST/AttrDump.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/AST/AttrDump.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-attr-dump)
+endif
+
+ifneq ($(findstring AttrImpl.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/AST/AttrImpl.inc
+$(intermediates)/include/clang/AST/AttrImpl.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/AST/AttrImpl.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-attr-impl)
+endif
+
+ifneq ($(findstring AttrList.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Basic/AttrList.inc
+$(intermediates)/include/clang/Basic/AttrList.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/Basic/AttrList.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-attr-list)
+endif
+
+ifneq ($(findstring AttrSpellings.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Lex/AttrSpellings.inc
+$(intermediates)/include/clang/Lex/AttrSpellings.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/Lex/AttrSpellings.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-attr-spelling-list)
+endif
+
+ifneq ($(findstring AttrPCHRead.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Serialization/AttrPCHRead.inc
+$(intermediates)/include/clang/Serialization/AttrPCHRead.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/Serialization/AttrPCHRead.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-attr-pch-read)
+endif
+
+ifneq ($(findstring AttrPCHWrite.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Serialization/AttrPCHWrite.inc
+$(intermediates)/include/clang/Serialization/AttrPCHWrite.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/Serialization/AttrPCHWrite.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-attr-pch-write)
+endif
+
+ifneq ($(findstring AttrLateParsed.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Parse/AttrLateParsed.inc
+$(intermediates)/include/clang/Parse/AttrLateParsed.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/Parse/AttrLateParsed.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-attr-late-parsed-list)
+endif
+
+ifneq ($(findstring Attrs.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/AST/Attrs.inc
+$(intermediates)/include/clang/AST/Attrs.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/AST/Attrs.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-attr-classes)
+endif
+
+ifneq ($(findstring AttrParsedAttrKinds.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Sema/AttrParsedAttrKinds.inc
+$(intermediates)/include/clang/Sema/AttrParsedAttrKinds.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/Sema/AttrParsedAttrKinds.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-attr-parsed-attr-kinds)
+endif
+
+ifneq ($(findstring AttrParsedAttrList.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Sema/AttrParsedAttrList.inc
+$(intermediates)/include/clang/Sema/AttrParsedAttrList.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/Sema/AttrParsedAttrList.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-attr-parsed-attr-list)
+endif
+
+ifneq ($(findstring AttrTemplateInstantiate.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Sema/AttrTemplateInstantiate.inc
+$(intermediates)/include/clang/Sema/AttrTemplateInstantiate.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/Sema/AttrTemplateInstantiate.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-attr-template-instantiate)
+endif
+
+ifneq ($(findstring Checkers.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/Checkers.inc
+$(intermediates)/Checkers.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/Checkers.inc: \
+  $(CLANG_ROOT_PATH)/lib/StaticAnalyzer/Checkers/Checkers.td \
+  $(CLANG_ROOT_PATH)/include/clang/StaticAnalyzer/Checkers/CheckerBase.td \
+  | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-sa-checkers)
+endif
+
+ifneq ($(findstring CommentCommandInfo.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/AST/CommentCommandInfo.inc
+$(intermediates)/include/clang/AST/CommentCommandInfo.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/AST/CommentCommandInfo.inc: \
+  $(CLANG_ROOT_PATH)/include/clang/AST/CommentCommands.td \
+  | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-comment-command-info)
+endif
+
+ifneq ($(findstring CommentHTMLTagsProperties.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/AST/CommentHTMLTagsProperties.inc
+$(intermediates)/include/clang/AST/CommentHTMLTagsProperties.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/AST/CommentHTMLTagsProperties.inc: \
+  $(CLANG_ROOT_PATH)/include/clang/AST/CommentHTMLTags.td \
+  | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-comment-html-tags-properties)
+endif
+
+ifneq ($(findstring CommentHTMLTags.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/AST/CommentHTMLTags.inc
+$(intermediates)/include/clang/AST/CommentHTMLTags.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/AST/CommentHTMLTags.inc: \
+  $(CLANG_ROOT_PATH)/include/clang/AST/CommentHTMLTags.td \
+  | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-comment-html-tags)
+endif
+
+ifneq ($(findstring CommentNodes.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/AST/CommentNodes.inc
+$(intermediates)/include/clang/AST/CommentNodes.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/AST/CommentNodes.inc: \
+  $(CLANG_ROOT_PATH)/include/clang/Basic/CommentNodes.td \
+  | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-comment-nodes)
+endif
+
+ifneq ($(filter Diagnostic%Kinds.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/include/clang/Basic/,$(filter Diagnostic%Kinds.inc,$(TBLGEN_TABLES)))
+$(intermediates)/include/clang/Basic/Diagnostic%Kinds.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/Basic/Diagnostic%Kinds.inc: \
+  $(CLANG_ROOT_PATH)/include/clang/Basic/Diagnostic.td \
+  $(CLANG_ROOT_PATH)/include/clang/Basic/Diagnostic%Kinds.td \
+  | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-diags-defs -clang-component=$(patsubst Diagnostic%Kinds.inc,%,$(@F)))
+endif
+
+ifneq ($(findstring DiagnosticGroups.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Basic/DiagnosticGroups.inc
+$(intermediates)/include/clang/Basic/DiagnosticGroups.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/Basic/DiagnosticGroups.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Diagnostic.td $(CLANG_ROOT_PATH)/include/clang/Basic/DiagnosticGroups.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-diag-groups)
+endif
+
+ifneq ($(findstring DiagnosticIndexName.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Basic/DiagnosticIndexName.inc
+$(intermediates)/include/clang/Basic/DiagnosticIndexName.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/Basic/DiagnosticIndexName.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Diagnostic.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-diag-groups)
+endif
+
+ifneq ($(findstring DeclNodes.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/AST/DeclNodes.inc
+$(intermediates)/include/clang/AST/DeclNodes.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/AST/DeclNodes.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/DeclNodes.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-decl-nodes)
+endif
+
+ifneq ($(findstring StmtNodes.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/AST/StmtNodes.inc
+$(intermediates)/include/clang/AST/StmtNodes.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/AST/StmtNodes.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/StmtNodes.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,clang-stmt-nodes)
+endif
+
+ifneq ($(findstring arm_neon.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Basic/arm_neon.inc
+$(intermediates)/include/clang/Basic/arm_neon.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/Basic/arm_neon.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/arm_neon.td | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,arm-neon-sema)
+endif
+
+ifneq ($(findstring Options.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Driver/Options.inc
+$(intermediates)/include/clang/Driver/Options.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/Driver/Options.inc: $(CLANG_ROOT_PATH)/include/clang/Driver/Options.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(CLANG_ROOT_PATH)/include/clang/Driver/CC1Options.td \
+    | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,opt-parser-defs)
+endif
+
+ifneq ($(findstring CC1AsOptions.inc,$(TBLGEN_TABLES)),)
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Driver/CC1AsOptions.inc
+$(intermediates)/include/clang/Driver/CC1AsOptions.inc: TBLGEN_LOCAL_MODULE := $(LOCAL_MODULE)
+$(intermediates)/include/clang/Driver/CC1AsOptions.inc: $(CLANG_ROOT_PATH)/include/clang/Driver/CC1AsOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td \
+    | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,opt-parser-defs)
+endif
+
+LOCAL_C_INCLUDES += $(intermediates)/include
+
+endif
diff --git a/clang-version-inc.mk b/clang-version-inc.mk
new file mode 100644
index 0000000..3a01fb8
--- /dev/null
+++ b/clang-version-inc.mk
@@ -0,0 +1,35 @@
+###########################################################
+## Generate clang/Basic/Version.inc
+###########################################################
+ifeq ($(LOCAL_MODULE_CLASS),)
+    LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+endif
+
+intermediates := $(call local-intermediates-dir)
+
+LLVMVersion := $(shell grep PACKAGE_VERSION $(LLVM_ROOT_PATH)/host/include/llvm/Config/config.h | sed -e 's/\#define PACKAGE_VERSION "\(.*\)"/\1/g')
+
+# Compute the Clang version from the LLVM version, unless specified explicitly.
+# (Copy from include/clang/Basic/Makefile)
+CLANG_VERSION := $(subst svn,,$(LLVMVersion))
+CLANG_VERSION_COMPONENTS := $(subst ., ,$(CLANG_VERSION))
+CLANG_VERSION_MAJOR := $(word 1,$(CLANG_VERSION_COMPONENTS))
+CLANG_VERSION_MINOR := $(word 2,$(CLANG_VERSION_COMPONENTS))
+CLANG_VERSION_PATCHLEVEL := $(word 3,$(CLANG_VERSION_COMPONENTS))
+ifeq ($(CLANG_VERSION_PATCHLEVEL),)
+    CLANG_HAS_VERSION_PATCHLEVEL := 0
+else
+    CLANG_HAS_VERSION_PATCHLEVEL := 1
+endif
+
+LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Basic/Version.inc
+$(intermediates)/include/clang/Basic/Version.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Version.inc.in
+	@echo "Updating Clang version info."
+	@mkdir -p $(dir $@)
+	$(hide) sed -e "s#@CLANG_VERSION@#$(CLANG_VERSION)#g" \
+	-e "s#@CLANG_VERSION_MAJOR@#$(CLANG_VERSION_MAJOR)#g" \
+	-e "s#@CLANG_VERSION_MINOR@#$(CLANG_VERSION_MINOR)#g" \
+	-e "s#@CLANG_VERSION_PATCHLEVEL@#$(CLANG_VERSION_PATCHLEVEL)#g" \
+	-e "s#@CLANG_HAS_VERSION_PATCHLEVEL@#$(CLANG_HAS_VERSION_PATCHLEVEL)#g" \
+	$< > $@
+
diff --git a/clang.mk b/clang.mk
new file mode 100644
index 0000000..f1084a5
--- /dev/null
+++ b/clang.mk
@@ -0,0 +1,9 @@
+ifeq ($(CLANG_ROOT_PATH),)
+$(error Must set variable CLANG_ROOT_PATH before including this! $(LOCAL_PATH))
+endif
+
+CLANG_TBLGEN := $(BUILD_OUT_EXECUTABLES)/clang-tblgen$(BUILD_EXECUTABLE_SUFFIX)
+
+CLANG_HOST_BUILD_MK := $(CLANG_ROOT_PATH)/clang-host-build.mk
+CLANG_TBLGEN_RULES_MK := $(CLANG_ROOT_PATH)/clang-tblgen-rules.mk
+CLANG_VERSION_INC_MK := $(CLANG_ROOT_PATH)/clang-version-inc.mk
diff --git a/gen_diff.sh b/gen_diff.sh
new file mode 100755
index 0000000..a914a41
--- /dev/null
+++ b/gen_diff.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+#
+# Copyright 2011 Google Inc. All Rights Reserved.
+
+function usage() {
+  echo Usage: $0 "[PATH_TO_YOUR_LLVM_DIRECTORY]"
+  echo This will generate a diff of both Clang and LLVM in the files
+  echo diff_clang.txt
+  echo diff_llvm.txt
+}
+
+BASE_LLVM_DIR_ONCE=0
+BASE_LLVM_DIR=$LLVMDIR/llvm
+
+ARGS=`getopt -o h --long help -- "$@"`
+eval set -- "$ARGS"
+
+while true; do
+  case "$1" in
+  -h|--help)
+    usage
+    exit 0
+    ;;
+  --)
+    shift;
+    break
+    ;;
+  *)
+    echo "Internal error!"
+    exit 1
+    ;;
+  esac
+done
+
+for ARG; do
+  if [ $BASE_LLVM_DIR_ONCE -eq 1 ]; then
+    usage
+    exit 1
+  fi
+  BASE_LLVM_DIR_ONCE=1
+  BASE_LLVM_DIR=$ARG
+done
+
+BASE_CLANG_DIR=$BASE_LLVM_DIR/tools/clang
+echo "Using BASE_LLVM_DIR = $BASE_LLVM_DIR"
+echo "Using BASE_CLANG_DIR = $BASE_CLANG_DIR"
+
+ANDROID_LLVM_DIR=$PWD/../llvm
+ANDROID_CLANG_DIR=$PWD
+echo "Using ANDROID_LLVM_DIR = $ANDROID_LLVM_DIR"
+echo "Using ANDROID_CLANG_DIR = $ANDROID_CLANG_DIR"
+
+DIFF_FLAGS="-x .git -r"
+
+diff $DIFF_FLAGS $BASE_CLANG_DIR $ANDROID_CLANG_DIR > diff_clang.txt
+diff $DIFF_FLAGS $BASE_LLVM_DIR $ANDROID_LLVM_DIR > diff_llvm.txt
+
+exit 0
diff --git a/host_shared_clang.mk b/host_shared_clang.mk
new file mode 100644
index 0000000..36b417d
--- /dev/null
+++ b/host_shared_clang.mk
@@ -0,0 +1,31 @@
+LOCAL_PATH:= $(call my-dir)
+
+LOCAL_IS_HOST_MODULE := true
+
+LOCAL_MODULE:= libclang
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_WHOLE_STATIC_LIBRARIES := \
+	libclangDriver \
+	libclangParse \
+	libclangSema \
+	libclangAnalysis \
+	libclangCodeGen \
+	libclangAST \
+	libclangEdit \
+	libclangLex \
+	libclangFrontend \
+	libclangBasic \
+	libclangSerialization
+
+LOCAL_SHARED_LIBRARIES := libLLVM
+
+ifeq ($(HOST_OS),windows)
+  LOCAL_LDLIBS := -limagehlp -lpsapi
+else
+  LOCAL_LDLIBS := -ldl -lpthread
+endif
+
+include $(CLANG_HOST_BUILD_MK)
+include $(BUILD_HOST_SHARED_LIBRARY)
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index df28510..cdcc856 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -2522,10 +2522,10 @@
   static int getPointAccessorIdx(char c) {
     switch (c) {
     default: return -1;
-    case 'x': return 0;
-    case 'y': return 1;
-    case 'z': return 2;
-    case 'w': return 3;
+    case 'x': case 'r': return 0;
+    case 'y': case 'g': return 1;
+    case 'z': case 'b': return 2;
+    case 'w': case 'a': return 3;
     }
   }
   static int getNumericAccessorIdx(char c) {
diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td
index 3d4c3e0..72d7343 100644
--- a/include/clang/Basic/Attr.td
+++ b/include/clang/Basic/Attr.td
@@ -336,6 +336,10 @@
   let ASTNode = 0;
 }
 
+def Kernel : Attr {
+  let Spellings = [GNU<"kernel">];
+}
+
 def Deprecated : InheritableAttr {
   let Spellings = [GNU<"deprecated">, CXX11<"gnu", "deprecated">];
   let Args = [StringArgument<"Message">];
diff --git a/include/clang/Basic/LangOptions.def b/include/clang/Basic/LangOptions.def
index 3de0107..e4b0b1a 100644
--- a/include/clang/Basic/LangOptions.def
+++ b/include/clang/Basic/LangOptions.def
@@ -119,6 +119,7 @@
 LANGOPT(NativeHalfType    , 1, 0, "Native half type support")
 LANGOPT(CUDA              , 1, 0, "CUDA")
 LANGOPT(OpenMP            , 1, 0, "OpenMP support")
+LANGOPT(Renderscript      , 1, 0, "Renderscript")
 
 LANGOPT(AssumeSaneOperatorNew , 1, 1, "implicit __attribute__((malloc)) for C++'s new operators")
 BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision")
diff --git a/include/clang/Config/config.h b/include/clang/Config/config.h
new file mode 100644
index 0000000..c5e6245
--- /dev/null
+++ b/include/clang/Config/config.h
@@ -0,0 +1,22 @@
+/* tools/clang/include/clang/Config/config.h.  Generated from config.h.in by configure.  */
+/* include/clang/Config/config.h.in. */
+
+#ifndef ANDROID_CONFIG_H
+#define ANDROID_CONFIG_H
+
+/* Bug report URL. */
+#define BUG_REPORT_URL "http://llvm.org/bugs/"
+
+/* Relative directory for resource files */
+#define CLANG_RESOURCE_DIR ""
+
+/* Directories clang will search for headers */
+#define C_INCLUDE_DIRS ""
+
+/* Default <path> to all compiler invocations for --sysroot=<path>. */
+#define DEFAULT_SYSROOT ""
+
+/* Directory where gcc is installed. */
+#define GCC_INSTALL_PREFIX ""
+
+#endif
diff --git a/lib/ARCMigrate/Android.mk b/lib/ARCMigrate/Android.mk
new file mode 100644
index 0000000..c79b963
--- /dev/null
+++ b/lib/ARCMigrate/Android.mk
@@ -0,0 +1,47 @@
+LOCAL_PATH := $(call my-dir)
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := \
+  Attrs.inc \
+  AttrList.inc \
+  AttrParsedAttrList.inc    \
+  CommentNodes.inc \
+  DeclNodes.inc \
+  DiagnosticCommonKinds.inc \
+  DiagnosticGroups.inc \
+  DiagnosticSemaKinds.inc \
+  StmtNodes.inc
+
+clang_arc_migrate_SRC_FILES := \
+  ARCMT.cpp \
+  ARCMTActions.cpp \
+  FileRemapper.cpp \
+  ObjCMT.cpp \
+  PlistReporter.cpp \
+  TransAPIUses.cpp \
+  TransARCAssign.cpp \
+  TransAutoreleasePool.cpp \
+  TransBlockObjCVariable.cpp \
+  TransEmptyStatementsAndDealloc.cpp \
+  TransformActions.cpp \
+  Transforms.cpp \
+  TransGCAttrs.cpp \
+  TransGCCalls.cpp \
+  TransProperties.cpp \
+  TransRetainReleaseDealloc.cpp \
+  TransUnbridgedCasts.cpp \
+  TransUnusedInitDelegate.cpp \
+  TransZeroOutPropsInDealloc.cpp
+
+LOCAL_SRC_FILES := $(clang_arc_migrate_SRC_FILES)
+
+LOCAL_MODULE := libclangARCMigrate
+LOCAL_MODULE_TAGS := optional
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/AST/Android.mk b/lib/AST/Android.mk
new file mode 100644
index 0000000..9c7bfb3
--- /dev/null
+++ b/lib/AST/Android.mk
@@ -0,0 +1,91 @@
+LOCAL_PATH:= $(call my-dir)
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES :=    \
+	AttrDump.inc	\
+	AttrImpl.inc	\
+	AttrList.inc	\
+	Attrs.inc	\
+	CommentCommandInfo.inc \
+	CommentHTMLTags.inc \
+	CommentHTMLTagsProperties.inc \
+	CommentNodes.inc \
+	DeclNodes.inc	\
+	DiagnosticASTKinds.inc	\
+	DiagnosticCommentKinds.inc \
+	DiagnosticCommonKinds.inc	\
+	DiagnosticSemaKinds.inc	\
+	StmtNodes.inc
+
+clang_ast_SRC_FILES :=	\
+	APValue.cpp	\
+	ASTConsumer.cpp	\
+	ASTContext.cpp	\
+	ASTDiagnostic.cpp	\
+	ASTDumper.cpp	\
+	ASTImporter.cpp	\
+	AttrImpl.cpp	\
+	Comment.cpp \
+	CommentBriefParser.cpp \
+	CommentCommandTraits.cpp \
+	CommentDumper.cpp \
+	CommentLexer.cpp \
+	CommentParser.cpp \
+	CommentSema.cpp \
+	CXXInheritance.cpp	\
+	Decl.cpp	\
+	DeclarationName.cpp	\
+	DeclBase.cpp	\
+	DeclCXX.cpp	\
+	DeclFriend.cpp	\
+	DeclGroup.cpp	\
+	DeclObjC.cpp	\
+	DeclPrinter.cpp	\
+	DeclTemplate.cpp	\
+	DumpXML.cpp	\
+	Expr.cpp	\
+	ExprClassification.cpp	\
+	ExprConstant.cpp	\
+	ExprCXX.cpp	\
+	ExternalASTSource.cpp	\
+	InheritViz.cpp	\
+	ItaniumCXXABI.cpp	\
+	ItaniumMangle.cpp	\
+	LambdaMangleContext.cpp	\
+	Mangle.cpp	\
+	MicrosoftCXXABI.cpp	\
+	MicrosoftMangle.cpp	\
+	NestedNameSpecifier.cpp	\
+        NSAPI.cpp       \
+	ParentMap.cpp	\
+	RecordLayout.cpp	\
+	RecordLayoutBuilder.cpp	\
+	RawCommentList.cpp \
+	SelectorLocationsKind.cpp \
+	Stmt.cpp	\
+	StmtIterator.cpp	\
+	StmtPrinter.cpp	\
+	StmtProfile.cpp	\
+	StmtViz.cpp	\
+	TemplateBase.cpp	\
+	TemplateName.cpp	\
+	Type.cpp	\
+	TypeLoc.cpp	\
+	TypePrinter.cpp \
+	VTTBuilder.cpp \
+	VTableBuilder.cpp
+
+LOCAL_SRC_FILES := $(clang_ast_SRC_FILES)
+
+LOCAL_MODULE:= libclangAST
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE_TAGS := optional
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Analysis/Android.mk b/lib/Analysis/Android.mk
new file mode 100644
index 0000000..8af3726
--- /dev/null
+++ b/lib/Analysis/Android.mk
@@ -0,0 +1,48 @@
+LOCAL_PATH:= $(call my-dir)
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := \
+  AttrList.inc \
+  Attrs.inc \
+  CommentNodes.inc \
+  DeclNodes.inc \
+  DiagnosticCommonKinds.inc \
+  DiagnosticAnalysisKinds.inc \
+  StmtNodes.inc
+
+clang_analysis_SRC_FILES := \
+  AnalysisDeclContext.cpp \
+  BodyFarm.cpp \
+  CallGraph.cpp \
+  CFG.cpp \
+  CFGReachabilityAnalysis.cpp \
+  CFGStmtMap.cpp \
+  CocoaConventions.cpp \
+  Dominators.cpp \
+  FormatString.cpp \
+  LiveVariables.cpp \
+  ObjCNoReturn.cpp \
+  PostOrderCFGView.cpp \
+  PrintfFormatString.cpp \
+  ProgramPoint.cpp \
+  PseudoConstantAnalysis.cpp \
+  ReachableCode.cpp \
+  ScanfFormatString.cpp \
+  ThreadSafety.cpp \
+  UninitializedValues.cpp
+
+
+LOCAL_SRC_FILES := $(clang_analysis_SRC_FILES)
+
+LOCAL_MODULE:= libclangAnalysis
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE_TAGS := optional
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Analysis/NOTICE b/lib/Analysis/NOTICE
new file mode 100644
index 0000000..369204e
--- /dev/null
+++ b/lib/Analysis/NOTICE
@@ -0,0 +1,62 @@
+==============================================================================
+LLVM Release License
+==============================================================================
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2007-2011 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.
+
+==============================================================================
+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
+-------             ---------
+<none yet>
diff --git a/lib/Basic/Android.mk b/lib/Basic/Android.mk
new file mode 100644
index 0000000..671a0c2
--- /dev/null
+++ b/lib/Basic/Android.mk
@@ -0,0 +1,54 @@
+LOCAL_PATH:= $(call my-dir)
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := \
+  DiagnosticASTKinds.inc \
+  DiagnosticAnalysisKinds.inc \
+  DiagnosticCommentKinds.inc \
+  DiagnosticCommonKinds.inc \
+  DiagnosticDriverKinds.inc \
+  DiagnosticFrontendKinds.inc \
+  DiagnosticGroups.inc \
+  DiagnosticIndexName.inc \
+  DiagnosticLexKinds.inc \
+  DiagnosticParseKinds.inc \
+  DiagnosticSemaKinds.inc \
+  DiagnosticSerializationKinds.inc \
+  arm_neon.inc
+
+clang_basic_SRC_FILES := \
+  Builtins.cpp \
+  ConvertUTF.c \
+  ConvertUTFWrapper.cpp \
+  Diagnostic.cpp \
+  DiagnosticIDs.cpp \
+  FileManager.cpp \
+  FileSystemStatCache.cpp \
+  IdentifierTable.cpp \
+  LangOptions.cpp \
+  Module.cpp \
+  ObjCRuntime.cpp \
+  OperatorPrecedence.cpp \
+  SourceLocation.cpp \
+  SourceManager.cpp \
+  TargetInfo.cpp \
+  Targets.cpp \
+  TokenKinds.cpp \
+  Version.cpp \
+  VersionTuple.cpp
+
+LOCAL_SRC_FILES := $(clang_basic_SRC_FILES)
+
+LOCAL_MODULE:= libclangBasic
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE_TAGS := optional
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_VERSION_INC_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index ec57ca3..26ed090 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -3473,7 +3473,7 @@
                                  bool Enabled) const {
     if (Name == "soft-float" || Name == "soft-float-abi" ||
         Name == "vfp2" || Name == "vfp3" || Name == "vfp4" || Name == "neon" ||
-        Name == "d16" || Name == "neonfp") {
+        Name == "d16" || Name == "neonfp" || Name == "long64") {
       Features[Name] = Enabled;
     } else
       return false;
@@ -3497,6 +3497,8 @@
         FPU |= VFP4FPU;
       else if (Features[i] == "+neon")
         FPU |= NeonFPU;
+      else if (Features[i] == "+long64")
+        LongWidth = LongAlign = 64;  // RenderScript uses a 64-bit long type
     }
 
     // Remove front-end specific options which the backend handles differently.
diff --git a/lib/CodeGen/Android.mk b/lib/CodeGen/Android.mk
new file mode 100644
index 0000000..57cba76
--- /dev/null
+++ b/lib/CodeGen/Android.mk
@@ -0,0 +1,69 @@
+LOCAL_PATH:= $(call my-dir)
+
+clang_codegen_TBLGEN_TABLES := \
+  AttrList.inc \
+  Attrs.inc \
+  CommentNodes.inc \
+  DeclNodes.inc \
+  DiagnosticCommonKinds.inc \
+  DiagnosticFrontendKinds.inc \
+  StmtNodes.inc \
+  arm_neon.inc
+
+clang_codegen_SRC_FILES := \
+  BackendUtil.cpp \
+  CGBlocks.cpp \
+  CGBuiltin.cpp \
+  CGCUDANV.cpp \
+  CGCUDARuntime.cpp \
+  CGCXX.cpp \
+  CGCXXABI.cpp \
+  CGCall.cpp \
+  CGClass.cpp \
+  CGCleanup.cpp \
+  CGDebugInfo.cpp \
+  CGDecl.cpp \
+  CGDeclCXX.cpp \
+  CGException.cpp \
+  CGExpr.cpp \
+  CGExprAgg.cpp \
+  CGExprCXX.cpp \
+  CGExprComplex.cpp \
+  CGExprConstant.cpp \
+  CGExprScalar.cpp \
+  CGObjC.cpp \
+  CGObjCGNU.cpp \
+  CGObjCMac.cpp \
+  CGObjCRuntime.cpp \
+  CGOpenCLRuntime.cpp \
+  CGRTTI.cpp \
+  CGRecordLayoutBuilder.cpp \
+  CGStmt.cpp \
+  CGVTT.cpp \
+  CGVTables.cpp \
+  CodeGenAction.cpp \
+  CodeGenFunction.cpp \
+  CodeGenModule.cpp \
+  CodeGenTBAA.cpp \
+  CodeGenTypes.cpp \
+  ItaniumCXXABI.cpp \
+  MicrosoftCXXABI.cpp \
+  ModuleBuilder.cpp \
+  TargetInfo.cpp
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+LOCAL_MODULE:= libclangCodeGen
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := $(clang_codegen_SRC_FILES)
+TBLGEN_TABLES := $(clang_codegen_TBLGEN_TABLES)
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_VERSION_INC_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(LLVM_GEN_INTRINSICS_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
index b870ae9..d23e508 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -3475,12 +3475,9 @@
   if (const VectorType *VT = Ty->getAs<VectorType>()) {
     // Check whether VT is legal.
     unsigned NumElements = VT->getNumElements();
-    uint64_t Size = getContext().getTypeSize(VT);
     // NumElements should be power of 2.
-    if ((NumElements & (NumElements - 1)) != 0)
+    if (((NumElements & (NumElements - 1)) != 0) && NumElements != 3)
       return true;
-    // Size should be greater than 32 bits.
-    return Size <= 32;
   }
   return false;
 }
@@ -3505,8 +3502,8 @@
     TyAlign = std::min(std::max(TyAlign, (uint64_t)4), (uint64_t)8);
   else
     TyAlign = 4;
-  // Use indirect if size of the illegal vector is bigger than 16 bytes.
-  if (isIllegalVectorType(Ty) && Size > 16) {
+  // Use indirect if size of the illegal vector is bigger than 32 bytes.
+  if (isIllegalVectorType(Ty) && Size > 32) {
     IsIndirect = true;
     Size = 4;
     TyAlign = 4;
diff --git a/lib/Driver/Android.mk b/lib/Driver/Android.mk
new file mode 100644
index 0000000..7a3ec43
--- /dev/null
+++ b/lib/Driver/Android.mk
@@ -0,0 +1,44 @@
+LOCAL_PATH:= $(call my-dir)
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := \
+  DiagnosticCommonKinds.inc \
+  DiagnosticDriverKinds.inc \
+  Options.inc \
+  CC1Options.inc \
+  CC1AsOptions.inc
+
+clang_driver_SRC_FILES := \
+  Action.cpp \
+  Arg.cpp \
+  ArgList.cpp \
+  CC1AsOptions.cpp \
+  Compilation.cpp \
+  Driver.cpp \
+  DriverOptions.cpp \
+  Job.cpp \
+  Option.cpp \
+  OptTable.cpp \
+  Phases.cpp \
+  Tool.cpp \
+  ToolChain.cpp \
+  ToolChains.cpp \
+  Tools.cpp \
+  Types.cpp \
+  WindowsToolChain.cpp
+
+LOCAL_SRC_FILES := $(clang_driver_SRC_FILES)
+
+LOCAL_MODULE := libclangDriver
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE_TAGS := optional
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(CLANG_VERSION_INC_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Edit/Android.mk b/lib/Edit/Android.mk
new file mode 100644
index 0000000..765fdb5
--- /dev/null
+++ b/lib/Edit/Android.mk
@@ -0,0 +1,31 @@
+LOCAL_PATH:= $(call my-dir)
+
+clang_edit_SRC_FILES := \
+  Commit.cpp \
+  EditedSource.cpp \
+  RewriteObjCFoundationAPI.cpp
+
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := \
+  Attrs.inc \
+  AttrList.inc \
+  CommentNodes.inc \
+  DeclNodes.inc \
+  DiagnosticCommonKinds.inc \
+  StmtNodes.inc
+
+LOCAL_SRC_FILES := $(clang_edit_SRC_FILES)
+
+LOCAL_MODULE:= libclangEdit
+
+LOCAL_MODULE_TAGS := optional
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_VERSION_INC_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Frontend/Android.mk b/lib/Frontend/Android.mk
new file mode 100644
index 0000000..c5ce90e
--- /dev/null
+++ b/lib/Frontend/Android.mk
@@ -0,0 +1,64 @@
+LOCAL_PATH:= $(call my-dir)
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := \
+  AttrList.inc \
+  Attrs.inc \
+  AttrParsedAttrList.inc \
+  CC1Options.inc \
+  CommentNodes.inc \
+  DiagnosticASTKinds.inc \
+  DiagnosticCommonKinds.inc \
+  DiagnosticDriverKinds.inc \
+  DiagnosticFrontendKinds.inc \
+  DiagnosticLexKinds.inc \
+  DiagnosticSemaKinds.inc \
+  DeclNodes.inc \
+  StmtNodes.inc
+
+clang_frontend_SRC_FILES := \
+  ASTConsumers.cpp \
+  ASTMerge.cpp \
+  ASTUnit.cpp \
+  CacheTokens.cpp \
+  ChainedDiagnosticConsumer.cpp \
+  ChainedIncludesSource.cpp \
+  CompilerInstance.cpp \
+  CompilerInvocation.cpp \
+  CreateInvocationFromCommandLine.cpp \
+  DependencyFile.cpp \
+  DependencyGraph.cpp \
+  DiagnosticRenderer.cpp \
+  FrontendAction.cpp \
+  FrontendActions.cpp \
+  FrontendOptions.cpp \
+  HeaderIncludeGen.cpp \
+  InitHeaderSearch.cpp \
+  InitPreprocessor.cpp \
+  LangStandards.cpp \
+  LayoutOverrideSource.cpp \
+  LogDiagnosticPrinter.cpp \
+  MultiplexConsumer.cpp \
+  PrintPreprocessedOutput.cpp \
+  SerializedDiagnosticPrinter.cpp \
+  TextDiagnostic.cpp \
+  TextDiagnosticBuffer.cpp \
+  TextDiagnosticPrinter.cpp \
+  Warnings.cpp \
+  VerifyDiagnosticConsumer.cpp
+
+LOCAL_SRC_FILES := $(clang_frontend_SRC_FILES)
+
+LOCAL_MODULE:= libclangFrontend
+LOCAL_MODULE_TAGS:= optional
+
+LOCAL_MODULE_TAGS := optional
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(CLANG_VERSION_INC_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/FrontendTool/Android.mk b/lib/FrontendTool/Android.mk
new file mode 100644
index 0000000..2496f6b
--- /dev/null
+++ b/lib/FrontendTool/Android.mk
@@ -0,0 +1,24 @@
+LOCAL_PATH:= $(call my-dir)
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+LOCAL_MODULE:= libclangFrontendTool
+
+LOCAL_MODULE_TAGS := optional
+
+TBLGEN_TABLES := \
+  DiagnosticCommonKinds.inc \
+  DiagnosticFrontendKinds.inc \
+  CC1Options.inc
+
+clang_frontend_tool_SRC_FILES := \
+  ExecuteCompilerInvocation.cpp
+
+LOCAL_SRC_FILES := $(clang_frontend_tool_SRC_FILES)
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Headers/Android.mk b/lib/Headers/Android.mk
new file mode 100644
index 0000000..117129e
--- /dev/null
+++ b/lib/Headers/Android.mk
@@ -0,0 +1,11 @@
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+$(TARGET_OUT_HEADERS)/clang/arm_neon.h: TBLGEN_LOCAL_MODULE := arm_neon.h
+$(TARGET_OUT_HEADERS)/clang/arm_neon.h: $(CLANG_ROOT_PATH)/include/clang/Basic/arm_neon.td \
+    | $(CLANG_TBLGEN)
+	$(call transform-host-clang-td-to-out,arm-neon)
+
+# Make sure when clang is used, arm_neon.h does exist.
+$(CLANG): | $(TARGET_OUT_HEADERS)/clang/arm_neon.h
diff --git a/lib/Lex/Android.mk b/lib/Lex/Android.mk
new file mode 100644
index 0000000..f3e294f
--- /dev/null
+++ b/lib/Lex/Android.mk
@@ -0,0 +1,46 @@
+LOCAL_PATH:= $(call my-dir)
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := \
+  DiagnosticLexKinds.inc \
+  DiagnosticCommonKinds.inc \
+  AttrSpellings.inc
+
+clang_lex_SRC_FILES := \
+  HeaderMap.cpp \
+  HeaderSearch.cpp \
+  Lexer.cpp \
+  LiteralSupport.cpp \
+  MacroArgs.cpp \
+  MacroInfo.cpp \
+  ModuleMap.cpp \
+  PPCaching.cpp \
+  PPCallbacks.cpp \
+  PPConditionalDirectiveRecord.cpp \
+  PPDirectives.cpp \
+  PPExpressions.cpp \
+  PPLexerChange.cpp \
+  PPMacroExpansion.cpp \
+  PTHLexer.cpp \
+  Pragma.cpp \
+  PreprocessingRecord.cpp \
+  Preprocessor.cpp \
+  PreprocessorLexer.cpp \
+  ScratchBuffer.cpp \
+  TokenConcatenation.cpp \
+  TokenLexer.cpp
+
+LOCAL_SRC_FILES := $(clang_lex_SRC_FILES)
+
+LOCAL_MODULE:= libclangLex
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE_TAGS := optional
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Parse/Android.mk b/lib/Parse/Android.mk
new file mode 100644
index 0000000..00073f1
--- /dev/null
+++ b/lib/Parse/Android.mk
@@ -0,0 +1,44 @@
+LOCAL_PATH:= $(call my-dir)
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES :=  \
+	AttrList.inc  \
+	AttrLateParsed.inc  \
+	AttrParsedAttrList.inc  \
+	Attrs.inc  \
+	CommentNodes.inc \
+	DeclNodes.inc  \
+	DiagnosticParseKinds.inc  \
+        DiagnosticCommonKinds.inc  \
+	DiagnosticSemaKinds.inc	\
+	StmtNodes.inc
+
+clang_parse_SRC_FILES :=  \
+	ParseAST.cpp  \
+	ParseCXXInlineMethods.cpp  \
+	ParseDecl.cpp  \
+	ParseDeclCXX.cpp  \
+	ParseExpr.cpp  \
+	ParseExprCXX.cpp  \
+	ParseInit.cpp  \
+	ParseObjc.cpp  \
+	ParsePragma.cpp  \
+	ParseStmt.cpp  \
+	ParseTemplate.cpp  \
+	ParseTentative.cpp  \
+	Parser.cpp
+
+LOCAL_SRC_FILES := $(clang_parse_SRC_FILES)
+
+LOCAL_MODULE:= libclangParse
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE_TAGS := optional
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Rewrite/Core/Android.mk b/lib/Rewrite/Core/Android.mk
new file mode 100644
index 0000000..546fc04
--- /dev/null
+++ b/lib/Rewrite/Core/Android.mk
@@ -0,0 +1,34 @@
+LOCAL_PATH:= $(call my-dir)
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+LOCAL_MODULE:= libclangRewriteCore
+
+LOCAL_MODULE_TAGS := optional
+
+TBLGEN_TABLES := \
+  AttrList.inc \
+  Attrs.inc \
+  AttrParsedAttrList.inc \
+  CommentNodes.inc \
+  DeclNodes.inc \
+  DiagnosticCommonKinds.inc \
+  DiagnosticFrontendKinds.inc \
+  StmtNodes.inc
+
+clang_rewrite_core_SRC_FILES := \
+  DeltaTree.cpp \
+  HTMLRewrite.cpp \
+  RewriteRope.cpp \
+  Rewriter.cpp \
+  TokenRewriter.cpp
+
+LOCAL_SRC_FILES := $(clang_rewrite_core_SRC_FILES)
+
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Rewrite/Frontend/Android.mk b/lib/Rewrite/Frontend/Android.mk
new file mode 100644
index 0000000..8d15425
--- /dev/null
+++ b/lib/Rewrite/Frontend/Android.mk
@@ -0,0 +1,37 @@
+LOCAL_PATH:= $(call my-dir)
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+LOCAL_MODULE:= libclangRewriteFrontend
+
+LOCAL_MODULE_TAGS := optional
+
+TBLGEN_TABLES := \
+  AttrList.inc \
+  Attrs.inc \
+  AttrParsedAttrList.inc \
+  CommentNodes.inc \
+  DeclNodes.inc \
+  DiagnosticCommonKinds.inc \
+  DiagnosticFrontendKinds.inc \
+  StmtNodes.inc
+
+clang_rewrite_frontend_SRC_FILES := \
+  FixItRewriter.cpp \
+  FrontendActions.cpp \
+  HTMLPrint.cpp \
+  InclusionRewriter.cpp \
+  RewriteMacros.cpp \
+  RewriteModernObjC.cpp \
+  RewriteObjC.cpp \
+  RewriteTest.cpp
+
+LOCAL_SRC_FILES := $(clang_rewrite_frontend_SRC_FILES)
+
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Sema/Android.mk b/lib/Sema/Android.mk
new file mode 100644
index 0000000..ed7246d
--- /dev/null
+++ b/lib/Sema/Android.mk
@@ -0,0 +1,79 @@
+LOCAL_PATH:= $(call my-dir)
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES :=    \
+	AttrList.inc	\
+	Attrs.inc	\
+	AttrParsedAttrKinds.inc    \
+	AttrParsedAttrList.inc    \
+	AttrTemplateInstantiate.inc	\
+	CommentNodes.inc \
+	DeclNodes.inc	\
+	DiagnosticASTKinds.inc	\
+	DiagnosticSemaKinds.inc	\
+	DiagnosticParseKinds.inc	\
+	DiagnosticCommentKinds.inc \
+	DiagnosticCommonKinds.inc	\
+	StmtNodes.inc	\
+	arm_neon.inc
+
+clang_sema_SRC_FILES :=	\
+	AnalysisBasedWarnings.cpp	\
+	AttributeList.cpp	\
+	CodeCompleteConsumer.cpp	\
+	DeclSpec.cpp	\
+	IdentifierResolver.cpp	\
+	DelayedDiagnostic.cpp \
+	JumpDiagnostics.cpp	\
+	MultiplexExternalSemaSource.cpp \
+	Scope.cpp \
+	ScopeInfo.cpp \
+	Sema.cpp	\
+	SemaAccess.cpp	\
+	SemaAttr.cpp	\
+	SemaCXXScopeSpec.cpp	\
+	SemaCast.cpp \
+	SemaChecking.cpp	\
+	SemaCodeComplete.cpp	\
+	SemaConsumer.cpp	\
+	SemaDecl.cpp	\
+	SemaDeclAttr.cpp	\
+	SemaDeclCXX.cpp	\
+	SemaDeclObjC.cpp	\
+	SemaExceptionSpec.cpp	\
+	SemaExpr.cpp	\
+	SemaExprCXX.cpp	\
+	SemaExprMember.cpp \
+	SemaExprObjC.cpp	\
+	SemaFixItUtils.cpp \
+	SemaInit.cpp	\
+	SemaLambda.cpp	\
+	SemaLookup.cpp	\
+	SemaObjCProperty.cpp	\
+	SemaOverload.cpp	\
+	SemaPseudoObject.cpp	\
+	SemaStmt.cpp	\
+        SemaStmtAsm.cpp \
+        SemaStmtAttr.cpp \
+	SemaTemplate.cpp	\
+	SemaTemplateDeduction.cpp	\
+	SemaTemplateInstantiate.cpp	\
+	SemaTemplateInstantiateDecl.cpp	\
+	SemaTemplateVariadic.cpp	\
+	SemaType.cpp	\
+	TargetAttributesSema.cpp
+
+LOCAL_SRC_FILES := $(clang_sema_SRC_FILES)
+
+LOCAL_MODULE:= libclangSema
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE_TAGS := optional
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 25202b1..2b85525 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -1058,7 +1058,7 @@
   // check the attribute arguments.
   if (!checkAttributeNumArgs(S, Attr, 0))
     return;
-  
+
   if (!checkIBOutletCommon(S, D, Attr))
     return;
 
@@ -1082,8 +1082,8 @@
   IdentifierInfo *II = Attr.getParameterName();
   if (!II)
     II = &S.Context.Idents.get("NSObject");
-  
-  ParsedType TypeRep = S.getTypeName(*II, Attr.getLoc(), 
+
+  ParsedType TypeRep = S.getTypeName(*II, Attr.getLoc(),
                         S.getScopeForContext(D->getDeclContext()->getParent()));
   if (!TypeRep) {
     S.Diag(Attr.getLoc(), diag::err_iboutletcollection_type) << II;
@@ -1245,7 +1245,7 @@
     // Is the function argument a pointer type?
     QualType T = getFunctionOrMethodArgType(D, x).getNonReferenceType();
     possibleTransparentUnionPointerType(T);
-    
+
     if (!T->isAnyPointerType() && !T->isBlockPointerType()) {
       // FIXME: Should also highlight argument in decl.
       S.Diag(Attr.getLoc(), diag::warn_nonnull_pointers_only)
@@ -1755,13 +1755,13 @@
 
 static void handleAnalyzerNoReturnAttr(Sema &S, Decl *D,
                                        const AttributeList &Attr) {
-  
+
   // The checking path for 'noreturn' and 'analyzer_noreturn' are different
   // because 'analyzer_noreturn' does not impact the type.
-  
+
   if(!checkAttributeNumArgs(S, Attr, 0))
       return;
-  
+
   if (!isFunctionOrMethod(D) && !isa<BlockDecl>(D)) {
     ValueDecl *VD = dyn_cast<ValueDecl>(D);
     if (VD == 0 || (!VD->getType()->isBlockPointerType()
@@ -1800,20 +1800,20 @@
 static void handleVecReturnAttr(Sema &S, Decl *D, const AttributeList &Attr) {
 /*
   Returning a Vector Class in Registers
-  
-  According to the PPU ABI specifications, a class with a single member of 
+
+  According to the PPU ABI specifications, a class with a single member of
   vector type is returned in memory when used as the return value of a function.
   This results in inefficient code when implementing vector classes. To return
   the value in a single vector register, add the vecreturn attribute to the
   class definition. This attribute is also applicable to struct types.
-  
+
   Example:
-  
+
   struct Vector
   {
     __vector float xyzw;
   } __attribute__((vecreturn));
-  
+
   Vector Add(Vector lhs, Vector rhs)
   {
     Vector result;
@@ -2028,7 +2028,7 @@
                                       Attr.getAttributeSpellingListIndex()));
 }
 
-static void handleArcWeakrefUnavailableAttr(Sema &S, Decl *D, 
+static void handleArcWeakrefUnavailableAttr(Sema &S, Decl *D,
                                             const AttributeList &Attr) {
   unsigned NumArgs = Attr.getNumArgs();
   if (NumArgs > 0) {
@@ -2041,13 +2041,13 @@
                                        Attr.getAttributeSpellingListIndex()));
 }
 
-static void handleObjCRootClassAttr(Sema &S, Decl *D, 
+static void handleObjCRootClassAttr(Sema &S, Decl *D,
                                     const AttributeList &Attr) {
   if (!isa<ObjCInterfaceDecl>(D)) {
     S.Diag(Attr.getLoc(), diag::err_attribute_requires_objc_interface);
     return;
   }
-  
+
   unsigned NumArgs = Attr.getNumArgs();
   if (NumArgs > 0) {
     S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 0;
@@ -2065,7 +2065,7 @@
     S.Diag(Attr.getLoc(), diag::err_suppress_autosynthesis);
     return;
   }
-  
+
   unsigned NumArgs = Attr.getNumArgs();
   if (NumArgs > 0) {
     S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 0;
@@ -2277,7 +2277,7 @@
   AvailabilityChange Obsoleted = Attr.getAvailabilityObsoleted();
   bool IsUnavailable = Attr.getUnavailableLoc().isValid();
   StringRef Str;
-  const StringLiteral *SE = 
+  const StringLiteral *SE =
     dyn_cast_or_null<const StringLiteral>(Attr.getMessageExpr());
   if (SE)
     Str = SE->getString();
@@ -2434,7 +2434,7 @@
     return;
   }
 
-  if (family == ObjCMethodFamilyAttr::OMF_init && 
+  if (family == ObjCMethodFamilyAttr::OMF_init &&
       !method->getResultType()->isObjCObjectPointerType()) {
     S.Diag(method->getLocation(), diag::err_init_method_bad_return_type)
       << method->getResultType();
@@ -2487,7 +2487,7 @@
     //  @property (retain, nonatomic) struct Bork *Q __attribute__((NSObject));
     //
     // In this case it follows tradition and suppresses an error in the above
-    // case.    
+    // case.
     S.Diag(D->getLocation(), diag::warn_nsobject_attribute);
   }
   D->addAttr(::new (S.Context)
@@ -2716,7 +2716,7 @@
 // Handles reqd_work_group_size and work_group_size_hint.
 static void handleWorkGroupSize(Sema &S, Decl *D,
                                 const AttributeList &Attr) {
-  assert(Attr.getKind() == AttributeList::AT_ReqdWorkGroupSize 
+  assert(Attr.getKind() == AttributeList::AT_ReqdWorkGroupSize
       || Attr.getKind() == AttributeList::AT_WorkGroupSizeHint);
 
   // Attribute has 3 arguments.
@@ -2825,7 +2825,7 @@
     S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
     return;
   }
-  
+
   if (NoThrowAttr *Existing = D->getAttr<NoThrowAttr>()) {
     if (Existing->getLocation().isInvalid())
       Existing->setRange(Attr.getRange());
@@ -3037,7 +3037,7 @@
     S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
     return;
   }
-  
+
   if (!isa<VarDecl>(D) || S.getCurFunctionOrMethodDecl()) {
     S.Diag(Attr.getLoc(), diag::err_init_priority_object_attr);
     Attr.setInvalid();
@@ -3051,14 +3051,14 @@
     Attr.setInvalid();
     return;
   }
-  
+
   if (Attr.getNumArgs() != 1) {
     S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 1;
     Attr.setInvalid();
     return;
   }
   Expr *priorityExpr = Attr.getArg(0);
-  
+
   llvm::APSInt priority(32);
   if (priorityExpr->isTypeDependent() || priorityExpr->isValueDependent() ||
       !priorityExpr->isIntegerConstantExpr(priority, S.Context)) {
@@ -3138,10 +3138,10 @@
 
   // Check for supported formats.
   FormatAttrKind Kind = getFormatAttrKind(Format);
-  
+
   if (Kind == IgnoredFormat)
     return;
-  
+
   if (Kind == InvalidFormat) {
     S.Diag(Attr.getLoc(), diag::warn_attribute_type_not_supported)
       << "format" << Attr.getParameterName()->getName();
@@ -3735,6 +3735,14 @@
                                       Attr.getAttributeSpellingListIndex()));
 }
 
+static void handleKernelAttr(Sema &S, Decl *D, const AttributeList &Attr) {
+  if (S.LangOpts.Renderscript) {
+    D->addAttr(::new (S.Context) KernelAttr(Attr.getRange(), S.Context));
+  } else {
+    S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "kernel";
+  }
+}
+
 static void handleConstantAttr(Sema &S, Decl *D, const AttributeList &Attr) {
   if (S.LangOpts.CUDA) {
     // check the attribute arguments.
@@ -4201,13 +4209,13 @@
 //===----------------------------------------------------------------------===//
 
 static bool isValidSubjectOfNSAttribute(Sema &S, QualType type) {
-  return type->isDependentType() || 
-         type->isObjCObjectPointerType() || 
+  return type->isDependentType() ||
+         type->isObjCObjectPointerType() ||
          S.Context.isObjCNSObjectType(type);
 }
 static bool isValidSubjectOfCFAttribute(Sema &S, QualType type) {
-  return type->isDependentType() || 
-         type->isPointerType() || 
+  return type->isDependentType() ||
+         type->isPointerType() ||
          isValidSubjectOfNSAttribute(S, type);
 }
 
@@ -4347,7 +4355,7 @@
 
   // Check that the method returns a normal pointer.
   QualType resultType = method->getResultType();
-    
+
   if (!resultType->isReferenceType() &&
       (!resultType->isPointerType() || resultType->isObjCRetainableType())) {
     S.Diag(method->getLocStart(), diag::warn_ns_attribute_wrong_return_type)
@@ -4635,6 +4643,7 @@
   case AttributeList::AT_CUDADevice:  handleDeviceAttr      (S, D, Attr); break;
   case AttributeList::AT_CUDAHost:    handleHostAttr        (S, D, Attr); break;
   case AttributeList::AT_Overloadable:handleOverloadableAttr(S, D, Attr); break;
+  case AttributeList::AT_Kernel:      handleKernelAttr      (S, D, Attr); break;
   default:
     break;
   }
@@ -4659,6 +4668,7 @@
   case AttributeList::AT_CUDADevice:
   case AttributeList::AT_CUDAHost:
   case AttributeList::AT_Overloadable:
+  case AttributeList::AT_Kernel:
     // Ignore, this is a non-inheritable attribute, handled
     // by ProcessNonInheritableDeclAttr.
     break;
@@ -4750,22 +4760,22 @@
   case AttributeList::AT_ReqdWorkGroupSize:
     handleWorkGroupSize(S, D, Attr); break;
 
-  case AttributeList::AT_InitPriority: 
+  case AttributeList::AT_InitPriority:
       handleInitPriorityAttr(S, D, Attr); break;
-      
+
   case AttributeList::AT_Packed:      handlePackedAttr      (S, D, Attr); break;
   case AttributeList::AT_Section:     handleSectionAttr     (S, D, Attr); break;
   case AttributeList::AT_Unavailable:
     handleAttrWithMessage<UnavailableAttr>(S, D, Attr, "unavailable");
     break;
-  case AttributeList::AT_ArcWeakrefUnavailable: 
-    handleArcWeakrefUnavailableAttr (S, D, Attr); 
+  case AttributeList::AT_ArcWeakrefUnavailable:
+    handleArcWeakrefUnavailableAttr (S, D, Attr);
     break;
   case AttributeList::AT_ObjCRootClass:
     handleObjCRootClassAttr(S, D, Attr);
     break;
-  case AttributeList::AT_ObjCRequiresPropertyDefs: 
-    handleObjCRequiresPropertyDefsAttr (S, D, Attr); 
+  case AttributeList::AT_ObjCRequiresPropertyDefs:
+    handleObjCRequiresPropertyDefsAttr (S, D, Attr);
     break;
   case AttributeList::AT_Unused:      handleUnusedAttr      (S, D, Attr); break;
   case AttributeList::AT_ReturnsTwice:
@@ -4919,8 +4929,8 @@
     // Ask target about the attribute.
     const TargetAttributesSema &TargetAttrs = S.getTargetAttributesSema();
     if (!TargetAttrs.ProcessDeclAttribute(scope, D, Attr, S))
-      S.Diag(Attr.getLoc(), Attr.isDeclspecAttribute() ? 
-             diag::warn_unhandled_ms_attribute_ignored : 
+      S.Diag(Attr.getLoc(), Attr.isDeclspecAttribute() ?
+             diag::warn_unhandled_ms_attribute_ignored :
              diag::warn_unknown_attribute_ignored) << Attr.getName();
     break;
   }
@@ -5161,9 +5171,9 @@
   if (S.getLangOpts().ObjCAutoRefCount)
     if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(decl)) {
       // FIXME: we may want to suppress diagnostics for all
-      // kind of forbidden type messages on unavailable functions. 
+      // kind of forbidden type messages on unavailable functions.
       if (FD->hasAttr<UnavailableAttr>() &&
-          diag.getForbiddenTypeDiagnostic() == 
+          diag.getForbiddenTypeDiagnostic() ==
           diag::err_arc_array_param_no_ownership) {
         diag.Triggered = true;
         return;
@@ -5286,7 +5296,7 @@
                                   const ObjCPropertyDecl  *ObjCProperty) {
   // Delay if we're currently parsing a declaration.
   if (DelayedDiagnostics.shouldDelayDiagnostics()) {
-    DelayedDiagnostics.add(DelayedDiagnostic::makeDeprecation(Loc, D, 
+    DelayedDiagnostics.add(DelayedDiagnostic::makeDeprecation(Loc, D,
                                                               UnknownObjCClass,
                                                               ObjCProperty,
                                                               Message));
diff --git a/lib/Sema/SemaExprMember.cpp b/lib/Sema/SemaExprMember.cpp
index 7b016c6..34a428e 100644
--- a/lib/Sema/SemaExprMember.cpp
+++ b/lib/Sema/SemaExprMember.cpp
@@ -248,6 +248,20 @@
   llvm_unreachable("unexpected instance member access kind");
 }
 
+/// Determine whether input char is from rgba component set.
+static bool
+IsRGBA(char c) {
+  switch (c) {
+  case 'r':
+  case 'g':
+  case 'b':
+  case 'a':
+    return true;
+  default:
+    return false;
+  }
+}
+
 /// Check an ext-vector component access expression.
 ///
 /// VK should be set in advance to the value kind of the base
@@ -287,7 +301,12 @@
     HalvingSwizzle = true;
   } else if (!HexSwizzle &&
              (Idx = vecType->getPointAccessorIdx(*compStr)) != -1) {
+    bool HasRGBA = IsRGBA(*compStr);
     do {
+      // If we mix/match rgba with xyzw, break to signal that we encountered
+      // an illegal name.
+      if (HasRGBA != IsRGBA(*compStr))
+        break;
       if (HasIndex[Idx]) HasRepeated = true;
       HasIndex[Idx] = true;
       compStr++;
diff --git a/lib/Serialization/Android.mk b/lib/Serialization/Android.mk
new file mode 100644
index 0000000..01656d9
--- /dev/null
+++ b/lib/Serialization/Android.mk
@@ -0,0 +1,44 @@
+LOCAL_PATH:= $(call my-dir)
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+LOCAL_MODULE:= libclangSerialization
+
+LOCAL_MODULE_TAGS := optional
+
+TBLGEN_TABLES := \
+  AttrList.inc \
+  AttrParsedAttrList.inc \
+  AttrPCHRead.inc \
+  AttrPCHWrite.inc \
+  Attrs.inc \
+  CommentNodes.inc \
+  DeclNodes.inc \
+  DiagnosticCommonKinds.inc \
+  DiagnosticFrontendKinds.inc \
+  DiagnosticSemaKinds.inc \
+  DiagnosticSerializationKinds.inc \
+  StmtNodes.inc
+
+clang_serialization_SRC_FILES :=\
+  GeneratePCH.cpp \
+  ASTCommon.cpp \
+  ASTReader.cpp \
+  ASTReaderDecl.cpp \
+  ASTReaderStmt.cpp \
+  ASTWriter.cpp \
+  ASTWriterDecl.cpp \
+  ASTWriterStmt.cpp \
+  Module.cpp \
+  ModuleManager.cpp
+
+LOCAL_SRC_FILES := $(clang_serialization_SRC_FILES)
+
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(CLANG_VERSION_INC_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/StaticAnalyzer/Checkers/Android.mk b/lib/StaticAnalyzer/Checkers/Android.mk
new file mode 100644
index 0000000..1821920
--- /dev/null
+++ b/lib/StaticAnalyzer/Checkers/Android.mk
@@ -0,0 +1,94 @@
+LOCAL_PATH:= $(call my-dir)
+
+clang_static_analyzer_checkers_TBLGEN_TABLES := \
+  AttrKinds.inc \
+  AttrList.inc \
+  AttrParsedAttrList.inc \
+  Attrs.inc \
+  Checkers.inc \
+  CommentNodes.inc \
+  DeclNodes.inc \
+  DiagnosticCommonKinds.inc \
+  StmtNodes.inc
+
+clang_static_analyzer_checkers_SRC_FILES := \
+  AnalyzerStatsChecker.cpp \
+  ArrayBoundChecker.cpp \
+  ArrayBoundCheckerV2.cpp \
+  AttrNonNullChecker.cpp \
+  BasicObjCFoundationChecks.cpp \
+  BoolAssignmentChecker.cpp \
+  BuiltinFunctionChecker.cpp \
+  CStringChecker.cpp \
+  CStringSyntaxChecker.cpp \
+  CallAndMessageChecker.cpp \
+  CastSizeChecker.cpp \
+  CastToStructChecker.cpp \
+  CheckObjCDealloc.cpp \
+  CheckObjCInstMethSignature.cpp \
+  CheckSecuritySyntaxOnly.cpp \
+  CheckSizeofPointer.cpp \
+  CheckerDocumentation.cpp \
+  ChrootChecker.cpp \
+  ClangCheckers.cpp \
+  CommonBugCategories.cpp \
+  DeadStoresChecker.cpp \
+  DebugCheckers.cpp \
+  DereferenceChecker.cpp \
+  DivZeroChecker.cpp \
+  DynamicTypePropagation.cpp \
+  ExprInspectionChecker.cpp \
+  FixedAddressChecker.cpp \
+  GenericTaintChecker.cpp \
+  IdempotentOperationChecker.cpp \
+  LLVMConventionsChecker.cpp \
+  MacOSKeychainAPIChecker.cpp \
+  MacOSXAPIChecker.cpp \
+  MallocChecker.cpp \
+  MallocOverflowSecurityChecker.cpp \
+  MallocSizeofChecker.cpp \
+  NSAutoreleasePoolChecker.cpp \
+  NSErrorChecker.cpp \
+  NoReturnFunctionChecker.cpp \
+  ObjCAtSyncChecker.cpp \
+  ObjCContainersASTChecker.cpp \
+  ObjCContainersChecker.cpp \
+  ObjCSelfInitChecker.cpp \
+  ObjCUnusedIVarsChecker.cpp \
+  PointerArithChecker.cpp \
+  PointerSubChecker.cpp \
+  PthreadLockChecker.cpp \
+  RetainCountChecker.cpp \
+  ReturnPointerRangeChecker.cpp \
+  ReturnUndefChecker.cpp \
+  StackAddrEscapeChecker.cpp \
+  StreamChecker.cpp \
+  TaintTesterChecker.cpp \
+  TraversalChecker.cpp \
+  UndefBranchChecker.cpp \
+  UndefCapturedBlockVarChecker.cpp \
+  UndefResultChecker.cpp \
+  UndefinedArraySubscriptChecker.cpp \
+  UndefinedAssignmentChecker.cpp \
+  UnixAPIChecker.cpp \
+  UnreachableCodeChecker.cpp \
+  VirtualCallChecker.cpp \
+  VLASizeChecker.cpp
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := $(clang_static_analyzer_checkers_TBLGEN_TABLES)
+
+LOCAL_SRC_FILES := $(clang_static_analyzer_checkers_SRC_FILES)
+
+LOCAL_MODULE:= libclangStaticAnalyzerCheckers
+
+LOCAL_MODULE_TAGS := optional
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(CLANG_VERSION_INC_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/StaticAnalyzer/Core/Android.mk b/lib/StaticAnalyzer/Core/Android.mk
new file mode 100644
index 0000000..57bfb0b
--- /dev/null
+++ b/lib/StaticAnalyzer/Core/Android.mk
@@ -0,0 +1,67 @@
+LOCAL_PATH:= $(call my-dir)
+
+clang_static_analyzer_core_TBLGEN_TABLES := \
+  AttrList.inc \
+  Attrs.inc \
+  CommentNodes.inc \
+  DeclNodes.inc \
+  DiagnosticCommonKinds.inc \
+  StmtNodes.inc
+
+clang_static_analyzer_core_SRC_FILES := \
+  AnalysisManager.cpp \
+  AnalyzerOptions.cpp \
+  APSIntType.cpp \
+  BasicValueFactory.cpp \
+  BlockCounter.cpp \
+  BugReporter.cpp \
+  BugReporterVisitors.cpp \
+  CallEvent.cpp \
+  Checker.cpp \
+  CheckerContext.cpp \
+  CheckerHelpers.cpp \
+  CheckerManager.cpp \
+  CheckerRegistry.cpp \
+  ConstraintManager.cpp \
+  CoreEngine.cpp \
+  Environment.cpp \
+  ExplodedGraph.cpp \
+  ExprEngine.cpp \
+  ExprEngineC.cpp \
+  ExprEngineCXX.cpp \
+  ExprEngineCallAndReturn.cpp \
+  ExprEngineObjC.cpp \
+  FunctionSummary.cpp \
+  HTMLDiagnostics.cpp \
+  MemRegion.cpp \
+  PathDiagnostic.cpp \
+  PlistDiagnostics.cpp \
+  ProgramState.cpp \
+  RangeConstraintManager.cpp \
+  RegionStore.cpp \
+  SValBuilder.cpp \
+  SVals.cpp \
+  SimpleConstraintManager.cpp \
+  SimpleSValBuilder.cpp \
+  Store.cpp \
+  SubEngine.cpp \
+  SymbolManager.cpp \
+  TextPathDiagnostics.cpp
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := $(clang_static_analyzer_core_TBLGEN_TABLES)
+
+LOCAL_SRC_FILES := $(clang_static_analyzer_core_SRC_FILES)
+
+LOCAL_MODULE:= libclangStaticAnalyzerCore
+
+LOCAL_MODULE_TAGS := optional
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(CLANG_VERSION_INC_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/StaticAnalyzer/Frontend/Android.mk b/lib/StaticAnalyzer/Frontend/Android.mk
new file mode 100644
index 0000000..e7c6664
--- /dev/null
+++ b/lib/StaticAnalyzer/Frontend/Android.mk
@@ -0,0 +1,38 @@
+LOCAL_PATH:= $(call my-dir)
+
+clang_static_analyzer_frontend_C_INCLUDES := \
+  $(CLANG_ROOT_PATH)/lib/StaticAnalyzer/Checkers
+
+clang_static_analyzer_frontend_TBLGEN_TABLES := \
+  AttrList.inc \
+  Attrs.inc \
+  CommentNodes.inc \
+  DeclNodes.inc \
+  DiagnosticCommonKinds.inc \
+  DiagnosticFrontendKinds.inc \
+  StmtNodes.inc
+
+clang_static_analyzer_frontend_SRC_FILES := \
+  AnalysisConsumer.cpp \
+  CheckerRegistration.cpp \
+  FrontendActions.cpp
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := $(clang_static_analyzer_frontend_TBLGEN_TABLES)
+
+LOCAL_SRC_FILES := $(clang_static_analyzer_frontend_SRC_FILES)
+
+LOCAL_C_INCLUDES := $(clang_static_analyzer_frontend_C_INCLUDES)
+
+LOCAL_MODULE:= libclangStaticAnalyzerFrontend
+
+LOCAL_MODULE_TAGS := optional
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(CLANG_VERSION_INC_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/include b/lib/include
new file mode 120000
index 0000000..74ea861
--- /dev/null
+++ b/lib/include
@@ -0,0 +1 @@
+Headers/
\ No newline at end of file
diff --git a/tools/driver/Android.mk b/tools/driver/Android.mk
new file mode 100644
index 0000000..919db0e
--- /dev/null
+++ b/tools/driver/Android.mk
@@ -0,0 +1,101 @@
+LOCAL_PATH:= $(call my-dir)
+
+# For the host only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+LOCAL_MODULE := clang
+
+LOCAL_MODULE_CLASS := EXECUTABLES
+
+TBLGEN_TABLES := \
+  DiagnosticCommonKinds.inc \
+  DiagnosticDriverKinds.inc \
+  DiagnosticFrontendKinds.inc \
+  CC1Options.inc \
+  CC1AsOptions.inc
+
+clang_SRC_FILES := \
+  cc1_main.cpp \
+  cc1as_main.cpp \
+  driver.cpp
+
+LOCAL_SRC_FILES := $(clang_SRC_FILES)
+
+LOCAL_STATIC_LIBRARIES := \
+  libclangFrontendTool \
+  libclangFrontend \
+  libclangARCMigrate \
+  libclangDriver \
+  libclangSerialization \
+  libclangCodeGen \
+  libclangRewriteFrontend \
+  libclangRewriteCore \
+  libclangParse \
+  libclangSema \
+  libclangStaticAnalyzerFrontend \
+  libclangStaticAnalyzerCheckers \
+  libclangStaticAnalyzerCore \
+  libclangAnalysis \
+  libclangEdit \
+  libclangAST \
+  libclangLex \
+  libclangBasic \
+  libLLVMARMAsmParser \
+  libLLVMARMCodeGen \
+  libLLVMARMAsmPrinter \
+  libLLVMARMDisassembler \
+  libLLVMARMDesc \
+  libLLVMARMInfo \
+  libLLVMMipsAsmParser \
+  libLLVMMipsCodeGen \
+  libLLVMMipsDisassembler \
+  libLLVMMipsAsmPrinter \
+  libLLVMMipsDesc \
+  libLLVMMipsInfo \
+  libLLVMX86Info \
+  libLLVMX86AsmParser \
+  libLLVMX86CodeGen \
+  libLLVMX86Disassembler \
+  libLLVMX86Desc \
+  libLLVMX86AsmPrinter \
+  libLLVMX86Utils \
+  libLLVMAsmParser \
+  libLLVMAsmPrinter \
+  libLLVMBitReader \
+  libLLVMBitWriter \
+  libLLVMSelectionDAG \
+  libLLVMipo \
+  libLLVMipa \
+  libLLVMInstCombine \
+  libLLVMInstrumentation \
+  libLLVMCodeGen \
+  libLLVMLinker \
+  libLLVMMC \
+  libLLVMMCParser \
+  libLLVMScalarOpts \
+  libLLVMTransformUtils \
+  libLLVMVectorize \
+  libLLVMAnalysis \
+  libLLVMCore \
+  libLLVMSupport \
+  libLLVMTarget
+
+LOCAL_LDLIBS += -lpthread -lm -ldl
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(BUILD_HOST_EXECUTABLE)
+
+# Make sure if clang (i.e. $(LOCAL_MODULE)) get installed,
+# clang++ will get installed as well.
+ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
+    $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(CLANG_CXX)
+# the additional dependency is needed when you run mm/mmm.
+$(LOCAL_MODULE) : $(CLANG_CXX)
+
+# Symlink for clang++
+$(CLANG_CXX) : $(LOCAL_INSTALLED_MODULE)
+	@echo "Symlink $@ -> $<"
+	$(hide) ln -sf $(notdir $<) $@
diff --git a/utils/TableGen/Android.mk b/utils/TableGen/Android.mk
new file mode 100644
index 0000000..3d2ce0e
--- /dev/null
+++ b/utils/TableGen/Android.mk
@@ -0,0 +1,35 @@
+LOCAL_PATH:= $(call my-dir)
+
+clang_tablegen_SRC_FILES := \
+  ClangASTNodesEmitter.cpp \
+  ClangAttrEmitter.cpp \
+  ClangCommentCommandInfoEmitter.cpp \
+  ClangCommentHTMLTagsEmitter.cpp \
+  ClangDiagnosticsEmitter.cpp \
+  ClangSACheckersEmitter.cpp \
+  NeonEmitter.cpp \
+  OptParserEmitter.cpp \
+  TableGen.cpp
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := clang-tblgen
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(clang_tablegen_SRC_FILES)
+
+REQUIRES_EH := 1
+REQUIRES_RTTI := 1
+
+LOCAL_STATIC_LIBRARIES := \
+  libLLVMTableGen \
+  libLLVMSupport
+
+LOCAL_LDLIBS += -lm
+ifeq ($(HOST_OS),windows)
+  LOCAL_LDLIBS += -limagehlp -lpsapi
+else
+  LOCAL_LDLIBS += -lpthread -ldl
+endif
+
+include $(LLVM_HOST_BUILD_MK)
+include $(BUILD_HOST_EXECUTABLE)