summaryrefslogtreecommitdiff
path: root/clang/test/Parser
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
committerCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
commitbe1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch)
tree1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/Parser
parentc4626a62754862d20b41e8a46a3574264ea80e6d (diff)
parentf1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff)
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/Parser')
-rw-r--r--clang/test/Parser/CompoundStmtScope.c8
-rw-r--r--clang/test/Parser/DelayedTemplateParsing.cpp92
-rw-r--r--clang/test/Parser/MicrosoftExtensions.c77
-rw-r--r--clang/test/Parser/MicrosoftExtensions.cpp311
-rw-r--r--clang/test/Parser/PR11000.cpp9
-rw-r--r--clang/test/Parser/access-spec-attrs.cpp12
-rw-r--r--clang/test/Parser/altivec.c121
-rw-r--r--clang/test/Parser/argument_qualified.c5
-rw-r--r--clang/test/Parser/argument_redef.c6
-rw-r--r--clang/test/Parser/argument_scope.c6
-rw-r--r--clang/test/Parser/asm-constraints-pr7869.c45
-rw-r--r--clang/test/Parser/asm.c19
-rw-r--r--clang/test/Parser/asm.cpp8
-rw-r--r--clang/test/Parser/attr-availability.c28
-rw-r--r--clang/test/Parser/attributes.c98
-rw-r--r--clang/test/Parser/backtrack-crash.cpp4
-rw-r--r--clang/test/Parser/bad-control.c9
-rw-r--r--clang/test/Parser/block-block-storageclass.c17
-rw-r--r--clang/test/Parser/block-pointer-decl.c28
-rw-r--r--clang/test/Parser/bracket-crash.cpp6
-rw-r--r--clang/test/Parser/builtin_classify_type.c21
-rw-r--r--clang/test/Parser/builtin_types_compatible.c43
-rw-r--r--clang/test/Parser/c-namespace.c6
-rw-r--r--clang/test/Parser/c1x-alignas.c7
-rw-r--r--clang/test/Parser/c1x-generic-selection.c10
-rw-r--r--clang/test/Parser/char-literal-printing.c67
-rw-r--r--clang/test/Parser/check-objc2-syntax-1.m10
-rw-r--r--clang/test/Parser/check-syntax-1.m19
-rw-r--r--clang/test/Parser/check_cast.c12
-rw-r--r--clang/test/Parser/compound_literal.c5
-rw-r--r--clang/test/Parser/control-scope.c8
-rw-r--r--clang/test/Parser/cuda-kernel-call.cu9
-rw-r--r--clang/test/Parser/cxx-altivec.cpp170
-rw-r--r--clang/test/Parser/cxx-ambig-decl-expr-xfail.cpp16
-rw-r--r--clang/test/Parser/cxx-ambig-decl-expr.cpp10
-rw-r--r--clang/test/Parser/cxx-ambig-paren-expr.cpp66
-rw-r--r--clang/test/Parser/cxx-attributes.cpp9
-rw-r--r--clang/test/Parser/cxx-bool.cpp4
-rw-r--r--clang/test/Parser/cxx-casting.cpp92
-rw-r--r--clang/test/Parser/cxx-class.cpp89
-rw-r--r--clang/test/Parser/cxx-condition.cpp15
-rw-r--r--clang/test/Parser/cxx-decl.cpp129
-rw-r--r--clang/test/Parser/cxx-default-args.cpp16
-rw-r--r--clang/test/Parser/cxx-default-delete.cpp23
-rw-r--r--clang/test/Parser/cxx-ext-delete-default.cpp11
-rw-r--r--clang/test/Parser/cxx-extern-c-array.cpp7
-rw-r--r--clang/test/Parser/cxx-friend.cpp40
-rw-r--r--clang/test/Parser/cxx-in-c.c5
-rw-r--r--clang/test/Parser/cxx-member-crash.cpp15
-rw-r--r--clang/test/Parser/cxx-member-init-missing-paren-crash.cpp12
-rw-r--r--clang/test/Parser/cxx-member-initializers.cpp15
-rw-r--r--clang/test/Parser/cxx-namespace-alias.cpp9
-rw-r--r--clang/test/Parser/cxx-reference.cpp21
-rw-r--r--clang/test/Parser/cxx-stmt.cpp60
-rw-r--r--clang/test/Parser/cxx-template-argument.cpp12
-rw-r--r--clang/test/Parser/cxx-template-decl.cpp115
-rw-r--r--clang/test/Parser/cxx-throw.cpp15
-rw-r--r--clang/test/Parser/cxx-typeid.cpp13
-rw-r--r--clang/test/Parser/cxx-typeof.cpp13
-rw-r--r--clang/test/Parser/cxx-undeclared-identifier.cpp9
-rw-r--r--clang/test/Parser/cxx-using-declaration.cpp45
-rw-r--r--clang/test/Parser/cxx-using-directive.cpp38
-rw-r--r--clang/test/Parser/cxx-variadic-func.cpp5
-rw-r--r--clang/test/Parser/cxx0x-ambig.cpp127
-rw-r--r--clang/test/Parser/cxx0x-attributes.cpp83
-rw-r--r--clang/test/Parser/cxx0x-condition.cpp37
-rw-r--r--clang/test/Parser/cxx0x-decl.cpp18
-rw-r--r--clang/test/Parser/cxx0x-for-range.cpp30
-rw-r--r--clang/test/Parser/cxx0x-in-cxx98.cpp23
-rw-r--r--clang/test/Parser/cxx0x-lambda-expressions.cpp43
-rw-r--r--clang/test/Parser/cxx0x-literal-operators.cpp8
-rw-r--r--clang/test/Parser/cxx0x-member-initializers.cpp29
-rw-r--r--clang/test/Parser/cxx0x-override-control-keywords.cpp25
-rw-r--r--clang/test/Parser/cxx0x-rvalue-reference.cpp9
-rw-r--r--clang/test/Parser/cxx11-stmt-attributes.cpp54
-rw-r--r--clang/test/Parser/cxx11-type-specifier.cpp20
-rw-r--r--clang/test/Parser/cxx11-user-defined-literals.cpp112
-rw-r--r--clang/test/Parser/declarators.c102
-rw-r--r--clang/test/Parser/designator.c17
-rw-r--r--clang/test/Parser/encode.m8
-rw-r--r--clang/test/Parser/enhanced-proto-1.m17
-rw-r--r--clang/test/Parser/expressions.c59
-rw-r--r--clang/test/Parser/expressions.m6
-rw-r--r--clang/test/Parser/extension.c20
-rw-r--r--clang/test/Parser/for.cpp20
-rw-r--r--clang/test/Parser/function-decls.c10
-rw-r--r--clang/test/Parser/goto.c30
-rw-r--r--clang/test/Parser/if-scope-c90.c8
-rw-r--r--clang/test/Parser/if-scope-c99.c8
-rw-r--r--clang/test/Parser/implicit-casts.c21
-rw-r--r--clang/test/Parser/knr_parameter_attributes.c11
-rw-r--r--clang/test/Parser/method-def-in-class.m14
-rw-r--r--clang/test/Parser/method-prototype-1.m43
-rw-r--r--clang/test/Parser/missing-end-2.m19
-rw-r--r--clang/test/Parser/missing-end-3.m10
-rw-r--r--clang/test/Parser/missing-end-4.m51
-rw-r--r--clang/test/Parser/missing-end.m7
-rw-r--r--clang/test/Parser/ms-inline-asm.c25
-rw-r--r--clang/test/Parser/namelookup-bug-1.c7
-rw-r--r--clang/test/Parser/namelookup-bug-2.c14
-rw-r--r--clang/test/Parser/namespace-alias-attr.cpp8
-rw-r--r--clang/test/Parser/namespaces.cpp8
-rw-r--r--clang/test/Parser/nested-namespaces-recovery.cpp24
-rw-r--r--clang/test/Parser/objc-alias-printing.m18
-rw-r--r--clang/test/Parser/objc-category-neg-1.m8
-rw-r--r--clang/test/Parser/objc-forcollection-1.m43
-rw-r--r--clang/test/Parser/objc-forcollection-neg-2.m38
-rw-r--r--clang/test/Parser/objc-forcollection-neg.m38
-rw-r--r--clang/test/Parser/objc-foreach-syntax.m25
-rw-r--r--clang/test/Parser/objc-init.m60
-rw-r--r--clang/test/Parser/objc-interfaces.m8
-rw-r--r--clang/test/Parser/objc-messaging-1.m26
-rw-r--r--clang/test/Parser/objc-messaging-neg-1.m13
-rw-r--r--clang/test/Parser/objc-missing-impl.m2
-rw-r--r--clang/test/Parser/objc-property-syntax.m17
-rw-r--r--clang/test/Parser/objc-quirks.m32
-rw-r--r--clang/test/Parser/objc-synthesized-recover.m15
-rw-r--r--clang/test/Parser/objc-try-catch-1.m70
-rw-r--r--clang/test/Parser/objc-type-printing.m19
-rw-r--r--clang/test/Parser/objcxx-at.mm15
-rw-r--r--clang/test/Parser/objcxx-lambda-expressions-neg.mm5
-rw-r--r--clang/test/Parser/objcxx0x-lambda-expressions.mm23
-rw-r--r--clang/test/Parser/objcxx11-attributes.mm57
-rw-r--r--clang/test/Parser/objcxx11-user-defined-literal.mm3
-rw-r--r--clang/test/Parser/offsetof.c7
-rw-r--r--clang/test/Parser/opencl-astype.cl20
-rw-r--r--clang/test/Parser/opencl-image-access.cl16
-rw-r--r--clang/test/Parser/opencl-kernel.cl9
-rw-r--r--clang/test/Parser/opencl-pragma.cl15
-rw-r--r--clang/test/Parser/opencl-storage-class.cl15
-rw-r--r--clang/test/Parser/parenthesis-balance.cpp15
-rw-r--r--clang/test/Parser/parmvardecl_conversion.c4
-rw-r--r--clang/test/Parser/parser_overflow.c7
-rw-r--r--clang/test/Parser/placeholder-recovery.m12
-rw-r--r--clang/test/Parser/pointer-arithmetic.c9
-rw-r--r--clang/test/Parser/pointer_promotion.c17
-rw-r--r--clang/test/Parser/pragma-options.c22
-rw-r--r--clang/test/Parser/pragma-pack.c32
-rw-r--r--clang/test/Parser/pragma-visibility.c9
-rw-r--r--clang/test/Parser/pragma-visibility2.c19
-rw-r--r--clang/test/Parser/pragma-weak.c17
-rw-r--r--clang/test/Parser/prefix-attributes.m8
-rw-r--r--clang/test/Parser/promote_types_in_proto.c9
-rw-r--r--clang/test/Parser/recovery.c100
-rw-r--r--clang/test/Parser/recovery.cpp42
-rw-r--r--clang/test/Parser/recovery.m5
-rw-r--r--clang/test/Parser/recursion-limits.cpp259
-rw-r--r--clang/test/Parser/selector-1.m20
-rw-r--r--clang/test/Parser/skip-function-bodies.mm45
-rw-r--r--clang/test/Parser/statements.c64
-rw-r--r--clang/test/Parser/struct-recursion.c11
-rw-r--r--clang/test/Parser/switch-recovery.cpp172
-rw-r--r--clang/test/Parser/top-level-semi-cxx0x.cpp15
-rw-r--r--clang/test/Parser/traditional_arg_scope.c7
-rw-r--r--clang/test/Parser/typeof.c26
-rw-r--r--clang/test/Parser/types.c14
-rw-r--r--clang/test/Parser/warn-dangling-else.cpp55
157 files changed, 5042 insertions, 0 deletions
diff --git a/clang/test/Parser/CompoundStmtScope.c b/clang/test/Parser/CompoundStmtScope.c
new file mode 100644
index 0000000..4f99103
--- /dev/null
+++ b/clang/test/Parser/CompoundStmtScope.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void foo() {
+ {
+ typedef float X;
+ }
+ X Y; // expected-error {{use of undeclared identifier}}
+}
diff --git a/clang/test/Parser/DelayedTemplateParsing.cpp b/clang/test/Parser/DelayedTemplateParsing.cpp
new file mode 100644
index 0000000..9737c73
--- /dev/null
+++ b/clang/test/Parser/DelayedTemplateParsing.cpp
@@ -0,0 +1,92 @@
+// RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify %s
+
+template <class T>
+class A {
+ void foo() {
+ undeclared();
+ }
+ void foo2();
+};
+
+template <class T>
+class B {
+ void foo4() { } // expected-note {{previous definition is here}} expected-note {{previous definition is here}}
+ void foo4() { } // expected-error {{class member cannot be redeclared}} expected-error {{redefinition of 'foo4'}} expected-note {{previous definition is here}}
+
+ friend void foo3() {
+ undeclared();
+ }
+};
+
+
+template <class T>
+void B<T>::foo4() {// expected-error {{redefinition of 'foo4'}}
+}
+
+template <class T>
+void A<T>::foo2() {
+ undeclared();
+}
+
+
+template <class T>
+void foo3() {
+ undeclared();
+}
+
+template void A<int>::foo2();
+
+
+void undeclared()
+{
+
+}
+
+template <class T> void foo5() {} //expected-note {{previous definition is here}}
+template <class T> void foo5() {} // expected-error {{redefinition of 'foo5'}}
+
+
+
+namespace Inner_Outer_same_template_param_name {
+
+template <class T>
+class Outmost {
+public:
+ template <class T>
+ class Inner {
+ public:
+ void f() {
+ T* var;
+ }
+ };
+};
+
+}
+
+
+namespace PR11931 {
+
+template <typename RunType>
+struct BindState;
+
+ template<>
+struct BindState<void(void*)> {
+ static void Run() { }
+};
+
+class Callback {
+public:
+ typedef void RunType();
+
+ template <typename RunType>
+ Callback(BindState<RunType> bind_state) {
+ BindState<RunType>::Run();
+ }
+};
+
+
+Callback Bind() {
+ return Callback(BindState<void(void*)>());
+}
+
+}
diff --git a/clang/test/Parser/MicrosoftExtensions.c b/clang/test/Parser/MicrosoftExtensions.c
new file mode 100644
index 0000000..1ef326a
--- /dev/null
+++ b/clang/test/Parser/MicrosoftExtensions.c
@@ -0,0 +1,77 @@
+// RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify -fms-extensions -Wno-missing-declarations -x objective-c++ %s
+__stdcall int func0();
+int __stdcall func();
+typedef int (__cdecl *tptr)();
+void (*__fastcall fastpfunc)();
+struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {};
+extern __declspec(dllimport) void __stdcall VarR4FromDec();
+__declspec(deprecated) __declspec(deprecated) char * __cdecl ltoa( long _Val, char * _DstBuf, int _Radix);
+__declspec(noalias) __declspec(restrict) void * __cdecl xxx( void * _Memory );
+typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR;
+
+void * __ptr64 PtrToPtr64(const void *p)
+{
+ return((void * __ptr64) (unsigned __int64) (ULONG_PTR)p ); // expected-warning {{unknown attribute '__ptr64' ignored}}
+}
+void * __ptr32 PtrToPtr32(const void *p)
+{
+ return((void * __ptr32) (unsigned __int32) (ULONG_PTR)p ); // expected-warning {{unknown attribute '__ptr32' ignored}}
+}
+
+void __forceinline InterlockedBitTestAndSet (long *Base, long Bit)
+{
+ __asm {
+ mov eax, Bit
+ mov ecx, Base
+ lock bts [ecx], eax
+ setc al
+ };
+}
+_inline int foo99() { return 99; }
+
+void *_alloca(int);
+
+void foo() {
+ __declspec(align(16)) int *buffer = (int *)_alloca(9);
+}
+
+typedef bool (__stdcall __stdcall *blarg)(int);
+
+void local_callconv()
+{
+ bool (__stdcall *p)(int);
+}
+
+// Charify extension.
+#define FOO(x) #@x
+char x = FOO(a);
+
+typedef enum E { e1 };
+
+
+enum __declspec(deprecated) E2 { i, j, k };
+__declspec(deprecated) enum E3 { a, b, c } e;
+
+void deprecated_enum_test(void)
+{
+ // Test to make sure the deprecated warning follows the right thing
+ enum E2 e1; // expected-warning {{'E2' is deprecated}}
+ enum E3 e2; // No warning expected, the deprecation follows the variable
+ enum E3 e3 = e; // expected-warning {{'e' is deprecated}}
+}
+
+/* Microsoft attribute tests */
+[repeatable][source_annotation_attribute( Parameter|ReturnValue )]
+struct SA_Post{ SA_Post(); int attr; };
+
+[returnvalue:SA_Post( attr=1)]
+int foo1([SA_Post(attr=1)] void *param);
+
+
+
+void ms_intrinsics(int a)
+{
+ __noop();
+ __assume(a);
+ __debugbreak();
+}
diff --git a/clang/test/Parser/MicrosoftExtensions.cpp b/clang/test/Parser/MicrosoftExtensions.cpp
new file mode 100644
index 0000000..3a1ffea
--- /dev/null
+++ b/clang/test/Parser/MicrosoftExtensions.cpp
@@ -0,0 +1,311 @@
+// RUN: %clang_cc1 %s -std=c++11 -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions -fms-compatibility -fdelayed-template-parsing
+
+/* Microsoft attribute tests */
+[repeatable][source_annotation_attribute( Parameter|ReturnValue )]
+struct SA_Post{ SA_Post(); int attr; };
+
+[returnvalue:SA_Post( attr=1)]
+int foo1([SA_Post(attr=1)] void *param);
+
+namespace {
+ [returnvalue:SA_Post(attr=1)]
+ int foo2([SA_Post(attr=1)] void *param);
+}
+
+class T {
+ [returnvalue:SA_Post(attr=1)]
+ int foo3([SA_Post(attr=1)] void *param);
+};
+
+extern "C" {
+ [returnvalue:SA_Post(attr=1)]
+ int foo5([SA_Post(attr=1)] void *param);
+}
+
+class class_attr {
+public:
+ class_attr([SA_Pre(Null=SA_No,NullTerminated=SA_Yes)] int a)
+ {
+ }
+};
+
+
+
+void uuidof_test1()
+{
+ __uuidof(0); // expected-error {{you need to include <guiddef.h> before using the '__uuidof' operator}}
+}
+
+typedef struct _GUID
+{
+ unsigned long Data1;
+ unsigned short Data2;
+ unsigned short Data3;
+ unsigned char Data4[8];
+} GUID;
+
+struct __declspec(uuid(L"00000000-0000-0000-1234-000000000047")) uuid_attr_bad1 { };// expected-error {{'uuid' attribute requires parameter 1 to be a string}}
+struct __declspec(uuid(3)) uuid_attr_bad2 { };// expected-error {{'uuid' attribute requires parameter 1 to be a string}}
+struct __declspec(uuid("0000000-0000-0000-1234-0000500000047")) uuid_attr_bad3 { };// expected-error {{uuid attribute contains a malformed GUID}}
+struct __declspec(uuid("0000000-0000-0000-Z234-000000000047")) uuid_attr_bad4 { };// expected-error {{uuid attribute contains a malformed GUID}}
+struct __declspec(uuid("000000000000-0000-1234-000000000047")) uuid_attr_bad5 { };// expected-error {{uuid attribute contains a malformed GUID}}
+
+
+
+struct __declspec(uuid("000000A0-0000-0000-C000-000000000046"))
+struct_with_uuid { };
+struct struct_without_uuid { };
+
+struct __declspec(uuid("000000A0-0000-0000-C000-000000000049"))
+struct_with_uuid2;
+
+struct
+struct_with_uuid2 {} ;
+
+int uuid_sema_test()
+{
+ struct_with_uuid var_with_uuid[1];
+ struct_without_uuid var_without_uuid[1];
+
+ __uuidof(struct_with_uuid);
+ __uuidof(struct_with_uuid2);
+ __uuidof(struct_without_uuid); // expected-error {{cannot call operator __uuidof on a type with no GUID}}
+ __uuidof(struct_with_uuid*);
+ __uuidof(struct_without_uuid*); // expected-error {{cannot call operator __uuidof on a type with no GUID}}
+
+ __uuidof(var_with_uuid);
+ __uuidof(var_without_uuid);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
+ __uuidof(var_with_uuid[1]);
+ __uuidof(var_without_uuid[1]);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
+ __uuidof(&var_with_uuid[1]);
+ __uuidof(&var_without_uuid[1]);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
+
+ __uuidof(0);
+ __uuidof(1);// expected-error {{cannot call operator __uuidof on a type with no GUID}}
+}
+
+
+template <class T>
+void template_uuid()
+{
+ T expr;
+
+ __uuidof(T);
+ __uuidof(expr);
+}
+
+
+template <class T, const GUID* g = &__uuidof(T)>
+class COM_CLASS_TEMPLATE { };
+
+typedef COM_CLASS_TEMPLATE<struct_with_uuid, &__uuidof(struct_with_uuid)> COM_TYPE_1;
+typedef COM_CLASS_TEMPLATE<struct_with_uuid> COM_TYPE_2;
+
+template <class T, const GUID& g>
+class COM_CLASS_TEMPLATE_REF { };
+typedef COM_CLASS_TEMPLATE_REF<struct_with_uuid, __uuidof(struct_with_uuid)> COM_TYPE_REF;
+
+ struct late_defined_uuid;
+ template<typename T>
+ void test_late_defined_uuid() {
+ __uuidof(late_defined_uuid);
+ }
+ struct __declspec(uuid("000000A0-0000-0000-C000-000000000049")) late_defined_uuid;
+
+
+class CtorCall {
+public:
+ CtorCall& operator=(const CtorCall& that);
+
+ int a;
+};
+
+CtorCall& CtorCall::operator=(const CtorCall& that)
+{
+ if (this != &that) {
+ this->CtorCall::~CtorCall();
+ this->CtorCall::CtorCall(that); // expected-warning {{explicit constructor calls are a Microsoft extension}}
+ }
+ return *this;
+}
+
+template <class A>
+class C1 {
+public:
+ template <int B>
+ class Iterator {
+ };
+};
+
+template<class T>
+class C2 {
+ typename C1<T>:: /*template*/ Iterator<0> Mypos; // expected-warning {{use 'template' keyword to treat 'Iterator' as a dependent template name}}
+};
+
+template <class T>
+void missing_template_keyword(){
+ typename C1<T>:: /*template*/ Iterator<0> Mypos; // expected-warning {{use 'template' keyword to treat 'Iterator' as a dependent template name}}
+}
+
+
+
+class AAAA { };
+
+template <class T>
+void redundant_typename() {
+ typename T t;// expected-warning {{expected a qualified name after 'typename'}}
+ typename AAAA a;// expected-warning {{expected a qualified name after 'typename'}}
+ t = 3;
+}
+
+
+__interface MicrosoftInterface;
+__interface MicrosoftInterface {
+ virtual void foo1() = 0;
+ virtual void foo2() = 0;
+};
+
+void interface_test() {
+ MicrosoftInterface* a;
+ a->foo1();
+}
+
+__int64 x7 = __int64(0);
+
+
+namespace If_exists_test {
+
+class IF_EXISTS {
+private:
+ typedef int Type;
+};
+
+int __if_exists_test() {
+ int b=0;
+ __if_exists(IF_EXISTS::Type) {
+ b++;
+ b++;
+ }
+ __if_exists(IF_EXISTS::Type_not) {
+ this wont compile.
+ }
+ __if_not_exists(IF_EXISTS::Type) {
+ this wont compile.
+ }
+ __if_not_exists(IF_EXISTS::Type_not) {
+ b++;
+ b++;
+ }
+}
+
+
+__if_exists(IF_EXISTS::Type) {
+ int var23;
+}
+
+__if_exists(IF_EXISTS::Type_not) {
+ this wont compile.
+}
+
+__if_not_exists(IF_EXISTS::Type) {
+ this wont compile.
+}
+
+__if_not_exists(IF_EXISTS::Type_not) {
+ int var244;
+}
+
+int __if_exists_init_list() {
+
+ int array1[] = {
+ 0,
+ __if_exists(IF_EXISTS::Type) {2, }
+ 3
+ };
+
+ int array2[] = {
+ 0,
+ __if_exists(IF_EXISTS::Type_not) { this wont compile }
+ 3
+ };
+
+ int array3[] = {
+ 0,
+ __if_not_exists(IF_EXISTS::Type_not) {2, }
+ 3
+ };
+
+ int array4[] = {
+ 0,
+ __if_not_exists(IF_EXISTS::Type) { this wont compile }
+ 3
+ };
+
+}
+
+
+class IF_EXISTS_CLASS_TEST {
+ __if_exists(IF_EXISTS::Type) {
+ // __if_exists, __if_not_exists can nest
+ __if_not_exists(IF_EXISTS::Type_not) {
+ int var123;
+ }
+ int var23;
+ }
+
+ __if_exists(IF_EXISTS::Type_not) {
+ this wont compile.
+ }
+
+ __if_not_exists(IF_EXISTS::Type) {
+ this wont compile.
+ }
+
+ __if_not_exists(IF_EXISTS::Type_not) {
+ int var244;
+ }
+};
+
+}
+
+
+int __identifier(generic) = 3;
+
+class inline_definition_pure_spec {
+ virtual int f() = 0 { return 0; }// expected-warning {{function definition with pure-specifier is a Microsoft extension}}
+ virtual int f2() = 0;
+};
+
+
+int main () {
+ // Necessary to force instantiation in -fdelayed-template-parsing mode.
+ test_late_defined_uuid<int>();
+ redundant_typename<int>();
+ missing_template_keyword<int>();
+}
+
+
+
+
+namespace access_protected_PTM {
+
+class A {
+protected:
+ void f(); // expected-note {{must name member using the type of the current context 'access_protected_PTM::B'}}
+};
+
+class B : public A{
+public:
+ void test_access();
+ static void test_access_static();
+};
+
+void B::test_access() {
+ &A::f; // expected-error {{'f' is a protected member of 'access_protected_PTM::A'}}
+}
+
+void B::test_access_static() {
+ &A::f;
+}
+
+} \ No newline at end of file
diff --git a/clang/test/Parser/PR11000.cpp b/clang/test/Parser/PR11000.cpp
new file mode 100644
index 0000000..7dae996
--- /dev/null
+++ b/clang/test/Parser/PR11000.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -std=c++11 %s 2>&1 | FileCheck %s
+
+// PR11000: Don't crash.
+class tuple<>
+{
+ template <class _Alloc>
+ tuple(allocator_arg_t, const _Alloc&) {}
+
+// CHECK: 6 errors generated.
diff --git a/clang/test/Parser/access-spec-attrs.cpp b/clang/test/Parser/access-spec-attrs.cpp
new file mode 100644
index 0000000..4fa5975
--- /dev/null
+++ b/clang/test/Parser/access-spec-attrs.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+
+struct X {
+public __attribute__((unavailable)): // expected-error {{access specifier can only have annotation attributes}}
+ void foo();
+private __attribute__((annotate("foobar"))):
+ void bar();
+};
+
+void f(X x) {
+ x.foo();
+}
diff --git a/clang/test/Parser/altivec.c b/clang/test/Parser/altivec.c
new file mode 100644
index 0000000..d1e6552
--- /dev/null
+++ b/clang/test/Parser/altivec.c
@@ -0,0 +1,121 @@
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s
+
+__vector char vv_c;
+__vector signed char vv_sc;
+__vector unsigned char vv_uc;
+__vector short vv_s;
+__vector signed short vv_ss;
+__vector unsigned short vv_us;
+__vector short int vv_si;
+__vector signed short int vv_ssi;
+__vector unsigned short int vv_usi;
+__vector int vv_i;
+__vector signed int vv_sint;
+__vector unsigned int vv_ui;
+__vector float vv_f;
+__vector bool char vv_bc;
+__vector bool short vv_bs;
+__vector bool int vv_bi;
+__vector __pixel vv_p;
+__vector pixel vv__p;
+__vector int vf__r();
+void vf__a(__vector int a);
+void vf__a2(int b, __vector int a);
+
+vector char v_c;
+vector signed char v_sc;
+vector unsigned char v_uc;
+vector short v_s;
+vector signed short v_ss;
+vector unsigned short v_us;
+vector short int v_si;
+vector signed short int v_ssi;
+vector unsigned short int v_usi;
+vector int v_i;
+vector signed int v_sint;
+vector unsigned int v_ui;
+vector float v_f;
+vector bool char v_bc;
+vector bool short v_bs;
+vector bool int v_bi;
+vector __pixel v_p;
+vector pixel v__p;
+vector int f__r();
+void f_a(vector int a);
+void f_a2(int b, vector int a);
+
+vector int v = (vector int)(-1);
+
+// These should have warnings.
+__vector long vv_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector signed long vv_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector unsigned long vv_ul; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector long int vv_li; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector signed long int vv_sli; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector unsigned long int vv_uli; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector long v_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector signed long v_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector unsigned long v_ul; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector long int v_li; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector signed long int v_sli; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector unsigned long int v_uli; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector long double vv_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+vector long double v_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+vector bool v_b; // expected-warning {{type specifier missing, defaults to 'int'}}
+
+// These should have errors.
+__vector double vv_d1; // expected-error {{cannot use 'double' with '__vector'}}
+vector double v_d2; // expected-error {{cannot use 'double' with '__vector'}}
+__vector long double vv_ld3; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+vector long double v_ld4; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+vector bool float v_bf; // expected-error {{cannot use 'float' with '__vector bool'}}
+vector bool double v_bd; // expected-error {{cannot use 'double' with '__vector bool'}}
+vector bool pixel v_bp; // expected-error {{cannot use '__pixel' with '__vector bool'}}
+vector bool signed char v_bsc; // expected-error {{cannot use 'signed' with '__vector bool'}}
+vector bool unsigned int v_bsc2; // expected-error {{cannot use 'unsigned' with '__vector bool'}}
+vector bool long v_bl; // expected-error {{cannot use 'long' with '__vector bool'}}
+vector bool long long v_bll; // expected-error {{cannot use 'long long' with '__vector bool'}}
+
+void f() {
+ __vector unsigned int v = {0,0,0,0};
+ __vector int v__cast = (__vector int)v;
+ __vector int v_cast = (vector int)v;
+ __vector char vb_cast = (vector char)v;
+
+ // Check some casting between gcc and altivec vectors.
+ #define gccvector __attribute__((vector_size(16)))
+ gccvector unsigned int gccv = {0,0,0,0};
+ gccvector unsigned int gccv1 = gccv;
+ gccvector int gccv2 = (gccvector int)gccv;
+ gccvector unsigned int gccv3 = v;
+ __vector unsigned int av = gccv;
+ __vector int avi = (__vector int)gccv;
+ gccvector unsigned int gv = v;
+ gccvector int gvi = (gccvector int)v;
+ __attribute__((vector_size(8))) unsigned int gv8;
+ gv8 = gccv; // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}}
+ av = gv8; // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}}
+
+ v = gccv;
+ __vector unsigned int tv = gccv;
+ gccv = v;
+ gccvector unsigned int tgv = v;
+
+ int res_i;
+ // bug 7553 - Problem with '==' and vectors
+ res_i = (vv_sc == vv_sc);
+ res_i = (vv_uc != vv_uc);
+ res_i = (vv_s > vv_s);
+ res_i = (vv_us >= vv_us);
+ res_i = (vv_i < vv_i);
+ res_i = (vv_ui <= vv_ui);
+ res_i = (vv_f <= vv_f);
+}
+
+// bug 6895 - Vectorl literal casting confusion.
+vector char v1 = (vector char)((vector int)(1, 2, 3, 4));
+vector char v2 = (vector char)((vector float)(1.0f, 2.0f, 3.0f, 4.0f));
+vector char v3 = (vector char)((vector int)('a', 'b', 'c', 'd'));
+vector int v4 = (vector int)(1, 2, 3, 4);
+vector float v5 = (vector float)(1.0f, 2.0f, 3.0f, 4.0f);
+vector char v6 = (vector char)((vector int)(1+2, -2, (int)(2.0 * 3), -(5-3)));
diff --git a/clang/test/Parser/argument_qualified.c b/clang/test/Parser/argument_qualified.c
new file mode 100644
index 0000000..7d1b9fd
--- /dev/null
+++ b/clang/test/Parser/argument_qualified.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 %s
+int abc (const float x) {
+ return 1;
+}
+
diff --git a/clang/test/Parser/argument_redef.c b/clang/test/Parser/argument_redef.c
new file mode 100644
index 0000000..519e8fd
--- /dev/null
+++ b/clang/test/Parser/argument_redef.c
@@ -0,0 +1,6 @@
+/* RUN: %clang_cc1 -fsyntax-only -verify %s
+*/
+
+void foo(int A) { /* expected-note {{previous definition is here}} */
+ int A; /* expected-error {{redefinition of 'A'}} */
+}
diff --git a/clang/test/Parser/argument_scope.c b/clang/test/Parser/argument_scope.c
new file mode 100644
index 0000000..d2d10c2
--- /dev/null
+++ b/clang/test/Parser/argument_scope.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only %s
+typedef struct foo foo;
+
+void blah(int foo) {
+ foo = 1;
+}
diff --git a/clang/test/Parser/asm-constraints-pr7869.c b/clang/test/Parser/asm-constraints-pr7869.c
new file mode 100644
index 0000000..db36991
--- /dev/null
+++ b/clang/test/Parser/asm-constraints-pr7869.c
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 %s
+
+int a, b, c, d, e, f, g, h, i, j, k, l;
+
+void
+f1 (void)
+{
+ __asm__ volatile (""
+ : [a] "+r" (a), [b] "+r" (b), [c] "+r" (c), [d] "+r" (d),
+ [e] "+r" (e), [f] "+r" (f), [g] "+r" (g), [h] "+r" (h),
+ [i] "+r" (i), [j] "+r" (j), [k] "+r" (k), [l] "+r" (l));
+}
+
+void
+f2 (void)
+{
+ __asm__ volatile (""
+ : [a] "+r,m" (a), [b] "+r,m" (b), [c] "+r,m" (c), [d] "+r,m" (d),
+ [e] "+r,m" (e), [f] "+r,m" (f), [g] "+r,m" (g), [h] "+r,m" (h),
+ [i] "+r,m" (i), [j] "+r,m" (j), [k] "+r,m" (k), [l] "+r,m" (l));
+}
+
+void
+f3 (void)
+{
+ __asm__ volatile (""
+ : [a] "=r" (a), [b] "=r" (b), [c] "=r" (c), [d] "=r" (d),
+ [e] "=r" (e), [f] "=r" (f), [g] "=r" (g), [h] "=r" (h),
+ [i] "=r" (i), [j] "=r" (j), [k] "=r" (k), [l] "=r" (l)
+ : "[a]" (a), "[b]" (b), "[c]" (c), "[d]" (d),
+ "[e]" (e), "[f]" (f), "[g]" (g), "[h]" (h),
+ "[i]" (i), "[j]" (j), "[k]" (k), "[l]" (l));
+}
+
+void
+f4 (void)
+{
+ __asm__ volatile (""
+ : [a] "=r,m" (a), [b] "=r,m" (b), [c] "=r,m" (c), [d] "=r,m" (d),
+ [e] "=r,m" (e), [f] "=r,m" (f), [g] "=r,m" (g), [h] "=r,m" (h),
+ [i] "=r,m" (i), [j] "=r,m" (j), [k] "=r,m" (k), [l] "=r,m" (l)
+ : "[a],m" (a), "[b],m" (b), "[c],m" (c), "[d],m" (d),
+ "[e],m" (e), "[f],m" (f), "[g],m" (g), "[h],m" (h),
+ "[i],m" (i), "[j],m" (j), "[k],m" (k), "[l],m" (l));
+}
diff --git a/clang/test/Parser/asm.c b/clang/test/Parser/asm.c
new file mode 100644
index 0000000..23052c3
--- /dev/null
+++ b/clang/test/Parser/asm.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f1() {
+ // PR7673: Some versions of GCC support an empty clobbers section.
+ asm ("ret" : : :);
+}
+
+void f2() {
+ asm("foo" : "=r" (a)); // expected-error {{use of undeclared identifier 'a'}}
+ asm("foo" : : "r" (b)); // expected-error {{use of undeclared identifier 'b'}}
+}
+
+
+// rdar://5952468
+__asm ; // expected-error {{expected '(' after 'asm'}}
+
+// <rdar://problem/10465079> - Don't crash on wide string literals in 'asm'.
+int foo asm (L"bar"); // expected-error {{cannot use wide string literal in 'asm'}}
+
diff --git a/clang/test/Parser/asm.cpp b/clang/test/Parser/asm.cpp
new file mode 100644
index 0000000..35a497c
--- /dev/null
+++ b/clang/test/Parser/asm.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+int foo1 asm ("bar1");
+int foo2 asm (L"bar2"); // expected-error {{cannot use wide string literal in 'asm'}}
+int foo3 asm (u8"bar3"); // expected-error {{cannot use unicode string literal in 'asm'}}
+int foo4 asm (u"bar4"); // expected-error {{cannot use unicode string literal in 'asm'}}
+int foo5 asm (U"bar5"); // expected-error {{cannot use unicode string literal in 'asm'}}
+int foo6 asm ("bar6"_x); // expected-error {{string literal with user-defined suffix cannot be used here}}
diff --git a/clang/test/Parser/attr-availability.c b/clang/test/Parser/attr-availability.c
new file mode 100644
index 0000000..b9ff31c
--- /dev/null
+++ b/clang/test/Parser/attr-availability.c
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#if !__has_feature(attribute_availability)
+# error 'availability' attribute is not available
+#endif
+
+void f0() __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6)));
+
+void f1() __attribute__((availability(macosx,deprecated=10.4,introduced=10.2,obsoleted=10.6)));
+
+void f2() __attribute__((availability(ios,deprecated=10.4.7,introduced=10,obsoleted=10.6)));
+
+void f3() __attribute__((availability(ios,deprecated=10.4.7,introduced=10,obsoleted=10.6,introduced=10.2))); // expected-error{{redundant 'introduced' availability change; only the last specified change will be used}}
+
+void f4() __attribute__((availability(macosx,introduced=10.5), availability(ios,unavailable)));
+
+void f5() __attribute__((availability(macosx,introduced=10.5), availability(ios,unavailable, unavailable))); // expected-error{{redundant 'unavailable' availability change; only the last specified change will be used}}
+
+void f6() __attribute__((availability(macosx,unavailable,introduced=10.5))); // expected-warning{{'unavailable' availability overrides all other availability information}}
+
+// rdar://10095131
+enum E{
+ gorf __attribute__((availability(macosx,introduced=8.5, message = 10.0))), // expected-error {{expected string literal}}
+ garf __attribute__((availability(macosx,introduced=8.5, message))), // expected-error {{expected '=' after 'message'}}
+
+ foo __attribute__((availability(macosx,introduced=8.5,deprecated=9.0, message="Use CTFontCopyPostScriptName()", deprecated=10.0))) // expected-error {{expected ')'}} \
+ // expected-note {{to match this '('}}
+};
diff --git a/clang/test/Parser/attributes.c b/clang/test/Parser/attributes.c
new file mode 100644
index 0000000..347cb9c
--- /dev/null
+++ b/clang/test/Parser/attributes.c
@@ -0,0 +1,98 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -pedantic -std=c99
+
+int __attribute__(()) x;
+
+__inline void __attribute__((__always_inline__, __nodebug__))
+foo(void) {
+}
+
+
+__attribute__(()) y; // expected-warning {{defaults to 'int'}}
+
+// PR2796
+int (__attribute__(()) *z)(long y);
+
+
+void f1(__attribute__(()) int x);
+
+int f2(y, __attribute__(()) x); // expected-error {{expected identifier}}
+
+// This is parsed as a normal argument list (with two args that are implicit
+// int) because the __attribute__ is a declspec.
+void f3(__attribute__(()) x, // expected-warning {{defaults to 'int'}}
+ y); // expected-warning {{defaults to 'int'}}
+
+void f4(__attribute__(())); // expected-error {{expected parameter declarator}}
+
+
+// This is ok, the __attribute__ applies to the pointer.
+int baz(int (__attribute__(()) *x)(long y));
+
+void g1(void (*f1)(__attribute__(()) int x));
+void g2(int (*f2)(y, __attribute__(()) x)); // expected-error {{expected identifier}}
+void g3(void (*f3)(__attribute__(()) x, int y)); // expected-warning {{defaults to 'int'}}
+void g4(void (*f4)(__attribute__(()))); // expected-error {{expected parameter declarator}}
+
+
+void (*h1)(void (*f1)(__attribute__(()) int x));
+void (*h2)(int (*f2)(y, __attribute__(()) x)); // expected-error {{expected identifier}}
+
+void (*h3)(void (*f3)(__attribute__(()) x)); // expected-warning {{defaults to 'int'}}
+void (*h4)(void (*f4)(__attribute__(()))); // expected-error {{expected parameter declarator}}
+
+
+
+// rdar://6131260
+int foo42(void) {
+ int x, __attribute__((unused)) y, z;
+ return 0;
+}
+
+// rdar://6096491
+void __attribute__((noreturn)) d0(void), __attribute__((noreturn)) d1(void);
+
+void d2(void) __attribute__((noreturn)), d3(void) __attribute__((noreturn));
+
+
+// PR6287
+void __attribute__((returns_twice)) returns_twice_test();
+
+int aligned(int);
+int __attribute__((vec_type_hint(char, aligned(16) )) missing_rparen_1; // expected-error {{expected ')'}}
+int __attribute__((mode(x aligned(16) )) missing_rparen_2; // expected-error {{expected ')'}}
+int __attribute__((format(printf, 0 aligned(16) )) missing_rparen_3; // expected-error {{expected ')'}}
+
+
+
+int testFundef1(int *a) __attribute__((nonnull(1))) { // \
+ // expected-warning {{GCC does not allow nonnull attribute in this position on a function definition}}
+ return *a;
+}
+
+// noreturn is lifted to type qualifier
+void testFundef2() __attribute__((noreturn)) { // \
+ // expected-warning {{GCC does not allow noreturn attribute in this position on a function definition}}
+ testFundef2();
+}
+
+int testFundef3(int *a) __attribute__((nonnull(1), // \
+ // expected-warning {{GCC does not allow nonnull attribute in this position on a function definition}}
+ pure)) { // \
+ // expected-warning {{GCC does not allow pure attribute in this position on a function definition}}
+ return *a;
+}
+
+int testFundef4(int *a) __attribute__((nonnull(1))) // \
+ // expected-warning {{GCC does not allow nonnull attribute in this position on a function definition}}
+ __attribute((pure)) { // \
+ // expected-warning {{GCC does not allow pure attribute in this position on a function definition}}
+ return *a;
+}
+
+// GCC allows these
+void testFundef5() __attribute__(()) { }
+
+__attribute__((pure)) int testFundef6(int a) { return a; }
+
+
+
diff --git a/clang/test/Parser/backtrack-crash.cpp b/clang/test/Parser/backtrack-crash.cpp
new file mode 100644
index 0000000..cc26873
--- /dev/null
+++ b/clang/test/Parser/backtrack-crash.cpp
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
+// PR7072
+()( // expected-error {{expected unqualified-id}}
+
diff --git a/clang/test/Parser/bad-control.c b/clang/test/Parser/bad-control.c
new file mode 100644
index 0000000..480d81b
--- /dev/null
+++ b/clang/test/Parser/bad-control.c
@@ -0,0 +1,9 @@
+/* RUN: %clang_cc1 -fsyntax-only -verify %s
+*/
+void foo() {
+ break; /* expected-error {{'break' statement not in loop or switch statement}} */
+}
+
+void foo2() {
+ continue; /* expected-error {{'continue' statement not in loop statement}} */
+}
diff --git a/clang/test/Parser/block-block-storageclass.c b/clang/test/Parser/block-block-storageclass.c
new file mode 100644
index 0000000..97ba113
--- /dev/null
+++ b/clang/test/Parser/block-block-storageclass.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s
+int printf(const char *, ...);
+void _Block_byref_release(void*src){}
+
+int main() {
+ __block int X = 1234;
+ __block const char * message = "HELLO";
+
+ X = X - 1234;
+
+ X += 1;
+
+ printf ("%s(%d)\n", message, X);
+ X -= 1;
+
+ return X;
+}
diff --git a/clang/test/Parser/block-pointer-decl.c b/clang/test/Parser/block-pointer-decl.c
new file mode 100644
index 0000000..a8cc258
--- /dev/null
+++ b/clang/test/Parser/block-pointer-decl.c
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s
+
+int printf(char const *, ...);
+
+struct blockStruct {
+ int (^a)(float, int);
+ int b;
+};
+
+int blockTaker (int (^myBlock)(int), int other_input)
+{
+ return 5 * myBlock (other_input);
+}
+
+int main (int argc, char **argv)
+{
+ int (^blockptr) (int) = ^(int inval) {
+ printf ("Inputs: %d, %d.\n", argc, inval);
+ return argc * inval;
+ };
+
+
+ argc = 10;
+ printf ("I got: %d.\n",
+ blockTaker (blockptr, 6));
+ return 0;
+}
+
diff --git a/clang/test/Parser/bracket-crash.cpp b/clang/test/Parser/bracket-crash.cpp
new file mode 100644
index 0000000..bcc6eab
--- /dev/null
+++ b/clang/test/Parser/bracket-crash.cpp
@@ -0,0 +1,6 @@
+// RUN: not %clang_cc1 -fsyntax-only -std=c++11 %s
+// PR7481
+decltype(;
+struct{
+ a
+}
diff --git a/clang/test/Parser/builtin_classify_type.c b/clang/test/Parser/builtin_classify_type.c
new file mode 100644
index 0000000..a7c0855
--- /dev/null
+++ b/clang/test/Parser/builtin_classify_type.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct foo { int a; };
+
+int main() {
+ int a;
+ float b;
+ double d;
+ struct foo s;
+
+ static int ary[__builtin_classify_type(a)];
+ static int ary2[(__builtin_classify_type)(a)]; // expected-error{{variable length array declaration can not have 'static' storage duration}}
+ static int ary3[(*__builtin_classify_type)(a)]; // expected-error{{variable length array declaration can not have 'static' storage duration}}
+
+ int result;
+
+ result = __builtin_classify_type(a);
+ result = __builtin_classify_type(b);
+ result = __builtin_classify_type(d);
+ result = __builtin_classify_type(s);
+}
diff --git a/clang/test/Parser/builtin_types_compatible.c b/clang/test/Parser/builtin_types_compatible.c
new file mode 100644
index 0000000..ac81e7b
--- /dev/null
+++ b/clang/test/Parser/builtin_types_compatible.c
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+extern int funcInt(int);
+extern float funcFloat(float);
+extern double funcDouble(double);
+// figure out why "char *" doesn't work (with gcc, nothing to do with clang)
+//extern void funcCharPtr(char *);
+
+#define func(expr) \
+ do { \
+ typeof(expr) tmp; \
+ if (__builtin_types_compatible_p(typeof(expr), int)) funcInt(tmp); \
+ else if (__builtin_types_compatible_p(typeof(expr), float)) funcFloat(tmp); \
+ else if (__builtin_types_compatible_p(typeof(expr), double)) funcDouble(tmp); \
+ } while (0)
+#define func_choose(expr) \
+ __builtin_choose_expr(__builtin_types_compatible_p(typeof(expr), int), funcInt(expr), \
+ __builtin_choose_expr(__builtin_types_compatible_p(typeof(expr), float), funcFloat(expr), \
+ __builtin_choose_expr(__builtin_types_compatible_p(typeof(expr), double), funcDouble(expr), (void)0)))
+
+static void test()
+{
+ int a;
+ float b;
+ double d;
+
+ func(a);
+ func(b);
+ func(d);
+ a = func_choose(a);
+ b = func_choose(b);
+ d = func_choose(d);
+
+ int c;
+ struct xx { int a; } x, y;
+
+ c = __builtin_choose_expr(a+3-7, b, x); // expected-error{{'__builtin_choose_expr' requires a constant expression}}
+ c = __builtin_choose_expr(0, b, x); // expected-error{{assigning to 'int' from incompatible type 'struct xx'}}
+ c = __builtin_choose_expr(5+3-7, b, x);
+ y = __builtin_choose_expr(4+3-7, b, x);
+
+}
+
diff --git a/clang/test/Parser/c-namespace.c b/clang/test/Parser/c-namespace.c
new file mode 100644
index 0000000..fbef09e
--- /dev/null
+++ b/clang/test/Parser/c-namespace.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only %s
+void bla1() {
+ struct XXX;
+ int XXX;
+}
+
diff --git a/clang/test/Parser/c1x-alignas.c b/clang/test/Parser/c1x-alignas.c
new file mode 100644
index 0000000..5dccc99
--- /dev/null
+++ b/clang/test/Parser/c1x-alignas.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -std=c1x -fsyntax-only -verify %s
+
+_Alignas(4) char c1;
+unsigned _Alignas(long) char c2;
+char _Alignas(16) c3;
+
+char c4 _Alignas(32); // expected-error {{expected ';' after top level declarator}}
diff --git a/clang/test/Parser/c1x-generic-selection.c b/clang/test/Parser/c1x-generic-selection.c
new file mode 100644
index 0000000..ee23059
--- /dev/null
+++ b/clang/test/Parser/c1x-generic-selection.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -std=c1x -fsyntax-only -verify %s
+
+void foo(void) {
+ _Generic; // expected-error {{expected '('}}
+ (void) _Generic(0); // expected-error {{expected ','}}
+ (void) _Generic(0, void); // expected-error {{expected ':'}}
+ (void) _Generic(0,
+ default: 0, // expected-note {{previous default generic association is here}}
+ default: 0); // expected-error {{duplicate default generic association}}
+}
diff --git a/clang/test/Parser/char-literal-printing.c b/clang/test/Parser/char-literal-printing.c
new file mode 100644
index 0000000..27dd63a
--- /dev/null
+++ b/clang/test/Parser/char-literal-printing.c
@@ -0,0 +1,67 @@
+// RUN: %clang_cc1 -ast-print %s
+// RUN: %clang_cc1 -x c++ -ast-print %s
+// RUN: %clang_cc1 -x c++ -std=c++11 -ast-print %s
+
+#include <stddef.h>
+
+char test1(void) { return '\\'; }
+wchar_t test2(void) { return L'\\'; }
+char test3(void) { return '\''; }
+wchar_t test4(void) { return L'\''; }
+char test5(void) { return '\a'; }
+wchar_t test6(void) { return L'\a'; }
+char test7(void) { return '\b'; }
+wchar_t test8(void) { return L'\b'; }
+char test9(void) { return '\e'; }
+wchar_t test10(void) { return L'\e'; }
+char test11(void) { return '\f'; }
+wchar_t test12(void) { return L'\f'; }
+char test13(void) { return '\n'; }
+wchar_t test14(void) { return L'\n'; }
+char test15(void) { return '\r'; }
+wchar_t test16(void) { return L'\r'; }
+char test17(void) { return '\t'; }
+wchar_t test18(void) { return L'\t'; }
+char test19(void) { return '\v'; }
+wchar_t test20(void) { return L'\v'; }
+
+char test21(void) { return 'c'; }
+wchar_t test22(void) { return L'c'; }
+char test23(void) { return '\x3'; }
+wchar_t test24(void) { return L'\x3'; }
+
+wchar_t test25(void) { return L'\x333'; }
+
+#if __cplusplus >= 201103L
+char16_t test26(void) { return u'\\'; }
+char16_t test27(void) { return u'\''; }
+char16_t test28(void) { return u'\a'; }
+char16_t test29(void) { return u'\b'; }
+char16_t test30(void) { return u'\e'; }
+char16_t test31(void) { return u'\f'; }
+char16_t test32(void) { return u'\n'; }
+char16_t test33(void) { return u'\r'; }
+char16_t test34(void) { return u'\t'; }
+char16_t test35(void) { return u'\v'; }
+
+char16_t test36(void) { return u'c'; }
+char16_t test37(void) { return u'\x3'; }
+
+char16_t test38(void) { return u'\x333'; }
+
+char32_t test39(void) { return U'\\'; }
+char32_t test40(void) { return U'\''; }
+char32_t test41(void) { return U'\a'; }
+char32_t test42(void) { return U'\b'; }
+char32_t test43(void) { return U'\e'; }
+char32_t test44(void) { return U'\f'; }
+char32_t test45(void) { return U'\n'; }
+char32_t test46(void) { return U'\r'; }
+char32_t test47(void) { return U'\t'; }
+char32_t test48(void) { return U'\v'; }
+
+char32_t test49(void) { return U'c'; }
+char32_t test50(void) { return U'\x3'; }
+
+char32_t test51(void) { return U'\x333'; }
+#endif
diff --git a/clang/test/Parser/check-objc2-syntax-1.m b/clang/test/Parser/check-objc2-syntax-1.m
new file mode 100644
index 0000000..3cdf2b0
--- /dev/null
+++ b/clang/test/Parser/check-objc2-syntax-1.m
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@interface Subclass
++ (int)magicNumber;
+@end
+
+int main (void) {
+ return Subclass.magicNumber;
+}
+
diff --git a/clang/test/Parser/check-syntax-1.m b/clang/test/Parser/check-syntax-1.m
new file mode 100644
index 0000000..0ae0c5d
--- /dev/null
+++ b/clang/test/Parser/check-syntax-1.m
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int @interface bla ; // expected-error {{cannot combine with previous 'int' declaration specifier}}
+@end
+
+typedef float CGFloat;
+@interface XNSNumber
++ (XNSNumber *) numberWithCGFloat : (CGFloat) float; // expected-error {{expected identifier}} \
+ // expected-error {{expected ';' after method prototype}}
+@end
+
+// rdar: // 7822196
+@interface A
+(void) x; // expected-error {{method type specifier must start with '-' or '+'}}
+(int)im; // expected-error {{method type specifier must start with '-' or '+'}} \
+- ok;
+@end
+
+
diff --git a/clang/test/Parser/check_cast.c b/clang/test/Parser/check_cast.c
new file mode 100644
index 0000000..790ee40
--- /dev/null
+++ b/clang/test/Parser/check_cast.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+struct foo {
+ int a;
+};
+
+int main() {
+ struct foo xxx;
+ int i;
+
+ xxx = (struct foo)1; // expected-error {{used type 'struct foo' where arithmetic or pointer type is required}}
+ i = (int)xxx; // expected-error {{operand of type 'struct foo' where arithmetic or pointer type is required}}
+}
diff --git a/clang/test/Parser/compound_literal.c b/clang/test/Parser/compound_literal.c
new file mode 100644
index 0000000..4f3609d
--- /dev/null
+++ b/clang/test/Parser/compound_literal.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+int main() {
+ char *s;
+ s = (char []){"whatever"};
+}
diff --git a/clang/test/Parser/control-scope.c b/clang/test/Parser/control-scope.c
new file mode 100644
index 0000000..5314980
--- /dev/null
+++ b/clang/test/Parser/control-scope.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -std=c90 -verify
+// RUN: %clang_cc1 %s -std=c99
+
+int f (int z) {
+ if (z + sizeof (enum {a})) // expected-note {{previous definition is here}}
+ return 1 + sizeof (enum {a}); // expected-error {{redefinition of enumerator 'a'}}
+ return 0;
+}
diff --git a/clang/test/Parser/cuda-kernel-call.cu b/clang/test/Parser/cuda-kernel-call.cu
new file mode 100644
index 0000000..f95ae9e
--- /dev/null
+++ b/clang/test/Parser/cuda-kernel-call.cu
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void foo(void) {
+ foo<<<1; // expected-error {{expected '>>>'}} expected-note {{to match this '<<<'}}
+
+ foo<<<1,1>>>; // expected-error {{expected '('}}
+
+ foo<<<>>>(); // expected-error {{expected expression}}
+}
diff --git a/clang/test/Parser/cxx-altivec.cpp b/clang/test/Parser/cxx-altivec.cpp
new file mode 100644
index 0000000..9b2b1af
--- /dev/null
+++ b/clang/test/Parser/cxx-altivec.cpp
@@ -0,0 +1,170 @@
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s
+
+__vector char vv_c;
+__vector signed char vv_sc;
+__vector unsigned char vv_uc;
+__vector short vv_s;
+__vector signed short vv_ss;
+__vector unsigned short vv_us;
+__vector short int vv_si;
+__vector signed short int vv_ssi;
+__vector unsigned short int vv_usi;
+__vector int vv_i;
+__vector signed int vv_sint;
+__vector unsigned int vv_ui;
+__vector float vv_f;
+__vector bool char vv_bc;
+__vector bool short vv_bs;
+__vector bool int vv_bi;
+__vector __pixel vv_p;
+__vector pixel vv__p;
+__vector int vf__r();
+void vf__a(__vector int a);
+void vf__a2(int b, __vector int a);
+
+vector char v_c;
+vector signed char v_sc;
+vector unsigned char v_uc;
+vector short v_s;
+vector signed short v_ss;
+vector unsigned short v_us;
+vector short int v_si;
+vector signed short int v_ssi;
+vector unsigned short int v_usi;
+vector int v_i;
+vector signed int v_sint;
+vector unsigned int v_ui;
+vector float v_f;
+vector bool char v_bc;
+vector bool short v_bs;
+vector bool int v_bi;
+vector __pixel v_p;
+vector pixel v__p;
+vector int f__r();
+void f_a(vector int a);
+void f_a2(int b, vector int a);
+
+vector int v = (vector int)(-1);
+
+// These should have warnings.
+__vector long vv_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector signed long vv_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector unsigned long vv_ul; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector long int vv_li; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector signed long int vv_sli; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector unsigned long int vv_uli; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector long v_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector signed long v_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector unsigned long v_ul; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector long int v_li; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector signed long int v_sli; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector unsigned long int v_uli; // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector long double vv_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+vector long double v_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+
+// These should have errors.
+__vector double vv_d1; // expected-error {{cannot use 'double' with '__vector'}}
+vector double v_d2; // expected-error {{cannot use 'double' with '__vector'}}
+__vector long double vv_ld3; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+vector long double v_ld4; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+vector bool v_b; // expected-error {{C++ requires a type specifier for all declarations}}
+vector bool float v_bf; // expected-error {{cannot use 'float' with '__vector bool'}}
+vector bool double v_bd; // expected-error {{cannot use 'double' with '__vector bool'}}
+vector bool pixel v_bp; // expected-error {{cannot use '__pixel' with '__vector bool'}}
+vector bool signed char v_bsc; // expected-error {{cannot use 'signed' with '__vector bool'}}
+vector bool unsigned int v_bsc2; // expected-error {{cannot use 'unsigned' with '__vector bool'}}
+vector bool long v_bl; // expected-error {{cannot use 'long' with '__vector bool'}}
+vector bool long long v_bll; // expected-error {{cannot use 'long long' with '__vector bool'}}
+
+void f() {
+ __vector unsigned int v = {0,0,0,0};
+ __vector int v__cast = (__vector int)v;
+ __vector int v_cast = (vector int)v;
+ __vector char vb_cast = (vector char)v;
+
+ // Check some casting between gcc and altivec vectors.
+ #define gccvector __attribute__((vector_size(16)))
+ gccvector unsigned int gccv = {0,0,0,0};
+ gccvector unsigned int gccv1 = gccv;
+ gccvector int gccv2 = (gccvector int)gccv;
+ gccvector unsigned int gccv3 = v;
+ __vector unsigned int av = gccv;
+ __vector int avi = (__vector int)gccv;
+ gccvector unsigned int gv = v;
+ gccvector int gvi = (gccvector int)v;
+ __attribute__((vector_size(8))) unsigned int gv8;
+ gv8 = gccv; // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}}
+ av = gv8; // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}}
+
+ v = gccv;
+ __vector unsigned int tv = gccv;
+ gccv = v;
+ gccvector unsigned int tgv = v;
+}
+
+// Now for the C++ version:
+
+class vc__v {
+ __vector int v;
+ __vector int f__r();
+ void f__a(__vector int a);
+ void f__a2(int b, __vector int a);
+};
+
+class c_v {
+ vector int v;
+ vector int f__r();
+ void f__a(vector int a);
+ void f__a2(int b, vector int a);
+};
+
+
+// bug 6895 - Vectorl literal casting confusion.
+vector char v1 = (vector char)((vector int)(1, 2, 3, 4));
+vector char v2 = (vector char)((vector float)(1.0f, 2.0f, 3.0f, 4.0f));
+vector char v3 = (vector char)((vector int)('a', 'b', 'c', 'd'));
+vector int v4 = (vector int)(1, 2, 3, 4);
+vector float v5 = (vector float)(1.0f, 2.0f, 3.0f, 4.0f);
+vector char v6 = (vector char)((vector int)(1+2, -2, (int)(2.0 * 3), -(5-3)));
+
+// bug 7553 - Problem with '==' and vectors
+void func() {
+ bool res_b;
+ res_b = (vv_sc == vv_sc);
+ res_b = (vv_uc != vv_uc);
+ res_b = (vv_s > vv_s);
+ res_b = (vv_us >= vv_us);
+ res_b = (vv_i < vv_i);
+ res_b = (vv_ui <= vv_ui);
+ res_b = (vv_f <= vv_f);
+}
+
+// vecreturn attribute test
+struct Vector
+{
+ __vector float xyzw;
+} __attribute__((vecreturn));
+
+Vector Add(Vector lhs, Vector rhs)
+{
+ Vector result;
+ result.xyzw = vec_add(lhs.xyzw, rhs.xyzw);
+ return result; // This will (eventually) be returned in a register
+}
+
+// vecreturn attribute test - should error because of virtual function.
+class VectorClassNonPod
+{
+ __vector float xyzw;
+public:
+ VectorClassNonPod() {}
+ virtual ~VectorClassNonPod() {}
+} __attribute__((vecreturn)); // expected-error {{the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)}}
+
+// vecreturn attribute test - should error because of virtual function.
+class VectorClassMultipleMembers
+{
+public:
+ __vector float xyzw;
+ __vector float abcd;
+} __attribute__((vecreturn)); // expected-error {{the vecreturn attribute can only be used on a class or structure with one member, which must be a vector}}
diff --git a/clang/test/Parser/cxx-ambig-decl-expr-xfail.cpp b/clang/test/Parser/cxx-ambig-decl-expr-xfail.cpp
new file mode 100644
index 0000000..ac4accb
--- /dev/null
+++ b/clang/test/Parser/cxx-ambig-decl-expr-xfail.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// XFAIL: *
+struct X {
+ template<typename T> X(T);
+ X(int, int);
+
+ X operator()(int, int) const;
+};
+
+template<typename T, typename U> struct Y { };
+
+X *x;
+void f() {
+ int y = 0;
+ X (*x)(int(y), int(y)) = Y<int, float>(), ++y;
+}
diff --git a/clang/test/Parser/cxx-ambig-decl-expr.cpp b/clang/test/Parser/cxx-ambig-decl-expr.cpp
new file mode 100644
index 0000000..b5ff728
--- /dev/null
+++ b/clang/test/Parser/cxx-ambig-decl-expr.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct X {
+ template<typename T, typename U>
+ static void f(int, int);
+};
+
+void f() {
+ void (*ptr)(int, int) = &X::f<int, int>;
+}
diff --git a/clang/test/Parser/cxx-ambig-paren-expr.cpp b/clang/test/Parser/cxx-ambig-paren-expr.cpp
new file mode 100644
index 0000000..3988205
--- /dev/null
+++ b/clang/test/Parser/cxx-ambig-paren-expr.cpp
@@ -0,0 +1,66 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+
+void f() {
+ typedef int T;
+ int x, *px;
+
+ // Type id.
+ (T())x; // expected-error {{cast from 'int' to 'T ()'}}
+ (T())+x; // expected-error {{cast from 'int' to 'T ()'}}
+ (T())*px; // expected-error {{cast from 'int' to 'T ()'}}
+
+ // Expression.
+ x = (T());
+ x = (T())/x;
+
+ typedef int *PT;
+ // Make sure stuff inside the parens are parsed only once (only one warning).
+ x = (PT()[(int){1}]); // expected-warning {{compound literals}}
+
+ // Special case: empty parens is a call, not an expression
+ struct S{int operator()();};
+ (S())();
+
+ // FIXME: Special case: "++" is postfix here, not prefix
+ // (S())++;
+}
+
+// Make sure we do tentative parsing correctly in conditions.
+typedef int type;
+struct rec { rec(int); };
+
+namespace ns {
+ typedef int type;
+ struct rec { rec(int); };
+}
+
+struct cls {
+ typedef int type;
+ struct rec { rec(int); };
+};
+
+struct result {
+ template <class T> result(T);
+ bool check();
+};
+
+void test(int i) {
+ if (result((cls::type) i).check())
+ return;
+
+ if (result((ns::type) i).check())
+ return;
+
+ if (result((::type) i).check())
+ return;
+
+ if (result((cls::rec) i).check())
+ return;
+
+ if (result((ns::rec) i).check())
+ return;
+
+ if (result((::rec) i).check())
+ return;
+}
+
diff --git a/clang/test/Parser/cxx-attributes.cpp b/clang/test/Parser/cxx-attributes.cpp
new file mode 100644
index 0000000..8603b30
--- /dev/null
+++ b/clang/test/Parser/cxx-attributes.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -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/clang/test/Parser/cxx-bool.cpp b/clang/test/Parser/cxx-bool.cpp
new file mode 100644
index 0000000..a8a161e
--- /dev/null
+++ b/clang/test/Parser/cxx-bool.cpp
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -fsyntax-only %s
+
+bool a = true;
+bool b = false;
diff --git a/clang/test/Parser/cxx-casting.cpp b/clang/test/Parser/cxx-casting.cpp
new file mode 100644
index 0000000..42ad12e
--- /dev/null
+++ b/clang/test/Parser/cxx-casting.cpp
@@ -0,0 +1,92 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+char *const_cast_test(const char *var)
+{
+ return const_cast<char*>(var);
+}
+
+struct A {
+ virtual ~A() {}
+};
+
+struct B : public A {
+};
+
+struct B *dynamic_cast_test(struct A *a)
+{
+ return dynamic_cast<struct B*>(a);
+}
+
+char *reinterpret_cast_test()
+{
+ return reinterpret_cast<char*>(0xdeadbeef);
+}
+
+double static_cast_test(int i)
+{
+ return static_cast<double>(i);
+}
+
+char postfix_expr_test()
+{
+ return reinterpret_cast<char*>(0xdeadbeef)[0];
+}
+
+// This was being incorrectly tentatively parsed.
+namespace test1 {
+ template <class T> class A {}; // expected-note 2{{here}}
+ void foo() { A<int>(*(A<int>*)0); }
+}
+
+typedef char* c;
+typedef A* a;
+void test2(char x, struct B * b) {
+ (void)const_cast<::c>(&x); // expected-error{{found '<::' after a const_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+ (void)dynamic_cast<::a>(b); // expected-error{{found '<::' after a dynamic_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+ (void)reinterpret_cast<::c>(x); // expected-error{{found '<::' after a reinterpret_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+ (void)static_cast<::c>(&x); // expected-error{{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+
+ // Do not do digraph correction.
+ (void)static_cast<: :c>(&x); //\
+ expected-error {{expected '<' after 'static_cast'}} \
+ expected-error {{expected expression}}\
+ expected-error {{expected ']'}}\
+ expected-note {{to match this '['}}
+ (void)static_cast<: // expected-error {{expected '<' after 'static_cast'}} \
+ expected-note {{to match this '['}}
+ :c>(&x); // expected-error {{expected expression}} \
+ expected-error {{expected ']'}}
+#define LC <:
+#define C :
+ test1::A LC:B> c; // expected-error {{cannot refer to class template 'A' without a template argument list}} expected-error 2{{}} expected-note{{}}
+ (void)static_cast LC:c>(&x); // expected-error {{expected '<' after 'static_cast'}} expected-error 2{{}} expected-note{{}}
+ test1::A<:C B> d; // expected-error {{cannot refer to class template 'A' without a template argument list}} expected-error 2{{}} expected-note{{}}
+ (void)static_cast<:C c>(&x); // expected-error {{expected '<' after 'static_cast'}} expected-error 2{{}} expected-note{{}}
+
+#define LCC <::
+ test1::A LCC B> e; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+ (void)static_cast LCC c>(&x); // expected-error{{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+}
+
+ // This note comes from "::D[:F> A5;"
+template <class T> class D {}; // expected-note{{template is declared here}}
+template <class T> void E() {};
+class F {};
+
+void test3() {
+ ::D<::F> A1; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+ D<::F> A2; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+ ::E<::F>(); // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+ E<::F>(); // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}}
+
+ ::D< ::F> A3;
+ D< ::F> A4;
+ ::E< ::F>();
+ E< ::F>();
+
+ // Make sure that parser doesn't expand '[:' to '< ::'
+ ::D[:F> A5; // expected-error {{cannot refer to class template 'D' without a template argument list}} \
+ // expected-error {{expected expression}} \
+ // expected-error {{expected ']'}} \
+ // expected-note {{to match this '['}}
+}
diff --git a/clang/test/Parser/cxx-class.cpp b/clang/test/Parser/cxx-class.cpp
new file mode 100644
index 0000000..1b3dd41
--- /dev/null
+++ b/clang/test/Parser/cxx-class.cpp
@@ -0,0 +1,89 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
+class C;
+class C {
+public:
+protected:
+ typedef int A,B;
+ static int sf(), u;
+
+ struct S {};
+ enum {}; // expected-warning{{declaration does not declare anything}}
+ int; // expected-warning {{declaration does not declare anything}}
+ int : 1, : 2;
+
+public:
+ void m() {
+ int l = 2;
+ };
+
+ template<typename T> void mt(T) { };
+ ; // expected-warning{{extra ';' inside a class}}
+
+ virtual int vf() const volatile = 0;
+
+private:
+ int x,f(),y,g();
+ inline int h();
+ static const int sci = 10;
+ mutable int mi;
+};
+void glo()
+{
+ struct local {};
+}
+
+// PR3177
+typedef union {
+ __extension__ union {
+ int a;
+ float b;
+ } y;
+} bug3177;
+
+// check that we don't consume the token after the access specifier
+// when it's not a colon
+class D {
+public // expected-error{{expected ':'}}
+ int i;
+};
+
+// consume the token after the access specifier if it's a semicolon
+// that was meant to be a colon
+class E {
+public; // expected-error{{expected ':'}}
+ int i;
+};
+
+class F {
+ int F1 { return 1; } // expected-error{{function definition does not declare parameters}}
+ void F2 {} // expected-error{{function definition does not declare parameters}}
+ typedef int F3() { return 0; } // expected-error{{function definition declared 'typedef'}}
+ typedef void F4() {} // expected-error{{function definition declared 'typedef'}}
+};
+
+namespace ctor_error {
+ class Foo {};
+ // By [class.qual]p2, this is a constructor declaration.
+ Foo::Foo (F) = F(); // expected-error{{does not match any declaration in 'ctor_error::Foo'}}
+
+ class Ctor { // expected-note{{not complete until the closing '}'}}
+ Ctor(f)(int); // ok
+ Ctor(g(int)); // ok
+ Ctor(x[5]); // expected-error{{incomplete type}}
+
+ Ctor(UnknownType *); // expected-error{{unknown type name 'UnknownType'}}
+ void operator+(UnknownType*); // expected-error{{unknown type name 'UnknownType'}}
+ };
+
+ Ctor::Ctor (x) = { 0 }; // \
+ // expected-error{{qualified reference to 'Ctor' is a constructor name}}
+
+ Ctor::Ctor(UnknownType *) {} // \
+ // expected-error{{unknown type name 'UnknownType'}}
+ void Ctor::operator+(UnknownType*) {} // \
+ // expected-error{{unknown type name 'UnknownType'}}
+}
+
+// PR11109 must appear at the end of the source file
+class pr11109r3 { // expected-note{{to match this '{'}}
+ public // expected-error{{expected ':'}} expected-error{{expected '}'}} expected-error{{expected ';' after class}}
diff --git a/clang/test/Parser/cxx-condition.cpp b/clang/test/Parser/cxx-condition.cpp
new file mode 100644
index 0000000..5672eea
--- /dev/null
+++ b/clang/test/Parser/cxx-condition.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct S { S(int); operator bool(); };
+
+void f() {
+ int a;
+ while (a) ;
+ while (int x) ; // expected-error {{variable declaration in condition must have an initializer}}
+ while (float x = 0) ;
+ if (const int x = a) ; // expected-warning{{empty body}} expected-note{{put the semicolon on a separate line to silence this warning}}
+ switch (int x = a+10) {}
+ for (; int x = ++a; ) ;
+
+ if (S a(42)) {} // expected-error {{variable declaration in condition cannot have a parenthesized initializer}}
+}
diff --git a/clang/test/Parser/cxx-decl.cpp b/clang/test/Parser/cxx-decl.cpp
new file mode 100644
index 0000000..57f33d8
--- /dev/null
+++ b/clang/test/Parser/cxx-decl.cpp
@@ -0,0 +1,129 @@
+// RUN: %clang_cc1 -verify -fsyntax-only -triple i386-linux %s
+
+int x(*g); // expected-error {{use of undeclared identifier 'g'}}
+
+struct Type {
+ int Type;
+};
+
+// rdar://8365458
+// rdar://9132143
+typedef char bool; // expected-error {{redeclaration of C++ built-in type 'bool'}}
+
+// PR4451 - We should recover well from the typo of '::' as ':' in a2.
+namespace y {
+ struct a { };
+ typedef int b;
+}
+
+y::a a1;
+y:a a2; // expected-error {{unexpected ':' in nested name specifier}}
+y::a a3 = a2;
+
+// Some valid colons:
+void foo() {
+y: // label
+ y::a s;
+
+ int a = 4;
+ a = a ? a : a+1;
+}
+
+struct b : y::a {};
+
+template <typename T>
+class someclass {
+
+ int bar() {
+ T *P;
+ return 1 ? P->x : P->y;
+ }
+};
+
+class asm_class_test {
+ void foo() __asm__("baz");
+};
+
+enum { fooenum = 1 };
+
+struct a {
+ int Type : fooenum;
+};
+
+void test(struct Type *P) {
+ int Type;
+ Type = 1 ? P->Type : Type;
+
+ Type = (y:b) 4; // expected-error {{unexpected ':' in nested name specifier}}
+ Type = 1 ? (
+ (y:b) // expected-error {{unexpected ':' in nested name specifier}}
+ 4) : 5;
+}
+
+struct test4 {
+ int x // expected-error {{expected ';' at end of declaration list}}
+ int y;
+ int z // expected-error {{expected ';' at end of declaration list}}
+};
+
+// Make sure we know these are legitimate commas and not typos for ';'.
+namespace Commas {
+ struct S {
+ static int a;
+ int c,
+ operator()();
+ };
+
+ int global1,
+ __attribute__(()) global2,
+ (global5),
+ *global6,
+ &global7 = global1,
+ &&global8 = static_cast<int&&>(global1), // expected-warning 2{{rvalue reference}}
+ S::a,
+ global9,
+ global10 = 0,
+ global11 == 0, // expected-error {{did you mean '='}}
+ global12 __attribute__(()),
+ global13(0),
+ global14[2],
+ global15;
+
+ void g() {
+ static int a,
+ b __asm__("ebx"), // expected-error {{expected ';' at end of declaration}}
+ Statics:return;
+ }
+}
+
+// PR5825
+struct test5 {};
+::new(static_cast<void*>(0)) test5; // expected-error {{expected unqualified-id}}
+
+
+// PR6782
+template<class T>
+class Class1;
+
+class Class2 {
+} // no ;
+
+typedef Class1<Class2> Type1; // expected-error {{cannot combine with previous 'class' declaration specifier}}
+
+// rdar : // 8307865
+struct CodeCompleteConsumer {
+};
+
+void CodeCompleteConsumer::() { // expected-error {{xpected unqualified-id}}
+}
+
+;
+
+// PR8380
+extern "" // expected-error {{unknown linkage language}}
+test6a { ;// expected-error {{C++ requires a type specifier for all declarations}} \
+ // expected-error {{expected ';' after top level declarator}}
+
+ int test6b;
+
+
diff --git a/clang/test/Parser/cxx-default-args.cpp b/clang/test/Parser/cxx-default-args.cpp
new file mode 100644
index 0000000..7fe8474
--- /dev/null
+++ b/clang/test/Parser/cxx-default-args.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR6647
+class C {
+ // After the error, the rest of the tokens inside the default arg should be
+ // skipped, avoiding a "expected ';' after class" after 'undecl'.
+ void m(int x = undecl + 0); // expected-error {{use of undeclared identifier 'undecl'}}
+};
+
+typedef struct Inst {
+ void m(int x=0);
+} *InstPtr;
+
+struct X {
+ void f(int x = 1:); // expected-error {{unexpected end of default argument expression}}
+};
diff --git a/clang/test/Parser/cxx-default-delete.cpp b/clang/test/Parser/cxx-default-delete.cpp
new file mode 100644
index 0000000..df24b3d
--- /dev/null
+++ b/clang/test/Parser/cxx-default-delete.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+int i = delete; // expected-error{{only functions}}
+int j = default; // expected-error{{special member functions}}
+
+int f() = delete, g; // expected-error{{'= delete' is a function definition}}
+int o, p() = delete; // expected-error{{'= delete' is a function definition}}
+
+int q() = default, r; // expected-error{{only special member functions}} \
+ // expected-error{{'= default' is a function definition}}
+int s, t() = default; // expected-error{{'= default' is a function definition}}
+
+struct foo {
+ foo() = default;
+ ~foo() = delete;
+ void bar() = delete;
+};
+
+void baz() = delete;
+
+struct quux {
+ int quux() = default; // expected-error{{constructor cannot have a return type}} expected-error {{member 'quux' has the same name as its class}}
+};
diff --git a/clang/test/Parser/cxx-ext-delete-default.cpp b/clang/test/Parser/cxx-ext-delete-default.cpp
new file mode 100644
index 0000000..af8b6d6
--- /dev/null
+++ b/clang/test/Parser/cxx-ext-delete-default.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+
+struct A {
+ A(const A&) = delete; // expected-warning {{C++11 extension}}
+ A& operator=(const A&) = delete; // expected-warning {{C++11 extension}}
+ A() = default; // expected-warning {{C++11 extension}}
+ ~A();
+};
+
+void f() = delete; // expected-warning {{C++11 extension}}
+A::~A() = default; //expected-warning {{C++11 extension}}
diff --git a/clang/test/Parser/cxx-extern-c-array.cpp b/clang/test/Parser/cxx-extern-c-array.cpp
new file mode 100644
index 0000000..14912fd
--- /dev/null
+++ b/clang/test/Parser/cxx-extern-c-array.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+extern "C" int myarray[];
+int myarray[12] = {0};
+
+extern "C" int anotherarray[][3];
+int anotherarray[2][3] = {1,2,3,4,5,6};
diff --git a/clang/test/Parser/cxx-friend.cpp b/clang/test/Parser/cxx-friend.cpp
new file mode 100644
index 0000000..a13e7ba
--- /dev/null
+++ b/clang/test/Parser/cxx-friend.cpp
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+class C {
+ friend class D;
+};
+
+class A {
+public:
+ void f();
+};
+
+friend int x; // expected-error {{'friend' used outside of class}}
+
+friend class D {}; // expected-error {{'friend' used outside of class}}
+
+union U {
+ int u1;
+};
+
+class B {
+ // 'A' here should refer to the declaration above.
+ friend class A;
+
+ friend C; // expected-warning {{specify 'class' to befriend}}
+ friend U; // expected-warning {{specify 'union' to befriend}}
+ friend int; // expected-warning {{non-class friend type 'int'}}
+
+ friend void myfunc();
+
+ void f(A *a) { a->f(); }
+};
+
+
+
+
+
+template <typename t1, typename t2> class some_template;
+friend // expected-error {{'friend' used outside of class}}
+some_template<foo, bar>& // expected-error {{use of undeclared identifier 'foo'}}
+ ; // expected-error {{expected unqualified-id}}
diff --git a/clang/test/Parser/cxx-in-c.c b/clang/test/Parser/cxx-in-c.c
new file mode 100644
index 0000000..f5fa39b
--- /dev/null
+++ b/clang/test/Parser/cxx-in-c.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR9137
+void f0(int x) : {}; // expected-error{{expected function body after function declarator}}
+void f1(int x) try {}; // expected-error{{expected function body after function declarator}}
diff --git a/clang/test/Parser/cxx-member-crash.cpp b/clang/test/Parser/cxx-member-crash.cpp
new file mode 100644
index 0000000..2b31a60
--- /dev/null
+++ b/clang/test/Parser/cxx-member-crash.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only %s 2>&1|FileCheck %s
+
+// <rdar://problem/9221993>
+
+// We only care to chek whether the compiler crashes; the actual
+// diagnostics are uninteresting.
+// CHECK: 8 errors generated.
+template<class _CharT> struct char_traits;
+template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ios;
+template<typename _CharT, typename _Traits = char_traits<_CharT> > class ostreambuf_iterator;
+template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> > class num_get;
+template<typename _CharT, typename _Traits> class basic_ostream : virtual public basic_ios<_CharT, _Traits> {
+ template<typename _CharT, typename _InIter> _InIter num_get<_CharT, _InIter>:: _M_extract_float(_InIter __beg, _InIter __end, ios_base& __io, ios_base::iostate& __err, string& __xtrc) const {
+ const bool __plus = __c == __lit[__num_base::_S_iplus];
+ if ((__plus || __c == __lit[__num_base::_S_iminus]) && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) && !(__c == __lc->_M_decimal_point)) {
diff --git a/clang/test/Parser/cxx-member-init-missing-paren-crash.cpp b/clang/test/Parser/cxx-member-init-missing-paren-crash.cpp
new file mode 100644
index 0000000..5485e7d
--- /dev/null
+++ b/clang/test/Parser/cxx-member-init-missing-paren-crash.cpp
@@ -0,0 +1,12 @@
+// RUN: not %clang_cc1 -fsyntax-only %s
+// Note: The important part here is that we don't crash, not any specific errors
+class Test {
+ public:
+ Test() : ab_(false {};
+
+ bool ab() {
+ return ab_;
+ }
+ private:
+ bool ab_;
+}
diff --git a/clang/test/Parser/cxx-member-initializers.cpp b/clang/test/Parser/cxx-member-initializers.cpp
new file mode 100644
index 0000000..5c39068
--- /dev/null
+++ b/clang/test/Parser/cxx-member-initializers.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct x {
+ x() : a(4) ; // expected-error {{expected '{'}}
+};
+
+struct y {
+ int a;
+ y() : a(4) ; // expected-error {{expected '{'}}
+};
+
+struct z {
+ int a;
+ z() : a {} // expected-error {{expected '('}}
+};
diff --git a/clang/test/Parser/cxx-namespace-alias.cpp b/clang/test/Parser/cxx-namespace-alias.cpp
new file mode 100644
index 0000000..9b90aab
--- /dev/null
+++ b/clang/test/Parser/cxx-namespace-alias.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+namespace A = B; // expected-error{{namespace name}}
+
+namespace A = !; // expected-error {{expected namespace name}}
+namespace A = A::!; // expected-error {{expected namespace name}} \
+ // expected-error{{use of undeclared identifier 'A'}}
+
+
diff --git a/clang/test/Parser/cxx-reference.cpp b/clang/test/Parser/cxx-reference.cpp
new file mode 100644
index 0000000..d21412c
--- /dev/null
+++ b/clang/test/Parser/cxx-reference.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+extern char *bork;
+char *& bar = bork;
+
+int val;
+
+void foo(int &a) {
+}
+
+typedef int & A;
+
+void g(const A aref) {
+}
+
+int & const X = val; // expected-error {{'const' qualifier may not be applied to a reference}}
+int & volatile Y = val; // expected-error {{'volatile' qualifier may not be applied to a reference}}
+int & const volatile Z = val; /* expected-error {{'const' qualifier may not be applied}} \
+ expected-error {{'volatile' qualifier may not be applied}} */
+
+typedef int && RV; // expected-warning {{rvalue references are a C++11 extension}}
diff --git a/clang/test/Parser/cxx-stmt.cpp b/clang/test/Parser/cxx-stmt.cpp
new file mode 100644
index 0000000..7677ca8
--- /dev/null
+++ b/clang/test/Parser/cxx-stmt.cpp
@@ -0,0 +1,60 @@
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
+
+void f1()
+{
+ try {
+ ;
+ } catch(int i) {
+ ;
+ } catch(...) {
+ }
+}
+
+void f2()
+{
+ try; // expected-error {{expected '{'}}
+
+ try {}
+ catch; // expected-error {{expected '('}}
+
+ try {}
+ catch (...); // expected-error {{expected '{'}}
+
+ try {}
+ catch {} // expected-error {{expected '('}}
+}
+
+void f3() try {
+} catch(...) {
+}
+
+struct A {
+ int i;
+ A(int);
+ A(char);
+ A() try : i(0) {} catch(...) {}
+ void f() try {} catch(...) {}
+ A(float) : i(0) try {} // expected-error {{expected '{' or ','}}
+};
+
+A::A(char) : i(0) try {} // expected-error {{expected '{' or ','}}
+A::A(int j) try : i(j) {} catch(...) {}
+
+
+
+// PR5740
+struct Type { };
+
+enum { Type } Kind;
+void f4() {
+ int i = 0;
+ switch (Kind) {
+ case Type: i = 7; break; // no error.
+ }
+}
+
+// PR5500
+void f5() {
+ asm volatile ("":: :"memory");
+ asm volatile ("": ::"memory");
+}
diff --git a/clang/test/Parser/cxx-template-argument.cpp b/clang/test/Parser/cxx-template-argument.cpp
new file mode 100644
index 0000000..c85b1c9
--- /dev/null
+++ b/clang/test/Parser/cxx-template-argument.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template<typename T> struct A {};
+
+// Check for template argument lists followed by junk
+// FIXME: The diagnostics here aren't great...
+A<int+> int x; // expected-error {{expected '>'}} expected-error {{expected unqualified-id}}
+A<int x; // expected-error {{expected '>'}}
+
+// PR8912
+template <bool> struct S {};
+S<bool(2 > 1)> s;
diff --git a/clang/test/Parser/cxx-template-decl.cpp b/clang/test/Parser/cxx-template-decl.cpp
new file mode 100644
index 0000000..7e931a3
--- /dev/null
+++ b/clang/test/Parser/cxx-template-decl.cpp
@@ -0,0 +1,115 @@
+// RUN: %clang_cc1 -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-warning {{exported templates are unsupported}}
+template < ; // expected-error {{expected template parameter}} \
+// expected-error{{expected ',' or '>' in template-parameter-list}} \
+// expected-warning {{declaration does not declare anything}}
+template <int +> struct x1; // expected-error {{expected ',' or '>' in template-parameter-list}}
+
+// verifies that we only walk to the ',' & still produce errors on the rest of the template parameters
+template <int +, T> struct x2; // expected-error {{expected ',' or '>' in template-parameter-list}} \
+ expected-error {{expected unqualified-id}}
+template<template<int+>> struct x3; // expected-error {{expected ',' or '>' in template-parameter-list}} \
+ expected-error {{template template parameter requires 'class' after the parameter list}}
+template <template X> struct Err1; // expected-error {{expected '<' after 'template'}} \
+// expected-error{{extraneous}}
+template <template <typename> > struct Err2; // expected-error {{template template parameter requires 'class' after the parameter list}}
+template <template <typename> Foo> struct Err3; // expected-error {{template template parameter requires 'class' after the parameter list}}
+
+// Template function declarations
+template <typename T> void foo();
+template <typename T, typename U> void foo();
+
+// Template function definitions.
+template <typename T> void foo() { }
+
+// Template class (forward) declarations
+template <typename T> struct A;
+template <typename T, typename U> struct b;
+template <typename> struct C;
+template <typename, typename> struct D;
+
+// Forward declarations with default parameters?
+template <typename T = int> class X1;
+template <typename = int> class X2;
+
+// Forward declarations w/template template parameters
+template <template <typename> class T> class TTP1;
+template <template <typename> class> class TTP2;
+template <template <typename> class T = foo> class TTP3; // expected-error{{must be a class template}}
+template <template <typename> class = foo> class TTP3; // expected-error{{must be a class template}}
+template <template <typename X, typename Y> class T> class TTP5;
+
+// Forward declarations with non-type params
+template <int> class NTP0;
+template <int N> class NTP1;
+template <int N = 5> class NTP2;
+template <int = 10> class NTP3;
+template <unsigned int N = 12u> class NTP4;
+template <unsigned int = 12u> class NTP5;
+template <unsigned = 15u> class NTP6;
+template <typename T, T Obj> class NTP7;
+
+// Template class declarations
+template <typename T> struct A { };
+template <typename T, typename U> struct B { };
+
+// Template parameter shadowing
+template<typename T, // expected-note{{template parameter is declared here}}
+ typename T> // expected-error{{declaration of 'T' shadows template parameter}}
+ void shadow1();
+
+template<typename T> // expected-note{{template parameter is declared here}}
+void shadow2(int T); // expected-error{{declaration of 'T' shadows template parameter}}
+
+template<typename T> // expected-note{{template parameter is declared here}}
+class T { // expected-error{{declaration of 'T' shadows template parameter}}
+};
+
+template<int Size> // expected-note{{template parameter is declared here}}
+void shadow3(int Size); // expected-error{{declaration of 'Size' shadows template parameter}}
+
+// <rdar://problem/6952203>
+template<typename T> // expected-note{{here}}
+struct shadow4 {
+ int T; // expected-error{{shadows}}
+};
+
+template<typename T> // expected-note{{here}}
+struct shadow5 {
+ int T(int, float); // expected-error{{shadows}}
+};
+
+// Non-type template parameters in scope
+template<int Size>
+void f(int& i) {
+ i = Size;
+ Size = i; // expected-error{{expression is not assignable}}
+}
+
+template<typename T>
+const T& min(const T&, const T&);
+
+void f2() {
+ int x;
+ A< typeof(x>1) > a;
+}
+
+
+// PR3844
+template <> struct S<int> { }; // expected-error{{explicit specialization of non-template struct 'S'}}
+
+namespace PR6184 {
+ namespace N {
+ template <typename T>
+ void bar(typename T::x);
+ }
+
+ template <typename T>
+ void N::bar(typename T::x) { }
+}
diff --git a/clang/test/Parser/cxx-throw.cpp b/clang/test/Parser/cxx-throw.cpp
new file mode 100644
index 0000000..d63b6d4
--- /dev/null
+++ b/clang/test/Parser/cxx-throw.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
+
+int i;
+
+void foo() {
+ (throw,throw);
+ (1 ? throw 1 : throw 2);
+ throw int(1);
+ throw;
+ throw 1;
+ throw;
+ 1 ? throw : (void)42;
+ __extension__ throw 1; // expected-error {{expected expression}}
+ (void)throw; // expected-error {{expected expression}}
+}
diff --git a/clang/test/Parser/cxx-typeid.cpp b/clang/test/Parser/cxx-typeid.cpp
new file mode 100644
index 0000000..e726665
--- /dev/null
+++ b/clang/test/Parser/cxx-typeid.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// FIXME: This should really include <typeinfo>, but we don't have that yet.
+namespace std {
+ class type_info;
+}
+
+void f()
+{
+ (void)typeid(int);
+ (void)typeid(0);
+ (void)typeid 1; // expected-error {{expected '(' after 'typeid'}}
+}
diff --git a/clang/test/Parser/cxx-typeof.cpp b/clang/test/Parser/cxx-typeof.cpp
new file mode 100644
index 0000000..1ec6e29
--- /dev/null
+++ b/clang/test/Parser/cxx-typeof.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+static void test() {
+ int *pi;
+ int x;
+ typeof pi[x] y;
+}
+
+// Part of rdar://problem/8347416; from the gcc test suite.
+struct S {
+ int i;
+ __typeof(S::i) foo(); // expected-error {{invalid use of non-static data member 'i'}}
+};
diff --git a/clang/test/Parser/cxx-undeclared-identifier.cpp b/clang/test/Parser/cxx-undeclared-identifier.cpp
new file mode 100644
index 0000000..f15deab
--- /dev/null
+++ b/clang/test/Parser/cxx-undeclared-identifier.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+
+// PR7180
+int f(a::b::c); // expected-error {{use of undeclared identifier 'a'}}
+
+class Foo::Bar { // expected-error {{use of undeclared identifier 'Foo'}} \
+ // expected-note {{to match this '{'}} \
+ // expected-error {{expected ';' after class}}
+ // expected-error {{expected '}'}}
diff --git a/clang/test/Parser/cxx-using-declaration.cpp b/clang/test/Parser/cxx-using-declaration.cpp
new file mode 100644
index 0000000..2b2a69d
--- /dev/null
+++ b/clang/test/Parser/cxx-using-declaration.cpp
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+namespace A {
+ int VA;
+ void FA() {}
+ struct SA { int V; };
+}
+
+using A::VA;
+using A::FA;
+using typename A::SA;
+
+int main()
+{
+ VA = 1;
+ FA();
+ SA x; //Still needs handling.
+}
+
+struct B {
+ void f(char){};
+ void g(char){};
+};
+struct D : B {
+ using B::f;
+ void f(int);
+ void g(int);
+};
+void D::f(int) { f('c'); } // calls B::f(char)
+void D::g(int) { g('c'); } // recursively calls D::g(int)
+
+namespace E {
+ template <typename TYPE> int funcE(TYPE arg) { return(arg); }
+}
+
+using E::funcE<int>; // expected-error{{using declaration can not refer to a template specialization}}
+
+namespace F {
+ struct X;
+}
+
+using F::X;
+// Should have some errors here. Waiting for implementation.
+void X(int);
+struct X *x;
diff --git a/clang/test/Parser/cxx-using-directive.cpp b/clang/test/Parser/cxx-using-directive.cpp
new file mode 100644
index 0000000..1d781fb
--- /dev/null
+++ b/clang/test/Parser/cxx-using-directive.cpp
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+class A {};
+
+namespace B {
+ namespace A {} // expected-note{{namespace '::B::A' defined here}}
+ using namespace A ;
+}
+
+namespace C {}
+
+namespace D {
+
+ class C {
+
+ using namespace B ; // expected-error{{not allowed}}
+ };
+
+ namespace B {}
+
+ using namespace C ;
+ using namespace B::A ; // expected-error{{no namespace named 'A' in namespace 'D::B'; did you mean '::B::A'?}}
+ using namespace ::B::A ;
+ using namespace ::D::C ; // expected-error{{expected namespace name}}
+}
+
+using namespace ! ; // expected-error{{expected namespace name}}
+using namespace A ; // expected-error{{expected namespace name}}
+using namespace ::A // expected-error{{expected namespace name}} \
+ // expected-error{{expected ';' after namespace name}}
+ B ;
+
+void test_nslookup() {
+ int B;
+ class C;
+ using namespace B;
+ using namespace C;
+}
diff --git a/clang/test/Parser/cxx-variadic-func.cpp b/clang/test/Parser/cxx-variadic-func.cpp
new file mode 100644
index 0000000..b9360d6
--- /dev/null
+++ b/clang/test/Parser/cxx-variadic-func.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only %s
+
+void f(...) {
+ int g(int(...));
+}
diff --git a/clang/test/Parser/cxx0x-ambig.cpp b/clang/test/Parser/cxx0x-ambig.cpp
new file mode 100644
index 0000000..98757b4
--- /dev/null
+++ b/clang/test/Parser/cxx0x-ambig.cpp
@@ -0,0 +1,127 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+// New exciting ambiguities in C++11
+
+// final 'context sensitive' mess.
+namespace final {
+ struct S { int n; };
+ struct T { int n; };
+ namespace N {
+ int n;
+ // These declare variables named final..
+ extern struct S final;
+ extern struct S final [[]];
+ extern struct S final, foo;
+ struct S final = S();
+
+ // This defines a class, not a variable, even though it would successfully
+ // parse as a variable but not as a class. DR1318's wording suggests that
+ // this disambiguation is only performed on an ambiguity, but that was not
+ // the intent.
+ struct S final { // expected-note {{here}}
+ int(n) // expected-error {{expected ';'}}
+ };
+ // This too.
+ struct T final : S {}; // expected-error {{base 'S' is marked 'final'}}
+ struct T bar : S {}; // expected-error {{expected ';' after top level declarator}} expected-error {{expected unqualified-id}}
+ }
+}
+
+// enum versus bitfield mess.
+namespace bitfield {
+ enum E {};
+
+ struct T {
+ constexpr T() {}
+ constexpr T(int) {}
+ constexpr T(T, T, T, T) {}
+ constexpr T operator=(T) { return *this; }
+ constexpr operator int() { return 4; }
+ };
+ constexpr T a, b, c, d;
+
+ struct S1 {
+ enum E : T ( a = 1, b = 2, c = 3, 4 ); // ok, declares a bitfield
+ };
+ // This could be a bit-field.
+ struct S2 {
+ enum E : T { a = 1, b = 2, c = 3, 4 }; // expected-error {{non-integral type}} expected-error {{expected '}'}} expected-note {{to match}}
+ };
+ struct S3 {
+ enum E : int { a = 1, b = 2, c = 3, d }; // ok, defines an enum
+ };
+ // Ambiguous.
+ struct S4 {
+ enum E : int { a = 1 }; // ok, defines an enum
+ };
+ // This could be a bit-field, but would be ill-formed due to the anonymous
+ // member being initialized.
+ struct S5 {
+ enum E : int { a = 1 } { b = 2 }; // expected-error {{expected member name}}
+ };
+ // This could be a bit-field.
+ struct S6 {
+ enum E : int { 1 }; // expected-error {{expected '}'}} expected-note {{to match}}
+ };
+
+ struct U {
+ constexpr operator T() { return T(); } // expected-note 2{{candidate}}
+ };
+ // This could be a bit-field.
+ struct S7 {
+ enum E : int { a = U() }; // expected-error {{no viable conversion}}
+ };
+ // This could be a bit-field, and does not conform to the grammar of an
+ // enum definition, because 'id(U())' is not a constant-expression.
+ constexpr const U &id(const U &u) { return u; }
+ struct S8 {
+ enum E : int { a = id(U()) }; // expected-error {{no viable conversion}}
+ };
+}
+
+namespace trailing_return {
+ typedef int n;
+ int a;
+
+ struct S {
+ S(int);
+ S *operator()() const;
+ int n;
+ };
+
+ namespace N {
+ void f() {
+ // This parses as a function declaration, but DR1223 makes the presence of
+ // 'auto' be used for disambiguation.
+ S(a)()->n; // ok, expression; expected-warning{{expression result unused}}
+ auto(a)()->n; // ok, function declaration
+ using T = decltype(a);
+ using T = auto() -> n;
+ }
+ }
+}
+
+namespace ellipsis {
+ template<typename...T>
+ struct S {
+ void e(S::S());
+ void f(S(...args[sizeof(T)])); // expected-note {{here}}
+ void f(S(...args)[sizeof(T)]); // expected-error {{redeclared}} expected-note {{here}}
+ void f(S ...args[sizeof(T)]); // expected-error {{redeclared}}
+ void g(S(...[sizeof(T)])); // expected-note {{here}}
+ void g(S(...)[sizeof(T)]); // expected-error {{function cannot return array type}}
+ void g(S ...[sizeof(T)]); // expected-error {{redeclared}}
+ void h(T(...)); // function type, expected-error {{unexpanded parameter pack}}
+ void h(T...); // pack expansion, ok
+ void i(int(T...)); // expected-note {{here}}
+ void i(int(T...a)); // expected-error {{redeclared}}
+ void i(int(T, ...)); // function type, expected-error {{unexpanded parameter pack}}
+ void i(int(T, ...a)); // expected-error {{expected ')'}} expected-note {{to match}} expected-error {{unexpanded parameter pack}}
+ void j(int(int...)); // function type, ok
+ void j(int(int...a)); // expected-error {{does not contain any unexpanded parameter packs}}
+ void j(T(int...)); // expected-error {{unexpanded parameter pack}}
+ void j(T(T...)); // expected-error {{unexpanded parameter pack}}
+ void k(int(...)(T)); // expected-error {{cannot return function type}}
+ void k(int ...(T));
+ };
+}
diff --git a/clang/test/Parser/cxx0x-attributes.cpp b/clang/test/Parser/cxx0x-attributes.cpp
new file mode 100644
index 0000000..f97995e
--- /dev/null
+++ b/clang/test/Parser/cxx0x-attributes.cpp
@@ -0,0 +1,83 @@
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s
+
+// Declaration syntax checks
+[[]] int before_attr;
+int [[]] between_attr;
+int after_attr [[]];
+int * [[]] ptr_attr;
+int & [[]] ref_attr = after_attr;
+int && [[]] rref_attr = 0;
+int array_attr [1] [[]];
+alignas(8) int aligned_attr;
+[[test::valid(for 42 [very] **** '+' symbols went on a trip; the end.)]]
+ int garbage_attr;
+[[,,,static, class, namespace,, inline, constexpr, mutable,, bi\
+tand, bitor::compl(!.*_ Cx.!U^*R),,,]] int more_garbage_attr;
+[[u8"invalid!"]] int invalid_string_attr; // expected-error {{expected ']'}}
+void fn_attr () [[]];
+void noexcept_fn_attr () noexcept [[]];
+struct MemberFnOrder {
+ virtual void f() const volatile && noexcept [[]] final = 0;
+};
+class [[]] class_attr {};
+extern "C++" [[]] int extern_attr;
+template <typename T> [[]] void template_attr ();
+[[]] [[]] int [[]] [[]] multi_attr [[]] [[]];
+
+int comma_attr [[,]];
+int scope_attr [[foo::]]; // expected-error {{expected identifier}}
+int (paren_attr) [[]]; // expected-error {{an attribute list cannot appear here}}
+unsigned [[]] int attr_in_decl_spec; // expected-error {{expected unqualified-id}}
+class foo {
+ void const_after_attr () [[]] const; // expected-error {{expected ';'}}
+};
+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}} expected-note {{declared 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
+alignas int aligned_no_params; // expected-error {{expected '('}}
+alignas(i) int aligned_nonconst; // expected-error {{'aligned' attribute requires integer constant}} expected-note {{read of non-const variable 'i'}}
+
+// 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}}
+ }
+ struct S { int arr[2]; } s;
+ (void)s.arr[ [] { return 0; }() ]; // expected-error {{C++11 only allows consecutive left square brackets when introducing an attribute}}
+ int n = __builtin_offsetof(S, arr[ [] { return 0; }() ]); // expected-error {{C++11 only allows consecutive left square brackets when introducing an attribute}}
+
+ void bar [[noreturn]] ([[]] int i, [[]] int j);
+ using FuncType = void ([[]] int);
+ void baz([[]]...); // expected-error {{expected parameter declarator}}
+
+ [[]] return;
+}
+
+template<typename...Ts> void variadic() {
+ void bar [[noreturn...]] (); // expected-error {{attribute 'noreturn' cannot be used as an attribute pack}}
+}
diff --git a/clang/test/Parser/cxx0x-condition.cpp b/clang/test/Parser/cxx0x-condition.cpp
new file mode 100644
index 0000000..e45cd86
--- /dev/null
+++ b/clang/test/Parser/cxx0x-condition.cpp
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+struct S { S(int); operator bool(); };
+
+void f() {
+ int a;
+ typedef int n;
+
+ while (a) ;
+ while (int x) ; // expected-error {{variable declaration in condition must have an initializer}}
+ while (float x = 0) ;
+ if (const int x = a) ; // expected-warning{{empty body}} expected-note{{put the semicolon on a separate line to silence this warning}}
+ switch (int x = a+10) {}
+ for (; int x = ++a; ) ;
+
+ if (S(a)) {} // ok
+ if (S(a) = 0) {} // ok
+ if (S(a) == 0) {} // ok
+
+ if (S(n)) {} // expected-error {{unexpected type name 'n': expected expression}}
+ if (S(n) = 0) {} // ok
+ if (S(n) == 0) {} // expected-error {{unexpected type name 'n': expected expression}}
+
+ if (S b(a)) {} // expected-error {{variable declaration in condition cannot have a parenthesized initializer}}
+
+ if (S b(n)) {} // expected-error {{a function type is not allowed here}} expected-error {{must have an initializer}}
+ if (S b(n) = 0) {} // expected-error {{a function type is not allowed here}}
+ if (S b(n) == 0) {} // expected-error {{a function type is not allowed here}} expected-error {{did you mean '='?}}
+
+ if (S{a}) {} // ok
+ if (S a{a}) {} // ok
+ if (S a = {a}) {} // ok
+ if (S a == {a}) {} // expected-error {{did you mean '='?}}
+
+ if (S(b){a}) {} // ok
+ if (S(b) = {a}) {} // ok
+}
diff --git a/clang/test/Parser/cxx0x-decl.cpp b/clang/test/Parser/cxx0x-decl.cpp
new file mode 100644
index 0000000..b9f5141
--- /dev/null
+++ b/clang/test/Parser/cxx0x-decl.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -verify -fsyntax-only -std=c++0x %s
+
+// Make sure we know these are legitimate commas and not typos for ';'.
+namespace Commas {
+ int a,
+ b [[ ]],
+ c alignas(double);
+}
+
+struct S {};
+enum E { e };
+
+auto f() -> struct S {
+ return S();
+}
+auto g() -> enum E {
+ return E();
+}
diff --git a/clang/test/Parser/cxx0x-for-range.cpp b/clang/test/Parser/cxx0x-for-range.cpp
new file mode 100644
index 0000000..f920ef9
--- /dev/null
+++ b/clang/test/Parser/cxx0x-for-range.cpp
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+template<typename T, typename U>
+struct pair {};
+
+template<typename T, typename U>
+struct map {
+ typedef pair<T,U> *iterator;
+ iterator begin();
+ iterator end();
+};
+
+template<typename T, typename U>
+pair<T,U> &tie(T &, U &);
+
+int foo(map<char*,int> &m) {
+ char *p;
+ int n;
+
+ for (pair<char*,int> x : m) {
+ (void)x;
+ }
+
+ for (tie(p, n) : m) { // expected-error {{for range declaration must declare a variable}}
+ (void)p;
+ (void)n;
+ }
+
+ return n;
+}
diff --git a/clang/test/Parser/cxx0x-in-cxx98.cpp b/clang/test/Parser/cxx0x-in-cxx98.cpp
new file mode 100644
index 0000000..b4bda89
--- /dev/null
+++ b/clang/test/Parser/cxx0x-in-cxx98.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify %s
+
+inline namespace N { // expected-warning{{inline namespaces are a C++11 feature}}
+struct X {
+ template<typename ...Args> // expected-warning{{variadic templates are a C++11 extension}}
+ void f(Args &&...) &; // expected-warning{{rvalue references are a C++11 extension}} \
+ // expected-warning{{reference qualifiers on functions are a C++11 extension}}
+};
+}
+
+struct B {
+ virtual void f();
+ virtual void g();
+};
+struct D final : B { // expected-warning {{'final' keyword is a C++11 extension}}
+ virtual void f() override; // expected-warning {{'override' keyword is a C++11 extension}}
+ virtual void g() final; // expected-warning {{'final' keyword is a C++11 extension}}
+};
+
+void NewBracedInitList() {
+ // A warning on this would be sufficient once we can handle it correctly.
+ new int {}; // expected-error {{}}
+}
diff --git a/clang/test/Parser/cxx0x-lambda-expressions.cpp b/clang/test/Parser/cxx0x-lambda-expressions.cpp
new file mode 100644
index 0000000..9c71941
--- /dev/null
+++ b/clang/test/Parser/cxx0x-lambda-expressions.cpp
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify -std=c++11 %s
+
+enum E { e };
+
+class C {
+
+ int f() {
+ int foo, bar;
+
+ []; // expected-error {{expected body of lambda expression}}
+ [+] {}; // expected-error {{expected variable name or 'this' in lambda capture list}}
+ [foo+] {}; // expected-error {{expected ',' or ']' in lambda capture list}}
+ [foo,&this] {}; // expected-error {{'this' cannot be captured by reference}}
+ [&this] {}; // expected-error {{'this' cannot be captured by reference}}
+ [&,] {}; // expected-error {{expected variable name or 'this' in lambda capture list}}
+ [=,] {}; // expected-error {{expected variable name or 'this' in lambda capture list}}
+ [] {};
+ [=] (int i) {};
+ [&] (int) mutable -> void {};
+ [foo,bar] () { return 3; };
+ [=,&foo] () {};
+ [&,foo] () {};
+ [this] () {};
+ [] () -> class C { return C(); };
+ [] () -> enum E { return e; };
+
+ [] -> int { return 0; }; // expected-error{{lambda requires '()' before return type}}
+ [] mutable -> int { return 0; }; // expected-error{{lambda requires '()' before 'mutable'}}
+ return 1;
+ }
+
+ void designator_or_lambda() {
+ typedef int T;
+ const int b = 0;
+ const int c = 1;
+ int a1[1] = {[b] (T()) {}}; // expected-error{{no viable conversion from 'C::<lambda}}
+ int a2[1] = {[b] = 1 };
+ int a3[1] = {[b,c] = 1 }; // expected-error{{expected body of lambda expression}}
+ int a4[1] = {[&b] = 1 }; // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'const int *'}}
+ int a5[3] = { []{return 0;}() };
+ int a6[1] = {[this] = 1 }; // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'C *'}}
+ }
+};
diff --git a/clang/test/Parser/cxx0x-literal-operators.cpp b/clang/test/Parser/cxx0x-literal-operators.cpp
new file mode 100644
index 0000000..1881fcb
--- /dev/null
+++ b/clang/test/Parser/cxx0x-literal-operators.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+void operator "" (const char *); // expected-error {{expected identifier}}
+void operator "k" foo(const char *); // \
+ expected-error {{string literal after 'operator' must be '""'}} \
+ expected-warning{{user-defined literal suffixes not starting with '_' are reserved}}
+void operator "" tester (const char *); // \
+ expected-warning{{user-defined literal suffixes not starting with '_' are reserved}}
diff --git a/clang/test/Parser/cxx0x-member-initializers.cpp b/clang/test/Parser/cxx0x-member-initializers.cpp
new file mode 100644
index 0000000..a324f97
--- /dev/null
+++ b/clang/test/Parser/cxx0x-member-initializers.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+// Make sure we don't run off the end of the stream when parsing a deferred
+// initializer.
+int a; // expected-note {{previous}}
+struct S {
+ int n = 4 + ; // expected-error {{expected expression}}
+} a; // expected-error {{redefinition}}
+
+// Make sure we use all of the tokens.
+struct T {
+ int a = 1 // expected-error {{expected ';' at end of declaration list}}
+ int b = 2;
+ int c = b; // expected-error {{undeclared identifier}}
+};
+
+// Test recovery for bad constructor initializers
+
+struct R1 {
+ int a;
+ R1() : a {}
+}; // expected-error {{expected '{' or ','}}
+
+// Test correct parsing.
+
+struct V1 {
+ int a, b;
+ V1() : a(), b{} {}
+};
diff --git a/clang/test/Parser/cxx0x-override-control-keywords.cpp b/clang/test/Parser/cxx0x-override-control-keywords.cpp
new file mode 100644
index 0000000..444862a
--- /dev/null
+++ b/clang/test/Parser/cxx0x-override-control-keywords.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+struct Base {
+ virtual void override();
+};
+
+struct S : Base {
+ virtual void final() final;
+ virtual void override() override;
+};
+
+struct T {
+ // virt-specifier-seq is only valid in member-declarators, and a function definition is not a member-declarator.
+ // FIXME: This currently doesn't work.
+ // virtual void f() const override { }
+};
+
+struct override;
+struct Base2 {
+ virtual override override(int override);
+};
+
+struct A : Base2 {
+ virtual struct override override(int override) override;
+};
diff --git a/clang/test/Parser/cxx0x-rvalue-reference.cpp b/clang/test/Parser/cxx0x-rvalue-reference.cpp
new file mode 100644
index 0000000..e57e601
--- /dev/null
+++ b/clang/test/Parser/cxx0x-rvalue-reference.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+int && r1(int &&a);
+
+typedef int && R;
+void r2(const R a) {
+ int & &&ar = a; // expected-error{{'ar' declared as a reference to a reference}}
+}
+
diff --git a/clang/test/Parser/cxx11-stmt-attributes.cpp b/clang/test/Parser/cxx11-stmt-attributes.cpp
new file mode 100644
index 0000000..fab5621
--- /dev/null
+++ b/clang/test/Parser/cxx11-stmt-attributes.cpp
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s
+
+void foo(int i) {
+
+ [[unknown_attribute]] ;
+ [[unknown_attribute]] { }
+ [[unknown_attribute]] if (0) { }
+ [[unknown_attribute]] for (;;);
+ [[unknown_attribute]] do {
+ [[unknown_attribute]] continue;
+ } while (0);
+ [[unknown_attribute]] while (0);
+
+ [[unknown_attribute]] switch (i) {
+ [[unknown_attribute]] case 0:
+ [[unknown_attribute]] default:
+ [[unknown_attribute]] break;
+ }
+
+ [[unknown_attribute]] goto here;
+ [[unknown_attribute]] here:
+
+ [[unknown_attribute]] try {
+ } catch (...) {
+ }
+
+ [[unknown_attribute]] return;
+
+
+ alignas(8) ; // expected-warning {{attribute aligned cannot be specified on a statement}}
+ [[noreturn]] { } // expected-warning {{attribute noreturn cannot be specified on a statement}}
+ [[noreturn]] if (0) { } // expected-warning {{attribute noreturn cannot be specified on a statement}}
+ [[noreturn]] for (;;); // expected-warning {{attribute noreturn cannot be specified on a statement}}
+ [[noreturn]] do { // expected-warning {{attribute noreturn cannot be specified on a statement}}
+ [[unavailable]] continue; // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
+ } while (0);
+ [[unknown_attributqqq]] while (0); // TODO: remove 'qqq' part and enjoy 'empty loop body' warning here (DiagnoseEmptyLoopBody)
+ [[unknown_attribute]] while (0); // no warning here yet, just an unknown attribute
+
+ [[unused]] switch (i) { // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
+ [[uuid]] case 0: // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
+ [[visibility]] default: // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
+ [[carries_dependency]] break; // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
+ }
+
+ [[fastcall]] goto there; // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
+ [[noinline]] there: // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
+
+ [[lock_returned]] try { // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
+ } catch (...) {
+ }
+
+ [[weakref]] return; // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
+}
diff --git a/clang/test/Parser/cxx11-type-specifier.cpp b/clang/test/Parser/cxx11-type-specifier.cpp
new file mode 100644
index 0000000..2e629f3
--- /dev/null
+++ b/clang/test/Parser/cxx11-type-specifier.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -verify %s -std=c++11 -fcxx-exceptions
+
+// Tests for parsing of type-specifier-seq
+
+struct S {
+ operator constexpr int(); // expected-error{{type name does not allow constexpr}}
+};
+enum E { e };
+
+void f() {
+ try {
+ (void) new constexpr int; // expected-error{{type name does not allow constexpr}}
+ } catch (constexpr int) { // expected-error{{type name does not allow constexpr}}
+ }
+
+ // These parse as type definitions, not as type references with braced
+ // initializers. Sad but true...
+ (void) new struct S {}; // expected-error{{'S' can not be defined in a type specifier}}
+ (void) new enum E { e }; // expected-error{{'E' can not be defined in a type specifier}}
+}
diff --git a/clang/test/Parser/cxx11-user-defined-literals.cpp b/clang/test/Parser/cxx11-user-defined-literals.cpp
new file mode 100644
index 0000000..49fea01
--- /dev/null
+++ b/clang/test/Parser/cxx11-user-defined-literals.cpp
@@ -0,0 +1,112 @@
+// RUN: %clang_cc1 -std=c++11 -verify %s -fms-extensions -triple x86_64-apple-darwin9.0.0
+
+// A ud-suffix cannot be used on string literals in a whole bunch of contexts:
+
+#include "foo"_bar // expected-error {{expected "FILENAME" or <FILENAME>}}
+#line 1 "foo"_bar // expected-error {{user-defined suffix cannot be used here}}
+# 1 "foo"_bar 1 // expected-error {{user-defined suffix cannot be used here}}
+#ident "foo"_bar // expected-error {{user-defined suffix cannot be used here}}
+_Pragma("foo"_bar) // expected-error {{user-defined suffix cannot be used here}}
+#pragma comment(lib, "foo"_bar) // expected-error {{user-defined suffix cannot be used here}}
+_Pragma("comment(lib, \"foo\"_bar)") // expected-error {{user-defined suffix cannot be used here}}
+#pragma message "hi"_there // expected-error {{user-defined suffix cannot be used here}} expected-warning {{hi}}
+#pragma push_macro("foo"_bar) // expected-error {{user-defined suffix cannot be used here}}
+#if __has_warning("-Wan-island-to-discover"_bar) // expected-error {{user-defined suffix cannot be used here}}
+#elif __has_include("foo"_bar) // expected-error {{expected "FILENAME" or <FILENAME>}}
+#endif
+
+extern "C++"_x {} // expected-error {{user-defined suffix cannot be used here}} expected-error {{unknown linkage language}}
+
+int f() {
+ asm("mov %eax, %rdx"_foo); // expected-error {{user-defined suffix cannot be used here}}
+}
+
+static_assert(true, "foo"_bar); // expected-error {{user-defined suffix cannot be used here}}
+
+int cake() __attribute__((availability(macosx, unavailable, message = "is a lie"_x))); // expected-error {{user-defined suffix cannot be used here}}
+
+// A ud-suffix cannot be used on character literals in preprocessor constant
+// expressions:
+#if 'x'_y - u'x'_z // expected-error 2{{character literal with user-defined suffix cannot be used in preprocessor constant expression}}
+#error error
+#endif
+
+// A ud-suffix cannot be used on integer literals in preprocessor constant
+// expressions:
+#if 0_foo // expected-error {{integer literal with user-defined suffix cannot be used in preprocessor constant expression}}
+#error error
+#endif
+
+// But they can appear in expressions.
+constexpr char operator"" _id(char c) { return c; }
+constexpr wchar_t operator"" _id(wchar_t c) { return c; }
+constexpr char16_t operator"" _id(char16_t c) { return c; }
+constexpr char32_t operator"" _id(char32_t c) { return c; }
+
+using size_t = decltype(sizeof(int));
+constexpr const char operator"" _id(const char *p, size_t n) { return *p; }
+constexpr const wchar_t operator"" _id(const wchar_t *p, size_t n) { return *p; }
+constexpr const char16_t operator"" _id(const char16_t *p, size_t n) { return *p; }
+constexpr const char32_t operator"" _id(const char32_t *p, size_t n) { return *p; }
+
+constexpr unsigned long long operator"" _id(unsigned long long n) { return n; }
+constexpr long double operator"" _id(long double d) { return d; }
+
+template<int n> struct S {};
+S<"a"_id> sa;
+S<L"b"_id> sb;
+S<u8"c"_id> sc;
+S<u"d"_id> sd;
+S<U"e"_id> se;
+
+S<'w'_id> sw;
+S<L'x'_id> sx;
+S<u'y'_id> sy;
+S<U'z'_id> sz;
+
+S<100_id> sn;
+S<(int)1.3_id> sf;
+
+void h() {
+ (void)"test"_id "test" L"test";
+}
+
+// Test source location for suffix is known
+const char *p =
+ "foo\nbar" R"x(
+ erk
+ flux
+ )x" "eep\x1f"\
+_no_such_suffix // expected-error {{'operator "" _no_such_suffix'}}
+"and a bit more"
+"and another suffix"_no_such_suffix;
+
+char c =
+ '\x14'\
+_no_such_suffix; // expected-error {{'operator "" _no_such_suffix'}}
+
+int &r =
+1234567\
+_no_such_suffix; // expected-error {{'operator "" _no_such_suffix'}}
+
+int k =
+1234567.89\
+_no_such_suffix; // expected-error {{'operator "" _no_such_suffix'}}
+
+// Make sure we handle more interesting ways of writing a string literal which
+// is "" in translation phase 7.
+void operator "\
+" _foo(unsigned long long); // ok
+
+void operator R"xyzzy()xyzzy" _foo(long double); // ok
+
+void operator"" "" R"()" "" _foo(const char *); // ok
+
+// Ensure we diagnose the bad cases.
+void operator "\0" _non_empty(const char *); // expected-error {{must be '""'}}
+void operator ""_no_space(const char *); // expected-error {{C++11 requires a space}}
+void operator L"" _not_char(const char *); // expected-error {{cannot have an encoding prefix}}
+void operator "" ""
+U"" // expected-error {{cannot have an encoding prefix}}
+"" _also_not_char(const char *);
+void operator "" u8"" "\u0123" "hello"_all_of_the_things ""(const char*); // expected-error {{must be '""'}}
diff --git a/clang/test/Parser/declarators.c b/clang/test/Parser/declarators.c
new file mode 100644
index 0000000..a7a01d8
--- /dev/null
+++ b/clang/test/Parser/declarators.c
@@ -0,0 +1,102 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
+
+extern int a1[];
+
+void f0();
+void f1(int [*]);
+void f2(int [const *]);
+void f3(int [volatile const*]);
+int f4(*XX)(void); /* expected-error {{cannot return}} expected-warning {{type specifier missing, defaults to 'int'}} */
+
+char ((((*X))));
+
+void (*signal(int, void (*)(int)))(int);
+
+int aaaa, ***C, * const D, B(int);
+
+int *A;
+
+struct str;
+
+void test2(int *P, int A) {
+ struct str;
+
+ // Hard case for array decl, not Array[*].
+ int Array[*(int*)P+A];
+}
+
+typedef int atype;
+void test3(x,
+ atype /* expected-error {{unexpected type name 'atype': expected identifier}} */
+ ) int x, atype; {}
+
+void test4(x, x) int x; {} /* expected-error {{redefinition of parameter 'x'}} */
+
+
+// PR3031
+int (test5), ; // expected-error {{expected identifier or '('}}
+
+
+
+// PR3963 & rdar://6759604 - test error recovery for mistyped "typenames".
+
+foo_t *d; // expected-error {{unknown type name 'foo_t'}}
+foo_t a; // expected-error {{unknown type name 'foo_t'}}
+int test6() { return a; } // a should be declared.
+
+// Use of tagged type without tag. rdar://6783347
+struct xyz { int y; };
+enum myenum { ASDFAS };
+xyz b; // expected-error {{must use 'struct' tag to refer to type 'xyz'}}
+myenum c; // expected-error {{must use 'enum' tag to refer to type 'myenum'}}
+
+float *test7() {
+ // We should recover 'b' by parsing it with a valid type of "struct xyz", which
+ // allows us to diagnose other bad things done with y, such as this.
+ return &b.y; // expected-warning {{incompatible pointer types returning 'int *' from a function with result type 'float *'}}
+}
+
+struct xyz test8() { return a; } // a should be be marked invalid, no diag.
+
+
+// Verify that implicit int still works.
+static f; // expected-warning {{type specifier missing, defaults to 'int'}}
+static g = 4; // expected-warning {{type specifier missing, defaults to 'int'}}
+static h // expected-warning {{type specifier missing, defaults to 'int'}}
+ __asm__("foo");
+
+
+struct test9 {
+ int x // expected-error {{expected ';' at end of declaration list}}
+ int y;
+ int z // expected-warning {{expected ';' at end of declaration list}}
+};
+
+// PR6208
+struct test10 { int a; } static test10x;
+struct test11 { int a; } const test11x;
+
+// PR6216
+void test12() {
+ (void)__builtin_offsetof(struct { char c; int i; }, i);
+}
+
+// rdar://7608537
+struct test13 { int a; } (test13x);
+
+// <rdar://problem/8044088>
+struct X<foo::int> { }; // expected-error{{expected identifier or '('}}
+
+
+// PR7617 - error recovery on missing ;.
+
+void test14() // expected-error {{expected ';' after top level declarator}}
+
+void test14a();
+void *test14b = (void*)test14a; // Make sure test14a didn't get skipped.
+
+// rdar://problem/8358508
+long struct X { int x; } test15(); // expected-error {{'long struct' is invalid}}
+
+void test16(i) int i j; { } // expected-error {{expected ';' at end of declaration}}
+void test17(i, j) int i, j k; { } // expected-error {{expected ';' at end of declaration}}
diff --git a/clang/test/Parser/designator.c b/clang/test/Parser/designator.c
new file mode 100644
index 0000000..6badab7
--- /dev/null
+++ b/clang/test/Parser/designator.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only %s -verify -pedantic
+
+int X[] = {
+ [4]4, // expected-warning {{use of GNU 'missing =' extension in designator}}
+ [5] = 7
+};
+
+struct foo {
+ int arr[10];
+};
+
+struct foo Y[10] = {
+ [4] .arr [2] = 4,
+
+ // This is not the GNU array init designator extension.
+ [4] .arr [2] 4 // expected-error {{expected '=' or another designator}}
+};
diff --git a/clang/test/Parser/encode.m b/clang/test/Parser/encode.m
new file mode 100644
index 0000000..7b8022e
--- /dev/null
+++ b/clang/test/Parser/encode.m
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int main(void) {
+ const char ch = @encode(char *)[0];
+ char c = @encode(char *)[0] + 4;
+ return c;
+}
+
diff --git a/clang/test/Parser/enhanced-proto-1.m b/clang/test/Parser/enhanced-proto-1.m
new file mode 100644
index 0000000..fa6e413
--- /dev/null
+++ b/clang/test/Parser/enhanced-proto-1.m
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@protocol MyProto1
+@optional
+- (void) FOO;
+@optional
+- (void) FOO1;
+@required
+- (void) REQ;
+@optional
+@end
+
+@protocol MyProto2 <MyProto1>
+- (void) FOO2;
+@optional
+- (void) FOO3;
+@end
diff --git a/clang/test/Parser/expressions.c b/clang/test/Parser/expressions.c
new file mode 100644
index 0000000..0d1b6c9
--- /dev/null
+++ b/clang/test/Parser/expressions.c
@@ -0,0 +1,59 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void test1() {
+ if (sizeof (int){ 1}) {} // sizeof compound literal
+ if (sizeof (int)) {} // sizeof type
+
+ (void)(int)4; // cast.
+ (void)(int){4}; // compound literal.
+
+ int A = (struct{ int a;}){ 1}.a;
+}
+
+int test2(int a, int b) {
+ return a ? (void)a,b : a;
+}
+
+int test3(int a, int b, int c) {
+ return a = b = c;
+}
+
+int test4() {
+ test4();
+ return 0;
+}
+
+struct X0 { struct { struct { int c[10][9]; } b; } a; };
+
+int test_offsetof() {
+ (void)__builtin_offsetof(struct X0, a.b.c[4][5]);
+ return 0;
+}
+
+void test_sizeof(){
+ int arr[10];
+ (void)sizeof arr[0];
+ (void)sizeof(arr[0]);
+ (void)sizeof(arr)[0];
+}
+
+// PR3418
+int test_leading_extension() {
+ __extension__ (*(char*)0) = 1; // expected-warning {{indirection of non-volatile null pointer}} \
+ // expected-note {{consider using __builtin_trap}}
+ return 0;
+}
+
+// PR3972
+int test5(int);
+int test6(void) {
+ return test5( // expected-note {{to match}}
+ test5(1)
+ ; // expected-error {{expected ')'}}
+}
+
+// PR8394
+void test7() {
+ ({} // expected-note {{to match}}
+ ; // expected-error {{expected ')'}}
+}
diff --git a/clang/test/Parser/expressions.m b/clang/test/Parser/expressions.m
new file mode 100644
index 0000000..1f1005a
--- /dev/null
+++ b/clang/test/Parser/expressions.m
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void test1() {
+ @"s"; // expected-warning {{expression result unused}}
+}
+
diff --git a/clang/test/Parser/extension.c b/clang/test/Parser/extension.c
new file mode 100644
index 0000000..fd4cf80
--- /dev/null
+++ b/clang/test/Parser/extension.c
@@ -0,0 +1,20 @@
+/* RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify -std=c89
+ */
+
+/* Top level extension marker. */
+
+__extension__ typedef struct
+{
+ long long int quot;
+ long long int rem;
+} lldiv_t;
+
+
+/* Decl/expr __extension__ marker. */
+void bar() {
+ __extension__ int i;
+ int j;
+ __extension__ (j = 10LL);
+ __extension__ j = 10LL; /* expected-warning {{'long long' is an extension}} */
+}
+
diff --git a/clang/test/Parser/for.cpp b/clang/test/Parser/for.cpp
new file mode 100644
index 0000000..e413839
--- /dev/null
+++ b/clang/test/Parser/for.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f1() {
+ int n;
+
+ for (n = 0; n < 10; n++);
+
+ for (n = 0 n < 10; n++); // expected-error {{expected ';' in 'for'}}
+ for (n = 0; n < 10 n++); // expected-error {{expected ';' in 'for'}}
+
+ for (int n = 0 n < 10; n++); // expected-error {{expected ';' in 'for'}}
+ for (int n = 0; n < 10 n++); // expected-error {{expected ';' in 'for'}}
+
+ for (n = 0 bool b = n < 10; n++); // expected-error {{expected ';' in 'for'}}
+ for (n = 0; bool b = n < 10 n++); // expected-error {{expected ';' in 'for'}}
+
+ for (n = 0 n < 10 n++); // expected-error 2{{expected ';' in 'for'}}
+
+ for (;); // expected-error {{expected ';' in 'for'}}
+}
diff --git a/clang/test/Parser/function-decls.c b/clang/test/Parser/function-decls.c
new file mode 100644
index 0000000..db9a98b
--- /dev/null
+++ b/clang/test/Parser/function-decls.c
@@ -0,0 +1,10 @@
+/* RUN: %clang_cc1 %s -ast-print
+ */
+
+void foo() {
+ int X;
+ X = sizeof(void (*(*)())());
+ X = sizeof(int(*)(int, float, ...));
+ X = sizeof(void (*(int arga, void (*argb)(double Y)))(void* Z));
+}
+
diff --git a/clang/test/Parser/goto.c b/clang/test/Parser/goto.c
new file mode 100644
index 0000000..a3e0117
--- /dev/null
+++ b/clang/test/Parser/goto.c
@@ -0,0 +1,30 @@
+/* RUN: %clang_cc1 -fsyntax-only -verify %s
+*/
+
+void test1() {
+ goto ; /* expected-error {{expected identifier}} */
+}
+
+
+void test2() {
+ l: /* expected-note {{previous definition is here}} */
+
+ {
+ __label__ l;
+ l: goto l;
+ }
+
+ {
+ __label__ l;
+ __label__ h; /* expected-error {{use of undeclared label 'h'}} */
+ l: goto l;
+ }
+
+ /* PR3429 & rdar://8287027
+ */
+ {
+ l: /* expected-error {{redefinition of label 'l'}} */
+ ;
+ }
+
+}
diff --git a/clang/test/Parser/if-scope-c90.c b/clang/test/Parser/if-scope-c90.c
new file mode 100644
index 0000000..c368fab
--- /dev/null
+++ b/clang/test/Parser/if-scope-c90.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c90 %s
+
+int f (int z)
+{
+ if (z > (int) sizeof (enum {a, b}))
+ return a;
+ return b;
+}
diff --git a/clang/test/Parser/if-scope-c99.c b/clang/test/Parser/if-scope-c99.c
new file mode 100644
index 0000000..63f82e0
--- /dev/null
+++ b/clang/test/Parser/if-scope-c99.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c99 %s
+
+int f (int z)
+{
+ if (z > (int) sizeof (enum {a, b}))
+ return a;
+ return b; // expected-error{{use of undeclared identifier}}
+}
diff --git a/clang/test/Parser/implicit-casts.c b/clang/test/Parser/implicit-casts.c
new file mode 100644
index 0000000..a2b31f9
--- /dev/null
+++ b/clang/test/Parser/implicit-casts.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
+_Complex double X;
+void test1(int c) {
+ X = 5;
+}
+void test2() {
+ int i;
+ double d = i;
+ double _Complex a = 5;
+
+ test1(a);
+ a = 5;
+ d = i;
+}
+int test3() {
+ int a[2];
+ a[0] = test3; // expected-warning{{incompatible pointer to integer conversion assigning to 'int' from 'int ()'}}
+ return 0;
+}
+short x; void test4(char c) { x += c; }
+int y; void test5(char c) { y += c; }
diff --git a/clang/test/Parser/knr_parameter_attributes.c b/clang/test/Parser/knr_parameter_attributes.c
new file mode 100644
index 0000000..fb975cb
--- /dev/null
+++ b/clang/test/Parser/knr_parameter_attributes.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -W -Wall -Werror -verify %s
+
+int f(int i __attribute__((__unused__)))
+{
+ return 0;
+}
+int g(i)
+ int i __attribute__((__unused__));
+{
+ return 0;
+}
diff --git a/clang/test/Parser/method-def-in-class.m b/clang/test/Parser/method-def-in-class.m
new file mode 100644
index 0000000..476ab9b
--- /dev/null
+++ b/clang/test/Parser/method-def-in-class.m
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://7029784
+
+@interface A
+-(id) f0 { // expected-error {{expected ';' after method prototype}}
+ assert(0);
+}
+@end
+
+@interface C
+- (id) f0 { // expected-error {{expected ';' after method prototype}}
+ assert(0);
+};
+@end
diff --git a/clang/test/Parser/method-prototype-1.m b/clang/test/Parser/method-prototype-1.m
new file mode 100644
index 0000000..a32bc2e
--- /dev/null
+++ b/clang/test/Parser/method-prototype-1.m
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 %s -fsyntax-only
+@interface MyObject
+- (void) bycopy : (int) woodo, ... ;
+- (void) break : (int) woodo, ... ;
+- (void) enum : (int) woodo, ... ;
+- (void) struct : (int) woodo, ... ;
+- (void) union : (int) woodo, ... ;
+- (void) if : (int) woodo, int i, char chh, ... ;
+- (void) else : (int) woodo, ... ;
+- (void) while : (int) woodo, ... ;
+- (void) do : (int) woodo, ... ;
+- (void) for : (int) woodo, ... ;
+- (void) switch : (int) woodo, ... ;
+- (void) case : (int) woodo, ... ;
+- (void) default : (int) woodo, ... ;
+- (void) break : (int) woodo, ... ;
+- (void) continue : (int) woodo, ... ;
+- (void) return : (int) woodo, ... ;
+- (void) goto : (int) woodo, ... ;
+- (void) sizeof : (int) woodo, ... ;
+- (void) typeof : (int) woodo, ... ;
+- (void) __alignof : (int) woodo, ... ;
+- (void) unsigned : (int) woodo, ... ;
+- (void) long : (int) woodo, ... ;
+- (void) const : (int) woodo, ... ;
+- (void) short : (int) woodo, ... ;
+- (void) volatile : (int) woodo, ... ;
+- (void) signed : (int) woodo, ... ;
+- (void) restrict : (int) woodo, ... ;
+- (void) _Complex : (int) woodo, ... ;
+- (void) in : (int) woodo, ... ;
+- (void) out : (int) woodo, ... ;
+- (void) inout : (int) woodo, ... ;
+- (void) bycopy : (int) woodo, ... ;
+- (void) byref : (int) woodo, ... ;
+- (void) oneway : (int) woodo, ... ;
+- (void) int : (int) woodo, ... ;
+- (void) char : (int) woodo, ... ;
+- (void) float : (int) woodo, ... ;
+- (void) double : (int) woodo, ... ;
+- (void) void : (int) woodo, ... ;
+- (void) _Bool : (int) woodo, ... ;
+@end
diff --git a/clang/test/Parser/missing-end-2.m b/clang/test/Parser/missing-end-2.m
new file mode 100644
index 0000000..e89f28e
--- /dev/null
+++ b/clang/test/Parser/missing-end-2.m
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar: //7824372
+
+@interface A // expected-note {{class started here}}
+-(void) im0;
+
+@implementation A // expected-error {{missing '@end'}}
+@end
+
+@interface B { // expected-note {{class started here}}
+}
+
+@implementation B // expected-error {{missing '@end'}}
+@end
+
+@interface C // expected-note 2 {{class started here}}
+@property int P;
+
+@implementation C // expected-error 2 {{missing '@end'}}
diff --git a/clang/test/Parser/missing-end-3.m b/clang/test/Parser/missing-end-3.m
new file mode 100644
index 0000000..4875ecd
--- /dev/null
+++ b/clang/test/Parser/missing-end-3.m
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://8283484
+@interface blah { // expected-note {{class started here}}
+ @private
+}
+// since I forgot the @end here it should say something
+
+@interface blah // expected-error {{missing '@end'}}
+@end // and Unknown type name 'end' here
+
diff --git a/clang/test/Parser/missing-end-4.m b/clang/test/Parser/missing-end-4.m
new file mode 100644
index 0000000..8a96e64
--- /dev/null
+++ b/clang/test/Parser/missing-end-4.m
@@ -0,0 +1,51 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+
+@interface X1
+@end
+@implementation X1 // expected-note {{implementation started here}}
+@interface Y1 // expected-error {{missing '@end'}}
+@end
+@end // expected-error {{'@end' must appear in an Objective-C context}}
+
+@interface X2
+@end
+@implementation X2 // expected-note {{implementation started here}}
+@protocol Y2 // expected-error {{missing '@end'}}
+@end
+@end // expected-error {{'@end' must appear in an Objective-C context}}
+
+@interface X6 // expected-note {{class started here}}
+@interface X7 // expected-error {{missing '@end'}}
+@end
+@end // expected-error {{'@end' must appear in an Objective-C context}}
+
+@protocol P1 // expected-note {{protocol started here}}
+@interface P2 // expected-error {{missing '@end'}}
+@end
+@end // expected-error {{'@end' must appear in an Objective-C context}}
+
+@interface X4 // expected-note {{class started here}}
+@implementation X4 // expected-error {{missing '@end'}}
+@end
+@end // expected-error {{'@end' must appear in an Objective-C context}}
+
+@interface I
+@end
+@implementation I
+@protocol P; // forward declarations of protocols in @implementations is allowed
+@class C; // forward declarations of classes in @implementations is allowed
+- (C<P>*) MyMeth {}
+@end
+
+@interface I2 {}
+@protocol P2; // expected-error {{illegal interface qualifier}}
+@class C2; // expected-error {{illegal interface qualifier}}
+@end
+
+@interface I3
+@end
+@implementation I3
+- Meth {}
++ Cls {}
+@protocol P3;
+@end
diff --git a/clang/test/Parser/missing-end.m b/clang/test/Parser/missing-end.m
new file mode 100644
index 0000000..d66ea64
--- /dev/null
+++ b/clang/test/Parser/missing-end.m
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@interface AAA // expected-note {{class started here}}
+{
+}
+@ x// expected-error{{expected an Objective-C directive after '@'}}
+// expected-error{{missing '@end'}}
diff --git a/clang/test/Parser/ms-inline-asm.c b/clang/test/Parser/ms-inline-asm.c
new file mode 100644
index 0000000..b1af23e
--- /dev/null
+++ b/clang/test/Parser/ms-inline-asm.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 %s -verify -fms-extensions
+
+#define M __asm int 0x2c
+#define M2 int
+
+void t1(void) { M }
+void t2(void) { __asm int 0x2c }
+void t3(void) { __asm M2 0x2c }
+void* t4(void) { __asm mov eax, fs:[0x10] }
+void t5() {
+ __asm {
+ int 0x2c ; } asm comments are fun! }{
+ }
+ __asm {}
+}
+int t6() {
+ __asm int 3 ; } comments for single-line asm
+ __asm {}
+
+ __asm int 4
+ return 10;
+}
+int t7() { // expected-note {{to match this}}
+ __asm
+ __asm { // expected-error 3 {{expected}} expected-note {{to match this}}
diff --git a/clang/test/Parser/namelookup-bug-1.c b/clang/test/Parser/namelookup-bug-1.c
new file mode 100644
index 0000000..8667a71
--- /dev/null
+++ b/clang/test/Parser/namelookup-bug-1.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -verify %s
+
+typedef int Object;
+
+struct Object *pp;
+
+Object staticObject1;
diff --git a/clang/test/Parser/namelookup-bug-2.c b/clang/test/Parser/namelookup-bug-2.c
new file mode 100644
index 0000000..84850ff
--- /dev/null
+++ b/clang/test/Parser/namelookup-bug-2.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -verify %s
+
+typedef int Object;
+
+struct Object {int i1; } *P;
+
+void foo() {
+ struct Object { int i2; } *X;
+ Object:
+ {
+ Object a;
+ }
+}
+
diff --git a/clang/test/Parser/namespace-alias-attr.cpp b/clang/test/Parser/namespace-alias-attr.cpp
new file mode 100644
index 0000000..ba80922
--- /dev/null
+++ b/clang/test/Parser/namespace-alias-attr.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -verify %s
+
+namespace A
+{
+}
+
+namespace B __attribute__ (( static )) = A; // expected-error{{attributes can not be specified on namespace alias}}
+
diff --git a/clang/test/Parser/namespaces.cpp b/clang/test/Parser/namespaces.cpp
new file mode 100644
index 0000000..b8c7819
--- /dev/null
+++ b/clang/test/Parser/namespaces.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// PR6596
+namespace g { enum { o = 0 }; }
+
+void foo() {
+ namespace a { typedef g::o o; } // expected-error{{namespaces can only be defined in global or namespace scope}}
+}
diff --git a/clang/test/Parser/nested-namespaces-recovery.cpp b/clang/test/Parser/nested-namespaces-recovery.cpp
new file mode 100644
index 0000000..d45938b
--- /dev/null
+++ b/clang/test/Parser/nested-namespaces-recovery.cpp
@@ -0,0 +1,24 @@
+// RUN: cp %s %t
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: not %clang_cc1 -x c++ -fixit %t
+// RUN: %clang_cc1 -x c++ %t
+
+namespace foo1::foo2::foo3 { // expected-error {{nested namespace definition must define each namespace separately}}
+ int foo(int x) { return x; }
+}
+
+int foo(int x) {
+ return foo1::foo2::foo3::foo(x);
+}
+
+namespace bar1 {
+ namespace bar2 {
+ namespace bar3 {
+ int bar(int x) { return x; }
+ }
+ }
+}
+
+int bar(int x) {
+ return bar1::bar2::bar3::bar(x);
+}
diff --git a/clang/test/Parser/objc-alias-printing.m b/clang/test/Parser/objc-alias-printing.m
new file mode 100644
index 0000000..8b9cc6e
--- /dev/null
+++ b/clang/test/Parser/objc-alias-printing.m
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -ast-print %s
+
+@protocol P1 @end
+@protocol P2 @end
+
+@interface INTF @end
+
+@compatibility_alias alias INTF;
+
+
+int foo ()
+{
+ INTF *pi;
+ INTF<P2,P1> *pi2;
+ alias *p;
+ alias<P1,P2> *p2;
+ return pi2 == p2;
+}
diff --git a/clang/test/Parser/objc-category-neg-1.m b/clang/test/Parser/objc-category-neg-1.m
new file mode 100644
index 0000000..4aa8bae
--- /dev/null
+++ b/clang/test/Parser/objc-category-neg-1.m
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void __assert_rtn(const char *, const char *, int, const char *) __attribute__((__noreturn__));
+static __inline__ int __inline_isfinitef (float ) __attribute__ ((always_inline));
+
+@interface NSATSTypesetter (NSPantherCompatibility) // expected-error {{cannot find interface declaration for 'NSATSTypesetter'}}
+- (id)lineFragmentRectForProposedRect:(id)proposedRect remainingRect:(id)remainingRect __attribute__((deprecated));
+@end
diff --git a/clang/test/Parser/objc-forcollection-1.m b/clang/test/Parser/objc-forcollection-1.m
new file mode 100644
index 0000000..4850deb
--- /dev/null
+++ b/clang/test/Parser/objc-forcollection-1.m
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -fsyntax-only %s
+
+typedef struct objc_class *Class;
+typedef struct objc_object {
+ Class isa;
+} *id;
+
+
+@protocol P @end
+
+@interface MyList
+@end
+
+@implementation MyList
+- (unsigned int)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state objects: (id *)items count:(unsigned int)stackcount
+{
+ return 0;
+}
+@end
+
+@interface MyList (BasicTest)
+- (void)compilerTestAgainst;
+@end
+
+@implementation MyList (BasicTest)
+- (void)compilerTestAgainst {
+ int i;
+ for (id elem in self)
+ ++i;
+ for (MyList *elem in self)
+ ++i;
+ for (id<P> se in self)
+ ++i;
+
+ MyList<P> *p;
+ for (p in self)
+ ++i;
+
+ for (p in p)
+ ++i;
+}
+@end
+
diff --git a/clang/test/Parser/objc-forcollection-neg-2.m b/clang/test/Parser/objc-forcollection-neg-2.m
new file mode 100644
index 0000000..f95dd13
--- /dev/null
+++ b/clang/test/Parser/objc-forcollection-neg-2.m
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+
+typedef struct objc_class *Class;
+struct __objcFastEnumerationState;
+typedef struct objc_object {
+ Class isa;
+} *id;
+
+@protocol P @end
+
+@interface MyList
+@end
+
+@implementation MyList
+- (unsigned int)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state objects: (id *)items count:(unsigned int)stackcount
+{
+ return 0;
+}
+@end
+
+@interface MyList (BasicTest)
+- (void)compilerTestAgainst;
+@end
+
+@implementation MyList (BasicTest)
+- (void)compilerTestAgainst {
+ static i;// expected-warning {{type specifier missing, defaults to 'int'}}
+ for (id el, elem in self) // expected-error {{only one element declaration is allowed}}
+ ++i;
+ for (id el in self)
+ ++i;
+ MyList<P> ***p;
+ for (p in self) // expected-error {{selector element type 'MyList<P> ***' is not a valid object}}
+ ++i;
+
+}
+@end
+
diff --git a/clang/test/Parser/objc-forcollection-neg.m b/clang/test/Parser/objc-forcollection-neg.m
new file mode 100644
index 0000000..1a989a1
--- /dev/null
+++ b/clang/test/Parser/objc-forcollection-neg.m
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+
+struct __objcFastEnumerationState;
+typedef struct objc_class *Class;
+typedef struct objc_object {
+ Class isa;
+} *id;
+
+
+@interface MyList
+@end
+
+@implementation MyList
+- (unsigned int)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state objects: (id *)items count:(unsigned int)stackcount
+{
+ return 0;
+}
+@end
+
+@interface MyList (BasicTest)
+- (void)compilerTestAgainst;
+@end
+
+@implementation MyList (BasicTest)
+- (void)compilerTestAgainst {
+
+ int i=0;
+ for (int * elem in elem) // expected-error {{selector element type 'int *' is not a valid object}} \
+ expected-error {{collection expression type 'int *' is not a valid object}}
+ ++i;
+ for (i in elem) // expected-error {{use of undeclared identifier 'elem'}} \
+ expected-error {{selector element type 'int' is not a valid object}}
+ ++i;
+ for (id se in i) // expected-error {{collection expression type 'int' is not a valid object}}
+ ++i;
+}
+@end
+
diff --git a/clang/test/Parser/objc-foreach-syntax.m b/clang/test/Parser/objc-foreach-syntax.m
new file mode 100644
index 0000000..5d83dc6
--- /dev/null
+++ b/clang/test/Parser/objc-foreach-syntax.m
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+
+struct __objcFastEnumerationState;
+@implementation MyList // expected-warning {{cannot find interface declaration for 'MyList'}}
+- (unsigned int)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state objects: (id *)items count:(unsigned int)stackcount
+{
+ return 0;
+}
+@end
+
+
+int LOOP();
+
+@implementation MyList (BasicTest)
+- (void)compilerTestAgainst {
+MyList * el;
+ for (el in @"foo")
+ { LOOP(); }
+}
+@end
+
+
+static int test7(id keys) {
+ for (id key; in keys) ; // expected-error {{use of undeclared identifier 'in'}}
+}
diff --git a/clang/test/Parser/objc-init.m b/clang/test/Parser/objc-init.m
new file mode 100644
index 0000000..efa1266
--- /dev/null
+++ b/clang/test/Parser/objc-init.m
@@ -0,0 +1,60 @@
+// RUN: %clang_cc1 -fsyntax-only -fobjc-fragile-abi -verify -pedantic -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-fragile-abi -verify -x objective-c++ -Wno-objc-root-class %s
+// rdar://5707001
+
+@interface NSNumber;
+- () METH;
+- (unsigned) METH2;
+@end
+
+struct SomeStruct {
+ int x, y, z, q;
+};
+
+void test1() {
+ id objects[] = {[NSNumber METH]};
+}
+
+void test2(NSNumber x) { // expected-error {{interface type 'NSNumber' cannot be passed by value; did you forget * in 'NSNumber'}}
+ id objects[] = {[x METH]};
+}
+
+void test3(NSNumber *x) {
+ id objects[] = {[x METH]};
+}
+
+
+// rdar://5977581
+void test4() {
+ unsigned x[] = {[NSNumber METH2]+2};
+}
+
+void test5(NSNumber *x) {
+ unsigned y[] = {
+ [4][NSNumber METH2]+2, // expected-warning {{use of GNU 'missing =' extension in designator}}
+ [4][x METH2]+2 // expected-warning {{use of GNU 'missing =' extension in designator}}
+ };
+
+ struct SomeStruct z = {
+ .x = [x METH2], // ok.
+ .x [x METH2] // expected-error {{expected '=' or another designator}}
+ };
+}
+
+// rdar://7370882
+@interface SemicolonsAppDelegate
+{
+ id i;
+}
+@property (assign) id window;
+@end
+
+@implementation SemicolonsAppDelegate
+{
+ id i;
+}
+ @synthesize window=i;
+@end
+
+
+
diff --git a/clang/test/Parser/objc-interfaces.m b/clang/test/Parser/objc-interfaces.m
new file mode 100644
index 0000000..0ae17f1
--- /dev/null
+++ b/clang/test/Parser/objc-interfaces.m
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+
+// Test features and error recovery for objc interfaces.
+
+@interface INTF
+- (int*) foo2 __attribute__((deprecated)) : (int) x1 __attribute__((deprecated)); // expected-error {{expected ';' after method prototype}} expected-error {{method type specifier must start with '-' or '+'}}
+@end
+
diff --git a/clang/test/Parser/objc-messaging-1.m b/clang/test/Parser/objc-messaging-1.m
new file mode 100644
index 0000000..82450df
--- /dev/null
+++ b/clang/test/Parser/objc-messaging-1.m
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+int main ()
+{
+ int i,j;
+ struct S *p;
+ id a, b, c;
+ [a ii]; // expected-warning{{not found}}
+ [a if: 1 :2]; // expected-warning{{not found}}
+ [a inout: 1 :2 another:(2,3,4)]; // expected-warning{{not found}} \
+ // expected-warning 2{{expression result unused}}
+ [a inout: 1 :2 another:(2,3,4), 6,6,8]; // expected-warning{{not found}} \
+ // expected-warning 2{{expression result unused}}
+ [a inout: 1 :2 another:(2,3,4), (6,4,5),6,8]; // expected-warning{{not found}} \
+ // expected-warning 4{{expression result unused}}
+ [a inout: 1 :2 another:(i+10), (i,j-1,5),6,8]; // expected-warning{{not found}} \
+ // expected-warning 2{{expression result unused}}
+ [a long: 1 :2 another:(i+10), (i,j-1,5),6,8]; // expected-warning{{not found}} \
+ // expected-warning 2{{expression result unused}}
+ [a : "Hello\n" :2 another:(i+10), (i,j-1,5),6,8]; // expected-warning{{not found}} \
+ // expected-warning 2{{expression result unused}}
+
+ // Comma expression as receiver (rdar://6222856)
+ [a, b, c foo]; // expected-warning{{not found}} \
+ // expected-warning 2{{expression result unused}}
+
+}
diff --git a/clang/test/Parser/objc-messaging-neg-1.m b/clang/test/Parser/objc-messaging-neg-1.m
new file mode 100644
index 0000000..bb496e9
--- /dev/null
+++ b/clang/test/Parser/objc-messaging-neg-1.m
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@interface A
++(void) foo:(int) a;
+@end
+
+int main() {
+ id a;
+ [a bla:0 6:7]; // expected-error {{expected ']'}}
+ [A foo bar]; // expected-error {{expected ':'}}
+ [A foo bar bar1]; // expected-error {{expected ':'}}
+ [] {}; // expected-error {{expected expression}}
+}
diff --git a/clang/test/Parser/objc-missing-impl.m b/clang/test/Parser/objc-missing-impl.m
new file mode 100644
index 0000000..791b9f8
--- /dev/null
+++ b/clang/test/Parser/objc-missing-impl.m
@@ -0,0 +1,2 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+@end // expected-error {{'@end' must appear in an Objective-C context}}
diff --git a/clang/test/Parser/objc-property-syntax.m b/clang/test/Parser/objc-property-syntax.m
new file mode 100644
index 0000000..38d12d5
--- /dev/null
+++ b/clang/test/Parser/objc-property-syntax.m
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+
+@interface MyClass {
+ int prop;
+};
+@property unsigned char bufferedUTF8Bytes[4]; // expected-error {{property cannot have array or function type}}
+@property unsigned char bufferedUTFBytes:1; // expected-error {{property name cannot be a bitfield}}
+@property(nonatomic, retain, setter=ab_setDefaultToolbarItems) MyClass *ab_defaultToolbarItems; // expected-error {{method name referenced in property setter attribute must end with ':'}}
+
+@property int prop;
+@end
+
+@implementation MyClass
+@dynamic ab_defaultToolbarItems // expected-error{{expected ';' after @dynamic}}
+@synthesize prop // expected-error{{expected ';' after @synthesize}}
+@end
+
diff --git a/clang/test/Parser/objc-quirks.m b/clang/test/Parser/objc-quirks.m
new file mode 100644
index 0000000..0bdeb46
--- /dev/null
+++ b/clang/test/Parser/objc-quirks.m
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
+
+// FIXME: This is a horrible error message here. Fix.
+int @"s" = 5; // expected-error {{prefix attribute must be}}
+
+
+// rdar://6480479
+@interface A // expected-note {{class started here}}
+}; // expected-error {{missing '@end'}} \
+// expected-error {{extraneous closing brace ('}')}} \
+// expected-warning{{extra ';' outside of a function}}
+
+
+
+
+// PR6811
+// 'super' isn't an expression, it is a magic context-sensitive keyword.
+@interface A2 {
+ id isa;
+}
+- (void)a;
+@end
+
+@interface B2 : A2 @end
+@implementation B2
+- (void)a
+{
+ [(super) a]; // expected-error {{use of undeclared identifier 'super'}}
+}
+@end
+
+@compatibility_alias A3 A2;
diff --git a/clang/test/Parser/objc-synthesized-recover.m b/clang/test/Parser/objc-synthesized-recover.m
new file mode 100644
index 0000000..c281c21
--- /dev/null
+++ b/clang/test/Parser/objc-synthesized-recover.m
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+
+@interface I1
+{
+ int value;
+ int value2;
+}
+@property int value;
+@property int value2;
+@end
+
+@implementation I1
+@synthesize value, - value2; // expected-error{{expected a property name}}
+@synthesize value2;
+@end
diff --git a/clang/test/Parser/objc-try-catch-1.m b/clang/test/Parser/objc-try-catch-1.m
new file mode 100644
index 0000000..a3220eb
--- /dev/null
+++ b/clang/test/Parser/objc-try-catch-1.m
@@ -0,0 +1,70 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions -x objective-c++ %s
+void * proc();
+
+@interface NSConstantString
+@end
+
+@interface Frob
+@end
+
+@interface Frob1
+@end
+
+void * foo()
+{
+ @try {
+ return proc();
+ }
+ @catch (Frob* ex) {
+ @throw;
+ }
+ @catch (Frob1* ex) {
+ @throw proc();
+ }
+ @finally {
+ @try {
+ return proc();
+ }
+ @catch (Frob* ex) {
+ @throw 1,2; // expected-error {{@throw requires an Objective-C object type ('int' invalid)}} \
+ // expected-warning {{expression result unused}}
+ }
+ @catch (float x) { // expected-error {{@catch parameter is not a pointer to an interface type}}
+
+ }
+ @catch(...) {
+ @throw (4,3,proc()); // expected-warning {{expression result unused}} \
+ // expected-warning {{expression result unused}}
+ }
+ }
+
+ @try { // expected-error {{@try statement without a @catch and @finally clause}}
+ return proc();
+ }
+}
+
+
+void bar()
+{
+ @try {}// expected-error {{@try statement without a @catch and @finally clause}}
+ @"s"; // expected-warning {{result unused}}
+}
+
+void baz()
+{
+ @try {}// expected-error {{@try statement without a @catch and @finally clause}}
+ @try {}
+ @finally {}
+}
+
+void noTwoTokenLookAheadRequiresABitOfFancyFootworkInTheParser() {
+ @try {
+ // Do something
+ } @catch (...) {}
+ @try {
+ // Do something
+ } @catch (...) {}
+ return;
+}
+
diff --git a/clang/test/Parser/objc-type-printing.m b/clang/test/Parser/objc-type-printing.m
new file mode 100644
index 0000000..9bbdac9
--- /dev/null
+++ b/clang/test/Parser/objc-type-printing.m
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -ast-print %s
+
+@protocol P1 @end
+@protocol P2 @end
+@protocol P3 @end
+
+@interface INTF
+- (INTF<P1>*) METH;
+@end
+
+void foo()
+{
+ INTF *pintf;
+ INTF<P1>* p1;
+ INTF<P1, P1>* p2;
+ INTF<P1, P3>* p3;
+ INTF<P1, P3, P2>* p4;
+ INTF<P2,P2, P3, P1>* p5;
+}
diff --git a/clang/test/Parser/objcxx-at.mm b/clang/test/Parser/objcxx-at.mm
new file mode 100644
index 0000000..37aee4d
--- /dev/null
+++ b/clang/test/Parser/objcxx-at.mm
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@interface B {
+ int i;
+}
+@end
+
+struct Z {
+ @defs(B); // expected-error{{@defs is not supported in Objective-C++}}
+};
+
+struct Y { // expected-note{{to match this '{'}}
+ struct X { } // expected-error{{expected ';' after struct}}
+ @interface A // expected-error{{unexpected '@' in member specification}}
+} // expected-error{{expected '}'}} expected-error{{expected ';' after struct}}
diff --git a/clang/test/Parser/objcxx-lambda-expressions-neg.mm b/clang/test/Parser/objcxx-lambda-expressions-neg.mm
new file mode 100644
index 0000000..7cdb1a2
--- /dev/null
+++ b/clang/test/Parser/objcxx-lambda-expressions-neg.mm
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify %s
+
+int main() {
+ []{}; // expected-error {{expected expression}}
+}
diff --git a/clang/test/Parser/objcxx0x-lambda-expressions.mm b/clang/test/Parser/objcxx0x-lambda-expressions.mm
new file mode 100644
index 0000000..1eab15b
--- /dev/null
+++ b/clang/test/Parser/objcxx0x-lambda-expressions.mm
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-value -std=c++11 %s
+
+class C {
+
+ void f() {
+ int foo, bar;
+
+ // fail to parse as a lambda introducer, so we get objc message parsing errors instead
+ [foo,+] {}; // expected-error {{expected expression}}
+
+ []; // expected-error {{expected body of lambda expression}}
+ [=,foo+] {}; // expected-error {{expected ',' or ']' in lambda capture list}}
+ [&this] {}; // expected-error {{address expression must be an lvalue}}
+ [] {};
+ [=] (int i) {};
+ [&] (int) mutable -> void {};
+ [foo,bar] () { return 3; };
+ [=,&foo] () {};
+ [this] () {};
+ }
+
+};
+
diff --git a/clang/test/Parser/objcxx11-attributes.mm b/clang/test/Parser/objcxx11-attributes.mm
new file mode 100644
index 0000000..0c91392
--- /dev/null
+++ b/clang/test/Parser/objcxx11-attributes.mm
@@ -0,0 +1,57 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+@interface X {}
++ (X*) alloc;
+- (X*) init;
+- (int) getSize;
+- (void) setSize: (int) size;
+- (X*) getSelf;
+@end
+
+void f(X *noreturn) {
+ // An array size which is computed by a message send is OK.
+ int a[ [noreturn getSize] ];
+
+ // ... but is interpreted as an attribute where possible.
+ int b[ [noreturn] ]; // expected-warning {{'noreturn' only applies to function types}}
+
+ int c[ [noreturn getSize] + 1 ];
+
+ // An array size which is computed by a lambda is not OK.
+ int d[ [noreturn] { return 3; } () ]; // expected-error {{expected ']'}} expected-warning {{'noreturn' only applies}}
+
+ // A message send which contains a message send is OK.
+ [ [ X alloc ] init ];
+ [ [ int(), noreturn getSelf ] getSize ]; // expected-warning {{unused}}
+
+ // A message send which contains a lambda is OK.
+ [ [noreturn] { return noreturn; } () setSize: 4 ];
+ [ [bitand] { return noreturn; } () setSize: 5 ];
+ [[[[] { return [ X alloc ]; } () init] getSelf] getSize];
+
+ // An attribute is OK.
+ [[]];
+ [[int(), noreturn]]; // expected-warning {{attribute noreturn cannot be specified on a statement}}
+ [[class, test(foo 'x' bar),,,]];
+ [[bitand, noreturn]]; // expected-warning {{attribute noreturn cannot be specified on a statement}}
+
+ [[noreturn]]int(e)();
+ int e2(); // expected-warning {{interpreted as a function declaration}} expected-note{{}}
+
+ // A function taking a noreturn function.
+ int(f)([[noreturn]] int()); // expected-note {{here}}
+ f(e);
+ f(e2); // expected-error {{cannot initialize a parameter of type 'int (*)() __attribute__((noreturn))' with an lvalue of type 'int ()'}}
+
+ // Variables initialized by a message send.
+ int(g)([[noreturn getSelf] getSize]);
+ int(h)([[noreturn]{return noreturn;}() getSize]);
+
+ int i = g + h;
+}
+
+template<typename...Ts> void f(Ts ...x) {
+ [[test::foo(bar, baz)...]];
+ [[used(x)...]];
+ [[x...] { return [ X alloc ]; }() init];
+}
diff --git a/clang/test/Parser/objcxx11-user-defined-literal.mm b/clang/test/Parser/objcxx11-user-defined-literal.mm
new file mode 100644
index 0000000..a5f1397
--- /dev/null
+++ b/clang/test/Parser/objcxx11-user-defined-literal.mm
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+id x = @"foo"_bar; // expected-error{{user-defined suffix cannot be used here}}
diff --git a/clang/test/Parser/offsetof.c b/clang/test/Parser/offsetof.c
new file mode 100644
index 0000000..3a5b9f3
--- /dev/null
+++ b/clang/test/Parser/offsetof.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct a { struct { int b; } x[2]; };
+
+int a = __builtin_offsetof(struct a, x; // expected-error{{expected ')'}} expected-note{{to match this '('}}
+// FIXME: This actually shouldn't give an error
+int b = __builtin_offsetof(struct a, x->b); // expected-error{{expected ')'}} expected-note{{to match this '('}}
diff --git a/clang/test/Parser/opencl-astype.cl b/clang/test/Parser/opencl-astype.cl
new file mode 100644
index 0000000..d4c547e
--- /dev/null
+++ b/clang/test/Parser/opencl-astype.cl
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+
+void test_astype() {
+ float f = 1.0f;
+ unsigned int i = __builtin_astype(f, unsigned int);
+
+ typedef __attribute__(( ext_vector_type(4) )) int int4;
+ typedef __attribute__(( ext_vector_type(3) )) float float3;
+ typedef __attribute__(( ext_vector_type(4) )) float float4;
+ typedef __attribute__(( ext_vector_type(4) )) double double4;
+
+ float4 f4;
+ double4 d4 = __builtin_astype(f4, double4); // expected-error{{invalid reinterpretation: sizes of 'double4' and 'float4' must match}}
+
+ // Verify int4->float3, float3->int4 works.
+ int4 i4;
+ float3 f3 = __builtin_astype(i4, float3);
+ i4 = __builtin_astype(f3, int4);
+}
diff --git a/clang/test/Parser/opencl-image-access.cl b/clang/test/Parser/opencl-image-access.cl
new file mode 100644
index 0000000..313587c
--- /dev/null
+++ b/clang/test/Parser/opencl-image-access.cl
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 %s -fsyntax-only
+
+typedef void* image2d_t;
+
+__kernel void f__ro(__read_only image2d_t a) { }
+
+__kernel void f__wo(__write_only image2d_t a) { }
+
+__kernel void f__rw(__read_write image2d_t a) { }
+
+
+__kernel void fro(read_only image2d_t a) { }
+
+__kernel void fwo(write_only image2d_t a) { }
+
+__kernel void frw(read_write image2d_t a) { }
diff --git a/clang/test/Parser/opencl-kernel.cl b/clang/test/Parser/opencl-kernel.cl
new file mode 100644
index 0000000..3abb62b
--- /dev/null
+++ b/clang/test/Parser/opencl-kernel.cl
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+__kernel void test()
+{
+}
+
+kernel void test1()
+{
+}
diff --git a/clang/test/Parser/opencl-pragma.cl b/clang/test/Parser/opencl-pragma.cl
new file mode 100644
index 0000000..1946077
--- /dev/null
+++ b/clang/test/Parser/opencl-pragma.cl
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+#pragma OPENCL EXTENSION cl_khr_fp16 : enable
+
+#pragma OPENCL EXTENSION cl_no_such_extension : disable /* expected-warning {{unknown OpenCL extension 'cl_no_such_extension' - ignoring}} */
+
+#pragma OPENCL EXTENSION all : disable
+#pragma OPENCL EXTENSION all : enable /* expected-warning {{unknown OpenCL extension 'all' - ignoring}} */
+
+#pragma OPENCL EXTENSION cl_khr_fp64 : on /* expected-warning {{expected 'enable' or 'disable' - ignoring}} */
+
+#pragma OPENCL FP_CONTRACT ON
+#pragma OPENCL FP_CONTRACT OFF
+#pragma OPENCL FP_CONTRACT DEFAULT
+#pragma OPENCL FP_CONTRACT FOO // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}}
diff --git a/clang/test/Parser/opencl-storage-class.cl b/clang/test/Parser/opencl-storage-class.cl
new file mode 100644
index 0000000..874329b
--- /dev/null
+++ b/clang/test/Parser/opencl-storage-class.cl
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+
+void test_storage_class_specs()
+{
+ static int a; // expected-error {{OpenCL does not support the 'static' storage class specifier}}
+ register int b; // expected-error {{OpenCL does not support the 'register' storage class specifier}}
+ extern int c; // expected-error {{OpenCL does not support the 'extern' storage class specifier}}
+ auto int d; // expected-error {{OpenCL does not support the 'auto' storage class specifier}}
+
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable
+ static int e;
+ register int f;
+ extern int g;
+ auto int h;
+}
diff --git a/clang/test/Parser/parenthesis-balance.cpp b/clang/test/Parser/parenthesis-balance.cpp
new file mode 100644
index 0000000..5bfa639
--- /dev/null
+++ b/clang/test/Parser/parenthesis-balance.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int f(int x) {
+ if (int foo = f(bar)) {} // expected-error{{use of undeclared identifier 'bar'}}
+ while (int foo = f(bar)) {} // expected-error{{use of undeclared identifier 'bar'}}
+ for (int foo = f(bar);;) {} // expected-error{{use of undeclared identifier 'bar'}}
+
+ int bar;
+ if (int foo = f(bar)) {}
+ while (int foo = f(bar)) {}
+ for (int foo = f(bar);;) {}
+
+ return 0;
+}
+
diff --git a/clang/test/Parser/parmvardecl_conversion.c b/clang/test/Parser/parmvardecl_conversion.c
new file mode 100644
index 0000000..9fa8a68
--- /dev/null
+++ b/clang/test/Parser/parmvardecl_conversion.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f (int p[]) { p++; }
+
diff --git a/clang/test/Parser/parser_overflow.c b/clang/test/Parser/parser_overflow.c
new file mode 100644
index 0000000..d2006ea
--- /dev/null
+++ b/clang/test/Parser/parser_overflow.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 %s -fsyntax-only 2>&1 | FileCheck %s
+
+void foo(void) {
+ {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{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}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
+}
+
+// CHECK: fatal error: parser recursion limit reached, program too complex
diff --git a/clang/test/Parser/placeholder-recovery.m b/clang/test/Parser/placeholder-recovery.m
new file mode 100644
index 0000000..1fc1549
--- /dev/null
+++ b/clang/test/Parser/placeholder-recovery.m
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// FIXME: We could do much better with this, if we recognized
+// placeholders somehow. However, we're content with not generating
+// bogus 'archaic' warnings with bad location info.
+@protocol <#protocol name#> <NSObject> // expected-error 2{{expected identifier}} \
+// expected-error{{cannot find protocol declaration for 'NSObject'}} \
+// expected-warning{{protocol qualifiers without 'id'}}
+
+<#methods#> // expected-error{{expected identifier}}
+
+@end // expected-error{{prefix attribute}}
diff --git a/clang/test/Parser/pointer-arithmetic.c b/clang/test/Parser/pointer-arithmetic.c
new file mode 100644
index 0000000..87eb1a2
--- /dev/null
+++ b/clang/test/Parser/pointer-arithmetic.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int *test1(int *a) { return a + 1; }
+int *test2(int *a) { return 1 + a; }
+int *test3(int *a) { return a - 1; }
+int test4(int *a, int *b) { return a - b; }
+
+int test5(int *a, int *b) { return a + b; } /* expected-error {{invalid operands}} */
+int *test6(int *a) { return 1 - a; } /* expected-error {{invalid operands}} */
diff --git a/clang/test/Parser/pointer_promotion.c b/clang/test/Parser/pointer_promotion.c
new file mode 100644
index 0000000..30589d0
--- /dev/null
+++ b/clang/test/Parser/pointer_promotion.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void test() {
+ void *vp;
+ int *ip;
+ char *cp;
+ struct foo *fp;
+ struct bar *bp;
+ short sint = 7;
+
+ if (ip < cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}}
+ if (cp < fp) {} // expected-warning {{comparison of distinct pointer types ('char *' and 'struct foo *')}}
+ if (fp < bp) {} // expected-warning {{comparison of distinct pointer types ('struct foo *' and 'struct bar *')}}
+ if (ip < 7) {} // expected-warning {{comparison between pointer and integer ('int *' and 'int')}}
+ if (sint < ip) {} // expected-warning {{comparison between pointer and integer ('int' and 'int *')}}
+ if (ip == cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}}
+}
diff --git a/clang/test/Parser/pragma-options.c b/clang/test/Parser/pragma-options.c
new file mode 100644
index 0000000..7844e71
--- /dev/null
+++ b/clang/test/Parser/pragma-options.c
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
+
+/* expected-warning {{expected 'align' following '#pragma options'}} */ #pragma options
+/* expected-warning {{expected '=' following '#pragma options align'}} */ #pragma options align
+/* expected-warning {{expected identifier in '#pragma options'}} */ #pragma options align =
+/* expected-warning {{invalid alignment option in '#pragma options align'}} */ #pragma options align = foo
+/* expected-warning {{extra tokens at end of '#pragma options'}} */ #pragma options align = reset foo
+
+#pragma options align=natural
+#pragma options align=reset
+#pragma options align=mac68k
+#pragma options align=power
+
+/* expected-warning {{expected '=' following '#pragma align'}} */ #pragma align
+/* expected-warning {{expected identifier in '#pragma align'}} */ #pragma align =
+/* expected-warning {{invalid alignment option in '#pragma align'}} */ #pragma align = foo
+/* expected-warning {{extra tokens at end of '#pragma align'}} */ #pragma align = reset foo
+
+#pragma align=natural
+#pragma align=reset
+#pragma align=mac68k
+#pragma align=power
diff --git a/clang/test/Parser/pragma-pack.c b/clang/test/Parser/pragma-pack.c
new file mode 100644
index 0000000..84778cd
--- /dev/null
+++ b/clang/test/Parser/pragma-pack.c
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Note that this puts the expected lines before the directives to work around
+// limitations in the -verify mode.
+
+/* expected-warning {{missing '(' after '#pragma pack'}}*/ #pragma pack 10
+#pragma pack()
+#pragma pack(8)
+
+/*expected-warning {{unknown action for '#pragma pack'}}*/ #pragma pack(hello)
+#pragma pack(push)
+#pragma pack(pop)
+
+/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(push,)
+/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(push,)
+/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(pop,)
+
+#pragma pack(push,i)
+/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(push,i,
+/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(push,i,)
+/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(push,i,help)
+
+#pragma pack(push,8)
+/* expected-warning {{missing ')' after '#pragma pack'}}*/ #pragma pack(push,8,
+/* expected-warning {{missing ')' after '#pragma pack'}}*/ #pragma pack(push,8,)
+/* expected-warning {{missing ')' after '#pragma pack'}}*/ #pragma pack(push,i,8
+#pragma pack(push,i,8)
+
+/* expected-warning {{missing ')' after '#pragma pack'}}*/ #pragma pack(push
+
+_Pragma("pack(push)")
+/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ _Pragma("pack(push,)")
diff --git a/clang/test/Parser/pragma-visibility.c b/clang/test/Parser/pragma-visibility.c
new file mode 100644
index 0000000..cfc3d9e
--- /dev/null
+++ b/clang/test/Parser/pragma-visibility.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#pragma GCC visibility foo // expected-warning{{expected identifier in '#pragma visibility' - ignored}}
+#pragma GCC visibility pop foo // expected-warning{{extra tokens at end of '#pragma visibility' - ignored}}
+#pragma GCC visibility push // expected-warning{{missing '(' after '#pragma visibility'}}
+#pragma GCC visibility push( // expected-warning{{expected identifier in '#pragma visibility' - ignored}}
+#pragma GCC visibility push(hidden // expected-warning{{missing ')' after '#pragma visibility' - ignoring}}
+#pragma GCC visibility push(hidden)
+#pragma GCC visibility pop
diff --git a/clang/test/Parser/pragma-visibility2.c b/clang/test/Parser/pragma-visibility2.c
new file mode 100644
index 0000000..bcef09f
--- /dev/null
+++ b/clang/test/Parser/pragma-visibility2.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -emit-llvm -triple i386-linux-gnu -o %t %s
+// RUN: FileCheck --input-file=%t %s
+// PR10392
+
+#define push(foo) push(default)
+#pragma GCC visibility push(hidden)
+
+int v1;
+// CHECK: @v1 = common hidden global i32 0, align 4
+
+#pragma GCC visibility pop
+
+int v2;
+// CHECK: @v2 = common global i32 0, align 4
+
+_Pragma("GCC visibility push(hidden)");
+
+int v3;
+// CHECK: @v3 = common hidden global i32 0, align 4
diff --git a/clang/test/Parser/pragma-weak.c b/clang/test/Parser/pragma-weak.c
new file mode 100644
index 0000000..7e5740b
--- /dev/null
+++ b/clang/test/Parser/pragma-weak.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Note that this puts the expected lines before the directives to work around
+// limitations in the -verify mode.
+
+int x;
+/* expected-warning {{expected identifier in '#pragma weak'}}*/ #pragma weak
+#pragma weak x
+
+extern int z;
+/* expected-warning {{expected identifier in '#pragma weak'}}*/ #pragma weak z = =
+/* expected-warning {{expected identifier in '#pragma weak'}}*/ #pragma weak z =
+/* expected-warning {{weak identifier 'y' never declared}} */ #pragma weak z = y
+
+extern int a;
+/* expected-warning {{extra tokens at end of '#pragma weak'}}*/ #pragma weak a b
+/* expected-warning {{extra tokens at end of '#pragma weak'}}*/ #pragma weak a = x c
diff --git a/clang/test/Parser/prefix-attributes.m b/clang/test/Parser/prefix-attributes.m
new file mode 100644
index 0000000..399421f
--- /dev/null
+++ b/clang/test/Parser/prefix-attributes.m
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s
+
+__attribute__((deprecated)) @class B; // expected-error {{prefix attribute must be followed by an interface or protocol}}
+
+__attribute__((deprecated)) @interface A @end
+__attribute__((deprecated)) @protocol P0;
+__attribute__((deprecated)) @protocol P1
+@end
diff --git a/clang/test/Parser/promote_types_in_proto.c b/clang/test/Parser/promote_types_in_proto.c
new file mode 100644
index 0000000..969ba28
--- /dev/null
+++ b/clang/test/Parser/promote_types_in_proto.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s
+void functionPromotion(void f(char *const []));
+void arrayPromotion(char * const argv[]);
+
+int whatever(int argc, char *argv[])
+{
+ arrayPromotion(argv);
+ functionPromotion(arrayPromotion);
+}
diff --git a/clang/test/Parser/recovery.c b/clang/test/Parser/recovery.c
new file mode 100644
index 0000000..3916acf
--- /dev/null
+++ b/clang/test/Parser/recovery.c
@@ -0,0 +1,100 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fblocks %s
+
+// PR2241
+float test2241[2] = {
+ 1e, // expected-error {{exponent}}
+ 1ee0 // expected-error {{exponent}}
+};
+
+
+// Testcase derived from PR2692
+static void f (char * (*g) (char **, int), char **p, ...) {
+ char *s;
+ va_list v; // expected-error {{identifier}}
+ s = g (p, __builtin_va_arg(v, int)); // expected-error {{identifier}}
+}
+
+
+// PR3172
+} // expected-error {{extraneous closing brace ('}')}}
+
+
+// rdar://6094870
+void test(int a) {
+ struct { int i; } x;
+
+ if (x.hello) // expected-error {{no member named 'hello'}}
+ test(0);
+ else
+ ;
+
+ if (x.hello == 0) // expected-error {{no member named 'hello'}}
+ test(0);
+ else
+ ;
+
+ if ((x.hello == 0)) // expected-error {{no member named 'hello'}}
+ test(0);
+ else
+ ;
+
+ if (x.i == 0)) // expected-error {{expected expression}}
+ test(0);
+ else
+ ;
+}
+
+
+
+char (((( /* expected-note {{to match this '('}} */
+ *X x ] )))); /* expected-error {{expected ')'}} */
+
+; // expected-warning {{extra ';' outside of a function}}
+
+
+
+
+struct S { void *X, *Y; };
+
+struct S A = {
+&BADIDENT, 0 /* expected-error {{use of undeclared identifier}} */
+};
+
+// rdar://6248081
+void test6248081() {
+ [10] // expected-error {{expected expression}}
+}
+
+struct forward; // expected-note{{forward declaration of 'struct forward'}}
+void x(struct forward* x) {switch(x->a) {}} // expected-error {{incomplete definition of type}}
+
+// PR3410
+void foo() {
+ int X;
+ X = 4 // expected-error{{expected ';' after expression}}
+}
+
+// rdar://9045701
+void test9045701(int x) {
+#define VALUE 0
+ x = VALUE // expected-error{{expected ';' after expression}}
+}
+
+// rdar://7980651
+typedef int intptr_t; // expected-note {{'intptr_t' declared here}}
+void bar(intptr y); // expected-error {{unknown type name 'intptr'; did you mean 'intptr_t'?}}
+
+void test1(void) {
+ int x = 2: // expected-error {{expected ';' at end of declaration}}
+ int y = x;
+ int z = y;
+}
+
+void test2(int x) {
+#define VALUE2 VALUE+VALUE
+#define VALUE3 VALUE+0
+#define VALUE4(x) x+0
+ x = VALUE2 // expected-error{{expected ';' after expression}}
+ x = VALUE3 // expected-error{{expected ';' after expression}}
+ x = VALUE4(0) // expected-error{{expected ';' after expression}}
+}
diff --git a/clang/test/Parser/recovery.cpp b/clang/test/Parser/recovery.cpp
new file mode 100644
index 0000000..ffa1bab
--- /dev/null
+++ b/clang/test/Parser/recovery.cpp
@@ -0,0 +1,42 @@
+// RUN: %clang -cc1 -verify -std=c++11 %s
+
+8gi///===--- recovery.cpp ---===// // expected-error {{unqualified-id}}
+namespace Std { // expected-note {{here}}
+ typedef int Important;
+}
+
+/ redeclare as an inline namespace // expected-error {{unqualified-id}}
+inline namespace Std { // expected-error {{cannot be reopened as inline}}
+ Important n;
+} / end namespace Std // expected-error {{unqualified-id}}
+int x;
+Std::Important y;
+
+// FIXME: Recover as if the typo correction were applied.
+extenr "C" { // expected-error {{did you mean 'extern'}} expected-error {{unqualified-id}}
+ void f();
+}
+void g() {
+ z = 1; // expected-error {{undeclared}}
+ f(); // expected-error {{undeclared}}
+}
+
+struct S {
+ int a, b, c;
+ S();
+};
+8S::S() : a{ 5 }, b{ 6 }, c{ 2 } { // expected-error {{unqualified-id}}
+ return;
+}
+int k;
+int l = k;
+
+5int m = { l }, n = m; // expected-error {{unqualified-id}}
+
+namespace N {
+ int
+} // expected-error {{unqualified-id}}
+
+// FIXME: Recover as if the typo correction were applied.
+strcut U { // expected-error {{did you mean 'struct'}}
+} *u[3]; // expected-error {{expected ';'}}
diff --git a/clang/test/Parser/recovery.m b/clang/test/Parser/recovery.m
new file mode 100644
index 0000000..e126526
--- /dev/null
+++ b/clang/test/Parser/recovery.m
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fblocks %s
+
+@interface Test0
+@property (assign) id x // expected-error {{expected ';' at end of declaration list}}
+@end
diff --git a/clang/test/Parser/recursion-limits.cpp b/clang/test/Parser/recursion-limits.cpp
new file mode 100644
index 0000000..ea25dea
--- /dev/null
+++ b/clang/test/Parser/recursion-limits.cpp
@@ -0,0 +1,259 @@
+// RUN: %clang_cc1 -fsyntax-only %s -verify
+class outer {
+ class inner1 { inner1(); };
+ class inner2 { inner2(); };
+ class inner3 { inner3(); };
+ class inner4 { inner4(); };
+ class inner5 { inner5(); };
+ class inner6 { inner6(); };
+ class inner7 { inner7(); };
+ class inner8 { inner8(); };
+ class inner9 { inner9(); };
+ class inner10 { inner10(); };
+ class inner11 { inner11(); };
+ class inner12 { inner12(); };
+ class inner13 { inner13(); };
+ class inner14 { inner14(); };
+ class inner15 { inner15(); };
+ class inner16 { inner16(); };
+ class inner17 { inner17(); };
+ class inner18 { inner18(); };
+ class inner19 { inner19(); };
+ class inner20 { inner20(); };
+ class inner21 { inner21(); };
+ class inner22 { inner22(); };
+ class inner23 { inner23(); };
+ class inner24 { inner24(); };
+ class inner25 { inner25(); };
+ class inner26 { inner26(); };
+ class inner27 { inner27(); };
+ class inner28 { inner28(); };
+ class inner29 { inner29(); };
+ class inner30 { inner30(); };
+ class inner31 { inner31(); };
+ class inner32 { inner32(); };
+ class inner33 { inner33(); };
+ class inner34 { inner34(); };
+ class inner35 { inner35(); };
+ class inner36 { inner36(); };
+ class inner37 { inner37(); };
+ class inner38 { inner38(); };
+ class inner39 { inner39(); };
+ class inner40 { inner40(); };
+ class inner41 { inner41(); };
+ class inner42 { inner42(); };
+ class inner43 { inner43(); };
+ class inner44 { inner44(); };
+ class inner45 { inner45(); };
+ class inner46 { inner46(); };
+ class inner47 { inner47(); };
+ class inner48 { inner48(); };
+ class inner49 { inner49(); };
+ class inner50 { inner50(); };
+ class inner51 { inner51(); };
+ class inner52 { inner52(); };
+ class inner53 { inner53(); };
+ class inner54 { inner54(); };
+ class inner55 { inner55(); };
+ class inner56 { inner56(); };
+ class inner57 { inner57(); };
+ class inner58 { inner58(); };
+ class inner59 { inner59(); };
+ class inner60 { inner60(); };
+ class inner61 { inner61(); };
+ class inner62 { inner62(); };
+ class inner63 { inner63(); };
+ class inner64 { inner64(); };
+ class inner65 { inner65(); };
+ class inner66 { inner66(); };
+ class inner67 { inner67(); };
+ class inner68 { inner68(); };
+ class inner69 { inner69(); };
+ class inner70 { inner70(); };
+ class inner71 { inner71(); };
+ class inner72 { inner72(); };
+ class inner73 { inner73(); };
+ class inner74 { inner74(); };
+ class inner75 { inner75(); };
+ class inner76 { inner76(); };
+ class inner77 { inner77(); };
+ class inner78 { inner78(); };
+ class inner79 { inner79(); };
+ class inner80 { inner80(); };
+ class inner81 { inner81(); };
+ class inner82 { inner82(); };
+ class inner83 { inner83(); };
+ class inner84 { inner84(); };
+ class inner85 { inner85(); };
+ class inner86 { inner86(); };
+ class inner87 { inner87(); };
+ class inner88 { inner88(); };
+ class inner89 { inner89(); };
+ class inner90 { inner90(); };
+ class inner91 { inner91(); };
+ class inner92 { inner92(); };
+ class inner93 { inner93(); };
+ class inner94 { inner94(); };
+ class inner95 { inner95(); };
+ class inner96 { inner96(); };
+ class inner97 { inner97(); };
+ class inner98 { inner98(); };
+ class inner99 { inner99(); };
+ class inner100 { inner100(); };
+ class inner101 { inner101(); };
+ class inner102 { inner102(); };
+ class inner103 { inner103(); };
+ class inner104 { inner104(); };
+ class inner105 { inner105(); };
+ class inner106 { inner106(); };
+ class inner107 { inner107(); };
+ class inner108 { inner108(); };
+ class inner109 { inner109(); };
+ class inner110 { inner110(); };
+ class inner111 { inner111(); };
+ class inner112 { inner112(); };
+ class inner113 { inner113(); };
+ class inner114 { inner114(); };
+ class inner115 { inner115(); };
+ class inner116 { inner116(); };
+ class inner117 { inner117(); };
+ class inner118 { inner118(); };
+ class inner119 { inner119(); };
+ class inner120 { inner120(); };
+ class inner121 { inner121(); };
+ class inner122 { inner122(); };
+ class inner123 { inner123(); };
+ class inner124 { inner124(); };
+ class inner125 { inner125(); };
+ class inner126 { inner126(); };
+ class inner127 { inner127(); };
+ class inner128 { inner128(); };
+ class inner129 { inner129(); };
+ class inner130 { inner130(); };
+ class inner131 { inner131(); };
+ class inner132 { inner132(); };
+ class inner133 { inner133(); };
+ class inner134 { inner134(); };
+ class inner135 { inner135(); };
+ class inner136 { inner136(); };
+ class inner137 { inner137(); };
+ class inner138 { inner138(); };
+ class inner139 { inner139(); };
+ class inner140 { inner140(); };
+ class inner141 { inner141(); };
+ class inner142 { inner142(); };
+ class inner143 { inner143(); };
+ class inner144 { inner144(); };
+ class inner145 { inner145(); };
+ class inner146 { inner146(); };
+ class inner147 { inner147(); };
+ class inner148 { inner148(); };
+ class inner149 { inner149(); };
+ class inner150 { inner150(); };
+ class inner151 { inner151(); };
+ class inner152 { inner152(); };
+ class inner153 { inner153(); };
+ class inner154 { inner154(); };
+ class inner155 { inner155(); };
+ class inner156 { inner156(); };
+ class inner157 { inner157(); };
+ class inner158 { inner158(); };
+ class inner159 { inner159(); };
+ class inner160 { inner160(); };
+ class inner161 { inner161(); };
+ class inner162 { inner162(); };
+ class inner163 { inner163(); };
+ class inner164 { inner164(); };
+ class inner165 { inner165(); };
+ class inner166 { inner166(); };
+ class inner167 { inner167(); };
+ class inner168 { inner168(); };
+ class inner169 { inner169(); };
+ class inner170 { inner170(); };
+ class inner171 { inner171(); };
+ class inner172 { inner172(); };
+ class inner173 { inner173(); };
+ class inner174 { inner174(); };
+ class inner175 { inner175(); };
+ class inner176 { inner176(); };
+ class inner177 { inner177(); };
+ class inner178 { inner178(); };
+ class inner179 { inner179(); };
+ class inner180 { inner180(); };
+ class inner181 { inner181(); };
+ class inner182 { inner182(); };
+ class inner183 { inner183(); };
+ class inner184 { inner184(); };
+ class inner185 { inner185(); };
+ class inner186 { inner186(); };
+ class inner187 { inner187(); };
+ class inner188 { inner188(); };
+ class inner189 { inner189(); };
+ class inner190 { inner190(); };
+ class inner191 { inner191(); };
+ class inner192 { inner192(); };
+ class inner193 { inner193(); };
+ class inner194 { inner194(); };
+ class inner195 { inner195(); };
+ class inner196 { inner196(); };
+ class inner197 { inner197(); };
+ class inner198 { inner198(); };
+ class inner199 { inner199(); };
+ class inner200 { inner200(); };
+ class inner201 { inner201(); };
+ class inner202 { inner202(); };
+ class inner203 { inner203(); };
+ class inner204 { inner204(); };
+ class inner205 { inner205(); };
+ class inner206 { inner206(); };
+ class inner207 { inner207(); };
+ class inner208 { inner208(); };
+ class inner209 { inner209(); };
+ class inner210 { inner210(); };
+ class inner211 { inner211(); };
+ class inner212 { inner212(); };
+ class inner213 { inner213(); };
+ class inner214 { inner214(); };
+ class inner215 { inner215(); };
+ class inner216 { inner216(); };
+ class inner217 { inner217(); };
+ class inner218 { inner218(); };
+ class inner219 { inner219(); };
+ class inner220 { inner220(); };
+ class inner221 { inner221(); };
+ class inner222 { inner222(); };
+ class inner223 { inner223(); };
+ class inner224 { inner224(); };
+ class inner225 { inner225(); };
+ class inner226 { inner226(); };
+ class inner227 { inner227(); };
+ class inner228 { inner228(); };
+ class inner229 { inner229(); };
+ class inner230 { inner230(); };
+ class inner231 { inner231(); };
+ class inner232 { inner232(); };
+ class inner233 { inner233(); };
+ class inner234 { inner234(); };
+ class inner235 { inner235(); };
+ class inner236 { inner236(); };
+ class inner237 { inner237(); };
+ class inner238 { inner238(); };
+ class inner239 { inner239(); };
+ class inner240 { inner240(); };
+ class inner241 { inner241(); };
+ class inner242 { inner242(); };
+ class inner243 { inner243(); };
+ class inner244 { inner244(); };
+ class inner245 { inner245(); };
+ class inner246 { inner246(); };
+ class inner247 { inner247(); };
+ class inner248 { inner248(); };
+ class inner249 { inner249(); };
+ class inner250 { inner250(); };
+ class inner251 { inner251(); };
+ class inner252 { inner252(); };
+ class inner253 { inner253(); };
+ class inner254 { inner254(); };
+ class inner255 { inner255(); };
+ class inner256 { inner256(); };
+};
diff --git a/clang/test/Parser/selector-1.m b/clang/test/Parser/selector-1.m
new file mode 100644
index 0000000..5ba2da9
--- /dev/null
+++ b/clang/test/Parser/selector-1.m
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
+
+// rdar://8366474
+int main() {
+ SEL s = @selector(retain);
+ SEL s1 = @selector(meth1:);
+ SEL s2 = @selector(retainArgument::);
+ SEL s3 = @selector(retainArgument:::::);
+ SEL s4 = @selector(retainArgument:with:);
+ SEL s5 = @selector(meth1:with:with:);
+ SEL s6 = @selector(getEnum:enum:bool:);
+ SEL s7 = @selector(char:float:double:unsigned:short:long:);
+ SEL s9 = @selector(:enum:bool:);
+
+ (void) @selector(foo:);
+ (void) @selector(foo::);
+ (void) @selector(foo:::);
+ (void) @selector(foo::::);
+}
diff --git a/clang/test/Parser/skip-function-bodies.mm b/clang/test/Parser/skip-function-bodies.mm
new file mode 100644
index 0000000..8462f69
--- /dev/null
+++ b/clang/test/Parser/skip-function-bodies.mm
@@ -0,0 +1,45 @@
+// RUN: env CINDEXTEST_SKIP_FUNCTION_BODIES=1 c-index-test -test-load-source all %s | FileCheck %s
+
+class A {
+ class B {};
+
+public:
+ A() {
+ struct C {
+ void d() {}
+ };
+ }
+
+ typedef B E;
+};
+
+@interface F
+- (void) G;
+@end
+@implementation F
+- (void) G {
+ typedef A H;
+ class I {};
+}
+@end
+
+void J() {
+ class K {};
+}
+
+// CHECK: skip-function-bodies.mm:3:7: ClassDecl=A:3:7 (Definition) Extent=[3:1 - 14:2]
+// CHECK: skip-function-bodies.mm:4:9: ClassDecl=B:4:9 (Definition) Extent=[4:3 - 4:13]
+// CHECK: skip-function-bodies.mm:6:1: CXXAccessSpecifier=:6:1 (Definition) Extent=[6:1 - 6:8]
+// CHECK: skip-function-bodies.mm:7:3: CXXConstructor=A:7:3 Extent=[7:3 - 7:6]
+// CHECK-NOT: skip-function-bodies.mm:8:12: StructDecl=C:8:12 (Definition) Extent=[8:5 - 10:6]
+// CHECK-NOT: skip-function-bodies.mm:9:12: CXXMethod=d:9:12 (Definition) Extent=[9:7 - 9:18]
+// CHECK: skip-function-bodies.mm:13:13: TypedefDecl=E:13:13 (Definition) Extent=[13:3 - 13:14]
+// CHECK: skip-function-bodies.mm:13:11: TypeRef=class A::B:4:9 Extent=[13:11 - 13:12]
+// CHECK: skip-function-bodies.mm:16:12: ObjCInterfaceDecl=F:16:12 Extent=[16:1 - 18:5]
+// CHECK: skip-function-bodies.mm:17:10: ObjCInstanceMethodDecl=G:17:10 Extent=[17:1 - 17:12]
+// CHECK: skip-function-bodies.mm:19:17: ObjCImplementationDecl=F:19:17 (Definition) Extent=[19:1 - 24:2]
+// CHECK: skip-function-bodies.mm:20:10: ObjCInstanceMethodDecl=G:20:10 Extent=[20:1 - 20:13]
+// CHECK-NOT: skip-function-bodies.mm:21:13: TypedefDecl=H:21:13 (Definition) Extent=[21:3 - 21:14]
+// CHECK-NOT: skip-function-bodies.mm:21:11: TypeRef=class A:3:7 Extent=[21:11 - 21:12]
+// CHECK: skip-function-bodies.mm:26:6: FunctionDecl=J:26:6 Extent=[26:1 - 26:9]
+// CHECK-NOT: skip-function-bodies.mm:27:9: ClassDecl=K:27:9 (Definition) Extent=[27:3 - 27:13]
diff --git a/clang/test/Parser/statements.c b/clang/test/Parser/statements.c
new file mode 100644
index 0000000..3a123d6
--- /dev/null
+++ b/clang/test/Parser/statements.c
@@ -0,0 +1,64 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unreachable-code
+
+void test1() {
+ { ; { ;;}} ;;
+}
+
+void test2() {
+ if (0) { if (1) {} } else { }
+
+ do { } while (0);
+
+ while (0) while(0) do ; while(0);
+
+ for ((void)0;0;(void)0)
+ for (;;)
+ for ((void)9;0;(void)2)
+ ;
+ for (int X = 0; 0; (void)0);
+}
+
+void test3() {
+ switch (0) {
+
+ case 4:
+ if (0) {
+ case 6: ;
+ }
+ default:
+ ;
+ }
+}
+
+void test4() {
+ if (0); // expected-warning {{if statement has empty body}} expected-note {{put the semicolon on a separate line to silence this warning}}
+
+ int X; // declaration in a block.
+
+foo: if (0); // expected-warning {{if statement has empty body}} expected-note {{put the semicolon on a separate line to silence this warning}}
+}
+
+typedef int t;
+void test5() {
+ if (0); // expected-warning {{if statement has empty body}} expected-note {{put the semicolon on a separate line to silence this warning}}
+
+ t x = 0;
+
+ if (0); // expected-warning {{if statement has empty body}} expected-note {{put the semicolon on a separate line to silence this warning}}
+}
+
+
+void test6(void) {
+ do
+ . // expected-error {{expected expression}}
+ while (0);
+}
+
+int test7() {
+ return 4 // expected-error {{expected ';' after return statement}}
+}
+
+void test8() {
+ // Should not skip '}' and produce a "expected '}'" error.
+ undecl // expected-error {{use of undeclared identifier 'undecl'}}
+}
diff --git a/clang/test/Parser/struct-recursion.c b/clang/test/Parser/struct-recursion.c
new file mode 100644
index 0000000..834c5d0
--- /dev/null
+++ b/clang/test/Parser/struct-recursion.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 %s -fsyntax-only
+
+// C99 6.7.2.3p11
+
+// mutually recursive structs
+struct s1 { struct s2 *A; };
+struct s2 { struct s1 *B; };
+
+// both types are complete now.
+struct s1 a;
+struct s2 b;
diff --git a/clang/test/Parser/switch-recovery.cpp b/clang/test/Parser/switch-recovery.cpp
new file mode 100644
index 0000000..84ac0c8
--- /dev/null
+++ b/clang/test/Parser/switch-recovery.cpp
@@ -0,0 +1,172 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// <rdar://problem/7971948>
+struct A {};
+struct B {
+ void foo(int b) {
+ switch (a) { // expected-error{{use of undeclared identifier 'a'}}
+ default:
+ return;
+ }
+
+ switch (b) {
+ case 17 // expected-error{{expected ':' after 'case'}}
+ break;
+
+ default // expected-error{{expected ':' after 'default'}}
+ return;
+ }
+ }
+
+ void test2() {
+ enum X { Xa, Xb } x;
+
+ switch (x) { // expected-warning {{enumeration value 'Xb' not handled in switch}}
+ case Xa; // expected-error {{expected ':' after 'case'}}
+ break;
+ }
+
+ switch (x) {
+ default; // expected-error {{expected ':' after 'default'}}
+ break;
+ }
+ }
+
+ int test3(int i) {
+ switch (i) {
+ case 1: return 0;
+ 2: return 1; // expected-error {{expected 'case' keyword before expression}}
+ default: return 5;
+ }
+ }
+};
+
+int test4(int i) {
+ switch (i)
+ 1: return -1; // expected-error {{expected 'case' keyword before expression}}
+ return 0;
+}
+
+int test5(int i) {
+ switch (i) {
+ case 1: case 2: case 3: return 1;
+ {
+ 4:5:6:7: return 2; // expected-error 4{{expected 'case' keyword before expression}}
+ }
+ default: return -1;
+ }
+}
+
+int test6(int i) {
+ switch (i) {
+ case 1:
+ case 4:
+ // This class provides extra single colon tokens. Make sure no
+ // errors are seen here.
+ class foo{
+ public:
+ protected:
+ private:
+ };
+ case 2:
+ 5: // expected-error {{expected 'case' keyword before expression}}
+ default: return 1;
+ }
+}
+
+int test7(int i) {
+ switch (i) {
+ case false ? 1 : 2:
+ true ? 1 : 2: // expected-error {{expected 'case' keyword before expression}}
+ case 10:
+ 14 ? 3 : 4; // expected-warning {{expression result unused}}
+ default:
+ return 1;
+ }
+}
+
+enum foo { A, B, C};
+int test8( foo x ) {
+ switch (x) {
+ A: return 0; // FIXME: give a warning for unused labels that could also be
+ // a case expression.
+ default: return 1;
+ }
+}
+
+// Stress test to make sure Clang doesn't crash.
+void test9(int x) {
+ switch(x) {
+ case 1: return;
+ 2: case; // expected-error {{expected 'case' keyword before expression}} \
+ expected-error {{expected expression}}
+ 4:5:6: return; // expected-error 3{{expected 'case' keyword before expression}}
+ 7: :x; // expected-error {{expected 'case' keyword before expression}} \
+ expected-error {{expected expression}}
+ 8:: x; // expected-error {{expected ';' after expression}} \
+ expected-error {{no member named 'x' in the global namespace}} \
+ expected-warning {{expression result unused}}
+ 9:: :y; // expected-error {{expected ';' after expression}} \
+ expected-error {{expected unqualified-id}} \
+ expected-warning {{expression result unused}}
+ :; // expected-error {{expected expression}}
+ ::; // expected-error {{expected unqualified-id}}
+ }
+}
+
+void test10(int x) {
+ switch (x) {
+ case 1: {
+ struct Inner {
+ void g(int y) {
+ 2: y++; // expected-error {{expected ';' after expression}} \
+ // expected-warning {{expression result unused}}
+ }
+ };
+ break;
+ }
+ }
+}
+
+template<typename T>
+struct test11 {
+ enum { E };
+
+ void f(int x) {
+ switch (x) {
+ E: break; // FIXME: give a 'case' fix-it for unused labels that
+ // could also be an expression an a case label.
+ E+1: break; // expected-error {{expected 'case' keyword before expression}}
+ }
+ }
+};
+
+void test12(int x) {
+ switch (x) {
+ 0: // expected-error {{expected 'case' keyword before expression}}
+ while (x) {
+ 1: // expected-error {{expected 'case' keyword before expression}}
+ for (;x;) {
+ 2: // expected-error {{expected 'case' keyword before expression}}
+ if (x > 0) {
+ 3: // expected-error {{expected 'case' keyword before expression}}
+ --x;
+ }
+ }
+ }
+ }
+}
+
+void missing_statement_case(int x) {
+ switch (x) {
+ case 1:
+ case 0: // expected-error {{label at end of compound statement: expected statement}}
+ }
+}
+
+void missing_statement_default(int x) {
+ switch (x) {
+ case 0:
+ default: // expected-error {{label at end of compound statement: expected statement}}
+ }
+}
diff --git a/clang/test/Parser/top-level-semi-cxx0x.cpp b/clang/test/Parser/top-level-semi-cxx0x.cpp
new file mode 100644
index 0000000..be342a2
--- /dev/null
+++ b/clang/test/Parser/top-level-semi-cxx0x.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++11 -verify %s
+
+void foo();
+
+void bar() { };
+
+void wibble();
+
+;
+
+namespace Blah {
+ void f() { };
+
+ void g();
+}
diff --git a/clang/test/Parser/traditional_arg_scope.c b/clang/test/Parser/traditional_arg_scope.c
new file mode 100644
index 0000000..3811d0d
--- /dev/null
+++ b/clang/test/Parser/traditional_arg_scope.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only %s -verify
+
+int x(a) int a; {return a;}
+int y(b) int b; {return a;} // expected-error {{use of undeclared identifier}}
+
+// PR2332
+int a(a)int a;{a=10;return a;}
diff --git a/clang/test/Parser/typeof.c b/clang/test/Parser/typeof.c
new file mode 100644
index 0000000..7953a69
--- /dev/null
+++ b/clang/test/Parser/typeof.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+typedef int TInt;
+
+static void test() {
+ int *pi;
+
+ int typeof (int) aIntInt; // expected-error{{cannot combine with previous 'int' declaration specifier}}
+ short typeof (int) aShortInt; // expected-error{{'short typeof' is invalid}}
+ int int ttt; // expected-error{{cannot combine with previous 'int' declaration specifier}}
+ typeof(TInt) anInt;
+ short TInt eee; // expected-error{{expected ';' at end of declaration}}
+ void ary[7] fff; // expected-error{{array has incomplete element type 'void'}} expected-error{{expected ';' at end of declaration}}
+ typeof(void ary[7]) anIntError; // expected-error{{expected ')'}} expected-note {{to match this '('}} expected-error {{variable has incomplete type 'typeof(void)' (aka 'void')}}
+ typeof(const int) aci;
+ const typeof (*pi) aConstInt;
+ int xx;
+ int *i;
+}
+
+// <rdar://problem/8237491>
+void test2() {
+ int a;
+ short b;
+ __typeof__(a) (*f)(__typeof__(b));
+}
diff --git a/clang/test/Parser/types.c b/clang/test/Parser/types.c
new file mode 100644
index 0000000..53b9dd5
--- /dev/null
+++ b/clang/test/Parser/types.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+
+// Test the X can be overloaded inside the struct.
+typedef int X;
+struct Y { short X; };
+
+// Variable shadows type, PR3872
+
+typedef struct foo { int x; } foo;
+void test() {
+ foo *foo;
+ foo->x = 0;
+}
+
diff --git a/clang/test/Parser/warn-dangling-else.cpp b/clang/test/Parser/warn-dangling-else.cpp
new file mode 100644
index 0000000..e91af98
--- /dev/null
+++ b/clang/test/Parser/warn-dangling-else.cpp
@@ -0,0 +1,55 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wdangling-else %s
+
+void f(int a, int b, int c, int d, int e) {
+
+ // should warn
+ { if (a) if (b) d++; else e++; } // expected-warning {{add explicit braces to avoid dangling else}}
+ { if (a) while (b) if (c) d++; else e++; } // expected-warning {{add explicit braces to avoid dangling else}}
+ { if (a) switch (b) if (c) d++; else e++; } // expected-warning {{add explicit braces to avoid dangling else}}
+ { if (a) for (;;) if (c) d++; else e++; } // expected-warning {{add explicit braces to avoid dangling else}}
+ { if (a) if (b) if (d) d++; else e++; else d--; } // expected-warning {{add explicit braces to avoid dangling else}}
+
+ if (a)
+ if (b) {
+ d++;
+ } else e++; // expected-warning {{add explicit braces to avoid dangling else}}
+
+ // shouldn't
+ { if (a) if (b) d++; }
+ { if (a) if (b) if (c) d++; }
+ { if (a) if (b) d++; else e++; else d--; }
+ { if (a) if (b) if (d) d++; else e++; else d--; else e--; }
+ { if (a) do if (b) d++; else e++; while (c); }
+
+ if (a) {
+ if (b) d++;
+ else e++;
+ }
+
+ if (a) {
+ if (b) d++;
+ } else e++;
+}
+
+// Somewhat more elaborate case that shouldn't warn.
+class A {
+ public:
+ void operator<<(const char* s) {}
+};
+
+void HandleDisabledThing() {}
+A GetThing() { return A(); }
+
+#define FOO(X) \
+ switch (0) default: \
+ if (!(X)) \
+ HandleDisabledThing(); \
+ else \
+ GetThing()
+
+void f(bool cond) {
+ int x = 0;
+ if (cond)
+ FOO(x) << "hello"; // no warning
+}
+