[libcxx-commits] [libcxx] 339156a - [libc++] Avoid passing -xc++ in Lit feature detection

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 5 10:41:56 PDT 2020


Author: Louis Dionne
Date: 2020-06-05T13:41:48-04:00
New Revision: 339156ad63c4c876432a3109b4d4a67a9602836b

URL: https://github.com/llvm/llvm-project/commit/339156ad63c4c876432a3109b4d4a67a9602836b
DIFF: https://github.com/llvm/llvm-project/commit/339156ad63c4c876432a3109b4d4a67a9602836b.diff

LOG: [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.

Added: 
    

Modified: 
    libcxx/utils/libcxx/test/dsl.py

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/libcxx/test/dsl.py b/libcxx/utils/libcxx/test/dsl.py
index 0e21256a2de0..59329debecf8 100644
--- a/libcxx/utils/libcxx/test/dsl.py
+++ b/libcxx/utils/libcxx/test/dsl.py
@@ -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'])


        


More information about the libcxx-commits mailing list