diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-11-07 10:32:55 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-11-07 10:32:55 +0000 |
commit | ae95127c7eff62d0985b537fdb92353ee8213f02 (patch) | |
tree | 509b72ff6b82da21c9b444a914f2eebd3a836920 | |
parent | c1c82eee944297a0b749f1caf9d7361d782c5b38 (diff) | |
download | llvm-ae95127c7eff62d0985b537fdb92353ee8213f02.zip llvm-ae95127c7eff62d0985b537fdb92353ee8213f02.tar.gz llvm-ae95127c7eff62d0985b537fdb92353ee8213f02.tar.bz2 |
Merging r143842:
------------------------------------------------------------------------
r143842 | chandlerc | 2011-11-05 16:29:28 -0700 (Sat, 05 Nov 2011) | 3 lines
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.
------------------------------------------------------------------------
llvm-svn: 143944
-rw-r--r-- | clang/test/lit.cfg | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/clang/test/lit.cfg b/clang/test/lit.cfg index f444b2f..2422ad0 100644 --- a/clang/test/lit.cfg +++ b/clang/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 ')) |