[llvm-branch-commits] [cfe-branch] r143944 - in /cfe/branches/release_30: ./ test/lit.cfg

Chandler Carruth chandlerc at gmail.com
Mon Nov 7 02:32:55 PST 2011


Author: chandlerc
Date: Mon Nov  7 04:32:55 2011
New Revision: 143944

URL: http://llvm.org/viewvc/llvm-project?rev=143944&view=rev
Log:
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.
------------------------------------------------------------------------

Modified:
    cfe/branches/release_30/   (props changed)
    cfe/branches/release_30/test/lit.cfg

Propchange: cfe/branches/release_30/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov  7 04:32:55 2011
@@ -1,3 +1,3 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:142113,142133-142134,142187,142349,142474,142476,142918,143344-143345,143684,143686-143687,143751-143752,143798,143801,143804-143807,143822-143823,143836,143838-143841
+/cfe/trunk:142113,142133-142134,142187,142349,142474,142476,142918,143344-143345,143684,143686-143687,143751-143752,143798,143801,143804-143807,143822-143823,143836,143838-143842
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_30/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/test/lit.cfg?rev=143944&r1=143943&r2=143944&view=diff
==============================================================================
--- cfe/branches/release_30/test/lit.cfg (original)
+++ cfe/branches/release_30/test/lit.cfg Mon Nov  7 04:32:55 2011
@@ -148,25 +148,19 @@
 # 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 '))





More information about the llvm-branch-commits mailing list