summaryrefslogtreecommitdiffstats
path: root/test/Parser
diff options
context:
space:
mode:
Diffstat (limited to 'test/Parser')
-rw-r--r--test/Parser/MicrosoftExtensions.c2
-rw-r--r--test/Parser/MicrosoftExtensions.cpp29
-rw-r--r--test/Parser/captured-statements.c14
-rw-r--r--test/Parser/cxx0x-ambig.cpp6
-rw-r--r--test/Parser/cxx0x-decl.cpp7
-rw-r--r--test/Parser/objc-boxing.m8
-rw-r--r--test/Parser/objc-error-qualified-implementation.m21
-rw-r--r--test/Parser/objcxx11-initialized-temps.mm38
-rw-r--r--test/Parser/pragma-options.c12
-rw-r--r--test/Parser/pragma-pack.c14
10 files changed, 143 insertions, 8 deletions
diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c
index 4c6f4f8..35c63d4 100644
--- a/test/Parser/MicrosoftExtensions.c
+++ b/test/Parser/MicrosoftExtensions.c
@@ -6,7 +6,7 @@ void (*__fastcall fastpfunc)();
struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {}; /* expected-warning{{__declspec attribute 'novtable' is not supported}} */
extern __declspec(dllimport) void __stdcall VarR4FromDec();
__declspec(deprecated) __declspec(deprecated) char * __cdecl ltoa( long _Val, char * _DstBuf, int _Radix);
-__declspec(noalias) __declspec(restrict) void * __cdecl xxx( void * _Memory ); /* expected-warning{{__declspec attribute 'noalias' is not supported}} expected-warning{{__declspec attribute 'restrict' is not supported}} */
+__declspec(safebuffers) __declspec(noalias) __declspec(restrict) void * __cdecl xxx( void * _Memory ); /* expected-warning{{__declspec attribute 'safebuffers' is not supported}} expected-warning{{__declspec attribute 'noalias' is not supported}} expected-warning{{__declspec attribute 'restrict' is not supported}} */
typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR;
void * __ptr64 PtrToPtr64(const void *p)
diff --git a/test/Parser/MicrosoftExtensions.cpp b/test/Parser/MicrosoftExtensions.cpp
index fd38dca..d8a597a 100644
--- a/test/Parser/MicrosoftExtensions.cpp
+++ b/test/Parser/MicrosoftExtensions.cpp
@@ -331,3 +331,32 @@ namespace Inheritance {
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}}
+
+ 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;
+}
diff --git a/test/Parser/captured-statements.c b/test/Parser/captured-statements.c
new file mode 100644
index 0000000..30dddb5
--- /dev/null
+++ b/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/test/Parser/cxx0x-ambig.cpp b/test/Parser/cxx0x-ambig.cpp
index 3b864f9..4c22ed3 100644
--- a/test/Parser/cxx0x-ambig.cpp
+++ b/test/Parser/cxx0x-ambig.cpp
@@ -38,8 +38,8 @@ namespace bitfield {
constexpr T() {}
constexpr T(int) {}
constexpr T(T, T, T, T) {}
- constexpr T operator=(T) { return *this; }
- constexpr operator int() { return 4; }
+ constexpr T operator=(T) const { return *this; }
+ constexpr operator int() const { return 4; }
};
constexpr T a, b, c, d;
@@ -68,7 +68,7 @@ namespace bitfield {
};
struct U {
- constexpr operator T() { return T(); } // expected-note 2{{candidate}}
+ constexpr operator T() const { return T(); } // expected-note 2{{candidate}}
};
// This could be a bit-field.
struct S7 {
diff --git a/test/Parser/cxx0x-decl.cpp b/test/Parser/cxx0x-decl.cpp
index b9441fd..e6cba72 100644
--- a/test/Parser/cxx0x-decl.cpp
+++ b/test/Parser/cxx0x-decl.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fsyntax-only -std=c++11 -pedantic-errors %s
+// 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 {
@@ -46,16 +46,15 @@ using PR14855 = int S::; // expected-error {{expected ';' after alias declaratio
// a constexpr function.
struct ConstexprTrailingReturn {
int n;
- constexpr auto f() -> decltype((n));
+ constexpr auto f() const -> decltype((n));
};
constexpr const int &ConstexprTrailingReturn::f() const { return n; }
namespace TestIsValidAfterTypeSpecifier {
struct s {} v;
-// FIXME: We should accept this once we support thread_local.
struct s
-thread_local tl; // expected-error {{expected unqualified-id}}
+thread_local tl;
struct s
&r0 = v;
diff --git a/test/Parser/objc-boxing.m b/test/Parser/objc-boxing.m
index a16a137..a6bb024 100644
--- a/test/Parser/objc-boxing.m
+++ b/test/Parser/objc-boxing.m
@@ -24,3 +24,11 @@ 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/test/Parser/objc-error-qualified-implementation.m b/test/Parser/objc-error-qualified-implementation.m
new file mode 100644
index 0000000..444fb5d
--- /dev/null
+++ b/test/Parser/objc-error-qualified-implementation.m
@@ -0,0 +1,21 @@
+// 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 can not be protocol qualified}}
+
+@interface J < P,P >
+@end
+
+
+@implementation J < P,P > // expected-error {{@implementation declaration can not be protocol qualified}}
+@end
+
+@interface K @end
+
+@implementation K <P // expected-error {{@implementation declaration can not be protocol qualified}}
+@end // expected-error {{expected '>'}}
diff --git a/test/Parser/objcxx11-initialized-temps.mm b/test/Parser/objcxx11-initialized-temps.mm
new file mode 100644
index 0000000..96f19fe
--- /dev/null
+++ b/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/test/Parser/pragma-options.c b/test/Parser/pragma-options.c
index 7844e71..d168a27 100644
--- a/test/Parser/pragma-options.c
+++ b/test/Parser/pragma-options.c
@@ -20,3 +20,15 @@
#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/test/Parser/pragma-pack.c b/test/Parser/pragma-pack.c
index 84778cd..172a332 100644
--- a/test/Parser/pragma-pack.c
+++ b/test/Parser/pragma-pack.c
@@ -30,3 +30,17 @@
_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;
+};
OpenPOWER on IntegriCloud