Index: test/libcxx/compiler.py
===================================================================
--- test/libcxx/compiler.py
+++ test/libcxx/compiler.py
@@ -1,9 +1,10 @@
-
import lit.util
+import libcxx.util
class CXXCompiler(object):
- def __init__(self, path, flags=[], compile_flags=[], link_flags=[], use_ccache=False):
+ def __init__(self, path, flags=[], compile_flags=[], link_flags=[],
+ use_ccache=False):
self.path = path
self.flags = list(flags)
self.compile_flags = list(compile_flags)
@@ -91,6 +92,29 @@
out, err, rc = lit.util.executeCommand(cmd, env=env, cwd=cwd)
return cmd, out, err, rc
+ def _compileLinkTwoSteps(self, source_file, object_file, out=None,
+ flags=[], env=None, cwd=None):
+ cmd, output, err, rc = self.compile(source_file, object_file,
+ flags=flags, env=env, cwd=cwd)
+ if rc != 0:
+ return cmd, output, err, rc
+ return self.link(object_file, out=out, flags=flags, env=env,
+ cwd=cwd)
+
+ def compileLinkTwoSteps(self, source_file, out=None, object_file=None,
+ flags=[], env=None, cwd=None):
+ if not isinstance(source_file, str):
+ raise TypeError('This function only accepts a single input file')
+ # Create, use and delete a temporary object file if none is given.
+ if object_file is None:
+ with libcxx.util.guardedTemporaryFile(suffix='.o') as object_file:
+ return self._compileLinkTwoSteps(source_file, object_file, out,
+ flags, env, cwd)
+ # Othewise compile using the given object file.
+ else:
+ return self._compileLinkTwoSteps(infile, object_file, out, flags,
+ env, cwd)
+
def dumpMacros(self, infiles=None, flags=[], env=None, cwd=None):
if infiles is None:
infiles = '/dev/null'
Index: test/libcxx/double_include.sh.cpp
===================================================================
--- /dev/null
+++ test/libcxx/double_include.sh.cpp
@@ -0,0 +1,111 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// Test that we can include each header in two TU's and link them together.
+
+// RUN: %cxx -c %s -o %t.first.o %flags %compile_flags
+// RUN: %cxx -c %s -o %t.second.o -DWITH_MAIN %flags %compile_flags
+// RUN: %cxx -o %t.exe %t.first.o %t.second.o %flags %link_flags
+// RUN: %run
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
use_lit_shell=<bool>
+
+Enable or disable the use of LIT's internal shell in ShTests. If the enviroment
+variable LIT_USE_INTERNAL_SHELL
is present then that is used as the
+default value. Otherwise the default value is True
on Windows and
+False
on every other platform.
+
+
+
+
no_default_flags=<bool>
Default: False