Add tests for tblgen's LLVMC backend.
authorMikhail Glushenkov <foldr@codedgers.com>
Sun, 7 Dec 2008 16:41:50 +0000 (16:41 +0000)
committerMikhail Glushenkov <foldr@codedgers.com>
Sun, 7 Dec 2008 16:41:50 +0000 (16:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60657 91177308-0d34-0410-b5e6-96231b3b80d8

test/LLVMC/EmptyCompilationGraph.td [new file with mode: 0644]
test/LLVMC/ExternOptions.td [new file with mode: 0644]
test/LLVMC/MultipleCompilationGraphs.td [new file with mode: 0644]
test/LLVMC/NoActions.td [new file with mode: 0644]
test/LLVMC/NoCompilationGraph.td [new file with mode: 0644]
test/LLVMC/TestWarnings.td [new file with mode: 0644]
test/LLVMC/llvmc.exp

diff --git a/test/LLVMC/EmptyCompilationGraph.td b/test/LLVMC/EmptyCompilationGraph.td
new file mode 100644 (file)
index 0000000..f4a3047
--- /dev/null
@@ -0,0 +1,6 @@
+// Check that the compilation graph can be empty.
+// RUN: tblgen -I $srcroot/include --gen-llvmc %s
+
+include "llvm/CompilerDriver/Common.td"
+
+def Graph : CompilationGraph<[]>;
diff --git a/test/LLVMC/ExternOptions.td b/test/LLVMC/ExternOptions.td
new file mode 100644 (file)
index 0000000..d38675c
--- /dev/null
@@ -0,0 +1,20 @@
+// Check that extern options work.
+// The dummy tool and graph are required to silence warnings.
+// RUN: tblgen -I $srcroot/include --gen-llvmc %s | grep extern
+
+include "llvm/CompilerDriver/Common.td"
+
+def OptList : OptionList<[(extern_switch "Wall"),
+    (extern_parameter "std"), (extern_list "L")]>;
+
+def dummy_tool : Tool<[
+(cmd_line "dummy_cmd"),
+(in_language "dummy"),
+(out_language "dummy"),
+(actions (case
+         (switch_on "Wall"), (stop_compilation),
+         (not_empty "std"), (stop_compilation),
+         (not_empty "L"), (stop_compilation)))
+]>;
+
+def DummyGraph : CompilationGraph<[SimpleEdge<"root", "dummy_tool">]>;
diff --git a/test/LLVMC/MultipleCompilationGraphs.td b/test/LLVMC/MultipleCompilationGraphs.td
new file mode 100644 (file)
index 0000000..3305fc6
--- /dev/null
@@ -0,0 +1,8 @@
+// Check that multiple compilation graphs are allowed.
+// RUN: tblgen -I $srcroot/include --gen-llvmc %s
+
+include "llvm/CompilerDriver/Common.td"
+
+def Graph1 : CompilationGraph<[]>;
+def Graph2 : CompilationGraph<[]>;
+def Graph3 : CompilationGraph<[]>;
diff --git a/test/LLVMC/NoActions.td b/test/LLVMC/NoActions.td
new file mode 100644 (file)
index 0000000..43fd007
--- /dev/null
@@ -0,0 +1,12 @@
+// Check that tools without associated actions are accepted.
+// RUN: tblgen -I $srcroot/include --gen-llvmc %s | grep dummy_tool
+
+include "llvm/CompilerDriver/Common.td"
+
+def dummy_tool : Tool<[
+(cmd_line "dummy_cmd"),
+(in_language "dummy"),
+(out_language "dummy")
+]>;
+
+def DummyGraph : CompilationGraph<[SimpleEdge<"root", "dummy_tool">]>;
diff --git a/test/LLVMC/NoCompilationGraph.td b/test/LLVMC/NoCompilationGraph.td
new file mode 100644 (file)
index 0000000..6476a37
--- /dev/null
@@ -0,0 +1,4 @@
+// Check that the compilation graph is not required.
+// RUN: tblgen -I $srcroot/include --gen-llvmc %s
+
+include "llvm/CompilerDriver/Common.td"
diff --git a/test/LLVMC/TestWarnings.td b/test/LLVMC/TestWarnings.td
new file mode 100644 (file)
index 0000000..5010c61
--- /dev/null
@@ -0,0 +1,8 @@
+// Check that the compiler warns about unused options!.
+// RUN: tblgen -I $srcroot/include --gen-llvmc %s | grep extern
+// XFAIL: *
+
+include "llvm/CompilerDriver/Common.td"
+
+def OptList : OptionList<[(extern_switch "Wall"),
+    (extern_parameter "std"), (extern_list "L")]>;
index a2e44b99859fd2f7450a7b3c7a5ff7c860101b29..8354097ed8e88cf2df56ef2ca5b5ca77432d1d48 100644 (file)
@@ -8,3 +8,4 @@ if [ llvm_gcc_supports c++ ] then {
   RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{cpp}]]
 }
 
+RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{td}]]