Update aosp/master Clang for rebase to r222490.

Change-Id: Ic557ac55e97fbf6ee08771c7b7c3594777b0aefd
diff --git a/test/lit.cfg b/test/lit.cfg
index 11e8e0b..4567f17 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -73,7 +73,6 @@
 
 # safe_env_vars = ('TMPDIR', 'TEMP', 'TMP', 'USERPROFILE', 'PWD',
 #                  'MACOSX_DEPLOYMENT_TARGET', 'IPHONEOS_DEPLOYMENT_TARGET',
-#                  'IOS_SIMULATOR_DEPLOYMENT_TARGET',
 #                  'VCINSTALLDIR', 'VC100COMNTOOLS', 'VC90COMNTOOLS',
 #                  'VC80COMNTOOLS')
 possibly_dangerous_env_vars = ['COMPILER_PATH', 'RC_DEBUG_OPTIONS',
@@ -115,11 +114,6 @@
     if symbolizer in os.environ:
         config.environment[symbolizer] = os.environ[symbolizer]
 
-# Propagate options for sanitizers.
-for options in ['ASAN_OPTIONS']:
-    if options in os.environ:
-        config.environment[options] = os.environ[options]
-
 ###
 
 # Check that the object root is known.
@@ -223,7 +217,8 @@
     # FIXME: Rather than just getting the version, we should have clang print
     # out its resource dir here in an easy to scrape form.
     cmd = subprocess.Popen([clang, '-print-file-name=include'],
-                           stdout=subprocess.PIPE)
+                           stdout=subprocess.PIPE,
+                           env=config.environment)
     if not cmd.stdout:
       lit_config.fatal("Couldn't find the include dir for Clang ('%s')" % clang)
     dir = cmd.stdout.read().strip()
@@ -258,7 +253,8 @@
     # -win32 is not supported for non-x86 targets; use a default.
     return 'i686-pc-win32'
 
-config.substitutions.append( ('%clang_cc1', '%s -cc1 -internal-isystem %s'
+config.substitutions.append( ('%clang_cc1',
+                              '%s -cc1 -internal-isystem %s -nostdsysteminc'
                               % (config.clang,
                                  getClangBuiltinIncludeDir(config.clang))) )
 config.substitutions.append( ('%clang_cpp', ' ' + config.clang +
@@ -272,6 +268,13 @@
 config.substitutions.append( ('%itanium_abi_triple', makeItaniumABITriple(config.target_triple)) )
 config.substitutions.append( ('%ms_abi_triple', makeMSABITriple(config.target_triple)) )
 
+# The host triple might not be set, at least if we're compiling clang from
+# an already installed llvm.
+if config.host_triple and config.host_triple != '@LLVM_HOST_TRIPLE@':
+    config.substitutions.append( ('%target_itanium_abi_host_triple', '--target=%s' % makeItaniumABITriple(config.host_triple)) )
+else:
+    config.substitutions.append( ('%target_itanium_abi_host_triple', '') )
+
 # FIXME: Find nicer way to prohibit this.
 config.substitutions.append(
     (' clang ', """*** Do not use 'clang' in tests, use '%clang'. ***""") )
@@ -334,6 +337,10 @@
 
 # Set available features we allow tests to conditionalize on.
 #
+# Enabled/disabled features
+if config.clang_staticanalyzer != 0:
+    config.available_features.add("staticanalyzer")
+
 # As of 2011.08, crash-recovery tests still do not pass on FreeBSD.
 if platform.system() not in ['FreeBSD']:
     config.available_features.add('crash-recovery')
@@ -419,7 +426,8 @@
             '--assertion-mode',
             '--targets-built',
             ],
-        stdout=subprocess.PIPE
+        stdout=subprocess.PIPE,
+        env=config.environment
         )
     # 1st line corresponds to --assertion-mode, "ON" or "OFF".
     line = cmd.stdout.readline().strip().decode('ascii')
@@ -446,6 +454,10 @@
 if (config.llvm_use_sanitizer == "Memory" or
         config.llvm_use_sanitizer == "MemoryWithOrigins"):
     config.available_features.add("msan")
+if config.llvm_use_sanitizer == "Undefined":
+    config.available_features.add("ubsan")
+else:
+    config.available_features.add("not_ubsan")
 
 # Check if we should run long running tests.
 if lit_config.params.get("run_long_tests", None) == "true":