[cfe-commits] r54853 - in /cfe/trunk/test: Makefile Sema/cxx-class.cpp Sema/cxx-namespace.cpp Sema/cxx-references.cpp Sema/cxx-this.cpp Sema/cxx-wchar_t.cpp SemaCXX/ SemaCXX/class.cpp SemaCXX/namespace.cpp SemaCXX/references.cpp SemaCXX/this.cpp SemaCXX/wchar_t.cpp

Argiris Kirtzidis akyrtzi at gmail.com
Sat Aug 16 13:53:59 PDT 2008


Author: akirtzidis
Date: Sat Aug 16 15:53:59 2008
New Revision: 54853

URL: http://llvm.org/viewvc/llvm-project?rev=54853&view=rev
Log:
Move the C++ Sema tests into a separate SemaCXX directory.

Added:
    cfe/trunk/test/SemaCXX/
    cfe/trunk/test/SemaCXX/class.cpp
    cfe/trunk/test/SemaCXX/namespace.cpp
    cfe/trunk/test/SemaCXX/references.cpp
    cfe/trunk/test/SemaCXX/this.cpp
    cfe/trunk/test/SemaCXX/wchar_t.cpp
Removed:
    cfe/trunk/test/Sema/cxx-class.cpp
    cfe/trunk/test/Sema/cxx-namespace.cpp
    cfe/trunk/test/Sema/cxx-references.cpp
    cfe/trunk/test/Sema/cxx-this.cpp
    cfe/trunk/test/Sema/cxx-wchar_t.cpp
Modified:
    cfe/trunk/test/Makefile

Modified: cfe/trunk/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Makefile?rev=54853&r1=54852&r2=54853&view=diff

==============================================================================
--- cfe/trunk/test/Makefile (original)
+++ cfe/trunk/test/Makefile Sat Aug 16 15:53:59 2008
@@ -1,7 +1,7 @@
 LEVEL = ../../..
 include $(LEVEL)/Makefile.common
 
-TESTDIRS = CodeGen Lexer Preprocessor Parser Sema SemaObjC Analysis Serialization Rewriter
+TESTDIRS = CodeGen Lexer Preprocessor Parser Sema SemaCXX SemaObjC Analysis Serialization Rewriter
 
 # Only run rewriter tests on darwin.
 ifeq ($(OS),Darwin)

Removed: cfe/trunk/test/Sema/cxx-class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/cxx-class.cpp?rev=54852&view=auto

==============================================================================
--- cfe/trunk/test/Sema/cxx-class.cpp (original)
+++ cfe/trunk/test/Sema/cxx-class.cpp (removed)
@@ -1,70 +0,0 @@
-// RUN: clang -fsyntax-only -verify %s 
-class C {
-public:
-  auto int errx; // expected-error {{error: storage class specified for a member declaration}}
-  register int erry; // expected-error {{error: storage class specified for a member declaration}}
-  extern int errz; // expected-error {{error: storage class specified for a member declaration}}
-
-  static void sm() {
-    sx = 0;
-    this->x = 0; // expected-error {{error: invalid use of 'this' outside of a nonstatic member function}}
-    x = 0; // expected-error {{error: invalid use of member 'x' in static member function}}
-  }
-
-  class NestedC {
-    void m() {
-      sx = 0;
-      x = 0; // expected-error {{error: invalid use of nonstatic data member 'x'}}
-    }
-  };
-
-  int b : 1, w : 2;
-  int : 1, : 2;
-  typedef int E : 1; // expected-error {{error: cannot declare 'E' to be a bit-field type}}
-  static int sb : 1; // expected-error {{error: static member 'sb' cannot be a bit-field}}
-  static int vs;
-
-  typedef int func();
-  func tm;
-  func btm : 1; // expected-error {{error: bit-field 'btm' with non-integral type}}
-  NestedC bc : 1; // expected-error {{error: bit-field 'bc' with non-integral type}}
-
-  enum E { en1, en2 };
-
-  int i = 0; // expected-error {{error: 'i' can only be initialized if it is a static const integral data member}}
-  static int si = 0; // expected-error {{error: 'si' can only be initialized if it is a static const integral data member}}
-  static const NestedC ci = 0; // expected-error {{error: 'ci' can only be initialized if it is a static const integral data member}}
-  static const int nci = vs; // expected-error {{error: initializer element is not a compile-time constant}}
-  static const int vi = 0;
-  static const E evi = 0;
-
-  void m() {
-    sx = 0;
-    this->x = 0;
-    y = 0;
-    this = 0; // expected-error {{error: expression is not assignable}}
-  }
-
-  int f1(int p) {
-   A z = 6;
-   return p + x + this->y + z;
-  }
-
-  typedef int A;
-
-private:
-  int x,y;
-  static int sx;
-};
-
-class C2 {
-  void f() {
-    static int lx;
-    class LC1 {
-      int m() { return lx; }
-    };
-    class LC2 {
-      int m() { return lx; }
-    };
-  }
-};

