Initial slang.

Change-Id: I4f84a741e5fbc440cd4c251406d2b611a237f713
diff --git a/test/Parser/2008-10-31-parse-noop-failure.c b/test/Parser/2008-10-31-parse-noop-failure.c
new file mode 100755
index 0000000..6df508e
--- /dev/null
+++ b/test/Parser/2008-10-31-parse-noop-failure.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -verify -parse-noop %s
+
+void add_attribute(id) int id; {}
+
diff --git a/test/Parser/CompoundStmtScope.c b/test/Parser/CompoundStmtScope.c
new file mode 100644
index 0000000..4f99103
--- /dev/null
+++ b/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/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c
new file mode 100644
index 0000000..0b2733e
--- /dev/null
+++ b/test/Parser/MicrosoftExtensions.c
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify -fms-extensions -x objective-c++ %s
+__stdcall int func0();
+int __stdcall func();
+typedef int (__cdecl *tptr)();
+void (*__fastcall fastpfunc)();
+extern __declspec(dllimport) void __stdcall VarR4FromDec();
+__declspec(deprecated) __declspec(deprecated) char * __cdecl ltoa( long _Val, char * _DstBuf, int _Radix);
+__declspec(noalias) __declspec(restrict) void * __cdecl xxx( void * _Memory );
+typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR;
+void * __ptr64 PtrToPtr64(const void *p)
+{
+  return((void * __ptr64) (unsigned __int64) (ULONG_PTR)p );
+}
+void __forceinline InterlockedBitTestAndSet (long *Base, long Bit)
+{
+  __asm {
+    mov eax, Bit
+    mov ecx, Base
+    lock bts [ecx], eax
+    setc al
+  };
+}
+
+void *_alloca(int);
+
+void foo() {
+  __declspec(align(16)) int *buffer = (int *)_alloca(9);
+}
+
+typedef bool (__stdcall __stdcall *blarg)(int);
+
+
+// Charify extension.
+#define FOO(x) #@x
+char x = FOO(a);
+
diff --git a/test/Parser/altivec.c b/test/Parser/altivec.c
new file mode 100644
index 0000000..ed14457
--- /dev/null
+++ b/test/Parser/altivec.c
@@ -0,0 +1,93 @@
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s
+
+__vector char vv_c;
+__vector signed char vv_sc;
+__vector unsigned char vv_uc;
+__vector short vv_s;
+__vector signed  short vv_ss;
+__vector unsigned  short vv_us;
+__vector short int vv_si;
+__vector signed short int vv_ssi;
+__vector unsigned short int vv_usi;
+__vector int vv_i;
+__vector signed int vv_sint;
+__vector unsigned int vv_ui;
+__vector float vv_f;
+__vector bool vv_b;
+__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 v_b;
+vector __pixel v_p;
+vector pixel v__p;
+vector int f__r();
+void f_a(vector int a);
+void f_a2(int b, vector int a);
+
+vector int v = (vector int)(-1);
+
+// These should have warnings.
+__vector long vv_l;                 // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector signed long vv_sl;         // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector unsigned long vv_ul;       // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector long int vv_li;            // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector signed long int vv_sli;    // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector unsigned long int vv_uli;  // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector long v_l;                    // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector signed long v_sl;            // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector unsigned long v_ul;          // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector long int v_li;               // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector signed long int v_sli;       // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector unsigned long int v_uli;     // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector long double  vv_ld;        // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+vector long double  v_ld;           // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+
+// These should have errors.
+__vector double vv_d;               // expected-error {{cannot use 'double' with '__vector'}}
+__vector double vv_d;               // expected-error {{cannot use 'double' with '__vector'}}
+vector double v_d;                  // expected-error {{cannot use 'double' with '__vector'}}
+vector double v_d;                  // expected-error {{cannot use 'double' with '__vector'}}
+__vector long double  vv_ld;        // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+vector long double  v_ld;           // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+
+void f() {
+  __vector unsigned int v = {0,0,0,0};
+  __vector int v__cast = (__vector int)v;
+  __vector int v_cast = (vector int)v;
+  __vector char vb_cast = (vector char)v;
+
+  // Check some casting between gcc and altivec vectors.
+  #define gccvector __attribute__((vector_size(16)))
+  gccvector unsigned int gccv = {0,0,0,0};
+  gccvector unsigned int gccv1 = gccv;
+  gccvector int gccv2 = (gccvector int)gccv;
+  gccvector unsigned int gccv3 = v;
+  __vector unsigned int av = gccv;
+  __vector int avi = (__vector int)gccv;
+  gccvector unsigned int gv = v;
+  gccvector int gvi = (gccvector int)v;
+  __attribute__((vector_size(8))) unsigned int gv8;
+  gv8 = gccv;     // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}}
+  av = gv8;       // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}}
+
+  v = gccv;
+  __vector unsigned int tv = gccv;
+  gccv = v;
+  gccvector unsigned int tgv = v;
+}
diff --git a/test/Parser/argument_qualified.c b/test/Parser/argument_qualified.c
new file mode 100644
index 0000000..7d1b9fd
--- /dev/null
+++ b/test/Parser/argument_qualified.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 %s
+int abc (const float x) {
+  return 1;
+}
+
diff --git a/test/Parser/argument_redef.c b/test/Parser/argument_redef.c
new file mode 100644
index 0000000..519e8fd
--- /dev/null
+++ b/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/test/Parser/argument_scope.c b/test/Parser/argument_scope.c
new file mode 100644
index 0000000..d2d10c2
--- /dev/null
+++ b/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/test/Parser/asm.c b/test/Parser/asm.c
new file mode 100644
index 0000000..df2e16f
--- /dev/null
+++ b/test/Parser/asm.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f1() {
+  asm ("ret" : : :); // expected-error {{expected string literal}}
+}
+
+void f2() {
+  asm("foo" : "=r" (a)); // expected-error {{use of undeclared identifier 'a'}}
+  asm("foo" : : "r" (b)); // expected-error {{use of undeclared identifier 'b'}} 
+}
+
+
+// rdar://5952468
+__asm ; // expected-error {{expected '(' after 'asm'}}
+
diff --git a/test/Parser/attributes.c b/test/Parser/attributes.c
new file mode 100644
index 0000000..b287363
--- /dev/null
+++ b/test/Parser/attributes.c
@@ -0,0 +1,58 @@
+// 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();
diff --git a/test/Parser/bad-control.c b/test/Parser/bad-control.c
new file mode 100644
index 0000000..480d81b
--- /dev/null
+++ b/test/Parser/bad-control.c
@@ -0,0 +1,9 @@
+/* RUN: %clang_cc1 -fsyntax-only -verify %s
+*/
+void foo() { 
+  break; /* expected-error {{'break' statement not in loop or switch statement}} */
+}
+
+void foo2() { 
+  continue; /* expected-error {{'continue' statement not in loop statement}} */
+}
diff --git a/test/Parser/block-block-storageclass.c b/test/Parser/block-block-storageclass.c
new file mode 100644
index 0000000..a4efc44
--- /dev/null
+++ b/test/Parser/block-block-storageclass.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -parse-noop %s
+#if 0
+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;
+}
+#endif
diff --git a/test/Parser/block-pointer-decl.c b/test/Parser/block-pointer-decl.c
new file mode 100644
index 0000000..2979b01
--- /dev/null
+++ b/test/Parser/block-pointer-decl.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -parse-noop -fblocks %s
+
+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/test/Parser/builtin_classify_type.c b/test/Parser/builtin_classify_type.c
new file mode 100644
index 0000000..a7c0855
--- /dev/null
+++ b/test/Parser/builtin_classify_type.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct foo { int a; };
+
+int main() {
+  int a;
+  float b;
+  double d;
+  struct foo s;
+
+  static int ary[__builtin_classify_type(a)];
+  static int ary2[(__builtin_classify_type)(a)]; // expected-error{{variable length array declaration can not have 'static' storage duration}}
+  static int ary3[(*__builtin_classify_type)(a)]; // expected-error{{variable length array declaration can not have 'static' storage duration}}
+
+  int result;
+
+  result =  __builtin_classify_type(a);
+  result =  __builtin_classify_type(b);
+  result =  __builtin_classify_type(d);
+  result =  __builtin_classify_type(s);
+}
diff --git a/test/Parser/builtin_types_compatible.c b/test/Parser/builtin_types_compatible.c
new file mode 100644
index 0000000..ac81e7b
--- /dev/null
+++ b/test/Parser/builtin_types_compatible.c
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+extern int funcInt(int);
+extern float funcFloat(float);
+extern double funcDouble(double);
+// figure out why "char *" doesn't work (with gcc, nothing to do with clang)
+//extern void funcCharPtr(char *);
+
+#define func(expr) \
+  do { \
+    typeof(expr) tmp; \
+    if (__builtin_types_compatible_p(typeof(expr), int)) funcInt(tmp); \
+    else if (__builtin_types_compatible_p(typeof(expr), float)) funcFloat(tmp); \
+    else if (__builtin_types_compatible_p(typeof(expr), double)) funcDouble(tmp); \
+  } while (0)
+#define func_choose(expr) \
+  __builtin_choose_expr(__builtin_types_compatible_p(typeof(expr), int), funcInt(expr), \
+    __builtin_choose_expr(__builtin_types_compatible_p(typeof(expr), float), funcFloat(expr), \
+      __builtin_choose_expr(__builtin_types_compatible_p(typeof(expr), double), funcDouble(expr), (void)0)))
+
+static void test()
+{
+  int a;
+  float b;
+  double d;
+
+  func(a);
+  func(b);
+  func(d);
+  a = func_choose(a);
+  b = func_choose(b);
+  d = func_choose(d);
+
+  int c; 
+  struct xx { int a; } x, y;
+  
+  c = __builtin_choose_expr(a+3-7, b, x); // expected-error{{'__builtin_choose_expr' requires a constant expression}}
+  c = __builtin_choose_expr(0, b, x); // expected-error{{assigning to 'int' from incompatible type 'struct xx'}}
+  c = __builtin_choose_expr(5+3-7, b, x);
+  y = __builtin_choose_expr(4+3-7, b, x);
+
+}
+
diff --git a/test/Parser/c-namespace.c b/test/Parser/c-namespace.c
new file mode 100644
index 0000000..fbef09e
--- /dev/null
+++ b/test/Parser/c-namespace.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only %s 
+void bla1() {
+  struct XXX;
+  int XXX;
+}
+
diff --git a/test/Parser/char-literal-printing.c b/test/Parser/char-literal-printing.c
new file mode 100644
index 0000000..5843e5f
--- /dev/null
+++ b/test/Parser/char-literal-printing.c
@@ -0,0 +1,31 @@
+// RUN: %clang_cc1 -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'; }
diff --git a/test/Parser/check-objc2-syntax-1.m b/test/Parser/check-objc2-syntax-1.m
new file mode 100644
index 0000000..3cdf2b0
--- /dev/null
+++ b/test/Parser/check-objc2-syntax-1.m
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@interface Subclass 
++ (int)magicNumber;
+@end
+
+int main (void) {
+  return Subclass.magicNumber;
+}
+
diff --git a/test/Parser/check-syntax-1.m b/test/Parser/check-syntax-1.m
new file mode 100644
index 0000000..db37793
--- /dev/null
+++ b/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/test/Parser/check_cast.c b/test/Parser/check_cast.c
new file mode 100644
index 0000000..790ee40
--- /dev/null
+++ b/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/test/Parser/compound_literal.c b/test/Parser/compound_literal.c
new file mode 100644
index 0000000..4f3609d
--- /dev/null
+++ b/test/Parser/compound_literal.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+int main() {
+  char *s;
+  s = (char []){"whatever"}; 
+}
diff --git a/test/Parser/control-scope.c b/test/Parser/control-scope.c
new file mode 100644
index 0000000..5314980
--- /dev/null
+++ b/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/test/Parser/cxx-altivec.cpp b/test/Parser/cxx-altivec.cpp
new file mode 100644
index 0000000..66d4f32
--- /dev/null
+++ b/test/Parser/cxx-altivec.cpp
@@ -0,0 +1,109 @@
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s
+// This is the same as the C version:
+
+__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 vv_b;
+__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 v_b;
+vector __pixel v_p;
+vector pixel v__p;
+vector int f__r();
+void f_a(vector int a);
+void f_a2(int b, vector int a);
+
+vector int v = (vector int)(-1);
+
+// These should have warnings.
+__vector long vv_l;                 // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector signed long vv_sl;         // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector unsigned long vv_ul;       // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector long int vv_li;            // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector signed long int vv_sli;    // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector unsigned long int vv_uli;  // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector long v_l;                    // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector signed long v_sl;            // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector unsigned long v_ul;          // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector long int v_li;               // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector signed long int v_sli;       // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+vector unsigned long int v_uli;     // expected-warning {{Use of 'long' with '__vector' is deprecated}}
+__vector long double  vv_ld;        // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+vector long double  v_ld;           // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+
+// These should have errors.
+__vector double vv_d1;               // expected-error {{cannot use 'double' with '__vector'}}
+vector double v_d2;                  // expected-error {{cannot use 'double' with '__vector'}}
+__vector long double  vv_ld3;        // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+vector long double  v_ld4;           // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}}
+
+void f() {
+  __vector unsigned int v = {0,0,0,0};
+  __vector int v__cast = (__vector int)v;
+  __vector int v_cast = (vector int)v;
+  __vector char vb_cast = (vector char)v;
+
+  // Check some casting between gcc and altivec vectors.
+  #define gccvector __attribute__((vector_size(16)))
+  gccvector unsigned int gccv = {0,0,0,0};
+  gccvector unsigned int gccv1 = gccv;
+  gccvector int gccv2 = (gccvector int)gccv;
+  gccvector unsigned int gccv3 = v;
+  __vector unsigned int av = gccv;
+  __vector int avi = (__vector int)gccv;
+  gccvector unsigned int gv = v;
+  gccvector int gvi = (gccvector int)v;
+  __attribute__((vector_size(8))) unsigned int gv8;
+  gv8 = gccv;     // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}}
+  av = gv8;       // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}}
+
+  v = gccv;
+  __vector unsigned int tv = gccv;
+  gccv = v;
+  gccvector unsigned int tgv = v;
+}
+
+// Now for the C++ version:
+
+class vc__v {
+  __vector int v;
+  __vector int f__r();
+  void f__a(__vector int a);
+  void f__a2(int b, __vector int a);
+};
+
+class c_v {
+  vector int v;
+  vector int f__r();
+  void f__a(vector int a);
+  void f__a2(int b, vector int a);
+};
+
diff --git a/test/Parser/cxx-ambig-paren-expr.cpp b/test/Parser/cxx-ambig-paren-expr.cpp
new file mode 100644
index 0000000..3988205
--- /dev/null
+++ b/test/Parser/cxx-ambig-paren-expr.cpp
@@ -0,0 +1,66 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+
+void f() {
+  typedef int T;
+  int x, *px;
+  
+  // Type id.
+  (T())x;    // expected-error {{cast from 'int' to 'T ()'}}
+  (T())+x;   // expected-error {{cast from 'int' to 'T ()'}}
+  (T())*px;  // expected-error {{cast from 'int' to 'T ()'}}
+  
+  // Expression.
+  x = (T());
+  x = (T())/x;
+
+  typedef int *PT;
+  // Make sure stuff inside the parens are parsed only once (only one warning).
+  x = (PT()[(int){1}]); // expected-warning {{compound literals}}
+
+  // Special case: empty parens is a call, not an expression
+  struct S{int operator()();};
+  (S())();
+
+  // FIXME: Special case: "++" is postfix here, not prefix
+  // (S())++;
+}
+
+// Make sure we do tentative parsing correctly in conditions.
+typedef int type;
+struct rec { rec(int); };
+
+namespace ns {
+  typedef int type;
+  struct rec { rec(int); };
+}
+
+struct cls {
+  typedef int type;
+  struct rec { rec(int); };
+};
+
+struct result {
+  template <class T> result(T);
+  bool check();
+};
+
+void test(int i) {
+  if (result((cls::type) i).check())
+    return;
+
+  if (result((ns::type) i).check())
+    return;
+
+  if (result((::type) i).check())
+    return;
+
+  if (result((cls::rec) i).check())
+    return;
+
+  if (result((ns::rec) i).check())
+    return;
+
+  if (result((::rec) i).check())
+    return;
+}
+
diff --git a/test/Parser/cxx-attributes.cpp b/test/Parser/cxx-attributes.cpp
new file mode 100644
index 0000000..192193a
--- /dev/null
+++ b/test/Parser/cxx-attributes.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s

