summaryrefslogtreecommitdiffstats
path: root/test/Parser
diff options
context:
space:
mode:
Diffstat (limited to 'test/Parser')
-rw-r--r--test/Parser/MicrosoftExtensions.c2
-rw-r--r--test/Parser/attributes.c1
-rw-r--r--test/Parser/cxx-attributes.cpp9
-rw-r--r--test/Parser/cxx-parse-member-pointer-op.cpp13
-rw-r--r--test/Parser/cxx-template-decl.cpp4
-rw-r--r--test/Parser/cxx-using-declaration.cpp5
-rw-r--r--test/Parser/cxx0x-attributes.cpp61
-rw-r--r--test/Parser/cxx0x-literal-operators.cpp5
-rw-r--r--test/Parser/if-scope-c90.c2
-rw-r--r--test/Parser/if-scope-c99.c2
10 files changed, 83 insertions, 21 deletions
diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c
index 572ac44..9c804c3 100644
--- a/test/Parser/MicrosoftExtensions.c
+++ b/test/Parser/MicrosoftExtensions.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify -fms-extensions -x=objective-c++ %s
+// RUN: clang-cc -fsyntax-only -verify -fms-extensions -x objective-c++ %s
__stdcall int func0();
int __stdcall func();
typedef int (__cdecl *tptr)();
diff --git a/test/Parser/attributes.c b/test/Parser/attributes.c
index dc2bb02..cad39d3 100644
--- a/test/Parser/attributes.c
+++ b/test/Parser/attributes.c
@@ -51,3 +51,4 @@ int foo42(void) {
// rdar://6096491
void __attribute__((noreturn)) d0(void), __attribute__((noreturn)) d1(void);
+void d2(void) __attribute__((noreturn)), d3(void) __attribute__((noreturn));
diff --git a/test/Parser/cxx-attributes.cpp b/test/Parser/cxx-attributes.cpp
new file mode 100644
index 0000000..743d9b9
--- /dev/null
+++ b/test/Parser/cxx-attributes.cpp
@@ -0,0 +1,9 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+class c {
+ virtual void f1(const char* a, ...)
+ __attribute__ (( __format__(__printf__,2,3) )) = 0;
+ virtual void f2(const char* a, ...)
+ __attribute__ (( __format__(__printf__,2,3) )) {}
+};
+
diff --git a/test/Parser/cxx-parse-member-pointer-op.cpp b/test/Parser/cxx-parse-member-pointer-op.cpp
deleted file mode 100644
index cc2e8b1..0000000
--- a/test/Parser/cxx-parse-member-pointer-op.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: clang-cc -fsyntax-only -pedantic -verify %s
-
-struct C {};
-
-typedef void (C::*pmfc)();
-
-void g(pmfc) {
- C *c;
- c->*pmfc(); // expected-error {{invalid use of pointer to member type after '->*'}}
- C c1;
- c1.*pmfc(); // expected-error {{invalid use of pointer to member type after '.*'}}
-}
-
diff --git a/test/Parser/cxx-template-decl.cpp b/test/Parser/cxx-template-decl.cpp
index 2b2d3de..644f0de 100644
--- a/test/Parser/cxx-template-decl.cpp
+++ b/test/Parser/cxx-template-decl.cpp
@@ -1,11 +1,11 @@
-// RUN: clang-cc -fsyntax-only -verify -fms-extensions=0 %s
+// RUN: clang-cc -fsyntax-only -verify %s
// Errors
export class foo { }; // expected-error {{expected template}}
template x; // expected-error {{C++ requires a type specifier for all declarations}} \
// expected-error {{does not refer}}
export template x; // expected-error {{expected '<' after 'template'}}
-export template<class T> class x0; // expected-note {{exported templates are unsupported}}
+export template<class T> class x0; // expected-warning {{exported templates are unsupported}}
template < ; // expected-error {{parse error}} expected-error {{declaration does not declare anything}}
template <template X> struct Err1; // expected-error {{expected '<' after 'template'}} \
// expected-error{{extraneous}}
diff --git a/test/Parser/cxx-using-declaration.cpp b/test/Parser/cxx-using-declaration.cpp
index a2bc8c5..461b9e5 100644
--- a/test/Parser/cxx-using-declaration.cpp
+++ b/test/Parser/cxx-using-declaration.cpp
@@ -1,4 +1,3 @@
-// FIXME: Disabled, appears to have undefined behavior, and needs to be updated to match new warnings.
// RUN: clang-cc -fsyntax-only -verify %s
// XFAIL: *
@@ -12,7 +11,7 @@ using A::VA;
using A::FA;
using typename A::SA;
-void main()
+int main()
{
VA = 1;
FA();
@@ -35,7 +34,7 @@ namespace E {
template <typename TYPE> int funcE(TYPE arg) { return(arg); }
}
-using E::funcE<int>; // expected-error{{use of template specialization in using directive not allowed}}
+using E::funcE<int>; // expected-error{{using declaration can not refer to a template specialization}}
namespace F {
struct X;
diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp
new file mode 100644
index 0000000..a66e3e0
--- /dev/null
+++ b/test/Parser/cxx0x-attributes.cpp
@@ -0,0 +1,61 @@
+// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+
+// Declaration syntax checks
+[[]] int before_attr;
+int after_attr [[]];
+int * [[]] ptr_attr;
+int array_attr [1] [[]];
+[[align(8)]] int aligned_attr;
+[[test::valid(for 42 [very] **** '+' symbols went on a trip; the end.)]]
+ int garbage_attr;
+void fn_attr () [[]];
+class [[]] class_attr {};
+extern "C++" [[]] int extern_attr;
+template <typename T> [[]] void template_attr ();
+
+int comma_attr [[,]]; // expected-error {{expected identifier}}
+int scope_attr [[foo::]]; // expected-error {{expected identifier}}
+int & [[]] ref_attr = after_attr; // expected-error {{an attribute list cannot appear here}}
+class foo {
+ void after_const_attr () const [[]]; // expected-error {{expected expression}}
+};
+extern "C++" [[]] { } // expected-error {{an attribute list cannot appear here}}
+[[]] template <typename T> void before_template_attr (); // expected-error {{an attribute list cannot appear here}}
+[[]] namespace ns { int i; } // expected-error {{an attribute list cannot appear here}}
+[[]] static_assert(true, ""); //expected-error {{an attribute list cannot appear here}}
+[[]] asm(""); // expected-error {{an attribute list cannot appear here}}
+
+[[]] using ns::i; // expected-error {{an attribute list cannot appear here}}
+[[]] using namespace ns;
+
+// Argument tests
+[[final()]] int final_params; // expected-error {{C++0x attribute 'final' cannot have an argument list}}
+[[align]] int aligned_no_params; // expected-error {{C++0x attribute 'align' must have an argument list}}
+[[align(i)]] int aligned_nonconst; // expected-error {{'aligned' attribute requires integer constant}}
+
+// Statement tests
+void foo () {
+ [[]] ;
+ [[]] { }
+ [[]] if (0) { }
+ [[]] for (;;);
+ [[]] do {
+ [[]] continue;
+ } while (0);
+ [[]] while (0);
+
+ [[]] switch (i) {
+ [[]] case 0:
+ [[]] default:
+ [[]] break;
+ }
+
+ [[]] goto there;
+ [[]] there:
+
+ [[]] try {
+ } [[]] catch (...) { // expected-error {{an attribute list cannot appear here}}
+ }
+
+ [[]] return;
+}
diff --git a/test/Parser/cxx0x-literal-operators.cpp b/test/Parser/cxx0x-literal-operators.cpp
new file mode 100644
index 0000000..c551460
--- /dev/null
+++ b/test/Parser/cxx0x-literal-operators.cpp
@@ -0,0 +1,5 @@
+// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s
+
+void operator "" (); // expected-error {{expected identifier}}
+void operator "k" foo(); // expected-error {{string literal after 'operator' must be '""'}}
+void operator "" tester (int);
diff --git a/test/Parser/if-scope-c90.c b/test/Parser/if-scope-c90.c
index 53987dc..c372f0f 100644
--- a/test/Parser/if-scope-c90.c
+++ b/test/Parser/if-scope-c90.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify --std=c90 %s
+// RUN: clang-cc -fsyntax-only -verify -std=c90 %s
int f (int z)
{
diff --git a/test/Parser/if-scope-c99.c b/test/Parser/if-scope-c99.c
index b4cb51c..0cb2495 100644
--- a/test/Parser/if-scope-c99.c
+++ b/test/Parser/if-scope-c99.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -fsyntax-only -verify --std=c99 %s
+// RUN: clang-cc -fsyntax-only -verify -std=c99 %s
int f (int z)
{
OpenPOWER on IntegriCloud