Removed: cfe/trunk/test/Sema/cxx-namespace.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/cxx-namespace.cpp?rev=54852&view=auto

==============================================================================
--- cfe/trunk/test/Sema/cxx-namespace.cpp (original)
+++ cfe/trunk/test/Sema/cxx-namespace.cpp (removed)
@@ -1,57 +0,0 @@
-// RUN: clang -fsyntax-only -verify %s 
-namespace A { // expected-error {{error: previous definition is here}}
-  int A;
-  void f() { A = 0; }
-}
-
-void f() { A = 0; } // expected-error {{error: unexpected namespace name 'A': expected expression}}
-int A; // expected-error {{error: redefinition of 'A' as different kind of symbol}}
-class A; // expected-error {{error: redefinition of 'A' as different kind of symbol}}
-
-class B {}; // expected-error {{error: previous definition is here}}
-namespace B {} // expected-error {{error: redefinition of 'B' as different kind of symbol}}
-
-void C(); // expected-error {{error: previous definition is here}}
-namespace C {} // expected-error {{error: redefinition of 'C' as different kind of symbol}}
-
-namespace D {
-  class D {};
-}
-
-namespace S1 {
-  int x;
-
-  namespace S2 {
-
-    namespace S3 {
-      B x;
-    }
-  }
-}
-
-namespace S1 {
-  void f() {
-    x = 0;
-  }
-
-  namespace S2 {
-    
-    namespace S3 {
-      void f() {
-        x = 0; // expected-error {{error: incompatible type assigning 'int', expected 'class B'}}
-      }
-    }
-
-    int y;
-  }
-}
-
-namespace S1 {
-  namespace S2 {
-    namespace S3 {
-      void f3() {
-        y = 0;
-      }
-    }
-  }
-}

Removed: cfe/trunk/test/Sema/cxx-references.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/cxx-references.cpp?rev=54852&view=auto

==============================================================================
--- cfe/trunk/test/Sema/cxx-references.cpp (original)
+++ cfe/trunk/test/Sema/cxx-references.cpp (removed)
@@ -1,28 +0,0 @@
-// RUN: clang -fsyntax-only %s
-int g(int);
-
-void f() {
-  int i;
-  int &r = i;
-  r = 1;
-  int *p = &r;
-  int &rr = r;
-  int (&rg)(int) = g;
-  rg(i);
-  int a[3];
-  int (&ra)[3] = a;
-  ra[1] = i;
-  int *Q;
-  int *& P = Q;
-  P[1] = 1;
-}
-
-typedef int t[1];
-void test2() {
-    t a;
-    t& b = a;
-
-
-    int c[3];
-    int (&rc)[3] = c;
-}

Removed: cfe/trunk/test/Sema/cxx-this.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/cxx-this.cpp?rev=54852&view=auto

