summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/enum.c4
-rw-r--r--test/CodeGen/indirect-goto.c2
-rw-r--r--test/CodeGen/rdr-6098585-default-after-caserange.c18
-rw-r--r--test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c20
-rw-r--r--test/CodeGen/rdr-6098585-empty-case-range.c23
-rw-r--r--test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c15
-rw-r--r--test/CodeGen/rdr-6098585-unsigned-caserange.c12
-rw-r--r--test/CodeGen/switch.c94
-rw-r--r--test/CodeGenCXX/copy-initialization.cpp29
-rw-r--r--test/CodeGenCXX/derived-to-base-conv.cpp12
-rw-r--r--test/CodeGenCXX/virt.cpp3
-rw-r--r--test/CodeGenCXX/vtable-linkage.cpp6
-rw-r--r--test/Parser/check-syntax-1.m10
-rw-r--r--test/SemaCXX/conditional-expr.cpp27
-rw-r--r--test/SemaCXX/copy-initialization.cpp20
-rw-r--r--test/SemaObjC/class-extension-after-implementation.m11
-rw-r--r--test/SemaObjC/default-synthesize.m16
17 files changed, 215 insertions, 107 deletions
diff --git a/test/CodeGen/enum.c b/test/CodeGen/enum.c
index eab32c1..87b0e1e 100644
--- a/test/CodeGen/enum.c
+++ b/test/CodeGen/enum.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm-bc -o - | opt -std-compile-opts | llvm-dis | grep 'ret i32 6'
-// RUN: %clang_cc1 -triple i386-unknown-unknown -x c++ %s -emit-llvm-bc -o - | opt -std-compile-opts | llvm-dis | grep 'ret i32 7'
+// RUN: %clang_cc1 -triple i386-unknown-unknown %s -O3 -emit-llvm -o - | grep 'ret i32 6'
+// RUN: %clang_cc1 -triple i386-unknown-unknown -x c++ %s -O3 -emit-llvm -o - | grep 'ret i32 7'
static enum { foo, bar = 1U } z;
diff --git a/test/CodeGen/indirect-goto.c b/test/CodeGen/indirect-goto.c
index 9fd8cfa..7a3d717 100644
--- a/test/CodeGen/indirect-goto.c
+++ b/test/CodeGen/indirect-goto.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts -S | grep "ret i32 2520"
+// RUN: %clang_cc1 -triple i386-unknown-unknown -O3 -emit-llvm -o - %s | grep "ret i32 2520"
static int foo(unsigned i) {
void *addrs[] = { &&L1, &&L2, &&L3, &&L4, &&L5 };
diff --git a/test/CodeGen/rdr-6098585-default-after-caserange.c b/test/CodeGen/rdr-6098585-default-after-caserange.c
deleted file mode 100644
index 3a89aa3..0000000
--- a/test/CodeGen/rdr-6098585-default-after-caserange.c
+++ /dev/null
@@ -1,18 +0,0 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
-// RUN: grep "ret i32" %t | count 1
-// RUN: grep "ret i32 10" %t | count 1
-
-// Ensure that default after a case range is not ignored.
-
-static int f1(unsigned x) {
- switch(x) {
- case 10 ... 0xFFFFFFFF:
- return 0;
- default:
- return 10;
- }
-}
-
-int g() {
- return f1(2);
-}
diff --git a/test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c b/test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c
deleted file mode 100644
index ba41b51..0000000
--- a/test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c
+++ /dev/null
@@ -1,20 +0,0 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
-// RUN: grep "ret i32 10" %t
-
-// Ensure that this doesn't compile to infinite loop in g() due to
-// miscompilation of fallthrough from default to a (tested) case
-// range.
-
-static int f0(unsigned x) {
- switch(x) {
- default:
- x += 1;
- case 10 ... 0xFFFFFFFF:
- return 0;
- }
-}
-
-int g() {
- f0(1);
- return 10;
-}
diff --git a/test/CodeGen/rdr-6098585-empty-case-range.c b/test/CodeGen/rdr-6098585-empty-case-range.c
deleted file mode 100644
index 1cf77ac..0000000
--- a/test/CodeGen/rdr-6098585-empty-case-range.c
+++ /dev/null
@@ -1,23 +0,0 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
-// RUN: grep "ret i32" %t | count 2
-// RUN: grep "ret i32 3" %t | count 2
-
-// This generated incorrect code because of poor switch chaining.
-int f1(int x) {
- switch(x) {
- default:
- return 3;
- case 10 ... 0xFFFFFFFF:
- return 0;
- }
-}
-
-// This just asserted because of the way case ranges were calculated.
-int f2(int x) {
- switch (x) {
- default:
- return 3;
- case 10 ... -1:
- return 0;
- }
-}
diff --git a/test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c b/test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c
deleted file mode 100644
index 48a6cc2..0000000
--- a/test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c
+++ /dev/null
@@ -1,15 +0,0 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
-// RUN: grep "ret i32 %" %t
-
-// Make sure return is not constant (if empty range is skipped or miscompiled)
-
-int f0(unsigned x) {
- switch(x) {
- case 2:
- // fallthrough empty range
- case 10 ... 9:
- return 10;
- default:
- return 0;
- }
-}
diff --git a/test/CodeGen/rdr-6098585-unsigned-caserange.c b/test/CodeGen/rdr-6098585-unsigned-caserange.c
deleted file mode 100644
index 6f577df..0000000
--- a/test/CodeGen/rdr-6098585-unsigned-caserange.c
+++ /dev/null
@@ -1,12 +0,0 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
-// RUN: grep "ret i32" %t | count 1
-// RUN: grep "ret i32 3" %t | count 1
-
-int f2(unsigned x) {
- switch(x) {
- default:
- return 3;
- case 0xFFFFFFFF ... 1: // This range should be empty because x is unsigned.
- return 0;
- }
-}
diff --git a/test/CodeGen/switch.c b/test/CodeGen/switch.c
index 519ccba..dc2d27b 100644
--- a/test/CodeGen/switch.c
+++ b/test/CodeGen/switch.c
@@ -100,3 +100,97 @@ void foo7(){
}
}
+
+// CHECK: define i32 @f8(
+// CHECK: ret i32 3
+// CHECK: }
+int f8(unsigned x) {
+ switch(x) {
+ default:
+ return 3;
+ case 0xFFFFFFFF ... 1: // This range should be empty because x is unsigned.
+ return 0;
+ }
+}
+
+// Ensure that default after a case range is not ignored.
+//
+// CHECK: define i32 @f9()
+// CHECK: ret i32 10
+// CHECK: }
+static int f9_0(unsigned x) {
+ switch(x) {
+ case 10 ... 0xFFFFFFFF:
+ return 0;
+ default:
+ return 10;
+ }
+}
+int f9() {
+ return f9_0(2);
+}
+
+// Ensure that this doesn't compile to infinite loop in g() due to
+// miscompilation of fallthrough from default to a (tested) case
+// range.
+//
+// CHECK: define i32 @f10()
+// CHECK: ret i32 10
+// CHECK: }
+static int f10_0(unsigned x) {
+ switch(x) {
+ default:
+ x += 1;
+ case 10 ... 0xFFFFFFFF:
+ return 0;
+ }
+}
+
+int f10() {
+ f10_0(1);
+ return 10;
+}
+
+// This generated incorrect code because of poor switch chaining.
+//
+// CHECK: define i32 @f11(
+// CHECK: ret i32 3
+// CHECK: }
+int f11(int x) {
+ switch(x) {
+ default:
+ return 3;
+ case 10 ... 0xFFFFFFFF:
+ return 0;
+ }
+}
+
+// This just asserted because of the way case ranges were calculated.
+//
+// CHECK: define i32 @f12(
+// CHECK: ret i32 3
+// CHECK: }
+int f12(int x) {
+ switch (x) {
+ default:
+ return 3;
+ case 10 ... -1:
+ return 0;
+ }
+}
+
+// Make sure return is not constant (if empty range is skipped or miscompiled)
+//
+// CHECK: define i32 @f13(
+// CHECK: ret i32 %
+// CHECK: }
+int f13(unsigned x) {
+ switch(x) {
+ case 2:
+ // fallthrough empty range
+ case 10 ... 9:
+ return 10;
+ default:
+ return 0;
+ }
+}
diff --git a/test/CodeGenCXX/copy-initialization.cpp b/test/CodeGenCXX/copy-initialization.cpp
new file mode 100644
index 0000000..62b9f26
--- /dev/null
+++ b/test/CodeGenCXX/copy-initialization.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+
+struct Foo {
+ Foo();
+ Foo(const Foo&);
+};
+
+struct Bar {
+ Bar();
+ operator const Foo&() const;
+};
+
+void f(Foo);
+
+// CHECK: define void @_Z1g3Foo(%struct.Bar* %foo)
+void g(Foo foo) {
+ // CHECK: call void @_ZN3BarC1Ev
+ // CHECK: @_ZNK3BarcvRK3FooEv
+ // CHECK: call void @_Z1f3Foo
+ f(Bar());
+ // CHECK: call void @_ZN3FooC1Ev
+ // CHECK: call void @_Z1f3Foo
+ f(Foo());
+ // CHECK: call void @_ZN3FooC1ERKS_
+ // CHECK: call void @_Z1f3Foo
+ f(foo);
+ // CHECK: ret
+}
+
diff --git a/test/CodeGenCXX/derived-to-base-conv.cpp b/test/CodeGenCXX/derived-to-base-conv.cpp
index c1a0caa..f2835b7 100644
--- a/test/CodeGenCXX/derived-to-base-conv.cpp
+++ b/test/CodeGenCXX/derived-to-base-conv.cpp
@@ -7,16 +7,21 @@ extern "C" int printf(...);
extern "C" void exit(int);
struct A {
- A (const A&) { printf("A::A(const A&)\n"); }
- A() {};
+ A (const A&) { printf("A::A(const A&)\n"); }
+ A() {};
+ ~A() { printf("A::~A()\n"); }
};
struct B : public A {
B() {};
-};
+ B(const B& Other) : A(Other) { printf("B::B(const B&)\n"); }
+ ~B() { printf("B::~B()\n"); }
+};
struct C : public B {
C() {};
+ C(const C& Other) : B(Other) { printf("C::C(const C&)\n"); }
+ ~C() { printf("C::~C()\n"); }
};
struct X {
@@ -24,6 +29,7 @@ struct X {
operator C&() {printf("X::operator C&()\n"); return c; }
X (const X&) { printf("X::X(const X&)\n"); }
X () { printf("X::X()\n"); }
+ ~X () { printf("X::~X()\n"); }
B b;
C c;
};
diff --git a/test/CodeGenCXX/virt.cpp b/test/CodeGenCXX/virt.cpp
index c404129..874ffb1 100644
--- a/test/CodeGenCXX/virt.cpp
+++ b/test/CodeGenCXX/virt.cpp
@@ -104,7 +104,8 @@ struct test7_B1 : virtual test7_B2 { virtual void funcB1(); };
struct test7_D : test7_B2, virtual test7_B1 {
};
-// CHECK-LP64: .zerofill __DATA,__common,_d7,16,3
+// FIXME: we were checking for an alignment of 3 (?)
+// CHECK-LP64: .zerofill __DATA,__common,_d7,16,
struct test3_B3 { virtual void funcB3(); };
diff --git a/test/CodeGenCXX/vtable-linkage.cpp b/test/CodeGenCXX/vtable-linkage.cpp
index a4ea2a1..c75efe2 100644
--- a/test/CodeGenCXX/vtable-linkage.cpp
+++ b/test/CodeGenCXX/vtable-linkage.cpp
@@ -128,10 +128,8 @@ void use_F(F<char> &fc) {
// CHECK: @_ZTI1FIlE = weak_odr constant
// F<int> is an explicit template instantiation declaration without a
-// key function, so its vtable should have weak_odr linkage.
-// CHECK: @_ZTV1FIiE = weak_odr constant
-// CHECK: @_ZTS1FIiE = weak_odr constant
-// CHECK: @_ZTI1FIiE = weak_odr constant
+// key function, so its vtable should have external linkage.
+// CHECK: @_ZTV1FIiE = external constant
// E<int> is an explicit template instantiation declaration. It has a
// key function that is not instantiated, so we should only reference
diff --git a/test/Parser/check-syntax-1.m b/test/Parser/check-syntax-1.m
index a1999de..085ff4c 100644
--- a/test/Parser/check-syntax-1.m
+++ b/test/Parser/check-syntax-1.m
@@ -9,3 +9,13 @@ typedef float CGFloat;
// expected-error {{ expected ';' after method prototype}}
@end
+// rdar: // 7822196
+@interface A
+(void) x; // expected-error {{method type specifier must start with '-' or '+'}} \
+ // expected-warning {{type specifier missing, defaults to 'int' [-Wimplicit-int]}} \
+ // expected-error {{cannot declare variable inside @interface or @protocol}}
+(int)im; // expected-error {{method type specifier must start with '-' or '+'}} \
+- ok;
+@end
+
+
diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp
index e2a966bd..49bcd99 100644
--- a/test/SemaCXX/conditional-expr.cpp
+++ b/test/SemaCXX/conditional-expr.cpp
@@ -213,3 +213,30 @@ namespace PR6595 {
(void)(Cond? a : S);
}
}
+
+namespace PR6757 {
+ struct Foo1 {
+ Foo1();
+ Foo1(const Foo1&);
+ };
+
+ struct Foo2 { };
+
+ struct Foo3 {
+ Foo3();
+ Foo3(Foo3&);
+ };
+
+ struct Bar {
+ operator const Foo1&() const;
+ operator const Foo2&() const;
+ operator const Foo3&() const;
+ };
+
+ void f() {
+ (void)(true ? Bar() : Foo1()); // okay
+ (void)(true ? Bar() : Foo2()); // okay
+ // FIXME: Diagnostic below could be improved
+ (void)(true ? Bar() : Foo3()); // expected-error{{incompatible operand types ('PR6757::Bar' and 'PR6757::Foo3')}}
+ }
+}
diff --git a/test/SemaCXX/copy-initialization.cpp b/test/SemaCXX/copy-initialization.cpp
index 3a63be0..e5b1fd7 100644
--- a/test/SemaCXX/copy-initialization.cpp
+++ b/test/SemaCXX/copy-initialization.cpp
@@ -21,3 +21,23 @@ struct foo {
// PR3600
void test(const foo *P) { P->bar(); } // expected-error{{cannot initialize object parameter of type 'foo' with an expression of type 'foo const'}}
+
+namespace PR6757 {
+ struct Foo {
+ Foo();
+ Foo(Foo&);
+ };
+
+ struct Bar {
+ operator const Foo&() const;
+ };
+
+ void f(Foo); // expected-note{{candidate function not viable: no known conversion from 'PR6757::Bar' to 'PR6757::Foo' for 1st argument}}
+
+ // FIXME: This isn't really the right reason for the failure. We
+ // should fail after overload resolution.
+ void g(Foo foo) {
+ f(Bar()); // expected-error{{no matching function for call to 'f'}}
+ f(foo);
+ }
+}
diff --git a/test/SemaObjC/class-extension-after-implementation.m b/test/SemaObjC/class-extension-after-implementation.m
new file mode 100644
index 0000000..2d8a5b1
--- /dev/null
+++ b/test/SemaObjC/class-extension-after-implementation.m
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://7822210
+
+@interface A @end
+
+@implementation A @end // expected-note {{class implementation is declared here}}
+
+@interface A () // expected-error {{cannot declare class extension for 'A' after class implementation}}
+-(void) im0;
+@end
+
diff --git a/test/SemaObjC/default-synthesize.m b/test/SemaObjC/default-synthesize.m
index be2397b..45a3710 100644
--- a/test/SemaObjC/default-synthesize.m
+++ b/test/SemaObjC/default-synthesize.m
@@ -23,12 +23,12 @@
//@synthesize howMany, what;
- (int) howMany {
- return howMany;
+ return self.howMany;
}
// - (void) setHowMany: (int) value
- (NSString*) what {
- return what;
+ return self.what;
}
// - (void) setWhat: (NSString*) value
@end
@@ -44,12 +44,12 @@
// - (int) howMany
- (void) setHowMany: (int) value {
- howMany = value;
+ self.howMany = value;
}
// - (NSString*) what
- (void) setWhat: (NSString*) value {
- if (what != value) {
+ if (self.what != value) {
}
}
@end
@@ -64,17 +64,17 @@
//@synthesize howMany, what; // REM: Redundant anyway
- (int) howMany {
- return howMany;
+ return self.howMany;
}
- (void) setHowMany: (int) value {
- howMany = value;
+ self.howMany = value;
}
- (NSString*) what {
- return what;
+ return self.what;
}
- (void) setWhat: (NSString*) value {
- if (what != value) {
+ if (self.what != value) {
}
}
@end
OpenPOWER on IntegriCloud