summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-11-07 10:20:16 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-11-07 10:20:16 +0000
commit1e38f1d0144dc0f65cf4c92c56e628fb51f1558d (patch)
tree9d2925b21a194ec28113aad0caaac3660cc01052
parent4fb21f4bd65bba90b370744f7b96cad9e1ce56fe (diff)
downloadllvm-1e38f1d0144dc0f65cf4c92c56e628fb51f1558d.tar.gz
Merging r143804:
------------------------------------------------------------------------ r143804 | chandlerc | 2011-11-05 03:15:27 -0700 (Sat, 05 Nov 2011) | 38 lines Teach Lit to pass the CC1 invocation the builtin include directory. This is a pretty gross hack, but I don't have any significantly cleaner ideas for this. There are several things obviously gross about it: 1) Lit shouldn't know that Clang needs this. This really that bad, as Lit already knows about CC1 and other internal details. 2) This hard codes the '3.0' version number, which is pretty lame. 3) This hard codes every other aspect of the resource dir structure which is less lame than the version number, but still not great. However, it should bring the MSVC tests back to life, and it should unblock the rest of the move from Frontend to Driver, so I think it's worth a bit of grossness that is isolated in our testing infrastructure while we figure out the best long term approach. I have the following ideas, some of which only solve part of the problem (and thus might need to be combined with other ideas): a) Create a symlink or other convenience path instead of a version number. b) Run 'clang' directly in the lit.cfg, look at its resource dir, and use that. c) Switch all the tests to use the driver instead of CC1. d) Hack the frontend to synthesize builtin include directories when none are provided by the driver. I don't like (d) because it feels very hackish and likely to break. We can only solve a small part of the problem with (a). I wanted to vote for (c), but lots of the tests in this bucket are really heavily using internal-only flags like -verify and -triple. I'm loath to complicate them with the full driver layer. Also, switching them to the driver adds more than just builtin headers, but all of the rest of the system headers! This leaves me with (b). If others like (b), I'll switch to it, but it felt a bit icky. Nothing concrete, and the other options look significantly worse, but I felt icky enough that I wanted to start with a more brain-dead patch to stop the bleeding, and gauge others' feelings here. ------------------------------------------------------------------------ llvm-svn: 143933
-rw-r--r--clang/test/lit.cfg12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/test/lit.cfg b/clang/test/lit.cfg
index 8062aa72c1f1..a7430db02338 100644
--- a/clang/test/lit.cfg
+++ b/clang/test/lit.cfg
@@ -141,7 +141,17 @@ if lit.useValgrind:
config.clang = inferClang(config.environment['PATH']).replace('\\', '/')
if not lit.quiet:
lit.note('using clang: %r' % config.clang)
-config.substitutions.append( ('%clang_cc1', config.clang + ' -cc1') )
+
+# Note that when substituting %clang_cc1 also fill in the include directory of
+# the builtin headers. Those are part of even a freestanding environment, but
+# Clang relies on the driver to locate them.
+# FIXME: It might be nice to teach the frontend how to find its builtin headers
+# in some limited cases when the driver provides no hints.
+clang_builtin_includes = os.path.join(llvm_libs_dir, 'clang', '3.0', 'include')
+config.substitutions.append( ('%clang_cc1',
+ '%s -cc1 -internal-nosysroot-isystem %s'
+ % (config.clang, clang_builtin_includes)) )
+
config.substitutions.append( ('%clangxx', ' ' + config.clang +
' -ccc-clang-cxx -ccc-cxx '))
config.substitutions.append( ('%clang', ' ' + config.clang + ' ') )