==============================================================================
--- cfe/trunk/test/Sema/cxx-this.cpp (original)
+++ cfe/trunk/test/Sema/cxx-this.cpp (removed)
@@ -1,6 +0,0 @@
-// RUN: clang -fsyntax-only -verify %s 
-int x = this; // expected-error {{error: invalid use of 'this' outside of a nonstatic member function}}
-
-void f() {
-  int x = this; // expected-error {{error: invalid use of 'this' outside of a nonstatic member function}}
-}

Removed: cfe/trunk/test/Sema/cxx-wchar_t.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/cxx-wchar_t.cpp?rev=54852&view=auto

==============================================================================
--- cfe/trunk/test/Sema/cxx-wchar_t.cpp (original)
+++ cfe/trunk/test/Sema/cxx-wchar_t.cpp (removed)
@@ -1,8 +0,0 @@
-// RUN: clang -fsyntax-only -pedantic -verify %s 
-wchar_t x;
-
-void f(wchar_t p) {
-  wchar_t x;
-  unsigned wchar_t y; // expected-warning {{'wchar_t' cannot be signed or unsigned}}
-  signed wchar_t z; // expected-warning {{'wchar_t' cannot be signed or unsigned}}
-}

Added: cfe/trunk/test/SemaCXX/class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/class.cpp?rev=54853&view=auto

==============================================================================
--- cfe/trunk/test/SemaCXX/class.cpp (added)
+++ cfe/trunk/test/SemaCXX/class.cpp Sat Aug 16 15:53:59 2008
@@ -0,0 +1,70 @@
+// RUN: clang -fsyntax-only -verify %s 
+class C {
+public:
+  auto int errx; // expected-error {{error: storage class specified for a member declaration}}
+  register int erry; // expected-error {{error: storage class specified for a member declaration}}
+  extern int errz; // expected-error {{error: storage class specified for a member declaration}}
+
+  static void sm() {
+    sx = 0;
+    this->x = 0; // expected-error {{error: invalid use of 'this' outside of a nonstatic member function}}
+    x = 0; // expected-error {{error: invalid use of member 'x' in static member function}}
+  }
+
+  class NestedC {
+    void m() {
+      sx = 0;
+      x = 0; // expected-error {{error: invalid use of nonstatic data member 'x'}}
+    }
+  };
+
+  int b : 1, w : 2;
+  int : 1, : 2;
+  typedef int E : 1; // expected-error {{error: cannot declare 'E' to be a bit-field type}}
+  static int sb : 1; // expected-error {{error: static member 'sb' cannot be a bit-field}}
+  static int vs;
+
+  typedef int func();
+  func tm;
+  func btm : 1; // expected-error {{error: bit-field 'btm' with non-integral type}}
+  NestedC bc : 1; // expected-error {{error: bit-field 'bc' with non-integral type}}
+
+  enum E { en1, en2 };
+
+  int i = 0; // expected-error {{error: 'i' can only be initialized if it is a static const integral data member}}
+  static int si = 0; // expected-error {{error: 'si' can only be initialized if it is a static const integral data member}}
+  static const NestedC ci = 0; // expected-error {{error: 'ci' can only be initialized if it is a static const integral data member}}
+  static const int nci = vs; // expected-error {{error: initializer element is not a compile-time constant}}
+  static const int vi = 0;
+  static const E evi = 0;
+
+  void m() {
+    sx = 0;
+    this->x = 0;
+    y = 0;
+    this = 0; // expected-error {{error: expression is not assignable}}
+  }
+
+  int f1(int p) {
+   A z = 6;
+   return p + x + this->y + z;
+  }
+
+  typedef int A;
+
+private:
+  int x,y;
+  static int sx;
+};
+
+class C2 {
+  void f() {
+    static int lx;
+    class LC1 {
+      int m() { return lx; }
+    };
+    class LC2 {
+      int m() { return lx; }
+    };
+  }
+};

Added: cfe/trunk/test/SemaCXX/namespace.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/namespace.cpp?rev=54853&view=auto

