aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Lexer/badstring_in_if0.c8
-rw-r--r--test/Lexer/block_cmt_end.c27
-rw-r--r--test/Lexer/escape_newline.c7
-rw-r--r--test/Lexer/number.c4
-rw-r--r--test/Lexer/unknown-char.c2
-rw-r--r--test/Makefile3
-rw-r--r--test/Parser/CompoundStmtScope.c8
-rw-r--r--test/Parser/argument_qualified.c5
-rw-r--r--test/Parser/argument_redef.c6
-rw-r--r--test/Parser/argument_scope.c6
-rw-r--r--test/Parser/attributes.c6
-rw-r--r--test/Parser/bad-control.c9
-rw-r--r--test/Parser/c-namespace.c6
-rw-r--r--test/Parser/cxx-bool.cpp4
-rw-r--r--test/Parser/cxx-casting.cpp32
-rw-r--r--test/Parser/cxx-reference.cpp17
-rw-r--r--test/Parser/declarators.c28
-rw-r--r--test/Parser/expressions.c30
-rw-r--r--test/Parser/function-decls.c10
-rw-r--r--test/Parser/portability.c5
-rw-r--r--test/Parser/recovery-1.c7
-rw-r--r--test/Parser/statements.c49
-rw-r--r--test/Parser/struct-recursion.c11
-rw-r--r--test/Parser/types.c6
-rw-r--r--test/Preprocessor/_Pragma-dependency.c7
-rw-r--r--test/Preprocessor/_Pragma-location.c4
-rw-r--r--test/Preprocessor/_Pragma-physloc.c6
-rw-r--r--test/Preprocessor/_Pragma-poison.c8
-rw-r--r--test/Preprocessor/_Pragma-syshdr.c4
-rw-r--r--test/Preprocessor/_Pragma-syshdr2.c5
-rw-r--r--test/Preprocessor/builtin_line.c4
-rw-r--r--test/Preprocessor/c99-6_10_3_3_p4.c6
-rw-r--r--test/Preprocessor/c99-6_10_3_4_p5.c29
-rw-r--r--test/Preprocessor/c99-6_10_3_4_p6.c24
-rw-r--r--test/Preprocessor/c99-6_10_3_4_p7.c9
-rw-r--r--test/Preprocessor/c99-6_10_3_4_p9.c16
-rw-r--r--test/Preprocessor/comment_save.c7
-rw-r--r--test/Preprocessor/comment_save_if.c6
-rw-r--r--test/Preprocessor/comment_save_macro.c8
-rw-r--r--test/Preprocessor/cxx_and.cpp17
-rw-r--r--test/Preprocessor/cxx_bitand.cpp16
-rw-r--r--test/Preprocessor/cxx_bitor.cpp18
-rw-r--r--test/Preprocessor/cxx_compl.cpp16
-rw-r--r--test/Preprocessor/cxx_not.cpp15
-rw-r--r--test/Preprocessor/cxx_not_eq.cpp16
-rw-r--r--test/Preprocessor/cxx_oper_keyword.cpp7
-rw-r--r--test/Preprocessor/cxx_oper_spelling.cpp11
-rw-r--r--test/Preprocessor/cxx_or.cpp17
-rw-r--r--test/Preprocessor/cxx_true.cpp13
-rw-r--r--test/Preprocessor/cxx_xor.cpp18
-rw-r--r--test/Preprocessor/define_other_target.c27
-rw-r--r--test/Preprocessor/define_target.c27
-rw-r--r--test/Preprocessor/disabled-cond-diags.c10
-rw-r--r--test/Preprocessor/expr_liveness.c32
-rw-r--r--test/Preprocessor/expr_usual_conversions.c8
-rw-r--r--test/Preprocessor/file_to_include.h3
-rw-r--r--test/Preprocessor/hash_line.c8
-rw-r--r--test/Preprocessor/hash_space.c6
-rw-r--r--test/Preprocessor/includeexpand.c12
-rw-r--r--test/Preprocessor/indent_macro.c6
-rw-r--r--test/Preprocessor/macro_arg_keyword.c6
-rw-r--r--test/Preprocessor/macro_defined.c6
-rw-r--r--test/Preprocessor/macro_disable.c13
-rw-r--r--test/Preprocessor/macro_disable2.c8
-rw-r--r--test/Preprocessor/macro_disable3.c8
-rw-r--r--test/Preprocessor/macro_expand.c7
-rw-r--r--test/Preprocessor/macro_expandloc.c6
-rw-r--r--test/Preprocessor/macro_expandloc2.c6
-rw-r--r--test/Preprocessor/macro_fn_comma_swallow.c16
-rw-r--r--test/Preprocessor/macro_fn_disable_expand.c11
-rw-r--r--test/Preprocessor/macro_fn_lparen_scan.c27
-rw-r--r--test/Preprocessor/macro_fn_lparen_scan2.c7
-rw-r--r--test/Preprocessor/macro_fn_placemarker.c5
-rw-r--r--test/Preprocessor/macro_fn_preexpand.c12
-rw-r--r--test/Preprocessor/macro_fn_varargs_iso.c11
-rw-r--r--test/Preprocessor/macro_fn_varargs_named.c7
-rw-r--r--test/Preprocessor/macro_not_define.c9
-rw-r--r--test/Preprocessor/macro_paste_bad.c5
-rw-r--r--test/Preprocessor/macro_paste_bcpl_comment.c5
-rw-r--r--test/Preprocessor/macro_paste_c_block_comment.c7
-rw-r--r--test/Preprocessor/macro_paste_empty.c13
-rw-r--r--test/Preprocessor/macro_paste_hard.c17
-rw-r--r--test/Preprocessor/macro_paste_hashhash.c7
-rw-r--r--test/Preprocessor/macro_paste_none.c6
-rw-r--r--test/Preprocessor/macro_paste_simple.c3
-rw-r--r--test/Preprocessor/macro_paste_spacing.c7
-rw-r--r--test/Preprocessor/macro_rescan.c9
-rw-r--r--test/Preprocessor/macro_rescan2.c15
-rw-r--r--test/Preprocessor/macro_rescan_varargs.c10
-rw-r--r--test/Preprocessor/macro_rparen_scan.c8
-rw-r--r--test/Preprocessor/macro_rparen_scan2.c8
-rw-r--r--test/Preprocessor/macro_space.c5
-rw-r--r--test/Preprocessor/output_paste_avoid.c12
-rw-r--r--test/Preprocessor/paste_bad.c17
-rw-r--r--test/Preprocessor/poison.c4
-rw-r--r--test/Preprocessor/poison_expansion.c9
-rw-r--r--test/Preprocessor/pragma_unknown.c6
-rw-r--r--test/Preprocessor/stringize_misc.c26
-rw-r--r--test/Preprocessor/stringize_space.c4
-rw-r--r--test/Sema/i-c-e1.c5
-rw-r--r--test/Sema/implicit-def.c8
-rw-r--r--test/Sema/unused-expr.c26
-rw-r--r--test/Sema/void_arg.c21
-rwxr-xr-xtest/TestRunner.sh50
104 files changed, 1220 insertions, 0 deletions
diff --git a/test/Lexer/badstring_in_if0.c b/test/Lexer/badstring_in_if0.c
new file mode 100644
index 0000000000..714f89b386
--- /dev/null
+++ b/test/Lexer/badstring_in_if0.c
@@ -0,0 +1,8 @@
+// RUN: clang -E %s 2>&1 | not grep error
+#if 0
+
+ "
+
+ '
+
+#endif
diff --git a/test/Lexer/block_cmt_end.c b/test/Lexer/block_cmt_end.c
new file mode 100644
index 0000000000..b111b2a23e
--- /dev/null
+++ b/test/Lexer/block_cmt_end.c
@@ -0,0 +1,27 @@
+/*
+ RUN: clang -E %s | grep bar &&
+ RUN: clang -E %s | grep foo &&
+ RUN: clang -E %s | not grep abc &&
+ RUN: clang -E %s | not grep xyz &&
+ RUN: clang -parse-ast-check %s
+ */
+
+/* abc
+
+next comment ends with normal escaped newline:
+*/
+
+/* expected-warning {{escaped newline}} expected-warning {{backslash and newline}} *\
+/
+
+bar
+
+/* xyz
+
+next comment ends with a trigraph escaped newline: */
+
+/* expected-warning {{escaped newline between}} expected-warning {{backslash and newline separated by space}} expected-warning {{trigraph ends block comment}} *??/
+/
+
+foo /* expected-error {{expected '=', ',', ';', 'asm', or '__attribute__' after declarator}} */
+
diff --git a/test/Lexer/escape_newline.c b/test/Lexer/escape_newline.c
new file mode 100644
index 0000000000..235ee51ef0
--- /dev/null
+++ b/test/Lexer/escape_newline.c
@@ -0,0 +1,7 @@
+// RUN: clang -E %s | grep -- ' ->' &&
+// RUN: clang -E %s 2>&1 | grep 'backslash and newline separated by space' &&
+// RUN: clang -E %s 2>&1 | grep 'trigraph converted'
+
+// This is an ugly way to spell a -> token.
+ -??/
+>
diff --git a/test/Lexer/number.c b/test/Lexer/number.c
new file mode 100644
index 0000000000..4e12cc7edc
--- /dev/null
+++ b/test/Lexer/number.c
@@ -0,0 +1,4 @@
+// RUN: clang %s -fsyntax-only
+
+float X = 1.17549435e-38F;
+
diff --git a/test/Lexer/unknown-char.c b/test/Lexer/unknown-char.c
new file mode 100644
index 0000000000..8bdfe60553
--- /dev/null
+++ b/test/Lexer/unknown-char.c
@@ -0,0 +1,2 @@
+// RUN: clang -E %s 2>&1 | not grep error
+ ` ` ` `
diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 0000000000..2c35b4421e
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,3 @@
+
+all:
+ find Lexer Preprocessor Parser -name '*.c*' -print -exec ./TestRunner.sh {} \;
diff --git a/test/Parser/CompoundStmtScope.c b/test/Parser/CompoundStmtScope.c
new file mode 100644
index 0000000000..d6a4730632
--- /dev/null
+++ b/test/Parser/CompoundStmtScope.c
@@ -0,0 +1,8 @@
+// RUN: clang -parse-ast-check %s
+
+int foo() {
+ {
+ typedef float X;
+ }
+ X Y; // expected-error {{use of undeclared identifier}}
+}
diff --git a/test/Parser/argument_qualified.c b/test/Parser/argument_qualified.c
new file mode 100644
index 0000000000..cd92c3258c
--- /dev/null
+++ b/test/Parser/argument_qualified.c
@@ -0,0 +1,5 @@
+// RUN: clang %s
+int abc (const float x) {
+ return 1;
+}
+
diff --git a/test/Parser/argument_redef.c b/test/Parser/argument_redef.c
new file mode 100644
index 0000000000..c3dae512a3
--- /dev/null
+++ b/test/Parser/argument_redef.c
@@ -0,0 +1,6 @@
+/* RUN: clang -parse-ast-check %s
+*/
+
+int foo(int A) { /* expected-error {{previous definition is here}} */
+ int A; /* expected-error {{redefinition of 'A'}} */
+}
diff --git a/test/Parser/argument_scope.c b/test/Parser/argument_scope.c
new file mode 100644
index 0000000000..8b9f065c82
--- /dev/null
+++ b/test/Parser/argument_scope.c
@@ -0,0 +1,6 @@
+// RUN: clang -fsyntax-only %s
+typedef struct foo foo;
+
+void blah(int foo) {
+ foo = 1;
+}
diff --git a/test/Parser/attributes.c b/test/Parser/attributes.c
new file mode 100644
index 0000000000..29e8c81f3b
--- /dev/null
+++ b/test/Parser/attributes.c
@@ -0,0 +1,6 @@
+// RUN: clang -parse-ast-check %s
+
+static __inline void __attribute__((__always_inline__, __nodebug__)) // expected-warning {{extension used}}
+foo (void)
+{
+}
diff --git a/test/Parser/bad-control.c b/test/Parser/bad-control.c
new file mode 100644
index 0000000000..914393461a
--- /dev/null
+++ b/test/Parser/bad-control.c
@@ -0,0 +1,9 @@
+/* RUN: clang -parse-ast-check %s
+*/
+int foo() {
+ break; /* expected-error {{'break' statement not in loop or switch statement}} */
+}
+
+int foo2() {
+ continue; /* expected-error {{'continue' statement not in loop statement}} */
+}
diff --git a/test/Parser/c-namespace.c b/test/Parser/c-namespace.c
new file mode 100644
index 0000000000..2b380503ac
--- /dev/null
+++ b/test/Parser/c-namespace.c
@@ -0,0 +1,6 @@
+// RUN: clang -fsyntax-only %s
+void bla1() {
+ struct XXX;
+ int XXX;
+}
+
diff --git a/test/Parser/cxx-bool.cpp b/test/Parser/cxx-bool.cpp
new file mode 100644
index 0000000000..623dcb2887
--- /dev/null
+++ b/test/Parser/cxx-bool.cpp
@@ -0,0 +1,4 @@
+// RUN: clang -fsyntax-only %s
+
+bool a = true;
+bool b = false;
diff --git a/test/Parser/cxx-casting.cpp b/test/Parser/cxx-casting.cpp
new file mode 100644
index 0000000000..638985faf7
--- /dev/null
+++ b/test/Parser/cxx-casting.cpp
@@ -0,0 +1,32 @@
+// RUN: clang -fsyntax-only %s
+// XFAIL: *
+
+char *const_cast_test(const char *var)
+{
+ return const_cast<char*>(var);
+}
+
+#if 0
+// FIXME: Uncomment when C++ is supported more.
+struct A {
+ virtual ~A() {}
+};
+
+struct B : public A {
+};
+
+struct B *dynamic_cast_test(struct A *a)
+{
+ return dynamic_cast<struct B*>(a);
+}
+#endif
+
+char *reinterpret_cast_test()
+{
+ return reinterpret_cast<char*>(0xdeadbeef);
+}
+
+double static_cast_test(int i)
+{
+ return static_cast<double>(i);
+}
diff --git a/test/Parser/cxx-reference.cpp b/test/Parser/cxx-reference.cpp
new file mode 100644
index 0000000000..44a2a03c9c
--- /dev/null
+++ b/test/Parser/cxx-reference.cpp
@@ -0,0 +1,17 @@
+// RUN: clang -parse-ast-check %s
+
+extern char *bork;
+char *& bar = bork;
+
+void foo(int &a) {
+}
+
+typedef int & A;
+
+void g(const A aref) {
+}
+
+int & const X; // expected-error {{'const' qualifier may not be applied to a reference}}
+int & volatile Y; // expected-error {{'volatile' qualifier may not be applied to a reference}}
+int & const volatile Z; /* expected-error {{'const' qualifier may not be applied}} \
+ expected-error {{'volatile' qualifier may not be applied}} */
diff --git a/test/Parser/declarators.c b/test/Parser/declarators.c
new file mode 100644
index 0000000000..af599f82fe
--- /dev/null
+++ b/test/Parser/declarators.c
@@ -0,0 +1,28 @@
+// RUN: clang %s -fsyntax-only
+
+extern int a1[];
+
+void f0();
+void f1(int [*]);
+void f2(int [const *]);
+void f3(int [volatile const*]);
+int f4(*XX)(void);
+
+char ((((*X))));
+
+void (*signal(int, void (*)(int)))(int);