[libc++] Avoid passing -xc++ in Lit feature detection

Otherwise, if %{flags} contain other files like static libraries, those
files are treated as C++ source files instead of object files, and the
compiler gets all confused.
This commit is contained in:
Louis Dionne 2020-06-05 13:39:49 -04:00
parent e73bb45c2b
commit 339156ad63
1 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ def _makeConfigTest(config):
suite = lit.Test.TestSuite('__config__', sourceRoot, execRoot, config)
if not os.path.exists(sourceRoot):
os.makedirs(sourceRoot)
tmp = tempfile.NamedTemporaryFile(dir=sourceRoot, delete=False)
tmp = tempfile.NamedTemporaryFile(dir=sourceRoot, delete=False, suffix='.cpp')
tmp.close()
pathInSuite = [os.path.relpath(tmp.name, sourceRoot)]
class TestWrapper(lit.Test.Test):
@ -68,7 +68,7 @@ def sourceBuilds(config, source):
sourceFile.write(source)
commands = [
"mkdir -p %T",
"%{cxx} -xc++ %s %{flags} %{compile_flags} %{link_flags} -o %t.exe"
"%{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe"
]
commands = libcxx.test.newformat.parseScript(test, preamble=commands, fileDependencies=['%t.exe'])
out, err, exitCode, timeoutInfo = _executeScriptInternal(test, commands)
@ -108,7 +108,7 @@ def hasLocale(config, locale):
""")
commands = [
"mkdir -p %T",
"%{cxx} -xc++ %s %{flags} %{compile_flags} %{link_flags} -o %t.exe",
"%{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe",
"%{{exec}} %t.exe {}".format(pipes.quote(locale)),
]
commands = libcxx.test.newformat.parseScript(test, preamble=commands, fileDependencies=['%t.exe'])