==============================================================================
--- cfe/trunk/test/SemaCXX/namespace.cpp (added)
+++ cfe/trunk/test/SemaCXX/namespace.cpp Sat Aug 16 15:53:59 2008
@@ -0,0 +1,57 @@
+// RUN: clang -fsyntax-only -verify %s 
+namespace A { // expected-error {{error: previous definition is here}}
+  int A;
+  void f() { A = 0; }
+}
+
+void f() { A = 0; } // expected-error {{error: unexpected namespace name 'A': expected expression}}
+int A; // expected-error {{error: redefinition of 'A' as different kind of symbol}}
+class A; // expected-error {{error: redefinition of 'A' as different kind of symbol}}
+
+class B {}; // expected-error {{error: previous definition is here}}
+namespace B {} // expected-error {{error: redefinition of 'B' as different kind of symbol}}
+
+void C(); // expected-error {{error: previous definition is here}}
+namespace C {} // expected-error {{error: redefinition of 'C' as different kind of symbol}}
+
+namespace D {
+  class D {};
+}
+
+namespace S1 {
+  int x;
+
+  namespace S2 {
+
+    namespace S3 {
+      B x;
+    }
+  }
+}
+
+namespace S1 {
+  void f() {
+    x = 0;
+  }
+
+  namespace S2 {
+    
+    namespace S3 {
+      void f() {
+        x = 0; // expected-error {{error: incompatible type assigning 'int', expected 'class B'}}
+      }
+    }
+
+    int y;
+  }
+}
+
+namespace S1 {
+  namespace S2 {
+    namespace S3 {
+      void f3() {
+        y = 0;
+      }
+    }
+  }
+}

Added: cfe/trunk/test/SemaCXX/references.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/references.cpp?rev=54853&view=auto

==============================================================================
--- cfe/trunk/test/SemaCXX/references.cpp (added)
+++ cfe/trunk/test/SemaCXX/references.cpp Sat Aug 16 15:53:59 2008
@@ -0,0 +1,28 @@
+// RUN: clang -fsyntax-only %s
+int g(int);
+
+void f() {
+  int i;
+  int &r = i;
+  r = 1;
+  int *p = &r;
+  int &rr = r;
+  int (&rg)(int) = g;
+  rg(i);
+  int a[3];
+  int (&ra)[3] = a;
+  ra[1] = i;
+  int *Q;
+  int *& P = Q;
+  P[1] = 1;
+}
+
+typedef int t[1];
+void test2() {
+    t a;
+    t& b = a;
+
+
+    int c[3];
+    int (&rc)[3] = c;
+}

Added: cfe/trunk/test/SemaCXX/this.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/this.cpp?rev=54853&view=auto

==============================================================================
--- cfe/trunk/test/SemaCXX/this.cpp (added)
+++ cfe/trunk/test/SemaCXX/this.cpp Sat Aug 16 15:53:59 2008
@@ -0,0 +1,6 @@
+// RUN: clang -fsyntax-only -verify %s 
+int x = this; // expected-error {{error: invalid use of 'this' outside of a nonstatic member function}}
+
+void f() {
+  int x = this; // expected-error {{error: invalid use of 'this' outside of a nonstatic member function}}
+}

Added: cfe/trunk/test/SemaCXX/wchar_t.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/wchar_t.cpp?rev=54853&view=auto

==============================================================================
--- cfe/trunk/test/SemaCXX/wchar_t.cpp (added)
+++ cfe/trunk/test/SemaCXX/wchar_t.cpp Sat Aug 16 15:53:59 2008
@@ -0,0 +1,8 @@
+// RUN: clang -fsyntax-only -pedantic -verify %s 
+wchar_t x;
+
+void f(wchar_t p) {
+  wchar_t x;
+  unsigned wchar_t y; // expected-warning {{'wchar_t' cannot be signed or unsigned}}
+  signed wchar_t z; // expected-warning {{'wchar_t' cannot be signed or unsigned}}
+}





More information about the cfe-commits mailing list