aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2009-06-03 13:29:08 +0000
committerEd Schouten <ed@FreeBSD.org>2009-06-03 13:29:08 +0000
commit922a2097733e49b869978a264837ad60eca82891 (patch)
tree4075b1f9165f6c8d2b9a7e98b89a1348669f78fe /test
parentec2b103c267a06a66e926f62cd96767b280f5cf5 (diff)
downloadsrc-922a2097733e49b869978a264837ad60eca82891.tar.gz
src-922a2097733e49b869978a264837ad60eca82891.zip
Import Clang, at r72770.vendor/clang/clang-r72770
Notes
Notes: svn path=/vendor/clang/dist/; revision=193380 svn path=/vendor/clang/clang-r72770/; revision=193381; tag=vendor/clang/clang-r72770
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/always_inline.c13
-rw-r--r--test/Parser/cxx-ambig-paren-expr.cpp6
-rw-r--r--test/Sema/vfprintf-invalid-redecl.c6
-rw-r--r--test/Sema/vfprintf-valid-redecl.c6
-rw-r--r--test/SemaCXX/const-cast.cpp2
-rw-r--r--test/SemaCXX/decl-expr-ambiguity.cpp2
-rw-r--r--test/SemaCXX/member-expr.cpp2
-rw-r--r--test/SemaCXX/reinterpret-cast.cpp6
-rw-r--r--test/SemaCXX/static-cast.cpp2
-rw-r--r--test/SemaObjC/objc2-merge-gc-attribue-decl.m18
-rw-r--r--test/SemaObjCXX/blocks.mm4
-rw-r--r--test/SemaTemplate/temp_arg_nontype.cpp2
12 files changed, 56 insertions, 13 deletions
diff --git a/test/CodeGen/always_inline.c b/test/CodeGen/always_inline.c
new file mode 100644
index 000000000000..d159bd2233e4
--- /dev/null
+++ b/test/CodeGen/always_inline.c
@@ -0,0 +1,13 @@
+// RUN: clang-cc -emit-llvm -o %t %s &&
+// RUN: grep '@f0' %t | count 0 &&
+// RUN: clang-cc -disable-llvm-optzns -emit-llvm -o %t %s &&
+// RUN: grep '@f0' %t | count 2
+
+//static int f0() {
+static int __attribute__((always_inline)) f0() {
+ return 1;
+}
+
+int f1() {
+ return f0();
+}
diff --git a/test/Parser/cxx-ambig-paren-expr.cpp b/test/Parser/cxx-ambig-paren-expr.cpp
index 6f23b35d3e6b..1712d849d516 100644
--- a/test/Parser/cxx-ambig-paren-expr.cpp
+++ b/test/Parser/cxx-ambig-paren-expr.cpp
@@ -5,9 +5,9 @@ void f() {
int x, *px;
// Type id.
- (T())x; // expected-error {{used type 'T (void)'}}
- (T())+x; // expected-error {{used type 'T (void)'}}
- (T())*px; // expected-error {{used type 'T (void)'}}
+ (T())x; // expected-error {{used type 'T ()'}}
+ (T())+x; // expected-error {{used type 'T ()'}}
+ (T())*px; // expected-error {{used type 'T ()'}}
// Expression.
x = (T());
diff --git a/test/Sema/vfprintf-invalid-redecl.c b/test/Sema/vfprintf-invalid-redecl.c
new file mode 100644
index 000000000000..02c5061d8cd5
--- /dev/null
+++ b/test/Sema/vfprintf-invalid-redecl.c
@@ -0,0 +1,6 @@
+// RUN: clang-cc %s -fsyntax-only -verify
+// PR4290
+
+// The following declaration is not compatible with vfprintf(), but make
+// sure this isn't an error: autoconf expects this to build.
+char vfprintf(); // expected-warning {{incompatible redeclaration of library function 'vfprintf'}} expected-note {{'vfprintf' is a builtin}}
diff --git a/test/Sema/vfprintf-valid-redecl.c b/test/Sema/vfprintf-valid-redecl.c
new file mode 100644
index 000000000000..cc8e2c40d30b
--- /dev/null
+++ b/test/Sema/vfprintf-valid-redecl.c
@@ -0,0 +1,6 @@
+// RUN: clang-cc %s -fsyntax-only -pedantic -verify
+// PR4290
+
+// The following declaration is compatible with vfprintf, so we shouldn't
+// warn.
+int vfprintf();
diff --git a/test/SemaCXX/const-cast.cpp b/test/SemaCXX/const-cast.cpp
index 39d61db0dc94..ee0048bd73be 100644
--- a/test/SemaCXX/const-cast.cpp
+++ b/test/SemaCXX/const-cast.cpp
@@ -58,6 +58,6 @@ short *bad_const_cast_test(char const *volatile *const volatile *var)
// Function pointers.
f fp2 = const_cast<f>(fp1); // expected-error {{const_cast to 'f' (aka 'int (*)(int)'), which is not a reference, pointer-to-object, or pointer-to-data-member}}
void (A::*mfn)() = 0;
- (void)const_cast<void (A::*)()>(mfn); // expected-error {{const_cast to 'void (struct A::*)(void)', which is not a reference, pointer-to-object, or pointer-to-data-member}}
+ (void)const_cast<void (A::*)()>(mfn); // expected-error {{const_cast to 'void (struct A::*)()', which is not a reference, pointer-to-object, or pointer-to-data-member}}
return **var3;
}
diff --git a/test/SemaCXX/decl-expr-ambiguity.cpp b/test/SemaCXX/decl-expr-ambiguity.cpp
index bff333464b91..05e25e9bb868 100644
--- a/test/SemaCXX/decl-expr-ambiguity.cpp
+++ b/test/SemaCXX/decl-expr-ambiguity.cpp
@@ -19,7 +19,7 @@ void f() {
(int(1)); // expected-warning {{expression result unused}}
// type-id
- (int())1; // expected-error {{used type 'int (void)' where arithmetic or pointer type is required}}
+ (int())1; // expected-error {{used type 'int ()' where arithmetic or pointer type is required}}
// Declarations.
int fd(T(a)); // expected-warning {{parentheses were disambiguated as a function declarator}}
diff --git a/test/SemaCXX/member-expr.cpp b/test/SemaCXX/member-expr.cpp
index 60ee10df7f6a..28b1224d8d8f 100644
--- a/test/SemaCXX/member-expr.cpp
+++ b/test/SemaCXX/member-expr.cpp
@@ -28,6 +28,6 @@ struct B {
A *f0();
};
int f0(B *b) {
- return b->f0->f0; // expected-error{{member reference base type 'struct A *(void)' is not a structure or union}} \
+ return b->f0->f0; // expected-error{{member reference base type 'struct A *()' is not a structure or union}} \
// expected-note{{perhaps you meant to call this function}}
}
diff --git a/test/SemaCXX/reinterpret-cast.cpp b/test/SemaCXX/reinterpret-cast.cpp
index fd5ca8cf39d4..91b72cc02207 100644
--- a/test/SemaCXX/reinterpret-cast.cpp
+++ b/test/SemaCXX/reinterpret-cast.cpp
@@ -80,11 +80,11 @@ void memptrs()
void (structure::*psf)() = 0;
(void)reinterpret_cast<int (structure::*)()>(psf);
- (void)reinterpret_cast<void (structure::*)()>(psi); // expected-error {{reinterpret_cast from 'int const struct structure::*' to 'void (struct structure::*)(void)' is not allowed}}
- (void)reinterpret_cast<int structure::*>(psf); // expected-error {{reinterpret_cast from 'void (struct structure::*)(void)' to 'int struct structure::*' is not allowed}}
+ (void)reinterpret_cast<void (structure::*)()>(psi); // expected-error {{reinterpret_cast from 'int const struct structure::*' to 'void (struct structure::*)()' is not allowed}}
+ (void)reinterpret_cast<int structure::*>(psf); // expected-error {{reinterpret_cast from 'void (struct structure::*)()' to 'int struct structure::*' is not allowed}}
// Cannot cast from integers to member pointers, not even the null pointer
// literal.
- (void)reinterpret_cast<void (structure::*)()>(0); // expected-error {{reinterpret_cast from 'int' to 'void (struct structure::*)(void)' is not allowed}}
+ (void)reinterpret_cast<void (structure::*)()>(0); // expected-error {{reinterpret_cast from 'int' to 'void (struct structure::*)()' is not allowed}}
(void)reinterpret_cast<int structure::*>(0); // expected-error {{reinterpret_cast from 'int' to 'int struct structure::*' is not allowed}}
}
diff --git a/test/SemaCXX/static-cast.cpp b/test/SemaCXX/static-cast.cpp
index 8399e77085b3..b5c515d5e161 100644
--- a/test/SemaCXX/static-cast.cpp
+++ b/test/SemaCXX/static-cast.cpp
@@ -115,7 +115,7 @@ void t_529_10()
// Bad code below
(void)static_cast<int*>((const void*)0); // expected-error {{static_cast from 'void const *' to 'int *' casts away constness}}
- (void)static_cast<void (*)()>((void*)0); // expected-error {{static_cast from 'void *' to 'void (*)(void)' is not allowed}}
+ (void)static_cast<void (*)()>((void*)0); // expected-error {{static_cast from 'void *' to 'void (*)()' is not allowed}}
}
// Member pointer upcast.
diff --git a/test/SemaObjC/objc2-merge-gc-attribue-decl.m b/test/SemaObjC/objc2-merge-gc-attribue-decl.m
index 4e3b3ec7a4dd..9dae1efdcd2a 100644
--- a/test/SemaObjC/objc2-merge-gc-attribue-decl.m
+++ b/test/SemaObjC/objc2-merge-gc-attribue-decl.m
@@ -10,3 +10,21 @@ extern id p1;
extern id CFRunLoopGetMain();
extern __strong id CFRunLoopGetMain();
+extern __weak id WLoopGetMain(); // expected-note {{previous declaration is here}}
+extern id WLoopGetMain(); // expected-error {{conflicting types for 'WLoopGetMain'}}
+
+extern id p3; // expected-note {{previous definition is here}}
+extern __weak id p3; // expected-error {{redefinition of 'p3' with a different type}}
+
+extern void *p4; // expected-note {{previous definition is here}}
+extern void * __strong p4; // expected-error {{redefinition of 'p4' with a different type}}
+
+extern id p5;
+extern __strong id p5;
+
+extern char* __strong p6; // expected-note {{previous definition is here}}
+extern char* p6; // expected-error {{redefinition of 'p6' with a different type}}
+
+// FIXME. We do not issue error here because we don't put the attribute on the pointer type.
+extern __strong char* p7;
+extern char* p7;
diff --git a/test/SemaObjCXX/blocks.mm b/test/SemaObjCXX/blocks.mm
index 3d421a878e59..e3304a41b730 100644
--- a/test/SemaObjCXX/blocks.mm
+++ b/test/SemaObjCXX/blocks.mm
@@ -3,12 +3,12 @@
void bar(id(^)(void));
void foo(id <NSObject>(^objectCreationBlock)(void)) {
- return bar(objectCreationBlock); // expected-warning{{incompatible pointer types passing 'id (^)(void)', expected 'id<NSObject> (^)(void)'}}
+ return bar(objectCreationBlock); // expected-warning{{incompatible pointer types passing 'id (^)()', expected 'id<NSObject> (^)()'}}
}
void bar2(id(*)(void));
void foo2(id <NSObject>(*objectCreationBlock)(void)) {
- return bar2(objectCreationBlock); // expected-warning{{incompatible pointer types passing 'id (*)(void)', expected 'id<NSObject> (*)(void)'}}
+ return bar2(objectCreationBlock); // expected-warning{{incompatible pointer types passing 'id (*)()', expected 'id<NSObject> (*)()'}}
}
void bar3(id(*)()); // expected-note{{candidate function}}
diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp
index fe18fe657c16..534030dba0ea 100644
--- a/test/SemaTemplate/temp_arg_nontype.cpp
+++ b/test/SemaTemplate/temp_arg_nontype.cpp
@@ -3,7 +3,7 @@ template<int N> struct A; // expected-note 5{{template parameter is declared her
A<0> *a0;
-A<int()> *a1; // expected-error{{template argument for non-type template parameter is treated as type 'int (void)'}}
+A<int()> *a1; // expected-error{{template argument for non-type template parameter is treated as type 'int ()'}}
A<int> *a2; // expected-error{{template argument for non-type template parameter must be an expression}}