+

+class c {

+  virtual void f1(const char* a, ...)

+    __attribute__ (( __format__(__printf__,2,3) )) = 0;

+  virtual void f2(const char* a, ...)

+    __attribute__ (( __format__(__printf__,2,3) )) {}

+};

+

diff --git a/test/Parser/cxx-bool.cpp b/test/Parser/cxx-bool.cpp
new file mode 100644
index 0000000..a8a161e
--- /dev/null
+++ b/test/Parser/cxx-bool.cpp
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -fsyntax-only %s
+
+bool a = true;
+bool b = false;
diff --git a/test/Parser/cxx-casting.cpp b/test/Parser/cxx-casting.cpp
new file mode 100644
index 0000000..c8b4716
--- /dev/null
+++ b/test/Parser/cxx-casting.cpp
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1 -fsyntax-only %s
+
+char *const_cast_test(const char *var)
+{
+  return const_cast<char*>(var);
+}
+
+#if 0
+// FIXME: Uncomment when C++ is supported more.
+struct A {
+  virtual ~A() {}
+};
+
+struct B : public A {
+};
+
+struct B *dynamic_cast_test(struct A *a)
+{
+  return dynamic_cast<struct B*>(a);
+}
+#endif
+
+char *reinterpret_cast_test()
+{
+  return reinterpret_cast<char*>(0xdeadbeef);
+}
+
+double static_cast_test(int i)
+{
+  return static_cast<double>(i);
+}
+
+char postfix_expr_test()
+{
+  return reinterpret_cast<char*>(0xdeadbeef)[0];
+}
diff --git a/test/Parser/cxx-class.cpp b/test/Parser/cxx-class.cpp
new file mode 100644
index 0000000..4abbbc5
--- /dev/null
+++ b/test/Parser/cxx-class.cpp
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+class C;
+class C {
+public:
+protected:
+  typedef int A,B;
+  static int sf(), u;
+
+  struct S {};
+  enum {};
+  int; // expected-warning {{declaration does not declare anything}}
+  int : 1, : 2;
+
+public:
+  void m() {
+    int l = 2;
+  }
+  virtual int vf() const volatile = 0;
+  
+private:
+  int x,f(),y,g();
+  inline int h();
+  static const int sci = 10;
+  mutable int mi;
+};
+void glo()
+{
+  struct local {};
+}
+
+// PR3177
+typedef union {
+  __extension__ union {
+    int a;
+    float b;
+  } y;
+} bug3177;
+
diff --git a/test/Parser/cxx-condition.cpp b/test/Parser/cxx-condition.cpp
new file mode 100644
index 0000000..a3991c4
--- /dev/null
+++ b/test/Parser/cxx-condition.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -parse-noop -verify %s
+
+void f() {
+  int a;
+  while (a) ;
+  while (int x) ; // expected-error {{expected '=' after declarator}}
+  while (float x = 0) ;
+  if (const int x = a) ;
+  switch (int x = a+10) {}
+  for (; int x = ++a; ) ;
+}
diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp
new file mode 100644
index 0000000..ae004ce
--- /dev/null
+++ b/test/Parser/cxx-decl.cpp
@@ -0,0 +1,74 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s
+
+int x(*g); // expected-error {{use of undeclared identifier 'g'}}
+
+struct Type {
+  int Type;
+};
+
+
+// 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;
+  }
+};
+
+enum { fooenum = 1 };
+
+struct a {
+  int Type : fooenum;
+};
+
+void test(struct Type *P) {
+  int Type;
+  Type = 1 ? P->Type : Type;
+  
+  Type = (y:b) 4;   // expected-error {{unexpected ':' in nested name specifier}}
+  Type = 1 ? (
+              (y:b)  // expected-error {{unexpected ':' in nested name specifier}}
+              4) : 5;
+}
+
+struct test4 {
+  int x  // expected-error {{expected ';' at end of declaration list}}
+  int y;
+  int z  // expected-error {{expected ';' at end of declaration list}}
+};
+
+// PR5825
+struct test5 {};
+::new(static_cast<void*>(0)) test5; // expected-error {{expected unqualified-id}}
+
+
+// PR6782
+template<class T>
+class Class1;
+
+class Class2 {
+}  // no ;
+
+typedef Class1<Class2> Type1; // expected-error {{cannot combine with previous 'class' declaration specifier}}
diff --git a/test/Parser/cxx-default-args.cpp b/test/Parser/cxx-default-args.cpp
new file mode 100644
index 0000000..a084fb0
--- /dev/null
+++ b/test/Parser/cxx-default-args.cpp
@@ -0,0 +1,9 @@
+// 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'}}
+};
+
diff --git a/test/Parser/cxx-exception-spec.cpp b/test/Parser/cxx-exception-spec.cpp
new file mode 100644
index 0000000..e6c3c75
--- /dev/null
+++ b/test/Parser/cxx-exception-spec.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only  %s
+
+struct X { };
+
+struct Y { };
+
+void f() throw() { }
+
+void g(int) throw(X) { }
+
+void h() throw(X, Y) { }
+
+class Class {
+  void foo() throw (X, Y) { }
+};
+
+void (*fptr)() throw();
diff --git a/test/Parser/cxx-extern-c-array.cpp b/test/Parser/cxx-extern-c-array.cpp
new file mode 100644
index 0000000..14912fd
--- /dev/null
+++ b/test/Parser/cxx-extern-c-array.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+extern "C" int myarray[];
+int myarray[12] = {0};
+
+extern "C" int anotherarray[][3];
+int anotherarray[2][3] = {1,2,3,4,5,6};
diff --git a/test/Parser/cxx-friend.cpp b/test/Parser/cxx-friend.cpp
new file mode 100644
index 0000000..59350b5
--- /dev/null
+++ b/test/Parser/cxx-friend.cpp
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+class C {
+  friend class D;
+};
+
+class A {
+public:
+  void f();
+};
+
+friend int x; // expected-error {{'friend' used outside of class}}
+
+friend class D {}; // expected-error {{'friend' used outside of class}}
+
+union U {
+  int u1;
+};
+
+class B {
+  // 'A' here should refer to the declaration above.  
+  friend class A;
+
+  friend C; // expected-warning {{must specify 'class' to befriend}}
+  friend U; // expected-warning {{must specify 'union' to befriend}}
+  friend int; // expected-warning {{non-class type 'int' cannot be a friend}}
+
+  friend void myfunc();
+
+  void f(A *a) { a->f(); }
+};
+
+
+
+
+
+template <typename t1, typename t2> class some_template;
+friend   // expected-error {{'friend' used outside of class}}
+some_template<foo, bar>&  // expected-error {{use of undeclared identifier 'foo'}}
+  ;  // expected-error {{expected unqualified-id}}
diff --git a/test/Parser/cxx-member-initializers.cpp b/test/Parser/cxx-member-initializers.cpp
new file mode 100644
index 0000000..34a725f
--- /dev/null
+++ b/test/Parser/cxx-member-initializers.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct x {
+  x() : a(4) ; // expected-error {{expected '{'}}
+};
+
+struct y {
+  int a;
+  y() : a(4) ; // expected-error {{expected '{'}}
+};
diff --git a/test/Parser/cxx-namespace-alias.cpp b/test/Parser/cxx-namespace-alias.cpp
new file mode 100644
index 0000000..2e4d7af
--- /dev/null
+++ b/test/Parser/cxx-namespace-alias.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -parse-noop -verify %s
+
+namespace A = B;
+
+namespace A = !; // expected-error {{expected namespace name}}
+namespace A = A::!; // expected-error {{expected namespace name}}
+
+
diff --git a/test/Parser/cxx-reference.cpp b/test/Parser/cxx-reference.cpp
new file mode 100644
index 0000000..46f9fb0
--- /dev/null
+++ b/test/Parser/cxx-reference.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+extern char *bork;
+char *& bar = bork;
+
+int val;
+
+void foo(int &a) {
+}
+
+typedef int & A;
+
+void g(const A aref) {
+}
+
+int & const X = val; // expected-error {{'const' qualifier may not be applied to a reference}}
+int & volatile Y = val; // expected-error {{'volatile' qualifier may not be applied to a reference}}
+int & const volatile Z = val; /* expected-error {{'const' qualifier may not be applied}} \
+                           expected-error {{'volatile' qualifier may not be applied}} */
+
+typedef int && RV; // expected-error {{rvalue references are only allowed in C++0x}}
diff --git a/test/Parser/cxx-stmt.cpp b/test/Parser/cxx-stmt.cpp
new file mode 100644
index 0000000..fdd573e
--- /dev/null
+++ b/test/Parser/cxx-stmt.cpp
@@ -0,0 +1,60 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f1()
+{
+  try {
+    ;
+  } catch(int i) {
+    ;
+  } catch(...) {
+  }
+}
+
+void f2()
+{
+  try; // expected-error {{expected '{'}}
+
+  try {}
+  catch; // expected-error {{expected '('}}
+
+  try {}
+  catch (...); // expected-error {{expected '{'}}
+
+  try {}
+  catch {} // expected-error {{expected '('}}
+}
+
+void f3() try {
+} catch(...) {
+}
+
+struct A {
+  int i;
+  A(int);
+  A(char);
+  A() try : i(0) {} catch(...) {}
+  void f() try {} catch(...) {}
+  A(float) : i(0) try {} // expected-error {{expected '{' or ','}}
+};
+
+A::A(char) : i(0) try {} // expected-error {{expected '{' or ','}}
+A::A(int j) try : i(j) {} catch(...) {}
+
+
+
+// PR5740
+struct Type { };
+
+enum { Type } Kind;
+void f4() {
+  int i = 0;
+  switch (Kind) {
+    case Type: i = 7; break;  // no error.
+  }
+}
+
+// PR5500
+void f5() {
+  asm volatile ("":: :"memory");
+  asm volatile ("": ::"memory");
+}
diff --git a/test/Parser/cxx-template-argument.cpp b/test/Parser/cxx-template-argument.cpp
new file mode 100644
index 0000000..532b4c9
--- /dev/null
+++ b/test/Parser/cxx-template-argument.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template<typename T> struct A {};
+
+// Check for template argument lists followed by junk
+// FIXME: The diagnostics here aren't great...
+A<int+> int x; // expected-error {{expected '>'}} expected-error {{expected unqualified-id}}
+A<int x; // expected-error {{expected '>'}}
+
diff --git a/test/Parser/cxx-template-decl.cpp b/test/Parser/cxx-template-decl.cpp
new file mode 100644
index 0000000..3a97efa
--- /dev/null
+++ b/test/Parser/cxx-template-decl.cpp
@@ -0,0 +1,108 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Errors
+export class foo { };   // expected-error {{expected template}}
+template  x;            // expected-error {{C++ requires a type specifier for all declarations}} \
+                        // expected-error {{does not refer}}
+export template x;      // expected-error {{expected '<' after 'template'}}
+export template<class T> class x0; // expected-warning {{exported templates are unsupported}}
+template < ;            // expected-error {{parse error}} expected-warning {{declaration does not declare anything}}
+template <template X> struct Err1; // expected-error {{expected '<' after 'template'}} \
+// expected-error{{extraneous}}
+template <template <typename> > struct Err2;       // expected-error {{expected 'class' before '>'}} \
+// expected-error{{extraneous}}
+template <template <typename> Foo> struct Err3;    // expected-error {{expected 'class' before 'Foo'}} \
+// expected-error{{extraneous}}
+
+// Template function declarations
+template <typename T> void foo();
+template <typename T, typename U> void foo();
+
+// Template function definitions.
+template <typename T> void foo() { }
+
+// Template class (forward) declarations
+template <typename T> struct A;
+template <typename T, typename U> struct b;
+template <typename> struct C;
+template <typename, typename> struct D;
+
+// Forward declarations with default parameters?
+template <typename T = int> class X1;
+template <typename = int> class X2;
+
+// Forward declarations w/template template parameters
+template <template <typename> class T> class TTP1;
+template <template <typename> class> class TTP2;
+template <template <typename> class T = foo> class TTP3; // expected-error{{must be a class template}}
+template <template <typename> class = foo> class TTP3; // expected-error{{must be a class template}}
+template <template <typename X, typename Y> class T> class TTP5;
+
+// Forward declarations with non-type params
+template <int> class NTP0;
+template <int N> class NTP1;
+template <int N = 5> class NTP2;
+template <int = 10> class NTP3;
+template <unsigned int N = 12u> class NTP4; 
+template <unsigned int = 12u> class NTP5;
+template <unsigned = 15u> class NTP6;
+template <typename T, T Obj> class NTP7;
+
+// Template class declarations
+template <typename T> struct A { };
+template <typename T, typename U> struct B { };
+
+// Template parameter shadowing
+template<typename T, // expected-note{{template parameter is declared here}}
+         typename T> // expected-error{{declaration of 'T' shadows template parameter}}
+  void shadow1();
+
+template<typename T> // expected-note{{template parameter is declared here}}
+void shadow2(int T); // expected-error{{declaration of 'T' shadows template parameter}}
+
+template<typename T> // expected-note{{template parameter is declared here}}
+class T { // expected-error{{declaration of 'T' shadows template parameter}}
+};
+
+template<int Size> // expected-note{{template parameter is declared here}}
+void shadow3(int Size); // expected-error{{declaration of 'Size' shadows template parameter}}
+
+// <rdar://problem/6952203>
+template<typename T> // expected-note{{here}}
+struct shadow4 {
+  int T; // expected-error{{shadows}}
+};
+
+template<typename T> // expected-note{{here}}
+struct shadow5 {
+  int T(int, float); // expected-error{{shadows}}
+};
+
+// Non-type template parameters in scope
+template<int Size> 
+void f(int& i) {
+  i = Size;
+  Size = i; // expected-error{{expression is not assignable}}
+}
+
+template<typename T>
+const T& min(const T&, const T&);
+
+void f2() {
+  int x;
+  A< typeof(x>1) > a;
+}
+
+
+// PR3844
+template <> struct S<int> { }; // expected-error{{explicit specialization of non-template struct 'S'}}
+
+namespace PR6184 {
+  namespace N {
+    template <typename T>
+    void bar(typename T::x);
+  }
+  
+  template <typename T>
+  void N::bar(typename T::x) { }
+}
diff --git a/test/Parser/cxx-throw.cpp b/test/Parser/cxx-throw.cpp
new file mode 100644
index 0000000..a878816
--- /dev/null
+++ b/test/Parser/cxx-throw.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int i;
+
+void foo() {
+  (throw,throw);
+  (1 ? throw 1 : throw 2);
+  throw int(1);
+  throw;
+  throw 1;
+  throw;
+  1 ? throw : (void)42;
+  __extension__ throw 1;    // expected-error {{expected expression}}
+  (void)throw;              // expected-error {{expected expression}}
+}
diff --git a/test/Parser/cxx-typeid.cpp b/test/Parser/cxx-typeid.cpp
new file mode 100644
index 0000000..a825dc3
--- /dev/null
+++ b/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 {{error: expected '(' after 'typeid'}}
+}
diff --git a/test/Parser/cxx-typeof.cpp b/test/Parser/cxx-typeof.cpp
new file mode 100644
index 0000000..7e89101
--- /dev/null
+++ b/test/Parser/cxx-typeof.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+static void test() {
+  int *pi;
+  int x;
+  typeof pi[x] y; 
+}
diff --git a/test/Parser/cxx-using-declaration.cpp b/test/Parser/cxx-using-declaration.cpp
new file mode 100644
index 0000000..2b2a69d
--- /dev/null
+++ b/test/Parser/cxx-using-declaration.cpp
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+namespace A {
+    int VA;
+    void FA() {}
+    struct SA { int V; };
+}
+
+using A::VA;
+using A::FA;
+using typename A::SA;
+
+int main()
+{
+    VA = 1;
+    FA();
+    SA x;   //Still needs handling.
+}
+
+struct B {
+    void f(char){};
+    void g(char){};
+};
+struct D : B {
+    using B::f;
+    void f(int);
+    void g(int);
+};
+void D::f(int) { f('c'); } // calls B::f(char)
+void D::g(int) { g('c'); } // recursively calls D::g(int)
+
+namespace E {
+    template <typename TYPE> int funcE(TYPE arg) { return(arg); }
+}
+
+using E::funcE<int>; // expected-error{{using declaration can not refer to a template specialization}}
+
+namespace F {
+    struct X;
+}
+
+using F::X;
+// Should have some errors here.  Waiting for implementation.
+void X(int);
+struct X *x;
diff --git a/test/Parser/cxx-using-directive.cpp b/test/Parser/cxx-using-directive.cpp
new file mode 100644
index 0000000..1e91899
--- /dev/null
+++ b/test/Parser/cxx-using-directive.cpp
@@ -0,0 +1,40 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+class A {};
+
+namespace B {
+  namespace A {}
+  using namespace A ;
+}
+
+namespace C {}
+
+namespace D {
+  
+  class C {
+    
+    using namespace B ; // expected-error{{not allowed}}
+  };
+  
+  namespace B {}
+  
+  using namespace C ;
+  using namespace B::A ; // expected-error{{expected namespace name}}
+  //FIXME: would be nice to note, that A is not member of D::B
+  using namespace ::B::A ;
+  using namespace ::D::C ; // expected-error{{expected namespace name}}
+}
+
+using namespace ! ; // expected-error{{expected namespace name}}
+using namespace A ; // expected-error{{expected namespace name}}
+using namespace ::A // expected-error{{expected namespace name}} \
+                    // expected-error{{expected ';' after namespace name}}
+                    B ; 
+
+void test_nslookup() {
+  int B;
+  class C;
+  using namespace B;
+  using namespace C;
+}
+
diff --git a/test/Parser/cxx-variadic-func.cpp b/test/Parser/cxx-variadic-func.cpp
new file mode 100644
index 0000000..b9360d6
--- /dev/null
+++ b/test/Parser/cxx-variadic-func.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only  %s
+
+void f(...) {
+  int g(int(...));
+}
diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp
new file mode 100644
index 0000000..67b2ea6
--- /dev/null
+++ b/test/Parser/cxx0x-attributes.cpp
@@ -0,0 +1,61 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+
+// Declaration syntax checks
+[[]] int before_attr;
+int after_attr [[]];
+int * [[]] ptr_attr;
+int array_attr [1] [[]];
+[[align(8)]] int aligned_attr;
+[[test::valid(for 42 [very] **** '+' symbols went on a trip; the end.)]]
+  int garbage_attr;
+void fn_attr () [[]];
+class [[]] class_attr {};
+extern "C++" [[]] int extern_attr;
+template <typename T> [[]] void template_attr ();
+
+int comma_attr [[,]]; // expected-error {{expected identifier}}
+int scope_attr [[foo::]]; // expected-error {{expected identifier}}
+int & [[]] ref_attr = after_attr; // expected-error {{an attribute list cannot appear here}}
+class foo {
+  void after_const_attr () const [[]]; // expected-error {{expected expression}}
+};
+extern "C++" [[]] { } // expected-error {{an attribute list cannot appear here}}
+[[]] template <typename T> void before_template_attr (); // expected-error {{an attribute list cannot appear here}}
+[[]] namespace ns { int i; } // expected-error {{an attribute list cannot appear here}}
+[[]] static_assert(true, ""); //expected-error {{an attribute list cannot appear here}}
+[[]] asm(""); // expected-error {{an attribute list cannot appear here}}
+
+[[]] using ns::i; // expected-error {{an attribute list cannot appear here}}
+[[]] using namespace ns;
+
+// Argument tests
+[[final()]] int final_params; // expected-error {{C++0x attribute 'final' cannot have an argument list}}
+[[align]] int aligned_no_params; // expected-error {{C++0x attribute 'align' must have an argument list}}
+[[align(i)]] int aligned_nonconst; // expected-error {{'aligned' attribute requires integer constant}}
+
+// Statement tests
+void foo () {
+  [[]] ;
+  [[]] { }
+  [[]] if (0) { }
+  [[]] for (;;);
+  [[]] do {
+    [[]] continue;
+  } while (0);
+  [[]] while (0);
+  
+  [[]] switch (i) {
+    [[]] case 0:
+    [[]] default:
+      [[]] break;
+  }
+  
+  [[]] goto there;
+  [[]] there:
+  
+  [[]] try {
+  } [[]] catch (...) { // expected-error {{an attribute list cannot appear here}}
+  }
+  
+  [[]] return;
+}
diff --git a/test/Parser/cxx0x-literal-operators.cpp b/test/Parser/cxx0x-literal-operators.cpp
new file mode 100644
index 0000000..30b2903
--- /dev/null
+++ b/test/Parser/cxx0x-literal-operators.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+
+void operator "" (const char *); // expected-error {{expected identifier}}
+void operator "k" foo(const char *); // expected-error {{string literal after 'operator' must be '""'}}
+void operator "" tester (const char *);
diff --git a/test/Parser/cxx0x-rvalue-reference.cpp b/test/Parser/cxx0x-rvalue-reference.cpp
new file mode 100644
index 0000000..ae568e8
--- /dev/null
+++ b/test/Parser/cxx0x-rvalue-reference.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+
+int && r1(int &&a);
+
+typedef int && R;
+void r2(const R a) {
+  int & &&ar = a; // expected-error{{'ar' declared as a reference to a reference}}
+}
+
diff --git a/test/Parser/declarators.c b/test/Parser/declarators.c
new file mode 100644
index 0000000..31712af
--- /dev/null
+++ b/test/Parser/declarators.c
@@ -0,0 +1,85 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic
+
+extern int a1[];
+
+void f0();
+void f1(int [*]);
+void f2(int [const *]);
+void f3(int [volatile const*]);
+int f4(*XX)(void); /* expected-error {{cannot return}} expected-warning {{type specifier missing, defaults to 'int'}} */
+
+char ((((*X))));
+
+void (*signal(int, void (*)(int)))(int);
+
+int aaaa, ***C, * const D, B(int);
+
+int *A;
+
+struct str;
+
+void test2(int *P, int A) {
+  struct str;
+
+  // Hard case for array decl, not Array[*].
+  int Array[*(int*)P+A];
+}
+
+typedef int atype;
+void test3(x, 
+           atype         /* expected-error {{unexpected type name 'atype': expected identifier}} */
+          ) int x, atype; {}
+
+void test4(x, x) int x; {} /* expected-error {{redefinition of parameter 'x'}} */
+
+
+// PR3031
+int (test5), ;  // expected-error {{expected identifier or '('}}
+
+
+
+// PR3963 & rdar://6759604 - test error recovery for mistyped "typenames".
+
+foo_t *d;      // expected-error {{unknown type name 'foo_t'}}
+foo_t a;   // expected-error {{unknown type name 'foo_t'}}
+int test6() { return a; }  // a should be declared.
+
+// Use of tagged type without tag. rdar://6783347
+struct xyz { int y; };
+enum myenum { ASDFAS };
+xyz b;         // expected-error {{must use 'struct' tag to refer to type 'xyz'}}
+myenum c;      // expected-error {{must use 'enum' tag to refer to type 'myenum'}}
+
+float *test7() {
+  // We should recover 'b' by parsing it with a valid type of "struct xyz", which
+  // allows us to diagnose other bad things done with y, such as this.
+  return &b.y;   // expected-warning {{incompatible pointer types returning 'int *' from a function with result type 'float *'}}
+}
+
+struct xyz test8() { return a; }  // a should be be marked invalid, no diag.
+
+
+// Verify that implicit int still works.
+static f;      // expected-warning {{type specifier missing, defaults to 'int'}}
+static g = 4;  // expected-warning {{type specifier missing, defaults to 'int'}}
+static h        // expected-warning {{type specifier missing, defaults to 'int'}} 
+      __asm__("foo");
+
+
+struct test9 {
+  int x  // expected-error {{expected ';' at end of declaration list}}
+  int y;
+  int z  // expected-warning {{expected ';' at end of declaration list}}
+};
+
+// PR6208
+struct test10 { int a; } static test10x;
+struct test11 { int a; } const test11x;
+
+// PR6216
+void test12() {
+  (void)__builtin_offsetof(struct { char c; int i; }, i);
+}
+
+// rdar://7608537
+struct test13 { int a; } (test13x);
diff --git a/test/Parser/designator.c b/test/Parser/designator.c
new file mode 100644
index 0000000..6badab7
--- /dev/null
+++ b/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/test/Parser/encode.m b/test/Parser/encode.m
new file mode 100644
index 0000000..e0e7535
--- /dev/null
+++ b/test/Parser/encode.m
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int main(void) {
+  const char ch = @encode(char *)[2];
+  char c = @encode(char *)[2] + 4;
+  return c;
+}
+
diff --git a/test/Parser/enhanced-proto-1.m b/test/Parser/enhanced-proto-1.m
new file mode 100644
index 0000000..a3819f3
--- /dev/null
+++ b/test/Parser/enhanced-proto-1.m
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@protocol MyProto1 
+@optional
+- (void) FOO;
+@optional
+- (void) FOO;
+@required 
+- (void) REQ;
+@optional
+@end
+
+@protocol  MyProto2 <MyProto1>
+- (void) FOO2;
+@optional
+- (void) FOO3;
+@end
diff --git a/test/Parser/expressions.c b/test/Parser/expressions.c
new file mode 100644
index 0000000..44ebe66
--- /dev/null
+++ b/test/Parser/expressions.c
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 -parse-noop -verify %s
+
+void test1() {
+  if (sizeof (int){ 1});   // sizeof compound literal
+  if (sizeof (int));       // sizeof type
+
+  (int)4;   // cast.
+  (int){4}; // compound literal.
+
+  // FIXME: change this to the struct version when we can.
+  //int A = (struct{ int a;}){ 1}.a;
+  int A = (int){ 1}.a;
+}
+
+int test2(int a, int b) {
+  return a ? a,b : a;
+}
+
+int test3(int a, int b, int c) {
+  return a = b = c;
+}
+
+int test4() {
+  test4();
+}
+
+int test_offsetof() {
+  // FIXME: change into something that is semantically correct.
+  __builtin_offsetof(int, a.b.c[4][5]);
+}
+
+void test_sizeof(){
+        int arr[10];
+        sizeof arr[0];
+        sizeof(arr[0]);
+        sizeof(arr)[0];
+}
+
+// PR3418
+int test_leading_extension() {
+  __extension__ (*(char*)0) = 1;
+}
+
+// PR3972
+int test5(int);
+int test6(void) { 
+  return test5(      // expected-note {{to match}}
+               test5(1)
+                 ; // expected-error {{expected ')'}}
+}
diff --git a/test/Parser/expressions.m b/test/Parser/expressions.m
new file mode 100644
index 0000000..e27f405
--- /dev/null
+++ b/test/Parser/expressions.m
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -parse-noop %s
+
+void test1() {
+  @"s";            // expected-warning {{expression result unused}}
+}
+
diff --git a/test/Parser/extension.c b/test/Parser/extension.c
new file mode 100644
index 0000000..fd4cf80
--- /dev/null
+++ b/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/test/Parser/function-decls.c b/test/Parser/function-decls.c
new file mode 100644
index 0000000..db9a98b
--- /dev/null
+++ b/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/test/Parser/goto-ident.c b/test/Parser/goto-ident.c
new file mode 100644
index 0000000..32051dc
--- /dev/null
+++ b/test/Parser/goto-ident.c
@@ -0,0 +1,6 @@
+/* RUN: %clang_cc1 -fsyntax-only -verify %s
+*/
+
+void foo() { 
+  goto ; /* expected-error {{expected identifier}} */
+}
diff --git a/test/Parser/if-scope-c90.c b/test/Parser/if-scope-c90.c
new file mode 100644
index 0000000..c368fab
--- /dev/null
+++ b/test/Parser/if-scope-c90.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c90 %s
+
+int f (int z)
+{ 
+  if (z > (int) sizeof (enum {a, b}))
+      return a;
+   return b;
+} 
diff --git a/test/Parser/if-scope-c99.c b/test/Parser/if-scope-c99.c
new file mode 100644
index 0000000..63f82e0
--- /dev/null
+++ b/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/test/Parser/implicit-casts.c b/test/Parser/implicit-casts.c
new file mode 100644
index 0000000..a2b31f9
--- /dev/null
+++ b/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/test/Parser/knr_parameter_attributes.c b/test/Parser/knr_parameter_attributes.c
new file mode 100644
index 0000000..fb975cb
--- /dev/null
+++ b/test/Parser/knr_parameter_attributes.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -W -Wall -Werror -verify %s
+
+int f(int i __attribute__((__unused__)))
+{
+    return 0;
+}
+int g(i)
+    int i __attribute__((__unused__));
+{
+    return 0;
+}
diff --git a/test/Parser/method-prototype-1.m b/test/Parser/method-prototype-1.m
new file mode 100644
index 0000000..d2d9563
--- /dev/null
+++ b/test/Parser/method-prototype-1.m
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 %s -parse-noop
+@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/test/Parser/missing-end.m b/test/Parser/missing-end.m
new file mode 100644
index 0000000..fb26461
--- /dev/null
+++ b/test/Parser/missing-end.m
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@interface AAA
+{
+}
+@ x// expected-error{{expected an Objective-C directive after '@'}}
+// expected-error{{missing @end}}
diff --git a/test/Parser/namelookup-bug-1.c b/test/Parser/namelookup-bug-1.c
new file mode 100644
index 0000000..8667a71
--- /dev/null
+++ b/test/Parser/namelookup-bug-1.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -verify %s
+
+typedef int Object;
+
+struct Object *pp;
+
+Object staticObject1;
diff --git a/test/Parser/namelookup-bug-2.c b/test/Parser/namelookup-bug-2.c
new file mode 100644
index 0000000..84850ff
--- /dev/null
+++ b/test/Parser/namelookup-bug-2.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -verify %s
+
+typedef int Object;
+
+struct Object {int i1; } *P;
+
+void foo() {
+ struct Object { int i2; } *X;
+  Object:
+ {
+    Object a;
+ }
+}
+
diff --git a/test/Parser/namespace-alias-attr.cpp b/test/Parser/namespace-alias-attr.cpp
new file mode 100644
index 0000000..ba80922
--- /dev/null
+++ b/test/Parser/namespace-alias-attr.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -verify %s
+
+namespace A
+{
+}
+
+namespace B __attribute__ (( static )) = A; // expected-error{{attributes can not be specified on namespace alias}}
+
diff --git a/test/Parser/objc-alias-printing.m b/test/Parser/objc-alias-printing.m
new file mode 100644
index 0000000..8b9cc6e
--- /dev/null
+++ b/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/test/Parser/objc-category-neg-1.m b/test/Parser/objc-category-neg-1.m
new file mode 100644
index 0000000..5799db0
--- /dev/null
+++ b/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/test/Parser/objc-forcollection-1.m b/test/Parser/objc-forcollection-1.m
new file mode 100644
index 0000000..4850deb
--- /dev/null
+++ b/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/test/Parser/objc-forcollection-neg-2.m b/test/Parser/objc-forcollection-neg-2.m
new file mode 100644
index 0000000..e02c51c
--- /dev/null
+++ b/test/Parser/objc-forcollection-neg-2.m
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %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 {
+    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 type}}
+           ++i;
+
+}
+@end
+
diff --git a/test/Parser/objc-forcollection-neg.m b/test/Parser/objc-forcollection-neg.m
new file mode 100644
index 0000000..0ba093e
--- /dev/null
+++ b/test/Parser/objc-forcollection-neg.m
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+typedef struct objc_class *Class;
+typedef struct objc_object {
+ Class isa;
+} *id;
+    
+            
+@interface MyList
+@end
+    
+@implementation MyList
+- (unsigned int)countByEnumeratingWithState:  (struct __objcFastEnumerationState *)state objects:  (id *)items count:(unsigned int)stackcount
+{
+        return 0;
+}
+@end
+
+@interface MyList (BasicTest)
+- (void)compilerTestAgainst;
+@end
+
+@implementation MyList (BasicTest)
+- (void)compilerTestAgainst {
+
+        int i=0;
+        for (int * elem in elem) // expected-error {{selector element type 'int *' is not a valid object}} \
+				    expected-error {{collection expression type 'int *' is not a valid object}}
+           ++i;
+        for (i in elem)  // expected-error {{use of undeclared identifier 'elem'}} \
+			    expected-error {{selector element type 'int' is not a valid object}}
+           ++i;
+        for (id se in i) // expected-error {{collection expression type 'int' is not a valid object}} 
+           ++i;
+}
+@end
+
diff --git a/test/Parser/objc-foreach-syntax.m b/test/Parser/objc-foreach-syntax.m
new file mode 100644
index 0000000..943540e
--- /dev/null
+++ b/test/Parser/objc-foreach-syntax.m
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+
+
+@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/test/Parser/objc-init.m b/test/Parser/objc-init.m
new file mode 100644
index 0000000..32ba948
--- /dev/null
+++ b/test/Parser/objc-init.m
@@ -0,0 +1,60 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -pedantic
+// RUN: %clang_cc1 -fsyntax-only -verify -x objective-c++ %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 {{Objective-C interface type 'NSNumber' cannot be passed by value; did you forget * in 'NSNumber'}}
+	id objects[] = {[x METH]};
+}
+
+void test3(NSNumber *x) {
+	id objects[] = {[x METH]};
+}
+
+
+// rdar://5977581
+void test4() {
+  unsigned x[] = {[NSNumber METH2]+2};
+}
+
+void test5(NSNumber *x) {
+  unsigned y[] = {
+    [4][NSNumber METH2]+2,   // expected-warning {{use of GNU 'missing =' extension in designator}}
+    [4][x METH2]+2   // expected-warning {{use of GNU 'missing =' extension in designator}}
+  };
+  
+  struct SomeStruct z = {
+    .x = [x METH2], // ok.
+    .x [x METH2]    // expected-error {{expected '=' or another designator}}
+  };
+}
+
+// rdar://7370882
+@interface SemicolonsAppDelegate 
+{
+  id i;
+}
+@property (assign) id window;
+@end
+
+@implementation SemicolonsAppDelegate
+{
+  id i;
+}
+  @synthesize window=i;
+@end
+
+
+
diff --git a/test/Parser/objc-interfaces.m b/test/Parser/objc-interfaces.m
new file mode 100644
index 0000000..aac3faa
--- /dev/null
+++ b/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}}
+@end
+
diff --git a/test/Parser/objc-messaging-1.m b/test/Parser/objc-messaging-1.m
new file mode 100644
index 0000000..511290e
--- /dev/null
+++ b/test/Parser/objc-messaging-1.m
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 %s -parse-noop
+int main ()
+{
+	int i,j;
+	struct S *p;
+        id a, b, c;
+	[p ii];
+	[p if: 1 :2];
+	[p inout: 1 :2 another:(2,3,4)];
+	[p inout: 1 :2 another:(2,3,4), 6,6,8];
+	[p inout: 1 :2 another:(2,3,4), (6,4,5),6,8];
+	[p inout: 1 :2 another:(i+10), (i,j-1,5),6,8];
+	[p long: 1 :2 another:(i+10), (i,j-1,5),6,8];
+	[p : "Hello\n" :2 another:(i+10), (i,j-1,5),6,8];
+
+	// Comma expression as receiver (rdar://6222856)
+	[a, b, c foo];
+
+}
diff --git a/test/Parser/objc-messaging-neg-1.m b/test/Parser/objc-messaging-neg-1.m
new file mode 100644
index 0000000..4ddadb8
--- /dev/null
+++ b/test/Parser/objc-messaging-neg-1.m
@@ -0,0 +1,12 @@
+// 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 ':'}}
+}
diff --git a/test/Parser/objc-missing-impl.m b/test/Parser/objc-missing-impl.m
new file mode 100644
index 0000000..05d9d6c
--- /dev/null
+++ b/test/Parser/objc-missing-impl.m
@@ -0,0 +1,2 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+@end // expected-warning {{@end must appear in an @implementation context}}
diff --git a/test/Parser/objc-property-syntax.m b/test/Parser/objc-property-syntax.m
new file mode 100644
index 0000000..064a209
--- /dev/null
+++ b/test/Parser/objc-property-syntax.m
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+@interface MyClass {
+
+};
+@property unsigned char bufferedUTF8Bytes[4];  // expected-error {{property cannot have array or function type}}
+@property unsigned char bufferedUTFBytes:1;    // expected-error {{property name cannot be a bitfield}}
+@property(nonatomic, retain, setter=ab_setDefaultToolbarItems) MyClass *ab_defaultToolbarItems; // expected-error {{method name referenced in property setter attribute must end with ':'}}
+@end
+
+@implementation MyClass
+@dynamic ab_defaultToolbarItems;
+@end
+
diff --git a/test/Parser/objc-quirks.m b/test/Parser/objc-quirks.m
new file mode 100644
index 0000000..b6671d1
--- /dev/null
+++ b/test/Parser/objc-quirks.m
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// FIXME: This is a horrible error message here. Fix.
+int @"s" = 5;  // expected-error {{prefix attribute must be}}
+
+
+// rdar://6480479
+@interface A
+}; // expected-error {{missing @end}} expected-error {{expected external declaration}}
+
+
+
+
+// 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
diff --git a/test/Parser/objc-synthesized-recover.m b/test/Parser/objc-synthesized-recover.m
new file mode 100644
index 0000000..3f04a8c
--- /dev/null
+++ b/test/Parser/objc-synthesized-recover.m
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %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/test/Parser/objc-try-catch-1.m b/test/Parser/objc-try-catch-1.m
new file mode 100644
index 0000000..1934cbd
--- /dev/null
+++ b/test/Parser/objc-try-catch-1.m
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -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)}}
+    }
+    @catch (float x) {  // expected-error {{@catch parameter is not a pointer to an interface type}}
+      
+    }
+    @catch(...) {
+      @throw (4,3,proc());
+    }
+  }
+
+  @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/test/Parser/objc-type-printing.m b/test/Parser/objc-type-printing.m
new file mode 100644
index 0000000..9bbdac9
--- /dev/null
+++ b/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/test/Parser/offsetof.c b/test/Parser/offsetof.c
new file mode 100644
index 0000000..3a5b9f3
--- /dev/null
+++ b/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/test/Parser/parmvardecl_conversion.c b/test/Parser/parmvardecl_conversion.c
new file mode 100644
index 0000000..9fa8a68
--- /dev/null
+++ b/test/Parser/parmvardecl_conversion.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f (int p[]) { p++; }
+
diff --git a/test/Parser/pointer-arithmetic.c b/test/Parser/pointer-arithmetic.c
new file mode 100644
index 0000000..87eb1a2
--- /dev/null
+++ b/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/test/Parser/pointer_promotion.c b/test/Parser/pointer_promotion.c
new file mode 100644
index 0000000..30589d0
--- /dev/null
+++ b/test/Parser/pointer_promotion.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void test() {
+  void *vp;
+  int *ip;
+  char *cp;
+  struct foo *fp;
+  struct bar *bp;
+  short sint = 7;
+
+  if (ip < cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}}
+  if (cp < fp) {} // expected-warning {{comparison of distinct pointer types ('char *' and 'struct foo *')}}
+  if (fp < bp) {} // expected-warning {{comparison of distinct pointer types ('struct foo *' and 'struct bar *')}}
+  if (ip < 7) {} // expected-warning {{comparison between pointer and integer ('int *' and 'int')}}
+  if (sint < ip) {} // expected-warning {{comparison between pointer and integer ('int' and 'int *')}}
+  if (ip == cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}}
+}
diff --git a/test/Parser/pragma-pack.c b/test/Parser/pragma-pack.c
new file mode 100644
index 0000000..84778cd
--- /dev/null
+++ b/test/Parser/pragma-pack.c
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Note that this puts the expected lines before the directives to work around
+// limitations in the -verify mode.
+
+/* expected-warning {{missing '(' after '#pragma pack'}}*/ #pragma pack 10
+#pragma pack()
+#pragma pack(8)
+
+/*expected-warning {{unknown action for '#pragma pack'}}*/ #pragma pack(hello) 
+#pragma pack(push)
+#pragma pack(pop)
+
+/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(push,)
+/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(push,)
+/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/  #pragma pack(pop,) 
+
+#pragma pack(push,i)
+/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(push,i, 
+/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(push,i,) 
+/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ #pragma pack(push,i,help) 
+
+#pragma pack(push,8)
+/* expected-warning {{missing ')' after '#pragma pack'}}*/ #pragma pack(push,8, 
+/* expected-warning {{missing ')' after '#pragma pack'}}*/ #pragma pack(push,8,) 
+/* expected-warning {{missing ')' after '#pragma pack'}}*/ #pragma pack(push,i,8 
+#pragma pack(push,i,8)
+
+/* expected-warning {{missing ')' after '#pragma pack'}}*/ #pragma pack(push 
+
+_Pragma("pack(push)")
+/* expected-warning {{expected integer or identifier in '#pragma pack'}}*/ _Pragma("pack(push,)") 
diff --git a/test/Parser/pragma-weak.c b/test/Parser/pragma-weak.c
new file mode 100644
index 0000000..7e5740b
--- /dev/null
+++ b/test/Parser/pragma-weak.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Note that this puts the expected lines before the directives to work around
+// limitations in the -verify mode.
+
+int x;
+/* expected-warning {{expected identifier in '#pragma weak'}}*/ #pragma weak
+#pragma weak x
+
+extern int z;
+/* expected-warning {{expected identifier in '#pragma weak'}}*/ #pragma weak z = =
+/* expected-warning {{expected identifier in '#pragma weak'}}*/ #pragma weak z =
+/* expected-warning {{weak identifier 'y' never declared}} */ #pragma weak z = y
+
+extern int a;
+/* expected-warning {{extra tokens at end of '#pragma weak'}}*/ #pragma weak a b
+/* expected-warning {{extra tokens at end of '#pragma weak'}}*/ #pragma weak a = x c
diff --git a/test/Parser/prefix-attributes.m b/test/Parser/prefix-attributes.m
new file mode 100644
index 0000000..399421f
--- /dev/null
+++ b/test/Parser/prefix-attributes.m
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s
+
+__attribute__((deprecated)) @class B; // expected-error {{prefix attribute must be followed by an interface or protocol}}
+
+__attribute__((deprecated)) @interface A @end
+__attribute__((deprecated)) @protocol P0;
+__attribute__((deprecated)) @protocol P1
+@end
diff --git a/test/Parser/promote_types_in_proto.c b/test/Parser/promote_types_in_proto.c
new file mode 100644
index 0000000..969ba28
--- /dev/null
+++ b/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/test/Parser/recovery.c b/test/Parser/recovery.c
new file mode 100644
index 0000000..8e7181e
--- /dev/null
+++ b/test/Parser/recovery.c
@@ -0,0 +1,75 @@
+// 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 {{expected external declaration}}
+
+
+// rdar://6094870
+void test(int a) {
+  struct { int i; } x;
+  
+  if (x.hello)   // expected-error {{no member named 'hello'}}
+    test(0);
+  else
+    ;
+  
+  if (x.hello == 0)   // expected-error {{no member named 'hello'}}
+    test(0);
+  else
+    ;
+  
+  if ((x.hello == 0))   // expected-error {{no member named 'hello'}}
+    test(0);
+  else
+    ;
+  
+  if (x.i == 0))   // expected-error {{expected expression}}
+    test(0);
+  else
+    ;
+}
+
+
+
+char ((((                       /* expected-note {{to match this '('}} */
+         *X x ] ))));                    /* expected-error {{expected ')'}} */
+
+;   // expected-warning {{ISO C does not allow an 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}}
+}
diff --git a/test/Parser/selector-1.m b/test/Parser/selector-1.m
new file mode 100644
index 0000000..1f9cad6
--- /dev/null
+++ b/test/Parser/selector-1.m
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -parse-noop %s 
+
+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:);
+}
diff --git a/test/Parser/statements.c b/test/Parser/statements.c
new file mode 100644
index 0000000..bc7192a
--- /dev/null
+++ b/test/Parser/statements.c
@@ -0,0 +1,64 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unreachable-code
+
+void test1() {
+  { ; {  ;;}} ;;
+}
+
+void test2() {
+  if (0) { if (1) {} } else { }
+
+  do { } while (0); 
+  
+  while (0) while(0) do ; while(0);
+
+  for ((void)0;0;(void)0)
+    for (;;)
+      for ((void)9;0;(void)2)
+        ;
+  for (int X = 0; 0; (void)0);
+}
+
+void test3() {
+    switch (0) {
+    
+    case 4:
+      if (0) {
+    case 6: ;
+      }
+    default:
+      ;     
+  }
+}
+
+void test4() {
+  if (0);  // expected-warning {{if statement has empty body}}
+  
+  int X;  // declaration in a block.
+  
+foo:  if (0); // expected-warning {{if statement has empty body}}
+}
+
+typedef int t;
+void test5() {
+  if (0);   // expected-warning {{if statement has empty body}}
+
+  t x = 0;
+
+  if (0);  // expected-warning {{if statement has empty body}}
+}
+
+
+void test6(void) { 
+  do 
+    .           // expected-error {{expected expression}}
+   while (0);
+}
+
+int test7() {
+  return 4     // expected-error {{expected ';' after return statement}}
+}
+
+void test8() {
+  // Should not skip '}' and produce a "expected '}'" error.
+  undecl // expected-error {{use of undeclared identifier 'undecl'}}
+}
diff --git a/test/Parser/struct-recursion.c b/test/Parser/struct-recursion.c
new file mode 100644
index 0000000..834c5d0
--- /dev/null
+++ b/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/test/Parser/top-level-semi-cxx0x.cpp b/test/Parser/top-level-semi-cxx0x.cpp
new file mode 100644
index 0000000..592483c
--- /dev/null
+++ b/test/Parser/top-level-semi-cxx0x.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++0x -verify %s
+
+void foo();
+
+void bar() { };
+
+void wibble();
+
+;
+
+namespace Blah {
+  void f() { };
+  
+  void g();
+}
diff --git a/test/Parser/traditional_arg_scope.c b/test/Parser/traditional_arg_scope.c
new file mode 100644
index 0000000..3811d0d
--- /dev/null
+++ b/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/test/Parser/typeof.c b/test/Parser/typeof.c
new file mode 100644
index 0000000..cf0e47a
--- /dev/null
+++ b/test/Parser/typeof.c
@@ -0,0 +1,19 @@
+// 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;
+}
diff --git a/test/Parser/types.c b/test/Parser/types.c
new file mode 100644
index 0000000..0e8a63d
--- /dev/null
+++ b/test/Parser/types.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -parse-noop
+
+// 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;
+}
+