summaryrefslogtreecommitdiff
path: root/clang/test/Driver
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
committerCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
commitbe1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch)
tree1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/Driver
parentc4626a62754862d20b41e8a46a3574264ea80e6d (diff)
parentf1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff)
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/Driver')
-rw-r--r--clang/test/Driver/Inputs/basic_freebsd64_tree/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_freebsd64_tree/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_freebsd64_tree/usr/lib/crt1.o0
-rw-r--r--clang/test/Driver/Inputs/basic_freebsd64_tree/usr/lib32/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_freebsd_tree/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib/crt1.o0
-rw-r--r--clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib32/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_linux_tree/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_linux_tree/usr/i386-unknown-linux/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_linux_tree/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/basic_linux_tree/usr/x86_64-unknown-linux/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/lib/i386-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/lib/powerpc-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/lib/powerpc64-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/lib/x86_64-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/backward/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/i686-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/powerpc-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/powerpc64-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/x86_64-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/i386-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/powerpc-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/powerpc64-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/x86_64-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/i686-linux-gnu/4.5/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/powerpc-linux-gnu/4.5/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/powerpc64-linux-gnu/4.5/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/x86_64-linux-gnu/4.5/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/i386-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/powerpc-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/powerpc64-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/x86_64-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/fake_install_tree/bin/.keep0
-rw-r--r--clang/test/Driver/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/fake_install_tree/lib/gcc/x86_64-unknown-linux/4.5.0/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing1/bin/.keep0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.6.99/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.6/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7.1/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing2/bin/.keep0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.99/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.x/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.1/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.x/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing3/bin/.keep0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing3/lib/gcc/i386-unknown-linux/4.7.98/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing3/lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing4/bin/.keep0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.98/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.99/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/multiarch_freebsd64_tree/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/crt1.o0
-rw-r--r--clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/.keep0
-rw-r--r--clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/crt1.o0
-rw-r--r--clang/test/Driver/Inputs/multilib_32bit_linux_tree/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_32bit_linux_tree/lib32/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_32bit_linux_tree/lib64/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib32/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib64/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/64/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib32/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib64/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_64bit_linux_tree/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_64bit_linux_tree/lib32/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_64bit_linux_tree/lib64/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib32/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib64/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib32/.keep0
-rw-r--r--clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib64/.keep0
-rwxr-xr-xclang/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-as2
-rwxr-xr-xclang/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-ld2
-rw-r--r--clang/test/Driver/Inputs/suse_10.3_ppc64_tree/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/suse_10.3_ppc64_tree/lib64/.keep0
-rw-r--r--clang/test/Driver/Inputs/suse_10.3_ppc64_tree/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/suse_10.3_ppc64_tree/usr/lib/gcc/powerpc64-suse-linux/4.1.2/crtbegin.o0
-rw-r--r--clang/test/Driver/Inputs/suse_10.3_ppc64_tree/usr/lib64/.keep0
-rw-r--r--clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/lib/i386-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/.keep0
-rw-r--r--clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/c++/4.5/.keep0
-rw-r--r--clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/c++/4.5/backward/.keep0
-rw-r--r--clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/c++/4.5/i686-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/i386-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/lib/.keep0
-rw-r--r--clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/lib/i386-linux-gnu/.keep0
-rw-r--r--clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/crtbegin.o0
-rw-r--r--clang/test/Driver/Wp-args.c13
-rw-r--r--clang/test/Driver/Xarch.c9
-rw-r--r--clang/test/Driver/Xlinker-args.c9
-rw-r--r--clang/test/Driver/altivec.cpp14
-rw-r--r--clang/test/Driver/analyze.c8
-rw-r--r--clang/test/Driver/apple-kext-i386.cpp50
-rw-r--r--clang/test/Driver/apple-kext-mkernel.c22
-rw-r--r--clang/test/Driver/arc-exceptions.m5
-rw-r--r--clang/test/Driver/arc.c17
-rw-r--r--clang/test/Driver/arch.c3
-rw-r--r--clang/test/Driver/arclite-link.c8
-rw-r--r--clang/test/Driver/arm-darwin-builtin.c14
-rw-r--r--clang/test/Driver/arm-mfpmath.c29
-rw-r--r--clang/test/Driver/arm-mfpu.c48
-rw-r--r--clang/test/Driver/asan.c8
-rw-r--r--clang/test/Driver/ast.c26
-rw-r--r--clang/test/Driver/at_file.c30
-rw-r--r--clang/test/Driver/at_file.c.args11
-rw-r--r--clang/test/Driver/bindings.c49
-rw-r--r--clang/test/Driver/cc-log-diagnostics.c35
-rw-r--r--clang/test/Driver/cc-print-options.c7
-rw-r--r--clang/test/Driver/ccc-add-args.c5
-rw-r--r--clang/test/Driver/ccc-host-triple-no-integrated-as.c17
-rw-r--r--clang/test/Driver/cfi.c9
-rw-r--r--clang/test/Driver/clang-c-as-cxx.c6
-rw-r--r--clang/test/Driver/clang-exception-flags.cpp23
-rw-r--r--clang/test/Driver/clang-g-opts.c5
-rw-r--r--clang/test/Driver/clang-translation.c46
-rw-r--r--clang/test/Driver/clang_cpp.c4
-rw-r--r--clang/test/Driver/clang_f_opts.c31
-rw-r--r--clang/test/Driver/clang_wrapv_opts.c11
-rw-r--r--clang/test/Driver/cpath.c22
-rw-r--r--clang/test/Driver/cpp-precomp.c5
-rw-r--r--clang/test/Driver/darwin-as.c17
-rw-r--r--clang/test/Driver/darwin-cc.c4
-rw-r--r--clang/test/Driver/darwin-debug-flags.c13
-rw-r--r--clang/test/Driver/darwin-dsymutil.c45
-rw-r--r--clang/test/Driver/darwin-iphone-defaults.m28
-rw-r--r--clang/test/Driver/darwin-ld.c123
-rw-r--r--clang/test/Driver/darwin-objc-defaults.m88
-rw-r--r--clang/test/Driver/darwin-objc-gc.m19
-rw-r--r--clang/test/Driver/darwin-objc-options.m21
-rw-r--r--clang/test/Driver/darwin-verify-debug.c34
-rw-r--r--clang/test/Driver/darwin-version.c31
-rw-r--r--clang/test/Driver/darwin-xarch.c20
-rw-r--r--clang/test/Driver/debug-options-as.c18
-rw-r--r--clang/test/Driver/debug-options.c27
-rw-r--r--clang/test/Driver/debug.c11
-rw-r--r--clang/test/Driver/default-toolchain.c8
-rw-r--r--clang/test/Driver/diagnostics.c9
-rw-r--r--clang/test/Driver/dragonfly.c7
-rw-r--r--clang/test/Driver/dwarf2-cfi-asm.c35
-rw-r--r--clang/test/Driver/emit-llvm.c10
-rw-r--r--clang/test/Driver/exceptions.m19
-rw-r--r--clang/test/Driver/fast-math.c119
-rw-r--r--clang/test/Driver/flags.c9
-rw-r--r--clang/test/Driver/frame-pointer.c24
-rw-r--r--clang/test/Driver/freebsd.c30
-rw-r--r--clang/test/Driver/gcc-toolchain.cpp23
-rw-r--r--clang/test/Driver/gcc_forward.c13
-rw-r--r--clang/test/Driver/gnu-runtime.m5
-rw-r--r--clang/test/Driver/gold-lto.c6
-rw-r--r--clang/test/Driver/hello.c18
-rw-r--r--clang/test/Driver/immediate-options.c4
-rw-r--r--clang/test/Driver/index-header-map.c4
-rw-r--r--clang/test/Driver/invalid-o-level.c4
-rw-r--r--clang/test/Driver/ios-simulator-arcruntime.c6
-rw-r--r--clang/test/Driver/le32-unknown-nacl.cpp146
-rw-r--r--clang/test/Driver/linker-opts.c5
-rw-r--r--clang/test/Driver/linux-as.c31
-rw-r--r--clang/test/Driver/linux-header-search.cpp75
-rw-r--r--clang/test/Driver/linux-ld.c270
-rw-r--r--clang/test/Driver/lto.c23
-rw-r--r--clang/test/Driver/m_and_mm.c3
-rw-r--r--clang/test/Driver/mg.c5
-rw-r--r--clang/test/Driver/mips-as.c31
-rw-r--r--clang/test/Driver/mips-float.c42
-rw-r--r--clang/test/Driver/mno-global-merge.c12
-rw-r--r--clang/test/Driver/modules.m6
-rw-r--r--clang/test/Driver/modules.mm6
-rw-r--r--clang/test/Driver/no-objc-arr.m8
-rw-r--r--clang/test/Driver/no-objc-default-synthesize-properties.m10
-rw-r--r--clang/test/Driver/no-sibling-calls.c8
-rw-r--r--clang/test/Driver/noexecstack.c1
-rw-r--r--clang/test/Driver/noinline.c10
-rw-r--r--clang/test/Driver/nostdincxx.cpp4
-rw-r--r--clang/test/Driver/nostdlib.c4
-rw-r--r--clang/test/Driver/nostdlibinc.c10
-rw-r--r--clang/test/Driver/objc++-cpp-output.mm8
-rw-r--r--clang/test/Driver/objc-cpp-output.m7
-rw-r--r--clang/test/Driver/openbsd.c5
-rw-r--r--clang/test/Driver/option-aliases.c11
-rw-r--r--clang/test/Driver/output-file-cleanup.c25
-rw-r--r--clang/test/Driver/parsing.c22
-rw-r--r--clang/test/Driver/phases.c78
-rw-r--r--clang/test/Driver/pic.c81
-rw-r--r--clang/test/Driver/prefixed-tools.c12
-rw-r--r--clang/test/Driver/preprocessor.c6
-rw-r--r--clang/test/Driver/pth.c12
-rw-r--r--clang/test/Driver/qa_override.c6
-rw-r--r--clang/test/Driver/redundant-args.c2
-rw-r--r--clang/test/Driver/redzone.c6
-rw-r--r--clang/test/Driver/rewrite-legacy-objc.m15
-rw-r--r--clang/test/Driver/rewrite-objc.m15
-rw-r--r--clang/test/Driver/stackrealign.c12
-rw-r--r--clang/test/Driver/std.c8
-rw-r--r--clang/test/Driver/std.cpp24
-rw-r--r--clang/test/Driver/sysroot-flags.c28
-rw-r--r--clang/test/Driver/sysroot.c18
-rw-r--r--clang/test/Driver/target.c11
-rw-r--r--clang/test/Driver/tsan.c8
-rw-r--r--clang/test/Driver/unknown-arg.c4
-rw-r--r--clang/test/Driver/unknown-gcc-arch.c8
-rw-r--r--clang/test/Driver/working-directory.c4
-rw-r--r--clang/test/Driver/x86_features.c3
220 files changed, 2604 insertions, 0 deletions
diff --git a/clang/test/Driver/Inputs/basic_freebsd64_tree/lib/.keep b/clang/test/Driver/Inputs/basic_freebsd64_tree/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_freebsd64_tree/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_freebsd64_tree/usr/lib/.keep b/clang/test/Driver/Inputs/basic_freebsd64_tree/usr/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_freebsd64_tree/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_freebsd64_tree/usr/lib/crt1.o b/clang/test/Driver/Inputs/basic_freebsd64_tree/usr/lib/crt1.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_freebsd64_tree/usr/lib/crt1.o
diff --git a/clang/test/Driver/Inputs/basic_freebsd64_tree/usr/lib32/.keep b/clang/test/Driver/Inputs/basic_freebsd64_tree/usr/lib32/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_freebsd64_tree/usr/lib32/.keep
diff --git a/clang/test/Driver/Inputs/basic_freebsd_tree/lib/.keep b/clang/test/Driver/Inputs/basic_freebsd_tree/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_freebsd_tree/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib/.keep b/clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib/crt1.o b/clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib/crt1.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib/crt1.o
diff --git a/clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib32/.keep b/clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib32/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib32/.keep
diff --git a/clang/test/Driver/Inputs/basic_linux_tree/lib/.keep b/clang/test/Driver/Inputs/basic_linux_tree/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_linux_tree/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_linux_tree/usr/i386-unknown-linux/lib/.keep b/clang/test/Driver/Inputs/basic_linux_tree/usr/i386-unknown-linux/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_linux_tree/usr/i386-unknown-linux/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/.keep b/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o b/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o
diff --git a/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o b/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o
diff --git a/clang/test/Driver/Inputs/basic_linux_tree/usr/x86_64-unknown-linux/lib/.keep b/clang/test/Driver/Inputs/basic_linux_tree/usr/x86_64-unknown-linux/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_linux_tree/usr/x86_64-unknown-linux/lib/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/lib/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/lib/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/lib/i386-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/lib/i386-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/lib/i386-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/lib/powerpc-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/lib/powerpc-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/lib/powerpc-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/lib/powerpc64-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/lib/powerpc64-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/lib/powerpc64-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/lib/x86_64-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/lib/x86_64-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/lib/x86_64-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/backward/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/backward/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/backward/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/i686-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/i686-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/i686-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/powerpc-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/powerpc-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/powerpc-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/powerpc64-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/powerpc64-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/powerpc64-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/x86_64-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/x86_64-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/x86_64-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/i386-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/i386-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/i386-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/powerpc-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/powerpc-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/powerpc-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/powerpc64-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/powerpc64-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/powerpc64-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/x86_64-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/x86_64-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/x86_64-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/i686-linux-gnu/4.5/crtbegin.o b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/i686-linux-gnu/4.5/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/i686-linux-gnu/4.5/crtbegin.o
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/powerpc-linux-gnu/4.5/crtbegin.o b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/powerpc-linux-gnu/4.5/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/powerpc-linux-gnu/4.5/crtbegin.o
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/powerpc64-linux-gnu/4.5/crtbegin.o b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/powerpc64-linux-gnu/4.5/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/powerpc64-linux-gnu/4.5/crtbegin.o
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/x86_64-linux-gnu/4.5/crtbegin.o b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/x86_64-linux-gnu/4.5/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/x86_64-linux-gnu/4.5/crtbegin.o
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/i386-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/i386-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/i386-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/powerpc-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/powerpc-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/powerpc-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/powerpc64-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/powerpc64-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/powerpc64-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/x86_64-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/x86_64-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/lib/x86_64-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/fake_install_tree/bin/.keep b/clang/test/Driver/Inputs/fake_install_tree/bin/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/fake_install_tree/bin/.keep
diff --git a/clang/test/Driver/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o b/clang/test/Driver/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o
diff --git a/clang/test/Driver/Inputs/fake_install_tree/lib/gcc/x86_64-unknown-linux/4.5.0/crtbegin.o b/clang/test/Driver/Inputs/fake_install_tree/lib/gcc/x86_64-unknown-linux/4.5.0/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/fake_install_tree/lib/gcc/x86_64-unknown-linux/4.5.0/crtbegin.o
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing1/bin/.keep b/clang/test/Driver/Inputs/gcc_version_parsing1/bin/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing1/bin/.keep
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.6.99/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.6.99/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.6.99/crtbegin.o
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.6/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.6/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.6/crtbegin.o
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7.1/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7.1/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7.1/crtbegin.o
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7/crtbegin.o
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing2/bin/.keep b/clang/test/Driver/Inputs/gcc_version_parsing2/bin/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing2/bin/.keep
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.99/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.99/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.99/crtbegin.o
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.x/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.x/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.x/crtbegin.o
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.1/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.1/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.1/crtbegin.o
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.x/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.x/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.x/crtbegin.o
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing3/bin/.keep b/clang/test/Driver/Inputs/gcc_version_parsing3/bin/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing3/bin/.keep
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing3/lib/gcc/i386-unknown-linux/4.7.98/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing3/lib/gcc/i386-unknown-linux/4.7.98/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing3/lib/gcc/i386-unknown-linux/4.7.98/crtbegin.o
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing3/lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing3/lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing3/lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing4/bin/.keep b/clang/test/Driver/Inputs/gcc_version_parsing4/bin/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing4/bin/.keep
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.98/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.98/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.98/crtbegin.o
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o
diff --git a/clang/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.99/crtbegin.o b/clang/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.99/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.99/crtbegin.o
diff --git a/clang/test/Driver/Inputs/multiarch_freebsd64_tree/lib/.keep b/clang/test/Driver/Inputs/multiarch_freebsd64_tree/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multiarch_freebsd64_tree/lib/.keep
diff --git a/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/.keep b/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/crt1.o b/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/crt1.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/crt1.o
diff --git a/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/.keep b/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/.keep
diff --git a/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/crt1.o b/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/crt1.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/crt1.o
diff --git a/clang/test/Driver/Inputs/multilib_32bit_linux_tree/lib/.keep b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/lib/.keep
diff --git a/clang/test/Driver/Inputs/multilib_32bit_linux_tree/lib32/.keep b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/lib32/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/lib32/.keep
diff --git a/clang/test/Driver/Inputs/multilib_32bit_linux_tree/lib64/.keep b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/lib64/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/lib64/.keep
diff --git a/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib/.keep b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib/.keep
diff --git a/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib32/.keep b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib32/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib32/.keep
diff --git a/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib64/.keep b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib64/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib64/.keep
diff --git a/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/.keep b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/64/crtbegin.o b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/64/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/64/crtbegin.o
diff --git a/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o
diff --git a/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib32/.keep b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib32/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib32/.keep
diff --git a/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib64/.keep b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib64/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib64/.keep
diff --git a/clang/test/Driver/Inputs/multilib_64bit_linux_tree/lib/.keep b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/lib/.keep
diff --git a/clang/test/Driver/Inputs/multilib_64bit_linux_tree/lib32/.keep b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/lib32/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/lib32/.keep
diff --git a/clang/test/Driver/Inputs/multilib_64bit_linux_tree/lib64/.keep b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/lib64/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/lib64/.keep
diff --git a/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/.keep b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32/crtbegin.o b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32/crtbegin.o
diff --git a/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o
diff --git a/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib32/.keep b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib32/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib32/.keep
diff --git a/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib64/.keep b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib64/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/lib64/.keep
diff --git a/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib/.keep b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib/.keep
diff --git a/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib32/.keep b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib32/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib32/.keep
diff --git a/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib64/.keep b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib64/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/multilib_64bit_linux_tree/usr/x86_64-unknown-linux/lib64/.keep
diff --git a/clang/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-as b/clang/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-as
new file mode 100755
index 0000000..d901134
--- /dev/null
+++ b/clang/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-as
@@ -0,0 +1,2 @@
+#!/bin/sh
+# This file must be executable to be picked up by GetProgramPath
diff --git a/clang/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-ld b/clang/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-ld
new file mode 100755
index 0000000..d901134
--- /dev/null
+++ b/clang/test/Driver/Inputs/prefixed_tools_tree/x86_64--linux-ld
@@ -0,0 +1,2 @@
+#!/bin/sh
+# This file must be executable to be picked up by GetProgramPath
diff --git a/clang/test/Driver/Inputs/suse_10.3_ppc64_tree/lib/.keep b/clang/test/Driver/Inputs/suse_10.3_ppc64_tree/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/suse_10.3_ppc64_tree/lib/.keep
diff --git a/clang/test/Driver/Inputs/suse_10.3_ppc64_tree/lib64/.keep b/clang/test/Driver/Inputs/suse_10.3_ppc64_tree/lib64/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/suse_10.3_ppc64_tree/lib64/.keep
diff --git a/clang/test/Driver/Inputs/suse_10.3_ppc64_tree/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64/crtbegin.o b/clang/test/Driver/Inputs/suse_10.3_ppc64_tree/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/suse_10.3_ppc64_tree/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64/crtbegin.o
diff --git a/clang/test/Driver/Inputs/suse_10.3_ppc64_tree/usr/lib/gcc/powerpc64-suse-linux/4.1.2/crtbegin.o b/clang/test/Driver/Inputs/suse_10.3_ppc64_tree/usr/lib/gcc/powerpc64-suse-linux/4.1.2/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/suse_10.3_ppc64_tree/usr/lib/gcc/powerpc64-suse-linux/4.1.2/crtbegin.o
diff --git a/clang/test/Driver/Inputs/suse_10.3_ppc64_tree/usr/lib64/.keep b/clang/test/Driver/Inputs/suse_10.3_ppc64_tree/usr/lib64/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/suse_10.3_ppc64_tree/usr/lib64/.keep
diff --git a/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/lib/.keep b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/lib/.keep
diff --git a/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/lib/i386-linux-gnu/.keep b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/lib/i386-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/lib/i386-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/.keep b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/.keep
diff --git a/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/c++/4.5/.keep b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/c++/4.5/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/c++/4.5/.keep
diff --git a/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/c++/4.5/backward/.keep b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/c++/4.5/backward/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/c++/4.5/backward/.keep
diff --git a/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/c++/4.5/i686-linux-gnu/.keep b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/c++/4.5/i686-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/c++/4.5/i686-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/i386-linux-gnu/.keep b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/i386-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/include/i386-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/lib/.keep b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/lib/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/lib/.keep
diff --git a/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/lib/i386-linux-gnu/.keep b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/lib/i386-linux-gnu/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/lib/i386-linux-gnu/.keep
diff --git a/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/crtbegin.o b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/crtbegin.o
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/ubuntu_11.04_multiarch_tree/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/crtbegin.o
diff --git a/clang/test/Driver/Wp-args.c b/clang/test/Driver/Wp-args.c
new file mode 100644
index 0000000..0ab85b4
--- /dev/null
+++ b/clang/test/Driver/Wp-args.c
@@ -0,0 +1,13 @@
+// Check that we extract -MD from '-Wp,-MD,FOO', which is used by a number of
+// major projects (e.g., FireFox and the Linux Kernel).
+
+// RUN: %clang --target i386-pc-linux-gnu -### \
+// RUN: -Wp,-MD,FOO.d -fsyntax-only %s 2> %t
+// RUN: FileCheck < %t %s
+//
+// CHECK: "-cc1"
+// CHECK-NOT: -MD
+// CHECK: "-dependency-file" "FOO.d"
+// CHECK: "-MT"
+//
+// PR4062
diff --git a/clang/test/Driver/Xarch.c b/clang/test/Driver/Xarch.c
new file mode 100644
index 0000000..2523f5a
--- /dev/null
+++ b/clang/test/Driver/Xarch.c
@@ -0,0 +1,9 @@
+// RUN: %clang -target i386-apple-darwin9 -m32 -Xarch_i386 -O2 %s -S -### 2> %t.log
+// RUN: grep ' "-O2" ' %t.log | count 1
+// RUN: %clang -target i386-apple-darwin9 -m64 -Xarch_i386 -O2 %s -S -### 2> %t.log
+// RUN: grep ' "-O2" ' %t.log | count 0
+// RUN: grep "argument unused during compilation: '-Xarch_i386 -O2'" %t.log
+// RUN: not %clang -target i386-apple-darwin9 -m32 -Xarch_i386 -o -Xarch_i386 -S %s -S -Xarch_i386 -o 2> %t.log
+// RUN: grep "error: invalid Xarch argument: '-Xarch_i386 -o'" %t.log | count 2
+// RUN: grep "error: invalid Xarch argument: '-Xarch_i386 -S'" %t.log
+
diff --git a/clang/test/Driver/Xlinker-args.c b/clang/test/Driver/Xlinker-args.c
new file mode 100644
index 0000000..b4e5a9b
--- /dev/null
+++ b/clang/test/Driver/Xlinker-args.c
@@ -0,0 +1,9 @@
+// Check that we extract --no-demangle from '-Xlinker' and '-Wl,', since that
+// was a collect2 argument.
+
+// RUN: %clang -target i386-apple-darwin9 -### \
+// RUN: -Xlinker one -Xlinker --no-demangle \
+// RUN: -Wl,two,--no-demangle,three -Xlinker four %s 2> %t
+// RUN: FileCheck < %t %s
+//
+// CHECK: "one" "two" "three" "four"
diff --git a/clang/test/Driver/altivec.cpp b/clang/test/Driver/altivec.cpp
new file mode 100644
index 0000000..6059ad0
--- /dev/null
+++ b/clang/test/Driver/altivec.cpp
@@ -0,0 +1,14 @@
+// Check that we error when -faltivec is specified on non-ppc platforms.
+
+// RUN: %clang -ccc-clang-archs powerpc -target powerpc-apple-darwin -faltivec -fsyntax-only %s
+// RUN: %clang -ccc-clang-archs powerpc64 -target powerpc64-linux-gnu -faltivec -fsyntax-only %s
+
+// RUN: %clang -target i386-pc-win32 -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
+// RUN: %clang -target x86_64-unknown-freebsd -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
+// RUN: %clang -target armv6-apple-darwin -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
+// RUN: %clang -target armv7-apple-darwin -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
+// RUN: %clang -ccc-clang-archs mips -target mips-linux-gnu -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
+// RUN: %clang -ccc-clang-archs mips64 -target mips64-linux-gnu -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
+// RUN: %clang -ccc-clang-archs sparc -target sparc-unknown-solaris -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
+
+// CHECK: invalid argument '-faltivec' only allowed with 'ppc/ppc64'
diff --git a/clang/test/Driver/analyze.c b/clang/test/Driver/analyze.c
new file mode 100644
index 0000000..68fa218
--- /dev/null
+++ b/clang/test/Driver/analyze.c
@@ -0,0 +1,8 @@
+// Verify that the analyzer gets the same flags as normal compilation
+// (at least for a few key ones).
+
+// RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 %clang -target i386-apple-darwin9 -### --analyze -o /dev/null %s -msse 2> %t.log
+// RUN: FileCheck --input-file=%t.log %s
+
+// CHECK: "-analyze"
+// CHECK: "-target-feature" "+sse"
diff --git a/clang/test/Driver/apple-kext-i386.cpp b/clang/test/Driver/apple-kext-i386.cpp
new file mode 100644
index 0000000..c11a136
--- /dev/null
+++ b/clang/test/Driver/apple-kext-i386.cpp
@@ -0,0 +1,50 @@
+// Check that we transparently fallback to llvm-gcc for i386 kexts, we don't
+// support the ABI they use (yet).
+
+// RUN: %clang -target i386-apple-darwin10 \
+// RUN: -fapple-kext -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK < %t %s
+
+// CHECK: cc1plus"
+// CHECK: "-fapple-kext"
+
+// RUN: %clang -target i386-apple-darwin10 \
+// RUN: -mkernel -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-MKERNEL < %t %s
+
+// CHECK-MKERNEL: cc1plus"
+// CHECK-MKERNEL: "-mkernel"
+
+// RUN: %clang -target i386-apple-darwin10 \
+// RUN: -Wno-self-assign -Wc++11-extensions -Wno-microsoft -Wmicrosoft -Wvla \
+// RUN: -faltivec -mthumb -mcpu=G4 -mlongcall -mno-longcall -msoft-float \
+// RUN: -fapple-kext -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-UNSUPPORTED < %t %s
+
+// CHECK-UNSUPPORTED: cc1plus"
+// CHECK-UNSUPPORTED-NOT: "-Wno-self-assign"
+// CHECK-UNSUPPORTED-NOT: "-Wc++11-extensions"
+// CHECK-UNSUPPORTED-NOT: "-Wno-microsoft"
+// CHECK-UNSUPPORTED-NOT: "-Wmicrosoft"
+// CHECK-UNSUPPORTED-NOT: "-Wvla"
+// CHECK-UNSUPPORTED-NOT: "-faltivec"
+// CHECK-UNSUPPORTED-NOT: "-mthumb"
+// CHECK-UNSUPPORTED-NOT: "-mlongcall"
+// CHECK-UNSUPPORTED: "-mno-longcall"
+// CHECK-UNSUPPORTED: "-msoft-float"
+
+// RUN: %clang -target i386-apple-darwin10 \
+// RUN: -Wconstant-logical-operand -save-temps \
+// RUN: -fapple-kext -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-UNSUPPORTED2 < %t %s
+
+// CHECK-UNSUPPORTED2: cc1plus"
+// CHECK-UNSUPPORTED2-NOT: "-Wconstant-logical-operand"
+
+// Check that --serialize-diagnostics does not cause an "argument unused" error.
+// RUN: %clang -target i386-apple-darwin10 \
+// RUN: -Wall -fapple-kext -### --serialize-diagnostics %t.dia -c %s 2>&1 | \
+// RUN: FileCheck --check-prefix=CHECK-UNUSED %s
+
+// CHECK-UNUSED-NOT: argument unused
+// CHECK-UNUSED: cc1plus
diff --git a/clang/test/Driver/apple-kext-mkernel.c b/clang/test/Driver/apple-kext-mkernel.c
new file mode 100644
index 0000000..f8b7b90
--- /dev/null
+++ b/clang/test/Driver/apple-kext-mkernel.c
@@ -0,0 +1,22 @@
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN: -mkernel -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-X86 < %t %s
+
+// CHECK-X86: "-disable-red-zone"
+// CHECK-X86: "-fno-builtin"
+// CHECK-X86: "-fno-rtti"
+// CHECK-X86: "-fno-common"
+
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN: -arch armv7 -mkernel -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-ARM < %t %s
+
+// CHECK-ARM: "-backend-option" "-arm-long-calls"
+// CHECK-ARM: "-backend-option" "-arm-strict-align"
+// CHECK-ARM: "-fno-builtin"
+// CHECK-ARM: "-fno-rtti"
+// CHECK-ARM: "-fno-common"
+
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN: -Werror -fno-builtin -fno-exceptions -fno-common -fno-rtti \
+// RUN: -mkernel -fsyntax-only %s
diff --git a/clang/test/Driver/arc-exceptions.m b/clang/test/Driver/arc-exceptions.m
new file mode 100644
index 0000000..4501ccd
--- /dev/null
+++ b/clang/test/Driver/arc-exceptions.m
@@ -0,0 +1,5 @@
+// RUN: %clang -### -x objective-c -arch x86_64 -fobjc-arc -fsyntax-only %s 2> %t.log
+// RUN: grep objective-c %t.log
+// RUN: not grep "fobjc-arc-exceptions" %t.log
+// RUN: %clang -### -x objective-c++ -arch x86_64 -fobjc-arc -fsyntax-only %s 2> %t.log
+// RUN: grep "fobjc-arc-exceptions" %t.log
diff --git a/clang/test/Driver/arc.c b/clang/test/Driver/arc.c
new file mode 100644
index 0000000..f2c1127
--- /dev/null
+++ b/clang/test/Driver/arc.c
@@ -0,0 +1,17 @@
+// RUN: %clang -ObjC -target i386-apple-darwin10 -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -x objective-c -target i386-apple-darwin10 -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -x objective-c++ -target i386-apple-darwin10 -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck %s
+// RUN: %clang -x c -target i386-apple-darwin10 -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck -check-prefix NOTOBJC %s
+// RUN: %clang -x c++ -target i386-apple-darwin10 -m32 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck -check-prefix NOTOBJC %s
+// RUN: %clang -x objective-c -target x86_64-apple-darwin11 -mmacosx-version-min=10.5 -fobjc-arc %s -fsyntax-only 2>&1 | FileCheck -check-prefix UNSUPPORTED %s
+
+// Just to test clang is working.
+# foo
+
+// CHECK: error: -fobjc-arc is not supported with fragile abi
+// CHECK-NOT: invalid preprocessing directive
+
+// NOTOBJC-NOT: error: -fobjc-arc is not supported with fragile abi
+// NOTOBJC: invalid preprocessing directive
+
+// UNSUPPORTED: error: -fobjc-arc is not supported on current deployment target
diff --git a/clang/test/Driver/arch.c b/clang/test/Driver/arch.c
new file mode 100644
index 0000000..df9a3e1
--- /dev/null
+++ b/clang/test/Driver/arch.c
@@ -0,0 +1,3 @@
+// RUN: %clang -target armv7a-unknown-linux-gnueabi -S -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: target triple = "armv7-unknown-linux-gnueabi"
diff --git a/clang/test/Driver/arclite-link.c b/clang/test/Driver/arclite-link.c
new file mode 100644
index 0000000..9cf1efe
--- /dev/null
+++ b/clang/test/Driver/arclite-link.c
@@ -0,0 +1,8 @@
+// RUN: touch %t.o
+// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-ARCLITE-OSX %s
+// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.8 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s
+// RUN: %clang -### -target i386-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s
+
+// CHECK-ARCLITE-OSX: libarclite_macosx.a
+// CHECK-ARCLITE-OSX: -lobjc
+// CHECK-NOARCLITE-NOT: libarclite
diff --git a/clang/test/Driver/arm-darwin-builtin.c b/clang/test/Driver/arm-darwin-builtin.c
new file mode 100644
index 0000000..41f13f3
--- /dev/null
+++ b/clang/test/Driver/arm-darwin-builtin.c
@@ -0,0 +1,14 @@
+// FIXME: Disable pending PR4941.
+// RUX: clang -target x86_64-apple-darwin9 -arch arm -### -fsyntax-only %s 2> %t &&
+// RUX: grep -- "-fno-builtin-strcat" %t &&
+// RUX: grep -- "-fno-builtin-strcpy" %t &&
+
+// FIXME: Disable pending PR4941.
+// RUX: clang -target x86_64-apple-darwin9 -arch arm -### -fsyntax-only %s -fbuiltin-strcat -fbuiltin-strcpy 2> %t &&
+// RUX: not grep -- "-fno-builtin-strcat" %t &&
+// RUX: not grep -- "-fno-builtin-strcpy" %t &&
+
+// RUN: %clang -ccc-no-clang -target x86_64-apple-darwin9 -arch arm -### -fsyntax-only %s -fbuiltin-strcat -fbuiltin-strcpy 2> %t
+// RUN: not grep -- "-fno-builtin-strcat" %t
+// RUN: not grep -- "-fno-builtin-strcpy" %t
+
diff --git a/clang/test/Driver/arm-mfpmath.c b/clang/test/Driver/arm-mfpmath.c
new file mode 100644
index 0000000..0421046
--- /dev/null
+++ b/clang/test/Driver/arm-mfpmath.c
@@ -0,0 +1,29 @@
+// Test different values of -mfpmath.
+
+// RUN: %clang -target arm-apple-darwin10 -mfpmath=vfp %s -### -c -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-VFP %s
+// CHECK-VFP: "-target-feature" "-neonfp"
+
+// RUN: %clang -target arm-apple-darwin10 -mfpmath=vfp2 %s -### -c -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-VFP2 %s
+// CHECK-VFP2: "-target-feature" "-neonfp"
+
+// RUN: %clang -target arm-apple-darwin10 -mfpmath=vfp3 %s -### -c -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-VFP3 %s
+// CHECK-VFP3: "-target-feature" "-neonfp"
+
+// RUN: %clang -target arm-apple-darwin10 -mfpmath=vfp4 %s -### -c -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-VFP4 %s
+// CHECK-VFP4: "-target-feature" "-neonfp"
+
+// RUN: %clang -target arm-apple-darwin10 -mfpmath=neon %s -### -c -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NEON %s
+// CHECK-NEON: "-target-feature" "+neonfp"
+
+// RUN: %clang -target arm-apple-darwin10 -mfpmath=foo %s -### -c -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-ERROR %s
+// CHECK-ERROR: clang compiler does not support '-mfpmath=foo'
+
+// RUN: %clang -target arm-apple-darwin10 -mcpu=arm1136j-s -mfpmath=neon %s -### -c -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-MCPU-ERROR %s
+// CHECK-MCPU-ERROR: error: invalid feature '-mfpmath=neon' for CPU 'arm1136j-s'
diff --git a/clang/test/Driver/arm-mfpu.c b/clang/test/Driver/arm-mfpu.c
new file mode 100644
index 0000000..f51c41e
--- /dev/null
+++ b/clang/test/Driver/arm-mfpu.c
@@ -0,0 +1,48 @@
+// Test that different values of -mfpu pick correct ARM FPU target-feature(s).
+
+// RUN: %clang -target arm-linux-eabi %s -### -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-DEFAULT %s
+// CHECK-DEFAULT-NOT: "-target-feature" "+vfp2"
+// CHECK-DEFAULT-NOT: "-target-feature" "+vfp3"
+// CHECK-DEFAULT-NOT: "-target-feature" "+d16"
+// CHECK-DEFAULT-NOT: "-target-feature" "+neon"
+
+// RUN: %clang -target arm-linux-eabi -mfpu=fpa %s -### -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-FPA %s
+// RUN: %clang -target arm-linux-eabi -mfpu=fpe2 %s -### -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-FPA %s
+// RUN: %clang -target arm-linux-eabi -mfpu=fpe3 %s -### -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-FPA %s
+// RUN: %clang -target arm-linux-eabi -mfpu=maverick %s -### -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-FPA %s
+// CHECK-FPA: "-target-feature" "-vfp2"
+// CHECK-FPA: "-target-feature" "-vfp3"
+// CHECK-FPA: "-target-feature" "-neon"
+
+// RUN: %clang -target arm-linux-eabi -mfpu=vfp3-d16 %s -### -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-VFP3-D16 %s
+// RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-d16 %s -### -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-VFP3-D16 %s
+// CHECK-VFP3-D16: "-target-feature" "+vfp3"
+// CHECK-VFP3-D16: "-target-feature" "+d16"
+// CHECK-VFP3-D16: "-target-feature" "-neon"
+
+// RUN: %clang -target arm-linux-eabi -mfpu=vfp %s -### -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-VFP %s
+// CHECK-VFP: "-target-feature" "+vfp2"
+// CHECK-VFP: "-target-feature" "-neon"
+
+// RUN: %clang -target arm-linux-eabi -mfpu=vfp3 %s -### -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-VFP3 %s
+// RUN: %clang -target arm-linux-eabi -mfpu=vfpv3 %s -### -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-VFP3 %s
+// CHECK-VFP3: "-target-feature" "+vfp3"
+// CHECK-VFP3: "-target-feature" "-neon"
+
+// RUN: %clang -target arm-linux-eabi -mfpu=neon %s -### -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NEON %s
+// CHECK-NEON: "-target-feature" "+neon"
+
+// RUN: %clang -target arm-linux-eabi -msoft-float %s -### -o %t.o 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-SOFT-FLOAT %s
+// CHECK-SOFT-FLOAT: "-target-feature" "-neon"
diff --git a/clang/test/Driver/asan.c b/clang/test/Driver/asan.c
new file mode 100644
index 0000000..4c9a1b6
--- /dev/null
+++ b/clang/test/Driver/asan.c
@@ -0,0 +1,8 @@
+// RUN: %clang -target i386-unknown-unknown -faddress-sanitizer %s -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang -O1 -target i386-unknown-unknown -faddress-sanitizer %s -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang -O2 -target i386-unknown-unknown -faddress-sanitizer %s -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang -O3 -target i386-unknown-unknown -faddress-sanitizer %s -S -emit-llvm -o - | FileCheck %s
+// Verify that -faddress-sanitizer invokes asan instrumentation.
+
+int foo(int *a) { return *a; }
+// CHECK: __asan_init
diff --git a/clang/test/Driver/ast.c b/clang/test/Driver/ast.c
new file mode 100644
index 0000000..83dfcc3
--- /dev/null
+++ b/clang/test/Driver/ast.c
@@ -0,0 +1,26 @@
+// RUN: %clang -target i386-unknown-unknown -ccc-print-phases -emit-ast %s 2> %t
+// RUN: echo 'END' >> %t
+// RUN: FileCheck -check-prefix EMIT-AST-PHASES -input-file %t %s
+
+// EMIT-AST-PHASES: 0: input,
+// EMIT-AST-PHASES: , c
+// EMIT-AST-PHASES: 1: preprocessor, {0}, cpp-output
+// EMIT-AST-PHASES: 2: compiler, {1}, ast
+// EMIT-AST-PHASES-NOT: 3:
+// EMIT-AST-PHASES: END
+
+// RUN: touch %t.ast
+// RUN: %clang -target i386-unknown-unknown -ccc-print-phases -c %t.ast 2> %t
+// RUN: echo 'END' >> %t
+// RUN: FileCheck -check-prefix COMPILE-AST-PHASES -input-file %t %s
+
+// COMPILE-AST-PHASES: 0: input,
+// COMPILE-AST-PHASES: , ast
+// COMPILE-AST-PHASES: 1: compiler, {0}, assembler
+// COMPILE-AST-PHASES: 2: assembler, {1}, object
+// COMPILE-AST-PHASES-NOT: 3:
+// COMPILE-AST-PHASES: END
+
+// FIXME: There is a problem with compiling AST's in that the input language is
+// not available for use by other tools (for example, to automatically add
+// -lstdc++). We may need -x [objective-]c++-ast and all that goodness. :(
diff --git a/clang/test/Driver/at_file.c b/clang/test/Driver/at_file.c
new file mode 100644
index 0000000..4ad2a5f
--- /dev/null
+++ b/clang/test/Driver/at_file.c
@@ -0,0 +1,30 @@
+// RUN: %clang -E %s @%s.args -o %t.log
+// RUN: FileCheck --input-file=%t.log %s
+
+// CHECK: bar1
+// CHECK-NEXT: bar2 zed2
+// CHECK-NEXT: bar3 zed3
+// CHECK-NEXT: bar4 zed4
+// CHECK-NEXT: bar5 zed5
+// CHECK-NEXT: 'bar6 zed6'
+// CHECK-NEXT: "bar7 zed7"
+// CHECK-NEXT: foo8bar8zed8
+// CHECK-NEXT: foo9'bar9'zed9
+// CHECK-NEXT: foo10"bar10"zed10
+// CHECK: bar
+// CHECK: zed12
+
+foo1
+foo2
+foo3
+foo4
+foo5
+foo6
+foo7
+foo8
+foo9
+foo10
+#ifdef foo11
+bar
+#endif
+foo12
diff --git a/clang/test/Driver/at_file.c.args b/clang/test/Driver/at_file.c.args
new file mode 100644
index 0000000..9a2b4ee
--- /dev/null
+++ b/clang/test/Driver/at_file.c.args
@@ -0,0 +1,11 @@
+-Dfoo1=bar1 -Dfoo2="bar2 zed2"
+-Dfoo3='bar3 zed3'
+"-Dfoo4=bar4 zed4"
+'-Dfoo5=bar5 zed5'
+-Dfoo6="'bar6 zed6'"
+-Dfoo7='"bar7 zed7"'
+-Dfoo8=foo8"bar8"zed8
+-Dfoo9=foo9\'bar9\'zed9
+-Dfoo10=foo10\"bar10\"zed10
+-D foo11
+-Dfoo12=zed12\
diff --git a/clang/test/Driver/bindings.c b/clang/test/Driver/bindings.c
new file mode 100644
index 0000000..a7cda19
--- /dev/null
+++ b/clang/test/Driver/bindings.c
@@ -0,0 +1,49 @@
+// Basic binding.
+// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings %s 2> %t
+// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: ".*\.s"' %t
+// RUN: grep '"gcc::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t
+// RUN: grep '"gcc::Link", inputs: \[".*\.o"\], output: "a.out"' %t
+
+// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -ccc-no-clang %s 2> %t
+// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: ".*\.s"' %t
+// RUN: grep '"gcc::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t
+// RUN: grep '"gcc::Link", inputs: \[".*\.o"\], output: "a.out"' %t
+
+// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -no-integrated-cpp %s 2> %t
+// RUN: grep '"gcc::Preprocess", inputs: \[".*bindings.c"\], output: ".*\.i"' %t
+// RUN: grep '"gcc::Compile", inputs: \[".*\.i"\], output: ".*\.s"' %t
+// RUN: grep '"gcc::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t
+// RUN: grep '"gcc::Link", inputs: \[".*\.o"\], output: "a.out"' %t
+
+// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -x c-header %s 2> %t
+// RUN: grep '"gcc::Precompile", inputs: \[".*bindings.c"\], output: ".*bindings.c.gch' %t
+
+// Clang control options
+
+// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -fsyntax-only %s 2> %t
+// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: (nothing)' %t
+// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -fsyntax-only %s 2> %t
+// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: (nothing)' %t
+// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -ccc-no-clang-cxx -fsyntax-only -x c++ %s 2> %t
+// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: (nothing)' %t
+// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -ccc-clang-cxx -fsyntax-only -x c++ %s 2> %t
+// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: (nothing)' %t
+// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -ccc-no-clang-cpp -fsyntax-only -no-integrated-cpp %s 2> %t
+// RUN: grep '"gcc::Preprocess", inputs: \[".*bindings.c"\], output: ".*\.i"' %t
+// RUN: grep '"clang", inputs: \[".*\.i"\], output: (nothing)' %t
+// RUN: %clang -target i386-apple-darwin9 -ccc-print-bindings -ccc-clang-archs i386 %s -S -arch ppc 2> %t
+// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: "bindings.s"' %t
+// RUN: %clang -target i386-apple-darwin9 -ccc-print-bindings -ccc-clang-archs powerpc %s -S -arch ppc 2> %t
+// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: "bindings.s"' %t
+
+// RUN: %clang -target powerpc-unknown-unknown -ccc-print-bindings -ccc-clang-archs "" %s -S 2> %t
+// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: "bindings.s"' %t
+// RUN: %clang -target powerpc-unknown-unknown -ccc-print-bindings -ccc-clang-archs "i386" %s -S 2> %t
+// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: "bindings.s"' %t
+
+// Darwin bindings
+// RUN: %clang -target i386-apple-darwin9 -no-integrated-as -ccc-print-bindings %s 2> %t
+// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: ".*\.s"' %t
+// RUN: grep '"darwin::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t
+// RUN: grep '"darwin::Link", inputs: \[".*\.o"\], output: "a.out"' %t
+
diff --git a/clang/test/Driver/cc-log-diagnostics.c b/clang/test/Driver/cc-log-diagnostics.c
new file mode 100644
index 0000000..88c99f5
--- /dev/null
+++ b/clang/test/Driver/cc-log-diagnostics.c
@@ -0,0 +1,35 @@
+// RUN: rm -f %t.log
+// RUN: env RC_DEBUG_OPTIONS=1 \
+// RUN: CC_LOG_DIAGNOSTICS=1 CC_LOG_DIAGNOSTICS_FILE=%t.log \
+// RUN: %clang -Wfoobar -no-canonical-prefixes -target x86_64-apple-darwin10 -fsyntax-only %s
+// RUN: FileCheck %s < %t.log
+
+int f0() {}
+
+// CHECK: <dict>
+// CHECK: <key>main-file</key>
+// CHECK: <string>{{.*}}cc-log-diagnostics.c</string>
+// CHECK: <key>dwarf-debug-flags</key>
+// CHECK: <string>{{.*}}clang{{.*}}-fsyntax-only{{.*}}</string>
+// CHECK: <key>diagnostics</key>
+// CHECK: <array>
+// CHECK: <dict>
+// CHECK: <key>level</key>
+// CHECK: <string>warning</string>
+// CHECK: <key>message</key>
+// CHECK: <string>unknown warning option &apos;-Wfoobar&apos;; did you mean &apos;-W{{.*}}&apos;?</string>
+// CHECK: </dict>
+// CHECK: <dict>
+// CHECK: <key>level</key>
+// CHECK: <string>warning</string>
+// CHECK: <key>filename</key>
+// CHECK: <string>{{.*}}cc-log-diagnostics.c</string>
+// CHECK: <key>line</key>
+// CHECK: <integer>7</integer>
+// CHECK: <key>column</key>
+// CHECK: <integer>11</integer>
+// CHECK: <key>message</key>
+// CHECK: <string>control reaches end of non-void function</string>
+// CHECK: </dict>
+// CHECK: </array>
+// CHECK: </dict>
diff --git a/clang/test/Driver/cc-print-options.c b/clang/test/Driver/cc-print-options.c
new file mode 100644
index 0000000..77dd0fe
--- /dev/null
+++ b/clang/test/Driver/cc-print-options.c
@@ -0,0 +1,7 @@
+// RUN: env CC_PRINT_OPTIONS=1 \
+// RUN: CC_PRINT_OPTIONS_FILE=%t.log \
+// RUN: %clang -no-canonical-prefixes -S -o %t.s %s
+// RUN: FileCheck %s < %t.log
+
+// CHECK: [Logging clang options]{{.*}}clang{{.*}}"-S"
+
diff --git a/clang/test/Driver/ccc-add-args.c b/clang/test/Driver/ccc-add-args.c
new file mode 100644
index 0000000..d9a16cb
--- /dev/null
+++ b/clang/test/Driver/ccc-add-args.c
@@ -0,0 +1,5 @@
+// RUN: env CCC_ADD_ARGS="-ccc-echo,-ccc-print-options,,-v" %clang -### 2>&1 | FileCheck %s
+// CHECK: Option 0 - Name: "-ccc-echo", Values: {}
+// CHECK: Option 1 - Name: "-ccc-print-options", Values: {}
+// CHECK: Option 2 - Name: "-v", Values: {}
+// CHECK: Option 3 - Name: "-###", Values: {}
diff --git a/clang/test/Driver/ccc-host-triple-no-integrated-as.c b/clang/test/Driver/ccc-host-triple-no-integrated-as.c
new file mode 100644
index 0000000..1677b71
--- /dev/null
+++ b/clang/test/Driver/ccc-host-triple-no-integrated-as.c
@@ -0,0 +1,17 @@
+// Check that -no-integrated-as works when -target i386-pc-win32-macho or
+// -target x86_64-pc-win32-macho is specified.
+
+// RUN: %clang -### -c -target i386-pc-win32-macho -no-integrated-as %s 2> %t1
+// RUN: FileCheck -check-prefix=X86 < %t1 %s
+// RUN: %clang -### -c -target x86_64-pc-win32-macho -no-integrated-as %s 2> %t2
+// RUN: FileCheck -check-prefix=X86_64 < %t2 %s
+//
+// X86: "-cc1"
+// X86-NOT: "-cc1as"
+// X86: "-arch"
+// X86: "i386"
+//
+// X86_64: "-cc1"
+// X86_64-NOT: "-cc1as"
+// X86_64: "-arch"
+// X86_64: "x86_64"
diff --git a/clang/test/Driver/cfi.c b/clang/test/Driver/cfi.c
new file mode 100644
index 0000000..c33d190
--- /dev/null
+++ b/clang/test/Driver/cfi.c
@@ -0,0 +1,9 @@
+// RUN: %clang -target i386-apple-darwin10 \
+// RUN: -no-integrated-as -### %s 2>&1 | \
+// RUN: FileCheck --check-prefix=CHECK-DARWIN %s
+
+// RUN: %clang -target i386-pc-linux-gnu -static -### %s 2>&1 | \
+// RUN: FileCheck --check-prefix=CHECK-LINUX %s
+
+// CHECK-DARWIN: -fno-dwarf2-cfi-asm
+// CHECK-LINUX-NOT: -fno-dwarf2-cfi-asm
diff --git a/clang/test/Driver/clang-c-as-cxx.c b/clang/test/Driver/clang-c-as-cxx.c
new file mode 100644
index 0000000..0e28178
--- /dev/null
+++ b/clang/test/Driver/clang-c-as-cxx.c
@@ -0,0 +1,6 @@
+// RUN: %clangxx -### %s 2>&1 | FileCheck %s
+//
+// PR5803
+//
+// CHECK: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
+// CHECK: "-cc1" {{.*}} "-x" "c++"
diff --git a/clang/test/Driver/clang-exception-flags.cpp b/clang/test/Driver/clang-exception-flags.cpp
new file mode 100644
index 0000000..90a9ebf
--- /dev/null
+++ b/clang/test/Driver/clang-exception-flags.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang -### %s 2>&1 | FileCheck %s -check-prefix=DEFAULT
+// DEFAULT: "-cc1" {{.*}} "-fcxx-exceptions" "-fexceptions"
+//
+// RUN: %clang -### -fexceptions %s 2>&1 | FileCheck %s -check-prefix=ON1
+// ON1: "-cc1" {{.*}} "-fcxx-exceptions" "-fexceptions"
+//
+// RUN: %clang -### -fno-exceptions -fcxx-exceptions %s 2>&1 | FileCheck %s -check-prefix=ON2
+// ON2: "-cc1" {{.*}} "-fcxx-exceptions" "-fexceptions"
+//
+// RUN: %clang -### -fno-cxx-exceptions -fexceptions %s 2>&1 | FileCheck %s -check-prefix=ON3
+// ON3: "-cc1" {{.*}} "-fcxx-exceptions" "-fexceptions"
+//
+// RUN: %clang -### -fno-exceptions %s 2>&1 | FileCheck %s -check-prefix=OFF1
+// OFF1-NOT: "-cc1" {{.*}} "-fcxx-exceptions"
+//
+// RUN: %clang -### -fno-cxx-exceptions %s 2>&1 | FileCheck %s -check-prefix=OFF2
+// OFF2-NOT: "-cc1" {{.*}} "-fcxx-exceptions"
+//
+// RUN: %clang -### -fcxx-exceptions -fno-exceptions %s 2>&1 | FileCheck %s -check-prefix=OFF3
+// OFF3-NOT: "-cc1" {{.*}} "-fcxx-exceptions"
+//
+// RUN: %clang -### -fexceptions -fno-cxx-exceptions %s 2>&1 | FileCheck %s -check-prefix=OFF4
+// OFF4-NOT: "-cc1" {{.*}} "-fcxx-exceptions"
diff --git a/clang/test/Driver/clang-g-opts.c b/clang/test/Driver/clang-g-opts.c
new file mode 100644
index 0000000..4dbdf61
--- /dev/null
+++ b/clang/test/Driver/clang-g-opts.c
@@ -0,0 +1,5 @@
+// RUN: %clang -S -v -o %t %s 2>&1 | not grep -w -- -g
+// RUN: %clang -S -v -o %t %s -g 2>&1 | grep -w -- -g
+// RUN: %clang -S -v -o %t %s -g0 2>&1 | not grep -w -- -g
+// RUN: %clang -S -v -o %t %s -g -g0 2>&1 | not grep -w -- -g
+// RUN: %clang -S -v -o %t %s -g0 -g 2>&1 | grep -w -- -g
diff --git a/clang/test/Driver/clang-translation.c b/clang/test/Driver/clang-translation.c
new file mode 100644
index 0000000..0e82de4
--- /dev/null
+++ b/clang/test/Driver/clang-translation.c
@@ -0,0 +1,46 @@
+// RUN: %clang -target i386-unknown-unknown -### -S -O0 -Os %s -o %t.s -fverbose-asm -funwind-tables -fvisibility=hidden 2> %t.log
+// RUN: grep '"-triple" "i386-unknown-unknown"' %t.log
+// RUN: grep '"-S"' %t.log
+// RUN: grep '"-disable-free"' %t.log
+// RUN: grep '"-mrelocation-model" "static"' %t.log
+// RUN: grep '"-mdisable-fp-elim"' %t.log
+// RUN: grep '"-munwind-tables"' %t.log
+// RUN: grep '"-Os"' %t.log
+// RUN: grep '"-o" .*clang-translation.*' %t.log
+// RUN: grep '"-masm-verbose"' %t.log
+// RUN: grep '"-fvisibility" "hidden"' %t.log
+// RUN: %clang -target i386-apple-darwin9 -### -S %s -o %t.s 2> %t.log
+// RUN: grep '"-target-cpu" "yonah"' %t.log
+// RUN: %clang -target x86_64-apple-darwin9 -### -S %s -o %t.s 2> %t.log
+// RUN: grep '"-target-cpu" "core2"' %t.log
+
+// RUN: %clang -target x86_64-apple-darwin10 -### -S %s 2> %t.log \
+// RUN: -arch armv7
+// RUN: FileCheck -check-prefix=ARMV7_DEFAULT %s < %t.log
+// ARMV7_DEFAULT: clang
+// ARMV7_DEFAULT: "-cc1"
+// ARMV7_DEFAULT-NOT: "-msoft-float"
+// ARMV7_DEFAULT: "-mfloat-abi" "soft"
+// ARMV7_DEFAULT-NOT: "-msoft-float"
+// ARMV7_DEFAULT: "-x" "c"
+
+// RUN: %clang -target x86_64-apple-darwin10 -### -S %s 2> %t.log \
+// RUN: -arch armv7 -msoft-float
+// RUN: FileCheck -check-prefix=ARMV7_SOFTFLOAT %s < %t.log
+// ARMV7_SOFTFLOAT: clang
+// ARMV7_SOFTFLOAT: "-cc1"
+// ARMV7_SOFTFLOAT: "-msoft-float"
+// ARMV7_SOFTFLOAT: "-mfloat-abi" "soft"
+// ARMV7_SOFTFLOAT: "-target-feature"
+// ARMV7_SOFTFLOAT: "-neon"
+// ARMV7_SOFTFLOAT: "-x" "c"
+
+// RUN: %clang -target x86_64-apple-darwin10 -### -S %s 2> %t.log \
+// RUN: -arch armv7 -mhard-float
+// RUN: FileCheck -check-prefix=ARMV7_HARDFLOAT %s < %t.log
+// ARMV7_HARDFLOAT: clang
+// ARMV7_HARDFLOAT: "-cc1"
+// ARMV7_HARDFLOAT-NOT: "-msoft-float"
+// ARMV7_HARDFLOAT: "-mfloat-abi" "hard"
+// ARMV7_HARDFLOAT-NOT: "-msoft-float"
+// ARMV7_HARDFLOAT: "-x" "c"
diff --git a/clang/test/Driver/clang_cpp.c b/clang/test/Driver/clang_cpp.c
new file mode 100644
index 0000000..79b2f55
--- /dev/null
+++ b/clang/test/Driver/clang_cpp.c
@@ -0,0 +1,4 @@
+// Verify that -include isn't included twice with -save-temps.
+// RUN: %clang -S -o - %s -include %t.h -save-temps -### 2> %t.log
+// RUN: grep '"-include' %t.log | count 1
+
diff --git a/clang/test/Driver/clang_f_opts.c b/clang/test/Driver/clang_f_opts.c
new file mode 100644
index 0000000..4eed4aa
--- /dev/null
+++ b/clang/test/Driver/clang_f_opts.c
@@ -0,0 +1,31 @@
+// RUN: %clang -### -S -fasm -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
+// RUN: %clang -### -S -fasm -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-asm -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-enums -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
+
+// CHECK-OPTIONS1: -fgnu-keywords
+// CHECK-OPTIONS1: -fblocks
+// CHECK-OPTIONS1: -fpascal-strings
+
+// CHECK_OPTIONS2: -fno-gnu-keywords
+// CHECK-OPTIONS2: -fmath-errno
+// CHECK-OPTIONS2: -fno-builtin
+// CHECK-OPTIONS2: -fshort-enums
+// CHECK-OPTIONS2: -fshort-wchar
+// CHECK-OPTIONS2: -fno-common
+// CHECK-OPTIONS2: -fno-show-source-location
+
+// RUN: %clang -### -S -Wwrite-strings %s 2>&1 | FileCheck -check-prefix=WRITE-STRINGS1 %s
+// WRITE-STRINGS1: -fconst-strings
+// RUN: %clang -### -S -Wwrite-strings -Wno-write-strings %s 2>&1 | FileCheck -check-prefix=WRITE-STRINGS2 %s
+// WRITE-STRINGS2-NOT: -fconst-strings
+// RUN: %clang -### -S -Wwrite-strings -w %s 2>&1 | FileCheck -check-prefix=WRITE-STRINGS3 %s
+// WRITE-STRINGS3: -fconst-strings
+
+// RUN: %clang -### -x c++ -c %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
+// RUN: %clang -### -x c++ -c -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
+// RUN: %clang -### -x c++ -c -Wno-deprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
+// RUN: %clang -### -x c++ -c -Wno-deprecated -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
+// RUN: %clang -### -x c++ -c -w %s 2>&1 | FileCheck -check-prefix=DEPRECATED-ON-CHECK %s
+// RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
+// RUN: %clang -### -c -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s
+// DEPRECATED-ON-CHECK: -fdeprecated-macro
+// DEPRECATED-OFF-CHECK-NOT: -fdeprecated-macro
diff --git a/clang/test/Driver/clang_wrapv_opts.c b/clang/test/Driver/clang_wrapv_opts.c
new file mode 100644
index 0000000..826468e
--- /dev/null
+++ b/clang/test/Driver/clang_wrapv_opts.c
@@ -0,0 +1,11 @@
+// RUN: %clang -### -S -fwrapv -fno-wrapv -fwrapv %s 2>&1 | FileCheck -check-prefix=CHECK1 %s
+// CHECK1: -fwrapv
+//
+// RUN: %clang -### -S -fstrict-overflow -fno-strict-overflow %s 2>&1 | FileCheck -check-prefix=CHECK2 %s
+// CHECK2: -fwrapv
+//
+// RUN: %clang -### -S -fwrapv -fstrict-overflow %s 2>&1 | FileCheck -check-prefix=CHECK3 %s
+// CHECK3: -fwrapv
+//
+// RUN: %clang -### -S -fno-wrapv -fno-strict-overflow %s 2>&1 | FileCheck -check-prefix=CHECK4 %s
+// CHECK4-NOT: -fwrapv
diff --git a/clang/test/Driver/cpath.c b/clang/test/Driver/cpath.c
new file mode 100644
index 0000000..bd7c8d0
--- /dev/null
+++ b/clang/test/Driver/cpath.c
@@ -0,0 +1,22 @@
+// RUN: mkdir -p %T/test1 %T/test2 %T/test3
+
+// RUN: env "CPATH=%T/test1%{pathsep}%T/test2" %clang -x c -E -v %s 2>&1 | FileCheck %s -check-prefix=CPATH
+// CPATH: -I {{.*}}/test1
+// CPATH: -I {{.*}}/test2
+// CPATH: search starts here
+// CPATH: test1
+// CPATH: test2
+
+// RUN: env "OBJC_INCLUDE_PATH=%T/test1%{pathsep}%T/test2" OBJCPLUS_INCLUDE_PATH=%T/test1 "CPLUS_INCLUDE_PATH=%T/test1%{pathsep}%t/test2" C_INCLUDE_PATH=%T/test3 %clang -x c -E -v %s 2>&1 | FileCheck %s -check-prefix=C_INCLUDE_PATH
+// C_INCLUDE_PATH: -c-isystem {{"?.*}}/test3{{"?}} -cxx-isystem {{"?.*}}/test1{{"?}} -cxx-isystem {{"?.*}}/test2{{"?}} -objc-isystem {{"?.*}}/test1{{"?}} -objc-isystem {{"?.*}}/test2{{"?}} -objcxx-isystem {{"?.*}}/test1{{"?}}
+// C_INCLUDE_PATH: search starts here
+// C_INCLUDE_PATH-NOT: test1
+// C_INCLUDE_PATH: test3
+// C_INCLUDE_PATH-NOT: test1
+
+// RUN: env OBJC_INCLUDE_PATH=%T/test1 OBJCPLUS_INCLUDE_PATH=%T/test3 CPLUS_INCLUDE_PATH=%T/test3 C_INCLUDE_PATH=%T/test1 %clang -x objective-c++ -E -v %s 2>&1 | FileCheck %s -check-prefix=OBJCPLUS_INCLUDE_PATH
+// OBJCPLUS_INCLUDE_PATH: -c-isystem {{"?.*}}/test1{{"?}} -cxx-isystem {{"?.*}}/test3{{"?}} -objc-isystem {{"?.*}}/test1{{"?}} -objcxx-isystem {{"?.*}}/test3{{"?}}
+// OBJCPLUS_INCLUDE_PATH: search starts here
+// OBJCPLUS_INCLUDE_PATH-NOT: test1
+// OBJCPLUS_INCLUDE_PATH: test3
+// OBJCPLUS_INCLUDE_PATH-NOT: test1
diff --git a/clang/test/Driver/cpp-precomp.c b/clang/test/Driver/cpp-precomp.c
new file mode 100644
index 0000000..a384a35
--- /dev/null
+++ b/clang/test/Driver/cpp-precomp.c
@@ -0,0 +1,5 @@
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN: -Werror -cpp-precomp -fsyntax-only %s
+
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN: -Werror -no-cpp-precomp -fsyntax-only %s
diff --git a/clang/test/Driver/darwin-as.c b/clang/test/Driver/darwin-as.c
new file mode 100644
index 0000000..92c7641
--- /dev/null
+++ b/clang/test/Driver/darwin-as.c
@@ -0,0 +1,17 @@
+// RUN: %clang -target i386-apple-darwin10 -### -x assembler -c %s \
+// RUN: -no-integrated-as -static -dynamic 2>%t
+// RUN: FileCheck -check-prefix=STATIC_AND_DYNAMIC-32 --input-file %t %s
+//
+// CHECK-STATIC_AND_DYNAMIC-32: as{{(.exe)?}}" "-arch" "i386" "-force_cpusubtype_ALL" "-static" "-o"
+
+// RUN: %clang -target x86_64-apple-darwin10 -### -x assembler -c %s \
+// RUN: -no-integrated-as -static 2>%t
+// RUN: FileCheck -check-prefix=STATIC-64 --input-file %t %s
+//
+// CHECK-STATIC-64: as{{(.exe)?}}" "-arch" "x86_64" "-force_cpusubtype_ALL" "-o"
+
+// RUN: %clang -target x86_64-apple-darwin10 -### \
+// RUN: -arch armv6 -no-integrated-as -x assembler -c %s 2>%t
+// RUN: FileCheck -check-prefix=ARMV6 --input-file %t %s
+//
+// CHECK-ARMV6: as{{(.exe)?}}" "-arch" "armv6" "-o"
diff --git a/clang/test/Driver/darwin-cc.c b/clang/test/Driver/darwin-cc.c
new file mode 100644
index 0000000..85cdf12
--- /dev/null
+++ b/clang/test/Driver/darwin-cc.c
@@ -0,0 +1,4 @@
+// RUN: %clang -ccc-no-clang -target i386-apple-darwin10 -m32 -### -MD -g -fast -Q -dA -mkernel -ansi -aFOO -S -o /tmp/OUTPUTNAME -g0 -gfull -O2 -Werror -pedantic -Wmost -w -std=c99 -trigraphs -v -pg -fFOO -undef -Qn --param a=b -fmudflap -coverage -save-temps -nostdinc -I ARG0 -F ARG1 -I ARG2 -P -MF ARG3 -MG -MP -remap -g3 -H -D ARG4 -U ARG5 -A ARG6 -D ARG7 -U ARG8 -A ARG9 -include ARG10 -pthread %s 2> %t.log
+// RUN: FileCheck %s < %t.log
+// CHECK: {{ ".*cc1.*" "-E" "-nostdinc" "-v" "-I" "ARG0" "-FARG1" "-I" "ARG2" "-P" "-MD" "[^"]*/OUTPUTNAME.d" "-MF" "ARG3" "-MG" "-MP" "-MQ" "[^"]*/OUTPUTNAME" "-remap" "-dD" "-H" "-D__STATIC__" "-D_REENTRANT" "-D" "ARG4" "-U" "ARG5" "-A" "ARG6" "-D" "ARG7" "-U" "ARG8" "-A" "ARG9" "-include" "ARG10" ".*darwin-cc.c" "-D_MUDFLAP" "-include" "mf-runtime.h" "-m32" "-mkernel" "-mtune=core2" "-mmacosx-version-min=10.6.0" "-ansi" "-std=c99" "-trigraphs" "-Werror" "-pedantic" "-Wmost" "-w" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-O2" "-undef" "-fpch-preprocess" "-o" ".*darwin-cc.i"}}
+// CHECK: {{ ".*cc1.*" "-fpreprocessed" ".*darwin-cc.i" "-O3" "-dumpbase" ".*darwin-cc.c" "-dA" "-m32" "-mkernel" "-mtune=core2" "-mmacosx-version-min=10.6.0" "-ansi" "-aFOO" "-auxbase-strip" "[^"]*/OUTPUTNAME" "-g" "-g0" "-g" "-g3" "-O2" "-Werror" "-pedantic" "-Wmost" "-w" "-ansi" "-std=c99" "-trigraphs" "-version" "-p" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-undef" "-fno-ident" "-o" "[^"]*/OUTPUTNAME" "--param" "a=b" "-fno-builtin" "-fno-merge-constants" "-fprofile-arcs" "-ftest-coverage"}}
diff --git a/clang/test/Driver/darwin-debug-flags.c b/clang/test/Driver/darwin-debug-flags.c
new file mode 100644
index 0000000..baf2847
--- /dev/null
+++ b/clang/test/Driver/darwin-debug-flags.c
@@ -0,0 +1,13 @@
+// RUN: env RC_DEBUG_OPTIONS=1 %clang -target i386-apple-darwin9 -g -Os %s -emit-llvm -S -o - | FileCheck %s
+// <rdar://problem/7256886>
+// RUN: touch %t.s
+// RUN: env RC_DEBUG_OPTIONS=1 %clang -### -target i386-apple-darwin9 -c -g %t.s 2>&1 | FileCheck -check-prefix=S %s
+
+// CHECK: !0 = metadata !{
+// CHECK: -g -Os
+// CHECK: -mmacosx-version-min=10.5.0
+// CHECK: [ DW_TAG_compile_unit ]
+
+int x;
+
+// S: "-dwarf-debug-flags"
diff --git a/clang/test/Driver/darwin-dsymutil.c b/clang/test/Driver/darwin-dsymutil.c
new file mode 100644
index 0000000..4409866
--- /dev/null
+++ b/clang/test/Driver/darwin-dsymutil.c
@@ -0,0 +1,45 @@
+// Check that we run dsymutil properly with multiple -arch options.
+//
+// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-phases \
+// RUN: -arch i386 -arch x86_64 %s -g 2> %t
+// RUN: FileCheck -check-prefix=CHECK-MULTIARCH-ACTIONS < %t %s
+//
+// CHECK-MULTIARCH-ACTIONS: 0: input, "{{.*}}darwin-dsymutil.c", c
+// CHECK-MULTIARCH-ACTIONS: 1: preprocessor, {0}, cpp-output
+// CHECK-MULTIARCH-ACTIONS: 2: compiler, {1}, assembler
+// CHECK-MULTIARCH-ACTIONS: 3: assembler, {2}, object
+// CHECK-MULTIARCH-ACTIONS: 4: linker, {3}, image
+// CHECK-MULTIARCH-ACTIONS: 5: bind-arch, "i386", {4}, image
+// CHECK-MULTIARCH-ACTIONS: 6: bind-arch, "x86_64", {4}, image
+// CHECK-MULTIARCH-ACTIONS: 7: lipo, {5, 6}, image
+// CHECK-MULTIARCH-ACTIONS: 8: dsymutil, {7}, dSYM
+//
+// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \
+// RUN: -arch i386 -arch x86_64 %s -g 2> %t
+// RUN: FileCheck -check-prefix=CHECK-MULTIARCH-BINDINGS < %t %s
+//
+// CHECK-MULTIARCH-BINDINGS: "x86_64-apple-darwin10" - "darwin::Lipo", inputs: [{{.*}}, {{.*}}], output: "a.out"
+// CHECK-MULTIARCH-BINDINGS: # "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: ["a.out"], output: "a.out.dSYM"
+
+// Check output name derivation.
+//
+// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \
+// RUN: -o foo %s -g 2> %t
+// RUN: FileCheck -check-prefix=CHECK-OUTPUT-NAME < %t %s
+//
+// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Link", inputs: [{{.*}}], output: "foo"
+// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: ["foo"], output: "foo.dSYM"
+
+// Check that we only use dsymutil when needed.
+//
+// RUN: touch %t.o
+// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \
+// RUN: -o foo %t.o -g 2> %t
+// RUN: grep "Dsymutil" %t | count 0
+
+// Check that we put the .dSYM in the right place.
+// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \
+// RUN: -o bar/foo %s -g 2> %t
+// RUN: FileCheck -check-prefix=CHECK-LOCATION < %t %s
+
+// CHECK-LOCATION: "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: ["bar/foo"], output: "bar/foo.dSYM"
diff --git a/clang/test/Driver/darwin-iphone-defaults.m b/clang/test/Driver/darwin-iphone-defaults.m
new file mode 100644
index 0000000..bba0cc0
--- /dev/null
+++ b/clang/test/Driver/darwin-iphone-defaults.m
@@ -0,0 +1,28 @@
+// RUN: %clang -target i386-apple-darwin9 -miphoneos-version-min=3.0 -arch armv7 -flto -S -o - %s | FileCheck %s
+
+// CHECK: @f0() ssp
+// CHECK: @__f0_block_invoke
+// CHECK: void @f1
+// CHECK-NOT: msgSend_fixup_alloc
+// CHECK: OBJC_SELECTOR_REFERENCES
+
+int f0() {
+ return ^(){ return 0; }();
+}
+
+@interface I0
+@property (assign) int p0;
+@end
+
+@implementation I0
+@synthesize p0 = __sythesized_p0;
+@end
+
+@interface I1
++(id) alloc;
+@end
+
+void f1() {
+ [I1 alloc];
+}
+
diff --git a/clang/test/Driver/darwin-ld.c b/clang/test/Driver/darwin-ld.c
new file mode 100644
index 0000000..3206f65
--- /dev/null
+++ b/clang/test/Driver/darwin-ld.c
@@ -0,0 +1,123 @@
+// Check that ld gets arch_multiple.
+
+// RUN: %clang -target i386-apple-darwin9 -arch i386 -arch x86_64 %s -### -o foo 2> %t.log
+// RUN: grep '".*ld.*" .*"-arch_multiple" "-final_output" "foo"' %t.log
+
+// Make sure we run dsymutil on source input files.
+// RUN: %clang -target i386-apple-darwin9 -### -g %s -o BAR 2> %t.log
+// RUN: grep '".*dsymutil" "-o" "BAR.dSYM" "BAR"' %t.log
+// RUN: %clang -target i386-apple-darwin9 -### -g -filelist FOO %s -o BAR 2> %t.log
+// RUN: grep '".*dsymutil" "-o" "BAR.dSYM" "BAR"' %t.log
+
+// Check linker changes that came with new linkedit format.
+// RUN: touch %t.o
+// RUN: %clang -target i386-apple-darwin9 -### -arch armv6 -miphoneos-version-min=3.0 %t.o 2> %t.log
+// RUN: %clang -target i386-apple-darwin9 -### -arch armv6 -miphoneos-version-min=3.0 -dynamiclib %t.o 2>> %t.log
+// RUN: %clang -target i386-apple-darwin9 -### -arch armv6 -miphoneos-version-min=3.0 -bundle %t.o 2>> %t.log
+// RUN: FileCheck -check-prefix=LINK_IPHONE_3_0 %s < %t.log
+
+// LINK_IPHONE_3_0: {{ld(.exe)?"}}
+// LINK_IPHONE_3_0-NOT: -lcrt1.3.1.o
+// LINK_IPHONE_3_0: -lcrt1.o
+// LINK_IPHONE_3_0: -lSystem
+// LINK_IPHONE_3_0: {{ld(.exe)?"}}
+// LINK_IPHONE_3_0: -dylib
+// LINK_IPHONE_3_0: -ldylib1.o
+// LINK_IPHONE_3_0: -lSystem
+// LINK_IPHONE_3_0: {{ld(.exe)?"}}
+// LINK_IPHONE_3_0: -lbundle1.o
+// LINK_IPHONE_3_0: -lSystem
+
+// RUN: %clang -target i386-apple-darwin9 -### -arch armv7 -miphoneos-version-min=3.1 %t.o 2> %t.log
+// RUN: %clang -target i386-apple-darwin9 -### -arch armv7 -miphoneos-version-min=3.1 -dynamiclib %t.o 2>> %t.log
+// RUN: %clang -target i386-apple-darwin9 -### -arch armv7 -miphoneos-version-min=3.1 -bundle %t.o 2>> %t.log
+// RUN: FileCheck -check-prefix=LINK_IPHONE_3_1 %s < %t.log
+
+// LINK_IPHONE_3_1: {{ld(.exe)?"}}
+// LINK_IPHONE_3_1-NOT: -lcrt1.o
+// LINK_IPHONE_3_1: -lcrt1.3.1.o
+// LINK_IPHONE_3_1: -lSystem
+// LINK_IPHONE_3_1: {{ld(.exe)?"}}
+// LINK_IPHONE_3_1: -dylib
+// LINK_IPHONE_3_1-NOT: -ldylib1.o
+// LINK_IPHONE_3_1: -lSystem
+// LINK_IPHONE_3_1: {{ld(.exe)?"}}
+// LINK_IPHONE_3_1-NOT: -lbundle1.o
+// LINK_IPHONE_3_1: -lSystem
+
+// RUN: %clang -target i386-apple-darwin9 -### -fpie %t.o 2> %t.log
+// RUN: FileCheck -check-prefix=LINK_EXPLICIT_PIE %s < %t.log
+//
+// LINK_EXPLICIT_PIE: {{ld(.exe)?"}}
+// LINK_EXPLICIT_PIE: "-pie"
+
+// RUN: %clang -target i386-apple-darwin9 -### -fno-pie %t.o 2> %t.log
+// RUN: FileCheck -check-prefix=LINK_EXPLICIT_NO_PIE %s < %t.log
+//
+// LINK_EXPLICIT_NO_PIE: {{ld(.exe)?"}}
+// LINK_EXPLICIT_NO_PIE: "-no_pie"
+
+// RUN: %clang -target x86_64-apple-darwin10 -### %t.o \
+// RUN: -mlinker-version=100 2> %t.log
+// RUN: FileCheck -check-prefix=LINK_NEWER_DEMANGLE %s < %t.log
+//
+// LINK_NEWER_DEMANGLE: {{ld(.exe)?"}}
+// LINK_NEWER_DEMANGLE: "-demangle"
+
+// RUN: %clang -target x86_64-apple-darwin10 -### %t.o \
+// RUN: -mlinker-version=100 -Wl,--no-demangle 2> %t.log
+// RUN: FileCheck -check-prefix=LINK_NEWER_NODEMANGLE %s < %t.log
+//
+// LINK_NEWER_NODEMANGLE: {{ld(.exe)?"}}
+// LINK_NEWER_NODEMANGLE-NOT: "-demangle"
+// LINK_NEWER_NODEMANGLE: "-lSystem"
+
+// RUN: %clang -target x86_64-apple-darwin10 -### %t.o \
+// RUN: -mlinker-version=95 2> %t.log
+// RUN: FileCheck -check-prefix=LINK_OLDER_NODEMANGLE %s < %t.log
+//
+// LINK_OLDER_NODEMANGLE: {{ld(.exe)?"}}
+// LINK_OLDER_NODEMANGLE-NOT: "-demangle"
+// LINK_OLDER_NODEMANGLE: "-lSystem"
+
+// RUN: %clang -target x86_64-apple-darwin10 -### %t.o \
+// RUN: -mlinker-version=117 -flto 2> %t.log
+// RUN: cat %t.log
+// RUN: FileCheck -check-prefix=LINK_OBJECT_LTO_PATH %s < %t.log
+//
+// LINK_OBJECT_LTO_PATH: {{ld(.exe)?"}}
+// LINK_OBJECT_LTO_PATH: "-object_path_lto"
+
+// RUN: %clang -target x86_64-apple-darwin10 -### %t.o \
+// RUN: -force_load a -force_load b 2> %t.log
+// RUN: cat %t.log
+// RUN: FileCheck -check-prefix=FORCE_LOAD %s < %t.log
+//
+// FORCE_LOAD: {{ld(.exe)?"}}
+// FORCE_LOAD: "-force_load" "a" "-force_load" "b"
+
+// RUN: %clang -target x86_64-apple-darwin10 -### %t.o \
+// RUN: -lazy_framework Framework 2> %t.log
+//
+// RUN: FileCheck -check-prefix=LINK_LAZY_FRAMEWORK %s < %t.log
+// LINK_LAZY_FRAMEWORK: {{ld(.exe)?"}}
+// LINK_LAZY_FRAMEWORK: "-lazy_framework" "Framework"
+
+// RUN: %clang -target x86_64-apple-darwin10 -### %t.o \
+// RUN: -lazy_library Library 2> %t.log
+//
+// RUN: FileCheck -check-prefix=LINK_LAZY_LIBRARY %s < %t.log
+// LINK_LAZY_LIBRARY: {{ld(.exe)?"}}
+// LINK_LAZY_LIBRARY: "-lazy_library" "Library"
+
+// RUN: %clang -target x86_64-apple-darwin10 -### %t.o 2> %t.log
+// RUN: %clang -target x86_64-apple-macosx10.7 -### %t.o 2>> %t.log
+// RUN: FileCheck -check-prefix=LINK_VERSION_MIN %s < %t.log
+// LINK_VERSION_MIN: {{ld(.exe)?"}}
+// LINK_VERSION_MIN: "-macosx_version_min" "10.6.0"
+// LINK_VERSION_MIN: {{ld(.exe)?"}}
+// LINK_VERSION_MIN: "-macosx_version_min" "10.7.0"
+
+// RUN: %clang -target x86_64-apple-darwin12 -### %t.o 2> %t.log
+// RUN: FileCheck -check-prefix=LINK_NO_CRT1 %s < %t.log
+// LINK_NO_CRT1-NOT: crt
diff --git a/clang/test/Driver/darwin-objc-defaults.m b/clang/test/Driver/darwin-objc-defaults.m
new file mode 100644
index 0000000..49fe8f9
--- /dev/null
+++ b/clang/test/Driver/darwin-objc-defaults.m
@@ -0,0 +1,88 @@
+// Check non-fragile ABI and dispatch method defaults.
+
+// i386
+
+// RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch i386 -mmacosx-version-min=10.5 2> %t
+// RUN: FileCheck --check-prefix CHECK-I386_OSX10_5 < %t %s
+
+// CHECK-CHECK-I386_OSX10_5: "-cc1"
+// CHECK-CHECK-I386_OSX10_5: -fobjc-fragile-abi
+// CHECK-CHECK-I386_OSX10_5-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-I386_OSX10_5: darwin-objc-defaults
+
+// RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch i386 -mmacosx-version-min=10.6 2> %t
+// RUN: FileCheck --check-prefix CHECK-I386_OSX10_6 < %t %s
+
+// CHECK-CHECK-I386_OSX10_6: "-cc1"
+// CHECK-CHECK-I386_OSX10_6: -fobjc-fragile-abi
+// CHECK-CHECK-I386_OSX10_6-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-I386_OSX10_6: darwin-objc-defaults
+
+// RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch i386 -miphoneos-version-min=3.0 2> %t
+// RUN: FileCheck --check-prefix CHECK-I386_IPHONE3_0 < %t %s
+
+// CHECK-CHECK-I386_IPHONE3_0: "-cc1"
+// CHECK-CHECK-I386_IPHONE3_0: -fobjc-fragile-abi
+// CHECK-CHECK-I386_IPHONE3_0-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-I386_IPHONE3_0: darwin-objc-defaults
+
+// x86_64
+
+// RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch x86_64 -mmacosx-version-min=10.5 2> %t
+// RUN: FileCheck --check-prefix CHECK-X86_64_OSX10_5 < %t %s
+
+// CHECK-CHECK-X86_64_OSX10_5: "-cc1"
+// CHECK-CHECK-X86_64_OSX10_5-NOT: -fobjc-fragile-abi
+// CHECK-CHECK-X86_64_OSX10_5: -fobjc-dispatch-method=non-legacy
+// CHECK-CHECK-X86_64_OSX10_5: darwin-objc-defaults
+
+// RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch x86_64 -mmacosx-version-min=10.6 2> %t
+// RUN: FileCheck --check-prefix CHECK-X86_64_OSX10_6 < %t %s
+
+// CHECK-CHECK-X86_64_OSX10_6: "-cc1"
+// CHECK-CHECK-X86_64_OSX10_6-NOT: -fobjc-fragile-abi
+// CHECK-CHECK-X86_64_OSX10_6: -fobjc-dispatch-method=mixed
+// CHECK-CHECK-X86_64_OSX10_6: darwin-objc-defaults
+
+// RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch x86_64 -miphoneos-version-min=3.0 2> %t
+// RUN: FileCheck --check-prefix CHECK-X86_64_IPHONE3_0 < %t %s
+
+// CHECK-CHECK-X86_64_IPHONE3_0: "-cc1"
+// CHECK-CHECK-X86_64_IPHONE3_0-NOT: -fobjc-fragile-abi
+// CHECK-CHECK-X86_64_IPHONE3_0: -fobjc-dispatch-method=mixed
+// CHECK-CHECK-X86_64_IPHONE3_0: darwin-objc-defaults
+
+// armv7
+
+// RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch armv7 -mmacosx-version-min=10.5 2> %t
+// RUN: FileCheck --check-prefix CHECK-ARMV7_OSX10_5 < %t %s
+
+// CHECK-CHECK-ARMV7_OSX10_5: "-cc1"
+// CHECK-CHECK-ARMV7_OSX10_5-NOT: -fobjc-fragile-abi
+// CHECK-CHECK-ARMV7_OSX10_5-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-ARMV7_OSX10_5: darwin-objc-defaults
+
+// RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch armv7 -mmacosx-version-min=10.6 2> %t
+// RUN: FileCheck --check-prefix CHECK-ARMV7_OSX10_6 < %t %s
+
+// CHECK-CHECK-ARMV7_OSX10_6: "-cc1"
+// CHECK-CHECK-ARMV7_OSX10_6-NOT: -fobjc-fragile-abi
+// CHECK-CHECK-ARMV7_OSX10_6-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-ARMV7_OSX10_6: darwin-objc-defaults
+
+// RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch armv7 -miphoneos-version-min=3.0 2> %t
+// RUN: FileCheck --check-prefix CHECK-ARMV7_IPHONE3_0 < %t %s
+
+// CHECK-CHECK-ARMV7_IPHONE3_0: "-cc1"
+// CHECK-CHECK-ARMV7_IPHONE3_0-NOT: -fobjc-fragile-abi
+// CHECK-CHECK-ARMV7_IPHONE3_0-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-ARMV7_IPHONE3_0: darwin-objc-defaults
diff --git a/clang/test/Driver/darwin-objc-gc.m b/clang/test/Driver/darwin-objc-gc.m
new file mode 100644
index 0000000..06e3aea
--- /dev/null
+++ b/clang/test/Driver/darwin-objc-gc.m
@@ -0,0 +1,19 @@
+// Check that we warn, but accept, -fobjc-gc for iPhone OS.
+
+// RUN: %clang -target i386-apple-darwin9 -miphoneos-version-min=3.0 -fobjc-gc -flto -S -o %t %s 2> %t.err
+// RUN: FileCheck --check-prefix=IPHONE_OBJC_GC_LL %s < %t
+// RUN: FileCheck --check-prefix=IPHONE_OBJC_GC_STDERR %s < %t.err
+
+// IPHONE_OBJC_GC_LL: define void @f0
+// IPHONE_OBJC_GC_LL-NOT: objc_assign_ivar
+// IPHONE_OBJC_GC_LL: }
+
+// IPHONE_OBJC_GC_STDERR: warning: Objective-C garbage collection is not supported on this platform, ignoring '-fobjc-gc'
+
+@interface A {
+@public
+ id x;
+}
+@end
+
+void f0(A *a, id x) { a->x = x; }
diff --git a/clang/test/Driver/darwin-objc-options.m b/clang/test/Driver/darwin-objc-options.m
new file mode 100644
index 0000000..5b421d8
--- /dev/null
+++ b/clang/test/Driver/darwin-objc-options.m
@@ -0,0 +1,21 @@
+// Check miscellaneous Objective-C options.
+
+// RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch x86_64 -fobjc-abi-version=1 2> %t
+// RUN: FileCheck --check-prefix CHECK-X86_64_ABI1 < %t %s
+
+// CHECK-CHECK-X86_64_ABI1: "-cc1"
+// CHECK-CHECK-X86_64_ABI1: -fobjc-fragile-abi
+// CHECK-CHECK-X86_64_ABI1-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-X86_64_ABI1: darwin-objc-options
+
+// RUN: %clang -target x86_64-apple-darwin10 -S -### %s \
+// RUN: -arch i386 -fobjc-abi-version=2 2> %t
+// RUN: FileCheck --check-prefix CHECK-I386_ABI2 < %t %s
+
+// CHECK-CHECK-I386_ABI2: "-cc1"
+// CHECK-CHECK-I386_ABI2-NOT: -fobjc-fragile-abi
+// CHECK-CHECK-I386_ABI2: -fobjc-exceptions
+// CHECK-CHECK-I386_ABI2: -fexceptions
+// CHECK-CHECK-I386_ABI2-NOT: -fobjc-dispatch-method
+// CHECK-CHECK-I386_ABI2: darwin-objc-options
diff --git a/clang/test/Driver/darwin-verify-debug.c b/clang/test/Driver/darwin-verify-debug.c
new file mode 100644
index 0000000..677419a
--- /dev/null
+++ b/clang/test/Driver/darwin-verify-debug.c
@@ -0,0 +1,34 @@
+// Check that we verify debug output properly with multiple -arch options.
+//
+// REQUIRES: asserts
+// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-phases \
+// RUN: -verify -arch i386 -arch x86_64 %s -g 2> %t
+// RUN: FileCheck -check-prefix=CHECK-MULTIARCH-ACTIONS < %t %s
+//
+// CHECK-MULTIARCH-ACTIONS: 0: input, "{{.*}}darwin-verify-debug.c", c
+// CHECK-MULTIARCH-ACTIONS: 8: dsymutil, {7}, dSYM
+// CHECK-MULTIARCH-ACTIONS: 9: verify, {8}, none
+//
+// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \
+// RUN: -verify -arch i386 -arch x86_64 %s -g 2> %t
+// RUN: FileCheck -check-prefix=CHECK-MULTIARCH-BINDINGS < %t %s
+//
+// CHECK-MULTIARCH-BINDINGS: # "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: ["a.out"], output: "a.out.dSYM"
+// CHECK-MULTIARCH-BINDINGS: # "x86_64-apple-darwin10" - "darwin::VerifyDebug", inputs: ["a.out.dSYM"], output: (nothing)
+
+// Check output name derivation.
+//
+// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \
+// RUN: -verify -o foo %s -g 2> %t
+// RUN: FileCheck -check-prefix=CHECK-OUTPUT-NAME < %t %s
+//
+// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Link", inputs: [{{.*}}], output: "foo"
+// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: ["foo"], output: "foo.dSYM"
+// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::VerifyDebug", inputs: ["foo.dSYM"], output: (nothing)
+
+// Check that we only verify when needed.
+//
+// RUN: touch %t.o
+// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \
+// RUN: -verify -o foo %t.o -g 2> %t
+// RUN: grep "Verify" %t | count 0
diff --git a/clang/test/Driver/darwin-version.c b/clang/test/Driver/darwin-version.c
new file mode 100644
index 0000000..2478a99
--- /dev/null
+++ b/clang/test/Driver/darwin-version.c
@@ -0,0 +1,31 @@
+// RUN: env MACOSX_DEPLOYMENT_TARGET=10.1 \
+// RUN: %clang -target i386-apple-darwin9 -DTEST0 -E %s
+#ifdef TEST0
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1010
+#error Invalid version
+#endif
+#endif
+
+// RUN: env IPHONEOS_DEPLOYMENT_TARGET=2.0 \
+// RUN: %clang -target i386-apple-darwin9 -DTEST1 -E %s
+#ifdef TEST1
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ != 20000
+#error Invalid version
+#endif
+#endif
+
+// RUN: env IPHONEOS_DEPLOYMENT_TARGET=2.3.1 \
+// RUN: %clang -target i386-apple-darwin9 -DTEST2 -E %s
+#ifdef TEST2
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ != 20301
+#error Invalid version
+#endif
+#endif
+
+// RUN: env MACOSX_DEPLOYMENT_TARGET=10.4.10 \
+// RUN: %clang -target i386-apple-darwin9 -DTEST3 -E %s
+#ifdef TEST3
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1049
+#error Invalid version
+#endif
+#endif
diff --git a/clang/test/Driver/darwin-xarch.c b/clang/test/Driver/darwin-xarch.c
new file mode 100644
index 0000000..3014236
--- /dev/null
+++ b/clang/test/Driver/darwin-xarch.c
@@ -0,0 +1,20 @@
+// RUN: %clang -target x86_64-apple-darwin10 -### \
+// RUN: -arch i386 -Xarch_i386 -mmacosx-version-min=10.4 \
+// RUN: -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 \
+// RUN: -c %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-COMPILE < %t %s
+//
+// CHECK-COMPILE: clang{{.*}}" "-cc1" "-triple" "i386-apple-macosx10.4.0"
+// CHECK-COMPILE: clang{{.*}}" "-cc1" "-triple" "x86_64-apple-macosx10.5.0"
+
+// RUN: %clang -target x86_64-apple-darwin10 -### \
+// RUN: -arch i386 -Xarch_i386 -Wl,-some-linker-arg -filelist X 2> %t
+// RUN: FileCheck --check-prefix=CHECK-LINK < %t %s
+//
+// CHECK-LINK: ld{{.*}} "-arch" "i386"{{.*}} "-some-linker-arg"
+
+// RUN: %clang -target x86_64-apple-darwin10 -### \
+// RUN: -arch armv7 -Xarch_armv7 -Wl,-some-linker-arg -filelist X 2> %t
+// RUN: FileCheck --check-prefix=CHECK-ARMV7-LINK < %t %s
+//
+// CHECK-ARMV7-LINK: ld{{.*}} "-arch" "armv7"{{.*}} "-some-linker-arg"
diff --git a/clang/test/Driver/debug-options-as.c b/clang/test/Driver/debug-options-as.c
new file mode 100644
index 0000000..a1dbe2e
--- /dev/null
+++ b/clang/test/Driver/debug-options-as.c
@@ -0,0 +1,18 @@
+// cygming have not supported integrated-as yet.
+// XFAIL: cygwin,mingw32
+//
+// Check to make sure clang is somewhat picky about -g options.
+// (Delived from debug-options.c)
+// rdar://10383444
+// RUN: %clang -### -c -save-temps -g %s 2>&1 | FileCheck -check-prefix=SAVE %s
+//
+// SAVE: "-cc1as"
+// SAVE-NOT: "-g"
+
+// Check to make sure clang with -g on a .s file gets passed.
+// rdar://9275556
+// RUN: touch %t.s
+// RUN: %clang -### -c -g %t.s 2>&1 | FileCheck -check-prefix=S %s
+//
+// S: "-cc1as"
+// S: "-g"
diff --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c
new file mode 100644
index 0000000..5dad8e9
--- /dev/null
+++ b/clang/test/Driver/debug-options.c
@@ -0,0 +1,27 @@
+// Check to make sure clang is somewhat picky about -g options.
+// rdar://10383444
+
+// RUN: %clang -### -c -g %s 2>&1 | FileCheck -check-prefix=G %s
+// RUN: %clang -### -c -g2 %s 2>&1 | FileCheck -check-prefix=G2 %s
+// RUN: %clang -### -c -g3 %s 2>&1 | FileCheck -check-prefix=G3 %s
+// RUN: %clang -### -c -ganything %s 2>&1 | FileCheck -check-prefix=GANY %s
+// RUN: %clang -### -c -ggdb %s 2>&1 | FileCheck -check-prefix=GGDB %s
+// RUN: %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=GFOO %s
+//
+// G: "-cc1"
+// G: "-g"
+//
+// G2: "-cc1"
+// G2: "-g"
+//
+// G3: "-cc1"
+// G3: "-g"
+//
+// GANY: "-cc1"
+// GANY-NOT: "-g"
+//
+// GGDB: "-cc1"
+// GGDB: "-g"
+//
+// GFOO: "-cc1"
+// GFOO-NOT: "-g"
diff --git a/clang/test/Driver/debug.c b/clang/test/Driver/debug.c
new file mode 100644
index 0000000..ca1ca30
--- /dev/null
+++ b/clang/test/Driver/debug.c
@@ -0,0 +1,11 @@
+// RUN: cd %S && %clang -### -g %s -c 2>&1 | FileCheck -check-prefix=CHECK-PWD %s
+// CHECK-PWD: {{"-fdebug-compilation-dir" ".*Driver.*"}}
+
+// RUN: env PWD=/foo %clang -### -g %s -c 2>&1 | FileCheck -check-prefix=CHECK-FOO %s
+// CHECK-FOO: {{"-fdebug-compilation-dir" ".*foo"}}
+
+// "PWD=/foo gcc" wouldn't necessarily work. You would need to pick a different
+// path to the same directory (try a symlink).
+
+// This depends on host's behavior how $PWD would be set.
+// REQUIRES: shell
diff --git a/clang/test/Driver/default-toolchain.c b/clang/test/Driver/default-toolchain.c
new file mode 100644
index 0000000..b9111a6
--- /dev/null
+++ b/clang/test/Driver/default-toolchain.c
@@ -0,0 +1,8 @@
+// RUN: %clang -target i386-unknown-unknown -m64 -v 2> %t
+// RUN: grep 'Target: x86_64-unknown-unknown' %t
+
+// RUN: %clang -target i386-apple-darwin9 -arch ppc -m64 -v 2> %t
+// RUN: grep 'Target: powerpc64-apple-darwin9' %t
+
+// RUN: %clang -target i386-apple-darwin9 -arch ppc64 -m32 -v 2> %t
+// RUN: grep 'Target: powerpc-apple-darwin9' %t
diff --git a/clang/test/Driver/diagnostics.c b/clang/test/Driver/diagnostics.c
new file mode 100644
index 0000000..8500fad
--- /dev/null
+++ b/clang/test/Driver/diagnostics.c
@@ -0,0 +1,9 @@
+// Parse diagnostic arguments in the driver
+// PR12181
+
+// RUN: not %clang -target x86_64-apple-darwin10 \
+// RUN: -fsyntax-only -fzyzzybalubah \
+// RUN: -Werror=unused-command-line-argument %s
+
+// RUN: not %clang -target x86_64-apple-darwin10 \
+// RUN: -fsyntax-only -fzyzzybalubah -Werror %s
diff --git a/clang/test/Driver/dragonfly.c b/clang/test/Driver/dragonfly.c
new file mode 100644
index 0000000..8a629da
--- /dev/null
+++ b/clang/test/Driver/dragonfly.c
@@ -0,0 +1,7 @@
+// RUN: %clang -no-canonical-prefixes -target amd64-pc-dragonfly %s -### 2> %t.log
+// RUN: FileCheck -input-file %t.log %s
+
+// CHECK: clang{{.*}}" "-cc1" "-triple" "amd64-pc-dragonfly"
+// CHECK: ld{{.*}}" "-dynamic-linker" "{{.*}}ld-elf.{{.*}}" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-L{{.*}}/gcc{{.*}}" {{.*}} "-lc" "-lgcc" "{{.*}}crtend.o" "{{.*}}crtn.o"
+
+
diff --git a/clang/test/Driver/dwarf2-cfi-asm.c b/clang/test/Driver/dwarf2-cfi-asm.c
new file mode 100644
index 0000000..a5c4878
--- /dev/null
+++ b/clang/test/Driver/dwarf2-cfi-asm.c
@@ -0,0 +1,35 @@
+// RUN: %clang -target x86_64-apple-darwin -### -S -integrated-as %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-DARWIN-MC-DEFAULT %s
+// RUN: %clang -target x86_64-apple-darwin -### -S -integrated-as -fdwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-DARWIN-MC-CFI %s
+// RUN: %clang -target x86_64-apple-darwin -### -S -integrated-as -fno-dwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-DARWIN-MC-NOCFI %s
+
+// RUN: %clang -target x86_64-apple-darwin -### -S -no-integrated-as %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-DARWIN-AS-DEFAULT %s
+// RUN: %clang -target x86_64-apple-darwin -### -S -no-integrated-as -fdwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-DARWIN-AS-CFI %s
+// RUN: %clang -target x86_64-apple-darwin -### -S -no-integrated-as -fno-dwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-DARWIN-AS-NOCFI %s
+
+
+// RUN: %clang -target x86_64-pc-linux -### -S -integrated-as %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-LINUX-MC-DEFAULT %s
+// RUN: %clang -target x86_64-pc-linux -### -S -integrated-as -fdwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-LINUX-MC-CFI %s
+// RUN: %clang -target x86_64-pc-linux -### -S -integrated-as -fno-dwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-LINUX-MC-NOCFI %s
+
+// RUN: %clang -target x86_64-pc-linux -### -S -no-integrated-as %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-LINUX-AS-DEFAULT %s
+// RUN: %clang -target x86_64-pc-linux -### -S -no-integrated-as -fdwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-LINUX-AS-CFI %s
+// RUN: %clang -target x86_64-pc-linux -### -S -no-integrated-as -fno-dwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-LINUX-AS-NOCFI %s
+
+
+
+// CHECK-DARWIN-MC-DEFAULT-NOT: -fno-dwarf2-cfi-asm
+// CHECK-DARWIN-MC-CFI-NOT: -fno-dwarf2-cfi-asm
+// CHECK-DARWIN-MC-NOCFI: -fno-dwarf2-cfi-asm
+
+// CHECK-DARWIN-AS-DEFAULT: -fno-dwarf2-cfi-asm
+// CHECK-DARWIN-AS-CFI-NOT: -fno-dwarf2-cfi-asm
+// CHECK-DARWIN-AS-NOCFI: -fno-dwarf2-cfi-asm
+
+
+// CHECK-LINUX-MC-DEFAULT-NOT: -fno-dwarf2-cfi-asmx
+// CHECK-LINUX-MC-CFI-NOT: -fno-dwarf2-cfi-asm
+// CHECK-LINUX-MC-NOCFI: -fno-dwarf2-cfi-asm
+
+// CHECK-LINUX-AS-DEFAULT-NOT: -fno-dwarf2-cfi-asm
+// CHECK-LINUX-AS-CFI-NOT: -fno-dwarf2-cfi-asm
+// CHECK-LINUX-AS-NOCFI: -fno-dwarf2-cfi-asm
diff --git a/clang/test/Driver/emit-llvm.c b/clang/test/Driver/emit-llvm.c
new file mode 100644
index 0000000..76ea059
--- /dev/null
+++ b/clang/test/Driver/emit-llvm.c
@@ -0,0 +1,10 @@
+// Check that -O4 is only honored as the effective -O option.
+// <rdar://problem/7046672> clang/loader problem
+
+// RUN: %clang -ccc-print-phases -c -O4 -O0 %s 2> %t
+// RUN: FileCheck --check-prefix=O4_AND_O0 %s < %t
+
+// O4_AND_O0: 0: input, "{{.*}}", c
+// O4_AND_O0: 1: preprocessor, {0}, cpp-output
+// O4_AND_O0: 2: compiler, {1}, assembler
+// O4_AND_O0: 3: assembler, {2}, object
diff --git a/clang/test/Driver/exceptions.m b/clang/test/Driver/exceptions.m
new file mode 100644
index 0000000..9b747bb
--- /dev/null
+++ b/clang/test/Driver/exceptions.m
@@ -0,0 +1,19 @@
+// RUN: %clang -target x86_64-apple-darwin9 \
+// RUN: -fsyntax-only -fno-exceptions %s
+
+void f1() {
+ @throw @"A";
+}
+
+void f0() {
+ @try {
+ f1();
+ } @catch (id x) {
+ ;
+ }
+}
+
+int main() {
+ f0();
+ return 0;
+}
diff --git a/clang/test/Driver/fast-math.c b/clang/test/Driver/fast-math.c
new file mode 100644
index 0000000..aef7cc3
--- /dev/null
+++ b/clang/test/Driver/fast-math.c
@@ -0,0 +1,119 @@
+// Test that the GCC fast-math floating point flags get lowered to the correct
+// permutation of Clang frontend flags. This is non-trivial for a few reasons.
+// First, the GCC flags have many different and surprising effects. Second,
+// LLVM only supports three switches which is more coarse grained than GCC's
+// support.
+//
+// RUN: %clang -### -fno-honor-infinities -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-INFS %s
+// CHECK-NO-INFS: "-cc1"
+// CHECK-NO-INFS: "-menable-no-infs"
+//
+// RUN: %clang -### -fno-honor-nans -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-NANS %s
+// CHECK-NO-NANS: "-cc1"
+// CHECK-NO-NANS: "-menable-no-nans"
+//
+// RUN: %clang -### -fmath-errno -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-MATH-ERRNO %s
+// CHECK-MATH-ERRNO: "-cc1"
+// CHECK-MATH-ERRNO: "-fmath-errno"
+//
+// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \
+// RUN: -fno-trapping-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-UNSAFE-MATH %s
+// CHECK-UNSAFE-MATH: "-cc1"
+// CHECK-UNSAFE-MATH: "-menable-unsafe-fp-math"
+//
+// Check that various umbrella flags also enable these frontend options.
+// RUN: %clang -### -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-INFS %s
+// RUN: %clang -### -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-NANS %s
+// RUN: %clang -### -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-UNSAFE-MATH %s
+// RUN: %clang -### -ffinite-math-only -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-INFS %s
+// RUN: %clang -### -ffinite-math-only -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-NANS %s
+// RUN: %clang -### -funsafe-math-optimizations -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-UNSAFE-MATH %s
+//
+// One umbrella flag is *really* weird and also changes the semantics of the
+// program by adding a special preprocessor macro. Check that the frontend flag
+// modeling this semantic change is provided. Also check that the semantic
+// impact remains even if every optimization is disabled.
+// RUN: %clang -### -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-FAST-MATH %s
+// RUN: %clang -### -ffast-math -fno-finite-math-only \
+// RUN: -fno-unsafe-math-optimizations -fmath-errno -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-FAST-MATH %s
+// CHECK-FAST-MATH: "-cc1"
+// CHECK-FAST-MATH: "-ffast-math"
+//
+// Check various means of disabling these flags, including disabling them after
+// they've been enabled via an umbrella flag.
+// RUN: %clang -### -fno-honor-infinities -fhonor-infinities -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-NO-INFS %s
+// RUN: %clang -### -ffinite-math-only -fhonor-infinities -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-NO-INFS %s
+// RUN: %clang -### -ffinite-math-only -fno-finite-math-only -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-NO-INFS %s
+// RUN: %clang -### -ffast-math -fhonor-infinities -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-NO-INFS %s
+// RUN: %clang -### -ffast-math -fno-finite-math-only -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-NO-INFS %s
+// CHECK-NO-NO-INFS: "-cc1"
+// CHECK-NO-NO-INFS-NOT: "-menable-no-infs"
+// CHECK-NO-NO-INFS: "-o"
+//
+// RUN: %clang -### -fno-honor-nans -fhonor-nans -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-NO-NANS %s
+// RUN: %clang -### -ffinite-math-only -fhonor-nans -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-NO-NANS %s
+// RUN: %clang -### -ffinite-math-only -fno-finite-math-only -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-NO-NANS %s
+// RUN: %clang -### -ffast-math -fhonor-nans -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-NO-NANS %s
+// RUN: %clang -### -ffast-math -fno-finite-math-only -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-NO-NANS %s
+// CHECK-NO-NO-NANS: "-cc1"
+// CHECK-NO-NO-NANS-NOT: "-menable-no-nans"
+// CHECK-NO-NO-NANS: "-o"
+//
+// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \
+// RUN: -fno-trapping-math -fno-associative-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \
+// RUN: -fno-trapping-math -fno-reciprocal-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \
+// RUN: -fno-trapping-math -fsigned-zeros -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \
+// RUN: -fno-trapping-math -ftrapping-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -funsafe-math-optimizations -fno-associative-math -c %s \
+// RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -funsafe-math-optimizations -fno-reciprocal-math -c %s \
+// RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -funsafe-math-optimizations -fsigned-zeros -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -funsafe-math-optimizations -ftrapping-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -funsafe-math-optimizations -fno-unsafe-math-optimizations \
+// RUN: -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -ffast-math -fno-associative-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -ffast-math -fno-reciprocal-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -ffast-math -fsigned-zeros -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -ffast-math -ftrapping-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// RUN: %clang -### -ffast-math -fno-unsafe-math-optimizations -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-UNSAFE-MATH %s
+// CHECK-NO-UNSAFE-MATH: "-cc1"
+// CHECK-NO-UNSAFE-MATH-NOT: "-menable-unsafe-fp-math"
+// CHECK-NO-UNSAFE-MATH: "-o"
diff --git a/clang/test/Driver/flags.c b/clang/test/Driver/flags.c
new file mode 100644
index 0000000..7a885b6
--- /dev/null
+++ b/clang/test/Driver/flags.c
@@ -0,0 +1,9 @@
+// RUN: %clang -target i386-apple-darwin9 -### -S -msoft-float %s 2> %t.log
+// RUN: grep '"-no-implicit-float"' %t.log
+
+// RUN: %clang -target i386-apple-darwin9 -### -S -msoft-float -mno-soft-float %s 2> %t.log
+// RUN: grep '"-no-implicit-float"' %t.log | count 0
+
+// RUN: %clang -target i386-apple-darwin9 -### -S -mno-soft-float %s -msoft-float 2> %t.log
+// RUN: grep '"-no-implicit-float"' %t.log
+
diff --git a/clang/test/Driver/frame-pointer.c b/clang/test/Driver/frame-pointer.c
new file mode 100644
index 0000000..6be395c
--- /dev/null
+++ b/clang/test/Driver/frame-pointer.c
@@ -0,0 +1,24 @@
+// RUN: %clang -target i386-pc-linux -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-32 %s
+// RUN: %clang -target i386-pc-linux -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-32 %s
+// RUN: %clang -target i386-pc-linux -### -S -O2 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK2-32 %s
+// RUN: %clang -target i386-pc-linux -### -S -O3 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK3-32 %s
+// RUN: %clang -target i386-pc-linux -### -S -Os %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECKs-32 %s
+
+
+// RUN: %clang -target x86_64-pc-linux -### -S -O0 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK0-64 %s
+// RUN: %clang -target x86_64-pc-linux -### -S -O1 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK1-64 %s
+// RUN: %clang -target x86_64-pc-linux -### -S -O2 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK2-64 %s
+// RUN: %clang -target x86_64-pc-linux -### -S -O3 %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK3-64 %s
+// RUN: %clang -target x86_64-pc-linux -### -S -Os %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECKs-64 %s
+
+// CHECK0-32: -mdisable-fp-elim
+// CHECK1-32-NOT: -mdisable-fp-elim
+// CHECK2-32-NOT: -mdisable-fp-elim
+// CHECK3-32-NOT: -mdisable-fp-elim
+// CHECKs-32-NOT: -mdisable-fp-elim
+
+// CHECK0-64: -mdisable-fp-elim
+// CHECK1-64-NOT: -mdisable-fp-elim
+// CHECK2-64-NOT: -mdisable-fp-elim
+// CHECK3-64-NOT: -mdisable-fp-elim
+// CHECKs-64-NOT: -mdisable-fp-elim
diff --git a/clang/test/Driver/freebsd.c b/clang/test/Driver/freebsd.c
new file mode 100644
index 0000000..1fb84a0
--- /dev/null
+++ b/clang/test/Driver/freebsd.c
@@ -0,0 +1,30 @@
+// REQUIRES: ppc32-registered-target,ppc64-registered-target
+// RUN: %clang -ccc-clang-archs powerpc -no-canonical-prefixes \
+// RUN: -target powerpc-pc-freebsd8 %s \
+// RUN: --sysroot=%S/Inputs/basic_freebsd_tree -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-PPC %s
+// CHECK-PPC: clang{{.*}}" "-cc1" "-triple" "powerpc-pc-freebsd8"
+// CHECK-PPC: ld{{.*}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-PPC: "--eh-frame-hdr" "-dynamic-linker" "{{.*}}ld-elf{{.*}}" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "-L[[SYSROOT]]/usr/lib" "{{.*}}.o" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "{{.*}}crtend.o" "{{.*}}crtn.o"
+//
+// RUN: %clang -ccc-clang-archs powerpc64 -no-canonical-prefixes \
+// RUN: -target powerpc64-pc-freebsd8 %s \
+// RUN: --sysroot=%S/Inputs/basic_freebsd64_tree -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-PPC64 %s
+// CHECK-PPC64: clang{{.*}}" "-cc1" "-triple" "powerpc64-pc-freebsd8"
+// CHECK-PPC64: ld{{.*}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-PPC64: "--eh-frame-hdr" "-dynamic-linker" "{{.*}}ld-elf{{.*}}" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "-L[[SYSROOT]]/usr/lib" "{{.*}}.o" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "{{.*}}crtend.o" "{{.*}}crtn.o"
+//
+//
+// Check that -m32 properly adjusts the toolchain flags.
+//
+// RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -m32 %s \
+// RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-LIB32 %s
+// CHECK-LIB32: clang{{.*}}" "-cc1" "-triple" "i386-pc-freebsd8"
+// CHECK-LIB32: ld{{.*}}" {{.*}} "-m" "elf_i386_fbsd"
+//
+// RUN: %clang -target x86_64-pc-freebsd8 -m32 %s 2>&1 \
+// RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -print-search-dirs 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-LIB32PATHS %s
+// CHECK-LIB32PATHS: libraries: ={{.*:?}}/usr/lib32
diff --git a/clang/test/Driver/gcc-toolchain.cpp b/clang/test/Driver/gcc-toolchain.cpp
new file mode 100644
index 0000000..e122dac
--- /dev/null
+++ b/clang/test/Driver/gcc-toolchain.cpp
@@ -0,0 +1,23 @@
+// Test that gcc-toolchain option is working correctly
+//
+// RUN: %clangxx -no-canonical-prefixes %s -### -o %t 2>&1 \
+// RUN: -target i386-unknown-linux \
+// RUN: -gcc-toolchain %S/Inputs/ubuntu_11.04_multiarch_tree/usr \
+// RUN: | FileCheck %s
+//
+// Test for header search toolchain detection.
+// CHECK: "-internal-isystem"
+// CHECK: "[[TOOLCHAIN:[^"]+]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../../include/c++/4.5"
+// CHECK: "-internal-isystem"
+// CHECK: "[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../../include/c++/4.5/i686-linux-gnu"
+// CHECK: "-internal-isystem"
+// CHECK: "[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../../include/c++/4.5/backward"
+// CHECK: "-internal-isystem" "/usr/local/include"
+//
+// Test for linker toolchain detection. Note that only the '-L' flags will use
+// the same precise formatting of the path as the '-internal-system' flags
+// above, so we just blanket wildcard match the 'crtbegin.o'.
+// CHECK: "{{[^"]*}}ld{{(.exe)?}}"
+// CHECK: "{{[^"]*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/crtbegin.o"
+// CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
+// CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."
diff --git a/clang/test/Driver/gcc_forward.c b/clang/test/Driver/gcc_forward.c
new file mode 100644
index 0000000..77f401b
--- /dev/null
+++ b/clang/test/Driver/gcc_forward.c
@@ -0,0 +1,13 @@
+// Check that we don't try to forward -Xclang or -mlinker-version to GCC.
+//
+// RUN: %clang -target powerpc-unknown-unknown \
+// RUN: -ccc-clang-archs i386 -c %s \
+// RUN: -Xclang foo-bar \
+// RUN: -mlinker-version=10 -### 2> %t
+// RUN: FileCheck < %t %s
+//
+// CHECK: gcc{{.*}}"
+// CHECK-NOT: "-mlinker-version=10"
+// CHECK-NOT: "-Xclang"
+// CHECK-NOT: "foo-bar"
+// CHECK: gcc_forward
diff --git a/clang/test/Driver/gnu-runtime.m b/clang/test/Driver/gnu-runtime.m
new file mode 100644
index 0000000..12426d9
--- /dev/null
+++ b/clang/test/Driver/gnu-runtime.m
@@ -0,0 +1,5 @@
+// RUN: %clang -target i386-apple-darwin10 -### -fsyntax-only -fgnu-runtime %s 2>&1 | FileCheck %s
+// RUN: %clang -target i386-apple-darwin10 -### -x objective-c++ -fsyntax-only -fgnu-runtime %s 2>&1 | FileCheck %s
+// CHECK: -fgnu-runtime
+// CHECK: -fobjc-runtime-has-arc
+// CHECK: -fobjc-runtime-has-weak
diff --git a/clang/test/Driver/gold-lto.c b/clang/test/Driver/gold-lto.c
new file mode 100644
index 0000000..05ac27a
--- /dev/null
+++ b/clang/test/Driver/gold-lto.c
@@ -0,0 +1,6 @@
+// RUN: touch %t.o
+// RUN: %clang -target x86_64-pc-linux-gnu -### %t.o -O4 -Wl,-plugin-opt=foo 2> %t.log
+// RUN: FileCheck %s < %t.log
+
+// CHECK: "-plugin" "{{.*}}/LLVMgold.so"
+// CHECK: "-plugin-opt=foo"
diff --git a/clang/test/Driver/hello.c b/clang/test/Driver/hello.c
new file mode 100644
index 0000000..c2260e5
--- /dev/null
+++ b/clang/test/Driver/hello.c
@@ -0,0 +1,18 @@
+// RUN: %clang -ccc-echo -o %t.exe %s 2> %t.log
+
+// Make sure we used clang.
+// RUN: grep 'clang\(-[0-9.]\+\)\?\(\.[Ee][Xx][Ee]\)\?" -cc1 .*hello.c' %t.log
+
+// RUN: %t.exe > %t.out
+// RUN: grep "I'm a little driver, short and stout." %t.out
+
+// FIXME: We don't have a usable assembler on Windows, so we can't build real
+// apps yet.
+// XFAIL: win32
+
+#include <stdio.h>
+
+int main() {
+ printf("I'm a little driver, short and stout.");
+ return 0;
+}
diff --git a/clang/test/Driver/immediate-options.c b/clang/test/Driver/immediate-options.c
new file mode 100644
index 0000000..5a3ec87
--- /dev/null
+++ b/clang/test/Driver/immediate-options.c
@@ -0,0 +1,4 @@
+// RUN: %clang --help
+// RUN: %clang --help-hidden
+// RUN: %clang -dumpversion
+// RUN: %clang -print-search-dirs
diff --git a/clang/test/Driver/index-header-map.c b/clang/test/Driver/index-header-map.c
new file mode 100644
index 0000000..8bd677a
--- /dev/null
+++ b/clang/test/Driver/index-header-map.c
@@ -0,0 +1,4 @@
+// RUN: %clang -I%S/Before -index-header-map -I%S/Index -I%S/After %s -### 2>> %t.log
+// RUN: FileCheck %s < %t.log
+
+// CHECK: {{-I.*Before.*-index-header-map.*-I.*Index.*-I.*After}}
diff --git a/clang/test/Driver/invalid-o-level.c b/clang/test/Driver/invalid-o-level.c
new file mode 100644
index 0000000..d5242c7
--- /dev/null
+++ b/clang/test/Driver/invalid-o-level.c
@@ -0,0 +1,4 @@
+// RUN: not %clang_cc1 %s -O900 2> %t.log
+// RUN: FileCheck %s -input-file=%t.log
+
+// CHECK: invalid value '900' in '-O900'
diff --git a/clang/test/Driver/ios-simulator-arcruntime.c b/clang/test/Driver/ios-simulator-arcruntime.c
new file mode 100644
index 0000000..9bf2091
--- /dev/null
+++ b/clang/test/Driver/ios-simulator-arcruntime.c
@@ -0,0 +1,6 @@
+// RUN: %clang -### -x objective-c -target i386-apple-darwin10 -arch i386 -mmacosx-version-min=10.6 -D__IPHONE_OS_VERSION_MIN_REQUIRED=40201 -fobjc-arc -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
+// RUN: %clang -### -x objective-c -target i386-apple-darwin10 -arch i386 -mmacosx-version-min=10.6 -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -fobjc-arc -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
+//
+
+// CHECK-OPTIONS1-NOT: -fobjc-runtime-has-weak
+// CHECK-OPTIONS2: -fobjc-runtime-has-weak
diff --git a/clang/test/Driver/le32-unknown-nacl.cpp b/clang/test/Driver/le32-unknown-nacl.cpp
new file mode 100644
index 0000000..f68b220
--- /dev/null
+++ b/clang/test/Driver/le32-unknown-nacl.cpp
@@ -0,0 +1,146 @@
+// RUN: %clang -target le32-unknown-nacl -ccc-clang-archs le32 -ccc-echo %s -emit-llvm-only -c 2>&1 | FileCheck %s -check-prefix=ECHO
+// RUN: %clang -target le32-unknown-nacl -ccc-clang-archs le32 %s -emit-llvm -S -c -o - | FileCheck %s
+// RUN: %clang -target le32-unknown-nacl -ccc-clang-archs le32 %s -emit-llvm -S -c -pthread -o - | FileCheck %s -check-prefix=THREADS
+
+// ECHO: {{.*}} -cc1 {{.*}}le32-unknown-nacl.c
+
+// Check platform defines
+#include <stdarg.h>
+#include <stddef.h>
+
+extern "C" {
+
+// CHECK: @align_c = global i32 1
+int align_c = __alignof(char);
+
+// CHECK: @align_s = global i32 2
+int align_s = __alignof(short);
+
+// CHECK: @align_i = global i32 4
+int align_i = __alignof(int);
+
+// CHECK: @align_l = global i32 4
+int align_l = __alignof(long);
+
+// CHECK: @align_ll = global i32 8
+int align_ll = __alignof(long long);
+
+// CHECK: @align_p = global i32 4
+int align_p = __alignof(void*);
+
+// CHECK: @align_f = global i32 4
+int align_f = __alignof(float);
+
+// CHECK: @align_d = global i32 8
+int align_d = __alignof(double);
+
+// CHECK: @align_ld = global i32 8
+int align_ld = __alignof(long double);
+
+// CHECK: @align_vl = global i32 4
+int align_vl = __alignof(va_list);
+
+// CHECK: __LITTLE_ENDIAN__defined
+#ifdef __LITTLE_ENDIAN__
+void __LITTLE_ENDIAN__defined() {}
+#endif
+
+// CHECK: __native_client__defined
+#ifdef __native_client__
+void __native_client__defined() {}
+#endif
+
+// CHECK: __le32__defined
+#ifdef __le32__
+void __le32__defined() {}
+#endif
+
+// CHECK: __pnacl__defined
+#ifdef __pnacl__
+void __pnacl__defined() {}
+#endif
+
+// CHECK: unixdefined
+#ifdef unix
+void unixdefined() {}
+#endif
+
+// CHECK: __ELF__defined
+#ifdef __ELF__
+void __ELF__defined() {}
+#endif
+
+// CHECK: _GNU_SOURCEdefined
+#ifdef _GNU_SOURCE
+void _GNU_SOURCEdefined() {}
+#endif
+
+// THREADS: _REENTRANTdefined
+// CHECK: _REENTRANTundefined
+#ifdef _REENTRANT
+void _REENTRANTdefined() {}
+#else
+void _REENTRANTundefined() {}
+#endif
+
+// Check types
+
+// CHECK: signext i8 @check_char()
+char check_char() { return 0; }
+
+// CHECK: signext i16 @check_short()
+short check_short() { return 0; }
+
+// CHECK: i32 @check_int()
+int check_int() { return 0; }
+
+// CHECK: i32 @check_long()
+long check_long() { return 0; }
+
+// CHECK: i64 @check_longlong()
+long long check_longlong() { return 0; }
+
+// CHECK: zeroext i8 @check_uchar()
+unsigned char check_uchar() { return 0; }
+
+// CHECK: zeroext i16 @check_ushort()
+unsigned short check_ushort() { return 0; }
+
+// CHECK: i32 @check_uint()
+unsigned int check_uint() { return 0; }
+
+// CHECK: i32 @check_ulong()
+unsigned long check_ulong() { return 0; }
+
+// CHECK: i64 @check_ulonglong()
+unsigned long long check_ulonglong() { return 0; }
+
+// CHECK: i32 @check_size_t()
+size_t check_size_t() { return 0; }
+
+// CHECK: float @check_float()
+float check_float() { return 0; }
+
+// CHECK: double @check_double()
+double check_double() { return 0; }
+
+// CHECK: double @check_longdouble()
+long double check_longdouble() { return 0; }
+
+}
+
+template<int> void Switch();
+template<> void Switch<4>();
+template<> void Switch<8>();
+template<> void Switch<16>();
+
+void check_pointer_size() {
+ // CHECK: SwitchILi4
+ Switch<sizeof(void*)>();
+
+ // CHECK: SwitchILi8
+ Switch<sizeof(long long)>();
+
+ // CHECK: SwitchILi16
+ Switch<sizeof(va_list)>();
+}
diff --git a/clang/test/Driver/linker-opts.c b/clang/test/Driver/linker-opts.c
new file mode 100644
index 0000000..d036dfd
--- /dev/null
+++ b/clang/test/Driver/linker-opts.c
@@ -0,0 +1,5 @@
+// RUN: env LIBRARY_PATH=%T/test1 %clang -x c %s -### 2>&1 | FileCheck %s
+// CHECK: "-L" "{{.*}}/test1"
+
+// GCC driver is used as linker on cygming. It should be aware of LIBRARY_PATH.
+// XFAIL: cygwin,mingw32
diff --git a/clang/test/Driver/linux-as.c b/clang/test/Driver/linux-as.c
new file mode 100644
index 0000000..22eac0d
--- /dev/null
+++ b/clang/test/Driver/linux-as.c
@@ -0,0 +1,31 @@
+// Check passing options to the assembler for ARM targets.
+//
+// RUN: %clang -target arm-linux -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=ARM %s
+// CHECK-ARM: as{{(.exe)?}}"
+//
+// RUN: %clang -target arm-linux -mcpu=cortex-a8 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=ARM-MCPU %s
+// CHECK-ARM-MCPU: as{{(.exe)?}}" "-mcpu=cortex-a8"
+//
+// RUN: %clang -target arm-linux -mfpu=neon -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=ARM-MFPU %s
+// CHECK-ARM-MFPU: as{{(.exe)?}}" "-mfpu=neon"
+//
+// RUN: %clang -target arm-linux -march=armv7-a -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=ARM-MARCH %s
+// CHECK-ARM-MARCH: as{{(.exe)?}}" "-march=armv7-a"
+//
+// RUN: %clang -target arm-linux -mcpu=cortex-a8 -mfpu=neon -march=armv7-a -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=ARM-ALL %s
+// CHECK-ARM-ALL: as{{(.exe)?}}" "-march=armv7-a" "-mcpu=cortex-a8" "-mfpu=neon"
+//
+// RUN: %clang -target armv7-linux -mcpu=cortex-a8 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=ARM-TARGET %s
+// CHECK-ARM-TARGET: as{{(.exe)?}}" "-mfpu=neon" "-mcpu=cortex-a8"
diff --git a/clang/test/Driver/linux-header-search.cpp b/clang/test/Driver/linux-header-search.cpp
new file mode 100644
index 0000000..ea82660
--- /dev/null
+++ b/clang/test/Driver/linux-header-search.cpp
@@ -0,0 +1,75 @@
+// General tests that the header search paths detected by the driver and passed
+// to CC1 are sane.
+//
+// Test a very broken version of multiarch that shipped in Ubuntu 11.04.
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target i386-unknown-linux \
+// RUN: --sysroot=%S/Inputs/ubuntu_11.04_multiarch_tree \
+// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-11-04 %s
+// CHECK-UBUNTU-11-04: "{{.*}}clang{{.*}}" "-cc1"
+// CHECK-UBUNTU-11-04: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-UBUNTU-11-04: "-internal-isystem" "[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../../include/c++/4.5"
+// CHECK-UBUNTU-11-04: "-internal-isystem" "[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../../include/c++/4.5/i686-linux-gnu"
+// CHECK-UBUNTU-11-04: "-internal-isystem" "[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../../include/c++/4.5/backward"
+// CHECK-UBUNTU-11-04: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-UBUNTU-11-04: "-internal-isystem" "{{.*}}/lib{{(64|32)?}}/clang/{{[0-9]\.[0-9]}}/include"
+// CHECK-UBUNTU-11-04: "-internal-externc-isystem" "[[SYSROOT]]/include"
+// CHECK-UBUNTU-11-04: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+//
+// Thoroughly exercise the Debian multiarch environment.
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target i686-linux-gnu \
+// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
+// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-X86 %s
+// CHECK-DEBIAN-X86: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-DEBIAN-X86: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-X86: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../../../include/c++/4.5"
+// CHECK-DEBIAN-X86: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../../../include/c++/4.5/i686-linux-gnu"
+// CHECK-DEBIAN-X86: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../../../include/c++/4.5/backward"
+// CHECK-DEBIAN-X86: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-DEBIAN-X86: "-internal-isystem" "{{.*}}/lib{{(64|32)?}}/clang/{{[0-9]\.[0-9]}}/include"
+// CHECK-DEBIAN-X86: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/i386-linux-gnu"
+// CHECK-DEBIAN-X86: "-internal-externc-isystem" "[[SYSROOT]]/include"
+// CHECK-DEBIAN-X86: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-linux-gnu \
+// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
+// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-X86-64 %s
+// CHECK-DEBIAN-X86-64: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-DEBIAN-X86-64: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-X86-64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../../../include/c++/4.5"
+// CHECK-DEBIAN-X86-64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../../../include/c++/4.5/x86_64-linux-gnu"
+// CHECK-DEBIAN-X86-64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../../../include/c++/4.5/backward"
+// CHECK-DEBIAN-X86-64: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-DEBIAN-X86-64: "-internal-isystem" "{{.*}}/lib{{(64|32)?}}/clang/{{[0-9]\.[0-9]}}/include"
+// CHECK-DEBIAN-X86-64: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/x86_64-linux-gnu"
+// CHECK-DEBIAN-X86-64: "-internal-externc-isystem" "[[SYSROOT]]/include"
+// CHECK-DEBIAN-X86-64: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+// RUN: %clang -ccc-clang-archs powerpc -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target powerpc-linux-gnu \
+// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
+// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-PPC %s
+// CHECK-DEBIAN-PPC: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-DEBIAN-PPC: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-PPC: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../../../include/c++/4.5"
+// CHECK-DEBIAN-PPC: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../../../include/c++/4.5/powerpc-linux-gnu"
+// CHECK-DEBIAN-PPC: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../../../include/c++/4.5/backward"
+// CHECK-DEBIAN-PPC: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-DEBIAN-PPC: "-internal-isystem" "{{.*}}/lib{{(64|32)?}}/clang/{{[0-9]\.[0-9]}}/include"
+// CHECK-DEBIAN-PPC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/powerpc-linux-gnu"
+// CHECK-DEBIAN-PPC: "-internal-externc-isystem" "[[SYSROOT]]/include"
+// CHECK-DEBIAN-PPC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+// RUN: %clang -ccc-clang-archs powerpc64 -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target powerpc64-linux-gnu \
+// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
+// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-PPC64 %s
+// CHECK-DEBIAN-PPC64: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-DEBIAN-PPC64: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-PPC64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../../../include/c++/4.5"
+// CHECK-DEBIAN-PPC64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../../../include/c++/4.5/powerpc64-linux-gnu"
+// CHECK-DEBIAN-PPC64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../../../include/c++/4.5/backward"
+// CHECK-DEBIAN-PPC64: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-DEBIAN-PPC64: "-internal-isystem" "{{.*}}/lib{{(64|32)?}}/clang/{{[0-9]\.[0-9]}}/include"
+// CHECK-DEBIAN-PPC64: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/powerpc64-linux-gnu"
+// CHECK-DEBIAN-PPC64: "-internal-externc-isystem" "[[SYSROOT]]/include"
+// CHECK-DEBIAN-PPC64: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
new file mode 100644
index 0000000..9a35d5d
--- /dev/null
+++ b/clang/test/Driver/linux-ld.c
@@ -0,0 +1,270 @@
+// General tests that ld invocations on Linux targets sane. Note that we use
+// sysroot to make these tests independent of the host system.
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-unknown-linux \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
+// CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o"
+// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
+// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
+// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
+// CHECK-LD-32: "-L[[SYSROOT]]/lib"
+// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target x86_64-unknown-linux \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD-64 %s
+// CHECK-LD-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-LD-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o"
+// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
+// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
+// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
+// CHECK-LD-64: "-L[[SYSROOT]]/lib"
+// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-unknown-linux -m32 \
+// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-32-TO-32 %s
+// CHECK-32-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-32-TO-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib32"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib32"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/lib/../lib32"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
+// CHECK-32-TO-32: "-L[[SYSROOT]]/lib"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-unknown-linux -m64 \
+// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-32-TO-64 %s
+// CHECK-32-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-32-TO-64: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/64/crtbegin.o"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/64"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib64"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib64"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/lib/../lib64"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
+// CHECK-32-TO-64: "-L[[SYSROOT]]/lib"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target x86_64-unknown-linux -m64 \
+// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-64-TO-64 %s
+// CHECK-64-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-64-TO-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o"
+// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
+// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib64"
+// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib64"
+// CHECK-64-TO-64: "-L[[SYSROOT]]/lib/../lib64"
+// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
+// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
+// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
+// CHECK-64-TO-64: "-L[[SYSROOT]]/lib"
+// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target x86_64-unknown-linux -m32 \
+// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-64-TO-32 %s
+// CHECK-64-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-64-TO-32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32/crtbegin.o"
+// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32"
+// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib32"
+// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib32"
+// CHECK-64-TO-32: "-L[[SYSROOT]]/lib/../lib32"
+// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
+// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
+// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
+// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
+// CHECK-64-TO-32: "-L[[SYSROOT]]/lib"
+// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target x86_64-unknown-linux -m32 \
+// RUN: -gcc-toolchain %S/Inputs/multilib_64bit_linux_tree/usr \
+// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-64-TO-32-SYSROOT %s
+// CHECK-64-TO-32-SYSROOT: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-64-TO-32-SYSROOT: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32/crtbegin.o"
+// CHECK-64-TO-32-SYSROOT: "-L{{[^"]*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32"
+// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/lib/../lib32"
+// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/usr/lib/../lib32"
+// CHECK-64-TO-32-SYSROOT: "-L{{[^"]*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
+// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/lib"
+// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-unknown-linux -m32 \
+// RUN: -ccc-install-dir %S/Inputs/fake_install_tree/bin \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-INSTALL-DIR-32 %s
+// CHECK-INSTALL-DIR-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-INSTALL-DIR-32: "{{.*}}/Inputs/fake_install_tree/bin/../lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o"
+// CHECK-INSTALL-DIR-32: "-L{{.*}}/Inputs/fake_install_tree/bin/../lib/gcc/i386-unknown-linux/4.7.0"
+//
+// Check that with 64-bit builds, we don't actually use the install directory
+// as its version of GCC is lower than our sysrooted version.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target x86_64-unknown-linux -m64 \
+// RUN: -ccc-install-dir %S/Inputs/fake_install_tree/bin \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-INSTALL-DIR-64 %s
+// CHECK-INSTALL-DIR-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-INSTALL-DIR-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o"
+// CHECK-INSTALL-DIR-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
+//
+// Check that we support unusual patch version formats, including missing that
+// component.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-unknown-linux -m32 \
+// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing1/bin \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION1 %s
+// CHECK-GCC-VERSION1: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-GCC-VERSION1: "{{.*}}/Inputs/gcc_version_parsing1/bin/../lib/gcc/i386-unknown-linux/4.7/crtbegin.o"
+// CHECK-GCC-VERSION1: "-L{{.*}}/Inputs/gcc_version_parsing1/bin/../lib/gcc/i386-unknown-linux/4.7"
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-unknown-linux -m32 \
+// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing2/bin \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION2 %s
+// CHECK-GCC-VERSION2: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-GCC-VERSION2: "{{.*}}/Inputs/gcc_version_parsing2/bin/../lib/gcc/i386-unknown-linux/4.7.x/crtbegin.o"
+// CHECK-GCC-VERSION2: "-L{{.*}}/Inputs/gcc_version_parsing2/bin/../lib/gcc/i386-unknown-linux/4.7.x"
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-unknown-linux -m32 \
+// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing3/bin \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION3 %s
+// CHECK-GCC-VERSION3: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-GCC-VERSION3: "{{.*}}/Inputs/gcc_version_parsing3/bin/../lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o"
+// CHECK-GCC-VERSION3: "-L{{.*}}/Inputs/gcc_version_parsing3/bin/../lib/gcc/i386-unknown-linux/4.7.99-rc5"
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-unknown-linux -m32 \
+// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing4/bin \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION4 %s
+// CHECK-GCC-VERSION4: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-GCC-VERSION4: "{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99/crtbegin.o"
+// CHECK-GCC-VERSION4: "-L{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99"
+//
+// Test a very broken version of multiarch that shipped in Ubuntu 11.04.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-unknown-linux \
+// RUN: --sysroot=%S/Inputs/ubuntu_11.04_multiarch_tree \
+// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-11-04 %s
+// CHECK-UBUNTU-11-04: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-UBUNTU-11-04: "{{.*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/crtbegin.o"
+// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
+// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../i386-linux-gnu"
+// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu"
+// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."
+// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/lib"
+// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib"
+//
+// Test the setup that shipped in SUSE 10.3 on ppc64.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target powerpc64-suse-linux \
+// RUN: --sysroot=%S/Inputs/suse_10.3_ppc64_tree \
+// RUN: | FileCheck --check-prefix=CHECK-SUSE-10-3-PPC64 %s
+// CHECK-SUSE-10-3-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-SUSE-10-3-PPC64: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64/crtbegin.o"
+// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64"
+// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/4.1.2/../../../../lib64"
+// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/lib/../lib64"
+// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/../lib64"
+//
+// Check that we do not pass --hash-style=gnu and --hash-style=both to linker
+// and provide correct path to the dynamic linker and emulation mode when build
+// for MIPS platforms.
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: -target mips-linux-gnu -ccc-clang-archs mips \
+// RUN: | FileCheck --check-prefix=CHECK-MIPS %s
+// CHECK-MIPS: "{{.*}}ld{{(.exe)?}}"
+// CHECK-MIPS: "-m" "elf32btsmip"
+// CHECK-MIPS: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
+// CHECK-MIPS-NOT: "--hash-style={{gnu|both}}"
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: -target mipsel-linux-gnu -ccc-clang-archs mipsel \
+// RUN: | FileCheck --check-prefix=CHECK-MIPSEL %s
+// CHECK-MIPSEL: "{{.*}}ld{{(.exe)?}}"
+// CHECK-MIPSEL: "-m" "elf32ltsmip"
+// CHECK-MIPSEL: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
+// CHECK-MIPSEL-NOT: "--hash-style={{gnu|both}}"
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: -target mips64-linux-gnu -ccc-clang-archs mips64 \
+// RUN: | FileCheck --check-prefix=CHECK-MIPS64 %s
+// CHECK-MIPS64: "{{.*}}ld{{(.exe)?}}"
+// CHECK-MIPS64: "-m" "elf64btsmip"
+// CHECK-MIPS64: "-dynamic-linker" "{{.*}}/lib64/ld.so.1"
+// CHECK-MIPS64-NOT: "--hash-style={{gnu|both}}"
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: -target mips64el-linux-gnu -ccc-clang-archs mips64el \
+// RUN: | FileCheck --check-prefix=CHECK-MIPS64EL %s
+// CHECK-MIPS64EL: "{{.*}}ld{{(.exe)?}}"
+// CHECK-MIPS64EL: "-m" "elf64ltsmip"
+// CHECK-MIPS64EL: "-dynamic-linker" "{{.*}}/lib64/ld.so.1"
+// CHECK-MIPS64EL-NOT: "--hash-style={{gnu|both}}"
+//
+// Thoroughly exercise the Debian multiarch environment.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i686-linux-gnu \
+// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
+// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-X86 %s
+// CHECK-DEBIAN-X86: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-X86: "{{.*}}/usr/lib/gcc/i686-linux-gnu/4.5/crtbegin.o"
+// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5"
+// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../../i386-linux-gnu"
+// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu"
+// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../.."
+// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/lib"
+// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib"
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target x86_64-linux-gnu \
+// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
+// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-X86-64 %s
+// CHECK-DEBIAN-X86-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-X86-64: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.5/crtbegin.o"
+// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5"
+// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../../x86_64-linux-gnu"
+// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/x86_64-linux-gnu"
+// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../.."
+// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/lib"
+// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib"
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target powerpc-linux-gnu \
+// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
+// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-PPC %s
+// CHECK-DEBIAN-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-PPC: "{{.*}}/usr/lib/gcc/powerpc-linux-gnu/4.5/crtbegin.o"
+// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5"
+// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../../powerpc-linux-gnu"
+// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/powerpc-linux-gnu"
+// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../.."
+// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/lib"
+// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib"
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target powerpc64-linux-gnu \
+// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
+// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-PPC64 %s
+// CHECK-DEBIAN-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-PPC64: "{{.*}}/usr/lib/gcc/powerpc64-linux-gnu/4.5/crtbegin.o"
+// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5"
+// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../../powerpc64-linux-gnu"
+// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/powerpc64-linux-gnu"
+// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../.."
+// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/lib"
+// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib"
+//
diff --git a/clang/test/Driver/lto.c b/clang/test/Driver/lto.c
new file mode 100644
index 0000000..22b4788
--- /dev/null
+++ b/clang/test/Driver/lto.c
@@ -0,0 +1,23 @@
+// -emit-llvm, -flto, and -O4 all cause a switch to llvm-bc object files.
+// RUN: %clang -ccc-print-phases -c %s -flto 2> %t.log
+// RUN: grep '2: compiler, {1}, lto-bc' %t.log
+// RUN: %clang -ccc-print-phases -c %s -O4 2> %t.log
+// RUN: grep '2: compiler, {1}, lto-bc' %t.log
+
+// and -emit-llvm doesn't alter pipeline (unfortunately?).
+// RUN: %clang -ccc-print-phases %s -emit-llvm 2> %t.log
+// RUN: grep '0: input, ".*lto.c", c' %t.log
+// RUN: grep '1: preprocessor, {0}, cpp-output' %t.log
+// RUN: grep '2: compiler, {1}, lto-bc' %t.log
+// RUN: grep '3: linker, {2}, image' %t.log
+
+// llvm-bc and llvm-ll outputs need to match regular suffixes
+// (unfortunately).
+// RUN: %clang %s -emit-llvm -save-temps -### 2> %t.log
+// RUN: grep '"-o" ".*lto\.i" "-x" "c" ".*lto\.c"' %t.log
+// RUN: grep '"-o" ".*lto\.o" .*".*lto\.i"' %t.log
+// RUN: grep '".*a.out" .*".*lto\.o"' %t.log
+
+// RUN: %clang %s -emit-llvm -S -### 2> %t.log
+// RUN: grep '"-o" ".*lto\.s" "-x" "c" ".*lto\.c"' %t.log
+
diff --git a/clang/test/Driver/m_and_mm.c b/clang/test/Driver/m_and_mm.c
new file mode 100644
index 0000000..eab2a04
--- /dev/null
+++ b/clang/test/Driver/m_and_mm.c
@@ -0,0 +1,3 @@
+// RUN: %clang -### \
+// RUN: -M -MM %s 2> %t
+// RUN: grep '"-sys-header-deps"' %t | count 0
diff --git a/clang/test/Driver/mg.c b/clang/test/Driver/mg.c
new file mode 100644
index 0000000..4f43814
--- /dev/null
+++ b/clang/test/Driver/mg.c
@@ -0,0 +1,5 @@
+// RUN: %clang -M -MG -include nonexistent-preinclude.h %s > %t
+// RUN: fgrep nonexistent-preinclude.h %t
+// RUN: fgrep nonexistent-ppinclude.h %t
+
+#include "nonexistent-ppinclude.h"
diff --git a/clang/test/Driver/mips-as.c b/clang/test/Driver/mips-as.c
new file mode 100644
index 0000000..44b8d8d
--- /dev/null
+++ b/clang/test/Driver/mips-as.c
@@ -0,0 +1,31 @@
+// Check passing options to the assembler for MIPS targets.
+//
+// RUN: %clang -target mips-linux-gnu -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS32-EB-AS %s
+// CHECK-MIPS32-EB-AS: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB"
+//
+// RUN: %clang -target mipsel-linux-gnu -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS32-EL-AS %s
+// CHECK-MIPS32-EL-AS: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EL"
+//
+// RUN: %clang -target mips64-linux-gnu -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS64-EB-AS %s
+// CHECK-MIPS64-EB-AS: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EB"
+//
+// RUN: %clang -target mips64el-linux-gnu -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS64-EL-AS %s
+// CHECK-MIPS64-EL-AS: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EL"
+//
+// RUN: %clang -target mips-linux-gnu -mabi=eabi -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-EABI %s
+// CHECK-MIPS-EABI: as{{(.exe)?}}" "-march" "mips32" "-mabi" "eabi" "-EB"
+//
+// RUN: %clang -target mips64-linux-gnu -mabi=n32 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-N32 %s
+// CHECK-MIPS-N32: as{{(.exe)?}}" "-march" "mips64" "-mabi" "n32" "-EB"
diff --git a/clang/test/Driver/mips-float.c b/clang/test/Driver/mips-float.c
new file mode 100644
index 0000000..c9e107f
--- /dev/null
+++ b/clang/test/Driver/mips-float.c
@@ -0,0 +1,42 @@
+// Check handling -mhard-float / -msoft-float / -mfloat-abi options
+// when build for MIPS platforms.
+//
+// Default
+// RUN: %clang -ccc-clang-archs mips -c %s -### -o %t.o 2>&1 \
+// RUN: -target mips-linux-gnu \
+// RUN: | FileCheck --check-prefix=CHECK-DEF %s
+// CHECK-DEF: "-mfloat-abi" "hard"
+//
+// -mhard-float
+// RUN: %clang -ccc-clang-archs mips -c %s -### -o %t.o 2>&1 \
+// RUN: -target mips-linux-gnu -mhard-float \
+// RUN: | FileCheck --check-prefix=CHECK-HARD %s
+// CHECK-HARD: "-mfloat-abi" "hard"
+//
+// -msoft-float
+// RUN: %clang -ccc-clang-archs mips -c %s -### -o %t.o 2>&1 \
+// RUN: -target mips-linux-gnu -msoft-float \
+// RUN: | FileCheck --check-prefix=CHECK-SOFT %s
+// CHECK-SOFT: "-msoft-float"
+// CHECK-SOFT: "-mfloat-abi" "soft"
+// CHECK-SOFT: "-target-feature" "+soft-float"
+//
+// -mfloat-abi=hard
+// RUN: %clang -ccc-clang-archs mips -c %s -### -o %t.o 2>&1 \
+// RUN: -target mips-linux-gnu -mfloat-abi=hard \
+// RUN: | FileCheck --check-prefix=CHECK-ABI-HARD %s
+// CHECK-ABI-HARD: "-mfloat-abi" "hard"
+//
+// -mfloat-abi=soft
+// RUN: %clang -ccc-clang-archs mips -c %s -### -o %t.o 2>&1 \
+// RUN: -target mips-linux-gnu -mfloat-abi=soft \
+// RUN: | FileCheck --check-prefix=CHECK-ABI-SOFT %s
+// CHECK-ABI-SOFT: "-msoft-float"
+// CHECK-ABI-SOFT: "-mfloat-abi" "soft"
+// CHECK-ABI-SOFT: "-target-feature" "+soft-float"
+//
+// -mfloat-abi=single
+// RUN: %clang -ccc-clang-archs mips -c %s -### -o %t.o 2>&1 \
+// RUN: -target mips-linux-gnu -mfloat-abi=single \
+// RUN: | FileCheck --check-prefix=CHECK-ABI-SINGLE %s
+// CHECK-ABI-SINGLE: "-target-feature" "+single-float"
diff --git a/clang/test/Driver/mno-global-merge.c b/clang/test/Driver/mno-global-merge.c
new file mode 100644
index 0000000..ec9f69e
--- /dev/null
+++ b/clang/test/Driver/mno-global-merge.c
@@ -0,0 +1,12 @@
+// RUN: %clang -target armv7-apple-darwin10 \
+// RUN: -mno-global-merge -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-NGM < %t %s
+
+// CHECK-NGM: "-mno-global-merge"
+
+// RUN: %clang -target armv7-apple-darwin10 \
+// RUN: -mglobal-merge -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-GM < %t %s
+
+// CHECK-GM-NOT: "-mglobal-merge"
+
diff --git a/clang/test/Driver/modules.m b/clang/test/Driver/modules.m
new file mode 100644
index 0000000..b93054d
--- /dev/null
+++ b/clang/test/Driver/modules.m
@@ -0,0 +1,6 @@
+// RUN: %clang -fmodules -fno-modules -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MODULES %s
+// CHECK-NO-MODULES-NOT: -fmodules
+
+// RUN: %clang -fmodules -fno-modules -fmodules -### %s 2>&1 | FileCheck -check-prefix=CHECK-HAS-MODULES %s
+// CHECK-HAS-MODULES: -fmodules
+
diff --git a/clang/test/Driver/modules.mm b/clang/test/Driver/modules.mm
new file mode 100644
index 0000000..b2948c4
--- /dev/null
+++ b/clang/test/Driver/modules.mm
@@ -0,0 +1,6 @@
+// RUN: %clang -fmodules -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MODULES %s
+// RUN: %clang -fcxx-modules -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MODULES %s
+// CHECK-NO-MODULES-NOT: -fmodules
+
+// RUN: %clang -fcxx-modules -fmodules -### %s 2>&1 | FileCheck -check-prefix=CHECK-HAS-MODULES %s
+// CHECK-HAS-MODULES: -fmodules
diff --git a/clang/test/Driver/no-objc-arr.m b/clang/test/Driver/no-objc-arr.m
new file mode 100644
index 0000000..e449393
--- /dev/null
+++ b/clang/test/Driver/no-objc-arr.m
@@ -0,0 +1,8 @@
+// RUN: %clang -Werror -fobjc-arc -fsyntax-only -fno-objc-arc -Xclang -verify %s
+// rdar://8949617
+
+void * FOO() {
+ id string = @"Hello World.\n";
+ void *pointer = string; // No error must be issued
+ return pointer;
+}
diff --git a/clang/test/Driver/no-objc-default-synthesize-properties.m b/clang/test/Driver/no-objc-default-synthesize-properties.m
new file mode 100644
index 0000000..e380514
--- /dev/null
+++ b/clang/test/Driver/no-objc-default-synthesize-properties.m
@@ -0,0 +1,10 @@
+// RUN: %clang -fsyntax-only -fno-objc-default-synthesize-properties -fobjc-default-synthesize-properties %s 2>&1 | FileCheck %s
+
+@interface I
+@property int P;
+@end
+
+@implementation I
+@end
+// CHECK: warning: argument unused during compilation: '-fno-objc-default-synthesize-properties'
+// CHECK: warning: argument unused during compilation: '-fobjc-default-synthesize-properties'
diff --git a/clang/test/Driver/no-sibling-calls.c b/clang/test/Driver/no-sibling-calls.c
new file mode 100644
index 0000000..c248990
--- /dev/null
+++ b/clang/test/Driver/no-sibling-calls.c
@@ -0,0 +1,8 @@
+// RUN: %clang -### %s -fno-optimize-sibling-calls 2> %t
+// RUN: FileCheck --check-prefix=CHECK-NOSC < %t %s
+// CHECK-NOSC: "-mdisable-tail-calls"
+
+// RUN: %clang -### -foptimize-sibling-calls %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-OSC < %t %s
+// CHECK-OSC-NOT: "-mdisable-tail-calls"
+
diff --git a/clang/test/Driver/noexecstack.c b/clang/test/Driver/noexecstack.c
new file mode 100644
index 0000000..1f47728
--- /dev/null
+++ b/clang/test/Driver/noexecstack.c
@@ -0,0 +1 @@
+// RUN: %clang -### %s -c -o tmp.o -triple i686-pc-linux-gnu -integrated-as -Wa,--noexecstack 2>&1 | grep "mnoexecstack"
diff --git a/clang/test/Driver/noinline.c b/clang/test/Driver/noinline.c
new file mode 100644
index 0000000..e665b2f
--- /dev/null
+++ b/clang/test/Driver/noinline.c
@@ -0,0 +1,10 @@
+// Make sure the driver is correctly passing -fno-inline-functions
+// rdar://10972766
+
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN: -fno-inline -fno-inline-functions -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK < %t %s
+
+// CHECK: clang
+// CHECK: "-fno-inline"
+// CHECK: "-fno-inline-functions"
diff --git a/clang/test/Driver/nostdincxx.cpp b/clang/test/Driver/nostdincxx.cpp
new file mode 100644
index 0000000..7e00555
--- /dev/null
+++ b/clang/test/Driver/nostdincxx.cpp
@@ -0,0 +1,4 @@
+// RUN: %clangxx -nostdinc++ %s 2>&1 | FileCheck %s
+// XFAIL: win32
+// CHECK: file not found
+#include <vector>
diff --git a/clang/test/Driver/nostdlib.c b/clang/test/Driver/nostdlib.c
new file mode 100644
index 0000000..e9ada31
--- /dev/null
+++ b/clang/test/Driver/nostdlib.c
@@ -0,0 +1,4 @@
+// RUN: %clang -target i686-pc-linux-gnu -### -nostdlib %s 2> %t
+// RUN: FileCheck < %t %s
+//
+// CHECK-NOT: start-group
diff --git a/clang/test/Driver/nostdlibinc.c b/clang/test/Driver/nostdlibinc.c
new file mode 100644
index 0000000..5b6fab6
--- /dev/null
+++ b/clang/test/Driver/nostdlibinc.c
@@ -0,0 +1,10 @@
+// RUN: %clang -target x86_64-unknown-unknown \
+// RUN: -nostdlibinc -ffreestanding -fsyntax-only %s
+
+#if !__has_include("stddef.h")
+#error "expected to be able to find compiler builtin headers!"
+#endif
+
+#if __has_include("stdlib.h")
+#error "expected to *not* be able to find standard C headers"
+#endif
diff --git a/clang/test/Driver/objc++-cpp-output.mm b/clang/test/Driver/objc++-cpp-output.mm
new file mode 100644
index 0000000..bb88144
--- /dev/null
+++ b/clang/test/Driver/objc++-cpp-output.mm
@@ -0,0 +1,8 @@
+// RUN: %clang -x objc++-cpp-output -c %s -o /dev/null
+
+// Should compile without errors
+@protocol P
+- (void)m;
+@end
+void f() {}
+class C {};
diff --git a/clang/test/Driver/objc-cpp-output.m b/clang/test/Driver/objc-cpp-output.m
new file mode 100644
index 0000000..6d97483
--- /dev/null
+++ b/clang/test/Driver/objc-cpp-output.m
@@ -0,0 +1,7 @@
+// RUN: %clang -x objc-cpp-output -c %s -o /dev/null
+
+// Should compile without errors
+@protocol P
+- (void)m;
+@end
+void f() {}
diff --git a/clang/test/Driver/openbsd.c b/clang/test/Driver/openbsd.c
new file mode 100644
index 0000000..911c452
--- /dev/null
+++ b/clang/test/Driver/openbsd.c
@@ -0,0 +1,5 @@
+// RUN: %clang -no-canonical-prefixes -ccc-clang-archs "" -target i686-pc-openbsd %s -### 2> %t.log
+// RUN: FileCheck -input-file %t.log %s
+
+// CHECK: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
+// CHECK: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o"
diff --git a/clang/test/Driver/option-aliases.c b/clang/test/Driver/option-aliases.c
new file mode 100644
index 0000000..38bf4b1
--- /dev/null
+++ b/clang/test/Driver/option-aliases.c
@@ -0,0 +1,11 @@
+// RUN: %clang -ccc-print-options \
+// RUN: --save-temps --undefine-macro=FOO --undefine-macro FOO \
+// RUN: --param=FOO --output=FOO 2> %t
+// RUN: FileCheck --check-prefix=CHECK-OPTIONS < %t %s
+
+// CHECK-OPTIONS: Option 0 - Name: "-ccc-print-options", Values: {}
+// CHECK-OPTIONS: Option 1 - Name: "-save-temps", Values: {}
+// CHECK-OPTIONS: Option 2 - Name: "-U", Values: {"FOO"}
+// CHECK-OPTIONS: Option 3 - Name: "-U", Values: {"FOO"}
+// CHECK-OPTIONS: Option 4 - Name: "--param", Values: {"FOO"}
+// CHECK-OPTIONS: Option 5 - Name: "-o", Values: {"FOO"}
diff --git a/clang/test/Driver/output-file-cleanup.c b/clang/test/Driver/output-file-cleanup.c
new file mode 100644
index 0000000..0a0c960
--- /dev/null
+++ b/clang/test/Driver/output-file-cleanup.c
@@ -0,0 +1,25 @@
+// RUN: touch %t.o
+// RUN: not %clang -DCRASH -o %t.o -MMD -MF %t.d %s
+// RUN: test ! -f %t.o
+// RUN: test ! -f %t.d
+
+// RUN: touch %t.o
+// RUN: not %clang -DMISSING -o %t.o -MMD -MF %t.d %s
+// RUN: test ! -f %t.o
+// RUN: test ! -f %t.d
+
+// RUN: touch %t.o
+// RUN: not %clang -o %t.o -MMD -MF %t.d %s
+// RUN: test ! -f %t.o
+// RUN: test -f %t.d
+
+// REQUIRES: shell
+// REQUIRES: crash-recovery
+
+#ifdef CRASH
+#pragma clang __debug crash
+#elif defined(MISSING)
+#include "nonexistent.h"
+#else
+invalid C code
+#endif
diff --git a/clang/test/Driver/parsing.c b/clang/test/Driver/parsing.c
new file mode 100644
index 0000000..eceba37
--- /dev/null
+++ b/clang/test/Driver/parsing.c
@@ -0,0 +1,22 @@
+// RUN: %clang -ccc-print-options input -Yunknown -m32 -arch ppc -djoined -A separate -Ajoined -Wp,one,two -Xarch_joined AndSeparate -sectalign 1 2 3 2> %t
+// RUN: grep 'Option 0 - Name: "-ccc-print-options", Values: {}' %t
+// RUN: grep 'Option 1 - Name: "<input>", Values: {"input"}' %t
+// RUN: grep 'Option 2 - Name: "<unknown>", Values: {"-Yunknown"}' %t
+// RUN: grep 'Option 3 - Name: "-m32", Values: {}' %t
+// RUN: grep 'Option 4 - Name: "-arch", Values: {"ppc"}' %t
+// RUN: grep 'Option 5 - Name: "-d", Values: {"joined"}' %t
+// RUN: grep 'Option 6 - Name: "-A", Values: {"separate"}' %t
+// RUN: grep 'Option 7 - Name: "-A", Values: {"joined"}' %t
+// RUN: grep 'Option 8 - Name: "-Wp,", Values: {"one", "two"}' %t
+// RUN: grep 'Option 9 - Name: "-Xarch_", Values: {"joined", "AndSeparate"}' %t
+// RUN: grep 'Option 10 - Name: "-sectalign", Values: {"1", "2", "3"}' %t
+
+// RUN: not %clang -V 2> %t
+// RUN: grep "error: argument to '-V' is missing (expected 1 value)" %t
+// RUN: not %clang -sectalign 1 2 2> %t
+// RUN: grep "error: argument to '-sectalign' is missing (expected 3 values)" %t
+
+// Verify that search continues after find the first option.
+// RUN: %clang -ccc-print-options -Wally 2> %t
+// RUN: grep 'Option 0 - Name: "-ccc-print-options", Values: {}' %t
+// RUN: grep 'Option 1 - Name: "-W", Values: {"ally"}' %t
diff --git a/clang/test/Driver/phases.c b/clang/test/Driver/phases.c
new file mode 100644
index 0000000..4c480d5
--- /dev/null
+++ b/clang/test/Driver/phases.c
@@ -0,0 +1,78 @@
+// Basic compilation for various types of files.
+// RUN: %clang -target i386-unknown-unknown -ccc-print-phases -x c %s -x objective-c %s -x c++ %s -x objective-c++ -x assembler %s -x assembler-with-cpp %s -x none %s 2>&1 | FileCheck -check-prefix=BASIC %s
+// BASIC: 0: input, "{{.*}}phases.c", c
+// BASIC: 1: preprocessor, {0}, cpp-output
+// BASIC: 2: compiler, {1}, assembler
+// BASIC: 3: assembler, {2}, object
+// BASIC: 4: input, "{{.*}}phases.c", objective-c
+// BASIC: 5: preprocessor, {4}, objective-c-cpp-output
+// BASIC: 6: compiler, {5}, assembler
+// BASIC: 7: assembler, {6}, object
+// BASIC: 8: input, "{{.*}}phases.c", c++
+// BASIC: 9: preprocessor, {8}, c++-cpp-output
+// BASIC: 10: compiler, {9}, assembler
+// BASIC: 11: assembler, {10}, object
+// BASIC: 12: input, "{{.*}}phases.c", assembler
+// BASIC: 13: assembler, {12}, object
+// BASIC: 14: input, "{{.*}}phases.c", assembler-with-cpp
+// BASIC: 15: preprocessor, {14}, assembler
+// BASIC: 16: assembler, {15}, object
+// BASIC: 17: input, "{{.*}}phases.c", c
+// BASIC: 18: preprocessor, {17}, cpp-output
+// BASIC: 19: compiler, {18}, assembler
+// BASIC: 20: assembler, {19}, object
+// BASIC: 21: linker, {3, 7, 11, 13, 16, 20}, image
+
+// Universal linked image.
+// RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=ULI %s
+// ULI: 0: input, "{{.*}}phases.c", c
+// ULI: 1: preprocessor, {0}, cpp-output
+// ULI: 2: compiler, {1}, assembler
+// ULI: 3: assembler, {2}, object
+// ULI: 4: linker, {3}, image
+// ULI: 5: bind-arch, "ppc", {4}, image
+// ULI: 6: bind-arch, "i386", {4}, image
+// ULI: 7: lipo, {5, 6}, image
+
+// Universal object file.
+// RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=UOF %s
+// UOF: 0: input, "{{.*}}phases.c", c
+// UOF: 1: preprocessor, {0}, cpp-output
+// UOF: 2: compiler, {1}, assembler
+// UOF: 3: assembler, {2}, object
+// UOF: 4: bind-arch, "ppc", {3}, object
+// UOF: 5: bind-arch, "i386", {3}, object
+// UOF: 6: lipo, {4, 5}, object
+
+// Arch defaulting
+// RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c -x assembler %s 2>&1 | FileCheck -check-prefix=ARCH1 %s
+// ARCH1: 2: bind-arch, "i386", {1}, object
+// RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c -x assembler %s -m32 -m64 2>&1 | FileCheck -check-prefix=ARCH2 %s
+// ARCH2: 2: bind-arch, "x86_64", {1}, object
+// RUN: %clang -target x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s 2>&1 | FileCheck -check-prefix=ARCH3 %s
+// ARCH3: 2: bind-arch, "x86_64", {1}, object
+// RUN: %clang -target x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s -m64 -m32 2>&1 | FileCheck -check-prefix=ARCH4 %s
+// ARCH4: 2: bind-arch, "i386", {1}, object
+
+// Analyzer
+// RUN: %clang -target i386-unknown-unknown -ccc-print-phases --analyze %s 2>&1 | FileCheck -check-prefix=ANALYZE %s
+// ANALYZE: 0: input, "{{.*}}phases.c", c
+// ANALYZE: 1: preprocessor, {0}, cpp-output
+// ANALYZE: 2: analyzer, {1}, plist
+
+// Precompiler
+// RUN: %clang -target i386-unknown-unknown -ccc-print-phases -x c-header %s 2>&1 | FileCheck -check-prefix=PCH %s
+// PCH: 0: input, "{{.*}}phases.c", c-header
+// PCH: 1: preprocessor, {0}, c-header-cpp-output
+// PCH: 2: precompiler, {1}, precompiled-header
+
+// Darwin overrides the handling for .s
+// RUN: touch %t.s
+// RUN: %clang -target i386-unknown-unknown -ccc-print-phases -c %t.s 2>&1 | FileCheck -check-prefix=DARWIN1 %s
+// DARWIN1: 0: input, "{{.*}}.s", assembler
+// DARWIN1: 1: assembler, {0}, object
+// RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c %t.s 2>&1 | FileCheck -check-prefix=DARWIN2 %s
+// DARWIN2: 0: input, "{{.*}}.s", assembler-with-cpp
+// DARWIN2: 1: preprocessor, {0}, assembler
+// DARWIN2: 2: assembler, {1}, object
+
diff --git a/clang/test/Driver/pic.c b/clang/test/Driver/pic.c
new file mode 100644
index 0000000..3952f85
--- /dev/null
+++ b/clang/test/Driver/pic.c
@@ -0,0 +1,81 @@
+// Test the driver's control over the PIC behavior. These consist of tests of
+// the relocation model flags and the pic level flags passed to CC1.
+//
+// CHECK-NO-PIC: "-mrelocation-model" "static"
+// CHECK-NO-PIC-NOT: "-pic-level"
+// CHECK-NO-PIC-NOT: "-pie-level"
+//
+// CHECK-DYNAMIC-NO-PIC1: "-mrelocation-model" "dynamic-no-pic"
+// CHECK-DYNAMIC-NO-PIC1: "-pic-level" "1"
+//
+// CHECK-DYNAMIC-NO-PIC2: "-mrelocation-model" "dynamic-no-pic"
+// CHECK-DYNAMIC-NO-PIC2: "-pic-level" "2"
+//
+// CHECK-PIC1-NOT: "-mrelocation-model"
+// CHECK-PIC1: "-pic-level" "1"
+//
+// CHECK-PIC2-NOT: "-mrelocation-model"
+// CHECK-PIC2: "-pic-level" "2"
+//
+// CHECK-PIE1-NOT: "-mrelocation-model"
+// CHECK-PIE1: "-pie-level" "1"
+//
+// CHECK-PIE2-NOT: "-mrelocation-model"
+// CHECK-PIE2: "-pie-level" "2"
+//
+// RUN: %clang -c %s -target i386-unknown-unknown -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fpic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC1
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIC -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target i386-unknown-unknown -fpie -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE1
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIE -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
+// RUN: %clang -c %s -target i386-unknown-unknown -fpic -fno-pic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fno-PIC -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fpic -fno-PIC -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fno-pic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-pie -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fno-PIE -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-PIE -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fno-pie -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-pic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fpic -fno-pie -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fpic -fPIC -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fpic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC1
+// RUN: %clang -c %s -target i386-unknown-unknown -fpic -fPIE -fpie -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE1
+// RUN: %clang -c %s -target i386-unknown-unknown -fpie -fPIC -fPIE -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
+//
+// Defaults change for Darwin.
+// RUN: %clang -c %s -target i386-apple-darwin -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target i386-apple-darwin -fno-pic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-apple-darwin -fno-PIC -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+//
+// Disregard any of the PIC-specific flags if we have a trump-card flag.
+// RUN: %clang -c %s -target i386-unknown-unknown -mkernel -fPIC -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -static -fPIC -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -mdynamic-no-pic -fPIC -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC1
+// RUN: %clang -c %s -target i386-apple-darwin -mdynamic-no-pic -fPIC -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC2
diff --git a/clang/test/Driver/prefixed-tools.c b/clang/test/Driver/prefixed-tools.c
new file mode 100644
index 0000000..d7c342a
--- /dev/null
+++ b/clang/test/Driver/prefixed-tools.c
@@ -0,0 +1,12 @@
+// RUN: %clang -### -B%S/Inputs/prefixed_tools_tree -o %t.o -no-integrated-as \
+// RUN: -target x86_64--linux %s 2>&1 | \
+// RUN: FileCheck --check-prefix=CHECK-M64 %s
+
+// RUN: %clang -### -B%S/Inputs/prefixed_tools_tree -o %t.o -no-integrated-as \
+// RUN: -m32 -target x86_64--linux %s 2>&1 | \
+// RUN: FileCheck --check-prefix=CHECK-M32 %s
+
+// CHECK-M64: "{{.*}}{{[/\\]}}prefixed_tools_tree{{[/\\]}}x86_64--linux-as"
+// CHECK-M64: "{{.*}}{{[/\\]}}prefixed_tools_tree{{[/\\]}}x86_64--linux-ld"
+// CHECK-M32: "{{.*}}{{[/\\]}}prefixed_tools_tree{{[/\\]}}x86_64--linux-as"
+// CHECK-M32: "{{.*}}{{[/\\]}}prefixed_tools_tree{{[/\\]}}x86_64--linux-ld"
diff --git a/clang/test/Driver/preprocessor.c b/clang/test/Driver/preprocessor.c
new file mode 100644
index 0000000..09c1f6c
--- /dev/null
+++ b/clang/test/Driver/preprocessor.c
@@ -0,0 +1,6 @@
+// RUN: %clang -E -x c-header %s > %t
+// RUN: grep 'B B' %t
+
+#define A B
+A A
+
diff --git a/clang/test/Driver/pth.c b/clang/test/Driver/pth.c
new file mode 100644
index 0000000..4350f46
--- /dev/null
+++ b/clang/test/Driver/pth.c
@@ -0,0 +1,12 @@
+// Test transparent PTH support.
+
+// RUN: %clang -no-canonical-prefixes -ccc-pch-is-pth -x c-header %s -o %t.h.pth -### 2> %t.log
+// RUN: FileCheck -check-prefix CHECK1 -input-file %t.log %s
+
+// CHECK1: "{{.*}}/clang{{.*}}" "-cc1" {{.*}} "-o" "{{.*}}.h.pth" "-x" "c-header" "{{.*}}pth.c"
+
+// RUN: touch %t.h.pth
+// RUN: %clang -no-canonical-prefixes -ccc-pch-is-pth -E -include %t.h %s -### 2> %t.log
+// RUN: FileCheck -check-prefix CHECK2 -input-file %t.log %s
+
+// CHECK2: "{{.*}}/clang{{.*}}" "-cc1" {{.*}}"-include-pth" "{{.*}}.h.pth" {{.*}}"-x" "c" "{{.*}}pth.c"
diff --git a/clang/test/Driver/qa_override.c b/clang/test/Driver/qa_override.c
new file mode 100644
index 0000000..5f96976
--- /dev/null
+++ b/clang/test/Driver/qa_override.c
@@ -0,0 +1,6 @@
+// RUN: env QA_OVERRIDE_GCC3_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a +b +c xb Xa Omagic ^-ccc-print-options " %clang x -O2 b -O3 2>&1 | FileCheck %s
+// CHECK-NOT: ###
+// CHECK: Option 0 - Name: "-ccc-print-options", Values: {}
+// CHECK-NEXT: Option 1 - Name: "<input>", Values: {"x"}
+// CHECK-NEXT: Option 2 - Name: "-O", Values: {"ignore"}
+// CHECK-NEXT: Option 3 - Name: "-O", Values: {"magic"}
diff --git a/clang/test/Driver/redundant-args.c b/clang/test/Driver/redundant-args.c
new file mode 100644
index 0000000..7bf98e1
--- /dev/null
+++ b/clang/test/Driver/redundant-args.c
@@ -0,0 +1,2 @@
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN: -Werror -x c -x c -fsyntax-only %s
diff --git a/clang/test/Driver/redzone.c b/clang/test/Driver/redzone.c
new file mode 100644
index 0000000..7d6d424
--- /dev/null
+++ b/clang/test/Driver/redzone.c
@@ -0,0 +1,6 @@
+// RUN: %clang -target i386-unknown-unknown -mno-red-zone %s -S -emit-llvm -o %t.log
+// RUN: grep 'noredzone' %t.log
+// RUN: %clang -target i386-unknown-unknown -mred-zone %s -S -emit-llvm -o %t.log
+// RUN: grep -v 'noredzone' %t.log
+
+int foo() { return 42; }
diff --git a/clang/test/Driver/rewrite-legacy-objc.m b/clang/test/Driver/rewrite-legacy-objc.m
new file mode 100644
index 0000000..af59ff6
--- /dev/null
+++ b/clang/test/Driver/rewrite-legacy-objc.m
@@ -0,0 +1,15 @@
+// RUN: %clang -no-canonical-prefixes -target x86_64-apple-macosx10.7.0 -rewrite-legacy-objc %s -o - -### 2>&1 | \
+// RUN: FileCheck -check-prefix=TEST0 %s
+// TEST0: clang{{.*}}" "-cc1"
+// TEST0: "-rewrite-objc"
+// FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency instead.
+// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime-has-arc" "-fobjc-runtime-has-weak" "-fobjc-fragile-abi" "-fobjc-default-synthesize-properties" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option"
+// TEST0: rewrite-legacy-objc.m"
+
+// RUN: not %clang -ccc-no-clang -target unknown -rewrite-legacy-objc %s -o - -### 2>&1 | \
+// RUN: FileCheck -check-prefix=TEST1 %s
+// TEST1: invalid output type 'rewritten-legacy-objc' for use with gcc
+
+// RUN: not %clang -ccc-no-clang -target i386-apple-darwin10 -rewrite-legacy-objc %s -o - -### 2>&1 | \
+// RUN: FileCheck -check-prefix=TEST2 %s
+// TEST2: invalid output type 'rewritten-legacy-objc' for use with gcc
diff --git a/clang/test/Driver/rewrite-objc.m b/clang/test/Driver/rewrite-objc.m
new file mode 100644
index 0000000..7b080fc
--- /dev/null
+++ b/clang/test/Driver/rewrite-objc.m
@@ -0,0 +1,15 @@
+// RUN: %clang -no-canonical-prefixes -target x86_64-apple-macosx10.7.0 -rewrite-objc %s -o - -### 2>&1 | \
+// RUN: FileCheck -check-prefix=TEST0 %s
+// TEST0: clang{{.*}}" "-cc1"
+// TEST0: "-rewrite-objc"
+// FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency instead.
+// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime-has-arc" "-fobjc-runtime-has-weak" "-fobjc-dispatch-method=mixed" "-fobjc-default-synthesize-properties" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option"
+// TEST0: rewrite-objc.m"
+
+// RUN: not %clang -ccc-no-clang -target unknown -rewrite-objc %s -o - -### 2>&1 | \
+// RUN: FileCheck -check-prefix=TEST1 %s
+// TEST1: invalid output type 'rewritten-objc' for use with gcc
+
+// RUN: not %clang -ccc-no-clang -target i386-apple-darwin10 -rewrite-objc %s -o - -### 2>&1 | \
+// RUN: FileCheck -check-prefix=TEST2 %s
+// TEST2: invalid output type 'rewritten-objc' for use with gcc
diff --git a/clang/test/Driver/stackrealign.c b/clang/test/Driver/stackrealign.c
new file mode 100644
index 0000000..c5221d6
--- /dev/null
+++ b/clang/test/Driver/stackrealign.c
@@ -0,0 +1,12 @@
+// RUN: %clang -### %s 2>&1 | FileCheck %s -check-prefix=NORMAL
+// NORMAL-NOT: -force-align-stack
+// NORMAL: -mstackrealign
+
+// RUN: %clang -### -mstackrealign %s 2>&1 | FileCheck %s -check-prefix=MREALIGN
+// MREALIGN: -force-align-stack
+// MREALIGN: -mstackrealign
+
+// RUN: %clang -### -mno-stackrealign %s 2>&1 | \
+// RUN: FileCheck %s -check-prefix=MNOREALIGN
+// MNOREALIGN-NOT: -force-align-stack
+// MNOREALIGN-NOT: -mstackrealign
diff --git a/clang/test/Driver/std.c b/clang/test/Driver/std.c
new file mode 100644
index 0000000..c82e9f1
--- /dev/null
+++ b/clang/test/Driver/std.c
@@ -0,0 +1,8 @@
+// RUN: %clang -std=c99 -trigraphs -std=gnu99 %s -E -o - | FileCheck -check-prefix=OVERRIDE %s
+// OVERRIDE: ??(??)
+// RUN: %clang -ansi %s -E -o - | FileCheck -check-prefix=ANSI %s
+// ANSI: []
+// RUN: %clang -std=gnu99 -trigraphs %s -E -o - | FileCheck -check-prefix=EXPLICIT %s
+// EXPLICIT: []
+
+??(??)
diff --git a/clang/test/Driver/std.cpp b/clang/test/Driver/std.cpp
new file mode 100644
index 0000000..7704c8d
--- /dev/null
+++ b/clang/test/Driver/std.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang -std=c++98 %s -Wno-c++0x-compat -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX98 %s
+// RUN: %clang -std=gnu++98 %s -Wno-c++0x-compat -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX98 %s
+// RUN: %clang -std=c++03 %s -Wno-c++0x-compat -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX98 %s
+// RUN: %clang -std=c++0x %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX11 %s
+// RUN: %clang -std=gnu++0x %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX11 %s
+// RUN: %clang -std=c++11 %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX11 %s
+// RUN: %clang -std=gnu++11 %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX11 %s
+
+void f(int n) {
+ typeof(n)();
+ decltype(n)();
+}
+
+// CXX98: undeclared identifier 'typeof'
+// CXX98: undeclared identifier 'decltype'
+
+// GNUXX98-NOT: undeclared identifier 'typeof'
+// GNUXX98: undeclared identifier 'decltype'
+
+// CXX11: undeclared identifier 'typeof'
+// CXX11-NOT: undeclared identifier 'decltype'
+
+// GNUXX11-NOT: undeclared identifier 'typeof'
+// GNUXX11-NOT: undeclared identifier 'decltype'
diff --git a/clang/test/Driver/sysroot-flags.c b/clang/test/Driver/sysroot-flags.c
new file mode 100644
index 0000000..b0a10bf
--- /dev/null
+++ b/clang/test/Driver/sysroot-flags.c
@@ -0,0 +1,28 @@
+// Check for proper handling of --sysroot and -isysroot flags.
+
+// RUN: %clang -### -fsyntax-only -isysroot /foo/bar %s 2>&1 | \
+// RUN: FileCheck %s -check-prefix=ISYSROOT
+// ISYSROOT: "-isysroot" "{{[^"]*}}/foo/bar"
+
+// Check that we get both isysroot for headers, and pass --sysroot on to GCC to
+// produce the final binary.
+// RUN: %clang -### -target x86_64-unknown-linux-gnu \
+// RUN: --sysroot=/foo/bar -o /dev/null %s 2>&1 | \
+// RUN: FileCheck %s -check-prefix=SYSROOT_EQ
+// SYSROOT_EQ: "-isysroot" "{{[^"]*}}/foo/bar"
+// SYSROOT_EQ: "--sysroot{{" "|=}}{{[^"]*}}/foo/bar"
+
+// Check for overriding the header sysroot by providing both --sysroot and
+// -isysroot.
+// RUN: %clang -### -target x86_64-unknown-linux-gnu -isysroot /baz \
+// RUN: --sysroot=/foo/bar -o /dev/null %s 2>&1 | FileCheck %s \
+// RUN: -check-prefix=ISYSROOT_AND_SYSROOT
+// ISYSROOT_AND_SYSROOT: "-isysroot" "{{[^"]*}}/baz"
+// ISYSROOT_AND_SYSROOT: "--sysroot{{" "|=}}{{[^"]*}}/foo/bar"
+
+// Check that omitting the equals works as well.
+// RUN: %clang -### -target x86_64-unknown-linux-gnu \
+// RUN: --sysroot /foo/bar -o /dev/null %s 2>&1 | \
+// RUN: FileCheck %s -check-prefix=SYSROOT_SEPARATE
+// SYSROOT_SEPARATE: "-isysroot" "{{[^"]*}}/foo/bar"
+// SYSROOT_SEPARATE: "--sysroot{{" "|=}}{{[^"]*}}/foo/bar"
diff --git a/clang/test/Driver/sysroot.c b/clang/test/Driver/sysroot.c
new file mode 100644
index 0000000..3080f76
--- /dev/null
+++ b/clang/test/Driver/sysroot.c
@@ -0,0 +1,18 @@
+// Check that --sysroot= also applies to header search paths.
+// RUN: %clang -target i386-unk-unk --sysroot=/FOO -### -E %s 2> %t1
+// RUN: FileCheck --check-prefix=CHECK-SYSROOTEQ < %t1 %s
+// CHECK-SYSROOTEQ: "-cc1"{{.*}} "-isysroot" "{{[^"]*}}/FOO"
+
+// Apple Darwin uses -isysroot as the syslib root, too.
+// RUN: touch %t2.o
+// RUN: %clang -target i386-apple-darwin10 \
+// RUN: -isysroot /FOO -### %t2.o 2> %t2
+// RUN: FileCheck --check-prefix=CHECK-APPLE-ISYSROOT < %t2 %s
+// CHECK-APPLE-ISYSROOT: "-arch" "i386"{{.*}} "-syslibroot" "{{[^"]*}}/FOO"
+
+// Check that honor --sysroot= over -isysroot, for Apple Darwin.
+// RUN: touch %t3.o
+// RUN: %clang -target i386-apple-darwin10 \
+// RUN: -isysroot /FOO --sysroot=/BAR -### %t3.o 2> %t3
+// RUN: FileCheck --check-prefix=CHECK-APPLE-SYSROOT < %t3 %s
+// CHECK-APPLE-SYSROOT: "-arch" "i386"{{.*}} "-syslibroot" "{{[^"]*}}/BAR"
diff --git a/clang/test/Driver/target.c b/clang/test/Driver/target.c
new file mode 100644
index 0000000..59147e0
--- /dev/null
+++ b/clang/test/Driver/target.c
@@ -0,0 +1,11 @@
+// RUN: %clang -no-canonical-prefixes -target unknown-unknown-unknown -c %s \
+// RUN: -o %t.o -### 2>&1 | FileCheck %s
+//
+// Ensure we get a crazy triple here as we asked for one.
+// CHECK: Target: unknown-unknown-unknown
+//
+// Also, ensure we don't blindly hand our target selection logic down to GCC.
+// CHECK: "{{.*gcc(\.[Ee][Xx][Ee])?}}"
+// CHECK-NOT: "-target"
+// CHECK-NOT: "unknown-unknown-unknown"
+// CHECK: "-x" "assembler"
diff --git a/clang/test/Driver/tsan.c b/clang/test/Driver/tsan.c
new file mode 100644
index 0000000..1dadb8e
--- /dev/null
+++ b/clang/test/Driver/tsan.c
@@ -0,0 +1,8 @@
+// RUN: %clang -target i386-unknown-unknown -fthread-sanitizer %s -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang -O1 -target i386-unknown-unknown -fthread-sanitizer %s -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang -O2 -target i386-unknown-unknown -fthread-sanitizer %s -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang -O3 -target i386-unknown-unknown -fthread-sanitizer %s -S -emit-llvm -o - | FileCheck %s
+// Verify that -fthread-sanitizer invokes tsan instrumentation.
+
+int foo(int *a) { return *a; }
+// CHECK: __tsan_init
diff --git a/clang/test/Driver/unknown-arg.c b/clang/test/Driver/unknown-arg.c
new file mode 100644
index 0000000..5d0f7af
--- /dev/null
+++ b/clang/test/Driver/unknown-arg.c
@@ -0,0 +1,4 @@
+// RUN: not %clang_cc1 %s -cake-is-lie 2> %t.log
+// RUN: FileCheck %s -input-file=%t.log
+
+// CHECK: unknown argument
diff --git a/clang/test/Driver/unknown-gcc-arch.c b/clang/test/Driver/unknown-gcc-arch.c
new file mode 100644
index 0000000..5e4746b
--- /dev/null
+++ b/clang/test/Driver/unknown-gcc-arch.c
@@ -0,0 +1,8 @@
+// RUN: %clang -target x86_64-unknown-unknown -c -x assembler %s -### 2> %t.log
+// RUN: grep '.*gcc.*"-m64"' %t.log
+// RUN: %clang -target x86_64-unknown-unknown -c -x assembler %s -### -m32 2> %t.log
+// RUN: grep '.*gcc.*"-m32"' %t.log
+// RUN: %clang -target i386-unknown-unknown -c -x assembler %s -### 2> %t.log
+// RUN: grep '.*gcc.*"-m32"' %t.log
+// RUN: %clang -target i386-unknown-unknown -c -x assembler %s -### -m64 2> %t.log
+// RUN: grep '.*gcc.*"-m64"' %t.log
diff --git a/clang/test/Driver/working-directory.c b/clang/test/Driver/working-directory.c
new file mode 100644
index 0000000..38a87a6
--- /dev/null
+++ b/clang/test/Driver/working-directory.c
@@ -0,0 +1,4 @@
+// RUN: %clang -ccc-print-options -working-directory "C:\Test" input 2>&1 | FileCheck %s
+// CHECK: Option 0 - Name: "-ccc-print-options", Values: {}
+// CHECK: Option 1 - Name: "-working-directory", Values: {"C:\Test"}
+// CHECK: Option 2 - Name: "<input>", Values: {"input"}
diff --git a/clang/test/Driver/x86_features.c b/clang/test/Driver/x86_features.c
new file mode 100644
index 0000000..5c65e31
--- /dev/null
+++ b/clang/test/Driver/x86_features.c
@@ -0,0 +1,3 @@
+// RUN: %clang -target i386-unknown-unknown -### -S %s -msse -msse4 -mno-sse -mno-mmx -msse 2> %t
+// RUN: grep '"pentium4" "-target-feature" "+sse4" "-target-feature" "-mmx" "-target-feature" "+sse"' %t
+// Note that we filter out all but the last -m(no)sse.