summaryrefslogtreecommitdiffstats
path: root/test/LLVMC/C++
diff options
context:
space:
mode:
Diffstat (limited to 'test/LLVMC/C++')
-rw-r--r--test/LLVMC/C++/dash-x.cpp9
-rw-r--r--test/LLVMC/C++/dg.exp5
-rw-r--r--test/LLVMC/C++/hello.cpp8
-rw-r--r--test/LLVMC/C++/together.cpp9
4 files changed, 31 insertions, 0 deletions
diff --git a/test/LLVMC/C++/dash-x.cpp b/test/LLVMC/C++/dash-x.cpp
new file mode 100644
index 0000000..b32400e
--- /dev/null
+++ b/test/LLVMC/C++/dash-x.cpp
@@ -0,0 +1,9 @@
+// Test that we can compile .c files as C++ and vice versa
+// RUN: llvmc %s -x c++ %p/../test_data/false.c -x c %p/../test_data/false.cpp -x lisp -x whatnot -x none %p/../test_data/false2.cpp -o %t
+// RUN: %abs_tmp | grep hello
+
+extern int test_main();
+
+int main() {
+ test_main();
+}
diff --git a/test/LLVMC/C++/dg.exp b/test/LLVMC/C++/dg.exp
new file mode 100644
index 0000000..fc852e3
--- /dev/null
+++ b/test/LLVMC/C++/dg.exp
@@ -0,0 +1,5 @@
+load_lib llvm.exp
+
+if [ llvm_gcc_supports c++ ] then {
+ RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
+}
diff --git a/test/LLVMC/C++/hello.cpp b/test/LLVMC/C++/hello.cpp
new file mode 100644
index 0000000..b9c6399
--- /dev/null
+++ b/test/LLVMC/C++/hello.cpp
@@ -0,0 +1,8 @@
+// Test that we can compile C++ code.
+// RUN: llvmc %s -o %t
+// RUN: %abs_tmp | grep hello
+#include <iostream>
+
+int main() {
+ std::cout << "hello" << '\n';
+}
diff --git a/test/LLVMC/C++/together.cpp b/test/LLVMC/C++/together.cpp
new file mode 100644
index 0000000..e02f69a
--- /dev/null
+++ b/test/LLVMC/C++/together.cpp
@@ -0,0 +1,9 @@
+// Check that we can compile files of different types together.
+// RUN: llvmc %s %p/../test_data/together.c -o %t
+// RUN: %abs_tmp | grep hello
+
+extern "C" void test();
+
+int main() {
+ test();
+}
OpenPOWER on IntegriCloud