aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-11-05 23:29:28 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-11-05 23:29:28 +0000
commitdf0a4c374b923f924d5ebcb008090928d408ea1c (patch)
treed75abb369643557e737c1b4fe6fb079541f220f2
parentcb2e00ff6570144efaf69a03f5d20b9e6fce4f7d (diff)
Switch Lit to directly query the driver for the builtin inclue path.
Thanks to Peter for pointing out how easy this is to do. I'm now much happier with this solution. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143842 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/lit.cfg22
1 files changed, 8 insertions, 14 deletions
diff --git a/test/lit.cfg b/test/lit.cfg
index f444b2fb92..2422ad0903 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -148,25 +148,19 @@ if not lit.quiet:
# 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.
-def getClangVersion(clang):
+def getClangBuiltinIncludeDir(clang):
# FIXME: Rather than just getting the version, we should have clang print
# out its resource dir here in an easy to scrape form.
- cmd = subprocess.Popen([clang, '-v'], stderr=subprocess.PIPE)
+ cmd = subprocess.Popen([clang, '-print-file-name=include'],
+ stdout=subprocess.PIPE)
+ if not cmd.stdout:
+ lit.fatal("Couldn't find the include dir for Clang ('%s')" % clang)
+ return cmd.stdout.read().strip()
- for line in cmd.stderr:
- m = re.match( r'^clang version ([^ ]+) ', line)
- if m is not None:
- return m.group(1)
-
- lit.fatal("Couldn't find the version of Clang ('%s')" % clang)
-
-clang_directory = os.path.dirname(os.path.realpath(config.clang))
-clang_builtin_includes = os.path.join(os.path.dirname(clang_directory),
- 'lib', 'clang',
- getClangVersion(config.clang), 'include')
config.substitutions.append( ('%clang_cc1',
'%s -cc1 -internal-nosysroot-isystem %s'
- % (config.clang, clang_builtin_includes)) )
+ % (config.clang,
+ getClangBuiltinIncludeDir(config.clang))) )
config.substitutions.append( ('%clangxx', ' ' + config.clang +
' -ccc-clang-cxx -ccc-cxx '))