test: prevent incorrect quoting of paths

The path would previously get an extra leading space as the arguments
would be parsed when generating the final command to run.  Pretokenise
the arguments to permit proper quoting of the paths.  This avoids a
number of ignoring non-existent path warnings from clang.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@295511 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Saleem Abdulrasool
2017-02-17 23:08:46 +00:00
parent 29a8300460
commit 958d196f22

View File

@@ -229,21 +229,19 @@ class Configuration(object):
self.cxx.compile_env['CCACHE_CPP2'] = '1'
def _configure_clang_cl(self, clang_path):
def _split_env_var(var):
return [p.strip() for p in os.environ.get(var, '').split(';') if p.strip()]
def _prefixed_env_list(var, prefix):
from itertools import chain
return list(chain.from_iterable((prefix, path) for path in _split_env_var(var)))
assert self.cxx_is_clang_cl
flags = []
compile_flags = []
link_flags = []
if 'INCLUDE' in os.environ:
compile_flags += ['-isystem %s' % p.strip()
for p in os.environ['INCLUDE'].split(';')
if p.strip()]
if 'LIB' in os.environ:
for p in os.environ['LIB'].split(';'):
p = p.strip()
if not p:
continue
link_flags += ['-L%s' % p]
self.add_path(self.exec_env, p)
compile_flags = _prefixed_env_list('INCLUDE', '-isystem')
link_flags = _prefixed_env_list('LIB', '-L')
for path in _list_env_var('LIB'):
self.add_path(self.exec_env, path)
return CXXCompiler(clang_path, flags=flags,
compile_flags=compile_flags,
link_flags=link_flags)