Apply changes to migrate to upstream Oct 20th 2011 (r142531)

Change-Id: I32cdb5da2c07c84e01f42b4e87161196f468806a
diff --git a/Android.mk b/Android.mk
index d1e57c7..4be49e2 100644
--- a/Android.mk
+++ b/Android.mk
@@ -22,6 +22,7 @@
   lib/StaticAnalyzer/Core \
   lib/StaticAnalyzer/Frontend \
   tools/driver \
+  utils/TableGen \
   ))
 
 include $(LOCAL_PATH)/clang.mk
diff --git a/clang-host-build.mk b/clang-host-build.mk
index f58014a..71ddec0 100644
--- a/clang-host-build.mk
+++ b/clang-host-build.mk
@@ -20,3 +20,19 @@
 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 TableGen: $(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
index 9eff7fb..ea0eada 100644
--- a/clang-tblgen-rules.mk
+++ b/clang-tblgen-rules.mk
@@ -11,44 +11,51 @@
 
 ifneq ($(findstring AttrImpl.inc,$(TBLGEN_TABLES)),)
 LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/AST/AttrImpl.inc
-$(intermediates)/include/clang/AST/AttrImpl.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(TBLGEN)
+$(intermediates)/include/clang/AST/AttrImpl.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
 	@echo "Building Clang attribute implementations with tblgen"
-	$(call transform-host-td-to-out,clang-attr-impl)
+	$(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: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(TBLGEN)
+$(intermediates)/include/clang/Basic/AttrList.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
 	@echo "Building Clang attribute list with tblgen"
-	$(call transform-host-td-to-out,clang-attr-list)
+	$(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: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(TBLGEN)
+$(intermediates)/include/clang/Lex/AttrSpellings.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
 	@echo "Building Clang attribute spelling list with tblgen"
-	$(call transform-host-td-to-out,clang-attr-spelling-list)
+	$(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: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(TBLGEN)
+$(intermediates)/include/clang/Serialization/AttrPCHRead.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
 	@echo "Building Clang attribute pch read with tblgen"
-	$(call transform-host-td-to-out,clang-attr-pch-read)
+	$(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: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(TBLGEN)
+$(intermediates)/include/clang/Serialization/AttrPCHWrite.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
 	@echo "Building Clang attribute pch write with tblgen"
-	$(call transform-host-td-to-out,clang-attr-pch-write)
+	$(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: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
+	@echo "Building Clang attribute late parsed list with 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: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(TBLGEN)
+$(intermediates)/include/clang/AST/Attrs.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Attr.td $(CLANG_TBLGEN)
 	@echo "Building Clang attribute classes with tblgen"
-	$(call transform-host-td-to-out,clang-attr-classes)
+	$(call transform-host-clang-td-to-out,clang-attr-classes)
 endif
 
 ifneq ($(findstring Checkers.inc,$(TBLGEN_TABLES)),)
@@ -56,72 +63,72 @@
 $(intermediates)/Checkers.inc: \
   $(CLANG_ROOT_PATH)/lib/StaticAnalyzer/Checkers/Checkers.td \
   $(CLANG_ROOT_PATH)/include/clang/StaticAnalyzer/Checkers/CheckerBase.td \
-  $(TBLGEN)
+  $(CLANG_TBLGEN)
 	@echo "Building Clang static analyzer checkers list with tblgen"
-	$(call transform-host-td-to-out,clang-sa-checkers)
+	$(call transform-host-clang-td-to-out,clang-sa-checkers)
 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: $(CLANG_ROOT_PATH)/include/clang/Basic/Diagnostic.td $(TBLGEN)
+$(intermediates)/include/clang/Basic/Diagnostic%Kinds.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Diagnostic.td $(CLANG_TBLGEN)
 	@echo "Building Clang $(patsubst Diagnostic%Kinds.inc,%,$(@F)) diagnostic tables with tblgen"
-	$(call transform-host-td-to-out,clang-diags-defs -clang-component=$(patsubst Diagnostic%Kinds.inc,%,$(@F)))
+	$(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: $(CLANG_ROOT_PATH)/include/clang/Basic/Diagnostic.td $(CLANG_ROOT_PATH)/include/clang/Basic/DiagnosticGroups.td $(TBLGEN)
+$(intermediates)/include/clang/Basic/DiagnosticGroups.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Diagnostic.td $(CLANG_ROOT_PATH)/include/clang/Basic/DiagnosticGroups.td $(CLANG_TBLGEN)
 	@echo "Building Clang diagnostic groups with tblgen"
-	$(call transform-host-td-to-out,clang-diag-groups)
+	$(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: $(CLANG_ROOT_PATH)/include/clang/Basic/Diagnostic.td $(TBLGEN)
+$(intermediates)/include/clang/Basic/DiagnosticIndexName.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/Diagnostic.td $(CLANG_TBLGEN)
 	@echo "Building Clang diagnostic name index with tblgen"
-	$(call transform-host-td-to-out,clang-diag-groups)
+	$(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: $(CLANG_ROOT_PATH)/include/clang/Basic/DeclNodes.td $(TBLGEN)
+$(intermediates)/include/clang/AST/DeclNodes.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/DeclNodes.td $(CLANG_TBLGEN)
 	@echo "Building Clang declaration node tables with tblgen"
-	$(call transform-host-td-to-out,clang-decl-nodes)
+	$(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: $(CLANG_ROOT_PATH)/include/clang/Basic/StmtNodes.td $(TBLGEN)
+$(intermediates)/include/clang/AST/StmtNodes.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/StmtNodes.td $(CLANG_TBLGEN)
 	@echo "Building Clang statement node tables with tblgen"
-	$(call transform-host-td-to-out,clang-stmt-nodes)
+	$(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: $(CLANG_ROOT_PATH)/include/clang/Basic/arm_neon.td $(TBLGEN)
+$(intermediates)/include/clang/Basic/arm_neon.inc: $(CLANG_ROOT_PATH)/include/clang/Basic/arm_neon.td $(CLANG_TBLGEN)
 	@echo "Building Clang arm_neon.inc with tblgen"
-	$(call transform-host-td-to-out,arm-neon-sema)
+	$(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: $(CLANG_ROOT_PATH)/include/clang/Driver/Options.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(TBLGEN)
+$(intermediates)/include/clang/Driver/Options.inc: $(CLANG_ROOT_PATH)/include/clang/Driver/Options.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(CLANG_TBLGEN)
 	@echo "Building Clang Driver Option tables with tblgen"
-	$(call transform-host-td-to-out,opt-parser-defs)
+	$(call transform-host-clang-td-to-out,opt-parser-defs)
 endif
 
 ifneq ($(findstring CC1Options.inc,$(TBLGEN_TABLES)),)
 LOCAL_GENERATED_SOURCES += $(intermediates)/include/clang/Driver/CC1Options.inc
-$(intermediates)/include/clang/Driver/CC1Options.inc: $(CLANG_ROOT_PATH)/include/clang/Driver/CC1Options.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(TBLGEN)
+$(intermediates)/include/clang/Driver/CC1Options.inc: $(CLANG_ROOT_PATH)/include/clang/Driver/CC1Options.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(CLANG_TBLGEN)
 	@echo "Building Clang CC1 Option tables with tblgen"
-	$(call transform-host-td-to-out,opt-parser-defs)
+	$(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: $(CLANG_ROOT_PATH)/include/clang/Driver/CC1AsOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(TBLGEN)
+$(intermediates)/include/clang/Driver/CC1AsOptions.inc: $(CLANG_ROOT_PATH)/include/clang/Driver/CC1AsOptions.td $(CLANG_ROOT_PATH)/include/clang/Driver/OptParser.td $(CLANG_TBLGEN)
 	@echo "Building Clang CC1 As Option tables with tblgen"
-	$(call transform-host-td-to-out,opt-parser-defs)
+	$(call transform-host-clang-td-to-out,opt-parser-defs)
 endif
 
 LOCAL_C_INCLUDES += $(intermediates)/include
diff --git a/clang.mk b/clang.mk
index 587a510..f1084a5 100644
--- a/clang.mk
+++ b/clang.mk
@@ -2,6 +2,8 @@
 $(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/lib/AST/Android.mk b/lib/AST/Android.mk
index d0de350..6b55e98 100644
--- a/lib/AST/Android.mk
+++ b/lib/AST/Android.mk
@@ -48,6 +48,7 @@
 	ParentMap.cpp	\
 	RecordLayout.cpp	\
 	RecordLayoutBuilder.cpp	\
+	SelectorLocationsKind.cpp \
 	Stmt.cpp	\
 	StmtDumper.cpp	\
 	StmtIterator.cpp	\
@@ -58,7 +59,9 @@
 	TemplateName.cpp	\
 	Type.cpp	\
 	TypeLoc.cpp	\
-	TypePrinter.cpp
+	TypePrinter.cpp \
+	VTTBuilder.cpp \
+	VTableBuilder.cpp
 
 LOCAL_SRC_FILES := $(clang_ast_SRC_FILES)
 
diff --git a/lib/Analysis/Android.mk b/lib/Analysis/Android.mk
index 43f88c8..0d4ede2 100644
--- a/lib/Analysis/Android.mk
+++ b/lib/Analysis/Android.mk
@@ -22,10 +22,12 @@
 	FormatString.cpp	\
 	LiveVariables.cpp	\
 	PrintfFormatString.cpp	\
+	ProgramPoint.cpp \
 	PseudoConstantAnalysis.cpp	\
 	ReachableCode.cpp	\
 	ScanfFormatString.cpp	\
-	UninitializedValues.cpp
+	UninitializedValues.cpp \
+	ThreadSafety.cpp
 
 
 LOCAL_SRC_FILES := $(clang_analysis_SRC_FILES)
diff --git a/lib/Basic/Android.mk b/lib/Basic/Android.mk
index 6cb0f8d..52e1b28 100644
--- a/lib/Basic/Android.mk
+++ b/lib/Basic/Android.mk
@@ -26,6 +26,7 @@
 	FileManager.cpp	\
 	FileSystemStatCache.cpp	\
 	IdentifierTable.cpp	\
+	LangOptions.cpp \
 	SourceLocation.cpp	\
 	SourceManager.cpp	\
 	TargetInfo.cpp	\
diff --git a/lib/CodeGen/Android.mk b/lib/CodeGen/Android.mk
index cb8d43f..f8cacd0 100644
--- a/lib/CodeGen/Android.mk
+++ b/lib/CodeGen/Android.mk
@@ -20,6 +20,9 @@
 	CGBuiltin.cpp	\
 	CGCall.cpp	\
 	CGClass.cpp	\
+	CGCUDANV.cpp \
+	CGCUDARuntime.cpp \
+	CGOpenCLRuntime.cpp \
 	CGCXX.cpp	\
 	CGCXXABI.cpp	\
 	CGCleanup.cpp	\
diff --git a/lib/Frontend/Android.mk b/lib/Frontend/Android.mk
index 8236477..b628f13 100644
--- a/lib/Frontend/Android.mk
+++ b/lib/Frontend/Android.mk
@@ -37,10 +37,11 @@
   LogDiagnosticPrinter.cpp \
   MultiplexConsumer.cpp \
   PrintPreprocessedOutput.cpp \
+  TextDiagnostic.cpp \
   TextDiagnosticBuffer.cpp \
   TextDiagnosticPrinter.cpp \
-  VerifyDiagnosticsClient.cpp \
-  Warnings.cpp
+  Warnings.cpp \
+  VerifyDiagnosticConsumer.cpp
 
 LOCAL_SRC_FILES := $(clang_frontend_SRC_FILES)
 
diff --git a/lib/Parse/Android.mk b/lib/Parse/Android.mk
index 27d29c2..2ced435 100644
--- a/lib/Parse/Android.mk
+++ b/lib/Parse/Android.mk
@@ -7,6 +7,7 @@
 
 TBLGEN_TABLES :=    \
 	AttrList.inc	\
+	AttrLateParsed.inc \
 	Attrs.inc	\
 	DeclNodes.inc	\
 	DiagnosticParseKinds.inc	\
diff --git a/lib/Sema/Android.mk b/lib/Sema/Android.mk
index 6c2b5ac..5cc8554 100644
--- a/lib/Sema/Android.mk
+++ b/lib/Sema/Android.mk
@@ -24,12 +24,13 @@
 	IdentifierResolver.cpp	\
 	DelayedDiagnostic.cpp \
 	JumpDiagnostics.cpp	\
+	MultiInitializer.cpp \
 	Scope.cpp \
 	Sema.cpp	\
 	SemaAccess.cpp	\
 	SemaAttr.cpp	\
-	SemaCXXCast.cpp	\
 	SemaCXXScopeSpec.cpp	\
+	SemaCast.cpp \
 	SemaChecking.cpp	\
 	SemaCodeComplete.cpp	\
 	SemaDecl.cpp	\
@@ -41,6 +42,7 @@
 	SemaExprCXX.cpp	\
 	SemaExprMember.cpp \
 	SemaExprObjC.cpp	\
+	SemaFixItUtils.cpp \
 	SemaInit.cpp	\
 	SemaLookup.cpp	\
 	SemaObjCProperty.cpp	\
diff --git a/lib/Serialization/Android.mk b/lib/Serialization/Android.mk
index d739353..97564f7 100644
--- a/lib/Serialization/Android.mk
+++ b/lib/Serialization/Android.mk
@@ -15,6 +15,7 @@
   AttrPCHWrite.inc \
   DiagnosticCommonKinds.inc \
   DiagnosticFrontendKinds.inc \
+  DiagnosticSemaKinds.inc \
   Attrs.inc \
   DeclNodes.inc \
   StmtNodes.inc
@@ -28,7 +29,9 @@
   ASTWriter.cpp \
   ASTWriterDecl.cpp \
   ASTWriterStmt.cpp \
-  ChainedIncludesSource.cpp
+  ChainedIncludesSource.cpp \
+  Module.cpp \
+  ModuleManager.cpp
 
 LOCAL_SRC_FILES := $(clang_serialization_SRC_FILES)
 
diff --git a/lib/StaticAnalyzer/Checkers/Android.mk b/lib/StaticAnalyzer/Checkers/Android.mk
index a5af57f..3831d45 100644
--- a/lib/StaticAnalyzer/Checkers/Android.mk
+++ b/lib/StaticAnalyzer/Checkers/Android.mk
@@ -26,7 +26,7 @@
   CheckSecuritySyntaxOnly.cpp \
   CheckSizeofPointer.cpp \
   ChrootChecker.cpp \
-  ClangSACheckerProvider.cpp \
+  ClangCheckers.cpp \
   DeadStoresChecker.cpp \
   DebugCheckers.cpp \
   DereferenceChecker.cpp \
@@ -35,8 +35,10 @@
   IdempotentOperationChecker.cpp \
   IteratorsChecker.cpp \
   LLVMConventionsChecker.cpp \
+  MacOSKeychainAPIChecker.cpp \
   MacOSXAPIChecker.cpp \
   MallocChecker.cpp \
+  MallocOverflowSecurityChecker.cpp \
   NSAutoreleasePoolChecker.cpp \
   NSErrorChecker.cpp \
   NoReturnFunctionChecker.cpp \
@@ -47,6 +49,7 @@
   PointerArithChecker.cpp \
   PointerSubChecker.cpp \
   PthreadLockChecker.cpp \
+  RetainCountChecker.cpp \
   ReturnPointerRangeChecker.cpp \
   ReturnUndefChecker.cpp \
   StackAddrEscapeChecker.cpp \
@@ -75,4 +78,5 @@
 
 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
index 6e26144..4c41112 100644
--- a/lib/StaticAnalyzer/Core/Android.mk
+++ b/lib/StaticAnalyzer/Core/Android.mk
@@ -11,25 +11,27 @@
   AggExprVisitor.cpp \
   AnalysisManager.cpp \
   BasicConstraintManager.cpp \
-  BasicStore.cpp \
   BasicValueFactory.cpp \
   BugReporter.cpp \
   BugReporterVisitors.cpp \
-  CFRefCount.cpp \
+  Checker.cpp \
   CheckerContext.cpp \
+  CheckerRegistry.cpp \
   CheckerHelpers.cpp \
   CheckerManager.cpp \
   Environment.cpp \
   ExplodedGraph.cpp \
   ExprEngine.cpp \
-  FlatStore.cpp \
+  ExprEngineC.cpp \
+  ExprEngineCXX.cpp \
+  ExprEngineCallAndReturn.cpp \
+  ExprEngineObjC.cpp \
   BlockCounter.cpp \
-  CXXExprEngine.cpp \
   CoreEngine.cpp \
-  GRState.cpp \
   HTMLDiagnostics.cpp \
   MemRegion.cpp \
   ObjCMessage.cpp \
+  ProgramState.cpp \
   PathDiagnostic.cpp \
   PlistDiagnostics.cpp \
   RangeConstraintManager.cpp \
@@ -57,4 +59,5 @@
 
 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
index e335818..89f010f 100644
--- a/lib/StaticAnalyzer/Frontend/Android.mk
+++ b/lib/StaticAnalyzer/Frontend/Android.mk
@@ -33,4 +33,5 @@
 
 include $(CLANG_HOST_BUILD_MK)
 include $(CLANG_TBLGEN_RULES_MK)
+include $(CLANG_VERSION_INC_MK)
 include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/tools/driver/Android.mk b/tools/driver/Android.mk
index 496636e..4f7504b 100644
--- a/tools/driver/Android.mk
+++ b/tools/driver/Android.mk
@@ -51,8 +51,8 @@
   libLLVMX86AsmParser \
   libLLVMX86CodeGen \
   libLLVMX86Disassembler \
-  libLLVMX86AsmPrinter \
   libLLVMX86Desc \
+  libLLVMX86AsmPrinter \
   libLLVMX86Utils \
   libLLVMARMInfo \
   libLLVMAsmParser \
@@ -60,11 +60,11 @@
   libLLVMBitReader \
   libLLVMBitWriter \
   libLLVMSelectionDAG \
+  libLLVMipo \
+  libLLVMipa \
   libLLVMInstCombine \
   libLLVMInstrumentation \
   libLLVMCodeGen \
-  libLLVMipo \
-  libLLVMipa \
   libLLVMLinker \
   libLLVMMC \
   libLLVMMCParser \
diff --git a/utils/TableGen/Android.mk b/utils/TableGen/Android.mk
new file mode 100644
index 0000000..de873e9
--- /dev/null
+++ b/utils/TableGen/Android.mk
@@ -0,0 +1,33 @@
+LOCAL_PATH:= $(call my-dir)
+
+clang_tablegen_SRC_FILES := \
+  ClangASTNodesEmitter.cpp \
+  ClangAttrEmitter.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)