Import Cobalt 19.master.0.203780 Includes the following patches: https://cobalt-review.googlesource.com/c/cobalt/+/5210 by errong.leng@samsung.com https://cobalt-review.googlesource.com/c/cobalt/+/5270 by linus.wang@samsung.com
diff --git a/src/third_party/llvm-project/clang/test/Parser/CompoundStmtScope.c b/src/third_party/llvm-project/clang/test/Parser/CompoundStmtScope.c new file mode 100644 index 0000000..4f99103 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/DelayedTemplateParsing.cpp b/src/third_party/llvm-project/clang/test/Parser/DelayedTemplateParsing.cpp new file mode 100644 index 0000000..6ea245c --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/DelayedTemplateParsing.cpp
@@ -0,0 +1,183 @@ +// RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify -std=c++11 %s + +template <class T> +class A { + void foo() { + undeclared(); + } + void foo2(); +}; + +template <class T> +class B { + void foo4() { } // expected-note {{previous definition is here}} + void foo4() { } // expected-error {{class member cannot be redeclared}} + void foo5() { } // expected-note {{previous definition is here}} + + friend void foo3() { + undeclared(); + } +}; + + +template <class T> +void B<T>::foo5() { // expected-error {{redefinition of 'foo5'}} +} + +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*)>()); +} + +} + +namespace rdar11700604 { + template<typename T> void foo() = delete; + + struct X { + X() = default; + + template<typename T> void foo() = delete; + }; +} + +namespace PR17334 { + +template <typename = void> struct ArrayRef { + constexpr ArrayRef() {} +}; +template <typename = void> void CreateConstInBoundsGEP2_32() { + ArrayRef<> IdxList; +} +void LLVMBuildStructGEP() { CreateConstInBoundsGEP2_32(); } + +} + +namespace PR17661 { +template <typename T> +constexpr T Fun(T A) { return T(0); } + +constexpr int Var = Fun(20); +} + +template <typename T> +auto invalidTrailingRetType() -> Bogus {} // expected-error {{unknown type name 'Bogus'}} + +namespace PR19613 { + +struct HeapTypeConfig { + static void from_bitset(); +}; + +template <class Config> +struct TypeImpl { + struct BitsetType; + + static void Any() { + BitsetType::New(); + } +}; + +template<class Config> +struct TypeImpl<Config>::BitsetType { + static void New() { + Config::from_bitset(); + } +}; + +static void f() { + TypeImpl<HeapTypeConfig>::Any(); +} + +template<typename A> struct S { + template<typename B> struct T; +}; +template<typename A> template<typename B> struct S<A>::T { + template<typename C, typename D> struct U; + template<typename C> struct U<C, C> { + template<typename E> static int f() { + return sizeof(A) + sizeof(B) + sizeof(C) + sizeof(E); + } + }; +}; + +static void g() { + S<int>::T<int>::U<int,int>::f<int>(); +} + +template<typename T> struct SS { + template<typename U> struct X; + template<typename U> struct X<U*>; +}; +template<typename T> template<typename U> struct SS<T>::X<U*> { + static int f() { + return sizeof(T) + sizeof(U); + } +}; + +static void h() { + SS<int>::X<int*>::f(); +} + +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/MicrosoftExtensions.c b/src/third_party/llvm-project/clang/test/Parser/MicrosoftExtensions.c new file mode 100644 index 0000000..2af6c42 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/MicrosoftExtensions.c
@@ -0,0 +1,117 @@ +// RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -Wno-missing-declarations -verify -fms-extensions %s +__stdcall int func0(void); +int __stdcall func(void); +typedef int (__cdecl *tptr)(void); +void (*__fastcall fastpfunc)(void); +extern __declspec(dllimport) void __stdcall VarR4FromDec(void); +__declspec(deprecated) __declspec(deprecated) char * __cdecl ltoa( long _Val, char * _DstBuf, int _Radix); +__declspec(safebuffers) __declspec(noalias) __declspec(restrict) void * __cdecl xxx(void *_Memory); /* expected-warning{{__declspec attribute 'safebuffers' is not supported}} */ +typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR; + +void * __ptr64 PtrToPtr64(const void *p) { + return((void * __ptr64) (unsigned __int64) (ULONG_PTR)p ); +} + +void * __ptr32 PtrToPtr32(const void *p) { + return((void * __ptr32) (unsigned __int32) (ULONG_PTR)p ); +} + +/* Both inline and __forceinline is OK. */ +inline void __forceinline pr8264(void) {} +__forceinline void inline pr8264_1(void) {} +void inline __forceinline pr8264_2(void) {} +void __forceinline inline pr8264_3(void) {} +/* But duplicate __forceinline causes warning. */ +void __forceinline __forceinline pr8264_4(void) { /* expected-warning{{duplicate '__forceinline' declaration specifier}} */ +} + +_inline int foo99(void) { return 99; } + +void test_ms_alignof_alias(void) { + unsigned int s = _alignof(int); + s = __builtin_alignof(int); +} + +/* Charify extension. */ +#define FOO(x) #@x +char x = FOO(a); +#define HASHAT #@ +#define MISSING_ARG(x) #@ +/* expected-error@-1 {{'#@' is not followed by a macro parameter}} */ + +typedef enum E { e1 }; + +enum __declspec(deprecated) E2 { i, j, k }; /* expected-note {{'E2' has been explicitly marked deprecated here}} */ +__declspec(deprecated) enum E3 { a, b, c } e; /* expected-note {{'e' has been explicitly marked deprecated here}} */ + +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 */ +[returnvalue:SA_Post( attr=1)] +int foo1([SA_Post(attr=1)] void *param); + +[unbalanced(attribute) /* expected-note {{to match this '['}} */ +void f(void); /* expected-error {{expected ']'}} */ + +void ms_intrinsics(int a) { + __noop(); + __assume(a); + __debugbreak(); +} + +struct __declspec(frobble) S1 {}; /* expected-warning {{__declspec attribute 'frobble' is not supported}} */ +struct __declspec(12) S2 {}; /* expected-error {{__declspec attributes must be an identifier or string literal}} */ +struct __declspec("testing") S3 {}; /* expected-warning {{__declspec attribute '"testing"' is not supported}} */ + +/* declspecs with arguments cannot have an empty argument list, even if the + arguments are optional. */ +__declspec(deprecated()) void dep_func_test(void); /* expected-error {{parentheses must be omitted if 'deprecated' attribute's argument list is empty}} */ +__declspec(deprecated) void dep_func_test2(void); +__declspec(deprecated("")) void dep_func_test3(void); + +/* Ensure multiple declspec attributes are supported */ +struct __declspec(align(8) deprecated) S4 {}; + +/* But multiple declspecs must still be legal */ +struct __declspec(deprecated frobble "testing") S5 {}; /* expected-warning {{__declspec attribute 'frobble' is not supported}} expected-warning {{__declspec attribute '"testing"' is not supported}} */ +struct __declspec(unknown(12) deprecated) S6 {}; /* expected-warning {{__declspec attribute 'unknown' is not supported}}*/ + +int * __sptr psp; +int * __uptr pup; +/* Either ordering is acceptable */ +int * __ptr32 __sptr psp32; +int * __ptr32 __uptr pup32; +int * __sptr __ptr64 psp64; +int * __uptr __ptr64 pup64; + +/* Legal to have nested pointer attributes */ +int * __sptr * __ptr32 ppsp32; + +// Ignored type qualifiers after comma in declarator lists +typedef int ignored_quals_dummy1, const volatile __ptr32 __ptr64 __w64 __unaligned __sptr __uptr ignored_quals1; // expected-warning {{qualifiers after comma in declarator list are ignored}} +typedef void(*ignored_quals_dummy2)(), __fastcall ignored_quals2; // expected-warning {{qualifiers after comma in declarator list are ignored}} +typedef void(*ignored_quals_dummy3)(), __stdcall ignored_quals3; // expected-warning {{qualifiers after comma in declarator list are ignored}} +typedef void(*ignored_quals_dummy4)(), __thiscall ignored_quals4; // expected-warning {{qualifiers after comma in declarator list are ignored}} +typedef void(*ignored_quals_dummy5)(), __cdecl ignored_quals5; // expected-warning {{qualifiers after comma in declarator list are ignored}} +typedef void(*ignored_quals_dummy6)(), __vectorcall ignored_quals6; // expected-warning {{qualifiers after comma in declarator list are ignored}} + +__declspec(align(16)) struct align_before_key1 {}; +__declspec(align(16)) struct align_before_key2 {} align_before_key2_var; +__declspec(align(16)) struct align_before_key3 {} *align_before_key3_var; +_Static_assert(__alignof(struct align_before_key1) == 16, ""); +_Static_assert(__alignof(struct align_before_key2) == 16, ""); +_Static_assert(__alignof(struct align_before_key3) == 16, ""); + +void PR28782(int i) { +foo: + int n; + switch (i) { + case 0: + int m; + } +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/MicrosoftExtensions.cpp b/src/third_party/llvm-project/clang/test/Parser/MicrosoftExtensions.cpp new file mode 100644 index 0000000..8799f49 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/MicrosoftExtensions.cpp
@@ -0,0 +1,433 @@ +// RUN: %clang_cc1 %s -triple i386-pc-win32 -std=c++14 -fsyntax-only -Wno-unused-getter-return-value -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 a string}} +struct __declspec(uuid(3)) uuid_attr_bad2 { };// expected-error {{'uuid' attribute requires 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}} +[uuid("000000000000-0000-1234-000000000047")] struct uuid_attr_bad6 { };// expected-error {{uuid attribute contains a malformed GUID}} + +__declspec(uuid("000000A0-0000-0000-C000-000000000046")) int i; // expected-warning {{'uuid' attribute only applies to structs, unions, classes, and enums}} + +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; + +[uuid("000000A0-0000-0000-C000-000000000049")] struct struct_with_uuid3; // expected-warning{{specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead}} + +struct +struct_with_uuid2 {} ; + +enum __declspec(uuid("000000A0-0000-0000-C000-000000000046")) +enum_with_uuid { }; +enum enum_without_uuid { }; + +int __declspec(uuid("000000A0-0000-0000-C000-000000000046")) inappropriate_uuid; // expected-warning {{'uuid' attribute only applies to}} + +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_with_uuid3); + __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(struct_with_uuid[1]); + __uuidof(struct_with_uuid*[1]); // expected-error {{cannot call operator __uuidof on a type with no GUID}} + __uuidof(const struct_with_uuid[1][1]); + __uuidof(const struct_with_uuid*[1][1]); // expected-error {{cannot call operator __uuidof on a type with no GUID}} + + __uuidof(enum_with_uuid); + __uuidof(enum_without_uuid); // expected-error {{cannot call operator __uuidof on a type with no GUID}} + __uuidof(enum_with_uuid*); + __uuidof(enum_without_uuid*); // expected-error {{cannot call operator __uuidof on a type with no GUID}} + __uuidof(enum_with_uuid[1]); + __uuidof(enum_with_uuid*[1]); // expected-error {{cannot call operator __uuidof on a type with no GUID}} + __uuidof(const enum_with_uuid[1][1]); + __uuidof(const enum_with_uuid*[1][1]); // 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)> // expected-note {{template parameter is declared here}} +class COM_CLASS_TEMPLATE { }; + +typedef COM_CLASS_TEMPLATE<struct_with_uuid, &*&__uuidof(struct_with_uuid)> COM_TYPE_1; // expected-warning {{non-type template argument containing a dereference operation is a Microsoft extension}} +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; + +COM_CLASS_TEMPLATE_REF<int, __uuidof(struct_with_uuid)> good_template_arg; + +COM_CLASS_TEMPLATE<int, __uuidof(struct_with_uuid)> bad_template_arg; // expected-error {{non-type template argument of type 'const _GUID' is not a constant expression}} + +namespace PR16911 { +struct __declspec(uuid("{12345678-1234-1234-1234-1234567890aB}")) uuid; +struct __declspec(uuid("{12345678-1234-1234-1234-1234567890aB}")) uuid2; + +template <typename T, typename T2> +struct thing { +}; + +struct empty {}; +struct inher : public thing<empty, uuid2> {}; + +struct __declspec(uuid("{12345678-1234-1234-1234-1234567890aB}")) uuid; +const struct _GUID *w = &__uuidof(inher); // expected-error{{cannot call operator __uuidof on a type with no GUID}} +const struct _GUID *x = &__uuidof(thing<uuid, inher>); +const struct _GUID *y = &__uuidof(thing<uuid2, uuid>); // expected-error{{cannot call operator __uuidof on a type with multiple GUIDs}} +thing<uuid2, uuid> thing_obj = thing<uuid2, uuid>(); +const struct _GUID *z = &__uuidof(thing_obj); // expected-error{{cannot call operator __uuidof on a type with multiple GUIDs}} +} + +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 { + typedef int D; +}; + +template <typename T> +class SimpleTemplate {}; + +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; + + typedef typename T* pointerT;// expected-warning {{expected a qualified name after 'typename'}} + typedef typename SimpleTemplate<int> templateT;// expected-warning {{expected a qualified name after 'typename'}} + + pointerT pT = &t; + *pT = 4; + + int var; + int k = typename var;// expected-error {{expected a qualified name after 'typename'}} +} + +template <typename T> +struct TypenameWrongPlace { + typename typedef T::D D;// expected-warning {{expected a qualified name after 'typename'}} +}; + +extern TypenameWrongPlace<AAAA> PR16925; + +__interface MicrosoftInterface; +__interface MicrosoftInterface { + void foo1() = 0; // expected-note {{overridden virtual function is here}} + virtual void foo2() = 0; +}; + +__interface MicrosoftDerivedInterface : public MicrosoftInterface { + void foo1(); // expected-warning {{'foo1' overrides a member function but is not marked 'override'}} + void foo2() override; + void foo3(); +}; + +void interface_test() { + MicrosoftInterface* a; + a->foo1(); + MicrosoftDerivedInterface* b; + b->foo2(); +} + +__int64 x7 = __int64(0); +_int64 x8 = _int64(0); +static_assert(sizeof(_int64) == 8, ""); +static_assert(sizeof(_int32) == 4, ""); +static_assert(sizeof(_int16) == 2, ""); +static_assert(sizeof(_int8) == 1, ""); + +int __identifier(generic) = 3; +int __identifier(int) = 4; +struct __identifier(class) { __identifier(class) *__identifier(for); }; +__identifier(class) __identifier(struct) = { &__identifier(struct) }; + +int __identifier for; // expected-error {{missing '(' after '__identifier'}} +int __identifier(else} = __identifier(for); // expected-error {{missing ')' after identifier}} expected-note {{to match this '('}} +#define identifier_weird(x) __identifier(x +int k = identifier_weird(if)); // expected-error {{use of undeclared identifier 'if'}} + +extern int __identifier(and); + +void f() { + __identifier(() // expected-error {{cannot convert '(' token to an identifier}} + __identifier(void) // expected-error {{use of undeclared identifier 'void'}} + __identifier()) // expected-error {{cannot convert ')' token to an identifier}} + // FIXME: We should pick a friendlier display name for this token kind. + __identifier(1) // expected-error {{cannot convert <numeric_constant> token to an identifier}} + __identifier(+) // expected-error {{cannot convert '+' token to an identifier}} + __identifier("foo") // expected-error {{cannot convert <string_literal> token to an identifier}} + __identifier(;) // expected-error {{cannot convert ';' token to an identifier}} +} + +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; +}; + +struct pure_virtual_dtor { + virtual ~pure_virtual_dtor() = 0; +}; +pure_virtual_dtor::~pure_virtual_dtor() { } + +struct pure_virtual_dtor_inline { + virtual ~pure_virtual_dtor_inline() = 0 { }// expected-warning {{function definition with pure-specifier is a Microsoft extension}} +}; + + +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; + } +} + +namespace Inheritance { + class __single_inheritance A; + class __multiple_inheritance B; + class __virtual_inheritance C; +} + +struct StructWithProperty { + __declspec(property) int V0; // expected-error {{expected '(' after 'property'}} + __declspec(property()) int V1; // expected-error {{property does not specify a getter or a putter}} + __declspec(property(set)) int V2; // expected-error {{putter for property must be specified as 'put', not 'set'}} expected-error {{expected '=' after 'set'}} + __declspec(property(ptu)) int V3; // expected-error {{missing 'get=' or 'put='}} + __declspec(property(ptu=PutV)) int V4; // expected-error {{expected 'get' or 'put' in property declaration}} + __declspec(property(get)) int V5; // expected-error {{expected '=' after 'get'}} + __declspec(property(get&)) int V6; // expected-error {{expected '=' after 'get'}} + __declspec(property(get=)) int V7; // expected-error {{expected name of accessor method}} + __declspec(property(get=GetV)) int V8; // no-warning + __declspec(property(get=GetV=)) int V9; // expected-error {{expected ',' or ')' at end of property accessor list}} + __declspec(property(get=GetV,)) int V10; // expected-error {{expected 'get' or 'put' in property declaration}} + __declspec(property(get=GetV,put=SetV)) int V11; // no-warning + __declspec(property(get=GetV,put=SetV,get=GetV)) int V12; // expected-error {{property declaration specifies 'get' accessor twice}} + __declspec(property(get=GetV)) int V13 = 3; // expected-error {{property declaration cannot have an in-class initializer}} + + int GetV() { return 123; } + void SetV(int v) {} +}; +void TestProperty() { + StructWithProperty sp; + sp.V8; + sp.V8 = 0; // expected-error {{no setter defined for property 'V8'}} + int i = sp.V11; + sp.V11 = i++; + sp.V11 += 8; + sp.V11++; + ++sp.V11; +} + +//expected-warning@+1 {{C++ operator 'and' (aka '&&') used as a macro name}} +#define and foo + +struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {}; + +typedef bool (__stdcall __stdcall *blarg)(int); + +void local_callconv() { + bool (__stdcall *p)(int); +} + +struct S7 { + int foo() { return 12; } + __declspec(property(get=foo) deprecated) int t; // expected-note {{'t' has been explicitly marked deprecated here}} +}; + +// Technically, this is legal (though it does nothing) +__declspec() void quux( void ) { + struct S7 s; + int i = s.t; // expected-warning {{'t' is deprecated}} +} + +void *_alloca(int); + +void foo(void) { + __declspec(align(16)) int *buffer = (int *)_alloca(9); +} + +template <int *> +struct NullptrArg {}; +NullptrArg<nullptr> a; + +// Ignored type qualifiers after comma in declarator lists +typedef int ignored_quals_dummy1, const volatile __ptr32 __ptr64 __w64 __unaligned __sptr __uptr ignored_quals1; // expected-warning {{qualifiers after comma in declarator list are ignored}} +typedef void(*ignored_quals_dummy2)(), __fastcall ignored_quals2; // expected-warning {{qualifiers after comma in declarator list are ignored}} +typedef void(*ignored_quals_dummy3)(), __stdcall ignored_quals3; // expected-warning {{qualifiers after comma in declarator list are ignored}} +typedef void(*ignored_quals_dummy4)(), __thiscall ignored_quals4; // expected-warning {{qualifiers after comma in declarator list are ignored}} +typedef void(*ignored_quals_dummy5)(), __cdecl ignored_quals5; // expected-warning {{qualifiers after comma in declarator list are ignored}} +typedef void(*ignored_quals_dummy6)(), __vectorcall ignored_quals6; // expected-warning {{qualifiers after comma in declarator list are ignored}} + +namespace { +bool f(int); +template <typename T> +struct A { + constexpr A(T t) { + __assume(f(t)); // expected-warning{{the argument to '__assume' has side effects that will be discarded}} + } + constexpr bool g() { return false; } +}; +constexpr A<int> h() { + A<int> b(0); // expected-note {{in instantiation of member function}} + return b; +} +static_assert(h().g() == false, ""); +} + +namespace { +__declspec(align(16)) struct align_before_key1 {}; +__declspec(align(16)) struct align_before_key2 {} align_before_key2_var; +__declspec(align(16)) struct align_before_key3 {} *align_before_key3_var; +static_assert(__alignof(struct align_before_key1) == 16, ""); +static_assert(__alignof(struct align_before_key2) == 16, ""); +static_assert(__alignof(struct align_before_key3) == 16, ""); +} + +namespace PR24027 { +struct S { + template <typename T> + S(T); +} f([] {}); +} + +namespace pr36638 { +// Make sure we accept __unaligned method qualifiers on member function +// pointers. +struct A; +void (A::*mp1)(int) __unaligned; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/MicrosoftExtensionsInlineAsm.c b/src/third_party/llvm-project/clang/test/Parser/MicrosoftExtensionsInlineAsm.c new file mode 100644 index 0000000..a973152 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/MicrosoftExtensionsInlineAsm.c
@@ -0,0 +1,13 @@ +// REQUIRES: x86-registered-target +// RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify -fms-extensions %s +// expected-no-diagnostics + +void __forceinline InterlockedBitTestAndSet (long *Base, long Bit) +{ + __asm { + mov eax, Bit + mov ecx, Base + lock bts [ecx], eax + setc al + }; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/PR11000.cpp b/src/third_party/llvm-project/clang/test/Parser/PR11000.cpp new file mode 100644 index 0000000..8d235cd --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/PR11000.cpp
@@ -0,0 +1,9 @@ +// RUN: not %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/src/third_party/llvm-project/clang/test/Parser/PR21872.cpp b/src/third_party/llvm-project/clang/test/Parser/PR21872.cpp new file mode 100644 index 0000000..ae0a13d --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/PR21872.cpp
@@ -0,0 +1,4 @@ +// RUN: not %clang_cc1 -fsyntax-only %s +template <typename T> struct S { + int k = (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +int f;
diff --git a/src/third_party/llvm-project/clang/test/Parser/access-spec-attrs.cpp b/src/third_party/llvm-project/clang/test/Parser/access-spec-attrs.cpp new file mode 100644 index 0000000..2958e38 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/access-spec-attrs.cpp
@@ -0,0 +1,13 @@ +// 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(); +private __attribute__((annotate())): // expected-error {{'annotate' attribute takes one argument}} +}; + +void f(X x) { + x.foo(); +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/altivec-csk-bool.c b/src/third_party/llvm-project/clang/test/Parser/altivec-csk-bool.c new file mode 100644 index 0000000..dc7fa1d --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/altivec-csk-bool.c
@@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -target-feature +altivec -fsyntax-only %s +// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only %s + +// PR16456: Verify that bool, true, false are treated as context-sensitive +// keywords (and therefore available for use as identifiers) when in +// Altivec mode. + +typedef enum { + false_value = 0, + true_value = 1 +} bool; + +#define true true_value +#define false false_value +
diff --git a/src/third_party/llvm-project/clang/test/Parser/altivec.c b/src/third_party/llvm-project/clang/test/Parser/altivec.c new file mode 100644 index 0000000..769b4de --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/altivec.c
@@ -0,0 +1,154 @@ +// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -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 __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 __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-error {{cannot use 'long double' with '__vector'}} +vector long double v_ld; // expected-error {{cannot use 'long double' with '__vector'}} +vector bool v_b; // expected-warning {{type specifier missing, defaults to 'int'}} +vector __bool v___b; // expected-warning {{type specifier missing, defaults to 'int'}} + +// These should have errors. +__vector double vv_d1; // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on POWER7 or later)}} +vector double v_d2; // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on POWER7 or later)}} +__vector bool long long v_bll1; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}} +__vector __bool long long v_bll2; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}} +vector bool long long v_bll3; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}} +vector __bool long long v_bll4; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}} +__vector long double vv_ld3; // expected-error {{cannot use 'long double' with '__vector'}} +vector long double v_ld4; // expected-error {{cannot use 'long 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 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 long is deprecated, but vector long long is not. +vector long long v_ll; +vector signed long long v_sll; +vector unsigned long long v_ull; + +typedef char i8; +typedef short i16; +typedef int i32; +struct S { + // i8, i16, i32 here are field names, not type names. + vector bool i8; // expected-error {{requires a specifier or qualifier}} + vector pixel i16; + vector long i32; // expected-warning {{deprecated}} +}; + +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' (vector of 2 'unsigned int' values) from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int' (vector of 4 'unsigned int' values)}} + av = gv8; // expected-error {{assigning to '__vector unsigned int' (vector of 4 'unsigned int' values) from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' (vector of 2 'unsigned int' values)}} + + 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/src/third_party/llvm-project/clang/test/Parser/annotation-token-in-lexed-body.cpp b/src/third_party/llvm-project/clang/test/Parser/annotation-token-in-lexed-body.cpp new file mode 100644 index 0000000..bcc9de1 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/annotation-token-in-lexed-body.cpp
@@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +struct S { // expected-note{{to match this}} + void f() { // expected-note{{to match this}} + // expected-error@+1{{expected '}'}} expected-error@+1{{expected '}'}} expected-error@+1{{expected ';'}} +#pragma pack()
diff --git a/src/third_party/llvm-project/clang/test/Parser/argument_qualified.c b/src/third_party/llvm-project/clang/test/Parser/argument_qualified.c new file mode 100644 index 0000000..7d1b9fd --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/argument_qualified.c
@@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s +int abc (const float x) { + return 1; +} +
diff --git a/src/third_party/llvm-project/clang/test/Parser/argument_redef.c b/src/third_party/llvm-project/clang/test/Parser/argument_redef.c new file mode 100644 index 0000000..519e8fd --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/argument_scope.c b/src/third_party/llvm-project/clang/test/Parser/argument_scope.c new file mode 100644 index 0000000..d2d10c2 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/arm-windows-calling-convention-handling.c b/src/third_party/llvm-project/clang/test/Parser/arm-windows-calling-convention-handling.c new file mode 100644 index 0000000..13669b1 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/arm-windows-calling-convention-handling.c
@@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -triple thumbv7-windows -fms-compatibility -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple aarch64-windows -fms-compatibility -fsyntax-only -verify %s + +int __cdecl cdecl(int a, int b, int c, int d) { // expected-no-diagnostics + return a + b + c + d; +} + +float __stdcall stdcall(float a, float b, float c, float d) { // expected-no-diagnostics + return a + b + c + d; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/asm-constraints-pr7869.c b/src/third_party/llvm-project/clang/test/Parser/asm-constraints-pr7869.c new file mode 100644 index 0000000..db36991 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/asm.c b/src/third_party/llvm-project/clang/test/Parser/asm.c new file mode 100644 index 0000000..dabb010 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/asm.c
@@ -0,0 +1,38 @@ +// 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'}} + + asm const (""); // expected-warning {{ignored const qualifier on asm}} + asm volatile (""); + asm restrict (""); // expected-warning {{ignored restrict qualifier on asm}} + // FIXME: Once GCC supports _Atomic, check whether it allows this. + asm _Atomic (""); // expected-warning {{ignored _Atomic qualifier on asm}} +} + + +// 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'}} + +asm() // expected-error {{expected string literal in 'asm'}} +// expected-error@-1 {{expected ';' after top-level asm block}} + +asm(; // expected-error {{expected string literal in 'asm'}} + +asm("") // expected-error {{expected ';' after top-level asm block}} + +// Unterminated asm strings at the end of the file were causing us to crash, so +// this needs to be last. rdar://15624081 +// expected-warning@+3 {{missing terminating '"' character}} +// expected-error@+2 {{expected string literal in 'asm'}} +// expected-error@+1 {{expected ';' after top-level asm block}} +asm("
diff --git a/src/third_party/llvm-project/clang/test/Parser/asm.cpp b/src/third_party/llvm-project/clang/test/Parser/asm.cpp new file mode 100644 index 0000000..9f64dfe --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/asm.cpp
@@ -0,0 +1,9 @@ +// 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}} +int foo6 asm ("" L"bar7"); // expected-error {{cannot use wide string literal in 'asm'}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/atomic.c b/src/third_party/llvm-project/clang/test/Parser/atomic.c new file mode 100644 index 0000000..e435518 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/atomic.c
@@ -0,0 +1,40 @@ +// RUN: %clang_cc1 -std=c11 %s -fsyntax-only -verify -pedantic + +typedef _Atomic(int) atomic_int; +typedef _Atomic int atomic_int; +typedef _Atomic _Atomic _Atomic(int) atomic_int; // expected-warning {{duplicate '_Atomic' declaration specifier}} + +typedef const int const_int; + +typedef const atomic_int const_atomic_int; +typedef _Atomic const int const_atomic_int; +typedef const _Atomic int const_atomic_int; +typedef const _Atomic(int) const_atomic_int; +typedef const _Atomic(_Atomic int) const_atomic_int; // expected-error {{_Atomic cannot be applied to atomic type '_Atomic(int)'}} +typedef _Atomic const_int const_atomic_int; +typedef _Atomic(const_int) const_atomic_int; // expected-error {{_Atomic cannot be applied to qualified type 'const_int' (aka 'const int')}} + +typedef int *_Atomic atomic_int_ptr; +typedef _Atomic(int *) atomic_int_ptr; +typedef int (*_Atomic atomic_int_ptr); + +typedef int _Atomic *int_atomic_ptr; +typedef _Atomic(int) *int_atomic_ptr; + +typedef int int_fn(); +typedef _Atomic int_fn atomic_int_fn; // expected-error {{_Atomic cannot be applied to function type 'int_fn' (aka 'int ()')}} +typedef _Atomic int atomic_int_array[3]; +typedef _Atomic atomic_int_array atomic_int_atomic_array; // expected-error {{_Atomic cannot be applied to array type 'atomic_int_array' (aka '_Atomic(int) [3]')}} + +_Atomic struct S { int n; }; // expected-warning {{'_Atomic' ignored on this declaration}} + +typedef _Atomic int __attribute__((address_space(1))) atomic_addr_space_int; +typedef _Atomic(int) __attribute__((address_space(1))) atomic_addr_space_int; + +typedef _Atomic int __attribute__((vector_size(16))) atomic_vector_int; +typedef _Atomic(int __attribute__((vector_size(16)))) atomic_vector_int; + +struct S +_Atomic atomic_s_no_missing_semicolon; + +int *const _Atomic atomic_return_type();
diff --git a/src/third_party/llvm-project/clang/test/Parser/attr-availability.c b/src/third_party/llvm-project/clang/test/Parser/attr-availability.c new file mode 100644 index 0000000..d812296 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/attr-availability.c
@@ -0,0 +1,32 @@ +// 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}} + +void f7() __attribute__((availability(macosx,message=L"wide"))); // expected-error {{expected string literal for optional message in 'availability' attribute}} + +void f8() __attribute__((availability(macosx,message="a" L"b"))); // expected-error {{expected string literal for optional message in 'availability' attribute}} + +// rdar://10095131 +enum E{ + gorf __attribute__((availability(macosx,introduced=8.5, message = 10.0))), // expected-error {{expected string literal for optional message in 'availability' attribute}} + 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/src/third_party/llvm-project/clang/test/Parser/attr-external-source-symbol-cxx11.cpp b/src/third_party/llvm-project/clang/test/Parser/attr-external-source-symbol-cxx11.cpp new file mode 100644 index 0000000..3457c6a --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/attr-external-source-symbol-cxx11.cpp
@@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// expected-no-diagnostics + +[[clang::external_source_symbol(language="Swift", defined_in="module")]] +void function() { }
diff --git a/src/third_party/llvm-project/clang/test/Parser/attr-external-source-symbol.m b/src/third_party/llvm-project/clang/test/Parser/attr-external-source-symbol.m new file mode 100644 index 0000000..772fde0 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/attr-external-source-symbol.m
@@ -0,0 +1,84 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +void function() __attribute__((external_source_symbol(language="Swift", defined_in="module", generated_declaration))); + +__attribute__((external_source_symbol(language="Swift", defined_in="module"))) +@interface I + +- (void)method __attribute__((external_source_symbol(defined_in= "module"))); + +@end + +enum E { + CaseA __attribute__((external_source_symbol(generated_declaration))), + CaseB __attribute__((external_source_symbol(generated_declaration, language="Swift"))) +} __attribute__((external_source_symbol(language = "Swift"))); + +void f2() +__attribute__((external_source_symbol())); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}} +void f3() +__attribute__((external_source_symbol(invalid))); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}} +void f4() +__attribute__((external_source_symbol(language))); // expected-error {{expected '=' after language}} +void f5() +__attribute__((external_source_symbol(language=))); // expected-error {{expected string literal for language name in 'external_source_symbol' attribute}} +void f6() +__attribute__((external_source_symbol(defined_in=20))); // expected-error {{expected string literal for source container name in 'external_source_symbol' attribute}} + +void f7() +__attribute__((external_source_symbol(generated_declaration, generated_declaration))); // expected-error {{duplicate 'generated_declaration' clause in an 'external_source_symbol' attribute}} +void f8() +__attribute__((external_source_symbol(language="Swift", language="Swift"))); // expected-error {{duplicate 'language' clause in an 'external_source_symbol' attribute}} +void f9() +__attribute__((external_source_symbol(defined_in="module", language="Swift", defined_in="foo"))); // expected-error {{duplicate 'defined_in' clause in an 'external_source_symbol' attribute}} + +void f10() +__attribute__((external_source_symbol(generated_declaration, language="Swift", defined_in="foo", generated_declaration, generated_declaration, language="Swift"))); // expected-error {{duplicate 'generated_declaration' clause in an 'external_source_symbol' attribute}} + +void f11() +__attribute__((external_source_symbol(language="Objective-C++", defined_in="Some file with spaces"))); + +void f12() +__attribute__((external_source_symbol(language="C Sharp", defined_in="file:////Hello world with spaces. cs"))); + +void f13() +__attribute__((external_source_symbol(language=Swift))); // expected-error {{expected string literal for language name in 'external_source_symbol' attribute}} + +void f14() +__attribute__((external_source_symbol(=))); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}} + +void f15() +__attribute__((external_source_symbol(="Swift"))); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}} + +void f16() +__attribute__((external_source_symbol("Swift", "module", generated_declaration))); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}} + +void f17() +__attribute__((external_source_symbol(language="Swift", "generated_declaration"))); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}} + +void f18() +__attribute__((external_source_symbol(language= =))); // expected-error {{expected string literal for language name in 'external_source_symbol' attribute}} + +void f19() +__attribute__((external_source_symbol(defined_in="module" language="swift"))); // expected-error {{expected ')'}} expected-note {{to match this '('}} + +void f20() +__attribute__((external_source_symbol(defined_in="module" language="swift" generated_declaration))); // expected-error {{expected ')'}} expected-note {{to match this '('}} + +void f21() +__attribute__((external_source_symbol(defined_in= language="swift"))); // expected-error {{expected string literal for source container name in 'external_source_symbol' attribute}} + +void f22() +__attribute__((external_source_symbol)); // expected-error {{'external_source_symbol' attribute takes at least 1 argument}} + +void f23() +__attribute__((external_source_symbol(defined_in=, language="swift" generated_declaration))); // expected-error {{expected string literal for source container name in 'external_source_symbol' attribute}} expected-error{{expected ')'}} expected-note{{to match this '('}} + +void f24() +__attribute__((external_source_symbol(language = generated_declaration))); // expected-error {{expected string literal for language name in 'external_source_symbol' attribute}} + +void f25() +__attribute__((external_source_symbol(defined_in=123, defined_in="module"))); // expected-error {{expected string literal for source container name in 'external_source_symbol'}} expected-error {{duplicate 'defined_in' clause in an 'external_source_symbol' attribute}} + +void f26() +__attribute__((external_source_symbol(language=Swift, language="Swift", error))); // expected-error {{expected string literal for language name in 'external_source_symbol'}} expected-error {{duplicate 'language' clause in an 'external_source_symbol' attribute}} expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/attributes.c b/src/third_party/llvm-project/clang/test/Parser/attributes.c new file mode 100644 index 0000000..b815b8d --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/attributes.c
@@ -0,0 +1,107 @@ +// 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 2{{expected ')'}} expected-note {{to match}} expected-warning {{does not declare anything}} +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; } + +void deprecatedTestFun(void) __attribute__((deprecated())); + +struct s { + int a; +}; + +// This test ensure compatibility with parsing GNU-style attributes +// where the attribute is on a separate line from the elaborated type +// specifier. +struct s +__attribute__((used)) bar;
diff --git a/src/third_party/llvm-project/clang/test/Parser/attributes.mm b/src/third_party/llvm-project/clang/test/Parser/attributes.mm new file mode 100644 index 0000000..024606b --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/attributes.mm
@@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -verify -fsyntax-only -Wno-objc-root-class %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 + +#define EXP __attribute__((visibility("default"))) +class EXP C {}; +EXP class C2 {}; // expected-warning {{attribute 'visibility' is ignored, place it after "class" to apply attribute to type declaration}} + +@interface EXP I @end // expected-error {{postfix attributes are not allowed on Objective-C directives, place them in front of '@interface'}} +EXP @interface I2 @end + +@implementation EXP I @end // expected-error-re {{postfix attributes are not allowed on Objective-C directives{{$}}}} +// FIXME: Prefix attribute recovery skips until ';' +EXP @implementation I2 @end; // expected-error {{prefix attribute must be followed by an interface or protocol}} + +@class EXP OC; // expected-error-re {{postfix attributes are not allowed on Objective-C directives{{$}}}} +EXP @class OC2; // expected-error {{prefix attribute must be followed by an interface or protocol}} + +@protocol EXP P @end // expected-error {{postfix attributes are not allowed on Objective-C directives, place them in front of '@protocol'}} +EXP @protocol P2 @end
diff --git a/src/third_party/llvm-project/clang/test/Parser/backtrack-crash.cpp b/src/third_party/llvm-project/clang/test/Parser/backtrack-crash.cpp new file mode 100644 index 0000000..cc26873 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/backtrack-off-by-one.cpp b/src/third_party/llvm-project/clang/test/Parser/backtrack-off-by-one.cpp new file mode 100644 index 0000000..52e1c41 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/backtrack-off-by-one.cpp
@@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -verify %s +// RUN: %clang_cc1 -verify %s -std=c++98 +// RUN: %clang_cc1 -verify %s -std=c++11 +// RUN: %clang_cc1 -verify %s -std=c++1z + +// PR25946 +// We had an off-by-one error in an assertion when annotating A<int> below. Our +// error recovery checks if A<int> is a constructor declarator, and opens a +// TentativeParsingAction. Then we attempt to annotate the token at the exact +// position that we want to possibly backtrack to, and this used to crash. + +template <typename T> class A {}; + +// expected-error@+1 {{expected '{' after base class list}} +template <typename T> class B : T // not ',' or '{' +#if __cplusplus < 201103L +// expected-error@+8 {{expected ';' after top level declarator}} +#endif +#if __cplusplus <= 201402L +// expected-error@+5 {{C++ requires a type specifier for all declarations}} +#else +// expected-error@+3 {{expected unqualified-id}} +#endif +// expected-error@+1 {{expected ';' after class}} +A<int> { +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/bad-control.c b/src/third_party/llvm-project/clang/test/Parser/bad-control.c new file mode 100644 index 0000000..72614eb --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/bad-control.c
@@ -0,0 +1,24 @@ +/* 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}} */ +} + +int pr8880_9 (int first) { + switch(({ if (first) { first = 0; break; } 1; })) { // expected-error {{'break' statement not in loop or switch statement}} + case 2: return 2; + default: return 0; + } +} + +void pr8880_24() { + for (({break;});;); // expected-error {{'break' statement not in loop or switch statement}} +} + +void pr8880_25() { + for (({continue;});;); // expected-error {{'continue' statement not in loop statement}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/block-block-storageclass.c b/src/third_party/llvm-project/clang/test/Parser/block-block-storageclass.c new file mode 100644 index 0000000..53cd997 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/block-block-storageclass.c
@@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s +// expected-no-diagnostics +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/src/third_party/llvm-project/clang/test/Parser/block-pointer-decl.c b/src/third_party/llvm-project/clang/test/Parser/block-pointer-decl.c new file mode 100644 index 0000000..d88daf3 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/block-pointer-decl.c
@@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s +// expected-no-diagnostics + +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/src/third_party/llvm-project/clang/test/Parser/bracket-crash.cpp b/src/third_party/llvm-project/clang/test/Parser/bracket-crash.cpp new file mode 100644 index 0000000..93b5294 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/bracket-crash.cpp
@@ -0,0 +1,9 @@ +// RUN: not %clang_cc1 -fsyntax-only -std=c++11 %s +// PR7481 +decltype(; +struct{ + a +} + +// PR14549. Must be at end of file. +decltype(
diff --git a/src/third_party/llvm-project/clang/test/Parser/brackets.c b/src/third_party/llvm-project/clang/test/Parser/brackets.c new file mode 100644 index 0000000..4ce38bd --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/brackets.c
@@ -0,0 +1,79 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: cp %s %t +// RUN: not %clang_cc1 -fixit %t -x c -DFIXIT +// RUN: %clang_cc1 -fsyntax-only %t -x c -DFIXIT +// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s -strict-whitespace + +void test1() { + int a[] = {0,1,1,2,3}; + int []b = {0,1,4,9,16}; + // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the identifier}} + // CHECK: {{^}} int []b = {0,1,4,9,16}; + // CHECK: {{^}} ~~ ^ + // CHECK: {{^}} [] + // CHECK: fix-it:{{.*}}:{[[@LINE-5]]:7-[[@LINE-5]]:9}:"" + // CHECK: fix-it:{{.*}}:{[[@LINE-6]]:10-[[@LINE-6]]:10}:"[]" + + int c = a[0]; + int d = b[0]; // No undeclared identifier error here. + + int *e = a; + int *f = b; // No undeclared identifier error here. +} + +struct S { + int [1][1]x; + // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the identifier}} + // CHECK: {{^}} int [1][1]x; + // CHECK: {{^}} ~~~~~~ ^ + // CHECK: {{^}} [1][1] + // CHECK: fix-it:{{.*}}:{[[@LINE-5]]:7-[[@LINE-5]]:13}:"" + // CHECK: fix-it:{{.*}}:{[[@LINE-6]]:14-[[@LINE-6]]:14}:"[1][1]" +} s; + +#ifndef FIXIT +void test2() { + int [][][]; + // expected-error@-1{{expected identifier or '('}} + // CHECK: {{^}} int [][][]; + // CHECK: {{^}} ^ + // CHECK-NOT: fix-it + struct T { + int []; + // expected-error@-1{{expected member name or ';' after declaration specifiers}} + // CHECK: {{^}} int []; + // CHECK: {{^}} ~~~ ^ + // CHECK-NOT: fix-it + }; +} + +void test3() { + int [5] *; + // expected-error@-1{{expected identifier or '('}} + // CHECK: {{^}} int [5] *; + // CHECK: {{^}} ^ + // CHECK-NOT: fix-it + // expected-error@-5{{brackets are not allowed here; to declare an array, place the brackets after the identifier}} + // CHECK: {{^}} int [5] *; + // CHECK: {{^}} ~~~~ ^ + // CHECK: {{^}} ()[5] + // CHECK: fix-it:{{.*}}:{[[@LINE-9]]:7-[[@LINE-9]]:11}:"" + // CHECK: fix-it:{{.*}}:{[[@LINE-10]]:11-[[@LINE-10]]:11}:"(" + // CHECK: fix-it:{{.*}}:{[[@LINE-11]]:12-[[@LINE-11]]:12}:")[5]" + + int [5] * a; + // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the identifier}} + // CHECK: {{^}} int [5] * a; + // CHECK: {{^}} ~~~~ ^ + // CHECK: {{^}} ( )[5] + // CHECK: fix-it:{{.*}}:{[[@LINE-5]]:7-[[@LINE-5]]:11}:"" + // CHECK: fix-it:{{.*}}:{[[@LINE-6]]:11-[[@LINE-6]]:11}:"(" + // CHECK: fix-it:{{.*}}:{[[@LINE-7]]:14-[[@LINE-7]]:14}:")[5]" + + int *b[5] = a; // expected-error{{}} a should not be corrected to type b + + int (*c)[5] = a; // a should be the same type as c +} +#endif + +// CHECK: 8 errors generated.
diff --git a/src/third_party/llvm-project/clang/test/Parser/brackets.cpp b/src/third_party/llvm-project/clang/test/Parser/brackets.cpp new file mode 100644 index 0000000..415cbdd --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/brackets.cpp
@@ -0,0 +1,161 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: cp %s %t +// RUN: not %clang_cc1 -fixit %t -x c++ -DFIXIT +// RUN: %clang_cc1 -fsyntax-only %t -x c++ -DFIXIT +// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s -strict-whitespace + +void test1() { + int a[] = {0,1,1,2,3}; + int []b = {0,1,4,9,16}; + // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}} + // CHECK: {{^}} int []b = {0,1,4,9,16}; + // CHECK: {{^}} ~~ ^ + // CHECK: {{^}} [] + // CHECK: fix-it:{{.*}}:{[[@LINE-5]]:7-[[@LINE-5]]:9}:"" + // CHECK: fix-it:{{.*}}:{[[@LINE-6]]:10-[[@LINE-6]]:10}:"[]" + + int c = a[0]; + int d = b[0]; // No undeclared identifier error here. + + int *e = a; + int *f = b; // No undeclared identifier error here. + + int[1] g[2]; + // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}} + // CHECK: {{^}} int[1] g[2]; + // CHECK: {{^}} ~~~ ^ + // CHECK: {{^}} [1] + // CHECK: fix-it:{{.*}}:{[[@LINE-5]]:6-[[@LINE-5]]:9}:"" + // CHECK: fix-it:{{.*}}:{[[@LINE-6]]:14-[[@LINE-6]]:14}:"[1]" +} + +void test2() { + int [3] (*a) = 0; + // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}} + // CHECK: {{^}} int [3] (*a) = 0; + // CHECK: {{^}} ~~~~ ^ + // CHECK: {{^}} [3] + // CHECK: fix-it:{{.*}}:{[[@LINE-5]]:7-[[@LINE-5]]:11}:"" + // CHECK: fix-it:{{.*}}:{[[@LINE-6]]:15-[[@LINE-6]]:15}:"[3]" + +#ifndef FIXIT + // Make sure a is corrected to be like type y, instead of like type z. + int (*b)[3] = a; + int (*c[3]) = a; // expected-error{{}} +#endif +} + +struct A { + static int [1][1]x; + // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}} + // CHECK: {{^}} static int [1][1]x; + // CHECK: {{^}} ~~~~~~ ^ + // CHECK: {{^}} [1][1] + // CHECK: fix-it:{{.*}}:{[[@LINE-5]]:14-[[@LINE-5]]:20}:"" + // CHECK: fix-it:{{.*}}:{[[@LINE-6]]:21-[[@LINE-6]]:21}:"[1][1]" +}; + +int [1][1]A::x = { {42} }; +// expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}} +// CHECK: {{^}}int [1][1]A::x = { {42} }; +// CHECK: {{^}} ~~~~~~ ^ +// CHECK: {{^}} [1][1] +// CHECK: fix-it:{{.*}}:{[[@LINE-5]]:5-[[@LINE-5]]:11}:"" +// CHECK: fix-it:{{.*}}:{[[@LINE-6]]:15-[[@LINE-6]]:15}:"[1][1]" + +struct B { static int (*x)[5]; }; +int [5] *B::x = 0; +// expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}} +// CHECK: {{^}}int [5] *B::x = 0; +// CHECK: {{^}} ~~~~ ^ +// CHECK: {{^}} ( )[5] +// CHECK: fix-it:{{.*}}:{[[@LINE-5]]:5-[[@LINE-5]]:9}:"" +// CHECK: fix-it:{{.*}}:{[[@LINE-6]]:9-[[@LINE-6]]:9}:"(" +// CHECK: fix-it:{{.*}}:{[[@LINE-7]]:14-[[@LINE-7]]:14}:")[5]" + +void test3() { + int [3] *a; + // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}} + // CHECK: {{^}} int [3] *a; + // CHECK: {{^}} ~~~~ ^ + // CHECK: {{^}} ( )[3] + // CHECK: fix-it:{{.*}}:{[[@LINE-5]]:7-[[@LINE-5]]:11}:"" + // CHECK: fix-it:{{.*}}:{[[@LINE-6]]:11-[[@LINE-6]]:11}:"(" + // CHECK: fix-it:{{.*}}:{[[@LINE-7]]:13-[[@LINE-7]]:13}:")[3]" + + int (*b)[3] = a; // no error +} + +void test4() { + int [2] a; + // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}} + // CHECK: {{^}} int [2] a; + // CHECK: {{^}} ~~~~ ^ + // CHECK: {{^}} [2] + // CHECK: fix-it:{{.*}}:{[[@LINE-5]]:7-[[@LINE-5]]:11}:"" + // CHECK: fix-it:{{.*}}:{[[@LINE-6]]:12-[[@LINE-6]]:12}:"[2]" + + int [2] &b = a; + // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}} + // CHECK: {{^}} int [2] &b = a; + // CHECK: {{^}} ~~~~ ^ + // CHECK: {{^}} ( )[2] + // CHECK: fix-it:{{.*}}:{[[@LINE-5]]:7-[[@LINE-5]]:11}:"" + // CHECK: fix-it:{{.*}}:{[[@LINE-6]]:11-[[@LINE-6]]:11}:"(" + // CHECK: fix-it:{{.*}}:{[[@LINE-7]]:13-[[@LINE-7]]:13}:")[2]" + +} + +namespace test5 { +#ifndef FIXIT +int [][][]; +// expected-error@-1{{expected unqualified-id}} +// CHECK: {{^}}int [][][]; +// CHECK: {{^}} ^ + +struct C { + int []; + // expected-error@-1{{expected member name or ';' after declaration specifiers}} + // CHECK: {{^}} int []; + // CHECK: {{^}} ~~~ ^ +}; + +#endif +} + +namespace test6 { +struct A { + static int arr[3]; +}; +int [3] ::test6::A::arr = {1,2,3}; +// expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}} +// CHECK: {{^}}int [3] ::test6::A::arr = {1,2,3}; +// CHECK: {{^}} ~~~~ ^ +// CHECK: {{^}} [3] +// CHECK: fix-it:{{.*}}:{[[@LINE-5]]:5-[[@LINE-5]]:9}:"" +// CHECK: fix-it:{{.*}}:{[[@LINE-6]]:24-[[@LINE-6]]:24}:"[3]" + +} + +namespace test7 { +class A{}; +void test() { + int [3] A::*a; + // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}} + // CHECK: {{^}} int [3] A::*a; + // CHECK: {{^}} ~~~~ ^ + // CHECK: {{^}} ( )[3] + // CHECK: fix-it:{{.*}}:{[[@LINE-5]]:7-[[@LINE-5]]:11}:"" + // CHECK: fix-it:{{.*}}:{[[@LINE-6]]:11-[[@LINE-6]]:11}:"(" + // CHECK: fix-it:{{.*}}:{[[@LINE-7]]:16-[[@LINE-7]]:16}:")[3]" +} +} + +namespace test8 { +struct A { + static const char f[]; +}; +const char[] A::f = "f"; +// expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}} +} +// CHECK: 15 errors generated.
diff --git a/src/third_party/llvm-project/clang/test/Parser/builtin_classify_type.c b/src/third_party/llvm-project/clang/test/Parser/builtin_classify_type.c new file mode 100644 index 0000000..63fd8e2 --- /dev/null +++ b/src/third_party/llvm-project/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 cannot have 'static' storage duration}} + static int ary3[(*__builtin_classify_type)(a)]; // expected-error{{builtin functions must be directly called}} + + 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/src/third_party/llvm-project/clang/test/Parser/builtin_types_compatible.c b/src/third_party/llvm-project/clang/test/Parser/builtin_types_compatible.c new file mode 100644 index 0000000..d967a70 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/builtin_types_compatible.c
@@ -0,0 +1,60 @@ +// 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); + +} + +enum E1 { E1Foo }; +enum E2 { E2Foo }; + +static void testGccCompatibility() { + _Static_assert(__builtin_types_compatible_p(const volatile int, int), ""); + _Static_assert(__builtin_types_compatible_p(int[5], int[]), ""); + _Static_assert(!__builtin_types_compatible_p(int[5], int[4]), ""); + _Static_assert(!__builtin_types_compatible_p(int *, int **), ""); + _Static_assert(!__builtin_types_compatible_p(const int *, int *), ""); + _Static_assert(!__builtin_types_compatible_p(enum E1, enum E2), ""); + + // GCC's __builtin_types_compatible_p ignores qualifiers on arrays. + _Static_assert(__builtin_types_compatible_p(const int[4], int[4]), ""); + _Static_assert(__builtin_types_compatible_p(int[4], const int[4]), ""); + _Static_assert(__builtin_types_compatible_p(const int[5][4], int[][4]), ""); + _Static_assert(!__builtin_types_compatible_p(const int(*)[], int(*)[]), ""); +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/c-namespace.c b/src/third_party/llvm-project/clang/test/Parser/c-namespace.c new file mode 100644 index 0000000..fbef09e --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/c11-noreturn.c b/src/third_party/llvm-project/clang/test/Parser/c11-noreturn.c new file mode 100644 index 0000000..9b932ab --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/c11-noreturn.c
@@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -std=c11 -fsyntax-only -verify %s +// RUN: not %clang_cc1 -std=c99 -pedantic -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-EXT %s + +_Noreturn int f(); +int _Noreturn f(); // expected-note {{previous}} +int f _Noreturn(); // expected-error {{expected ';'}} expected-error 2{{}} +int f() _Noreturn; // expected-error {{'_Noreturn' keyword must precede function declarator}} + +_Noreturn char c1; // expected-error {{'_Noreturn' can only appear on functions}} +char _Noreturn c2; // expected-error {{'_Noreturn' can only appear on functions}} + +typedef _Noreturn int g(); // expected-error {{'_Noreturn' can only appear on functions}} + +_Noreturn int; // expected-error {{'_Noreturn' can only appear on functions}} expected-warning {{does not declare anything}} +_Noreturn struct S; // expected-error {{'_Noreturn' can only appear on functions}} +_Noreturn enum E { e }; // expected-error {{'_Noreturn' can only appear on functions}} + +// CHECK-EXT: _Noreturn functions are a C11-specific feature
diff --git a/src/third_party/llvm-project/clang/test/Parser/c1x-alignas.c b/src/third_party/llvm-project/clang/test/Parser/c1x-alignas.c new file mode 100644 index 0000000..ce8436c --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/c1x-alignas.c
@@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -std=c11 -fsyntax-only -verify %s +// RUN: not %clang_cc1 -std=c99 -pedantic -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-EXT %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}} expected-warning {{declaration does not declare anything}} + +char _Alignas(_Alignof(int)) c5; + +// CHECK-EXT: _Alignas is a C11-specific feature +// CHECK-EXT: _Alignof is a C11-specific feature
diff --git a/src/third_party/llvm-project/clang/test/Parser/c1x-generic-selection.c b/src/third_party/llvm-project/clang/test/Parser/c1x-generic-selection.c new file mode 100644 index 0000000..ee23059 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/c2x-attributes.c b/src/third_party/llvm-project/clang/test/Parser/c2x-attributes.c new file mode 100644 index 0000000..f261dee --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/c2x-attributes.c
@@ -0,0 +1,122 @@ +// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -verify %s + +enum [[]] E { + One [[]], + Two, + Three [[]] +}; + +enum [[]] { Four }; +[[]] enum E2 { Five }; // expected-error {{misplaced attributes}} + +// FIXME: this diagnostic can be improved. +enum { [[]] Six }; // expected-error {{expected identifier}} + +// FIXME: this diagnostic can be improved. +enum E3 [[]] { Seven }; // expected-error {{expected identifier or '('}} + +struct [[]] S1 { + int i [[]]; + int [[]] j; + int k[10] [[]]; + int l[[]][10]; + [[]] int m, n; + int o [[]] : 12; +}; + +[[]] struct S2 { int a; }; // expected-error {{misplaced attributes}} +struct S3 [[]] { int a; }; // expected-error {{an attribute list cannot appear here}} + +union [[]] U { + double d [[]]; + [[]] int i; +}; + +[[]] union U2 { double d; }; // expected-error {{misplaced attributes}} +union U3 [[]] { double d; }; // expected-error {{an attribute list cannot appear here}} + +struct [[]] IncompleteStruct; +union [[]] IncompleteUnion; +enum [[]] IncompleteEnum; +enum __attribute__((deprecated)) IncompleteEnum2; + +[[]] void f1(void); +void [[]] f2(void); +void f3 [[]] (void); +void f4(void) [[]]; + +void f5(int i [[]], [[]] int j, int [[]] k); + +void f6(a, b) [[]] int a; int b; { // expected-error {{an attribute list cannot appear here}} +} + +// FIXME: technically, an attribute list cannot appear here, but we currently +// parse it as part of the return type of the function, which is reasonable +// behavior given that we *don't* want to parse it as part of the K&R parameter +// declarations. It is disallowed to avoid a parsing ambiguity we already +// handle well. +int (*f7(a, b))(int, int) [[]] int a; int b; { + return 0; +} + +[[]] int a, b; +int c [[]], d [[]]; + +void f8(void) [[]] { + [[]] int i, j; + int k, l [[]]; +} + +[[]] void f9(void) { + int i[10] [[]]; + int (*fp1)(void)[[]]; + int (*fp2 [[]])(void); + + int * [[]] *ipp; +} + +void f10(int j[static 10] [[]], int k[*] [[]]); + +void f11(void) { + [[]] {} + [[]] if (1) {} + + [[]] switch (1) { + [[]] case 1: [[]] break; + [[]] default: break; + } + + goto foo; + [[]] foo: (void)1; + + [[]] for (;;); + [[]] while (1); + [[]] do [[]] { } while(1); + + [[]] (void)1; + + [[]]; + + (void)sizeof(int [4][[]]); + (void)sizeof(struct [[]] S3 { int a [[]]; }); + + [[]] return; +} + +[[attr]] void f12(void); // expected-warning {{unknown attribute 'attr' ignored}} +[[vendor::attr]] void f13(void); // expected-warning {{unknown attribute 'attr' ignored}} + +// Ensure that asm statements properly handle double colons. +void test_asm(void) { + asm("ret" :::); + asm("foo" :: "r" (xx)); // expected-error {{use of undeclared identifier 'xx'}} +} + +// Do not allow 'using' to introduce vendor attribute namespaces. +[[using vendor: attr1, attr2]] void f14(void); // expected-error {{expected ']'}} \ + // expected-warning {{unknown attribute 'vendor' ignored}} \ + // expected-warning {{unknown attribute 'using' ignored}} + +struct [[]] S4 *s; // expected-error {{an attribute list cannot appear here}} +struct S5 {}; +int c = sizeof(struct [[]] S5); // expected-error {{an attribute list cannot appear here}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/c2x-attributes.m b/src/third_party/llvm-project/clang/test/Parser/c2x-attributes.m new file mode 100644 index 0000000..f461041 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/c2x-attributes.m
@@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -verify %s +// expected-no-diagnostics + +enum __attribute__((deprecated)) E1 : int; // ok +enum [[deprecated]] E2 : int; + +@interface Base +@end + +@interface S : Base +- (void) bar; +@end + +@interface T : Base +- (S *) foo; +@end + + +void f(T *t) { + [[]][[t foo] bar]; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/captured-statements.c b/src/third_party/llvm-project/clang/test/Parser/captured-statements.c new file mode 100644 index 0000000..30dddb5 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/captured-statements.c
@@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -verify %s + +void test1() +{ + #pragma clang __debug captured x // expected-warning {{extra tokens at end of #pragma clang __debug captured directive}} + { + } +} + +void test2() +{ + #pragma clang __debug captured + int x; // expected-error {{expected '{'}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/char-literal-printing.c b/src/third_party/llvm-project/clang/test/Parser/char-literal-printing.c new file mode 100644 index 0000000..27dd63a --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/check-objc2-syntax-1.m b/src/third_party/llvm-project/clang/test/Parser/check-objc2-syntax-1.m new file mode 100644 index 0000000..364f826 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/check-objc2-syntax-1.m
@@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// rdar://15505492 +@import Foundation; // expected-error {{use of '@import' when modules are disabled}} + +@interface Subclass ++ (int)magicNumber; +@end + +int main (void) { + return Subclass.magicNumber; +} +
diff --git a/src/third_party/llvm-project/clang/test/Parser/check-syntax-1.m b/src/third_party/llvm-project/clang/test/Parser/check-syntax-1.m new file mode 100644 index 0000000..0ae0c5d --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/check_cast.c b/src/third_party/llvm-project/clang/test/Parser/check_cast.c new file mode 100644 index 0000000..790ee40 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/colon-colon-parentheses.cpp b/src/third_party/llvm-project/clang/test/Parser/colon-colon-parentheses.cpp new file mode 100644 index 0000000..804e4f7 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/colon-colon-parentheses.cpp
@@ -0,0 +1,36 @@ +// RUN: %clang_cc1 %s -verify -fno-spell-checking + +struct S { static int a,b,c;}; +int S::(a); // expected-error{{expected unqualified-id}} +int S::(b; // expected-error{{expected unqualified-id}} + ); +int S::c; +int S::(*d); // expected-error{{expected unqualified-id}} +int S::(*e; // expected-error{{expected unqualified-id}} + ); +int S::*f; +int g = S::(a); // expected-error {{expected unqualified-id}} expected-error {{use of undeclared identifier 'a'}} +int h = S::(b; // expected-error {{expected unqualified-id}} expected-error {{use of undeclared identifier 'b'}} + ); +int i = S::c; + +void foo() { + int a; + a = ::(g); // expected-error{{expected unqualified-id}} + a = ::(h; // expected-error{{expected unqualified-id}} + a = ::i; +} + +// The following tests used to be crash bugs. + +// PR21815 +// expected-error@+2{{C++ requires a type specifier for all declarations}} +// expected-error@+1{{expected unqualified-id}} +a (::( )); + +::((c )); // expected-error{{expected unqualified-id}} + +// PR26623 +int f1(::(B) p); // expected-error {{expected unqualified-id}} expected-error {{use of undeclared identifier 'B'}} + +int f2(::S::(C) p); // expected-error {{expected unqualified-id}} expected-error {{use of undeclared identifier 'C'}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/completely-empty-header-file.h b/src/third_party/llvm-project/clang/test/Parser/completely-empty-header-file.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/completely-empty-header-file.h
diff --git a/src/third_party/llvm-project/clang/test/Parser/compound_literal.c b/src/third_party/llvm-project/clang/test/Parser/compound_literal.c new file mode 100644 index 0000000..0054499 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/compound_literal.c
@@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -x c++ %s +// expected-no-diagnostics +int main() { + char *s; + s = (char []){"whatever"}; + s = (char(*)){s}; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/control-scope.c b/src/third_party/llvm-project/clang/test/Parser/control-scope.c new file mode 100644 index 0000000..5314980 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/crash-report.c b/src/third_party/llvm-project/clang/test/Parser/crash-report.c new file mode 100644 index 0000000..ef65b88 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/crash-report.c
@@ -0,0 +1,13 @@ +// RUN: not --crash %clang_cc1 %s 2>&1 | FileCheck %s +// REQUIRES: crash-recovery + +// FIXME: CHECKs might be incompatible to win32. +// Stack traces also require back traces. +// REQUIRES: shell, backtrace + +#prag\ +ma clang __debug crash + +// CHECK: prag\ +// CHECK-NEXT: ma +
diff --git a/src/third_party/llvm-project/clang/test/Parser/cuda-force-host-device-templates.cu b/src/third_party/llvm-project/clang/test/Parser/cuda-force-host-device-templates.cu new file mode 100644 index 0000000..315de1c --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cuda-force-host-device-templates.cu
@@ -0,0 +1,40 @@ +// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify -fcuda-is-device %s + +// Check how the force_cuda_host_device pragma interacts with template +// instantiations. + +template <typename T> +auto foo() { // expected-note {{declared here}} + return T(); +} + +template <typename T> +struct X { + void foo(); // expected-note {{declared here}} +}; + +#pragma clang force_cuda_host_device begin +__attribute__((host)) __attribute__((device)) void test() { + int n = foo<int>(); // expected-error {{reference to __host__ function 'foo<int>'}} + X<int>().foo(); // expected-error {{reference to __host__ function 'foo'}} +} +#pragma clang force_cuda_host_device end + +// Same thing as above, but within a force_cuda_host_device block without a +// corresponding end. + +template <typename T> +T bar() { // expected-note {{declared here}} + return T(); +} + +template <typename T> +struct Y { + void bar(); // expected-note {{declared here}} +}; + +#pragma clang force_cuda_host_device begin +__attribute__((host)) __attribute__((device)) void test2() { + int n = bar<int>(); // expected-error {{reference to __host__ function 'bar<int>'}} + Y<int>().bar(); // expected-error {{reference to __host__ function 'bar'}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cuda-force-host-device.cu b/src/third_party/llvm-project/clang/test/Parser/cuda-force-host-device.cu new file mode 100644 index 0000000..6064708 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cuda-force-host-device.cu
@@ -0,0 +1,36 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// Check the force_cuda_host_device pragma. + +#pragma clang force_cuda_host_device begin +void f(); +#pragma clang force_cuda_host_device begin +void g(); +#pragma clang force_cuda_host_device end +void h(); +#pragma clang force_cuda_host_device end + +void i(); // expected-note {{not viable}} + +void host() { + f(); + g(); + h(); + i(); +} + +__attribute__((device)) void device() { + f(); + g(); + h(); + i(); // expected-error {{no matching function}} +} + +#pragma clang force_cuda_host_device foo +// expected-warning@-1 {{incorrect use of #pragma clang force_cuda_host_device begin|end}} + +#pragma clang force_cuda_host_device +// expected-warning@-1 {{incorrect use of #pragma clang force_cuda_host_device begin|end}} + +#pragma clang force_cuda_host_device begin foo +// expected-warning@-1 {{incorrect use of #pragma clang force_cuda_host_device begin|end}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cuda-kernel-call-c++11.cu b/src/third_party/llvm-project/clang/test/Parser/cuda-kernel-call-c++11.cu new file mode 100644 index 0000000..8f833f7 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cuda-kernel-call-c++11.cu
@@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s + +template<typename> struct S {}; +template<typename> void f(); + + +void foo(void) { + // In C++11 mode, all of these are expected to parse correctly, and the CUDA + // language should not interfere with that. + + // expected-no-diagnostics + + S<S<S<int>>> s3; + + S<S<S<S<int>>>> s4; + + S<S<S<S<S<int>>>>> s5; + + (void)(&f<S<S<int>>>==0); +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cuda-kernel-call.cu b/src/third_party/llvm-project/clang/test/Parser/cuda-kernel-call.cu new file mode 100644 index 0000000..1970c55 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cuda-kernel-call.cu
@@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +template<typename> struct S {}; +template<typename> void f(); + +void foo(void) { + foo<<<1; // expected-error {{expected '>>>'}} expected-note {{to match this '<<<'}} + + foo<<<1,1>>>; // expected-error {{expected '('}} + + foo<<<>>>(); // expected-error {{expected expression}} + + // The following two are parse errors because -std=c++11 is not enabled. + + S<S<S<int>>> s; // expected-error 2{{use '> >'}} + (void)(&f<S<S<int>>>==0); // expected-error 2{{use '> >'}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-altivec.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-altivec.cpp new file mode 100644 index 0000000..6395452 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-altivec.cpp
@@ -0,0 +1,198 @@ +// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify -std=c++11 %s +#include <altivec.h> + +__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 __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 __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-error {{cannot use 'long double' with '__vector'}} +vector long double v_ld; // expected-error {{cannot use 'long double' with '__vector'}} + +// These should have errors. +__vector double vv_d1; // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on POWER7 or later)}} +vector double v_d2; // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on POWER7 or later)}} +__vector bool long long v_bll1; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}} +__vector __bool long long v_bll2; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}} +vector bool long long v_bll3; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}} +vector __bool long long v_bll4; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}} +__vector long double vv_ld3; // expected-error {{cannot use 'long double' with '__vector'}} +vector long double v_ld4; // expected-error {{cannot use 'long 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 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 long is deprecated, but vector long long is not. +vector long long v_ll; +vector signed long long v_sll; +vector unsigned long long v_ull; + +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' (vector of 2 'unsigned int' values) from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int' (vector of 4 'unsigned int' values)}} + av = gv8; // expected-error {{assigning to '__vector unsigned int' (vector of 4 'unsigned int' values) from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' (vector of 2 'unsigned int' values)}} + + 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}} + +template<typename... Args> void PR16874() { + (void) (Args::foo()...); // expected-error {{expression contains unexpanded parameter pack 'Args'}} expected-error {{expected ')'}} expected-note {{to match this '('}} +} +
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-ambig-decl-expr-xfail.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-ambig-decl-expr-xfail.cpp new file mode 100644 index 0000000..85c3468 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-ambig-decl-expr-xfail.cpp
@@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// XFAIL: * +// FIXME: This is PR7655 + +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/src/third_party/llvm-project/clang/test/Parser/cxx-ambig-decl-expr.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-ambig-decl-expr.cpp new file mode 100644 index 0000000..7bf08b0 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-ambig-decl-expr.cpp
@@ -0,0 +1,17 @@ +// 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>; + + unknown *p = 0; // expected-error {{unknown type name 'unknown'}} + unknown * p + 0; // expected-error {{undeclared identifier 'unknown'}} +} + +auto (*p)() -> int(nullptr); +auto (*q)() -> int(*)(unknown); // expected-error {{unknown type name 'unknown'}} +auto (*r)() -> int(*)(unknown + 1); // expected-error {{undeclared identifier 'unknown'}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-ambig-init-templ.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-ambig-init-templ.cpp new file mode 100644 index 0000000..89ed5e5 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-ambig-init-templ.cpp
@@ -0,0 +1,176 @@ +// RUN: %clang_cc1 -Wno-uninitialized -std=c++11 -verify %s + +template<int> struct c { c(int) = delete; typedef void val; operator int() const; }; + +int val; +int foobar; +struct S { + int k1 = a < b < c, d > ::val, e1; + int k2 = a < b, c < d > ::val, e2; + int k3 = b < a < c, d > ::val, e3; + int k4 = b < c, x, y = d > ::val, e4; + int k5 = T1 < b, &S::operator=(int); // expected-error {{extra qualification}} + int k6 = T2 < b, &S::operator= >::val; + int k7 = T1 < b, &S::operator>(int); // expected-error {{extra qualification}} + int k8 = T2 < b, &S::operator> >::val; + int k9 = T3 < a < b, c >> (d), e5 = 1 > (e4); + int k10 = 0 < T3 < a < b, c >> (d + ) // expected-error {{expected ';' at end of declaration}} + , a > (e4); + int k11 = 0 < 1, c<3>::*ptr; + int k12 = e < 0, int a<b<c>::* >(), e11; + + void f1( + int k1 = a < b < c, d > ::val, + int k2 = b < a < c, d > ::val, + int k3 = b < c, int x = 0 > ::val, + int k4 = a < b, T3 < int > >(), // expected-error {{must be an expression}} + int k5 = a < b, c < d > ::val, + int k6 = a < b, c < d > (n) // expected-error {{undeclared identifier 'n'}} + ); + + void f2a( + // T3<int> here is a parameter type, so must be declared before it is used. + int k1 = c < b, T3 < int > x = 0 // expected-error {{unexpected end of default argument expression}} + ); + + template<typename, int=0> struct T3 { T3(int); operator int(); }; + + void f2b( + int k1 = c < b, T3 < int > x = 0 // ok + ); + + // This is a one-parameter function. Ensure we don't typo-correct it to + // int = a < b, c < foobar > () + // ... which would be a function with two parameters. + int f3(int = a < b, c < goobar > ()); + static constexpr int (S::*f3_test)(int) = &S::f3; + + void f4( + int k1 = a<1,2>::val, + int missing_default // expected-error {{missing default argument on parameter}} + ); + + void f5( + int k1 = b < c, + int missing_default // expected-error {{missing default argument on parameter}} + ); + + void f6( + int k = b < c, + unsigned int (missing_default) // expected-error {{missing default argument on parameter}} + ); + + template<int, int=0> struct a { static const int val = 0; operator int(); }; // expected-note {{here}} + static const int b = 0, c = 1, d = 2, goobar = 3; + template<int, typename> struct e { operator int(); }; + + int mp1 = 0 < 1, + a<b<c,b<c>::*mp2, + mp3 = 0 > a<b<c>::val, + a<b<c,b<c>::*mp4 = 0, + a<b<c,b<c>::*mp5 {0}, + a<b<c,b<c>::*mp6; + + int np1 = e<0, int a<b<c,b<c>::*>(); + + static const int T1 = 4; + template<int, int &(S::*)(int)> struct T2 { static const int val = 0; }; +}; + +namespace NoAnnotationTokens { + template<bool> struct Bool { Bool(int); }; + static const bool in_class = false; + + struct Test { + // Check we don't keep around a Bool<false> annotation token here. + int f(Bool<true> = X<Y, Bool<in_class> >(0)); + + // But it's OK if we do here. + int g(Bool<true> = Z<Y, Bool<in_class> = Bool<false>(0)); + + static const bool in_class = true; + template<int, typename U> using X = U; + static const int Y = 0, Z = 0; + }; +} + +namespace ImplicitInstantiation { + template<typename T> struct HasError { typename T::error error; }; // expected-error {{has no members}} + + struct S { + // This triggers the instantiation of the outer HasError<int> during + // disambiguation, even though it uses the inner HasError<int>. + void f(int a = X<Y, HasError<int>::Z >()); // expected-note {{in instantiation of}} + + template<typename, typename> struct X { operator int(); }; + typedef int Y; + template<typename> struct HasError { typedef int Z; }; + }; + + HasError<int> hei; +} + +namespace CWG325 { + template <int A, typename B> struct T { static int i; operator int(); }; + class C { + int Foo (int i = T<1, int>::i); + }; + + class D { + int Foo (int i = T<1, int>::i); + template <int A, typename B> struct T {static int i;}; + }; + + const int a = 0; + typedef int b; + T<a,b> c; + struct E { + int n = T<a,b>(c); + }; +} + +namespace Operators { + struct Y {}; + constexpr int operator,(const Y&, const Y&) { return 8; } + constexpr int operator>(const Y&, const Y&) { return 8; } + constexpr int operator<(const Y&, const Y&) { return 8; } + constexpr int operator>>(const Y&, const Y&) { return 8; } + + struct X { + typedef int (*Fn)(const Y&, const Y&); + + Fn a = operator,, b = operator<, c = operator>; + void f(Fn a = operator,, Fn b = operator<, Fn c = operator>); + + int k1 = T1<0, operator<, operator>, operator<>::val, l1; + int k2 = T1<0, operator>, operator,, operator,>::val, l2; + int k3 = T2<0, operator,(Y{}, Y{}), operator<(Y{}, Y{})>::val, l3; + int k4 = T2<0, operator>(Y{}, Y{}), operator,(Y{}, Y{})>::val, l4; + int k5 = T3<0, operator>>>::val, l5; + int k6 = T4<0, T3<0, operator>>>>::val, l6; + + template<int, Fn, Fn, Fn> struct T1 { enum { val }; }; + template<int, int, int> struct T2 { enum { val }; }; + template<int, Fn> struct T3 { enum { val }; }; + template<int, typename T> struct T4 : T {}; + }; +} + +namespace ElaboratedTypeSpecifiers { + struct S { + int f(int x = T<a, struct S>()); + int h(int x = T<a, union __attribute__(()) U>()); + int i(int x = T<a, enum E>()); + int j(int x = T<a, struct S::template T<0, enum E>>()); + template <int, typename> struct T { operator int(); }; + static const int a = 0; + enum E {}; + }; +} + +namespace PR20459 { + template <typename EncTraits> struct A { + void foo(int = EncTraits::template TypeEnc<int, int>::val); // ok + }; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-ambig-paren-expr-asan.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-ambig-paren-expr-asan.cpp new file mode 100644 index 0000000..ec9d6b9 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-ambig-paren-expr-asan.cpp
@@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s + +// This syntax error used to cause use-after free due to token local buffer +// in ParseCXXAmbiguousParenExpression. +int H((int()[)]); +// expected-error@-1 {{expected expression}} +// expected-error@-2 {{expected ']'}} +// expected-note@-3 {{to match this '['}} +// expected-error@-4 {{expected ';' after top level declarator}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-ambig-paren-expr.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-ambig-paren-expr.cpp new file mode 100644 index 0000000..cc509f7 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-ambig-paren-expr.cpp
@@ -0,0 +1,72 @@ +// 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())(); + + // Special case: "++" is postfix here, not prefix + (S())++; // expected-error {{cannot increment value of type 'S'}} + + struct X { int &operator++(int); X operator[](int); int &operator++(); }; + int &postfix_incr = (X()[3])++; + (X())++ ++; // ok, not a C-style cast + (X())++ ++X(); // expected-error {{C-style cast from 'int' to 'X ()'}} + int q = (int)++(x); +} + +// 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/src/third_party/llvm-project/clang/test/Parser/cxx-attributes.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-attributes.cpp new file mode 100644 index 0000000..6591532 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-attributes.cpp
@@ -0,0 +1,24 @@ +// 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) )) {} +}; + +template <typename T> class X { + template <typename S> void X<S>::f() __attribute__((locks_excluded())); // expected-error{{nested name specifier 'X<S>::' for declaration does not refer into a class, class template or class template partial specialization}} \ + // expected-warning{{attribute locks_excluded ignored, because it is not attached to a declaration}} +}; + +namespace PR17666 { + const int A = 1; + typedef int __attribute__((__aligned__(A))) T1; + int check1[__alignof__(T1) == 1 ? 1 : -1]; + + typedef int __attribute__((aligned(int(1)))) T1; + typedef int __attribute__((aligned(int))) T2; // expected-error {{expected '(' for function-style cast}} +} + +__attribute((typename)) int x; // expected-warning {{unknown attribute 'typename' ignored}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-bool.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-bool.cpp new file mode 100644 index 0000000..21591d1 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-bool.cpp
@@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics + +bool a = true; +bool b = false; + +namespace pr34273 { + char c = "clang"[true]; + char d = true["clang"]; +} +
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-casting.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-casting.cpp new file mode 100644 index 0000000..b1ae591 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-casting.cpp
@@ -0,0 +1,150 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %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); } // expected-warning {{binding dereferenced null pointer to reference has undefined behavior}} +} + +typedef char* c; +typedef A* a; +void test2(char x, struct B * b) { + (void)const_cast<::c>(&x); +#if __cplusplus <= 199711L + // expected-error@-2 {{found '<::' after a const_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} +#endif + + (void)dynamic_cast<::a>(b); +#if __cplusplus <= 199711L + // expected-error@-2 {{found '<::' after a dynamic_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} +#endif + + (void)reinterpret_cast<::c>(x); +#if __cplusplus <= 199711L + // expected-error@-2 {{found '<::' after a reinterpret_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} +#endif + + (void)static_cast<::c>(&x); +#if __cplusplus <= 199711L + // expected-error@-2 {{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} +#endif + + // 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 {{class template 'test1::A' requires template arguments}} expected-error 2{{}} + (void)static_cast LC:c>(&x); // expected-error {{expected '<' after 'static_cast'}} expected-error 2{{}} expected-note{{}} + test1::A<:C B> d; // expected-error {{class template 'test1::A' requires template arguments}} expected-error 2{{}} + (void)static_cast<:C c>(&x); // expected-error {{expected '<' after 'static_cast'}} expected-error 2{{}} expected-note{{}} + +#define LCC <:: + test1::A LCC B> e; +#if __cplusplus <= 199711L + // expected-error@-2 {{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} +#endif + + (void)static_cast LCC c>(&x); +#if __cplusplus <= 199711L + // expected-error@-2 {{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} +#endif +} + + // 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; +#if __cplusplus <= 199711L + // expected-error@-2 {{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} +#endif + + D<::F> A2; +#if __cplusplus <= 199711L + // expected-error@-2 {{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} +#endif + + ::E<::F>(); +#if __cplusplus <= 199711L + // expected-error@-2 {{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} +#endif + + E<::F>(); +#if __cplusplus <= 199711L + // expected-error@-2 {{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} +#endif + + ::D< ::F> A3; + D< ::F> A4; + ::E< ::F>(); + E< ::F>(); + + // Make sure that parser doesn't expand '[:' to '< ::' + ::D[:F> A5; // expected-error {{class template '::D' requires template arguments}} \ + // expected-error {{expected expression}} \ + // expected-error {{expected unqualified-id}} +} + +// Ensure that a C-style cast doesn't turn off colon protection. +void PR19748() { + struct A {}; + int A = 0, b; + int test1 = true ? (int)A : b; + + struct f {}; + extern B f(), (*p)(); + (true ? (B(*)())f : p)(); +} + +void PR19751(int n) { + struct T { void operator++(int); }; + (T())++; // ok, not an ill-formed cast to function type + (T())++n; // expected-error {{C-style cast from 'int' to 'T ()' is not allowed}} +} + +// PR13619. Must be at end of file. +int n = reinterpret_cast // expected-error {{expected '<'}} expected-error {{expected ';'}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-class-template-specialization.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-class-template-specialization.cpp new file mode 100644 index 0000000..f94a859 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-class-template-specialization.cpp
@@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +struct A { + template<typename T> + void f(); +}; +class A::f<int>; +// expected-error@-1 {{identifier followed by '<' indicates a class template specialization but 'f' refers to a function template}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-class.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-class.cpp new file mode 100644 index 0000000..3cc006a --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-class.cpp
@@ -0,0 +1,277 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fcxx-exceptions %s +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fcxx-exceptions -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -fcxx-exceptions -std=c++11 %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 m0() {}; // ok, one extra ';' is permitted + void m1() {} + ; // ok, one extra ';' is permitted + void m() { + int l = 2; + };; // expected-warning{{extra ';' after member function definition}} + + template<typename T> void mt(T) { } + ; + ; // expected-warning{{extra ';' inside a class}} + + virtual int vf() const volatile = 0; + + virtual int vf0() = 0l; // expected-error {{does not look like a pure-specifier}} + virtual int vf1() = 1; // expected-error {{does not look like a pure-specifier}} + virtual int vf2() = 00; // expected-error {{does not look like a pure-specifier}} + virtual int vf3() = 0x0; // expected-error {{does not look like a pure-specifier}} + virtual int vf4() = 0.0; // expected-error {{does not look like a pure-specifier}} + virtual int vf5(){0}; // expected-error +{{}} expected-warning {{unused}} + virtual int vf5a(){0;}; // function definition, expected-warning {{unused}} + virtual int vf6()(0); // expected-error +{{}} expected-note +{{}} + virtual int vf7() = { 0 }; // expected-error {{does not look like a pure-specifier}} + +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; } +#if __cplusplus <= 199711L + // expected-error@-2 {{function definition does not declare parameters}} +#else + // expected-error@-4 {{expected expression}} + // expected-error@-5 {{expected}} + // expected-note@-6 {{to match this '{'}} + // expected-error@-7 {{expected ';' after class}} +#endif + + void F2 {} +#if __cplusplus <= 199711L + // expected-error@-2 {{function definition does not declare parameters}} +#else + // expected-error@-4 {{variable has incomplete type 'void'}} + // expected-error@-5 {{expected ';' after top level declarator}} +#endif + + typedef int F3() { return 0; } // expected-error{{function definition declared 'typedef'}} + typedef void F4() {} // expected-error{{function definition declared 'typedef'}} +}; +#if __cplusplus >= 201103L +// expected-error@-2 {{extraneous closing brace}} +#endif + +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'}} +} + +namespace nns_decl { + struct A { + struct B; + }; + namespace N { + union C; + } + struct A::B; // expected-error {{forward declaration of struct cannot have a nested name specifier}} + union N::C; // expected-error {{forward declaration of union cannot have a nested name specifier}} +} + +// PR13775: Don't assert here. +namespace PR13775 { + class bar + { + public: + void foo (); + void baz (); + }; + void bar::foo () + { + baz x(); // expected-error 3{{}} + } +} + +class pr16989 { + void tpl_mem(int *) { + return; + class C2 { + void f(); + }; + void C2::f() {} // expected-error{{function definition is not allowed here}} + }; +}; + +namespace CtorErrors { + struct A { + A(NonExistent); // expected-error {{unknown type name 'NonExistent'}} + }; + struct B { + B(NonExistent) : n(0) {} // expected-error {{unknown type name 'NonExistent'}} + int n; + }; + struct C { + C(NonExistent) try {} catch (...) {} // expected-error {{unknown type name 'NonExistent'}} + }; + struct D { + D(NonExistent) {} // expected-error {{unknown type name 'NonExistent'}} + }; +} + +namespace DtorErrors { + struct A { ~A(); int n; } a; + ~A::A() { n = 0; } // expected-error {{'~' in destructor name should be after nested name specifier}} expected-note {{previous}} + A::~A() {} // expected-error {{redefinition}} + + struct B { ~B(); } *b; + DtorErrors::~B::B() {} // expected-error {{'~' in destructor name should be after nested name specifier}} + + void f() { + a.~A::A(); // expected-error {{'~' in destructor name should be after nested name specifier}} + b->~DtorErrors::~B::B(); // expected-error {{'~' in destructor name should be after nested name specifier}} + } + + struct C; // expected-note {{forward decl}} + ~C::C() {} // expected-error {{incomplete}} expected-error {{'~' in destructor name should be after nested name specifier}} + + struct D { struct X {}; ~D() throw(X); }; + ~D::D() throw(X) {} // expected-error {{'~' in destructor name should be after nested name specifier}} + + ~Undeclared::Undeclared() {} // expected-error {{use of undeclared identifier 'Undeclared'}} expected-error {{'~' in destructor name should be after nested name specifier}} + ~Undeclared:: {} // expected-error {{expected identifier}} expected-error {{'~' in destructor name should be after nested name specifier}} + + struct S { + // For another struct's destructor, emit the same diagnostic like for + // A::~A() in addition to the "~ in the wrong place" one. + ~A::A() {} // expected-error {{'~' in destructor name should be after nested name specifier}} expected-error {{non-friend class member '~A' cannot have a qualified name}} + A::~A() {} // expected-error {{non-friend class member '~A' cannot have a qualified name}} + + // An inline destructor with a redundant class name should also get the + // same diagnostic as S::~S. + ~S::S() {} // expected-error {{'~' in destructor name should be after nested name specifier}} expected-error {{extra qualification on member '~S'}} + + // This just shouldn't crash. + int I; // expected-note {{declared here}} + ~I::I() {} // expected-error {{'I' is not a class, namespace, or enumeration}} expected-error {{'~' in destructor name should be after nested name specifier}} + }; + + struct T {}; + T t1 = t1.T::~T<int>; // expected-error {{destructor name 'T' does not refer to a template}} expected-error {{expected '(' for function-style cast or type construction}} expected-error {{expected expression}} + // Emit the same diagnostic as for the previous case, plus something about ~. + T t2 = t2.~T::T<int>; // expected-error {{'~' in destructor name should be after nested name specifier}} expected-error {{destructor name 'T' does not refer to a template}} expected-error {{expected '(' for function-style cast or type construction}} expected-error {{expected expression}} +} + +namespace BadFriend { + struct A { + friend int : 3; // expected-error {{friends can only be classes or functions}} + friend void f() = 123; // expected-error {{illegal initializer}} + friend virtual void f(); // expected-error {{'virtual' is invalid in friend declarations}} + friend void f() final; // expected-error {{'final' is invalid in friend declarations}} + friend void f() override; // expected-error {{'override' is invalid in friend declarations}} + }; +} + +class PR20760_a { + int a = ); // expected-error {{expected expression}} +#if __cplusplus <= 199711L + // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}} +#endif + + int b = }; // expected-error {{expected expression}} +#if __cplusplus <= 199711L + // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}} +#endif + + int c = ]; // expected-error {{expected expression}} +#if __cplusplus <= 199711L + // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}} +#endif + +}; +class PR20760_b { + int d = d); // expected-error {{expected ';'}} +#if __cplusplus <= 199711L + // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}} +#endif + + int e = d]; // expected-error {{expected ';'}} +#if __cplusplus <= 199711L + // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}} +#endif + + int f = d // expected-error {{expected ';'}} +#if __cplusplus <= 199711L + // expected-warning@-2 {{in-class initialization of non-static data member is a C++11 extension}} +#endif + +}; + +namespace PR20887 { +class X1 { a::operator=; }; // expected-error {{undeclared identifier 'a'}} +class X2 { a::a; }; // expected-error {{undeclared identifier 'a'}} +} + +class BadExceptionSpec { + void f() throw(int; // expected-error {{expected ')'}} expected-note {{to match}} + void g() throw( + int( + ; // expected-error {{unexpected ';' before ')'}} + )); +}; + +// 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/src/third_party/llvm-project/clang/test/Parser/cxx-concept-declaration.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-concept-declaration.cpp new file mode 100644 index 0000000..2e9d1ac --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-concept-declaration.cpp
@@ -0,0 +1,7 @@ + +// Support parsing of concepts +// Disabled for now. +// expected-no-diagnostics + +// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s +// template<typename T> concept C1 = true;
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-concepts-ambig-constraint-expr.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-concepts-ambig-constraint-expr.cpp new file mode 100644 index 0000000..12ab338 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-concepts-ambig-constraint-expr.cpp
@@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ %s -verify + +// Test parsing of constraint-expressions in cases where the grammar is +// ambiguous with the expectation that the longest token sequence which matches +// the syntax is consumed without backtracking. + +// type-specifier-seq in conversion-type-id +template <typename T> requires (bool)&T::operator short +unsigned int foo(); // expected-error {{C++ requires a type specifier for all declarations}} + +// type-specifier-seq in new-type-id +template <typename T> requires (bool)sizeof new (T::f()) short +unsigned int bar(); // expected-error {{C++ requires a type specifier for all declarations}} + +template<typename T> requires (bool)sizeof new (T::f()) unsigned // expected-error {{'struct' cannot be signed or unsigned}} +struct X { }; // expected-error {{'X' cannot be defined in a type specifier}} + +// C-style cast +// of function call on function-style cast +template <typename T> requires (bool(T())) +T (*fp)(); // expected-error {{use of undeclared identifier 'fp'}} + +// function-style cast +// as the callee in a function call +struct A { + static int t; + template <typename T> requires bool(T()) + (A(T (&t))) { } // expected-error {{called object type 'bool' is not a function or function pointer}} +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-concepts-requires-clause.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-concepts-requires-clause.cpp new file mode 100644 index 0000000..01893a9 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-concepts-requires-clause.cpp
@@ -0,0 +1,82 @@ +// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ %s -verify +// expected-no-diagnostics + +// Test parsing of the optional requires-clause in a template-declaration. + +template <typename T> requires true +void foo() { } + + +template <typename T> requires !0 +struct A { + void foo(); + struct AA; + enum E : int; + static int x; + + template <typename> requires true + void Mfoo(); + + template <typename> requires true + struct M; + + template <typename> requires true + static int Mx; + + template <typename TT> requires true + using MQ = M<TT>; +}; + +template <typename T> requires !0 +void A<T>::foo() { } + +template <typename T> requires !0 +struct A<T>::AA { }; + +template <typename T> requires !0 +enum A<T>::E : int { E0 }; + +template <typename T> requires !0 +int A<T>::x = 0; + +template <typename T> requires !0 +template <typename> requires true +void A<T>::Mfoo() { } + +template <typename T> requires !0 +template <typename> requires true +struct A<T>::M { }; + +template <typename T> requires !0 +template <typename> requires true +int A<T>::Mx = 0; + + +template <typename T> requires true +int x = 0; + +template <typename T> requires true +using Q = A<T>; + +struct C { + template <typename> requires true + void Mfoo(); + + template <typename> requires true + struct M; + + template <typename> requires true + static int Mx; + + template <typename T> requires true + using MQ = M<T>; +}; + +template <typename> requires true +void C::Mfoo() { } + +template <typename> requires true +struct C::M { }; + +template <typename> requires true +int C::Mx = 0;
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-condition.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-condition.cpp new file mode 100644 index 0000000..5672eea --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/cxx-decl.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-decl.cpp new file mode 100644 index 0000000..c60e42f --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-decl.cpp
@@ -0,0 +1,322 @@ +// RUN: %clang_cc1 -verify -fsyntax-only -triple i386-linux -Wredundant-parens -pedantic-errors -fcxx-exceptions -fexceptions %s +// RUN: %clang_cc1 -verify -fsyntax-only -triple i386-linux -Wredundant-parens -pedantic-errors -fcxx-exceptions -fexceptions -std=c++98 %s +// RUN: %clang_cc1 -verify -fsyntax-only -triple i386-linux -Wredundant-parens -pedantic-errors -fcxx-exceptions -fexceptions -std=c++11 %s + +const char const *x10; // expected-error {{duplicate 'const' declaration specifier}} + +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, }; +#if __cplusplus <= 199711L +// expected-error@-2 {{commas at the end of enumerator lists are a C++11 extension}} +#endif + +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), // expected-warning {{redundant parentheses surrounding declarator}} + *global6, + &global7 = global1, + &&global8 = static_cast<int&&>(global1), +#if __cplusplus <= 199711L + // expected-error@-2 2{{rvalue references are a C++11 extension}} +#endif + + 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 { +} // expected-error {{expected ';' after class}} + +typedef Class1<Class2> Type1; + +// rdar : // 8307865 +struct CodeCompleteConsumer { +}; + +void CodeCompleteConsumer::() { // expected-error {{xpected unqualified-id}} +} + +; + +// PR4111 +void f(sqrgl); // expected-error {{unknown type name 'sqrgl'}} + +// PR9903 +struct S { + typedef void a() { }; // expected-error {{function definition declared 'typedef'}} + typedef void c() try { } catch(...) { } // expected-error {{function definition declared 'typedef'}} + int n, m; + typedef S() : n(1), m(2) { } // expected-error {{function definition declared 'typedef'}} +}; + + +namespace TestIsValidAfterTypeSpecifier { +struct s {} v; + +namespace a { +struct s operator++(struct s a) +{ return a; } +} + +namespace b { +// The newline after s should make no difference. +struct s +operator++(struct s a) +{ return a; } +} + +struct X { + struct s + friend f(); + struct s + virtual f(); +}; + +struct s +&r0 = v; +struct s +bitand r2 = v; + +} + +struct DIE { + void foo() {} +}; + +void test (DIE die, DIE *Die, DIE INT, DIE *FLOAT) { + DIE.foo(); // expected-error {{cannot use dot operator on a type}} + die.foo(); + + DIE->foo(); // expected-error {{cannot use arrow operator on a type}} + Die->foo(); + + int.foo(); // expected-error {{cannot use dot operator on a type}} + INT.foo(); + + float->foo(); // expected-error {{cannot use arrow operator on a type}} + FLOAT->foo(); +} + +namespace PR15017 { + template<typename T = struct X { int i; }> struct S {}; // expected-error {{'PR15017::X' cannot be defined in a type specifier}} +} + +// Ensure we produce at least some diagnostic for attributes in C++98. +[[]] struct S; +#if __cplusplus <= 199711L +// expected-error@-2 {{expected expression}} +// expected-error@-3 {{expected unqualified-id}} +#else +// expected-error@-5 {{misplaced attributes}} +#endif + +namespace test7 { + struct Foo { + void a(); + void b(); + }; + + void Foo:: + // Comment! + a() {} + + + void Foo:: // expected-error {{expected unqualified-id}} + // Comment! +} + +void test8() { + struct {} o; + // This used to crash. + (&o)->(); // expected-error{{expected unqualified-id}} +} + +namespace PR5066 { + template<typename T> struct X {}; + X<int N> x; // expected-error {{type-id cannot have a name}} + + using T = int (*T)(); // expected-error {{type-id cannot have a name}} +#if __cplusplus <= 199711L + // expected-error@-2 {{alias declarations are a C++11 extensio}} +#endif + +} + +namespace PR17255 { +void foo() { + typename A::template B<>; // expected-error {{use of undeclared identifier 'A'}} + // expected-error@-1 {{'template' keyword not permitted here}} +#if __cplusplus <= 199711L + // expected-error@-3 {{'template' keyword outside of a template}} +#endif + // expected-error@-5 {{expected a qualified name after 'typename'}} +} +} + +namespace PR17567 { + struct Foobar { // expected-note 2{{declared here}} + FooBar(); // expected-error {{missing return type for function 'FooBar'; did you mean the constructor name 'Foobar'?}} + ~FooBar(); // expected-error {{expected the class name after '~' to name a destructor}} + }; + FooBar::FooBar() {} // expected-error {{undeclared}} expected-error {{missing return type}} + FooBar::~FooBar() {} // expected-error {{undeclared}} expected-error {{expected the class name}} +} + +namespace DuplicateFriend { + struct A { + friend void friend f(); // expected-warning {{duplicate 'friend' declaration specifier}} + friend struct B friend; // expected-warning {{duplicate 'friend' declaration specifier}} +#if __cplusplus >= 201103L + // expected-error@-2 {{'friend' must appear first in a non-function declaration}} +#endif + }; +} + +namespace NNS { + struct A {}; + namespace B { extern A C1, C2, *C3, C4[], C5; } + // Do not produce a redundant parentheses warning here; removing these parens + // changes the meaning of the program. + A (::NNS::B::C1); + A (NNS::B::C2); // expected-warning {{redundant parentheses surrounding declarator}} + A (*::NNS::B::C3); // expected-warning {{redundant parentheses surrounding declarator}} + A (::NNS::B::C4[2]); + // Removing one of these sets of parentheses would be reasonable. + A ((::NNS::B::C5)); // expected-warning {{redundant parentheses surrounding declarator}} + + void f() { + // FIXME: A vexing-parse warning here would be useful. + A(::NNS::B::C1); // expected-error {{definition or redeclaration}} + A(NNS::B::C1); // expected-warning {{redundant paren}} expected-error {{definition or redeclaration}} + } +} + +inline namespace ParensAroundFriend { // expected-error 0-1{{C++11}} + struct A {}; + struct B { + static A C(); + }; + namespace X { + struct B {}; + struct D { + // No warning here: while this could be written as + // friend (::B::C)(); + // we do need parentheses *somewhere* here. + friend A (::B::C()); + }; + } +} + +namespace rdar37099386 { + class A typename A; // expected-error {{expected a qualified name after 'typename'}} + // expected-error@-1 {{cannot combine with previous 'class' declaration specifier}} +} + +// PR8380 +extern "" // expected-error {{unknown linkage language}} +test6a { ;// expected-error {{C++ requires a type specifier for all declarations}} +#if __cplusplus <= 199711L +// expected-error@-2 {{expected ';' after top level declarator}} +#else +// expected-error@-4 {{expected expression}} +// expected-note@-5 {{to match this}} +#endif + + int test6b; +#if __cplusplus >= 201103L +// expected-error@+3 {{expected}} +// expected-error@-3 {{expected ';' after top level declarator}} +#endif +
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-default-args.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-default-args.cpp new file mode 100644 index 0000000..0095a2f --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-default-args.cpp
@@ -0,0 +1,43 @@ +// 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}} +}; + +// PR13657 +struct T { + template <typename A, typename B> struct T1 { enum {V};}; + template <int A, int B> struct T2 { enum {V}; }; + template <int, int> static int func(int); + + + void f1(T1<int, int> = T1<int, int>()); + void f2(T1<int, double> = T1<int, double>(), T2<0, 5> = T2<0, 5>()); + void f3(int a = T2<0, (T1<int, int>::V > 10) ? 5 : 6>::V, bool b = 4<5 ); + void f4(bool a = 1 < 0, bool b = 2 > 0 ); + void f5(bool a = 1 > T2<0, 0>::V, bool b = T1<int,int>::V < 3, int c = 0); + void f6(bool a = T2<0,3>::V < 4, bool b = 4 > T2<0,3>::V); + void f7(bool a = T1<int, bool>::V < 3); + void f8(int = func<0,1<2>(0), int = 1<0, T1<int,int>(int) = 0); +}; + +// rdar://18508589 +struct S { + void f(int &r = error); // expected-error {{use of undeclared identifier 'error'}} +}; + +struct U { + void i(int x = ) {} // expected-error{{expected expression}} + typedef int *fp(int x = ); // expected-error{{default arguments can only be specified for parameters in a function declaration}} +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-default-delete.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-default-delete.cpp new file mode 100644 index 0000000..8766d86 --- /dev/null +++ b/src/third_party/llvm-project/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}} +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-ext-delete-default.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-ext-delete-default.cpp new file mode 100644 index 0000000..af8b6d6 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/cxx-extern-c-array.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-extern-c-array.cpp new file mode 100644 index 0000000..11092ad --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-extern-c-array.cpp
@@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics + +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/src/third_party/llvm-project/clang/test/Parser/cxx-extra-semi.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-extra-semi.cpp new file mode 100644 index 0000000..de14bc0 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-extra-semi.cpp
@@ -0,0 +1,44 @@ +// RUN: %clang_cc1 -fsyntax-only -pedantic -verify -DPEDANTIC %s +// RUN: %clang_cc1 -fsyntax-only -Wextra-semi -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wextra-semi -verify -std=c++11 %s +// RUN: cp %s %t +// RUN: %clang_cc1 -x c++ -Wextra-semi -fixit %t +// RUN: %clang_cc1 -x c++ -Wextra-semi -Werror %t + +class A { + void A1(); + void A2() { }; +#ifndef PEDANTIC + // This warning is only produced if we specify -Wextra-semi, and not if only + // -pedantic is specified, since one semicolon is technically permitted. + // expected-warning@-4{{extra ';' after member function definition}} +#endif + void A2b() { };; // expected-warning{{extra ';' after member function definition}} + ; // expected-warning{{extra ';' inside a class}} + void A2c() { } + ; +#ifndef PEDANTIC + // expected-warning@-2{{extra ';' after member function definition}} +#endif + void A3() { }; ;; // expected-warning{{extra ';' after member function definition}} + ;;;;;;; // expected-warning{{extra ';' inside a class}} + ; // expected-warning{{extra ';' inside a class}} + ; ;; ; ;;; // expected-warning{{extra ';' inside a class}} + ; ; ; ; ;; // expected-warning{{extra ';' inside a class}} + void A4(); +}; + +union B { + int a1; + int a2;; // expected-warning{{extra ';' inside a union}} +}; + +; +; ;; +#if __cplusplus < 201103L +// expected-warning@-3{{extra ';' outside of a function is a C++11 extension}} +// expected-warning@-3{{extra ';' outside of a function is a C++11 extension}} +#elif !defined(PEDANTIC) +// expected-warning@-6{{extra ';' outside of a function is incompatible with C++98}} +// expected-warning@-6{{extra ';' outside of a function is incompatible with C++98}} +#endif
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-friend.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-friend.cpp new file mode 100644 index 0000000..a4492ba --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-friend.cpp
@@ -0,0 +1,57 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %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; +#if __cplusplus <= 199711L + // expected-warning@-2 {{unelaborated friend declaration is a C++11 extension; specify 'class' to befriend 'C'}} +#endif + + friend U; +#if __cplusplus <= 199711L + // expected-warning@-2 {{unelaborated friend declaration is a C++11 extension; specify 'union' to befriend 'U'}} +#endif + + friend int; +#if __cplusplus <= 199711L + // expected-warning@-2 {{non-class friend type 'int' is a C++11 extension}} +#endif + + friend void myfunc(); + + void f(A *a) { a->f(); } +}; + +inline void bar() {} // expected-note {{previous definition is here}} +class E { + friend void bar() {} // expected-error {{redefinition of 'bar'}} +}; + + + + +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/src/third_party/llvm-project/clang/test/Parser/cxx-in-c.c b/src/third_party/llvm-project/clang/test/Parser/cxx-in-c.c new file mode 100644 index 0000000..f5fa39b --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/cxx-invalid-for-range.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-invalid-for-range.cpp new file mode 100644 index 0000000..557c1da --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-invalid-for-range.cpp
@@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +// From PR23057 comment #18 (https://llvm.org/bugs/show_bug.cgi?id=23057#c18). + +namespace N { + int X[10]; // expected-note{{declared here}}}} +} + +void f1() { + for (auto operator new : X); // expected-error{{'operator new' cannot be the name of a variable or data member}} + // expected-error@-1{{use of undeclared identifier 'X'; did you mean 'N::X'?}} +} + +void f2() { + for (a operator== :) // expected-error{{'operator==' cannot be the name of a variable or data member}} + // expected-error@-1{{expected expression}} + // expected-error@-2{{unknown type name 'a'}} +} // expected-error{{expected statement}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-invalid-function-decl.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-invalid-function-decl.cpp new file mode 100644 index 0000000..2db2751 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-invalid-function-decl.cpp
@@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// Check that "::new" and "::delete" in member initializer list are diagnosed +// correctly and don't lead to infinite loop on parsing. + +// Error: X() (initializer on non-constructor), "::new" is skipped. +void f1() : X() ::new{}; // expected-error{{only constructors take base initializers}} + +// Errors: first "::delete" and initializer on non-constructor, others skipped. +void f2() : ::delete, ::new, X() ::new ::delete{} // expected-error{{expected class member or base class name}} + // expected-error@-1{{only constructors take base initializers}} + +// Errors: the '::' token, "::delete" and initializer on non-constructor, others skipped. +void f3() : ::, ::delete X(), ::new {}; // expected-error2{{expected class member or base class name}} + // expected-error@-1{{only constructors take base initializers}} + +template <class T> +struct Base1 { + T x1; + Base1(T a1) : x1(a1) {} +}; + +template <class T> +struct Base2 { + T x2; + Base2(T a2) : x2(a2) {} +}; + +struct S : public Base1<int>, public Base2<float> { + int x; + + // 1-st initializer is correct (just missing ','), 2-nd incorrect, skip other. + S() : ::Base1<int>(0) ::new, ::Base2<float>(1.0) ::delete x(2) {} // expected-error{{expected class member or base class name}} + // expected-error@-1{{missing ',' between base or member initializers}} + + // 1-st and 2-nd are correct, errors: '::' and "::new", others skipped. + S(int a) : Base1<int>(a), ::Base2<float>(1.0), ::, // expected-error{{expected class member or base class name}} + ::new, ! ::delete, ::Base2<() x(3) {} // expected-error{{expected class member or base class name}} + + // All initializers are correct, nothing to skip, diagnose 2 missing commas. + S(const S &) : Base1<int>(0) ::Base2<float>(1.0) x(2) {} // expected-error2{{missing ',' between base or member initializers}} +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-member-crash.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-member-crash.cpp new file mode 100644 index 0000000..65e7095 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-member-crash.cpp
@@ -0,0 +1,15 @@ +// RUN: not %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s + +// <rdar://problem/9221993> + +// We only care to check 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/src/third_party/llvm-project/clang/test/Parser/cxx-member-init-missing-paren-crash.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-member-init-missing-paren-crash.cpp new file mode 100644 index 0000000..5485e7d --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/cxx-member-initializers.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-member-initializers.cpp new file mode 100644 index 0000000..8e52adb --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-member-initializers.cpp
@@ -0,0 +1,107 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %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 '{'}} + +namespace PR16480 { + template<int n> struct X { + X(); + X(int); + }; + + struct A : X<0> { + A() : X<a<b>{0}.n>() {} + + template<int> struct a { + int n; + }; + + static const int b = 1; + }; + + struct B : X<0> { + B() : X<a<b>{0} {} + + static const int a = 0, b = 0; + }; + + template<int> struct a { + constexpr a(int) {} + constexpr operator int() const { return 0; } + }; + + struct C : X<0> { + C() : X<a<b>(0)>() {} + + static const int b = 0; + }; + + struct D : X<0> { + D() : X<a<b>(0) {} + + static const int a = 0, b = 0; + }; + + template<typename T> struct E : X<0> { + E(X<0>) : X<(0)>{} {} + E(X<1>) : X<int{}>{} {} + E(X<2>) : X<(0)>() {} + E(X<3>) : X<int{}>() {} + }; + + // FIXME: This should be valid in the union of C99 and C++11. + struct F : X<0> { + F() : X<A<T>().n + (T){}.n>{} {} // expected-error +{{}} + + struct T { int n; }; + template<typename> struct A { int n; }; + }; + + // FIXME: This is valid now, but may be made ill-formed by DR1607. + struct G : X<0> { + G() : X<0 && [](){return 0;}()>{} // expected-error +{{}} + }; + + struct Errs : X<0> { + Errs(X<0>) : decltype X<0>() {} // expected-error {{expected '(' after 'decltype'}} + Errs(X<1>) : what is this () {} // expected-error {{expected '(' or '{'}} + Errs(X<2>) : decltype(X<0> // expected-note {{to match this '('}} + }; // expected-error {{expected ')'}} +} + +template <class U, class V> struct C { + int f() { return 4; } + class C1 {}; +}; + +class D {}; +namespace N { +struct E { + class F {}; +}; +} + +class G { + // These are all valid: + void f(int x = C<int, D>().f()) {} + void g(int x = C<int, ::D>().f()) {} + void h(int x = C<int, N::E>().f()) {} + void i(int x = C<int, ::N::E>().f()) {} + void j(int x = C<int, decltype(N::E())::F>().f()) {} + void k(int x = C<int, C<int, int>>().f()) {} + void l(int x = C<int, C<int, int>::C1>().f()) {} + + // This isn't, but it shouldn't crash. The diagnostics don't matter much. + void m(int x = C<int, union int>().f()) {} // expected-error {{declaration of anonymous union must be a definition}} expected-error {{expected a type}} +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-modules-interface.cppm b/src/third_party/llvm-project/clang/test/Parser/cxx-modules-interface.cppm new file mode 100644 index 0000000..0e7c746 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-modules-interface.cppm
@@ -0,0 +1,31 @@ +// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -o %t.pcm -verify +// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -o %t.pcm -verify -DERRORS + +export module foo; +#ifndef ERRORS +// expected-no-diagnostics +#else +// FIXME: diagnose missing module-declaration when building module interface + +// FIXME: proclaimed-ownership-declarations? + +export { + int a; + int b; +} +export int c; + +namespace N { + export void f() {} +} + +export struct T {} t; + +struct S { + export int n; // expected-error {{expected member name or ';'}} + export static int n; // expected-error {{expected member name or ';'}} +}; +void f() { + export int n; // expected-error {{expected expression}} +} +#endif
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-namespace-alias.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-namespace-alias.cpp new file mode 100644 index 0000000..9b90aab --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/cxx-reference.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-reference.cpp new file mode 100644 index 0000000..58bd7ab --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-reference.cpp
@@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +extern char *bork; +char *& bar = bork; + +int val; + +void foo(int &a) { +} + +typedef int & A; + +void g(const A aref) { // expected-warning {{'const' qualifier on reference type 'A' (aka 'int &') has no effect}} +} + +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; +#if __cplusplus <= 199711L +// expected-warning@-2 {{rvalue references are a C++11 extension}} +#endif
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-stmt.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-stmt.cpp new file mode 100644 index 0000000..c2fa0a4 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-stmt.cpp
@@ -0,0 +1,68 @@ +// 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"); +} + +int f6() { + int k, // expected-note {{change this ',' to a ';' to call 'f6'}} + f6(), // expected-error {{expected ';'}} expected-warning {{interpreted as a function declaration}} expected-note {{replace paren}} + int n = 0, // expected-error {{expected ';'}} + return f5(), // ok + int(n); +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-template-argument.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-template-argument.cpp new file mode 100644 index 0000000..963356e --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-template-argument.cpp
@@ -0,0 +1,130 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -verify %s -fdelayed-template-parsing +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -fdelayed-template-parsing +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -fdelayed-template-parsing + +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; + +// Test behavior when a template-id is ended by a token which starts with '>'. +namespace greatergreater { + template<typename T> struct S { S(); S(T); }; + void f(S<int>=0); // expected-error {{a space is required between a right angle bracket and an equals sign (use '> =')}} + void f(S<S<int>>=S<int>()); // expected-error {{use '> >'}} expected-error {{use '> ='}} + template<typename T> void t(); + void g() { + void (*p)() = &t<int>; + (void)(&t<int>==p); // expected-error {{use '> ='}} + (void)(&t<int>>=p); // expected-error {{use '> >'}} + (void)(&t<S<int>>>=p); +#if __cplusplus <= 199711L + // expected-error@-2 {{use '> >'}} +#endif + (void)(&t<S<int>>==p); // expected-error {{use '> >'}} expected-error {{use '> ='}} + } +} + +namespace PR5925 { + template <typename x> + class foo { // expected-note {{here}} + }; + void bar(foo *X) { // expected-error {{requires template arguments}} + } +} + +namespace PR13210 { + template <class T> + class C {}; // expected-note {{here}} + + void f() { + new C(); // expected-error {{requires template arguments}} + } +} + +// Don't emit spurious messages +namespace pr16225add { + + template<class T1, typename T2> struct Known { }; // expected-note 3 {{template is declared here}} + template<class T1, typename T2> struct X; + template<class T1, typename T2> struct ABC; // expected-note {{template is declared here}} + template<int N1, int N2> struct ABC2 {}; + + template<class T1, typename T2> struct foo : + UnknownBase<T1,T2> // expected-error {{unknown template name 'UnknownBase'}} + { }; + + template<class T1, typename T2> struct foo2 : + UnknownBase<T1,T2>, // expected-error {{unknown template name 'UnknownBase'}} + Known<T1> // expected-error {{too few template arguments for class template 'Known'}} + { }; + + template<class T1, typename T2> struct foo3 : + UnknownBase<T1,T2,ABC<T2,T1> > // expected-error {{unknown template name 'UnknownBase'}} + { }; + + template<class T1, typename T2> struct foo4 : + UnknownBase<T1,ABC<T2> >, // expected-error {{unknown template name 'UnknownBase'}} \ + // expected-error {{too few template arguments for class template 'ABC'}} + Known<T1> // expected-error {{too few template arguments for class template 'Known'}} + { }; + + template<class T1, typename T2> struct foo5 : + UnknownBase<T1,T2,ABC<T2,T1>> // expected-error {{unknown template name 'UnknownBase'}} +#if __cplusplus <= 199711L + // expected-error@-2 {{use '> >'}} +#endif + { }; + + template<class T1, typename T2> struct foo6 : + UnknownBase<T1,ABC<T2,T1>>, // expected-error {{unknown template name 'UnknownBase'}} +#if __cplusplus <= 199711L + // expected-error@-2 {{use '> >'}} +#endif + Known<T1> // expected-error {{too few template arguments for class template 'Known'}} + { }; + + template<class T1, typename T2, int N> struct foo7 : + UnknownBase<T1,T2,(N>1)> // expected-error {{unknown template name 'UnknownBase'}} + { }; + + template<class T1, typename T2> struct foo8 : + UnknownBase<X<int,int>,X<int,int>> // expected-error {{unknown template name 'UnknownBase'}} +#if __cplusplus <= 199711L + // expected-error@-2 {{use '> >'}} +#endif + { }; + + template<class T1, typename T2> struct foo9 : + UnknownBase<Known<int,int>,X<int,int>> // expected-error {{unknown template name 'UnknownBase'}} +#if __cplusplus <= 199711L + // expected-error@-2 {{use '> >'}} +#endif + { }; + + template<class T1, typename T2> struct foo10 : + UnknownBase<Known<int,int>,X<int,X<int,int>>> // expected-error {{unknown template name 'UnknownBase'}} +#if __cplusplus <= 199711L + // expected-error@-2 {{use '> >'}} +#endif + { }; + + template<int N1, int N2> struct foo11 : + UnknownBase<2<N1,N2<4> // expected-error {{unknown template name 'UnknownBase'}} + { }; + +} + +namespace PR18793 { + template<typename T, T> struct S {}; + template<typename T> int g(S<T, (T())> *); +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-template-decl.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-template-decl.cpp new file mode 100644 index 0000000..9ad422e --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-template-decl.cpp
@@ -0,0 +1,250 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify %s -fdelayed-template-parsing -DDELAYED_TEMPLATE_PARSING +// RUN: %clang_cc1 -fsyntax-only -verify -std=gnu++1z %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 <template <typename> typename Foo> struct Cxx1z; +#if __cplusplus <= 201402L +// expected-warning@-2 {{extension}} +#endif + +// 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}} +}; + +template<typename T, // expected-note{{template parameter is declared here}} + T T> // expected-error{{declaration of 'T' shadows template parameter}} +void shadow6(); + +template<typename T, // expected-note{{template parameter is declared here}} + template<typename> class T> // expected-error{{declaration of 'T' shadows template parameter}} +void shadow7(); + +// PR8302 +template<template<typename> class T> struct shadow8 { // expected-note{{template parameter is declared here}} + template<template<typename> class T> struct inner; // expected-error{{declaration of 'T' shadows template parameter}} +}; + +// Non-type template parameters in scope +template<int Size> +void f(int& i) { + i = Size; + #ifdef DELAYED_TEMPLATE_PARSING + Size = i; + #else + Size = i; // expected-error{{expression is not assignable}} + #endif +} + +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'}} +template <> union U<int> { }; // expected-error{{explicit specialization of non-template union 'U'}} + +namespace PR6184 { + namespace N { + template <typename T> + void bar(typename T::x); + } + + template <typename T> + void N::bar(typename T::x) { } +} + +// This PR occurred only in template parsing mode. +namespace PR17637 { +template <int> +struct L { + template <typename T> + struct O { + template <typename U> + static void Fun(U); + }; +}; + +template <int k> +template <typename T> +template <typename U> +void L<k>::O<T>::Fun(U) {} + +void Instantiate() { L<0>::O<int>::Fun(0); } + +} + +namespace explicit_partial_specializations { +typedef char (&oneT)[1]; +typedef char (&twoT)[2]; +typedef char (&threeT)[3]; +typedef char (&fourT)[4]; +typedef char (&fiveT)[5]; +typedef char (&sixT)[6]; + +char one[1]; +char two[2]; +char three[3]; +char four[4]; +char five[5]; +char six[6]; + +template<bool b> struct bool_ { typedef int type; }; +template<> struct bool_<false> { }; + +#define XCAT(x,y) x ## y +#define CAT(x,y) XCAT(x,y) +#define sassert(_b_) bool_<(_b_)>::type CAT(var, __LINE__); + + +template <int> +struct L { + template <typename T> + struct O { + template <typename U> + static oneT Fun(U); + + }; +}; +template <int k> +template <typename T> +template <typename U> +oneT L<k>::O<T>::Fun(U) { return one; } + +template<> +template<> +template<typename U> +oneT L<0>::O<char>::Fun(U) { return one; } + + +void Instantiate() { + sassert(sizeof(L<0>::O<int>::Fun(0)) == sizeof(one)); + sassert(sizeof(L<0>::O<char>::Fun(0)) == sizeof(one)); +} + +} + +namespace func_tmpl_spec_def_in_func { +// We failed to diagnose function template specialization definitions inside +// functions during recovery previously. +template <class> void FuncTemplate() {} +void TopLevelFunc() { + // expected-error@+2 {{expected a qualified name after 'typename'}} + // expected-error@+1 {{function definition is not allowed here}} + typename template <> void FuncTemplate<void>() { } + // expected-error@+1 {{function definition is not allowed here}} + void NonTemplateInner() { } +} +} + +namespace broken_baseclause { +template<typename T> +struct base { }; + +struct t1 : base<int, + public: // expected-error {{expected expression}} +}; // expected-error {{expected class name}} +// expected-error@-1 {{expected '{' after base class list}} +struct t2 : base<int, + public // expected-error {{expected expression}} +}; // expected-error {{expected class name}} +// expected-error@-1 {{expected '{' after base class list}} + +} + +namespace class_scope_instantiation { + struct A { + template<typename T> void f(T); + template void f<int>(int); // expected-error {{expected '<' after 'template'}} + template void f(float); // expected-error {{expected '<' after 'template'}} + extern template // expected-error {{expected member name or ';'}} + void f(double); + }; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-throw.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-throw.cpp new file mode 100644 index 0000000..a1be710 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-throw.cpp
@@ -0,0 +1,17 @@ +// 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}} +} + +void f() throw(static); // expected-error {{expected a type}} expected-error {{does not allow storage class}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-typeid.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-typeid.cpp new file mode 100644 index 0000000..e726665 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/cxx-typeof.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-typeof.cpp new file mode 100644 index 0000000..c9651b4 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-typeof.cpp
@@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=gnu++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=gnu++11 %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(); +#if __cplusplus <= 199711L + // expected-error@-2 {{invalid use of non-static data member 'i'}} +#else + // expected-no-diagnostics +#endif +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-undeclared-identifier.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-undeclared-identifier.cpp new file mode 100644 index 0000000..a3f9e02 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-undeclared-identifier.cpp
@@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s + +namespace ImplicitInt { + static a(4); // expected-error {{requires a type specifier}} + b(int n); // expected-error {{requires a type specifier}} + c (*p)[]; // expected-error {{unknown type name 'c'}} + itn f(char *p, *q); // expected-error {{unknown type name 'itn'}} expected-error {{requires a type specifier}} + + struct S { + void f(); + }; + S::f() {} // expected-error {{requires a type specifier}} +} + +// PR7180 +int f(a::b::c); // expected-error {{use of undeclared identifier 'a'}} + +class Foo::Bar { // expected-error {{use of undeclared identifier 'Foo'}} \ + // expected-error {{expected ';' after class}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-using-declaration.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-using-declaration.cpp new file mode 100644 index 0000000..17237a3 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-using-declaration.cpp
@@ -0,0 +1,61 @@ +// 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 cannot 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; + + +namespace ShadowedTagNotes { + +namespace foo { + class Bar {}; +} + +void Bar(int); // expected-note{{class 'Bar' is hidden by a non-type declaration of 'Bar' here}} +using foo::Bar; + +void ambiguity() { + const Bar *x; // expected-error{{must use 'class' tag to refer to type 'Bar' in this scope}} +} + +} // namespace ShadowedTagNotes
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-using-directive.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-using-directive.cpp new file mode 100644 index 0000000..5efd991 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-using-directive.cpp
@@ -0,0 +1,40 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +class A {}; + +namespace B { + namespace A {} // expected-note{{namespace '::B::A' defined here}} \ + // expected-note 2{{namespace 'B::A' defined here}} + using namespace A ; +} + +namespace C {} // expected-note{{namespace 'C' defined here}} + +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::F ; // expected-error{{expected namespace name}} + using namespace ::D::C ; // expected-error{{no namespace named 'C' in namespace 'D'; did you mean simply 'C'?}} +} + +using namespace ! ; // expected-error{{expected namespace name}} +using namespace A ; // expected-error{{no namespace named 'A'; did you mean 'B::A'?}} +using namespace ::A // expected-error{{no namespace named 'A' in the global namespace; did you mean 'B::A'?}} \ + // expected-error{{expected ';' after namespace name}} + B ; + +void test_nslookup() { + int B; + class C; + using namespace B; + using namespace C; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx-variadic-func.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx-variadic-func.cpp new file mode 100644 index 0000000..98a34d3 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx-variadic-func.cpp
@@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +void f(...) { + // FIXME: There's no disambiguation here; this is unambiguous. + int g(int(...)); // expected-warning {{disambiguated}} expected-note {{paren}} +} + +void h(int n..., int m); // expected-error {{expected ')'}} expected-note {{to match}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx0x-ambig.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx0x-ambig.cpp new file mode 100644 index 0000000..71d32b8 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx0x-ambig.cpp
@@ -0,0 +1,177 @@ +// 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}} + } + // _Alignas isn't allowed in the places where alignas is. We used to + // assert on this. + struct U final _Alignas(4) {}; // expected-error 3{{}} expected-note {{}} +} + +// 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) const { return *this; } + constexpr operator int() const { 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 identifier}} + }; + 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 ';' after enum}} expected-error {{expected member name}} + }; + // This could be a bit-field. + struct S6 { + enum E : int { 1 }; // expected-error {{expected identifier}} + }; + + struct U { + constexpr operator T() const { 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}} + S(a)(int())->n; // ok, expression; expected-warning{{expression result unused}} + auto(a)()->n; // ok, function declaration + auto(b)(int())->n; // ok, function declaration + using T = decltype(a); + using T = auto() -> n; + } + } +} + +namespace ellipsis { + template<typename...T> + struct S { + void e(S::S()); // expected-error {{is a constructor name}} + void f(S(...args[sizeof(T)])); // expected-note {{here}} expected-note {{here}} + void f(S(...args)[sizeof(T)]); // expected-error {{redeclared}} + void f(S ...args[sizeof(T)]); // expected-error {{redeclared}} + void g(S(...[sizeof(T)])); // expected-note {{here}} expected-warning {{ISO C++11 requires a parenthesized pack declaration to have a name}} + 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)); + void l(int(&...)(T)); // expected-warning {{ISO C++11 requires a parenthesized pack declaration to have a name}} + void l(int(*...)(T)); // expected-warning {{ISO C++11 requires a parenthesized pack declaration to have a name}} + void l(int(S<int>::*...)(T)); // expected-warning {{ISO C++11 requires a parenthesized pack declaration to have a name}} + }; + + struct CtorSink { + template <typename ...T> constexpr CtorSink(T &&...t) { } + constexpr operator int() const { return 42; } + }; + + template <unsigned ...N> struct UnsignedTmplArgSink; + + template <typename ...T> + void foo(int x, T ...t) { + // Have a variety of cases where the syntax is technically unambiguous, but hinges on careful treatment of ellipses. + CtorSink(t ...), x; // ok, expression; expected-warning 2{{expression result unused}} + + int x0(CtorSink(t ...)); // ok, declares object x0 + int *p0 = &x0; + (void)p0; + + CtorSink x1(int(t) ..., int(x)); // ok, declares object x1 + CtorSink *p1 = &x1; + (void)p1; + + UnsignedTmplArgSink<T(CtorSink(t ...)) ...> *t0; // ok + UnsignedTmplArgSink<((T *)0, 42u) ...> **t0p = &t0; + } + + template void foo(int, int, int); // expected-note {{in instantiation of function template specialization 'ellipsis::foo<int, int>' requested here}} +} + +namespace braced_init_list { + struct X { + void foo() {} + }; + + void (*pf1)() {}; + void (X::*pmf1)() {&X::foo}; + void (X::*pmf2)() = {&X::foo}; + + void test() { + void (*pf2)() {}; + void (X::*pmf3)() {&X::foo}; + void (X::*pmf4)() = {&X::foo}; + } +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx0x-attributes.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx0x-attributes.cpp new file mode 100644 index 0000000..e01491d --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx0x-attributes.cpp
@@ -0,0 +1,375 @@ +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -Wc++14-compat -Wc++14-extensions -Wc++17-extensions %s + +// Need std::initializer_list +namespace std { + typedef decltype(sizeof(int)) size_t; + + // libc++'s implementation + template <class _E> + class initializer_list + { + const _E* __begin_; + size_t __size_; + + initializer_list(const _E* __b, size_t __s) + : __begin_(__b), + __size_(__s) + {} + + public: + typedef _E value_type; + typedef const _E& reference; + typedef const _E& const_reference; + typedef size_t size_type; + + typedef const _E* iterator; + typedef const _E* const_iterator; + + initializer_list() : __begin_(nullptr), __size_(0) {} + + size_t size() const {return __size_;} + const _E* begin() const {return __begin_;} + const _E* end() const {return __begin_ + __size_;} + }; +} + + +// Declaration syntax checks +[[]] int before_attr; +int [[]] between_attr; +const [[]] int between_attr_2 = 0; // expected-error {{an attribute list cannot appear here}} +int after_attr [[]]; +int * [[]] ptr_attr; +int & [[]] ref_attr = after_attr; +int & [[unknown]] ref_attr_2 = after_attr; // expected-warning {{unknown attribute 'unknown' ignored}} +int & [[noreturn]] ref_attr_3 = after_attr; // expected-error {{'noreturn' attribute cannot be applied to types}} +int && [[]] rref_attr = 0; +int array_attr [1] [[]]; +alignas(8) int aligned_attr; +[[test::valid(for 42 [very] **** '+' symbols went on a trip and had a "good"_time; the end.)]] int garbage_attr; // expected-warning {{unknown attribute 'valid' ignored}} +[[,,,static, class, namespace,, inline, constexpr, mutable,, bitand, bitor::compl(!.*_ Cx.!U^*R),,,]] int more_garbage_attr; // expected-warning {{unknown attribute 'static' ignored}} \ + // expected-warning {{unknown attribute 'class' ignored}} \ + // expected-warning {{unknown attribute 'namespace' ignored}} \ + // expected-warning {{unknown attribute 'inline' ignored}} \ + // expected-warning {{unknown attribute 'constexpr' ignored}} \ + // expected-warning {{unknown attribute 'mutable' ignored}} \ + // expected-warning {{unknown attribute 'bitand' ignored}} \ + // expected-warning {{unknown attribute 'compl' ignored}} +[[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; +}; +struct [[]] struct_attr; +class [[]] class_attr {}; +union [[]] union_attr; +enum [[]] E { }; +namespace test_misplacement { +[[]] struct struct_attr2; //expected-error{{misplaced attributes}} +[[]] class class_attr2; //expected-error{{misplaced attributes}} +[[]] union union_attr2; //expected-error{{misplaced attributes}} +[[]] enum E2 { }; //expected-error{{misplaced attributes}} +} + +// Checks attributes placed at wrong syntactic locations of class specifiers. +class [[]] [[]] + attr_after_class_name_decl [[]] [[]]; // expected-error {{an attribute list cannot appear here}} + +class [[]] [[]] + attr_after_class_name_definition [[]] [[]] [[]]{}; // expected-error {{an attribute list cannot appear here}} + +class [[]] c {}; +class c [[]] [[]] x; +class c [[]] [[]] y [[]] [[]]; +class c final [(int){0}]; + +class base {}; +class [[]] [[]] final_class + alignas(float) [[]] final // expected-error {{an attribute list cannot appear here}} + alignas(float) [[]] [[]] alignas(float): base{}; // expected-error {{an attribute list cannot appear here}} + +class [[]] [[]] final_class_another + [[]] [[]] alignas(16) final // expected-error {{an attribute list cannot appear here}} + [[]] [[]] alignas(16) [[]]{}; // expected-error {{an attribute list cannot appear here}} + +// The diagnostics here don't matter much, this just shouldn't crash: +class C final [[deprecated(l]] {}); // expected-error {{use of undeclared identifier}} expected-error {{expected ']'}} expected-error {{an attribute list cannot appear here}} expected-error {{expected unqualified-id}} +class D final alignas ([l) {}]{}); // expected-error {{expected ',' or ']' in lambda capture list}} expected-error {{an attribute list cannot appear here}} + +[[]] struct with_init_declarators {} init_declarator; +[[]] struct no_init_declarators; // expected-error {{misplaced attributes}} +template<typename> [[]] struct no_init_declarators_template; // expected-error {{an attribute list cannot appear here}} +void fn_with_structs() { + [[]] struct with_init_declarators {} init_declarator; + [[]] struct no_init_declarators; // expected-error {{an attribute list cannot appear here}} +} +[[]]; +struct ctordtor { + [[]] ctordtor [[]] () [[]]; + ctordtor (C) [[]]; + [[]] ~ctordtor [[]] () [[]]; +}; +[[]] ctordtor::ctordtor [[]] () [[]] {} +[[]] ctordtor::ctordtor (C) [[]] try {} catch (...) {} +[[]] ctordtor::~ctordtor [[]] () [[]] {} +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 {{an attribute list cannot appear here}} +unsigned [[]] int [[]] const double_decl_spec = 0; // expected-error 2{{an attribute list cannot appear here}} +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}} +[[unknown]] using namespace ns; // expected-warning {{unknown attribute 'unknown' ignored}} +[[noreturn]] using namespace ns; // expected-error {{'noreturn' attribute only applies to functions}} +namespace [[]] ns2 {} // expected-warning {{attributes on a namespace declaration are a C++17 extension}} + +using [[]] alignas(4) [[]] ns::i; // expected-error {{an attribute list cannot appear here}} +using [[]] alignas(4) [[]] foobar = int; // expected-error {{an attribute list cannot appear here}} expected-error {{'alignas' attribute only applies to}} + +void bad_attributes_in_do_while() { + do {} while ( + [[ns::i); // expected-error {{expected ']'}} \ + // expected-note {{to match this '['}} \ + // expected-error {{expected expression}} + do {} while ( + [[a]b ns::i); // expected-error {{expected ']'}} \ + // expected-note {{to match this '['}} \ + // expected-error {{expected expression}} + do {} while ( + [[ab]ab] ns::i); // expected-error {{an attribute list cannot appear here}} + do {} while ( // expected-note {{to match this '('}} + alignas(4 ns::i; // expected-note {{to match this '('}} +} // expected-error 2{{expected ')'}} expected-error {{expected expression}} + +[[]] using T = int; // expected-error {{an attribute list cannot appear here}} +using T [[]] = int; // ok +template<typename T> using U [[]] = T; +using ns::i [[]]; // expected-error {{an attribute list cannot appear here}} +using [[]] ns::i; // expected-error {{an attribute list cannot appear here}} +using T [[unknown]] = int; // expected-warning {{unknown attribute 'unknown' ignored}} +using T [[noreturn]] = int; // expected-error {{'noreturn' attribute only applies to functions}} +using V = int; // expected-note {{previous}} +using V [[gnu::vector_size(16)]] = int; // expected-error {{redefinition with different types}} + +auto trailing() -> [[]] const int; // expected-error {{an attribute list cannot appear here}} +auto trailing() -> const [[]] int; // expected-error {{an attribute list cannot appear here}} +auto trailing() -> const int [[]]; +auto trailing_2() -> struct struct_attr [[]]; + +namespace N { + struct S {}; +}; +template<typename> struct Template {}; + +// FIXME: Improve this diagnostic +struct [[]] N::S s; // expected-error {{an attribute list cannot appear here}} +struct [[]] Template<int> t; // expected-error {{an attribute list cannot appear here}} +struct [[]] ::template Template<int> u; // expected-error {{an attribute list cannot appear here}} +template struct [[]] Template<char>; // expected-error {{an attribute list cannot appear here}} +template <> struct [[]] Template<void>; + +enum [[]] E1 {}; +enum [[]] E2; // expected-error {{forbids forward references}} +enum [[]] E1; +enum [[]] E3 : int; +enum [[]] { + k_123 [[]] = 123 // expected-warning {{attributes on an enumerator declaration are a C++17 extension}} +}; +enum [[]] E1 e; // expected-error {{an attribute list cannot appear here}} +enum [[]] class E4 { }; // expected-error {{an attribute list cannot appear here}} +enum struct [[]] E5; + +struct S { + friend int f [[]] (); // expected-FIXME{{an attribute list cannot appear here}} + friend int f1 [[noreturn]] (); //expected-error{{an attribute list cannot appear here}} + friend int f2 [[]] [[noreturn]] () {} + [[]] friend int g(); // expected-error{{an attribute list cannot appear here}} + [[]] friend int h() { + } + [[]] friend int f3(), f4(), f5(); // expected-error{{an attribute list cannot appear here}} + friend int f6 [[noreturn]] (), f7 [[noreturn]] (), f8 [[noreturn]] (); // expected-error3 {{an attribute list cannot appear here}} + friend class [[]] C; // expected-error{{an attribute list cannot appear here}} + [[]] friend class D; // expected-error{{an attribute list cannot appear here}} + [[]] friend int; // expected-error{{an attribute list cannot appear here}} +}; +template<typename T> void tmpl(T) {} +template void tmpl [[]] (int); // expected-FIXME {{an attribute list cannot appear here}} +template [[]] void tmpl(char); // expected-error {{an attribute list cannot appear here}} +template void [[]] tmpl(short); + +// 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}} +} + +// Expression tests +void bar () { + // FIXME: GCC accepts [[gnu::noreturn]] on a lambda, even though it appertains + // to the operator()'s type, and GCC does not otherwise accept attributes + // applied to types. Use that to test this. + [] () [[gnu::noreturn]] { return; } (); // expected-warning {{attribute 'noreturn' ignored}} FIXME-error {{should not return}} + [] () [[gnu::noreturn]] { throw; } (); // expected-warning {{attribute 'noreturn' ignored}} + new int[42][[]][5][[]]{}; +} + +// Condition tests +void baz () { + if ([[unknown]] bool b = true) { // expected-warning {{unknown attribute 'unknown' ignored}} + switch ([[unknown]] int n { 42 }) { // expected-warning {{unknown attribute 'unknown' ignored}} + default: + for ([[unknown]] int n = 0; [[unknown]] char b = n < 5; ++b) { // expected-warning 2{{unknown attribute 'unknown' ignored}} + } + } + } + int x; + // An attribute can be applied to an expression-statement, such as the first + // statement in a for. But it can't be applied to a condition which is an + // expression. + for ([[]] x = 0; ; ) {} // expected-error {{an attribute list cannot appear here}} + for (; [[]] x < 5; ) {} // expected-error {{an attribute list cannot appear here}} + while ([[]] bool k { false }) { + } + while ([[]] true) { // expected-error {{an attribute list cannot appear here}} + } + do { + } while ([[]] false); // expected-error {{an attribute list cannot appear here}} + + for ([[unknown]] int n : { 1, 2, 3 }) { // expected-warning {{unknown attribute 'unknown' ignored}} + } +} + +enum class __attribute__((visibility("hidden"))) SecretKeepers { + one, /* rest are deprecated */ two, three +}; +enum class [[]] EvenMoreSecrets {}; + +namespace arguments { + void f[[gnu::format(printf, 1, 2)]](const char*, ...); + void g() [[unknown::foo(ignore arguments for unknown attributes, even with symbols!)]]; // expected-warning {{unknown attribute 'foo' ignored}} + [[deprecated("with argument")]] int i; + // expected-warning@-1 {{use of the 'deprecated' attribute is a C++14 extension}} +} + +// Forbid attributes on decl specifiers. +unsigned [[gnu::used]] static int [[gnu::unused]] v1; // expected-error {{'unused' attribute cannot be applied to types}} \ + expected-error {{an attribute list cannot appear here}} +typedef [[gnu::used]] unsigned long [[gnu::unused]] v2; // expected-error {{'unused' attribute cannot be applied to types}} \ + expected-error {{an attribute list cannot appear here}} +int [[carries_dependency]] foo(int [[carries_dependency]] x); // expected-error 2{{'carries_dependency' attribute cannot be applied to types}} + +// Forbid [[gnu::...]] attributes on declarator chunks. +int *[[gnu::unused]] v3; // expected-warning {{attribute 'unused' ignored}} +int v4[2][[gnu::unused]]; // expected-warning {{attribute 'unused' ignored}} +int v5()[[gnu::unused]]; // expected-warning {{attribute 'unused' ignored}} + +[[attribute_declaration]]; // expected-warning {{unknown attribute 'attribute_declaration' ignored}} +[[noreturn]]; // expected-error {{'noreturn' attribute only applies to functions}} +[[carries_dependency]]; // expected-error {{'carries_dependency' attribute only applies to parameters, Objective-C methods, and functions}} + +class A { + A([[gnu::unused]] int a); +}; +A::A([[gnu::unused]] int a) {} + +namespace GccConst { + // GCC's tokenizer treats const and __const as the same token. + [[gnu::const]] int *f1(); + [[gnu::__const]] int *f2(); + [[gnu::__const__]] int *f3(); + void f(const int *); + void g() { f(f1()); f(f2()); } + void h() { f(f3()); } +} + +namespace GccASan { + __attribute__((no_address_safety_analysis)) void f1(); + __attribute__((no_sanitize_address)) void f2(); + [[gnu::no_address_safety_analysis]] void f3(); + [[gnu::no_sanitize_address]] void f4(); +} + +namespace { + [[deprecated]] void bar(); + // expected-warning@-1 {{use of the 'deprecated' attribute is a C++14 extension}} + [[deprecated("hello")]] void baz(); + // expected-warning@-1 {{use of the 'deprecated' attribute is a C++14 extension}} + [[deprecated()]] void foo(); + // expected-error@-1 {{parentheses must be omitted if 'deprecated' attribute's argument list is empty}} + [[gnu::deprecated()]] void quux(); +} + +namespace { +[[ // expected-error {{expected ']'}} +#pragma pack(pop) +deprecated +]] void bad(); +} + +int fallthru(int n) { + switch (n) { + case 0: + n += 5; + [[fallthrough]]; // expected-warning {{use of the 'fallthrough' attribute is a C++17 extension}} + case 1: + n *= 2; + break; + } + return n; +} + +#define attr_name bitand +#define attr_name_2(x) x +#define attr_name_3(x, y) x##y +[[attr_name, attr_name_2(bitor), attr_name_3(com, pl)]] int macro_attrs; // expected-warning {{unknown attribute 'compl' ignored}} \ + expected-warning {{unknown attribute 'bitor' ignored}} \ + expected-warning {{unknown attribute 'bitand' ignored}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx0x-condition.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx0x-condition.cpp new file mode 100644 index 0000000..19d5a73 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx0x-condition.cpp
@@ -0,0 +1,38 @@ +// 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) {} // expected-warning {{redundant parentheses}} expected-note 2{{}} + if (S(a) == 0) {} // ok + + if (S(n)) {} // expected-error {{unexpected type name 'n': expected expression}} + if (S(n) = 0) {} // expected-warning {{redundant parentheses}} expected-note 2{{}} + 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}} + 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}} + + S s(a); + if (S{s}) {} // ok + if (S a{s}) {} // ok + if (S a = {s}) {} // ok + if (S a == {s}) {} // expected-error {{did you mean '='?}} + + if (S(b){a}) {} // ok + if (S(b) = {a}) {} // ok +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx0x-decl.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx0x-decl.cpp new file mode 100644 index 0000000..7bd82e8 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx0x-decl.cpp
@@ -0,0 +1,162 @@ +// RUN: %clang_cc1 -verify -fsyntax-only -std=c++11 -pedantic-errors -triple x86_64-linux-gnu %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(); +} + +int decltype(f())::*ptr_mem_decltype; + +class ExtraSemiAfterMemFn { + // Due to a peculiarity in the C++11 grammar, a deleted or defaulted function + // is permitted to be followed by either one or two semicolons. + void f() = delete // expected-error {{expected ';' after delete}} + void g() = delete; // ok + void h() = delete;; // ok + void i() = delete;;; // expected-error {{extra ';' after member function definition}} +}; + +int *const const p = 0; // expected-error {{duplicate 'const' declaration specifier}} +const const int *q = 0; // expected-error {{duplicate 'const' declaration specifier}} + +struct MultiCV { + void f() const const; // expected-error {{duplicate 'const' declaration specifier}} +}; + +static_assert(something, ""); // expected-error {{undeclared identifier}} + +// PR9903 +struct SS { + typedef void d() = default; // expected-error {{function definition declared 'typedef'}} expected-error {{only special member functions may be defaulted}} +}; + +using PR14855 = int S::; // expected-error {{expected ';' after alias declaration}} + +// Ensure that 'this' has a const-qualified type in a trailing return type for +// a constexpr function. +struct ConstexprTrailingReturn { + int n; + constexpr auto f() const -> decltype((n)); +}; +constexpr const int &ConstexprTrailingReturn::f() const { return n; } + +namespace TestIsValidAfterTypeSpecifier { +struct s {} v; + +struct s +thread_local tl; + +struct s +&r0 = v; + +struct s +&&r1 = s(); + +struct s +bitand r2 = v; + +struct s +and r3 = s(); + +enum E {}; +enum E +[[]] e; + +} + +namespace PR5066 { + using T = int (*f)(); // expected-error {{type-id cannot have a name}} + template<typename T> using U = int (*f)(); // expected-error {{type-id cannot have a name}} + auto f() -> int (*f)(); // expected-error {{only variables can be initialized}} expected-error {{expected ';'}} + auto g = []() -> int (*f)() {}; // expected-error {{type-id cannot have a name}} +} + +namespace FinalOverride { + struct Base { + virtual void *f(); + virtual void *g(); + virtual void *h(); + virtual void *i(); + }; + struct Derived : Base { + virtual auto f() -> void *final; + virtual auto g() -> void *override; + virtual auto h() -> void *final override; + virtual auto i() -> void *override final; + }; +} + +namespace UsingDeclAttrs { + using T __attribute__((aligned(1))) = int; + using T [[gnu::aligned(1)]] = int; + static_assert(alignof(T) == 1, ""); + + using [[gnu::aligned(1)]] T = int; // expected-error {{an attribute list cannot appear here}} + using T = int [[gnu::aligned(1)]]; // expected-error {{'aligned' attribute cannot be applied to types}} +} + +namespace DuplicateSpecifier { + constexpr constexpr int f(); // expected-warning {{duplicate 'constexpr' declaration specifier}} + constexpr int constexpr a = 0; // expected-warning {{duplicate 'constexpr' declaration specifier}} + + struct A { + friend constexpr int constexpr friend f(); // expected-warning {{duplicate 'friend' declaration specifier}} \ + // expected-warning {{duplicate 'constexpr' declaration specifier}} + friend struct A friend; // expected-warning {{duplicate 'friend'}} expected-error {{'friend' must appear first}} + }; +} + +namespace ColonColonDecltype { + struct S { struct T {}; }; + ::decltype(S())::T invalid; // expected-error {{expected unqualified-id}} +} + +namespace AliasDeclEndLocation { + template<typename T> struct A {}; + // Ensure that we correctly determine the end of this declaration to be the + // end of the annotation token, not the beginning. + using B = AliasDeclEndLocation::A<int + > // expected-error {{expected ';' after alias declaration}} + +; + using C = AliasDeclEndLocation::A<int + >\ +> // expected-error {{expected ';' after alias declaration}} + ; + using D = AliasDeclEndLocation::A<int + > // expected-error {{expected ';' after alias declaration}} + // FIXME: After splitting this >> into two > tokens, we incorrectly determine + // the end of the template-id to be after the *second* '>'. + using E = AliasDeclEndLocation::A<int>>; +#define GGG >>> + using F = AliasDeclEndLocation::A<int GGG; + // expected-error@-1 {{expected ';' after alias declaration}} + B something_else; +} + +struct Base { virtual void f() = 0; virtual void g() = 0; virtual void h() = 0; }; +struct MemberComponentOrder : Base { + void f() override __asm__("foobar") __attribute__(( )) {} + void g() __attribute__(( )) override; + void h() __attribute__(( )) override {} +}; + +void NoMissingSemicolonHere(struct S + [3]); +template<int ...N> void NoMissingSemicolonHereEither(struct S + ... [N]); + +// This must be at the end of the file; we used to look ahead past the EOF token here. +// expected-error@+1 {{expected unqualified-id}} expected-error@+1{{expected ';'}} +using
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx0x-for-range.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx0x-for-range.cpp new file mode 100644 index 0000000..c3276eb --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx0x-for-range.cpp
@@ -0,0 +1,62 @@ +// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -std=c++11 %s 2>&1 | FileCheck %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; +} + +namespace PR19176 { +struct Vector { + struct iterator { + int &operator*(); + iterator &operator++(); + iterator &operator++(int); + bool operator==(const iterator &) const; + }; + iterator begin(); + iterator end(); +}; + +void f() { + Vector v; + int a[] = {1, 2, 3, 4}; + for (auto foo = a) // expected-error {{range-based 'for' statement uses ':', not '='}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:19-[[@LINE-1]]:20}:":" + (void)foo; + for (auto i + = + v) // expected-error@-1 {{range-based 'for' statement uses ':', not '='}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:7-[[@LINE-2]]:8}:":" + (void)i; +#define FORRANGE(v, a) for (DECLVARWITHINIT(v) a) // expected-note {{expanded from macro}} +#define DECLAUTOVAR(v) auto v +#define DECLVARWITHINIT(v) DECLAUTOVAR(v) = // expected-note {{expanded from macro}} + FORRANGE(i, a) { // expected-error {{range-based 'for' statement uses ':', not '='}} + + } +} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx0x-in-cxx98.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx0x-in-cxx98.cpp new file mode 100644 index 0000000..10cb4d2 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx0x-in-cxx98.cpp
@@ -0,0 +1,34 @@ +// 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 {{}} +} + +struct Auto { + static int n; +}; +auto Auto::n = 0; // expected-warning {{'auto' type specifier is a C++11 extension}} +auto Auto::m = 0; // expected-error {{no member named 'm' in 'Auto'}} + // expected-warning@-1 {{'auto' type specifier is a C++11 extension}} + +struct Conv { template<typename T> operator T(); }; +bool pr21367_a = new int && false; +bool pr21367_b = &Conv::operator int && false;
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx0x-lambda-expressions.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx0x-lambda-expressions.cpp new file mode 100644 index 0000000..7deeb21 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx0x-lambda-expressions.cpp
@@ -0,0 +1,110 @@ +// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify -std=c++11 %s + +enum E { e }; + +constexpr int id(int n) { return n; } + +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'}} + [](int) -> {}; // PR13652 expected-error {{expected a type}} + return 1; + } + + void designator_or_lambda() { + typedef int T; + const int b = 0; + const int c = 1; + int d; + int a1[1] = {[b] (T()) {}}; // expected-error{{no viable conversion from '(lambda}} + int a2[1] = {[b] = 1 }; + int a3[1] = {[b,c] = 1 }; // expected-error{{expected ']'}} expected-note {{to match}} + 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 *'}} + int a7[1] = {[d(0)] { return d; } ()}; // expected-warning{{extension}} + int a8[1] = {[d = 0] { return d; } ()}; // expected-warning{{extension}} + int a9[1] = {[d = 0] = 1}; // expected-error{{is not an integral constant expression}} + int a10[1] = {[id(0)] { return id; } ()}; // expected-warning{{extension}} + int a11[1] = {[id(0)] = 1}; + } + + void delete_lambda(int *p) { + delete [] p; + delete [] (int*) { new int }; // ok, compound-literal, not lambda + delete [] { return new int; } (); // expected-error{{expected expression}} + delete [&] { return new int; } (); // ok, lambda + } + + // We support init-captures in C++11 as an extension. + int z; + void init_capture() { + [n(0)] () mutable -> int { return ++n; }; // expected-warning{{extension}} + [n{0}] { return; }; // expected-warning{{extension}} + [n = 0] { return ++n; }; // expected-error {{captured by copy in a non-mutable}} expected-warning{{extension}} + [n = {0}] { return; }; // expected-error {{<initializer_list>}} expected-warning{{extension}} + [a([&b = z]{})](){}; // expected-warning 2{{extension}} + + int x = 4; + auto y = [&r = x, x = x + 1]() -> int { // expected-warning 2{{extension}} + r += 2; + return x + 2; + } (); + } + + void attributes() { + [] [[]] {}; // expected-error {{lambda requires '()' before attribute specifier}} + [] __attribute__((noreturn)) {}; // expected-error {{lambda requires '()' before attribute specifier}} + []() [[]] + mutable {}; // expected-error {{expected body of lambda expression}} + + []() [[]] {}; + []() [[]] -> void {}; + []() mutable [[]] -> void {}; + []() mutable noexcept [[]] -> void {}; + + // Testing GNU-style attributes on lambdas -- the attribute is specified + // before the mutable specifier instead of after (unlike C++11). + []() __attribute__((noreturn)) mutable { while(1); }; + []() mutable + __attribute__((noreturn)) { while(1); }; // expected-error {{expected body of lambda expression}} + } +}; + +template <typename> +void PR22122() { + [](int) -> {}; // expected-error {{expected a type}} +} + +template void PR22122<int>(); + +struct S { + template <typename T> + void m (T x =[0); // expected-error{{expected variable name or 'this' in lambda capture list}} +} s; + +struct U { + template <typename T> + void m_fn1(T x = 0[0); // expected-error{{expected ']'}} expected-note{{to match this '['}} +} *U;
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx0x-literal-operators.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx0x-literal-operators.cpp new file mode 100644 index 0000000..1881fcb --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/cxx0x-member-initializers.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx0x-member-initializers.cpp new file mode 100644 index 0000000..4d14394 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx0x-member-initializers.cpp
@@ -0,0 +1,43 @@ +// 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{} {} +}; + +template <typename, typename> struct T1 { enum {V};}; +template <int, int> struct T2 { enum {V};}; +struct A { + T1<int, int> a1 = T1<int, int>(), *a2 = new T1<int,int>; + T2<0,0> b1 = T2<0,0>(), b2 = T2<0,0>(), b3; + bool c1 = 1 < 2, c2 = 2 < 1, c3 = false; + bool d1 = T1<int, T1<int, int>>::V < 3, d2; + T1<int, int()> e = T1<int, int()>(); +}; + +struct PR19993 { + static int n = delete; // expected-error {{only functions can have deleted definitions}} +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx0x-override-control-keywords.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx0x-override-control-keywords.cpp new file mode 100644 index 0000000..a9096af --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx0x-override-control-keywords.cpp
@@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// expected-no-diagnostics + +struct Base { + virtual void override(); +}; + +struct S : Base { + virtual void final() final; + virtual void override() override; +}; + +struct T : Base { + virtual void override() override { } +}; + +struct override; +struct Base2 { + virtual override override(int override); +}; + +struct A : Base2 { + virtual struct override override(int override) override; +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx0x-rvalue-reference.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx0x-rvalue-reference.cpp new file mode 100644 index 0000000..613b828 --- /dev/null +++ b/src/third_party/llvm-project/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) { // expected-warning {{'const' qualifier on reference type 'R' (aka 'int &&') has no effect}} + int & &&ar = a; // expected-error{{'ar' declared as a reference to a reference}} +} +
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx11-base-spec-attributes.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx11-base-spec-attributes.cpp new file mode 100644 index 0000000..7338c51 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx11-base-spec-attributes.cpp
@@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -std=c++11 %s -verify + +struct A {}; +struct B : [[]] A {}; +struct C : [[]] virtual A {}; +struct D : [[]] public virtual A {}; +struct E : public [[]] virtual A {}; // expected-error {{an attribute list cannot appear here}} +struct F : virtual [[]] public A {}; // expected-error {{an attribute list cannot appear here}} +struct G : [[noreturn]] A {}; // expected-error {{'noreturn' attribute cannot be applied to a base specifier}} +struct H : [[unknown::foobar]] A {}; // expected-warning {{unknown attribute 'foobar' ignored}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx11-brace-initializers.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx11-brace-initializers.cpp new file mode 100644 index 0000000..820344c --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx11-brace-initializers.cpp
@@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 + +struct S { + S(int, int) {} +}; + +void f(int, S const&, int) {} + +void test1() +{ + S X1{1, 1,}; + S X2 = {1, 1,}; + + f(0, {1, 1}, 0); +} + +namespace PR14948 { + template<typename T> struct Q { static T x; }; + + struct X {}; + template<> X Q<X>::x {}; + template<> int Q<int[]>::x[] { 1, 2, 3 }; + template<> int Q<int>::x { 1 }; + + template<typename T> T Q<T>::x {}; +} + +int conditional1 = 1 ? {} : 0; // expected-error {{initializer list cannot be used on the right hand side of operator '?'}} +int conditional2 = 1 ? 0 : {}; // expected-error {{initializer list cannot be used on the right hand side of operator ':'}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx11-stmt-attributes.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx11-stmt-attributes.cpp new file mode 100644 index 0000000..75fb37e --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx11-stmt-attributes.cpp
@@ -0,0 +1,85 @@ +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 %s + +void foo(int i) { + + [[unknown_attribute]] ; // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + [[unknown_attribute]] { } // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + [[unknown_attribute]] if (0) { } // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + [[unknown_attribute]] for (;;); // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + [[unknown_attribute]] do { // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + [[unknown_attribute]] continue; // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + } while (0); + [[unknown_attribute]] while (0); // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + + [[unknown_attribute]] switch (i) { // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + [[unknown_attribute]] case 0: // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + [[unknown_attribute]] default: // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + [[unknown_attribute]] break; // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + } + + [[unknown_attribute]] goto here; // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + [[unknown_attribute]] here: // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + + [[unknown_attribute]] try { // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + } catch (...) { + } + + [[unknown_attribute]] return; // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + + + alignas(8) ; // expected-error {{'alignas' attribute cannot be applied to a statement}} + [[noreturn]] { } // expected-error {{'noreturn' attribute cannot be applied to a statement}} + [[noreturn]] if (0) { } // expected-error {{'noreturn' attribute cannot be applied to a statement}} + [[noreturn]] for (;;); // expected-error {{'noreturn' attribute cannot be applied to a statement}} + [[noreturn]] do { // expected-error {{'noreturn' attribute cannot be applied to a statement}} + [[unavailable]] continue; // expected-warning {{unknown attribute 'unavailable' ignored}} + } while (0); + [[unknown_attributqqq]] while (0); // expected-warning {{unknown attribute 'unknown_attributqqq' ignored}} + // TODO: remove 'qqq' part and enjoy 'empty loop body' warning here (DiagnoseEmptyLoopBody) + + [[unknown_attribute]] while (0); // expected-warning {{unknown attribute 'unknown_attribute' ignored}} + + [[unused]] switch (i) { // expected-warning {{unknown attribute 'unused' ignored}} + [[uuid]] case 0: // expected-warning {{unknown attribute 'uuid' ignored}} + [[visibility]] default: // expected-warning {{unknown attribute 'visibility' ignored}} + [[carries_dependency]] break; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + } + + [[fastcall]] goto there; // expected-warning {{unknown attribute 'fastcall' ignored}} + [[noinline]] there: // expected-warning {{unknown attribute 'noinline' ignored}} + + [[lock_returned]] try { // expected-warning {{unknown attribute 'lock_returned' ignored}} + } catch (...) { + } + + [[weakref]] return; // expected-warning {{unknown attribute 'weakref' ignored}} + + [[carries_dependency]] ; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + [[carries_dependency]] { } // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + [[carries_dependency]] if (0) { } // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + [[carries_dependency]] for (;;); // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + [[carries_dependency]] do { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + [[carries_dependency]] continue; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} ignored}} + } while (0); + [[carries_dependency]] while (0); // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + + [[carries_dependency]] switch (i) { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} ignored}} + [[carries_dependency]] case 0: // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + [[carries_dependency]] default: // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + [[carries_dependency]] break; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + } + + [[carries_dependency]] goto here; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + + [[carries_dependency]] try { // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + } catch (...) { + } + + [[carries_dependency]] return; // expected-error {{'carries_dependency' attribute cannot be applied to a statement}} + + { + [[ ]] // expected-error {{an attribute list cannot appear here}} +#pragma STDC FP_CONTRACT ON // expected-error {{can only appear at file scope or at the start of a compound statement}} +#pragma clang fp contract(fast) // expected-error {{can only appear at file scope or at the start of a compound statement}} + } +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx11-templates.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx11-templates.cpp new file mode 100644 index 0000000..ed04952 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx11-templates.cpp
@@ -0,0 +1,46 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +struct S { + template <typename Ty = char> + static_assert(sizeof(Ty) != 1, "Not a char"); // expected-error {{a static_assert declaration cannot be a template}} +}; + +template <typename Ty = char> +static_assert(sizeof(Ty) != 1, "Not a char"); // expected-error {{a static_assert declaration cannot be a template}} + +namespace Ellipsis { + template<typename ...T> void f(T t..., int n); // expected-error {{must immediately precede declared identifier}} + template<typename ...T> void f(int n, T t...); // expected-error {{must immediately precede declared identifier}} + template<typename ...T> void f(int n, T t, ...); // expected-error {{unexpanded parameter pack}} + template<typename ...T> void f() { + f([]{ + void g(T + t // expected-note {{place '...' immediately before declared identifier to declare a function parameter pack}} + ... // expected-warning {{'...' in this location creates a C-style varargs function, not a function parameter pack}} + // expected-note@-1 {{insert ',' before '...' to silence this warning}} + ); + void h(T (& + ) // expected-note {{place '...' here to declare a function parameter pack}} + ... // expected-warning {{'...' in this location creates a C-style varargs function, not a function parameter pack}} + // expected-note@-1 {{insert ',' before '...' to silence this warning}} + ); + void i(T (&), ...); + }...); + } + template<typename ...T> struct S { + void f(T t...); // expected-error {{must immediately precede declared identifier}} + void f(T ... // expected-note {{preceding '...' declares a function parameter pack}} + t...); // expected-warning-re {{'...' in this location creates a C-style varargs function{{$}}}} + // expected-note@-1 {{insert ',' before '...' to silence this warning}} + }; + + // FIXME: We should just issue a single error in this case pointing out where + // the '...' goes. It's tricky to recover correctly in this case, though, + // because the parameter is in scope in the default argument, so must be + // passed to Sema before we reach the ellipsis. + template<typename...T> void f(T n = 1 ...); + // expected-warning@-1 {{creates a C-style varargs}} + // expected-note@-2 {{place '...' immediately before declared identifier}} + // expected-note@-3 {{insert ','}} + // expected-error@-4 {{unexpanded parameter pack}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx11-type-specifier.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx11-type-specifier.cpp new file mode 100644 index 0000000..1676623 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx11-type-specifier.cpp
@@ -0,0 +1,24 @@ +// 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' cannot be defined in a type specifier}} + (void) new enum E { e }; // expected-error{{'E' cannot be defined in a type specifier}} +} + +// And for trailing-type-specifier-seq + +auto f() -> unknown; // expected-error{{unknown type name 'unknown'}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx11-user-defined-literals.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx11-user-defined-literals.cpp new file mode 100644 index 0000000..d3188f8 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx11-user-defined-literals.cpp
@@ -0,0 +1,145 @@ +// 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}} + +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 + +void operator ""_no_space(const char *); // ok + +// Ensure we diagnose the bad cases. +void operator "\0" _non_empty(const char *); // expected-error {{must be '""'}} +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 '""'}} + +// Make sure we treat UCNs and UTF-8 as equivalent. +int operator""_µs(unsigned long long) {} // expected-note {{previous}} +int hundred_µs = 50_µs + 50_\u00b5s; +int operator""_\u00b5s(unsigned long long) {} // expected-error {{redefinition of 'operator""_µs'}} + +int operator""_\U0000212B(long double) {} // expected-note {{previous}} +int hundred_Å = 50.0_Å + 50._\U0000212B; +int operator""_Å(long double) {} // expected-error {{redefinition of 'operator""_Å'}} + +int operator""_𐀀(char) {} // expected-note {{previous}} +int 𐀀 = '4'_𐀀 + '2'_\U00010000; +int operator""_\U00010000(char) {} // expected-error {{redefinition of 'operator""_𐀀'}} + +// These all declare the same function. +int operator""_℮""_\u212e""_\U0000212e""(const char*, size_t); +int operator""_\u212e""_\U0000212e""_℮""(const char*, size_t); +int operator""_\U0000212e""_℮""_\u212e""(const char*, size_t); +int mix_ucn_utf8 = ""_℮""_\u212e""_\U0000212e""; + +void operator""_℮""_ℯ(unsigned long long) {} // expected-error {{differing user-defined suffixes ('_℮' and '_ℯ') in string literal concatenation}} +void operator""_℮""_\u212f(unsigned long long) {} // expected-error {{differing user-defined suffixes ('_℮' and '_ℯ') in string literal concatenation}} +void operator""_\u212e""_ℯ(unsigned long long) {} // expected-error {{differing user-defined suffixes ('_℮' and '_ℯ') in string literal concatenation}} +void operator""_\u212e""_\u212f(unsigned long long) {} // expected-error {{differing user-defined suffixes ('_℮' and '_ℯ') in string literal concatenation}} + +void operator""_℮""_℮(unsigned long long) {} // expected-note {{previous}} +void operator""_\u212e""_\u212e(unsigned long long) {} // expected-error {{redefinition}} + +#define ¢ *0.01 // expected-error {{macro name must be an identifier}} +constexpr int operator""_¢(long double d) { return d * 100; } // expected-error {{non-ASCII}} +constexpr int operator""_¢(unsigned long long n) { return n; } // expected-error {{non-ASCII}} +static_assert(0.02_¢ == 2_¢, ""); // expected-error 2{{non-ASCII}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx1z-attributes.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx1z-attributes.cpp new file mode 100644 index 0000000..1267091 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx1z-attributes.cpp
@@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++1z %s + +namespace [[]] foo {} +namespace [[]] {} +namespace [[]] bad = foo; // expected-error {{attributes cannot be specified on namespace alias}} + +namespace [[]] A::B {} // expected-error {{attributes cannot be specified on a nested namespace definition}} + +enum test { + bing [[]], + bar [[]] = 1, + baz [[]][[]], + quux [[]][[]] = 4 +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx1z-class-template-argument-deduction.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx1z-class-template-argument-deduction.cpp new file mode 100644 index 0000000..532c893 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx1z-class-template-argument-deduction.cpp
@@ -0,0 +1,232 @@ +// RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -verify %s + +template <typename T> struct A { // expected-note 38{{declared here}} + constexpr A() {} + constexpr A(int) {} + constexpr operator int() { return 0; } +}; +A() -> A<int>; +A(int) -> A<int>; + +// Make sure we still correctly parse cases where a template can appear without arguments. +namespace template_template_arg { + template<template<typename> typename> struct X {}; + template<typename> struct Y {}; + + X<A> xa; + Y<A> ya; // expected-error {{requires template arguments}} + X<::A> xcca; + Y<::A> ycca; // expected-error {{requires template arguments}} + X<A*> xap; // expected-error {{requires template arguments}} + X<const A> xca; // expected-error {{requires template arguments}} + X<A const> xac; // expected-error {{requires template arguments}} + // FIXME: This should not parse as a template template argument due to the + // trailing attributes. + X<A [[]]> xa_attr; + + template<template<typename> typename = A> struct XD {}; + template<typename = A> struct YD {}; // expected-error {{requires template arguments}} + template<template<typename> typename = ::A> struct XCCD {}; + template<typename = ::A> struct YCCD {}; // expected-error {{requires template arguments}} + + // FIXME: replacing the invalid type with 'int' here is horrible + template <A a = A<int>()> class C { }; // expected-error {{requires template arguments}} + template<typename T = A> struct G { }; // expected-error {{requires template arguments}} +} + +namespace template_template_arg_pack { + template<template<typename> typename...> struct XP {}; + template<typename...> struct YP {}; + + struct Z { template<typename T> struct Q {}; }; // expected-note 2{{here}} + + template<typename T> using ZId = Z; + + template<typename ...Ts> struct A { + XP<ZId<Ts>::Q...> xe; + YP<ZId<Ts>::Q...> ye; // expected-error {{requires template arguments}} + + XP<ZId<Ts>::Q> xp; // expected-error {{unexpanded parameter pack}} + YP<ZId<Ts>::Q> yp; // expected-error {{requires template arguments}} + }; +} + +namespace injected_class_name { + template<typename T> struct A { + A(T); + void f(int) { // expected-note {{previous}} + A a = 1; + injected_class_name::A b = 1; // expected-note {{in instantiation of template class 'injected_class_name::A<int>'}} + } + void f(T); // expected-error {{multiple overloads of 'f' instantiate to the same signature 'void (int)}} + }; + A<short> ai = 1; + A<double>::A b(1); // expected-error {{constructor name}} +} + +struct member { + A a; // expected-error {{requires template arguments}} + A *b; // expected-error {{requires template arguments}} + const A c; // expected-error {{requires template arguments}} + + void f() throw (A); // expected-error {{requires template arguments}} + + friend A; // expected-error {{requires template arguments; argument deduction not allowed in friend declaration}} + + operator A(); // expected-error {{requires template arguments; argument deduction not allowed in conversion function type}} + + static A x; // expected-error {{declaration of variable 'x' with deduced type 'A' requires an initializer}} + static constexpr A y = 0; +}; + +namespace in_typedef { + typedef A *AutoPtr; // expected-error {{requires template arguments; argument deduction not allowed in typedef}} + typedef A (*PFun)(int a); // expected-error{{requires template arguments; argument deduction not allowed in typedef}} + typedef A Fun(int a) -> decltype(a + a); // expected-error{{requires template arguments; argument deduction not allowed in function return type}} +} + +namespace stmt { + void g(A a) { // expected-error{{requires template arguments; argument deduction not allowed in function prototype}} + try { } + catch (A &a) { } // expected-error{{requires template arguments; argument deduction not allowed in exception declaration}} + catch (const A a) { } // expected-error{{requires template arguments; argument deduction not allowed in exception declaration}} + try { } catch (A a) { } // expected-error{{requires template arguments; argument deduction not allowed in exception declaration}} + + // FIXME: The standard only permits class template argument deduction in a + // simple-declaration or cast. We also permit it in conditions, + // for-range-declarations, member-declarations for static data members, and + // new-expressions, because not doing so would be bizarre. + A local = 0; + static A local_static = 0; + static thread_local A thread_local_static = 0; + if (A a = 0) {} + if (A a = 0; a) {} + switch (A a = 0) {} // expected-warning {{no case matching constant switch condition '0'}} + switch (A a = 0; a) {} // expected-warning {{no case matching constant switch condition '0'}} + for (A a = 0; a; /**/) {} + for (/**/; A a = 0; /**/) {} + while (A a = 0) {} + int arr[3]; + for (A a : arr) {} + } + + namespace std { + class type_info; + } +} + +namespace expr { + template<typename T> struct U {}; + void j() { + (void)typeid(A); // expected-error{{requires template arguments; argument deduction not allowed here}} + (void)sizeof(A); // expected-error{{requires template arguments; argument deduction not allowed here}} + (void)__alignof(A); // expected-error{{requires template arguments; argument deduction not allowed here}} + + U<A> v; // expected-error {{requires template arguments}} + + int n; + (void)dynamic_cast<A&>(n); // expected-error{{requires template arguments; argument deduction not allowed here}} + (void)static_cast<A*>(&n); // expected-error{{requires template arguments; argument deduction not allowed here}} + (void)reinterpret_cast<A*>(&n); // expected-error{{requires template arguments; argument deduction not allowed here}} + (void)const_cast<A>(n); // expected-error{{requires template arguments; argument deduction not allowed here}} + (void)*(A*)(&n); // expected-error{{requires template arguments; argument deduction not allowed here}} + (void)(A)(n); // expected-error{{requires template arguments; argument deduction not allowed here}} + (void)(A){n}; // expected-error{{requires template arguments; argument deduction not allowed here}} + + (void)A(n); + (void)A{n}; + (void)new A(n); + (void)new A{n}; + (void)new A; + } +} + +namespace decl { + enum E : A {}; // expected-error{{requires template arguments; argument deduction not allowed here}} + struct F : A {}; // expected-error{{expected class name}} + + using B = A; // expected-error{{requires template arguments}} + + auto k() -> A; // expected-error{{requires template arguments}} + + A a; + A b = 0; + const A c = 0; + A (parens) = 0; // expected-error {{cannot use parentheses when declaring variable with deduced class template specialization type}} + A *p = 0; // expected-error {{cannot form pointer to deduced class template specialization type}} + A &r = *p; // expected-error {{cannot form reference to deduced class template specialization type}} + A arr[3] = 0; // expected-error {{cannot form array of deduced class template specialization type}} + A F::*pm = 0; // expected-error {{cannot form pointer to deduced class template specialization type}} + A (*fp)() = 0; // expected-error {{cannot form function returning deduced class template specialization type}} + A [x, y] = 0; // expected-error {{cannot be declared with type 'A'}} expected-error {{type 'A<int>' decomposes into 0 elements, but 2 names were provided}} +} + +namespace typename_specifier { + struct F {}; + + void e() { + (void) typename ::A(0); + (void) typename ::A{0}; + new typename ::A(0); + new typename ::A{0}; + typename ::A a = 0; + const typename ::A b = 0; + if (typename ::A a = 0) {} + for (typename ::A a = 0; typename ::A b = 0; /**/) {} + + (void)(typename ::A)(0); // expected-error{{requires template arguments; argument deduction not allowed here}} + (void)(typename ::A){0}; // expected-error{{requires template arguments; argument deduction not allowed here}} + } + typename ::A a = 0; + const typename ::A b = 0; + typename ::A (parens) = 0; // expected-error {{cannot use parentheses when declaring variable with deduced class template specialization type}} + typename ::A *p = 0; // expected-error {{cannot form pointer to deduced class template specialization type}} + typename ::A &r = *p; // expected-error {{cannot form reference to deduced class template specialization type}} + typename ::A arr[3] = 0; // expected-error {{cannot form array of deduced class template specialization type}} + typename ::A F::*pm = 0; // expected-error {{cannot form pointer to deduced class template specialization type}} + typename ::A (*fp)() = 0; // expected-error {{cannot form function returning deduced class template specialization type}} + typename ::A [x, y] = 0; // expected-error {{cannot be declared with type 'typename ::A'}} expected-error {{type 'typename ::A<int>' (aka 'A<int>') decomposes into 0}} + + struct X { template<typename T> struct A { A(T); }; }; // expected-note 8{{declared here}} + + template<typename T> void f() { + (void) typename T::A(0); + (void) typename T::A{0}; + new typename T::A(0); + new typename T::A{0}; + typename T::A a = 0; + const typename T::A b = 0; + if (typename T::A a = 0) {} // expected-error {{value of type 'typename X::A<int>' (aka 'typename_specifier::X::A<int>') is not contextually convertible to 'bool'}} + for (typename T::A a = 0; typename T::A b = 0; /**/) {} // expected-error {{value of type 'typename X::A<int>' (aka 'typename_specifier::X::A<int>') is not contextually convertible to 'bool'}} + + {(void)(typename T::A)(0);} // expected-error{{refers to class template member}} + {(void)(typename T::A){0};} // expected-error{{refers to class template member}} + {typename T::A (parens) = 0;} // expected-error {{refers to class template member in 'typename_specifier::X'; argument deduction not allowed here}} + // expected-warning@-1 {{disambiguated as redundant parentheses around declaration of variable named 'parens'}} expected-note@-1 {{add a variable name}} expected-note@-1{{remove parentheses}} expected-note@-1 {{add enclosing parentheses}} + {typename T::A *p = 0;} // expected-error {{refers to class template member}} + {typename T::A &r = *p;} // expected-error {{refers to class template member}} + {typename T::A arr[3] = 0;} // expected-error {{refers to class template member}} + {typename T::A F::*pm = 0;} // expected-error {{refers to class template member}} + {typename T::A (*fp)() = 0;} // expected-error {{refers to class template member}} + {typename T::A [x, y] = 0;} // expected-error {{cannot be declared with type 'typename T::A'}} expected-error {{type 'typename X::A<int>' (aka 'typename_specifier::X::A<int>') decomposes into 0}} + } + template void f<X>(); // expected-note {{instantiation of}} + + template<typename T> void g(typename T::A = 0); // expected-note {{refers to class template member}} + void h() { g<X>(); } // expected-error {{no matching function}} +} + +namespace parenthesized { + template<typename T> struct X { X(T); }; + auto n = (X([]{})); +} + +namespace within_template_arg_list { + template<typename T> struct X { constexpr X(T v) : v(v) {} T v; }; + template<int N = X(1).v> struct Y {}; + using T = Y<>; + using T = Y<X(1).v>; + using T = Y<within_template_arg_list::X(1).v>; + + template<int ...N> struct Z { Y<X(N)...> y; }; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx1z-constexpr-lambdas.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx1z-constexpr-lambdas.cpp new file mode 100644 index 0000000..4cf3d12 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx1z-constexpr-lambdas.cpp
@@ -0,0 +1,31 @@ +// RUN: %clang_cc1 -std=c++17 %s -verify +// RUN: %clang_cc1 -std=c++14 %s -verify +// RUN: %clang_cc1 -std=c++11 %s -verify + + +auto XL0 = [] constexpr { }; //expected-error{{requires '()'}} expected-error{{expected body}} +auto XL1 = [] () mutable + mutable //expected-error{{cannot appear multiple times}} + mutable { }; //expected-error{{cannot appear multiple times}} + +#if __cplusplus > 201402L +auto XL2 = [] () constexpr mutable constexpr { }; //expected-error{{cannot appear multiple times}} +auto L = []() mutable constexpr { }; +auto L2 = []() constexpr { }; +auto L4 = []() constexpr mutable { }; +auto XL16 = [] () constexpr + mutable + constexpr //expected-error{{cannot appear multiple times}} + mutable //expected-error{{cannot appear multiple times}} + mutable //expected-error{{cannot appear multiple times}} + constexpr //expected-error{{cannot appear multiple times}} + constexpr //expected-error{{cannot appear multiple times}} + { }; + +#else +auto L = []() mutable constexpr {return 0; }; //expected-warning{{is a C++17 extension}} +auto L2 = []() constexpr { return 0;};//expected-warning{{is a C++17 extension}} +auto L4 = []() constexpr mutable { return 0; }; //expected-warning{{is a C++17 extension}} +#endif + +
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx1z-coroutines.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx1z-coroutines.cpp new file mode 100644 index 0000000..68ef91c --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx1z-coroutines.cpp
@@ -0,0 +1,35 @@ +// RUN: %clang_cc1 -std=c++11 -fcoroutines-ts %s -verify + +template<typename T, typename U> +U f(T t) { + co_await t; + co_yield t; + + 1 + co_await t; + 1 + co_yield t; // expected-error {{expected expression}} + + auto x = co_await t; + auto y = co_yield t; + + for co_await (int x : t) {} + for co_await (int x = 0; x != 10; ++x) {} // expected-error {{'co_await' modifier can only be applied to range-based for loop}} + + if (t) + co_return t; + else + co_return {t}; +} + +struct Y {}; +struct X { Y operator co_await(); }; +struct Z {}; +Y operator co_await(Z); + +void f(X x, Z z) { + x.operator co_await(); + operator co_await(z); +} + +void operator co_await(); // expected-error {{must have at least one parameter}} +void operator co_await(X, Y, Z); // expected-error {{must be a unary operator}} +void operator co_await(int); // expected-error {{parameter of class or enumeration type}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx1z-decomposition.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx1z-decomposition.cpp new file mode 100644 index 0000000..cf4ba77 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx1z-decomposition.cpp
@@ -0,0 +1,151 @@ +// RUN: %clang_cc1 -std=c++1z %s -verify -fcxx-exceptions + +struct S { int a, b, c; }; + +// A simple-declaration can be a decompsition declaration. +namespace SimpleDecl { + auto [a_x, b_x, c_x] = S(); + + void f(S s) { + auto [a, b, c] = S(); + { + for (auto [a, b, c] = S();;) {} + if (auto [a, b, c] = S(); true) {} + switch (auto [a, b, c] = S(); 0) { case 0:; } + } + } +} + +// A for-range-declaration can be a decomposition declaration. +namespace ForRangeDecl { + extern S arr[10]; + void h() { + for (auto [a, b, c] : arr) { + } + } +} + +// Other kinds of declaration cannot. +namespace OtherDecl { + // A parameter-declaration is not a simple-declaration. + // This parses as an array declaration. + void f(auto [a, b, c]); // expected-error {{'auto' not allowed in function prototype}} expected-error {{'a'}} + + void g() { + // A condition is allowed as a Clang extension. + // See commentary in test/Parser/decomposed-condition.cpp + for (; auto [a, b, c] = S(); ) {} // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{value of type 'S' is not contextually convertible to 'bool'}} + if (auto [a, b, c] = S()) {} // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{value of type 'S' is not contextually convertible to 'bool'}} + if (int n; auto [a, b, c] = S()) {} // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{value of type 'S' is not contextually convertible to 'bool'}} + switch (auto [a, b, c] = S()) {} // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{statement requires expression of integer type ('S' invalid)}} + switch (int n; auto [a, b, c] = S()) {} // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{statement requires expression of integer type ('S' invalid)}} + while (auto [a, b, c] = S()) {} // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{value of type 'S' is not contextually convertible to 'bool'}} + + // An exception-declaration is not a simple-declaration. + try {} + catch (auto [a, b, c]) {} // expected-error {{'auto' not allowed in exception declaration}} expected-error {{'a'}} + } + + // A member-declaration is not a simple-declaration. + class A { + auto [a, b, c] = S(); // expected-error {{not permitted in this context}} + static auto [a, b, c] = S(); // expected-error {{not permitted in this context}} + }; +} + +namespace GoodSpecifiers { + void f() { + int n[1]; + const volatile auto &[a] = n; + } +} + +namespace BadSpecifiers { + typedef int I1[1]; + I1 n; + struct S { int n; } s; + void f() { + // storage-class-specifiers + static auto &[a] = n; // expected-error {{cannot be declared 'static'}} + thread_local auto &[b] = n; // expected-error {{cannot be declared 'thread_local'}} + extern auto &[c] = n; // expected-error {{cannot be declared 'extern'}} expected-error {{cannot have an initializer}} + struct S { + mutable auto &[d] = n; // expected-error {{not permitted in this context}} + + // function-specifiers + virtual auto &[e] = n; // expected-error {{not permitted in this context}} + explicit auto &[f] = n; // expected-error {{not permitted in this context}} + + // misc decl-specifiers + friend auto &[g] = n; // expected-error {{'auto' not allowed}} expected-error {{friends can only be classes or functions}} + }; + typedef auto &[h] = n; // expected-error {{cannot be declared 'typedef'}} + constexpr auto &[i] = n; // expected-error {{cannot be declared 'constexpr'}} + + static constexpr thread_local auto &[j] = n; // expected-error {{cannot be declared with 'static thread_local constexpr' specifiers}} + } + inline auto &[k] = n; // expected-error {{cannot be declared 'inline'}} + + const int K = 5; + void g() { + // defining-type-specifiers other than cv-qualifiers and 'auto' + S [a] = s; // expected-error {{cannot be declared with type 'BadSpecifiers::S'}} + decltype(auto) [b] = s; // expected-error {{cannot be declared with type 'decltype(auto)'}} + auto ([c]) = s; // expected-error {{cannot be declared with parentheses}} + + // FIXME: This error is not very good. + auto [d]() = s; // expected-error {{expected ';'}} expected-error {{expected expression}} + auto [e][1] = s; // expected-error {{expected ';'}} expected-error {{requires an initializer}} + + // FIXME: This should fire the 'misplaced array declarator' diagnostic. + int [K] arr = {0}; // expected-error {{expected ';'}} expected-error {{cannot be declared with type 'int'}} expected-error {{decomposition declaration '[K]' requires an initializer}} + int [5] arr = {0}; // expected-error {{place the brackets after the name}} + + auto *[f] = s; // expected-error {{cannot be declared with type 'auto *'}} expected-error {{incompatible initializer}} + auto S::*[g] = s; // expected-error {{cannot be declared with type 'auto BadSpecifiers::S::*'}} expected-error {{incompatible initializer}} + + // ref-qualifiers are OK. + auto &&[ok_1] = S(); + auto &[ok_2] = s; + + // attributes are OK. + [[]] auto [ok_3] = s; + alignas(S) auto [ok_4] = s; + + // ... but not after the identifier or declarator. + // FIXME: These errors are not very good. + auto [bad_attr_1 [[]]] = s; // expected-error {{attribute list cannot appear here}} expected-error 2{{}} + auto [bad_attr_2] [[]] = s; // expected-error {{expected ';'}} expected-error {{}} + } +} + +namespace MultiDeclarator { + struct S { int n; }; + void f(S s) { + auto [a] = s, [b] = s; // expected-error {{must be the only declaration}} + auto [c] = s, d = s; // expected-error {{must be the only declaration}} + auto e = s, [f] = s; // expected-error {{must be the only declaration}} + auto g = s, h = s, i = s, [j] = s; // expected-error {{must be the only declaration}} + } +} + +namespace Template { + int n[3]; + // FIXME: There's no actual rule against this... + template<typename T> auto [a, b, c] = n; // expected-error {{decomposition declaration template not supported}} +} + +namespace Init { + void f() { + int arr[1]; + struct S { int n; }; + auto &[bad1]; // expected-error {{decomposition declaration '[bad1]' requires an initializer}} + const auto &[bad2](S{}, S{}); // expected-error {{initializer for variable '[bad2]' with type 'const auto &' contains multiple expressions}} + const auto &[bad3](); // expected-error {{expected expression}} + auto &[good1] = arr; + auto &&[good2] = S{}; + const auto &[good3](S{}); + S [goodish3] = { 4 }; // expected-error {{cannot be declared with type 'S'}} + S [goodish4] { 4 }; // expected-error {{cannot be declared with type 'S'}} + } +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx1z-fold-expressions.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx1z-fold-expressions.cpp new file mode 100644 index 0000000..93ee6f2 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx1z-fold-expressions.cpp
@@ -0,0 +1,88 @@ +// RUN: %clang_cc1 -std=c++1z -verify %s + +template<typename ...T> constexpr auto sum(T ...t) { return (... + t); } +template<typename ...T> constexpr auto product(T ...t) { return (t * ...); } +template<typename ...T> constexpr auto all(T ...t) { return (true && ... && t); } +template<typename ...T> constexpr auto all2(T ...t) { return (t && ... && true); } + +int k1 = (1 + ... + 2); // expected-error {{does not contain any unexpanded parameter packs}} +int k2 = (1 + ...); // expected-error {{does not contain any unexpanded parameter packs}} +int k3 = (... + 2); // expected-error {{does not contain any unexpanded parameter packs}} + +struct A { A(int); friend A operator+(A, A); A operator-(A); A operator()(A); A operator[](A); }; +A operator*(A, A); + +template<int ...N> void bad1() { (N + ... + N); } // expected-error {{unexpanded parameter packs in both operands}} +// FIXME: it would be reasonable to support this as an extension. +template<int ...N> void bad2() { (2 * N + ... + 1); } // expected-error {{expression not permitted as operand}} +template<int ...N> void bad3() { (2 + N * ... * 1); } // expected-error {{expression not permitted as operand}} +template<int ...N, int ...M> void bad4(int (&...x)[N]) { (N + M * ... * 1); } // expected-error {{expression not permitted as operand}} +template<int ...N, int ...M> void fixed4(int (&...x)[N]) { ((N + M) * ... * 1); } +template<typename ...T> void bad4a(T ...t) { (t * 2 + ... + 1); } // expected-error {{expression not permitted as operand}} +template<int ...N> void bad4b() { (A(0) + A(N) + ...); } // expected-error {{expression not permitted as operand}} +template<int ...N> void bad4c() { (A(0) - A(N) + ...); } // expected-error {{expression not permitted as operand}} +template<int ...N> void bad4d() { (A(0)(A(0)) + ... + A(0)[A(N)]); } + +// Parens are mandatory. +template<int ...N> void bad5() { N + ...; } // expected-error {{expected expression}} expected-error +{{}} +template<int ...N> void bad6() { ... + N; } // expected-error {{expected expression}} +template<int ...N> void bad7() { N + ... + N; } // expected-error {{expected expression}} expected-error +{{}} + +// Must have a fold-operator in the relevant places. +template<int ...N> int bad8() { return (N + ... * 3); } // expected-error {{operators in fold expression must be the same}} +template<int ...N> int bad9() { return (3 + ... * N); } // expected-error {{operators in fold expression must be the same}} +template<int ...N> int bad10() { return (3 ? ... : N); } // expected-error +{{}} expected-note {{to match}} +template<int ...N> int bad11() { return (N + ... 0); } // expected-error {{expected a foldable binary operator}} expected-error {{expected expression}} +template<int ...N> int bad12() { return (... N); } // expected-error {{expected expression}} + +template<typename ...T> void as_operand_of_cast(int a, T ...t) { + return + (int)(a + ... + undeclared_junk) + // expected-error {{undeclared}} expected-error {{does not contain any unexpanded}} + (int)(t + ... + undeclared_junk) + // expected-error {{undeclared}} + (int)(... + undeclared_junk) + // expected-error {{undeclared}} expected-error {{does not contain any unexpanded}} + (int)(undeclared_junk + ...) + // expected-error {{undeclared}} + (int)(a + ...); // expected-error {{does not contain any unexpanded}} +} + +// fold-operator can be '>' or '>>'. +template <int... N> constexpr bool greaterThan() { return (N > ...); } +template <int... N> constexpr int rightShift() { return (N >> ...); } + +static_assert(greaterThan<2, 1>()); +static_assert(rightShift<10, 1>() == 5); + +template <auto V> constexpr auto Identity = V; + +// Support fold operators within templates. +template <int... N> constexpr int nestedFoldOperator() { + return Identity<(Identity<0> >> ... >> N)> + + Identity<(N >> ... >> Identity<0>)>; +} + +static_assert(nestedFoldOperator<3, 1>() == 1); + +// A fold-expression is a primary-expression. +template <typename T, typename... Ts> +constexpr auto castSum(Ts... Args) { + return (T)(Args + ...).Value; // expected-error{{member reference base type 'int' is not a structure or union}} +} + +template <typename... Ts> +constexpr auto simpleSum(Ts... Args) { + return (... + Args).Value; // expected-error{{member reference base type 'int' is not a structure or union}} +} + +void prim() { + castSum<int>(1, 2); + // expected-note@-1{{in instantiation of function template specialization}} + simpleSum(1, 2); + // expected-note@-1{{in instantiation of function template specialization}} + + struct Number { + int Value; + constexpr Number operator+(Number Rhs) const { return {Rhs.Value + Value}; } + }; + + static_assert(castSum<long>(Number{1}, Number{2}) == 3); + static_assert(simpleSum(Number{1}, Number{2}) == 3); +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx1z-init-statement.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx1z-init-statement.cpp new file mode 100644 index 0000000..3d119ef --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx1z-init-statement.cpp
@@ -0,0 +1,51 @@ +// RUN: %clang_cc1 -std=c++1z -verify %s -Wno-vexing-parse + +int g, h; +typedef int T; +int f() { + // init-statement declarations + if (T n = 0; n != 0) {} + if (T f(); f()) {} + if (T(f()); f()) {} + if (T(f()), g, h; f()) {} + if (T f(); f()) {} + if (T f(), g, h; f()) {} + if (T(n) = 0; n) {} + + // init-statement expressions + if (T{f()}; f()) {} + if (T{f()}, g, h; f()) {} // expected-warning 2{{unused}} + if (T(f()), g, h + 1; f()) {} // expected-warning 2{{unused}} + + // condition declarations + if (T(n){g}) {} + if (T f()) {} // expected-error {{function type}} + if (T f(), g, h) {} // expected-error {{function type}} + if (T(n) = 0) {} + + // condition expressions + if (T(f())) {} + if (T{f()}) {} + if (T(f()), g, h) {} // expected-warning 2{{unused}} + if (T{f()}, g, h) {} // expected-warning 2{{unused}} + + // none of the above, disambiguated as expression (can't be a declaration) + if (T(n)(g)) {} // expected-error {{undeclared identifier 'n'}} + if (T(n)(int())) {} // expected-error {{undeclared identifier 'n'}} + + // Likewise for 'switch' + switch (int n; n) {} + switch (g; int g = 5) {} + + if (int a, b; int c = a) { // expected-note 6{{previous}} + int a; // expected-error {{redefinition}} + int b; // expected-error {{redefinition}} + int c; // expected-error {{redefinition}} + } else { + int a; // expected-error {{redefinition}} + int b; // expected-error {{redefinition}} + int c; // expected-error {{redefinition}} + } + + return 0; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx1z-nested-namespace-definition.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx1z-nested-namespace-definition.cpp new file mode 100644 index 0000000..e0c5244 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx1z-nested-namespace-definition.cpp
@@ -0,0 +1,38 @@ +// RUN: cp %s %t +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 +// RUN: not %clang_cc1 -x c++ -fixit %t -Werror -DFIXIT +// RUN: %clang_cc1 -x c++ %t -DFIXIT +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17 -Wc++14-compat + +namespace foo1::foo2::foo3 { +#if __cplusplus <= 201400L +// expected-warning@-2 {{nested namespace definition is a C++17 extension; define each namespace separately}} +#else +// expected-warning@-4 {{nested namespace definition is incompatible with C++ standards before C++17}} +#endif + int foo(int x) { return x; } +} + +#ifndef FIXIT +inline namespace goo::bar { // expected-error {{nested namespace definition cannot be 'inline'}} expected-warning 0-1{{C++11 feature}} + int n; +} + +int m = goo::bar::n; +#endif + +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/src/third_party/llvm-project/clang/test/Parser/cxx1z-using-declaration.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx1z-using-declaration.cpp new file mode 100644 index 0000000..0be8167 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx1z-using-declaration.cpp
@@ -0,0 +1,35 @@ +// RUN: %clang_cc1 -std=c++1z -verify %s + +namespace A { + int m, n; +}; + +namespace B { + using A::m, A::n, A::n; + int q = m + n; +} + +struct X { + int x1, x2, y, z; // expected-note 2{{conflicting}} +}; +struct Y { + int x1, x2, y, z; // expected-note 2{{target}} +}; +struct Z : X, Y { + using X::x1, + blah::blah, // expected-error {{undeclared}} + X::x2, // expected-note {{previous}} + Y::y, + X::x2, // expected-error {{redeclaration}} + X::z, + Y::z; // expected-error {{conflicts with}} +}; +int X::*px1 = &Z::x1; +int X::*px2 = &Z::x2; +int Y::*py = &Z::y; +int X::*pz = &Z::z; + +template<typename ...T> struct Q : T... { + using T::z...; // expected-error {{conflicts}} +}; +Q<X,Y> q; // expected-note {{instantiation of}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx2a-bitfield-init.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx2a-bitfield-init.cpp new file mode 100644 index 0000000..83f1575 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx2a-bitfield-init.cpp
@@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -std=c++2a -verify %s + +namespace std_example { + int a; + const int b = 0; // expected-note {{here}} + struct S { + int x1 : 8 = 42; + int x2 : 8 { 42 }; + int y1 : true ? 8 : a = 42; + int y3 : (true ? 8 : b) = 42; + int z : 1 || new int { 1 }; + }; + static_assert(S{}.x1 == 42); + static_assert(S{}.x2 == 42); + static_assert(S{}.y1 == 0); + static_assert(S{}.y3 == 42); + static_assert(S{}.z == 0); + + struct T { + int y2 : true ? 8 : b = 42; // expected-error {{cannot assign to variable 'b'}} + }; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/cxx2a-spaceship.cpp b/src/third_party/llvm-project/clang/test/Parser/cxx2a-spaceship.cpp new file mode 100644 index 0000000..24cece3 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/cxx2a-spaceship.cpp
@@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -std=c++2a -verify %s + +template<int> struct X {}; + +X<1> operator<<(X<0>, X<0>); +X<2> operator<=>(X<0>, X<1>); +X<2> operator<=>(X<1>, X<0>); +X<3> operator<(X<0>, X<2>); +X<3> operator<(X<2>, X<0>); + +void f(X<0> x0, X<1> x1) { + X<2> a = x0 <=> x0 << x0; + X<2> b = x0 << x0 <=> x0; // expected-warning {{overloaded operator << has higher precedence than comparison operator}} expected-note 2{{}} + X<3> c = x0 < x0 <=> x1; + X<3> d = x1 <=> x0 < x0; + X<3> e = x0 < x0 <=> x0 << x0; + X<3> f = x0 << x0 <=> x0 < x0; // expected-warning {{overloaded operator << has higher precedence than comparison operator}} expected-note 2{{}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/debugger-import-module.m b/src/third_party/llvm-project/clang/test/Parser/debugger-import-module.m new file mode 100644 index 0000000..b6001ae --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/debugger-import-module.m
@@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -fsyntax-only -fdebugger-support -verify %s +// expected-no-diagnostics + +void importAModule() { + @import AModuleThatDoesntExist +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/declarators.c b/src/third_party/llvm-project/clang/test/Parser/declarators.c new file mode 100644 index 0000000..48936d5 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/declarators.c
@@ -0,0 +1,154 @@ +// 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'}} */ +int f5(int [static]); /* expected-error {{'static' may not be used without an array size}} */ + +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}} +void knrNoSemi(i) int i { } // expected-error {{expected ';' at end of declaration}} + + +// PR12595 +void test18() { + int x = 4+(5-12)); // expected-error {{extraneous ')' before ';'}} +} + +enum E1 { e1 }: // expected-error {{expected ';'}} +struct EnumBitfield { // expected-warning {{struct without named members is a GNU extension}} + enum E2 { e2 } : 4; // ok + struct S { int n; }: // expected-error {{expected ';'}} + // expected-warning@-1 {{declaration does not declare anything}} + +}; + +// PR10982 +enum E11 { + A1 = 1, +}; + +enum E12 { + , // expected-error{{expected identifier}} + A2 +}; +void func_E12(enum E12 *p) { *p = A2; } + +enum E13 { + 1D, // expected-error{{expected identifier}} + A3 +}; +void func_E13(enum E13 *p) { *p = A3; } + +enum E14 { + A4 12, // expected-error{{expected '= constant-expression' or end of enumerator definition}} + A4a +}; +void func_E14(enum E14 *p) { *p = A4a; } + +enum E15 { + A5=12 4, // expected-error{{expected '}' or ','}} + A5a +}; +void func_E15(enum E15 *p) { *p = A5a; } + +enum E16 { + A6; // expected-error{{expected '= constant-expression' or end of enumerator definition}} + A6a +}; + +int PR20634 = sizeof(struct { int n; } [5]);
diff --git a/src/third_party/llvm-project/clang/test/Parser/declspec-recovery.c b/src/third_party/llvm-project/clang/test/Parser/declspec-recovery.c new file mode 100644 index 0000000..b256861 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/declspec-recovery.c
@@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -verify %s + +__declspec(naked) void f(void) {} // expected-error{{'__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes}} + +struct S { + __declspec(property(get=Getter, put=Setter)) int X; // expected-error{{'__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes}} + int Y; +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/declspec-supported.c b/src/third_party/llvm-project/clang/test/Parser/declspec-supported.c new file mode 100644 index 0000000..f900489 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/declspec-supported.c
@@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -fms-extensions -verify %s +// RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -fdeclspec -verify %s +// expected-no-diagnostics + +__declspec(naked) void f(void) {} + +struct S { + __declspec(property(get=Getter, put=Setter)) int X; + int Y; +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/decomposed-condition.cpp b/src/third_party/llvm-project/clang/test/Parser/decomposed-condition.cpp new file mode 100644 index 0000000..4c635c4 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/decomposed-condition.cpp
@@ -0,0 +1,87 @@ +// RUN: %clang_cc1 -std=c++1z %s -verify + +namespace std { + template<typename> struct tuple_size; + template<int, typename> struct tuple_element; +} + +struct Get { + template<int> int get() { return 0; } + operator bool() { return true; } +}; + +namespace std { + template<> struct tuple_size<Get> { static constexpr int value = 1; }; + template<> struct tuple_element<0, Get> { using type = int; }; +} + +struct Na { + bool flag; + float data; +}; + +struct Rst { + bool flag; + float data; + explicit operator bool() const { + return flag; + } +}; + +Rst f(); +Na g(); + +namespace CondInIf { +int h() { + if (auto [ok, d] = f()) // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} + ; + if (auto [ok, d] = g()) // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{value of type 'Na' is not contextually convertible to 'bool'}} + ; + if (auto [value] = Get()) // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} + return value; +} +} // namespace CondInIf + +namespace CondInWhile { +int h() { + while (auto [ok, d] = f()) // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} + ; + while (auto [ok, d] = g()) // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{value of type 'Na' is not contextually convertible to 'bool'}} + ; + while (auto [value] = Get()) // expected-warning{{ISO C++17 does not permit structured binding declaration in a condition}} + return value; +} +} // namespace CondInWhile + +namespace CondInFor { +int h() { + for (; auto [ok, d] = f();) // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} + ; + for (; auto [ok, d] = g();) // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{value of type 'Na' is not contextually convertible to 'bool'}} + ; + for (; auto [value] = Get();) // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} + return value; +} +} // namespace CondInFor + +struct IntegerLike { + bool flag; + float data; + operator int() const { + return int(data); + } +}; + +namespace CondInSwitch { +int h(IntegerLike x) { + switch (auto [ok, d] = x) // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} + ; + switch (auto [ok, d] = g()) // expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} expected-error {{statement requires expression of integer type ('Na' invalid)}} + ; + switch (auto [value] = Get()) {// expected-warning {{ISO C++17 does not permit structured binding declaration in a condition}} + // expected-warning@-1{{switch condition has boolean value}} + case 1: + return value; + } +} +} // namespace CondInSwitch
diff --git a/src/third_party/llvm-project/clang/test/Parser/designator.c b/src/third_party/llvm-project/clang/test/Parser/designator.c new file mode 100644 index 0000000..6badab7 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/diag-crash.c b/src/third_party/llvm-project/clang/test/Parser/diag-crash.c new file mode 100644 index 0000000..4f1265f --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/diag-crash.c
@@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// Avoid preprocessor diag crash caused by a parser diag left in flight. + +int foo: // expected-error {{expected ';' after top level declarator}} +#endif // expected-error {{#endif without #if}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/editor-placeholder-recovery.cpp b/src/third_party/llvm-project/clang/test/Parser/editor-placeholder-recovery.cpp new file mode 100644 index 0000000..d68e087 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/editor-placeholder-recovery.cpp
@@ -0,0 +1,75 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -fallow-editor-placeholders -DSUPPRESS -verify %s + +struct Struct { +public: + void method(Struct &x); +}; + +struct <#struct name#> { + int <#field-name#>; +#ifndef SUPPRESS + // expected-error@-3 {{editor placeholder in source file}} + // expected-error@-3 {{editor placeholder in source file}} +#endif +}; + +typename <#typename#>::<#name#>; +decltype(<#expression#>) foobar; +typedef <#type#> <#name#>; +#ifndef SUPPRESS + // expected-error@-4 2 {{editor placeholder in source file}} + // expected-error@-4 {{editor placeholder in source file}} + // expected-error@-4 2 {{editor placeholder in source file}} +#endif + +namespace <#identifier#> { + <#declarations#> +#ifndef SUPPRESS + // expected-error@-3 {{editor placeholder in source file}} + // expected-error@-3 {{editor placeholder in source file}} +#endif + +} + +using <#qualifier#>::<#name#>; +#ifndef SUPPRESS + // expected-error@-2 2 {{editor placeholder in source file}} +#endif + +void avoidPlaceholderErrors(Struct &obj) { + static_cast< <#type#> >(<#expression#>); + while (<#condition#>) { + <#statements#> + } + obj.method(<#Struct &x#>); +#ifndef SUPPRESS + // expected-error@-6 2 {{editor placeholder in source file}} + // expected-error@-6 {{editor placeholder in source file}} + // expected-error@-6 {{editor placeholder in source file}} + // expected-error@-5 {{editor placeholder in source file}} +#endif + switch (<#expression#>) { + case <#constant#>: + <#statements#> +#ifndef SUPPRESS + // expected-error@-4 {{editor placeholder in source file}} + // expected-error@-4 {{editor placeholder in source file}} + // expected-error@-4 {{editor placeholder in source file}} +#endif + break; + + default: + break; + } +} + +void Struct::method(<#Struct &x#>, noSupressionHere) { // expected-error {{unknown type name 'noSupressionHere'}} expected-error {{C++ requires a type specifier for all declarations}} +#ifndef SUPPRESS + // expected-error@-2 {{editor placeholder in source file}} +#endif +} + +void handleTrigraph() { + <??=placeholder#> // expected-error {{expected expression}} expected-error {{expected expression}} expected-warning {{trigraph converted to '#' character}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/empty-translation-unit.c b/src/third_party/llvm-project/clang/test/Parser/empty-translation-unit.c new file mode 100644 index 0000000..04e57f6 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/empty-translation-unit.c
@@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c99 -pedantic -W -verify %s +// RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++03 -pedantic-errors -W %s + +#include "completely-empty-header-file.h" +// no-warning -- an empty file is OK + +#define A_MACRO_IS_NOT_GOOD_ENOUGH 1 + +// In C we should get this warning, but in C++ we shouldn't. +// expected-warning{{ISO C requires a translation unit to contain at least one declaration}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/encode.m b/src/third_party/llvm-project/clang/test/Parser/encode.m new file mode 100644 index 0000000..056cee1 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/encode.m
@@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics + +int main(void) { + const char ch = @encode(char *)[0]; + char c = @encode(char *)[0] + 4; + return c; +} +
diff --git a/src/third_party/llvm-project/clang/test/Parser/enhanced-proto-1.m b/src/third_party/llvm-project/clang/test/Parser/enhanced-proto-1.m new file mode 100644 index 0000000..bad5c7c --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/enhanced-proto-1.m
@@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics + +@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/src/third_party/llvm-project/clang/test/Parser/eof.cpp b/src/third_party/llvm-project/clang/test/Parser/eof.cpp new file mode 100644 index 0000000..4a06587 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/eof.cpp
@@ -0,0 +1,13 @@ +// RUN: not %clang_cc1 %s -fsyntax-only 2>&1 | FileCheck %s + +// CHECK: error: expected '<' after 'template' +// CHECK: error: expected '}' +// CHECK: note: to match this '{' +// CHECK: error: expected ';' after class +// CHECK: error: anonymous structs and classes must be class members +// CHECK: 4 errors generated. + +// Do not add anything to the end of this file. This requires the whitespace +// plus EOF after the template keyword. + +class { template
diff --git a/src/third_party/llvm-project/clang/test/Parser/eof2.cpp b/src/third_party/llvm-project/clang/test/Parser/eof2.cpp new file mode 100644 index 0000000..6a8b862 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/eof2.cpp
@@ -0,0 +1,15 @@ +// RUN: not %clang_cc1 %s -fsyntax-only 2>&1 | FileCheck %s + +// CHECK: error: expected expression +// CHECK: error: expected member name or ';' after declaration specifiers +// CHECK: error: expected '}' +// CHECK: note: to match this '{' +// CHECK: error: expected ';' after class +// CHECK: 4 errors generated. + +// Do not add anything to the end of this file. This requires the whitespace +// plus EOF after the '<' token. + +template <typename T> +class a { + a<
diff --git a/src/third_party/llvm-project/clang/test/Parser/expressions.c b/src/third_party/llvm-project/clang/test/Parser/expressions.c new file mode 100644 index 0000000..64b4447 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/expressions.c
@@ -0,0 +1,75 @@ +// 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 ')'}} +} + +// PR16992 +struct pr16992 { int x; }; + +void func_16992 () { + int x1 = sizeof int; // expected-error {{expected parentheses around type name in sizeof expression}} + int x2 = sizeof struct pr16992; // expected-error {{expected parentheses around type name in sizeof expression}} + int x3 = __alignof int; // expected-error {{expected parentheses around type name in __alignof expression}} + int x4 = _Alignof int; // expected-error {{expected parentheses around type name in _Alignof expression}} +} + +void callee(double, double); +void test8() { + callee(foobar, // expected-error {{use of undeclared identifier 'foobar'}} + fizbin); // expected-error {{use of undeclared identifier 'fizbin'}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/expressions.m b/src/third_party/llvm-project/clang/test/Parser/expressions.m new file mode 100644 index 0000000..1f1005a --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/extension.c b/src/third_party/llvm-project/clang/test/Parser/extension.c new file mode 100644 index 0000000..fd4cf80 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/extra-semi.cpp b/src/third_party/llvm-project/clang/test/Parser/extra-semi.cpp new file mode 100644 index 0000000..7287f85 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/extra-semi.cpp
@@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: cp %s %t.cpp +// RUN: not %clang_cc1 -fsyntax-only %t.cpp -fixit +// RUN: %clang_cc1 -fsyntax-only %t.cpp + +void test1(int a;) { // expected-error{{unexpected ';' before ')'}} + while (a > 5;) {} // expected-error{{unexpected ';' before ')'}} + for (int c = 0; c < 21; ++c;) {} // expected-error{{unexpected ';' before ')'}} + int d = int(3 + 4;); // expected-error{{unexpected ';' before ')'}} + int e[5;]; // expected-error{{unexpected ';' before ']'}} + e[a+1;] = 4; // expected-error{{unexpected ';' before ']'}} + int f[] = {1,2,3;}; // expected-error{{unexpected ';' before '}'}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/for.cpp b/src/third_party/llvm-project/clang/test/Parser/for.cpp new file mode 100644 index 0000000..e413839 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/function-decls.c b/src/third_party/llvm-project/clang/test/Parser/function-decls.c new file mode 100644 index 0000000..db9a98b --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/gcc-__final-compatibility.cpp b/src/third_party/llvm-project/clang/test/Parser/gcc-__final-compatibility.cpp new file mode 100644 index 0000000..ddd14ba --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/gcc-__final-compatibility.cpp
@@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -std=c++98 -fgnu-keywords -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fgnu-keywords -fsyntax-only -verify %s + +struct B { + virtual void g(); +}; +struct D __final : B { // expected-warning {{__final is a GNU extension, consider using C++11 final}} + virtual void g() __final; // expected-warning {{__final is a GNU extension, consider using C++11 final}} +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/gcc-for-loop-init-compatibility.c b/src/third_party/llvm-project/clang/test/Parser/gcc-for-loop-init-compatibility.c new file mode 100644 index 0000000..dc88f08 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/gcc-for-loop-init-compatibility.c
@@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -std=c89 -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=gnu89 -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c99 -fsyntax-only -verify %s -DC99 + +#ifdef C99 +// expected-no-diagnostics +#endif + +void foo() { +#ifndef C99 + // expected-warning@+2{{GCC does not allow variable declarations in for loop initializers before C99}} +#endif + for (int i = 0; i < 10; i++) + ; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/goto.c b/src/third_party/llvm-project/clang/test/Parser/goto.c new file mode 100644 index 0000000..a3e0117 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/if-scope-c90.c b/src/third_party/llvm-project/clang/test/Parser/if-scope-c90.c new file mode 100644 index 0000000..61119ea --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/if-scope-c90.c
@@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c90 %s +// expected-no-diagnostics + +int f (int z) +{ + if (z > (int) sizeof (enum {a, b})) + return a; + return b; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/if-scope-c99.c b/src/third_party/llvm-project/clang/test/Parser/if-scope-c99.c new file mode 100644 index 0000000..63f82e0 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/implicit-casts.c b/src/third_party/llvm-project/clang/test/Parser/implicit-casts.c new file mode 100644 index 0000000..a2b31f9 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/knr_parameter_attributes.c b/src/third_party/llvm-project/clang/test/Parser/knr_parameter_attributes.c new file mode 100644 index 0000000..b11a75e --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/knr_parameter_attributes.c
@@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -fsyntax-only -W -Wall -Werror -verify %s +// expected-no-diagnostics + +int f(int i __attribute__((__unused__))) +{ + return 0; +} +int g(i) + int i __attribute__((__unused__)); +{ + return 0; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/lambda-attr.cu b/src/third_party/llvm-project/clang/test/Parser/lambda-attr.cu new file mode 100644 index 0000000..d5aaf01 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/lambda-attr.cu
@@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcuda-is-device -verify %s + +__attribute__((device)) void device_fn() {} +__attribute__((host, device)) void hd_fn() {} + +__attribute__((device)) void device_attr() { + ([]() __attribute__((device)) { device_fn(); })(); + // expected-warning@-1 {{nvcc does not allow '__device__' to appear after '()' in lambdas}} + ([] __attribute__((device)) () { device_fn(); })(); + ([] __attribute__((device)) { device_fn(); })(); + + ([&]() __attribute__((device)){ device_fn(); })(); + // expected-warning@-1 {{nvcc does not allow '__device__' to appear after '()' in lambdas}} + ([&] __attribute__((device)) () { device_fn(); })(); + ([&] __attribute__((device)) { device_fn(); })(); + + ([&](int) __attribute__((device)){ device_fn(); })(0); + // expected-warning@-1 {{nvcc does not allow '__device__' to appear after '()' in lambdas}} + ([&] __attribute__((device)) (int) { device_fn(); })(0); +} + +__attribute__((host)) __attribute__((device)) void host_device_attrs() { + ([]() __attribute__((host)) __attribute__((device)){ hd_fn(); })(); + // expected-warning@-1 {{nvcc does not allow '__host__' to appear after '()' in lambdas}} + // expected-warning@-2 {{nvcc does not allow '__device__' to appear after '()' in lambdas}} + ([] __attribute__((host)) __attribute__((device)) () { hd_fn(); })(); + ([] __attribute__((host)) __attribute__((device)) { hd_fn(); })(); + + ([&]() __attribute__((host)) __attribute__((device)){ hd_fn(); })(); + // expected-warning@-1 {{nvcc does not allow '__host__' to appear after '()' in lambdas}} + // expected-warning@-2 {{nvcc does not allow '__device__' to appear after '()' in lambdas}} + ([&] __attribute__((host)) __attribute__((device)) () { hd_fn(); })(); + ([&] __attribute__((host)) __attribute__((device)) { hd_fn(); })(); + + ([&](int) __attribute__((host)) __attribute__((device)){ hd_fn(); })(0); + // expected-warning@-1 {{nvcc does not allow '__host__' to appear after '()' in lambdas}} + // expected-warning@-2 {{nvcc does not allow '__device__' to appear after '()' in lambdas}} + ([&] __attribute__((host)) __attribute__((device)) (int) { hd_fn(); })(0); +} + +// TODO: Add tests for __attribute__((global)) once we support global lambdas.
diff --git a/src/third_party/llvm-project/clang/test/Parser/method-def-in-class.m b/src/third_party/llvm-project/clang/test/Parser/method-def-in-class.m new file mode 100644 index 0000000..476ab9b --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/method-prototype-1.m b/src/third_party/llvm-project/clang/test/Parser/method-prototype-1.m new file mode 100644 index 0000000..a32bc2e --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/missing-closing-rbrace.m b/src/third_party/llvm-project/clang/test/Parser/missing-closing-rbrace.m new file mode 100644 index 0000000..d811421 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/missing-closing-rbrace.m
@@ -0,0 +1,3 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// rdar: //6854840 +@interface A {@end // expected-error {{'@end' appears where closing brace '}' is expected}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/missing-end-2.m b/src/third_party/llvm-project/clang/test/Parser/missing-end-2.m new file mode 100644 index 0000000..e89f28e --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/missing-end-3.m b/src/third_party/llvm-project/clang/test/Parser/missing-end-3.m new file mode 100644 index 0000000..4875ecd --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/missing-end-4.m b/src/third_party/llvm-project/clang/test/Parser/missing-end-4.m new file mode 100644 index 0000000..8a96e64 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/missing-end.m b/src/third_party/llvm-project/clang/test/Parser/missing-end.m new file mode 100644 index 0000000..d66ea64 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/missing-selector-name.mm b/src/third_party/llvm-project/clang/test/Parser/missing-selector-name.mm new file mode 100644 index 0000000..d5554c5 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/missing-selector-name.mm
@@ -0,0 +1,52 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s +// rdar://11939584 + +@interface PodiumWalkerController +@property (assign) id PROP; +- (void) // expected-error {{expected ';' after method prototype}} +@end // expected-error {{expected selector for Objective-C method}} + + +id GVAR; + +id StopProgressAnimation() +{ + + PodiumWalkerController *controller; + return controller.PROP; +} + +@interface P1 +@property (assign) id PROP; +- (void); // expected-error {{expected selector for Objective-C method}} +@end + +id GG=0; + +id Stop1() +{ + + PodiumWalkerController *controller; + return controller.PROP; +} + +@interface P2 +@property (assign) id PROP; +- (void)Meth {} // expected-error {{expected ';' after method prototype}} +@end + +@interface P3 +@property (assign) id PROP; +- (void) +- (void)Meth {} // expected-error {{expected selector for Objective-C method}} \ + // expected-error {{expected ';' after method prototype}} +@end + +id HH=0; + +id Stop2() +{ + + PodiumWalkerController *controller; + return controller.PROP; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/ms-anachronism.c b/src/third_party/llvm-project/clang/test/Parser/ms-anachronism.c new file mode 100644 index 0000000..3767639 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/ms-anachronism.c
@@ -0,0 +1,3 @@ +// RUN: %clang_cc1 -triple i686-windows-msvc -fms-extensions -fsyntax-only -verify %s + +struct {} __cdecl s; // expected-warning {{'__cdecl' only applies to function types; type here is 'struct}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/ms-if-exists.c b/src/third_party/llvm-project/clang/test/Parser/ms-if-exists.c new file mode 100644 index 0000000..7dd2054 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/ms-if-exists.c
@@ -0,0 +1,87 @@ +// RUN: %clang_cc1 %s -fsyntax-only -Wmicrosoft -verify -fms-extensions +// expected-no-diagnostics + +struct Type { +}; + +void test_if_exists_stmts() { + int b = 0; + __if_exists(Type) { + b++; + b++; + } + __if_exists(Type_not) { + this will not compile. + } + __if_not_exists(Type) { + this will not compile. + } + __if_not_exists(Type_not) { + b++; + b++; + } +} + +int if_exists_creates_no_scope() { + __if_exists(Type) { + int x; // 'x' is declared in the parent scope. + } + __if_not_exists(Type_not) { + x++; + } + return x; +} + +__if_exists(Type) { + int var23; +} + +__if_exists(Type_not) { + this will not compile. +} + +__if_not_exists(Type) { + this will not compile. +} + +__if_not_exists(Type_not) { + int var244; +} + +void test_if_exists_init_list() { + + int array1[] = { + 0, + __if_exists(Type) {2, } + 3 + }; + + int array2[] = { + 0, + __if_exists(Type_not) { this will not compile } + 3 + }; + + int array3[] = { + 0, + __if_not_exists(Type_not) {2, } + 3 + }; + + int array4[] = { + 0, + __if_not_exists(Type) { this will not compile } + 3 + }; + +} + + +void test_nested_if_exists() { + __if_exists(Type) { + int x = 42; + __if_not_exists(Type_not) { + x++; + } + } +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/ms-if-exists.cpp b/src/third_party/llvm-project/clang/test/Parser/ms-if-exists.cpp new file mode 100644 index 0000000..79cc571 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/ms-if-exists.cpp
@@ -0,0 +1,117 @@ +// RUN: %clang_cc1 %s -std=c++11 -fsyntax-only -Wmicrosoft -verify -fms-extensions + +class MayExist { +private: + typedef int Type; +}; + +void test_if_exists_stmts() { + int b = 0; + __if_exists(MayExist::Type) { + b++; + b++; + } + __if_exists(MayExist::Type_not) { + this will not compile. + } + __if_not_exists(MayExist::Type) { + this will not compile. + } + __if_not_exists(MayExist::Type_not) { + b++; + b++; + } +} + +int if_exists_creates_no_scope() { + __if_exists(MayExist::Type) { + int x; // 'x' is declared in the parent scope. + } + __if_not_exists(MayExist::Type_not) { + x++; + } + return x; +} + +__if_exists(MayExist::Type) { + int var23; +} + +__if_exists(MayExist::Type_not) { + this will not compile. +} + +__if_not_exists(MayExist::Type) { + this will not compile. +} + +__if_not_exists(MayExist::Type_not) { + int var244; +} + +void test_if_exists_init_list() { + + int array1[] = { + 0, + __if_exists(MayExist::Type) {2, } + 3 + }; + + int array2[] = { + 0, + __if_exists(MayExist::Type_not) { this will not compile } + 3 + }; + + int array3[] = { + 0, + __if_not_exists(MayExist::Type_not) {2, } + 3 + }; + + int array4[] = { + 0, + __if_not_exists(MayExist::Type) { this will not compile } + 3 + }; + +} + + +class IfExistsClassScope { + __if_exists(MayExist::Type) { + // __if_exists, __if_not_exists can nest + __if_not_exists(MayExist::Type_not) { + int var123; + } + int var23; + } + + __if_exists(MayExist::Type_not) { + this will not compile. + } + + __if_not_exists(MayExist::Type) { + this will not compile. + } + + __if_not_exists(MayExist::Type_not) { + int var244; + } +}; + +void test_nested_if_exists() { + __if_exists(MayExist::Type) { + int x = 42; + __if_not_exists(MayExist::Type_not) { + x++; + } + } +} + +void test_attribute_on_if_exists() { + [[clang::fallthrough]] // expected-error {{an attribute list cannot appear here}} + __if_exists(MayExist::Type) { + int x; + } +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/ms-inline-asm-nested-braces.c b/src/third_party/llvm-project/clang/test/Parser/ms-inline-asm-nested-braces.c new file mode 100644 index 0000000..58b055b --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/ms-inline-asm-nested-braces.c
@@ -0,0 +1,9 @@ +// REQUIRES: x86-registered-target +// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks + +int t_fail() { // expected-note {{to match this}} + __asm + { // expected-note {{to match this}} + { // expected-note {{to match this}} + { + } // expected-error 3 {{expected}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/ms-inline-asm.c b/src/third_party/llvm-project/clang/test/Parser/ms-inline-asm.c new file mode 100644 index 0000000..0170b2b --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/ms-inline-asm.c
@@ -0,0 +1,62 @@ +// REQUIRES: x86-registered-target +// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks +// Disabling gnu inline assembly should have no effect on this testcase +// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks -fno-gnu-inline-asm + +#define M __asm int 0x2c +#define M2 int + +void t1(void) { M } +void t2(void) { __asm int 2ch } +void t3(void) { __asm M2 2ch } +void t4(void) { __asm mov eax, fs:[10h] } +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; +} +void t7() { + __asm { + push ebx + mov ebx, 07h + pop ebx + } +} +void t8() { + __asm nop __asm nop __asm nop +} +void t9() { + __asm nop __asm nop ; __asm nop +} +void t10() { + __asm { + mov eax, 0 + __asm { + mov eax, 1 + { + mov eax, 2 + } + } + } +} +void t11() { + do { __asm mov eax, 0 __asm { __asm mov edx, 1 } } while(0); +} +void t12() { + __asm jmp label // expected-error {{use of undeclared label 'label'}} +} +void t13() { + __asm m{o}v eax, ebx // expected-error {{unknown token in expression}} +} + +int t_fail() { // expected-note {{to match this}} + __asm + __asm { // expected-error 3 {{expected}} expected-note {{to match this}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/ms-seh.c b/src/third_party/llvm-project/clang/test/Parser/ms-seh.c new file mode 100644 index 0000000..68c2e30 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/ms-seh.c
@@ -0,0 +1,24 @@ +// RUN: %clang_cc1 %s -fsyntax-only -Wmicrosoft -verify -fms-extensions + +void f() { + int a; + + __try a; // expected-error {{expected '{'}} expected-warning {{expression result unused}} + + __try { + } +} // expected-error {{expected '__except' or '__finally' block}} + +void g() { + int a; + + __try { + } __except(1) a; // expected-error {{expected '{'}} expected-warning {{expression result unused}} +} + +void h() { + int a; + + __try { + } __finally a; // expected-error {{expected '{'}} expected-warning {{expression result unused}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/ms-square-bracket-attributes.mm b/src/third_party/llvm-project/clang/test/Parser/ms-square-bracket-attributes.mm new file mode 100644 index 0000000..c1fc14c --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/ms-square-bracket-attributes.mm
@@ -0,0 +1,174 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++14 -verify -fms-extensions %s -Wno-deprecated-declarations + +typedef struct _GUID { + unsigned long Data1; + unsigned short Data2; + unsigned short Data3; + unsigned char Data4[8]; +} GUID; + +namespace { +// cl.exe supports [] attributes on decls like so: +[uuid( "000000A0-0000-0000-C000-000000000049" )] struct struct_with_uuid; + +// Optionally, the uuid can be surrounded by one set of braces. +[uuid( + "{000000A0-0000-0000-C000-000000000049}" +)] struct struct_with_uuid_brace; + +// uuids must be ascii string literals. +// expected-error@+1 {{uuid attribute contains a malformed GUID}} +[uuid(u8"000000A0-0000-0000-C000-000000000049")] struct struct_with_uuid_u8; +// expected-error@+1 {{uuid attribute contains a malformed GUID}} +[uuid(L"000000A0-0000-0000-C000-000000000049")] struct struct_with_uuid_L; + +// cl.exe doesn't allow raw string literals in []-style attributes, but does +// allow it for __declspec(uuid()) (u8 literals etc are not allowed there +// either). Since raw string literals not being allowed seems like an +// implementation artifact in cl and not allowing them makes the parse code +// a bit unnatural, do allow this. +[uuid(R"(000000A0-0000-0000-C000-000000000049)")] struct struct_with_uuid_raw; + +// Likewise, cl supports UCNs in declspec uuid, but not in []-style uuid. +// clang-cl allows them in both. +[uuid("000000A0-0000\u002D0000-C000-000000000049")] struct struct_with_uuid_ucn; + +// cl doesn't allow string concatenation in []-style attributes, for no good +// reason. clang-cl allows them. +[uuid("000000A0-00" "00-0000-C000-000000000049")] struct struct_with_uuid_split; + +// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} +[uuid("{000000A0-0000-0000-C000-000000000049}", "1")] struct S {}; +// expected-error@+1 {{expected '('}} +[uuid{"000000A0-0000-0000-C000-000000000049"}] struct T {}; +// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} +[uuid("000000A0-0000-0000-C000-000000000049"}] struct U {}; + + +// In addition to uuids in string literals, cl also allows uuids that are not +// in a string literal, only delimited by (). The contents of () are almost +// treated like a literal (spaces there aren't ignored), but macro substitution, +// \ newline escapes, and so on are performed. + +[ uuid (000000A0-0000-0000-C000-000000000049) ] struct struct_with_uuid2; +[uuid({000000A0-0000-0000-C000-000000000049})] struct struct_with_uuid2_brace; + +// The non-quoted form doesn't allow any whitespace inside the parens: +// expected-error@+1 {{uuid attribute contains a malformed GUID}} +[uuid( 000000A0-0000-0000-C000-000000000049)] struct struct_with_uuid2; +// expected-error@+1 {{uuid attribute contains a malformed GUID}} +[uuid(000000A0-0000 -0000-C000-000000000049)] struct struct_with_uuid2; +// expected-error@+2 {{uuid attribute contains a malformed GUID}} +[uuid(000000A0-0000 +-0000-C000-000000000049)] struct struct_with_uuid2; +// expected-error@+1 {{uuid attribute contains a malformed GUID}} +[uuid(000000A0-0000/**/-0000-C000-000000000049)] struct struct_with_uuid2; +// expected-error@+1 {{uuid attribute contains a malformed GUID}} +[uuid(000000A0-0000-0000-C000-000000000049 )] struct struct_with_uuid2; +// expected-error@+2 {{uuid attribute contains a malformed GUID}} +[uuid(000000A0-0000-0000-C000-000000000049 +) +] struct struct_with_uuid2; +// expected-error@+1 {{uuid attribute contains a malformed GUID}} +[uuid({000000A0-0000-""0000-C000-000000000049})] struct struct_with_uuid2; + +// Line continuations and macro substitution are fine though: +[uuid(000000A0-0000-0000-\ +C000-000000000049)] struct struct_with_uuid2_cont; +#define UUID 000000A0-0000-0000-C000-000000000049 +#define UUID_PART 000000A0-0000 +[uuid(UUID)] struct struct_with_uuid2_macro; +[uuid(UUID_PART-0000-C000-000000000049)] struct struct_with_uuid2_macro_part; + +// Both cl and clang-cl accept trigraphs here (with /Zc:trigraphs, off by +// default) +// expected-warning@+1 2{{trigraph converted}} +[uuid(??<000000A0-0000-0000-C000-000000000049??>)] +struct struct_with_uuid2_trigraph; + +// UCNs cannot be used in this form because they're prohibited by C99. +// expected-error@+1 {{character '-' cannot be specified by a universal character name}} +[uuid(000000A0-0000\u002D0000-C000-000000000049)] struct struct_with_uuid2_ucn; + +// Invalid digits. +// expected-error@+1 {{uuid attribute contains a malformed GUID}} +[uuid(0Z0000A0-0000-0000-C000-000000000049)] struct struct_with_uuid2; + +struct OuterClass { + // [] uuids and inner classes are weird in cl.exe: It warns that uuid on + // nested types has undefined behavior, and errors out __uuidof() claiming + // that the inner type has no assigned uuid. Things work fine if __declspec() + // is used instead. clang-cl handles this fine. + [uuid(10000000-0000-0000-0000-000000000000)] class InnerClass1; + [uuid(10000000-0000-0000-0000-000000000000)] class InnerClass2 {} ic; + [uuid(10000000-0000-0000-0000-000000000000)] static class InnerClass3 {} sic; + // Putting `static` in front of [...] causes parse errors in both cl and clang + + // This is the only syntax to declare an inner class with []-style attributes + // that works in cl: Declare the inner class without an attribute, and then + // have the []-style attribute on the definition. + class InnerClass; +}; +[uuid(10000000-0000-0000-0000-000000000000)] class OuterClass::InnerClass {}; + +void use_it() { + (void)__uuidof(struct_with_uuid); + (void)__uuidof(struct_with_uuid_brace); + (void)__uuidof(struct_with_uuid_raw); + (void)__uuidof(struct_with_uuid_ucn); + (void)__uuidof(struct_with_uuid_split); + + (void)__uuidof(struct_with_uuid2); + (void)__uuidof(struct_with_uuid2_brace); + (void)__uuidof(struct_with_uuid2_cont); + (void)__uuidof(struct_with_uuid2_macro); + (void)__uuidof(struct_with_uuid2_macro_part); + (void)__uuidof(struct_with_uuid2_trigraph); + + (void)__uuidof(OuterClass::InnerClass); + (void)__uuidof(OuterClass::InnerClass1); + (void)__uuidof(OuterClass::InnerClass2); + (void)__uuidof(OuterClass::InnerClass3); + (void)__uuidof(OuterClass().ic); + (void)__uuidof(OuterClass::sic); +} + +// expected-warning@+1 {{'uuid' attribute only applies to structs, unions, classes, and enums}} +[uuid("000000A0-0000-0000-C000-000000000049")] void f(); +} + +// clang supports these on toplevel decls, but not on local decls since this +// syntax is ambiguous with lambdas and Objective-C message send expressions. +// This file documents clang's shortcomings and lists a few constructs that +// one has to keep in mind when trying to fix this. System headers only seem +// to use these attributes on toplevel decls, so supporting this is not very +// important. + +void local_class() { + // FIXME: MSVC accepts, but we reject due to ambiguity. + // expected-error@+1 {{expected body of lambda expression}} + [uuid("a5a7bd07-3b14-49bc-9399-de066d4d72cd")] struct Local { + int x; + }; +} + +void useit(int); +int lambda() { + int uuid = 42; + [uuid]() { useit(uuid); }(); + + // C++14 lambda init captures: + [uuid(00000000-0000-0000-0000-000000000000)] { return uuid; }(); + [uuid("00000000-0000-0000-0000-000000000000")](int n) { return uuid[n]; }(3); +} + +@interface NSObject +- (void)retain; +@end +int message_send(id uuid) { + [uuid retain]; +} +NSObject* uuid(const char*); +int message_send2() { + [uuid("a5a7bd07-3b14-49bc-9399-de066d4d72cd") retain]; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/namelookup-bug-1.c b/src/third_party/llvm-project/clang/test/Parser/namelookup-bug-1.c new file mode 100644 index 0000000..31d17a9 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/namelookup-bug-1.c
@@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -verify %s +// expected-no-diagnostics + +typedef int Object; + +struct Object *pp; + +Object staticObject1;
diff --git a/src/third_party/llvm-project/clang/test/Parser/namelookup-bug-2.c b/src/third_party/llvm-project/clang/test/Parser/namelookup-bug-2.c new file mode 100644 index 0000000..4598da0 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/namelookup-bug-2.c
@@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -verify %s +// expected-no-diagnostics + +typedef int Object; + +struct Object {int i1; } *P; + +void foo() { + struct Object { int i2; } *X; + Object: + { + Object a; + } +} +
diff --git a/src/third_party/llvm-project/clang/test/Parser/namespace-alias-attr.cpp b/src/third_party/llvm-project/clang/test/Parser/namespace-alias-attr.cpp new file mode 100644 index 0000000..0baba84 --- /dev/null +++ b/src/third_party/llvm-project/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 cannot be specified on namespace alias}} +
diff --git a/src/third_party/llvm-project/clang/test/Parser/namespaces.cpp b/src/third_party/llvm-project/clang/test/Parser/namespaces.cpp new file mode 100644 index 0000000..25ff73b --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/namespaces.cpp
@@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -std=c++11 -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}} +} + +// PR14085 +namespace PR14085 {} +namespace = PR14085; // expected-error {{expected identifier}} + +struct namespace_nested_in_record { + int k = ({namespace {}}); // expected-error {{statement expression not allowed at file scope}} +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/no-gnu-inline-asm.c b/src/third_party/llvm-project/clang/test/Parser/no-gnu-inline-asm.c new file mode 100644 index 0000000..03c2ede --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/no-gnu-inline-asm.c
@@ -0,0 +1,15 @@ +// RUN: %clang_cc1 %s -triple i686-apple-darwin -verify -fsyntax-only -fno-gnu-inline-asm + +asm ("INST r1, 0"); // expected-error {{GNU-style inline assembly is disabled}} + +void foo() __asm("__foo_func"); // AsmLabel is OK +int foo1 asm("bar1") = 0; // OK + +asm(" "); // Whitespace is OK + +void f (void) { + long long foo = 0, bar; + asm volatile("INST %0, %1" : "=r"(foo) : "r"(bar)); // expected-error {{GNU-style inline assembly is disabled}} + asm (""); // Empty is OK + return; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/nullability.c b/src/third_party/llvm-project/clang/test/Parser/nullability.c new file mode 100644 index 0000000..d70087d --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/nullability.c
@@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c99 -Wno-nullability-declspec -pedantic %s -verify + +_Nonnull int *ptr; // expected-warning{{type nullability specifier '_Nonnull' is a Clang extension}} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnullability-extension" +_Nonnull int *ptr2; // no-warning +#pragma clang diagnostic pop + +#if !__has_feature(nullability) +# error Nullability should always be supported +#endif + +#if !__has_feature(nullability_on_arrays) +# error Nullability on array parameters should always be supported +#endif + +#if !__has_extension(nullability) +# error Nullability should always be supported as an extension +#endif + +#if !__has_extension(nullability_on_arrays) +# error Nullability on array parameters should always be supported as an extension +#endif
diff --git a/src/third_party/llvm-project/clang/test/Parser/objc-alias-printing.m b/src/third_party/llvm-project/clang/test/Parser/objc-alias-printing.m new file mode 100644 index 0000000..8b9cc6e --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/objc-at-directive-fixit.m b/src/third_party/llvm-project/clang/test/Parser/objc-at-directive-fixit.m new file mode 100644 index 0000000..dcf695d --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objc-at-directive-fixit.m
@@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.10.0 -verify -fobjc-exceptions %s +// RUN: not %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.10.0 -fdiagnostics-parseable-fixits -fobjc-exceptions %s 2>&1 | FileCheck %s + +// rdar://19669565 + +void bar(int x); + +void f() { + @try { } + @finally { } + @autoreleasepool { } + + // Provide a fixit when we are parsing a standalone statement + @tr { }; // expected-error {{unexpected '@' in program}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:4-[[@LINE-1]]:6}:"try" + @finaly { }; // expected-error {{unexpected '@' in program}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:4-[[@LINE-1]]:10}:"finally" + @autorelpool { }; // expected-error {{unexpected '@' in program}} + // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:4-[[@LINE-1]]:15}:"autoreleasepool" + + // Ensure that no fixit is given when parsing expressions + // CHECK-NOT: fix-it + id thing = @autoreleasepool { }; // expected-error {{unexpected '@' in program}} + (void)@tr { }; // expected-error {{unexpected '@' in program}} + bar(@final { }); // expected-error {{unexpected '@' in program}} + for(@auto;;) { } // expected-error {{unexpected '@' in program}} + [@try]; // expected-error {{unexpected '@' in program}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/objc-at-implementation-eof-crash.m b/src/third_party/llvm-project/clang/test/Parser/objc-at-implementation-eof-crash.m new file mode 100644 index 0000000..76e56c1 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objc-at-implementation-eof-crash.m
@@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -verify -Wno-objc-root-class %s + +@interface ClassA + +- (void)fileExistsAtPath:(int)x; + +@end + +@interface ClassB + +@end + +@implementation ClassB // expected-note {{implementation started here}} + +- (void) method:(ClassA *)mgr { // expected-note {{to match this '{'}} + [mgr fileExistsAtPath:0 +} // expected-error {{expected ']'}} + +@implementation ClassC // \ + // expected-error {{missing '@end'}} \ + // expected-error {{expected '}'}} \ + // expected-warning {{cannot find interface declaration for 'ClassC'}} + +@end
diff --git a/src/third_party/llvm-project/clang/test/Parser/objc-at-interface-eof-crash.m b/src/third_party/llvm-project/clang/test/Parser/objc-at-interface-eof-crash.m new file mode 100644 index 0000000..2c7bfd6 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objc-at-interface-eof-crash.m
@@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -verify -Wno-objc-root-class %s + +@interface ClassA + +- (void)fileExistsAtPath:(int)x; + +@end + +@interface ClassB + +@end + +@implementation ClassB // expected-note {{implementation started here}} + +- (void) method:(ClassA *)mgr { // expected-note {{to match this '{'}} + [mgr fileExistsAtPath:0 +} // expected-error {{expected ']'}} + +@interface ClassC // \ + // expected-error {{missing '@end'}} \ + // expected-error {{expected '}'}} + +@end
diff --git a/src/third_party/llvm-project/clang/test/Parser/objc-attr.m b/src/third_party/llvm-project/clang/test/Parser/objc-attr.m new file mode 100644 index 0000000..7e65eff --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objc-attr.m
@@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -fsyntax-only -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 -verify %s +// expected-no-diagnostics + +@interface NSObject +@end + +[[clang::objc_exception]] +@interface Foo { + [[clang::iboutlet]] NSObject *h; +} +@property (readonly) [[clang::objc_returns_inner_pointer]] void *i, *j; +@property (readonly) [[clang::iboutlet]] NSObject *k; +@end + +[[clang::objc_runtime_name("name")]] @protocol Bar; + +[[clang::objc_protocol_requires_explicit_implementation]] +@protocol Baz +@end + +@interface Quux +-(void)g1 [[clang::ns_consumes_self]]; +-(void)g2 __attribute__((ns_consumes_self)); +-(void)h1: (int)x [[clang::ns_consumes_self]]; +-(void)h2: (int)x __attribute__((ns_consumes_self)); +-(void) [[clang::ns_consumes_self]] i1; +-(void) __attribute__((ns_consumes_self)) i2; +@end
diff --git a/src/third_party/llvm-project/clang/test/Parser/objc-available.m b/src/third_party/llvm-project/clang/test/Parser/objc-available.m new file mode 100644 index 0000000..01d59f8 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objc-available.m
@@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -fsyntax-only -Wunguarded-availability -Wno-unsupported-availability-guard -triple x86_64-apple-macosx10.10.0 -verify %s + +void f() { + + if (@available(macos 10.12, *)) {} + else if (@available(macos 10.11, *)) {} + else {} + + (void)__builtin_available(ios 8, macos 10.10, *); + + (void)@available(macos 10.11); // expected-error{{must handle potential future platforms with '*'}} + (void)@available(macos 10.11, macos 10.11, *); // expected-error{{version for 'macos' already specified}} + + (void)@available(erik_os 10.11, *); // expected-error{{unrecognized platform name erik_os}} + + (void)@available(erik_os 10.10, hat_os 1.0, *); // expected-error 2 {{unrecognized platform name}} + + (void)@available(); // expected-error{{expected a platform name here}} + (void)@available(macos 10.10,); // expected-error{{expected a platform name here}} + (void)@available(macos); // expected-error{{expected a version}} + (void)@available; // expected-error{{expected '('}} +} + +void prettyPlatformNames() { + (void)@available(iOS 8, tvOS 10, watchOS 3, macOS 10.11, *); + (void)__builtin_available(iOSApplicationExtension 8, tvOSApplicationExtension 10, + watchOSApplicationExtension 3, macOSApplicationExtension 10.11, *); +} + +#if __has_builtin(__builtin_available) +#error expected +// expected-error@-1 {{expected}} +#endif
diff --git a/src/third_party/llvm-project/clang/test/Parser/objc-boxing.m b/src/third_party/llvm-project/clang/test/Parser/objc-boxing.m new file mode 100644 index 0000000..a6bb024 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objc-boxing.m
@@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +@interface NSString @end + +@interface NSString (NSStringExtensionMethods) ++ (id)stringWithUTF8String:(const char *)nullTerminatedCString; +@end + +extern char *strdup(const char *str); + +id constant_string() { + return @("boxed constant string."); +} + +id dynamic_string() { + return @(strdup("boxed dynamic string")); +} + +id const_char_pointer() { + return @((const char *)"constant character pointer"); +} + +id missing_parentheses() { + return @(5; // expected-error {{expected ')'}} \ + // expected-note {{to match this '('}} +} + +// rdar://10679157 +void bar(id p); +void foo(id p) { + bar(@{p, p}); // expected-error {{expected ':'}} + bar(0); + bar(0); +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/objc-category-neg-1.m b/src/third_party/llvm-project/clang/test/Parser/objc-category-neg-1.m new file mode 100644 index 0000000..4aa8bae --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/objc-class-property.m b/src/third_party/llvm-project/clang/test/Parser/objc-class-property.m new file mode 100644 index 0000000..e4c3b07 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objc-class-property.m
@@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics + +@interface Root +-(id) alloc; +-(id) init; +@end + +@interface A : Root { + int x; + int z; +} +@property int x; +@property int y; +@property int z; +@property(readonly) int ro, ro2; +@property (class) int c; +@end + +@implementation A +@dynamic x; +@synthesize z; +@dynamic c; +@end + +int test() { + A *a = [[A alloc] init]; + return a.x; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/objc-cxx-keyword-identifiers.mm b/src/third_party/llvm-project/clang/test/Parser/objc-cxx-keyword-identifiers.mm new file mode 100644 index 0000000..6791f0d --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objc-cxx-keyword-identifiers.mm
@@ -0,0 +1,62 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wno-objc-root-class -Wno-incomplete-implementation -triple x86_64-apple-macosx10.10.0 -verify %s + +// rdar://20626062 + +struct S { + int throw; // expected-error {{expected member name or ';' after declaration specifiers; 'throw' is a keyword in Objective-C++}} +}; + +@interface class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}} +@end + +@interface Bar: class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}} +@end + +@protocol P // ok +@end + +@protocol new // expected-error {{expected identifier; 'new' is a keyword in Objective-C++}} +@end + +@protocol P2, delete; // expected-error {{expected identifier; 'delete' is a keyword in Objective-C++}} + +@class Foo, try; // expected-error {{expected identifier; 'try' is a keyword in Objective-C++}} + +@interface Foo + +@property (readwrite, nonatomic) int a, b, throw; // expected-error {{expected member name or ';' after declaration specifiers; 'throw' is a keyword in Objective-C++}} + +-foo:(int)class; // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}} ++foo:(int)constexpr; // expected-error {{expected identifier; 'constexpr' is a keyword in Objective-C++}} + +@end + +@interface Foo () <P, new> // expected-error {{expected identifier; 'new' is a keyword in Objective-C++}} +@end + +@implementation Foo + +@synthesize a = _a; // ok +@synthesize b = virtual; // expected-error {{expected identifier; 'virtual' is a keyword in Objective-C++}} + +@dynamic throw; // expected-error {{expected identifier; 'throw' is a keyword in Objective-C++}} + +-foo:(int)class { // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}} +} + +@end + +@implementation class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}} +@end + +@implementation Bar: class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}} +@end + +@compatibility_alias C Foo; // ok +@compatibility_alias const_cast Bar; // expected-error {{expected identifier; 'const_cast' is a keyword in Objective-C++}} +@compatibility_alias C2 class; // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}} + +void func() { + (void)@protocol(P); // ok + (void)@protocol(delete); // expected-error {{expected identifier; 'delete' is a keyword in Objective-C++}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/objc-default-ctor-init.mm b/src/third_party/llvm-project/clang/test/Parser/objc-default-ctor-init.mm new file mode 100644 index 0000000..a14a243 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objc-default-ctor-init.mm
@@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -std=c++11 -ast-dump %s | FileCheck %s +// CHECK: CXXCtorInitializer Field {{.*}} 'ptr' 'void *' +// CHECK: CXXCtorInitializer Field {{.*}} 'q' 'Q' + +@interface NSObject +@end + +@interface I : NSObject +@end + +struct Q { Q(); }; + +struct S { + S(); + void *ptr = nullptr; + Q q; +}; + +@implementation I +S::S() {} +@end
diff --git a/src/third_party/llvm-project/clang/test/Parser/objc-diag-width.mm b/src/third_party/llvm-project/clang/test/Parser/objc-diag-width.mm new file mode 100644 index 0000000..eba7a84 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objc-diag-width.mm
@@ -0,0 +1,8 @@ +// RUN: not %clang_cc1 %s 2>&1 | FileCheck %s + +// Just shouldn't crash. -verify suppresses the crash, so don't use it. +// PR13417 +// CHECK-NOT: Assertion failed +@interface ExtensionActionContextMenu @end +@implementation ExtensionActionContextMenu +namespace {
diff --git a/src/third_party/llvm-project/clang/test/Parser/objc-error-qualified-implementation.m b/src/third_party/llvm-project/clang/test/Parser/objc-error-qualified-implementation.m new file mode 100644 index 0000000..179e2d2 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objc-error-qualified-implementation.m
@@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -fsyntax-only -Wno-objc-root-class -verify %s +// rdar://12233858 + +@protocol P +@end + +@interface I @end + +@implementation I<P> @end // expected-error {{@implementation declaration cannot be protocol qualified}} + +@interface J < P,P > +@end + + +@implementation J < P,P > // expected-error {{@implementation declaration cannot be protocol qualified}} +@end + +@interface K @end + +@implementation K <P // expected-error {{@implementation declaration cannot be protocol qualified}} expected-note{{to match this '<'}} +@end // expected-error {{expected '>'}} + +// rdar://13920026 +@implementation I (Cat) <P> // expected-error {{@implementation declaration cannot be protocol qualified}} +- (void) Meth {} +@end + +@implementation I (Cat1) <P // expected-error {{@implementation declaration cannot be protocol qualified}} +@end // expected-error {{expected '>'}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/objc-forcollection-1.m b/src/third_party/llvm-project/clang/test/Parser/objc-forcollection-1.m new file mode 100644 index 0000000..4850deb --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/objc-forcollection-neg-2.m b/src/third_party/llvm-project/clang/test/Parser/objc-forcollection-neg-2.m new file mode 100644 index 0000000..f95dd13 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/objc-forcollection-neg.m b/src/third_party/llvm-project/clang/test/Parser/objc-forcollection-neg.m new file mode 100644 index 0000000..9e5400c --- /dev/null +++ b/src/third_party/llvm-project/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 {{the type 'int *' is not a pointer to a fast-enumerable 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 {{the type 'int' is not a pointer to a fast-enumerable object}} + ++i; +} +@end +
diff --git a/src/third_party/llvm-project/clang/test/Parser/objc-foreach-syntax.m b/src/third_party/llvm-project/clang/test/Parser/objc-foreach-syntax.m new file mode 100644 index 0000000..5d83dc6 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/objc-init.m b/src/third_party/llvm-project/clang/test/Parser/objc-init.m new file mode 100644 index 0000000..088e385 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objc-init.m
@@ -0,0 +1,70 @@ +// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -pedantic -Wno-objc-root-class %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -x objective-c++ -Wno-objc-root-class %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -x objective-c++ -Wno-objc-root-class -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -x objective-c++ -Wno-objc-root-class -std=c++11 %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 in C++98. +#if __cplusplus >= 201103L + // expected-error@-2 {{non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list}} + // expected-note@-3 {{insert an explicit cast to silence this issue}} +#endif + .x [x METH2] // expected-error {{expected '=' or another designator}} +#if __cplusplus >= 201103L + // expected-error@-2 {{non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list}} + // expected-note@-3 {{insert an explicit cast to silence this issue}} +#endif + }; +} + +// rdar://7370882 +@interface SemicolonsAppDelegate +{ + id i; +} +@property (assign) id window; +@end + +@implementation SemicolonsAppDelegate +{ + id i; +} + @synthesize window=i; +@end + + +
diff --git a/src/third_party/llvm-project/clang/test/Parser/objc-interfaces.m b/src/third_party/llvm-project/clang/test/Parser/objc-interfaces.m new file mode 100644 index 0000000..0ae17f1 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/objc-messaging-1.m b/src/third_party/llvm-project/clang/test/Parser/objc-messaging-1.m new file mode 100644 index 0000000..82450df --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/objc-messaging-neg-1.m b/src/third_party/llvm-project/clang/test/Parser/objc-messaging-neg-1.m new file mode 100644 index 0000000..bb496e9 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/objc-missing-impl.m b/src/third_party/llvm-project/clang/test/Parser/objc-missing-impl.m new file mode 100644 index 0000000..791b9f8 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/objc-property-syntax.m b/src/third_party/llvm-project/clang/test/Parser/objc-property-syntax.m new file mode 100644 index 0000000..8e56a09 --- /dev/null +++ b/src/third_party/llvm-project/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 bit-field}} +@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/src/third_party/llvm-project/clang/test/Parser/objc-quirks.m b/src/third_party/llvm-project/clang/test/Parser/objc-quirks.m new file mode 100644 index 0000000..0bdeb46 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/objc-recover.mm b/src/third_party/llvm-project/clang/test/Parser/objc-recover.mm new file mode 100644 index 0000000..61444c7 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objc-recover.mm
@@ -0,0 +1,64 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s + +@interface StopAtAtEnd +// This used to eat the @end +int 123 // expected-error{{expected unqualified-id}} +@end + +@implementation StopAtAtEnd // no-warning +int 123 // expected-error{{expected unqualified-id}} +@end + + +@interface StopAtMethodDecls +// This used to eat the method declarations +int 123 // expected-error{{expected unqualified-id}} +- (void)foo; // expected-note{{here}} +int 456 // expected-error{{expected unqualified-id}} ++ (void)bar; // expected-note{{here}} +@end + +@implementation StopAtMethodDecls +int 123 // expected-error{{expected unqualified-id}} +- (id)foo {} // expected-warning{{conflicting return type}} +int 456 // expected-error{{expected unqualified-id}} ++ (id)bar {} // expected-warning{{conflicting return type}} +@end + + +@interface EmbeddedNamespace +// This used to cause an infinite loop. +namespace NS { // expected-error{{expected unqualified-id}} +} +- (id)test; // expected-note{{here}} +@end + +@implementation EmbeddedNamespace +int 123 // expected-error{{expected unqualified-id}} +// We should still stop here and parse this namespace. +namespace NS { + void foo(); +} + +// Make sure the declaration of -test was recognized. +- (void)test { // expected-warning{{conflicting return type}} + // Make sure the declaration of NS::foo was recognized. + NS::foo(); +} + +@end + + +@protocol ProtocolWithEmbeddedNamespace +namespace NS { // expected-error{{expected unqualified-id}} + +} +- (void)PWEN_foo; // expected-note{{here}} +@end + +@interface ImplementPWEN <ProtocolWithEmbeddedNamespace> +@end + +@implementation ImplementPWEN +- (id)PWEN_foo {} // expected-warning{{conflicting return type}} +@end
diff --git a/src/third_party/llvm-project/clang/test/Parser/objc-synthesized-recover.m b/src/third_party/llvm-project/clang/test/Parser/objc-synthesized-recover.m new file mode 100644 index 0000000..c281c21 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/objc-try-catch-1.m b/src/third_party/llvm-project/clang/test/Parser/objc-try-catch-1.m new file mode 100644 index 0000000..3a60148 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objc-try-catch-1.m
@@ -0,0 +1,70 @@ +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -fsyntax-only -verify -fobjc-exceptions %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -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/src/third_party/llvm-project/clang/test/Parser/objc-type-printing.m b/src/third_party/llvm-project/clang/test/Parser/objc-type-printing.m new file mode 100644 index 0000000..9bbdac9 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/objcbridge-related-attribute.m b/src/third_party/llvm-project/clang/test/Parser/objcbridge-related-attribute.m new file mode 100644 index 0000000..209448b --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objcbridge-related-attribute.m
@@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -verify -fsyntax-only %s +// rdar://15499111 + +typedef struct __attribute__((objc_bridge_related(NSColor,colorWithCGColor:,CGColor))) CGColor *CGColorRefOk; +typedef struct __attribute__((objc_bridge_related(NSColor,,CGColor))) CGColor *CGColorRef1Ok; +typedef struct __attribute__((objc_bridge_related(NSColor,,))) CGColor *CGColorRef2Ok; +typedef struct __attribute__((objc_bridge_related(NSColor,colorWithCGColor:,))) CGColor *CGColorRef3Ok; + +typedef struct __attribute__((objc_bridge_related(,colorWithCGColor:,CGColor))) CGColor *CGColorRef1NotOk; // expected-error {{expected a related ObjectiveC class name, e.g., 'NSColor'}} +typedef struct __attribute__((objc_bridge_related(NSColor,colorWithCGColor,CGColor))) CGColor *CGColorRef2NotOk; // expected-error {{expected a class method selector with single argument, e.g., 'colorWithCGColor:'}} +typedef struct __attribute__((objc_bridge_related(NSColor,colorWithCGColor::,CGColor))) CGColor *CGColorRef3NotOk; // expected-error {{expected a class method selector with single argument, e.g., 'colorWithCGColor:'}} +typedef struct __attribute__((objc_bridge_related(12,colorWithCGColor:,CGColor))) CGColor *CGColorRef4NotOk; // expected-error {{expected a related ObjectiveC class name, e.g., 'NSColor'}} +typedef struct __attribute__((objc_bridge_related(NSColor,+:,CGColor))) CGColor *CGColorRef5NotOk; // expected-error {{expected ','}} +typedef struct __attribute__((objc_bridge_related(NSColor,colorWithCGColor:,+))) CGColor *CGColorRef6NotOk; // expected-error {{expected ')'}} +
diff --git a/src/third_party/llvm-project/clang/test/Parser/objcxx-at.mm b/src/third_party/llvm-project/clang/test/Parser/objcxx-at.mm new file mode 100644 index 0000000..37aee4d --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/objcxx-lambda-expressions-neg.mm b/src/third_party/llvm-project/clang/test/Parser/objcxx-lambda-expressions-neg.mm new file mode 100644 index 0000000..b2fe39d --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objcxx-lambda-expressions-neg.mm
@@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify -std=c++11 %s + +int main() { + []{}; +#if __cplusplus <= 199711L + // expected-error@-2 {{expected expression}} +#else + // expected-no-diagnostics +#endif + +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/objcxx0x-lambda-expressions.mm b/src/third_party/llvm-project/clang/test/Parser/objcxx0x-lambda-expressions.mm new file mode 100644 index 0000000..0f3e948 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objcxx0x-lambda-expressions.mm
@@ -0,0 +1,56 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-value -Wno-c++1y-extensions -std=c++11 %s + +class C { + id get(int); + + void f() { + int foo, bar, baz; + + // 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 {{cannot take the address of an rvalue of type 'C *'}} + [] {}; + [=] (int i) {}; + [&] (int) mutable -> void {}; + [foo,bar] () { return 3; }; + [=,&foo] () {}; + [this] () {}; + + [foo(bar)] () {}; + [foo = bar] () {}; + [foo{bar}] () {}; + [foo = {bar}] () {}; // expected-error {{<initializer_list>}} + + [foo(bar) baz] () {}; // expected-error {{called object type 'int' is not a function}} + [foo(bar), baz] () {}; // ok + + [foo = bar baz]; // expected-warning {{receiver type 'int'}} expected-warning {{instance method '-baz'}} + + [get(bar) baz]; // expected-warning {{instance method '-baz'}} + [get(bar), baz]; // expected-error {{expected body of lambda}} + + [foo = bar ++ baz]; // expected-warning {{receiver type 'int'}} expected-warning {{instance method '-baz'}} + [foo = bar + baz]; // expected-error {{expected body of lambda}} + [foo = { bar, baz }]; // expected-error {{<initializer_list>}} expected-error {{expected body of lambda}} + [foo = { bar } baz ]; // expected-warning {{receiver type 'int'}} expected-warning {{instance method '-baz'}} + [foo = { bar }, baz ]; // expected-error {{<initializer_list>}} expected-error {{expected body of lambda}} + } + +}; + +struct Func { + template <typename F> + Func(F&&); +}; + +int getInt(); + +void test() { + [val = getInt()]() { }; + Func{ + [val = getInt()]() { } + }; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/objcxx11-attributes.mm b/src/third_party/llvm-project/clang/test/Parser/objcxx11-attributes.mm new file mode 100644 index 0000000..4bff215 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objcxx11-attributes.mm
@@ -0,0 +1,66 @@ +// 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-error {{'noreturn' attribute only applies to functions}} + + 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-error {{'noreturn' attribute only applies to functions}} + + // 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 {{unknown attribute 'int' ignored}} \ + // expected-error {{'noreturn' attribute cannot be applied to a statement}} + [[class, test(foo 'x' bar),,,]]; // expected-warning {{unknown attribute 'test' ignored}}\ + // expected-warning {{unknown attribute 'class' ignored}} + + [[bitand, noreturn]]; // expected-error {{'noreturn' attribute cannot be applied to a statement}} \ + expected-warning {{unknown attribute 'bitand' ignored}} + + // FIXME: Suppress vexing parse warning + [[gnu::noreturn]]int(e)(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}} + int e2(); // expected-warning {{interpreted as a function declaration}} expected-note{{}} + + // A function taking a noreturn function. + int(f)([[gnu::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)...]]; // expected-error {{attribute 'foo' cannot be used as an attribute pack}} \ + // expected-warning {{unknown attribute 'foo' ignored}} + + [[used(x)...]]; // expected-error {{attribute 'used' cannot be used as an attribute pack}} \ + // expected-warning {{unknown attribute 'used' ignored}} + + [[x...] { return [ X alloc ]; }() init]; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/objcxx11-initialized-temps.mm b/src/third_party/llvm-project/clang/test/Parser/objcxx11-initialized-temps.mm new file mode 100644 index 0000000..96f19fe --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objcxx11-initialized-temps.mm
@@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// expected-no-diagnostics +// rdar://12788429 + +struct CGPoint { + double x; + double y; +}; +typedef struct CGPoint CGPoint; + +struct CGSize { + double width; + double height; +}; +typedef struct CGSize CGSize; + +struct CGRect { + CGPoint origin; + CGSize size; +}; +typedef struct CGRect CGRect; + +typedef CGRect NSRect; + +void HappySetFrame(NSRect frame) {} + +__attribute__((objc_root_class)) +@interface NSObject @end + +@implementation NSObject +- (void) sadSetFrame: (NSRect)frame {} + +- (void) nothing +{ + HappySetFrame({{0,0}, {13,14}}); + [self sadSetFrame: {{0,0}, {13,14}}]; +} +@end
diff --git a/src/third_party/llvm-project/clang/test/Parser/objcxx11-invalid-lambda.cpp b/src/third_party/llvm-project/clang/test/Parser/objcxx11-invalid-lambda.cpp new file mode 100644 index 0000000..74c5636 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objcxx11-invalid-lambda.cpp
@@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -x objective-c++ -std=c++11 %s + +void foo() { // expected-note {{to match this '{'}} + int bar; + auto baz = [ + bar( // expected-note {{to match this '('}} expected-note {{to match this '('}} + foo_undeclared() // expected-error{{use of undeclared identifier 'foo_undeclared'}} expected-error{{use of undeclared identifier 'foo_undeclared'}} + /* ) */ + ] () { }; // expected-error{{expected ')'}} +} // expected-error{{expected ')'}} expected-error{{expected ';' at end of declaration}} expected-error{{expected '}'}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/objcxx11-messaging-and-lambda.mm b/src/third_party/llvm-project/clang/test/Parser/objcxx11-messaging-and-lambda.mm new file mode 100644 index 0000000..002f3e9 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objcxx11-messaging-and-lambda.mm
@@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +#define OBJCLASS(name) // expected-note {{macro 'OBJCLASS' defined here}} + +class NSMutableData; + +NSMutableData *test() { // expected-note {{to match this '{'}} + NSMutableData *data = [[[OBJCLASS(NSMutableDataOBJCLASS( alloc] init] autorelease]; // expected-error {{unterminated function-like macro invocation}} \ + // expected-error {{expected ';' at end of declaration}} + return data; +} // expected-error {{expected expression}} expected-error {{expected '}'}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/objcxx11-protocol-in-template.mm b/src/third_party/llvm-project/clang/test/Parser/objcxx11-protocol-in-template.mm new file mode 100644 index 0000000..5c80ae9 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objcxx11-protocol-in-template.mm
@@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +template<class T> class vector {}; +@protocol P @end + +// expected-no-diagnostics + +vector<id<P>> v; +vector<vector<id<P>>> v2; + +@protocol PA; +@protocol PB; + +@class NSArray<ObjectType>; +typedef int some_t; + +id<PA> FA(NSArray<id<PB>> *h, some_t group);
diff --git a/src/third_party/llvm-project/clang/test/Parser/objcxx11-user-defined-literal.mm b/src/third_party/llvm-project/clang/test/Parser/objcxx11-user-defined-literal.mm new file mode 100644 index 0000000..a5f1397 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/objcxx14-protocol-in-template.mm b/src/third_party/llvm-project/clang/test/Parser/objcxx14-protocol-in-template.mm new file mode 100644 index 0000000..36da92e --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/objcxx14-protocol-in-template.mm
@@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s + +template<class T> class vector {}; +@protocol P @end + +// expected-no-diagnostics + +template <typename Functor> void F(Functor functor) {} + +// Test protocol in template within lambda capture initializer context. +void z() { + id<P> x = 0; + (void)x; + F( [ x = vector<id<P>>{} ] {} ); +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/offsetof.c b/src/third_party/llvm-project/clang/test/Parser/offsetof.c new file mode 100644 index 0000000..3a5b9f3 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/opencl-astype.cl b/src/third_party/llvm-project/clang/test/Parser/opencl-astype.cl new file mode 100644 index 0000000..903c42e --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/opencl-astype.cl
@@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s -triple spir-unknown-unknown +#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' (vector of 4 'double' values) and 'float4' (vector of 4 'float' values) must match}} + + // Verify int4->float3, float3->int4 works. + int4 i4; + float3 f3 = __builtin_astype(i4, float3); + i4 = __builtin_astype(f3, int4); +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/opencl-atomics-cl20.cl b/src/third_party/llvm-project/clang/test/Parser/opencl-atomics-cl20.cl new file mode 100644 index 0000000..ad67db0 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/opencl-atomics-cl20.cl
@@ -0,0 +1,74 @@ +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -fsyntax-only -cl-std=CL2.0 -DCL20 +// RUN: %clang_cc1 %s -triple spir64-unknown-unknown -verify -fsyntax-only -cl-std=CL2.0 -DCL20 +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -fsyntax-only -cl-std=CL2.0 -DCL20 -DEXT -Wpedantic-core-features + +#ifdef EXT +#pragma OPENCL EXTENSION cl_khr_int64_base_atomics:enable +#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics:enable +#pragma OPENCL EXTENSION cl_khr_fp64:enable +#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2 +// expected-warning@-2{{OpenCL extension 'cl_khr_fp64' is core feature or supported optional core feature - ignoring}} +#endif +#endif + +void atomic_types_test() { +// OpenCL v2.0 s6.13.11.6 defines supported atomic types. + atomic_int i; + atomic_uint ui; + atomic_long l; + atomic_ulong ul; + atomic_float f; + atomic_double d; + atomic_flag fl; + atomic_intptr_t ip; + atomic_uintptr_t uip; + atomic_size_t s; + atomic_ptrdiff_t pd; +// OpenCL v2.0 s6.13.11.8, _Atomic type specifier and _Atomic type qualifier +// are not supported by OpenCL. + _Atomic int i; // expected-error {{use of undeclared identifier '_Atomic'}} +} +#ifndef CL20 +// expected-error@-16 {{use of undeclared identifier 'atomic_int'}} +// expected-error@-16 {{use of undeclared identifier 'atomic_uint'}} +// expected-error@-16 {{use of undeclared identifier 'atomic_long'}} +// expected-error@-16 {{use of undeclared identifier 'atomic_ulong'}} +// expected-error@-16 {{use of undeclared identifier 'atomic_float'}} +// expected-error@-16 {{use of undeclared identifier 'atomic_double'}} +// expected-error@-16 {{use of undeclared identifier 'atomic_flag'}} +// expected-error@-16 {{use of undeclared identifier 'atomic_intptr_t'}} +// expected-error@-16 {{use of undeclared identifier 'atomic_uintptr_t'}} +// expected-error@-16 {{use of undeclared identifier 'atomic_size_t'}} +// expected-error@-16 {{use of undeclared identifier 'atomic_ptrdiff_t'}} +#elif !EXT +// expected-error@-26 {{use of type 'atomic_long' (aka '_Atomic(long)') requires cl_khr_int64_base_atomics extension to be enabled}} +// expected-error@-27 {{use of type 'atomic_long' (aka '_Atomic(long)') requires cl_khr_int64_extended_atomics extension to be enabled}} +// expected-error@-27 {{use of type 'atomic_ulong' (aka '_Atomic(unsigned long)') requires cl_khr_int64_base_atomics extension to be enabled}} +// expected-error@-28 {{use of type 'atomic_ulong' (aka '_Atomic(unsigned long)') requires cl_khr_int64_extended_atomics extension to be enabled}} +// expected-error@-27 {{use of type 'atomic_double' (aka '_Atomic(double)') requires cl_khr_int64_base_atomics extension to be enabled}} +// expected-error@-28 {{use of type 'atomic_double' (aka '_Atomic(double)') requires cl_khr_int64_extended_atomics extension to be enabled}} +#if __LP64__ +// expected-error-re@-28 {{use of type 'atomic_intptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}} +// expected-error-re@-29 {{use of type 'atomic_intptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}} +// expected-error-re@-29 {{use of type 'atomic_uintptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}} +// expected-error-re@-30 {{use of type 'atomic_uintptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}} +// expected-error-re@-30 {{use of type 'atomic_size_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}} +// expected-error-re@-31 {{use of type 'atomic_size_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}} +// expected-error-re@-31 {{use of type 'atomic_ptrdiff_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}} +// expected-error-re@-32 {{use of type 'atomic_ptrdiff_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}} +#endif +#endif + +#ifdef CL20 +void foo(atomic_int * ptr) {} +void atomic_ops_test() { + atomic_int i; + foo(&i); +// OpenCL v2.0 s6.13.11.8, arithemtic operations are not permitted on atomic types. + i++; // expected-error {{invalid argument type 'atomic_int' (aka '_Atomic(int)') to unary expression}} + i = 1; // expected-error {{atomic variable can be assigned to a variable only in global address space}} + i += 1; // expected-error {{invalid operands to binary expression ('atomic_int' (aka '_Atomic(int)') and 'int')}} + i = i + i; // expected-error {{invalid operands to binary expression ('atomic_int' (aka '_Atomic(int)') and 'atomic_int')}} +} +#endif
diff --git a/src/third_party/llvm-project/clang/test/Parser/opencl-cl20.cl b/src/third_party/llvm-project/clang/test/Parser/opencl-cl20.cl new file mode 100644 index 0000000..be96950 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/opencl-cl20.cl
@@ -0,0 +1,26 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 -DCL20 + +#ifdef CL20 +// expected-no-diagnostics +#endif + +__generic int * __generic_test(__generic int *arg) { + __generic int *var; + return var; +} +#ifndef CL20 +// expected-error@-5 {{OpenCL C version 1.0 does not support the '__generic' type qualifier}} +// expected-error@-6 {{OpenCL C version 1.0 does not support the '__generic' type qualifier}} +// expected-error@-6 {{OpenCL C version 1.0 does not support the '__generic' type qualifier}} +#endif + +generic int * generic_test(generic int *arg) { + generic int *var; + return var; +} +#ifndef CL20 +// expected-error@-5 {{OpenCL C version 1.0 does not support the 'generic' type qualifier}} +// expected-error@-6 {{OpenCL C version 1.0 does not support the 'generic' type qualifier}} +// expected-error@-6 {{OpenCL C version 1.0 does not support the 'generic' type qualifier}} +#endif
diff --git a/src/third_party/llvm-project/clang/test/Parser/opencl-cxx-keywords.cl b/src/third_party/llvm-project/clang/test/Parser/opencl-cxx-keywords.cl new file mode 100644 index 0000000..791da93 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/opencl-cxx-keywords.cl
@@ -0,0 +1,50 @@ +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -verify -fsyntax-only +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -verify -fsyntax-only -fexceptions -fcxx-exceptions + +// This test checks that various C++ and OpenCL C keywords are not available +// in OpenCL C++, according to OpenCL C++ 1.0 Specification Section 2.9. + +// Test that exceptions are disabled despite passing -fcxx-exceptions. +kernel void test_exceptions() { + int x; + try { + // expected-error@-1 {{cannot use 'try' with exceptions disabled}} + throw 0; + // expected-error@-1 {{cannot use 'throw' with exceptions disabled}} + } catch (int i) { + x = 41; + } +} + +// Test that only __-prefixed address space qualifiers are accepted. +struct test_address_space_qualifiers { + global int *g; + // expected-error@-1 {{unknown type name 'global'}} + // expected-error@-2 {{expected member name or ';' after declaration specifiers}} + __global int *uug; + int global; // should be fine in OpenCL C++ + + local int *l; + // expected-error@-1 {{unknown type name 'local'}} + // expected-error@-2 {{expected member name or ';' after declaration specifiers}} + __local int *uul; + int local; // should be fine in OpenCL C++ + + private int *p; + // expected-error@-1 {{expected ':'}} + __private int *uup; + int private; // 'private' is a keyword in C++14 and thus in OpenCL C++ + // expected-error@-1 {{expected member name or ';' after declaration specifiers}} + + constant int *c; + // expected-error@-1 {{unknown type name 'constant'}} + // expected-error@-2 {{expected member name or ';' after declaration specifiers}} + __constant int *uuc; + int constant; // should be fine in OpenCL C++ + + generic int *ge; + // expected-error@-1 {{unknown type name 'generic'}} + // expected-error@-2 {{expected member name or ';' after declaration specifiers}} + __generic int *uuge; + int generic; // should be fine in OpenCL C++ +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/opencl-cxx-virtual.cl b/src/third_party/llvm-project/clang/test/Parser/opencl-cxx-virtual.cl new file mode 100644 index 0000000..da08bfd --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/opencl-cxx-virtual.cl
@@ -0,0 +1,45 @@ +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -fsyntax-only -verify + +// Test that virtual functions and abstract classes are rejected. +class virtual_functions { + virtual void bad1() {} + //expected-error@-1 {{virtual functions are not supported in OpenCL C++}} + + virtual void bad2() = 0; + //expected-error@-1 {{virtual functions are not supported in OpenCL C++}} + //expected-error@-2 {{'bad2' is not virtual and cannot be declared pure}} +}; + +template <typename T> +class X { + virtual T f(); + //expected-error@-1 {{virtual functions are not supported in OpenCL C++}} +}; + +// Test that virtual base classes are allowed. +struct A { + int a; + void foo(); +}; + +struct B : virtual A { + int b; +}; + +struct C : public virtual A { + int c; +}; + +struct D : B, C { + int d; +}; + +kernel void virtual_inheritance() { + D d; + + d.foo(); + d.a = 11; + d.b = 22; + d.c = 33; + d.d = 44; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/opencl-image-access.cl b/src/third_party/llvm-project/clang/test/Parser/opencl-image-access.cl new file mode 100644 index 0000000..99ced8e --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/opencl-image-access.cl
@@ -0,0 +1,19 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +// RUN: %clang_cc1 %s -fsyntax-only -verify -cl-std=CL2.0 -DCL20 +// expected-no-diagnostics + +__kernel void f__ro(__read_only image2d_t a) { } + +__kernel void f__wo(__write_only image2d_t a) { } + +#if CL20 +__kernel void f__rw(__read_write image2d_t a) { } +#endif + +__kernel void fro(read_only image2d_t a) { } + +__kernel void fwo(write_only image2d_t a) { } + +#if CL20 +__kernel void frw(read_write image2d_t a) { } +#endif
diff --git a/src/third_party/llvm-project/clang/test/Parser/opencl-kernel.cl b/src/third_party/llvm-project/clang/test/Parser/opencl-kernel.cl new file mode 100644 index 0000000..01c7ed6 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/opencl-kernel.cl
@@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only +// expected-no-diagnostics + +__kernel void test() +{ +} + +kernel void test1() +{ +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/opencl-keywords.cl b/src/third_party/llvm-project/clang/test/Parser/opencl-keywords.cl new file mode 100644 index 0000000..5bc7054 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/opencl-keywords.cl
@@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only +// expected-no-diagnostics + +void f(half *h) { + bool b; + int wchar_t; + int constexpr; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/opencl-pragma.cl b/src/third_party/llvm-project/clang/test/Parser/opencl-pragma.cl new file mode 100644 index 0000000..02f053f --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/opencl-pragma.cl
@@ -0,0 +1,15 @@ +// RUN: %clang_cc1 %s -verify -pedantic -Wno-empty-translation-unit -fsyntax-only -triple spir-unknown-unknown + +#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 {{expected 'disable' - ignoring}} */ + +#pragma OPENCL EXTENSION cl_khr_fp64 : on /* expected-warning {{expected 'enable', 'disable', 'begin' or 'end' - 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/src/third_party/llvm-project/clang/test/Parser/opencl-storage-class.cl b/src/third_party/llvm-project/clang/test/Parser/opencl-storage-class.cl new file mode 100644 index 0000000..a33c6e8 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/opencl-storage-class.cl
@@ -0,0 +1,15 @@ +// RUN: %clang_cc1 %s -verify -fsyntax-only -triple spir-unknown-unknown + +void test_storage_class_specs() +{ + static int a; // expected-error {{OpenCL C version 1.0 does not support the 'static' storage class specifier}} + register int b; // expected-error {{OpenCL C version 1.0 does not support the 'register' storage class specifier}} + extern int c; // expected-error {{OpenCL C version 1.0 does not support the 'extern' storage class specifier}} + auto int d; // expected-error {{OpenCL C version 1.0 does not support the 'auto' storage class specifier}} + +#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable + static int e; // expected-error {{static local variable must reside in constant address space}} + register int f; + extern int g; // expected-error {{extern variable must reside in constant address space}} + auto int h; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/opencl-unroll-hint.cl b/src/third_party/llvm-project/clang/test/Parser/opencl-unroll-hint.cl new file mode 100644 index 0000000..5742dcd --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/opencl-unroll-hint.cl
@@ -0,0 +1,8 @@ +//RUN: %clang_cc1 -O0 -cl-std=CL2.0 -fsyntax-only -verify %s + +kernel void B (global int *x) { + __attribute__((opencl_unroll_hint(42))) + if (x[0]) // expected-error {{OpenCL only supports 'opencl_unroll_hint' attribute on for, while, and do statements}} + x[0] = 15; +} +
diff --git a/src/third_party/llvm-project/clang/test/Parser/parenthesis-balance.cpp b/src/third_party/llvm-project/clang/test/Parser/parenthesis-balance.cpp new file mode 100644 index 0000000..5bfa639 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/parmvardecl_conversion.c b/src/third_party/llvm-project/clang/test/Parser/parmvardecl_conversion.c new file mode 100644 index 0000000..f6afd12 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/parmvardecl_conversion.c
@@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics + +void f (int p[]) { p++; } +
diff --git a/src/third_party/llvm-project/clang/test/Parser/parser_overflow.c b/src/third_party/llvm-project/clang/test/Parser/parser_overflow.c new file mode 100644 index 0000000..9514e80 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/parser_overflow.c
@@ -0,0 +1,19 @@ +// RUN: not %clang_cc1 %s -fsyntax-only -DHUGE 2>&1 | FileCheck %s +// RUN: not %clang_cc1 %s -fsyntax-only 2>&1 | FileCheck %s +// RUN: not %clang_cc1 %s -fsyntax-only -fbracket-depth 299 2>&1 | FileCheck %s +// RUN: %clang_cc1 %s -fsyntax-only -fbracket-depth 300 +// RUN: not %clang %s -fsyntax-only -fbracket-depth=299 2>&1 | FileCheck %s +// RUN: %clang %s -fsyntax-only -fbracket-depth=300 + +void foo(void) { +#ifdef HUGE + // 16384 {, 16384 } + {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{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}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +#else +// 299 {, 299 } +{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} +#endif +} + +// CHECK: fatal error: bracket nesting level exceeded maximum of {{256|299}} +// CHECK: note: use -fbracket-depth=N to increase maximum nesting level
diff --git a/src/third_party/llvm-project/clang/test/Parser/placeholder-recovery.m b/src/third_party/llvm-project/clang/test/Parser/placeholder-recovery.m new file mode 100644 index 0000000..4f22ea7 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/placeholder-recovery.m
@@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +@protocol NSObject +@end + +@protocol <#protocol name#> <NSObject> // expected-error {{editor placeholder in source file}} +// expected-note@-1 {{protocol started here}} + +// 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. +<#methods#> // expected-error {{editor placeholder in source file}} + +@end // expected-error {{prefix attribute must be followed by an interface or protocol}} expected-error {{missing '@end'}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/pointer-arithmetic.c b/src/third_party/llvm-project/clang/test/Parser/pointer-arithmetic.c new file mode 100644 index 0000000..87eb1a2 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/pointer_promotion.c b/src/third_party/llvm-project/clang/test/Parser/pointer_promotion.c new file mode 100644 index 0000000..8b718ad --- /dev/null +++ b/src/third_party/llvm-project/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 ('short' and 'int *')}} + if (ip == cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/pragma-attribute-declspec.cpp b/src/third_party/llvm-project/clang/test/Parser/pragma-attribute-declspec.cpp new file mode 100644 index 0000000..28785ba --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/pragma-attribute-declspec.cpp
@@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -triple i386-pc-win32 -std=c++11 -verify -Wno-pragma-clang-attribute -fms-extensions -fms-compatibility %s + +#pragma clang attribute push(__declspec(dllexport), apply_to = function) + +void function(); + +#pragma clang attribute pop + +#pragma clang attribute push(__declspec(dllexport, dllimport), apply_to = function) // expected-error {{more than one attribute specified in '#pragma clang attribute push'}} + +#pragma clang attribute push(__declspec(align), apply_to = variable) // expected-error {{attribute 'align' is not supported by '#pragma clang attribute'}} + +#pragma clang attribute push(__declspec(), apply_to = variable) // A noop
diff --git a/src/third_party/llvm-project/clang/test/Parser/pragma-attribute.cpp b/src/third_party/llvm-project/clang/test/Parser/pragma-attribute.cpp new file mode 100644 index 0000000..f0ebca2 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/pragma-attribute.cpp
@@ -0,0 +1,181 @@ +// RUN: %clang_cc1 -Wno-pragma-clang-attribute -verify -std=c++11 %s + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = function) + +void function(); + +#pragma clang attribute pop + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any(variable(is_parameter), function)) +#pragma clang attribute pop + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = variable(unless(is_parameter))) +#pragma clang attribute pop + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any(variable(unless(is_parameter)))) +#pragma clang attribute pop + +#pragma clang attribute push (__attribute__((abi_tag("a")))) // expected-error {{expected ','}} +#pragma clang attribute push (__attribute__((abi_tag("a"))) apply_to=function) // expected-error {{expected ','}} +#pragma clang attribute push (__attribute__((abi_tag("a"))) = function) // expected-error {{expected ','}} +#pragma clang attribute push (__attribute__((abi_tag("a"))) any(function)) // expected-error {{expected ','}} + +#pragma clang attribute push (__attribute__((abi_tag("a"))) 22) // expected-error {{expected ','}} +#pragma clang attribute push (__attribute__((abi_tag("a"))) function) // expected-error {{expected ','}} +#pragma clang attribute push (__attribute__((abi_tag("a"))) (function)) // expected-error {{expected ','}} + +#pragma clang attribute push(__attribute__((annotate("test"))), ) // expected-error {{expected attribute subject set specifier 'apply_to'}} +#pragma clang attribute push(__attribute__((annotate("test"))), = any(function)) // expected-error {{expected attribute subject set specifier 'apply_to'}} +#pragma clang attribute push(__attribute__((annotate("test"))), = function) // expected-error {{expected attribute subject set specifier 'apply_to'}} +#pragma clang attribute push(__attribute__((annotate("test"))), any(function)) // expected-error {{expected attribute subject set specifier 'apply_to'}} +#pragma clang attribute push(__attribute__((annotate("test"))), function) // expected-error {{expected attribute subject set specifier 'apply_to'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply = any(function )) // expected-error {{expected attribute subject set specifier 'apply_to'}} +#pragma clang attribute push(__attribute__((annotate("test"))), to = function) // expected-error {{expected attribute subject set specifier 'apply_to'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_only_to = function) // expected-error {{expected attribute subject set specifier 'apply_to'}} + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to any(function)) // expected-error {{expected '='}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to function) // expected-error {{expected '='}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to) // expected-error {{expected '='}} +#pragma clang attribute push (__attribute__((abi_tag("a"))), apply_to 41 (22)) // expected-error {{expected '='}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any) // expected-error {{expected '('}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any {) // expected-error {{expected '('}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any function) // expected-error {{expected '('}} + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = { function, enum }) // expected-error {{expected an identifier that corresponds to an attribute subject rule}} + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any(function ) // expected-error {{expected ')'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any(function, )) // expected-error {{expected an identifier that corresponds to an attribute subject rule}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( function, enum ) // expected-error {{expected ')'}} + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = () ) // expected-error {{expected an identifier that corresponds to an attribute subject rule}} + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( + ) ) // expected-error {{expected an identifier that corresponds to an attribute subject rule}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any()) // expected-error {{expected an identifier that corresponds to an attribute subject rule}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( function, 42 )) // expected-error {{expected an identifier that corresponds to an attribute subject rule}} + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( diag )) // expected-error {{unknown attribute subject rule 'diag'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( a )) // expected-error {{unknown attribute subject rule 'a'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( function, for)) // expected-error {{unknown attribute subject rule 'for'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( function42, for )) // expected-error {{unknown attribute subject rule 'function42'}} + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any(hasType)) // expected-error {{expected '('}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = hasType) // expected-error {{expected '('}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = hasType(functionType)) // OK + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( variable( )) // expected-error {{expected ')'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( variable( ) )) // expected-error {{expected an identifier that corresponds to an attribute subject matcher sub-rule; 'variable' matcher supports the following sub-rules: 'is_thread_local', 'is_global', 'is_parameter', 'unless(is_parameter)'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( variable(is ) )) // expected-error {{unknown attribute subject matcher sub-rule 'is'; 'variable' matcher supports the following sub-rules: 'is_thread_local', 'is_global', 'is_parameter', 'unless(is_parameter)'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( variable(is_parameter, not) )) // expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( variable is_parameter )) // expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( variable ( ) // expected-error {{expected ')'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = variable ( // expected-error {{expected ')'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( function, variable (is ()) )) // expected-error {{unknown attribute subject matcher sub-rule 'is'; 'variable' matcher supports the following sub-rules: 'is_thread_local', 'is_global', 'is_parameter', 'unless(is_parameter)'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( function, variable (42) )) // expected-error {{expected an identifier that corresponds to an attribute subject matcher sub-rule; 'variable' matcher supports the following sub-rules: 'is_thread_local', 'is_global', 'is_parameter', 'unless(is_parameter)'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( function, namespace("test") )) // expected-error {{expected an identifier that corresponds to an attribute subject matcher sub-rule; 'namespace' matcher does not support sub-rules}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( function, variable ("test" )) // expected-error {{expected ')'}} + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = enum(is_parameter)) // expected-error {{invalid use of attribute subject matcher sub-rule 'is_parameter'; 'enum' matcher does not support sub-rules}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any(enum(is_parameter))) // expected-error {{invalid use of attribute subject matcher sub-rule 'is_parameter'; 'enum' matcher does not support sub-rules}} + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any (function, variable (unless) )) // expected-error {{expected '('}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any (function, variable (unless() )) // expected-error {{expected ')'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any ( function, variable (unless(is)) )) // expected-error {{unknown attribute subject matcher sub-rule 'unless(is)'; 'variable' matcher supports the following sub-rules: 'is_thread_local', 'is_global', 'is_parameter', 'unless(is_parameter)'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( variable(unless(is_parameter, not)) )) // expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( variable(unless(is_parameter), not) ) // expected-error {{expected ')'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( variable unless is_parameter )) // expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( variable(unless is_parameter) )) // expected-error {{expected '('}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( function, variable (unless(42)) )) // expected-error {{expected an identifier that corresponds to an attribute subject matcher sub-rule; 'variable' matcher supports the following sub-rules: 'is_thread_local', 'is_global', 'is_parameter', 'unless(is_parameter)'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( function, enum(unless("test")) )) // expected-error {{expected an identifier that corresponds to an attribute subject matcher sub-rule; 'enum' matcher does not support sub-rules}} + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( function, variable (unless(is_global)) )) // expected-error {{unknown attribute subject matcher sub-rule 'unless(is_global)'; 'variable' matcher supports the following sub-rules: 'is_thread_local', 'is_global', 'is_parameter', 'unless(is_parameter)'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( enum(unless(is_parameter)) )) // expected-error {{invalid use of attribute subject matcher sub-rule 'unless(is_parameter)'; 'enum' matcher does not support sub-rules}} + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( function, function )) // expected-error {{duplicate attribute subject matcher 'function'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( function, function, function )) // expected-error 2 {{duplicate attribute subject matcher 'function'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( function, enum, function )) // expected-error {{duplicate attribute subject matcher 'function'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( enum, enum, function )) // expected-error {{duplicate attribute subject matcher 'enum'}} + +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( variable(is_global), variable(is_global) )) // expected-error {{duplicate attribute subject matcher 'variable(is_global)'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( variable(is_global), function, variable(is_global), variable(is_global) )) // expected-error 2 {{duplicate attribute subject matcher 'variable(is_global)'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( variable(unless(is_parameter)), variable(unless(is_parameter)) )) // expected-error {{duplicate attribute subject matcher 'variable(unless(is_parameter))'}} +#pragma clang attribute push(__attribute__((annotate("test"))), apply_to = any( variable(unless(is_parameter)), variable(unless(is_parameter)), enum, variable(unless(is_parameter)) )) // expected-error 2 {{duplicate attribute subject matcher 'variable(unless(is_parameter))'}} + +#pragma clang attribute // expected-error {{expected 'push' or 'pop' after '#pragma clang attribute'}} +#pragma clang attribute 42 // expected-error {{expected 'push' or 'pop' after '#pragma clang attribute'}} +#pragma clang attribute pushpop // expected-error {{unexpected argument 'pushpop' to '#pragma clang attribute'; expected 'push' or 'pop'}} + +#pragma clang attribute push // expected-error {{expected '('}} +#pragma clang attribute push ( // expected-error {{expected an attribute after '('}} +#pragma clang attribute push (__attribute__((annotate)) // expected-error {{expected ')'}} +#pragma clang attribute push () // expected-error {{expected an attribute after '('}} + +#pragma clang attribute push (__attribute__((annotate("test"))), apply_to = function) () // expected-warning {{extra tokens at end of '#pragma clang attribute'}} +// expected-error@-1 {{expected unqualified-id}} +// expected-error@-2 {{unterminated '#pragma clang attribute push' at end of file}} + +#pragma clang attribute pop () // expected-warning {{extra tokens at end of '#pragma clang attribute'}} + +; + +#pragma clang attribute push (__attribute__((42))) // expected-error {{expected identifier that represents an attribute name}} + +#pragma clang attribute push (__attribute__((annotate)) foo) // expected-error {{expected ','}} +#pragma clang attribute push (__attribute__((annotate)), apply_to=function foo) // expected-error {{extra tokens after attribute in a '#pragma clang attribute push'}} + +#pragma clang attribute push (__attribute__((objc_bridge_related)), apply_to=function) +// expected-error@-1 {{attribute 'objc_bridge_related' is not supported by '#pragma clang attribute'}} +#pragma clang attribute push (__attribute__((objc_bridge_related(1))), apply_to=function) // expected-error {{expected a related ObjectiveC class name, e.g., 'NSColor'}} + +#pragma clang attribute push (__attribute__((used)), apply_to=function) // expected-error {{attribute 'used' is not supported by '#pragma clang attribute'}} + +void statementPragmasAndPragmaExpression() { +#pragma clang attribute push (__attribute__((annotate("hello"))), apply_to=variable) +#pragma clang attribute pop +int x = 0; +_Pragma("clang attribute push (__attribute__((annotate(\"hi\"))), apply_to = function)"); + +_Pragma("clang attribute push (__attribute__((annotate(\"hi\"))), apply_to = any(function(is_method ))"); // expected-error {{expected ')'}} +} + +_Pragma("clang attribute pop"); + +#pragma clang attribute push (__attribute__((address_space(0))), apply_to=variable) // expected-error {{attribute 'address_space' is not supported by '#pragma clang attribute'}} + +// Check support for CXX11 style attributes +#pragma clang attribute push ([[noreturn]], apply_to = any(function)) +#pragma clang attribute pop + +#pragma clang attribute push ([[clang::disable_tail_calls]], apply_to = function) +#pragma clang attribute pop + +#pragma clang attribute push ([[gnu::abi_tag]], apply_to=any(function)) +#pragma clang attribute pop + +#pragma clang attribute push ([[clang::disable_tail_calls, noreturn]], apply_to = function) // expected-error {{more than one attribute specified in '#pragma clang attribute push'}} +#pragma clang attribute push ([[clang::disable_tail_calls, noreturn]]) // expected-error {{more than one attribute specified in '#pragma clang attribute push'}} + +#pragma clang attribute push ([[gnu::abi_tag]], apply_to=namespace) +#pragma clang attribute pop + +#pragma clang attribute push ([[fallthrough]], apply_to=function) // expected-error {{attribute 'fallthrough' is not supported by '#pragma clang attribute'}} +#pragma clang attribute push ([[clang::fallthrough]], apply_to=function) // expected-error {{attribute 'fallthrough' is not supported by '#pragma clang attribute'}} + +#pragma clang attribute push ([[]], apply_to = function) // A noop + +#pragma clang attribute push ([[noreturn ""]], apply_to=function) // expected-error {{expected ']'}} +#pragma clang attribute pop +#pragma clang attribute push ([[noreturn 42]]) // expected-error {{expected ']'}} expected-error {{expected ','}} + +#pragma clang attribute push(__attribute__, apply_to=function) // expected-error {{expected '(' after 'attribute'}} +#pragma clang attribute push(__attribute__(), apply_to=function) // expected-error {{expected '(' after '('}} +#pragma clang attribute push(__attribute__(()), apply_to=function) // expected-error {{expected identifier that represents an attribute name}} +#pragma clang attribute push(__attribute__((annotate, apply_to=function))) // expected-error {{expected ')'}} +#pragma clang attribute push(__attribute__((annotate("test"), apply_to=function))) // expected-error {{expected ')'}} +#pragma clang attribute push(__attribute__((annotate), apply_to=function)) // expected-error {{expected ')'}} + +#pragma clang attribute push (42) // expected-error {{expected an attribute that is specified using the GNU, C++11 or '__declspec' syntax}} +#pragma clang attribute push (test) // expected-error {{expected an attribute that is specified using the GNU, C++11 or '__declspec' syntax}} +#pragma clang attribute push (annotate) // expected-error {{expected an attribute that is specified using the GNU, C++11 or '__declspec' syntax}} +// expected-note@-1 {{use the GNU '__attribute__' syntax}} +#pragma clang attribute push (annotate("test")) // expected-error {{expected an attribute that is specified using the GNU, C++11 or '__declspec' syntax}} +// expected-note@-1 {{use the GNU '__attribute__' syntax}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/pragma-fp-contract.c b/src/third_party/llvm-project/clang/test/Parser/pragma-fp-contract.c new file mode 100644 index 0000000..c80c140 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/pragma-fp-contract.c
@@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +void f1(void) { + int x = 0; +/* expected-error@+1 {{'#pragma fp_contract' can only appear at file scope or at the start of a compound statement}} */ +#pragma STDC FP_CONTRACT ON +} + +void f2(void) { + #pragma STDC FP_CONTRACT OFF + #pragma STDC FP_CONTRACT ON +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/pragma-fp.cpp b/src/third_party/llvm-project/clang/test/Parser/pragma-fp.cpp new file mode 100644 index 0000000..00547bf --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/pragma-fp.cpp
@@ -0,0 +1,64 @@ +// RUN: %clang_cc1 -std=c++11 -verify %s + +void test_0(int *List, int Length) { +/* expected-error@+1 {{missing option; expected contract}} */ +#pragma clang fp + for (int i = 0; i < Length; i++) { + List[i] = i; + } +} +void test_1(int *List, int Length) { +/* expected-error@+1 {{invalid option 'blah'; expected contract}} */ +#pragma clang fp blah + for (int i = 0; i < Length; i++) { + List[i] = i; + } +} + +void test_3(int *List, int Length) { +/* expected-error@+1 {{expected '('}} */ +#pragma clang fp contract on + for (int i = 0; i < Length; i++) { + List[i] = i; + } +} + +void test_4(int *List, int Length) { +/* expected-error@+1 {{unexpected argument 'while' to '#pragma clang fp contract'; expected 'on', 'fast' or 'off'}} */ +#pragma clang fp contract(while) + for (int i = 0; i < Length; i++) { + List[i] = i; + } +} + +void test_5(int *List, int Length) { +/* expected-error@+1 {{unexpected argument 'maybe' to '#pragma clang fp contract'; expected 'on', 'fast' or 'off'}} */ +#pragma clang fp contract(maybe) + for (int i = 0; i < Length; i++) { + List[i] = i; + } +} + +void test_6(int *List, int Length) { +/* expected-error@+1 {{expected ')'}} */ +#pragma clang fp contract(fast + for (int i = 0; i < Length; i++) { + List[i] = i; + } +} + +void test_7(int *List, int Length) { +/* expected-warning@+1 {{extra tokens at end of '#pragma clang fp' - ignored}} */ +#pragma clang fp contract(fast) * + for (int i = 0; i < Length; i++) { + List[i] = i; + } +} + +void test_8(int *List, int Length) { + for (int i = 0; i < Length; i++) { + List[i] = i; +/* expected-error@+1 {{'#pragma clang fp' can only appear at file scope or at the start of a compound statement}} */ +#pragma clang fp contract(fast) + } +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/pragma-loop-safety.cpp b/src/third_party/llvm-project/clang/test/Parser/pragma-loop-safety.cpp new file mode 100644 index 0000000..ab87dcd --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/pragma-loop-safety.cpp
@@ -0,0 +1,35 @@ +// RUN: %clang_cc1 -std=c++11 -verify %s + +// Note that this puts the expected lines before the directives to work around +// limitations in the -verify mode. + +void test(int *List, int Length) { + int i = 0; + +#pragma clang loop vectorize(assume_safety) +#pragma clang loop interleave(assume_safety) + while (i + 1 < Length) { + List[i] = i; + } + +/* expected-error {{expected ')'}} */ #pragma clang loop vectorize(assume_safety +/* expected-error {{expected ')'}} */ #pragma clang loop interleave(assume_safety + +/* expected-error {{invalid argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll(assume_safety) +/* expected-error {{invalid argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute(assume_safety) + +/* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop vectorize(badidentifier) +/* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop interleave(badidentifier) +/* expected-error {{invalid argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll(badidentifier) + while (i-7 < Length) { + List[i] = i; + } + +/* expected-error {{duplicate directives 'vectorize(assume_safety)' and 'vectorize(enable)'}} */ #pragma clang loop vectorize(enable) +#pragma clang loop vectorize(assume_safety) +/* expected-error {{duplicate directives 'interleave(assume_safety)' and 'interleave(enable)'}} */ #pragma clang loop interleave(enable) +#pragma clang loop interleave(assume_safety) + while (i-9 < Length) { + List[i] = i; + } +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/pragma-loop.cpp b/src/third_party/llvm-project/clang/test/Parser/pragma-loop.cpp new file mode 100644 index 0000000..f42d196 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/pragma-loop.cpp
@@ -0,0 +1,284 @@ +// RUN: %clang_cc1 -std=c++11 -verify %s + +// Note that this puts the expected lines before the directives to work around +// limitations in the -verify mode. + +template <int V, int I> +void test_nontype_template_param(int *List, int Length) { +#pragma clang loop vectorize_width(V) interleave_count(I) + for (int i = 0; i < Length; i++) { + List[i] = i; + } + +#pragma clang loop vectorize_width(V + 4) interleave_count(I + 4) + for (int i = 0; i < Length; i++) { + List[i] = i; + } +} + +template <int V> +void test_nontype_template_vectorize(int *List, int Length) { + /* expected-error {{invalid value '-1'; must be positive}} */ #pragma clang loop vectorize_width(V) + for (int i = 0; i < Length; i++) { + List[i] = i; + } + + /* expected-error {{invalid value '0'; must be positive}} */ #pragma clang loop vectorize_width(V / 2) + for (int i = 0; i < Length; i++) { + List[i] += i; + } +} + +template <int I> +void test_nontype_template_interleave(int *List, int Length) { + /* expected-error {{invalid value '-1'; must be positive}} */ #pragma clang loop interleave_count(I) + for (int i = 0; i < Length; i++) { + List[i] = i; + } + + /* expected-error {{invalid value '0'; must be positive}} */ #pragma clang loop interleave_count(2 % I) + for (int i = 0; i < Length; i++) { + List[i] = i; + } +} + +template <char V> +void test_nontype_template_char(int *List, int Length) { + /* expected-error {{invalid argument of type 'char'; expected an integer type}} */ #pragma clang loop vectorize_width(V) + for (int i = 0; i < Length; i++) { + List[i] = i; + } +} + +template <bool V> +void test_nontype_template_bool(int *List, int Length) { + /* expected-error {{invalid argument of type 'bool'; expected an integer type}} */ #pragma clang loop vectorize_width(V) + for (int i = 0; i < Length; i++) { + List[i] = i; + } +} + +template <int V, int I> +void test_nontype_template_badarg(int *List, int Length) { + /* expected-error {{use of undeclared identifier 'Vec'}} */ #pragma clang loop vectorize_width(Vec) interleave_count(I) + /* expected-error {{use of undeclared identifier 'Int'}} */ #pragma clang loop vectorize_width(V) interleave_count(Int) + for (int i = 0; i < Length; i++) { + List[i] = i; + } +} + +template <typename T> +void test_type_template_vectorize(int *List, int Length) { + const T Value = -1; + /* expected-error {{invalid value '-1'; must be positive}} */ #pragma clang loop vectorize_width(Value) + for (int i = 0; i < Length; i++) { + List[i] = i; + } +} + +void test(int *List, int Length) { + int i = 0; + +#pragma clang loop vectorize(enable) +#pragma clang loop interleave(enable) +#pragma clang loop unroll(full) + while (i + 1 < Length) { + List[i] = i; + } + +#pragma clang loop vectorize_width(4) +#pragma clang loop interleave_count(8) +#pragma clang loop unroll_count(16) + while (i < Length) { + List[i] = i; + } + +#pragma clang loop vectorize(disable) +#pragma clang loop interleave(disable) +#pragma clang loop unroll(disable) + while (i - 1 < Length) { + List[i] = i; + } + +#pragma clang loop vectorize_width(4) interleave_count(8) unroll_count(16) + while (i - 2 < Length) { + List[i] = i; + } + +#pragma clang loop interleave_count(16) + while (i - 3 < Length) { + List[i] = i; + } + + int VList[Length]; +#pragma clang loop vectorize(disable) interleave(disable) unroll(disable) + for (int j : VList) { + VList[j] = List[j]; + } + +#pragma clang loop distribute(enable) + for (int j : VList) { + VList[j] = List[j]; + } + +#pragma clang loop distribute(disable) + for (int j : VList) { + VList[j] = List[j]; + } + + test_nontype_template_param<4, 8>(List, Length); + +/* expected-error {{expected '('}} */ #pragma clang loop vectorize +/* expected-error {{expected '('}} */ #pragma clang loop interleave +/* expected-error {{expected '('}} */ #pragma clang loop unroll +/* expected-error {{expected '('}} */ #pragma clang loop distribute + +/* expected-error {{expected ')'}} */ #pragma clang loop vectorize(enable +/* expected-error {{expected ')'}} */ #pragma clang loop interleave(enable +/* expected-error {{expected ')'}} */ #pragma clang loop unroll(full +/* expected-error {{expected ')'}} */ #pragma clang loop distribute(enable + +/* expected-error {{expected ')'}} */ #pragma clang loop vectorize_width(4 +/* expected-error {{expected ')'}} */ #pragma clang loop interleave_count(4 +/* expected-error {{expected ')'}} */ #pragma clang loop unroll_count(4 + +/* expected-error {{missing argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop vectorize() +/* expected-error {{missing argument; expected an integer value}} */ #pragma clang loop interleave_count() +/* expected-error {{missing argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll() +/* expected-error {{missing argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute() + +/* expected-error {{missing option; expected vectorize, vectorize_width, interleave, interleave_count, unroll, unroll_count, or distribute}} */ #pragma clang loop +/* expected-error {{invalid option 'badkeyword'}} */ #pragma clang loop badkeyword +/* expected-error {{invalid option 'badkeyword'}} */ #pragma clang loop badkeyword(enable) +/* expected-error {{invalid option 'badkeyword'}} */ #pragma clang loop vectorize(enable) badkeyword(4) +/* expected-warning {{extra tokens at end of '#pragma clang loop'}} */ #pragma clang loop vectorize(enable) , + while (i-4 < Length) { + List[i] = i; + } + +/* expected-error {{invalid value '0'; must be positive}} */ #pragma clang loop vectorize_width(0) +/* expected-error {{invalid value '0'; must be positive}} */ #pragma clang loop interleave_count(0) +/* expected-error {{invalid value '0'; must be positive}} */ #pragma clang loop unroll_count(0) + +/* expected-error {{expression is not an integral constant expression}} expected-note {{division by zero}} */ #pragma clang loop vectorize_width(10 / 0) +/* expected-error {{invalid value '0'; must be positive}} */ #pragma clang loop interleave_count(10 / 5 - 2) + while (i-5 < Length) { + List[i] = i; + } + +test_nontype_template_vectorize<4>(List, Length); +/* expected-note {{in instantiation of function template specialization}} */ test_nontype_template_vectorize<-1>(List, Length); +test_nontype_template_interleave<8>(List, Length); +/* expected-note {{in instantiation of function template specialization}} */ test_nontype_template_interleave<-1>(List, Length); + +/* expected-note {{in instantiation of function template specialization}} */ test_nontype_template_char<'A'>(List, Length); // Loop hint arg cannot be a char. +/* expected-note {{in instantiation of function template specialization}} */ test_nontype_template_bool<true>(List, Length); // Or a bool. +/* expected-note {{in instantiation of function template specialization}} */ test_type_template_vectorize<int>(List, Length); // Or a template type. + +/* expected-error {{value '3000000000' is too large}} */ #pragma clang loop vectorize_width(3000000000) +/* expected-error {{value '3000000000' is too large}} */ #pragma clang loop interleave_count(3000000000) +/* expected-error {{value '3000000000' is too large}} */ #pragma clang loop unroll_count(3000000000) + while (i-6 < Length) { + List[i] = i; + } + +/* expected-warning {{extra tokens at end of '#pragma clang loop'}} */ #pragma clang loop vectorize_width(1 +) 1 +/* expected-warning {{extra tokens at end of '#pragma clang loop'}} */ #pragma clang loop vectorize_width(1) +1 +const int VV = 4; +/* expected-error {{expected expression}} */ #pragma clang loop vectorize_width(VV +/ 2) +/* expected-error {{use of undeclared identifier 'undefined'}} */ #pragma clang loop vectorize_width(VV+undefined) +/* expected-error {{expected ')'}} */ #pragma clang loop vectorize_width(1+(^*/2 * () +/* expected-warning {{extra tokens at end of '#pragma clang loop' - ignored}} */ #pragma clang loop vectorize_width(1+(-0[0])))))) + +/* expected-error {{use of undeclared identifier 'badvalue'}} */ #pragma clang loop vectorize_width(badvalue) +/* expected-error {{use of undeclared identifier 'badvalue'}} */ #pragma clang loop interleave_count(badvalue) +/* expected-error {{use of undeclared identifier 'badvalue'}} */ #pragma clang loop unroll_count(badvalue) + while (i-6 < Length) { + List[i] = i; + } + +/* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop vectorize(badidentifier) +/* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop interleave(badidentifier) +/* expected-error {{invalid argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll(badidentifier) +/* expected-error {{invalid argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute(badidentifier) + while (i-7 < Length) { + List[i] = i; + } + +// PR20069 - Loop pragma arguments that are not identifiers or numeric +// constants crash FE. +/* expected-error {{expected ')'}} */ #pragma clang loop vectorize(() +/* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop interleave(*) +/* expected-error {{invalid argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll(=) +/* expected-error {{invalid argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute(+) +/* expected-error {{type name requires a specifier or qualifier}} expected-error {{expected expression}} */ #pragma clang loop vectorize_width(^) +/* expected-error {{expected expression}} expected-error {{expected expression}} */ #pragma clang loop interleave_count(/) +/* expected-error {{expected expression}} expected-error {{expected expression}} */ #pragma clang loop unroll_count(==) + while (i-8 < Length) { + List[i] = i; + } + +#pragma clang loop vectorize(enable) +/* expected-error {{expected a for, while, or do-while loop to follow '#pragma clang loop'}} */ int j = Length; + List[0] = List[1]; + + while (j-1 < Length) { + List[j] = j; + } + +// FIXME: A bug in ParsedAttributes causes the order of the attributes to be +// processed in reverse. Consequently, the errors occur on the first of pragma +// of the next three tests rather than the last, and the order of the kinds +// is also reversed. + +/* expected-error {{incompatible directives 'vectorize(disable)' and 'vectorize_width(4)'}} */ #pragma clang loop vectorize_width(4) +#pragma clang loop vectorize(disable) +/* expected-error {{incompatible directives 'interleave(disable)' and 'interleave_count(4)'}} */ #pragma clang loop interleave_count(4) +#pragma clang loop interleave(disable) +/* expected-error {{incompatible directives 'unroll(disable)' and 'unroll_count(4)'}} */ #pragma clang loop unroll_count(4) +#pragma clang loop unroll(disable) + while (i-8 < Length) { + List[i] = i; + } + +/* expected-error {{duplicate directives 'vectorize(disable)' and 'vectorize(enable)'}} */ #pragma clang loop vectorize(enable) +#pragma clang loop vectorize(disable) +/* expected-error {{duplicate directives 'interleave(disable)' and 'interleave(enable)'}} */ #pragma clang loop interleave(enable) +#pragma clang loop interleave(disable) +/* expected-error {{duplicate directives 'unroll(disable)' and 'unroll(full)'}} */ #pragma clang loop unroll(full) +#pragma clang loop unroll(disable) +/* expected-error {{duplicate directives 'distribute(disable)' and 'distribute(enable)'}} */ #pragma clang loop distribute(enable) +#pragma clang loop distribute(disable) + while (i-9 < Length) { + List[i] = i; + } + +/* expected-error {{incompatible directives 'vectorize(disable)' and 'vectorize_width(4)'}} */ #pragma clang loop vectorize(disable) +#pragma clang loop vectorize_width(4) +/* expected-error {{incompatible directives 'interleave(disable)' and 'interleave_count(4)'}} */ #pragma clang loop interleave(disable) +#pragma clang loop interleave_count(4) +/* expected-error {{incompatible directives 'unroll(disable)' and 'unroll_count(4)'}} */ #pragma clang loop unroll(disable) +#pragma clang loop unroll_count(4) + while (i-10 < Length) { + List[i] = i; + } + +/* expected-error {{duplicate directives 'vectorize_width(4)' and 'vectorize_width(8)'}} */ #pragma clang loop vectorize_width(8) +#pragma clang loop vectorize_width(4) +/* expected-error {{duplicate directives 'interleave_count(4)' and 'interleave_count(8)'}} */ #pragma clang loop interleave_count(8) +#pragma clang loop interleave_count(4) +/* expected-error {{duplicate directives 'unroll_count(4)' and 'unroll_count(8)'}} */ #pragma clang loop unroll_count(8) +#pragma clang loop unroll_count(4) + while (i-11 < Length) { + List[i] = i; + } + + +/* expected-error {{incompatible directives 'unroll(full)' and 'unroll_count(4)'}} */ #pragma clang loop unroll(full) +#pragma clang loop unroll_count(4) + while (i-11 < Length) { + List[i] = i; + } + +#pragma clang loop interleave(enable) +/* expected-error {{expected statement}} */ }
diff --git a/src/third_party/llvm-project/clang/test/Parser/pragma-optimize-diagnostics.cpp b/src/third_party/llvm-project/clang/test/Parser/pragma-optimize-diagnostics.cpp new file mode 100644 index 0000000..af11a4e --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/pragma-optimize-diagnostics.cpp
@@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#pragma clang optimize off + +#pragma clang optimize on + +// Extra arguments +#pragma clang optimize on top of spaghetti // expected-error {{unexpected extra argument 'top' to '#pragma clang optimize'}} + +// Wrong argument +#pragma clang optimize something_wrong // expected-error {{unexpected argument 'something_wrong' to '#pragma clang optimize'; expected 'on' or 'off'}} + +// No argument +#pragma clang optimize // expected-error {{missing argument to '#pragma clang optimize'; expected 'on' or 'off'}} + +// Check that macros can be used in the pragma +#define OFF off +#define ON on +#pragma clang optimize OFF +#pragma clang optimize ON + +// Check that _Pragma can also be used to address the use case where users want +// to define optimization control macros to abstract out which compiler they are +// using. +#define OPT_OFF _Pragma("clang optimize off") +#define OPT_ON _Pragma("clang optimize on") +OPT_OFF +OPT_ON
diff --git a/src/third_party/llvm-project/clang/test/Parser/pragma-options.c b/src/third_party/llvm-project/clang/test/Parser/pragma-options.c new file mode 100644 index 0000000..a35f0b0 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/pragma-options.c
@@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -triple i386-apple-darwin9 -Wno-pragma-pack -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 + +// PR13580 +struct S +{ + char a[3]; +#pragma align=packed + struct T + { + char b; + int c; + } d; +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/pragma-options.cpp b/src/third_party/llvm-project/clang/test/Parser/pragma-options.cpp new file mode 100644 index 0000000..8f5a215 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/pragma-options.cpp
@@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -triple i386-apple-darwin9 -Wno-pragma-pack -fsyntax-only -verify %s +// expected-no-diagnostics + +class C { +#pragma options align=natural +};
diff --git a/src/third_party/llvm-project/clang/test/Parser/pragma-pack.c b/src/third_party/llvm-project/clang/test/Parser/pragma-pack.c new file mode 100644 index 0000000..d2aefaa --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/pragma-pack.c
@@ -0,0 +1,50 @@ +// RUN: %clang_cc1 -fsyntax-only -Wno-pragma-pack -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,)") + +// PR13580 +struct S +{ + char a[3]; +#pragma pack(1) + struct T + { + char b; + int c; + } d; +#pragma pack() + int e; +}; + +_Pragma("pack(push, 1)") struct PR28094 { + int a; +} _Pragma("pack(pop)");
diff --git a/src/third_party/llvm-project/clang/test/Parser/pragma-unroll.cpp b/src/third_party/llvm-project/clang/test/Parser/pragma-unroll.cpp new file mode 100644 index 0000000..b1d7798 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/pragma-unroll.cpp
@@ -0,0 +1,113 @@ +// RUN: %clang_cc1 -std=c++11 -verify %s + +// Note that this puts the expected lines before the directives to work around +// limitations in the -verify mode. + +void test(int *List, int Length) { + int i = 0; + +#pragma unroll + while (i + 1 < Length) { + List[i] = i; + } + +#pragma nounroll + while (i < Length) { + List[i] = i; + } + +#pragma unroll 4 + while (i - 1 < Length) { + List[i] = i; + } + +#pragma unroll(8) + while (i - 2 < Length) { + List[i] = i; + } + +/* expected-error {{expected ')'}} */ #pragma unroll(4 +/* expected-error {{missing argument; expected an integer value}} */ #pragma unroll() +/* expected-warning {{extra tokens at end of '#pragma unroll'}} */ #pragma unroll 1 2 + while (i-6 < Length) { + List[i] = i; + } + +/* expected-warning {{extra tokens at end of '#pragma nounroll'}} */ #pragma nounroll 1 + while (i-7 < Length) { + List[i] = i; + } + +/* expected-error {{expected ')'}} */ #pragma unroll(() +/* expected-error {{expected expression}} */ #pragma unroll - +/* expected-error {{invalid value '0'; must be positive}} */ #pragma unroll(0) +/* expected-error {{invalid value '0'; must be positive}} */ #pragma unroll 0 +/* expected-error {{value '3000000000' is too large}} */ #pragma unroll(3000000000) +/* expected-error {{value '3000000000' is too large}} */ #pragma unroll 3000000000 + while (i-8 < Length) { + List[i] = i; + } + +#pragma unroll +/* expected-error {{expected a for, while, or do-while loop to follow '#pragma unroll'}} */ int j = Length; +#pragma unroll 4 +/* expected-error {{expected a for, while, or do-while loop to follow '#pragma unroll'}} */ int k = Length; +#pragma nounroll +/* expected-error {{expected a for, while, or do-while loop to follow '#pragma nounroll'}} */ int l = Length; + +/* expected-error {{incompatible directives 'unroll(disable)' and '#pragma unroll(4)'}} */ #pragma unroll 4 +#pragma clang loop unroll(disable) + while (i-10 < Length) { + List[i] = i; + } + +/* expected-error {{incompatible directives 'unroll(full)' and '#pragma unroll(4)'}} */ #pragma unroll(4) +#pragma clang loop unroll(full) + while (i-11 < Length) { + List[i] = i; + } + +/* expected-error {{incompatible directives 'unroll(enable)' and '#pragma unroll(4)'}} */ #pragma unroll(4) +#pragma clang loop unroll(enable) + while (i-11 < Length) { + List[i] = i; + } + +/* expected-error {{incompatible directives '#pragma unroll' and '#pragma unroll(4)'}} */ #pragma unroll(4) +#pragma unroll + while (i-11 < Length) { + List[i] = i; + } + +/* expected-error {{incompatible directives '#pragma nounroll' and 'unroll_count(4)'}} */ #pragma clang loop unroll_count(4) +#pragma nounroll + while (i-12 < Length) { + List[i] = i; + } + +/* expected-error {{duplicate directives '#pragma nounroll' and '#pragma nounroll'}} */ #pragma nounroll +#pragma nounroll + while (i-13 < Length) { + List[i] = i; + } + +/* expected-error {{duplicate directives '#pragma unroll' and '#pragma unroll'}} */ #pragma unroll +#pragma unroll + while (i-14 < Length) { + List[i] = i; + } + +/* expected-error {{duplicate directives 'unroll(full)' and '#pragma unroll'}} */ #pragma unroll +#pragma clang loop unroll(full) + while (i-15 < Length) { + List[i] = i; + } + +/* expected-error {{duplicate directives '#pragma unroll(4)' and '#pragma unroll(4)'}} */ #pragma unroll 4 +#pragma unroll(4) + while (i-16 < Length) { + List[i] = i; + } + +#pragma unroll +/* expected-error {{expected statement}} */ }
diff --git a/src/third_party/llvm-project/clang/test/Parser/pragma-visibility.c b/src/third_party/llvm-project/clang/test/Parser/pragma-visibility.c new file mode 100644 index 0000000..cfc3d9e --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/pragma-visibility2.c b/src/third_party/llvm-project/clang/test/Parser/pragma-visibility2.c new file mode 100644 index 0000000..bcef09f --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/pragma-weak.c b/src/third_party/llvm-project/clang/test/Parser/pragma-weak.c new file mode 100644 index 0000000..fd47dd8 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/pragma-weak.c
@@ -0,0 +1,44 @@ +// 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 + + +void pragma_is_not_a_statement(int x) +{ + int t; + + { + if (x) +#pragma weak t + else // expected-error {{expected expression}} +#pragma weak t + } + + switch (x) { + case 1: +#pragma weak t + } // expected-error {{expected statement}} + switch(x) { + default: +#pragma weak t + } // expected-error {{expected statement}} + +label: +#pragma weak t +} // expected-error {{expected statement}} + +
diff --git a/src/third_party/llvm-project/clang/test/Parser/promote_types_in_proto.c b/src/third_party/llvm-project/clang/test/Parser/promote_types_in_proto.c new file mode 100644 index 0000000..969ba28 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/recovery.c b/src/third_party/llvm-project/clang/test/Parser/recovery.c new file mode 100644 index 0000000..178427e --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/recovery.c
@@ -0,0 +1,101 @@ +// 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 + ; + + // PR12595 + if (x.i == 0)) // expected-error {{extraneous ')' after condition, expected a statement}} + 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/src/third_party/llvm-project/clang/test/Parser/recovery.cpp b/src/third_party/llvm-project/clang/test/Parser/recovery.cpp new file mode 100644 index 0000000..2d5b518 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/recovery.cpp
@@ -0,0 +1,214 @@ +// RUN: %clang_cc1 -verify -std=c++11 -fms-extensions %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; + +extenr "C" { // expected-error {{did you mean 'extern'}} + void f(); +} +void g() { + z = 1; // expected-error {{undeclared}} + f(); +} + +struct S { + int a, b, c; + S(); + int x // expected-error {{expected ';'}} + friend void f() +}; +8S::S() : a{ 5 }, b{ 6 }, c{ 2 } { // expected-error {{unqualified-id}} + return; +} +int k; +int l = k // expected-error {{expected ';'}} +constexpr int foo(); + +5int m = { l }, n = m; // expected-error {{unqualified-id}} + +namespace MissingBrace { + struct S { // expected-error {{missing '}' at end of definition of 'MissingBrace::S'}} + int f(); + // }; + + namespace N { int g(); } // expected-note {{still within definition of 'MissingBrace::S' here}} + + int k1 = S().h(); // expected-error {{no member named 'h' in 'MissingBrace::S'}} + int k2 = S().f() + N::g(); + + template<typename T> struct PR17949 { // expected-error {{missing '}' at end of definition of 'MissingBrace::PR17949'}} + + namespace X { // expected-note {{still within definition of 'MissingBrace::PR17949' here}} + } +} + +namespace N { + int +} // expected-error {{unqualified-id}} + +strcut Uuuu { // expected-error {{did you mean 'struct'}} \ + // expected-note {{'Uuuu' declared here}} +} *u[3]; +uuuu v; // expected-error {{did you mean 'Uuuu'}} + +struct Redefined { // expected-note {{previous}} + Redefined() {} +}; +struct Redefined { // expected-error {{redefinition}} + Redefined() {} +}; + +struct MissingSemi5; +namespace N { + typedef int afterMissingSemi4; + extern MissingSemi5 afterMissingSemi5; +} + +struct MissingSemi1 {} // expected-error {{expected ';' after struct}} +static int afterMissingSemi1(); + +class MissingSemi2 {} // expected-error {{expected ';' after class}} +MissingSemi1 *afterMissingSemi2; + +enum MissingSemi3 {} // expected-error {{expected ';' after enum}} +::MissingSemi1 afterMissingSemi3; + +extern N::afterMissingSemi4 afterMissingSemi4b; +union MissingSemi4 { MissingSemi4(int); } // expected-error {{expected ';' after union}} +N::afterMissingSemi4 (afterMissingSemi4b); + +int afterMissingSemi5b; +struct MissingSemi5 { MissingSemi5(int); } // ok, no missing ';' here +N::afterMissingSemi5 (afterMissingSemi5b); + +template<typename T> struct MissingSemiT { +} // expected-error {{expected ';' after struct}} +MissingSemiT<int> msi; + +struct MissingSemiInStruct { + struct Inner1 {} // expected-error {{expected ';' after struct}} + static MissingSemi5 ms1; + + struct Inner2 {} // ok, no missing ';' here + static MissingSemi1; + + struct Inner3 {} // expected-error {{expected ';' after struct}} + static MissingSemi5 *p; +}; + +void MissingSemiInFunction() { + struct Inner1 {} // expected-error {{expected ';' after struct}} + if (true) {} + + // FIXME: It would be nice to at least warn on this. + struct Inner2 { Inner2(int); } // ok, no missing ';' here + k = l; + + struct Inner3 {} // expected-error {{expected ';' after struct}} + Inner1 i1; + + struct Inner4 {} // ok, no missing ';' here + Inner5; +} + +namespace NS { + template<typename T> struct Foo {}; +} +struct MissingSemiThenTemplate1 {} // expected-error {{expected ';' after struct}} +NS::Foo<int> missingSemiBeforeFunctionReturningTemplateId1(); + +using NS::Foo; +struct MissingSemiThenTemplate2 {} // expected-error {{expected ';' after struct}} +Foo<int> missingSemiBeforeFunctionReturningTemplateId2(); + +namespace PR17084 { +enum class EnumID {}; +template <typename> struct TempID; +template <> struct TempID<BadType> : BadType, EnumID::Garbage; // expected-error{{use of undeclared identifier 'BadType'}} +} + +namespace pr15133 { + namespace ns { + const int V1 = 1; // expected-note {{declared here}} + } + struct C1 { + enum E1 { V2 = 2 }; // expected-note {{declared here}} + static const int V3 = 3; // expected-note {{declared here}} + }; + enum E2 { + V4 = 4, // expected-note {{declared here}} + V6 // expected-note {{declared here}} + }; + enum class EC3 { V0 = 0, V5 = 5 }; // expected-note {{declared here}} + void func_3(); + + void func_1(int x) { + switch(x) { + case 0: break; + case ns::V1:: break; // expected-error{{'V1' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}} + case C1::V2:: break; // expected-error{{'V2' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}} + case C1::V3:: break; // expected-error{{'V3' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}} + case V4:: break; // expected-error{{'V4' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}} + case V6:: func_3(); // expected-error{{'V6' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}} + } + } + void func_2(EC3 x) { + switch(x) { + case EC3::V0: break; + case EC3::V5:: break; // expected-error{{'V5' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}} + } + } + + template<class T> struct TS1 { + typedef int A; + }; + template<class T> void func(int x) { + switch(x) { + case TS1<T>::A:: break; // expected-error{{expected unqualified-id}} + } + }; + void mainf() { + func<int>(1); + } + + struct S { + static int n; // expected-note{{declared here}} + int nn; // expected-note 2 {{declared here}} + }; + + int func_3(int x) { + return x ? S::n :: 0; // expected-error{{'n' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}} + } + int func_4(int x, S &s) { + return x ? s.nn :: x; // expected-error{{'nn' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}} + } + int func_5(int x, S &s) { + return x ? s.nn :: S::n; // expected-error{{'nn' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}} + } + + struct S2 { + struct S3; + }; + + struct S2 :: S3 :: public S2 { // expected-error{{'public' cannot be a part of nested name specifier; did you mean ':'?}} + }; +} + +namespace InvalidEmptyNames { +// These shouldn't crash, the diagnostics aren't important. +struct ::, struct ::; // expected-error 2 {{expected identifier}} expected-error 2 {{declaration of anonymous struct must be a definition}} expected-warning {{declaration does not declare anything}} +enum ::, enum ::; // expected-error 2 {{expected identifier}} expected-warning {{declaration does not declare anything}} +struct ::__super, struct ::__super; // expected-error 2 {{expected identifier}} expected-error 2 {{expected '::' after '__super'}} +struct ::template foo, struct ::template bar; // expected-error 2 {{expected identifier}} expected-error 2 {{declaration of anonymous struct must be a definition}} expected-warning {{declaration does not declare anything}} +struct ::foo struct::; // expected-error {{no struct named 'foo' in the global namespace}} expected-error {{expected identifier}} expected-error {{declaration of anonymous struct must be a definition}} +class :: : {} a; // expected-error {{expected identifier}} expected-error {{expected class name}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/recovery.m b/src/third_party/llvm-project/clang/test/Parser/recovery.m new file mode 100644 index 0000000..e126526 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/recursion-limits.cpp b/src/third_party/llvm-project/clang/test/Parser/recursion-limits.cpp new file mode 100644 index 0000000..bb7354f --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/recursion-limits.cpp
@@ -0,0 +1,260 @@ +// RUN: %clang_cc1 -fsyntax-only %s -verify +// expected-no-diagnostics +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/src/third_party/llvm-project/clang/test/Parser/selector-1.m b/src/third_party/llvm-project/clang/test/Parser/selector-1.m new file mode 100644 index 0000000..3e2a86d --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/selector-1.m
@@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s +// expected-no-diagnostics + +// 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/src/third_party/llvm-project/clang/test/Parser/skip-function-bodies.h b/src/third_party/llvm-project/clang/test/Parser/skip-function-bodies.h new file mode 100644 index 0000000..2d1a4c0 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/skip-function-bodies.h
@@ -0,0 +1,3 @@ +int header1(int t) { + return t; +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/skip-function-bodies.mm b/src/third_party/llvm-project/clang/test/Parser/skip-function-bodies.mm new file mode 100644 index 0000000..646730e --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/skip-function-bodies.mm
@@ -0,0 +1,56 @@ +#include "skip-function-bodies.h" + +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 {}; +} + +// RUN: env CINDEXTEST_SKIP_FUNCTION_BODIES=1 c-index-test -test-load-source all %s | FileCheck %s +// 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 (default constructor) 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] + +// RUN: env CINDEXTEST_EDITING=1 \ +// RUN: CINDEXTEST_CREATE_PREAMBLE_ON_FIRST_PARSE=1 \ +// RUN: CINDEXTEST_SKIP_FUNCTION_BODIES=1 \ +// RUN: CINDEXTEST_LIMIT_SKIP_FUNCTION_BODIES_TO_PREAMBLE=1 \ +// RUN: c-index-test -test-load-source all %s | FileCheck -check-prefix=CHECK-PREAMBLE %s +// CHECK-PREAMBLE: skip-function-bodies.h:1:5: FunctionDecl=header1:1:5 Extent=[1:1 - 1:19] +// CHECK-PREAMBLE-NOT: skip-function-bodies.h:2:3: ReturnStmt= Extent=[2:3 - 2:11] +// CHECK-PREAMBLE: skip-function-bodies.mm:8:12: StructDecl=C:8:12 (Definition) Extent=[8:5 - 10:6] +// CHECK-PREAMBLE: skip-function-bodies.mm:9:12: CXXMethod=d:9:12 (Definition) Extent=[9:7 - 9:18]
diff --git a/src/third_party/llvm-project/clang/test/Parser/statements.c b/src/third_party/llvm-project/clang/test/Parser/statements.c new file mode 100644 index 0000000..8215f4c --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/statements.c
@@ -0,0 +1,79 @@ +// 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'}} +} + +int test9() { + int T[] = {1, 2, }; + + int X; + X = 0, // expected-error {{expected ';' after expression}} + { + } + + X = 0, // expected-error {{expected ';' after expression}} + if (0) + ; + + return 4, // expected-error {{expected ';' after return statement}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/struct-recursion.c b/src/third_party/llvm-project/clang/test/Parser/struct-recursion.c new file mode 100644 index 0000000..834c5d0 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/switch-recovery.cpp b/src/third_party/llvm-project/clang/test/Parser/switch-recovery.cpp new file mode 100644 index 0000000..a3a0178 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/switch-recovery.cpp
@@ -0,0 +1,233 @@ +// 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) { // expected-note {{'x' declared here}} + 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; did you mean simply 'x'?}} \ + expected-warning 2 {{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}} + } +} + +void pr19022_1() { + switch (int x) // expected-error {{variable declaration in condition must have an initializer}} + case v: ; // expected-error {{use of undeclared identifier 'v'}} +} + +void pr19022_1a(int x) { + switch(x) { + case 1 // expected-error{{expected ':' after 'case'}} \ + // expected-error{{label at end of compound statement: expected statement}} + } +} + +void pr19022_1b(int x) { + switch(x) { + case v // expected-error{{use of undeclared identifier 'v'}} \ + // expected-error{{expected ':' after 'case'}} + } // expected-error{{expected statement}} + } + +void pr19022_2() { + switch (int x) // expected-error {{variable declaration in condition must have an initializer}} + case v1: case v2: ; // expected-error {{use of undeclared identifier 'v1'}} \ + // expected-error {{use of undeclared identifier 'v2'}} +} + +void pr19022_3(int x) { + switch (x) + case 1: case v2: ; // expected-error {{use of undeclared identifier 'v2'}} +} + +int pr19022_4(int x) { + switch(x) { + case 1 // expected-error{{expected ':' after 'case'}} expected-note{{previous case defined here}} + case 1 : return x; // expected-error{{duplicate case value '1'}} + } +} + +void pr19022_5(int x) { + switch(x) { + case 1: case // expected-error{{expected ':' after 'case'}} \ + // expected-error{{expected statement}} + } // expected-error{{expected expression}} +} + +namespace pr19022 { +int baz5() {} +bool bar0() { + switch (int foo0) //expected-error{{variable declaration in condition must have an initializer}} + case bar5: ; // expected-error{{use of undeclared identifier 'bar5'}} +} +} + +namespace pr21841 { +void fn1() { + switch (0) + switch (0 // expected-note{{to match this '('}} + { // expected-error{{expected ')'}} + } +} // expected-error{{expected statement}} +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/top-level-semi-cxx0x.cpp b/src/third_party/llvm-project/clang/test/Parser/top-level-semi-cxx0x.cpp new file mode 100644 index 0000000..472686e --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/top-level-semi-cxx0x.cpp
@@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++11 -verify %s +// expected-no-diagnostics + +void foo(); + +void bar() { }; + +void wibble(); + +; + +namespace Blah { + void f() { }; + + void g(); +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/traditional_arg_scope.c b/src/third_party/llvm-project/clang/test/Parser/traditional_arg_scope.c new file mode 100644 index 0000000..3811d0d --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/typeof.c b/src/third_party/llvm-project/clang/test/Parser/typeof.c new file mode 100644 index 0000000..7953a69 --- /dev/null +++ b/src/third_party/llvm-project/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/src/third_party/llvm-project/clang/test/Parser/types.c b/src/third_party/llvm-project/clang/test/Parser/types.c new file mode 100644 index 0000000..db8c083 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/types.c
@@ -0,0 +1,15 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify +// expected-no-diagnostics + +// 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/src/third_party/llvm-project/clang/test/Parser/vector-cast-define.cl b/src/third_party/llvm-project/clang/test/Parser/vector-cast-define.cl new file mode 100644 index 0000000..ec4eba7 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/vector-cast-define.cl
@@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only +// expected-no-diagnostics + +typedef int int3 __attribute__((ext_vector_type(3))); + +void test() +{ + int index = (int3)(1, 2, 3).x * (int3)(3, 2, 1).y; +} +
diff --git a/src/third_party/llvm-project/clang/test/Parser/vsx.c b/src/third_party/llvm-project/clang/test/Parser/vsx.c new file mode 100644 index 0000000..32bc934 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/vsx.c
@@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify %s + +// Legitimate for VSX. +__vector double vv_d1; +vector double v_d2; + +// These should have errors. +__vector long double vv_ld3; // expected-error {{cannot use 'long double' with '__vector'}} +vector long double v_ld4; // expected-error {{cannot use 'long double' with '__vector'}}
diff --git a/src/third_party/llvm-project/clang/test/Parser/warn-cuda-compat.cu b/src/third_party/llvm-project/clang/test/Parser/warn-cuda-compat.cu new file mode 100644 index 0000000..c3aad6f --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/warn-cuda-compat.cu
@@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -Wno-cuda-compat -Werror %s +// RUN: %clang_cc1 -Wcuda-compat -verify %s +// RUN: %clang_cc1 -x c++ -Wcuda-compat -Werror %s + +// Note that this puts the expected lines before the directives to work around +// limitations in the -verify mode. + +void test(int *List, int Length) { +/* expected-warning {{argument to '#pragma unroll' should not be in parentheses in CUDA C/C++}} */#pragma unroll(4) + for (int i = 0; i < Length; ++i) { + List[i] = i; + } +}
diff --git a/src/third_party/llvm-project/clang/test/Parser/warn-dangling-else.cpp b/src/third_party/llvm-project/clang/test/Parser/warn-dangling-else.cpp new file mode 100644 index 0000000..e91af98 --- /dev/null +++ b/src/third_party/llvm-project/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 +} +
diff --git a/src/third_party/llvm-project/clang/test/Parser/warn-semicolon-before-method-body.m b/src/third_party/llvm-project/clang/test/Parser/warn-semicolon-before-method-body.m new file mode 100644 index 0000000..abdf9f2 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/warn-semicolon-before-method-body.m
@@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -fsyntax-only -Wsemicolon-before-method-body -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wsemicolon-before-method-body -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s + +// Allow optional semicolon in objc method definition after method prototype, +// warn about it and suggest a fixit. + +@interface NSObject +@end + +@interface C : NSObject +- (int)z; +@end + +@implementation C +- (int)z; // expected-warning {{semicolon before method body is ignored}} +{ + return 0; +} +@end + +// CHECK: fix-it:"{{.*}}":{15:9-15:10}:"" +
diff --git a/src/third_party/llvm-project/clang/test/Parser/x64-windows-calling-convention-handling.c b/src/third_party/llvm-project/clang/test/Parser/x64-windows-calling-convention-handling.c new file mode 100644 index 0000000..c027663 --- /dev/null +++ b/src/third_party/llvm-project/clang/test/Parser/x64-windows-calling-convention-handling.c
@@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -triple x86_64-windows -fms-compatibility -fsyntax-only -verify %s + +int __cdecl cdecl(int a, int b, int c, int d) { // expected-no-diagnostics + return a + b + c + d; +} + +float __stdcall stdcall(float a, float b, float c, float d) { // expected-no-diagnostics + return a + b + c + d; +}