From 4ebdf5c4f587daef4e0be499802eac3a7a49bf2f Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Sat, 27 Jun 2009 10:45:02 +0000 Subject: Import Clang r74383. --- test/Analysis/NoReturn.m | 2 - test/Analysis/ObjCProperties.m | 2 - test/Analysis/array-struct.c | 1 - test/Analysis/complex.c | 1 - test/Analysis/dead-stores.c | 2 - test/Analysis/elementtype.c | 2 +- test/Analysis/exercise-ps.c | 1 - test/Analysis/func.c | 2 - test/Analysis/null-deref-ps.c | 8 +-- test/Analysis/outofbound.c | 2 +- test/Analysis/ptr-arith.c | 1 - test/Analysis/region-only-test.c | 2 +- test/Analysis/stack-addr-ps.c | 1 - test/Analysis/uninit-msg-expr.m | 1 - test/Analysis/uninit-vals-ps-region.c | 2 +- test/CXX/class/class.local/p1.cpp | 18 ++++++ test/CXX/class/class.local/p2.cpp | 12 ++++ test/CXX/class/class.local/p3.cpp | 30 +++++++++ test/CXX/class/class.local/p4.cpp | 10 +++ test/CXX/class/class.nested.type/p1.cpp | 11 ++++ .../dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp | 13 ++++ .../dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp | 21 ++++++ .../dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp | 6 ++ .../temp.decls/temp.fct/temp.over.link/p4-neg.cpp | 27 ++++++++ .../temp/temp.decls/temp.fct/temp.over.link/p4.cpp | 13 ++++ .../temp.deduct/temp.deduct.call/basic.cpp | 28 ++++++++ .../temp.deduct/temp.deduct.call/p2.cpp | 31 +++++++++ .../temp.deduct/temp.deduct.call/p3.cpp | 60 ++++++++++++++++++ test/CodeGen/2009-06-16-inc_test.c | 3 - test/CodeGen/2009-06-16-test.c | 15 ----- test/CodeGenObjC/deadcode_strip_used_var.m | 9 +++ test/Coverage/html-diagnostics.c | 2 +- test/Index/resolve-loc.c | 24 +++++++ test/Parser/check-syntax-1.m | 7 ++ test/Parser/cxx-template-decl.cpp | 6 +- test/Sema/attr-format_arg.c | 11 ++++ test/Sema/ext_vector_casts.c | 23 +++++++ test/Sema/ext_vector_components.c | 7 ++ test/Sema/vector-cast.c | 4 +- test/SemaCXX/auto-cxx0x.cpp | 5 ++ test/SemaCXX/auto-cxx98.cpp | 5 ++ test/SemaCXX/basic_lookup_argdep.cpp | 13 ++++ test/SemaCXX/decltype-pr4444.cpp | 6 ++ test/SemaCXX/decltype-pr4448.cpp | 8 +++ test/SemaCXX/default-assignment-operator.cpp | 74 ++++++++++++++++++++++ test/SemaCXX/nested-name-spec.cpp | 23 +++++++ test/SemaCXX/template-specialization.cpp | 1 + test/SemaCXX/using-decl-1.cpp | 8 +++ test/SemaCXX/using-decl-pr4441.cpp | 8 +++ test/SemaCXX/using-decl-pr4450.cpp | 15 +++++ test/SemaTemplate/implicit-instantiation-1.cpp | 11 +++- test/SemaTemplate/operator-template.cpp | 14 ++++ test/SemaTemplate/temp_arg_template.cpp | 4 +- test/SemaTemplate/template-decl-fail.cpp | 3 + 54 files changed, 570 insertions(+), 49 deletions(-) create mode 100644 test/CXX/class/class.local/p1.cpp create mode 100644 test/CXX/class/class.local/p2.cpp create mode 100644 test/CXX/class/class.local/p3.cpp create mode 100644 test/CXX/class/class.local/p4.cpp create mode 100644 test/CXX/class/class.nested.type/p1.cpp create mode 100644 test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp create mode 100644 test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp create mode 100644 test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp create mode 100644 test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4-neg.cpp create mode 100644 test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4.cpp create mode 100644 test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp create mode 100644 test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp create mode 100644 test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp create mode 100644 test/CodeGenObjC/deadcode_strip_used_var.m create mode 100644 test/Index/resolve-loc.c create mode 100644 test/Sema/attr-format_arg.c create mode 100644 test/Sema/ext_vector_casts.c create mode 100644 test/SemaCXX/auto-cxx0x.cpp create mode 100644 test/SemaCXX/auto-cxx98.cpp create mode 100644 test/SemaCXX/decltype-pr4444.cpp create mode 100644 test/SemaCXX/decltype-pr4448.cpp create mode 100644 test/SemaCXX/default-assignment-operator.cpp create mode 100644 test/SemaCXX/using-decl-1.cpp create mode 100644 test/SemaCXX/using-decl-pr4441.cpp create mode 100644 test/SemaCXX/using-decl-pr4450.cpp create mode 100644 test/SemaTemplate/operator-template.cpp create mode 100644 test/SemaTemplate/template-decl-fail.cpp (limited to 'test') diff --git a/test/Analysis/NoReturn.m b/test/Analysis/NoReturn.m index a43f99bdd79bb..5f5ce281a7941 100644 --- a/test/Analysis/NoReturn.m +++ b/test/Analysis/NoReturn.m @@ -1,5 +1,3 @@ -// RUN: clang-cc -analyze -checker-simple -analyzer-store=basic -analyzer-constraints=basic -verify %s && -// RUN: clang-cc -analyze -checker-simple -analyzer-store=basic -analyzer-constraints=range -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s && diff --git a/test/Analysis/ObjCProperties.m b/test/Analysis/ObjCProperties.m index 7787a1d6ecdc3..3ad256914a422 100644 --- a/test/Analysis/ObjCProperties.m +++ b/test/Analysis/ObjCProperties.m @@ -1,5 +1,3 @@ -// RUN: clang-cc -analyze -checker-simple -analyzer-store=basic -analyzer-constraints=basic %s -verify && -// RUN: clang-cc -analyze -checker-simple -analyzer-store=basic -analyzer-constraints=range %s -verify && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic %s -verify && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range %s -verify && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic %s -verify && diff --git a/test/Analysis/array-struct.c b/test/Analysis/array-struct.c index 0ad7ae7e8283f..438e1ccf476df 100644 --- a/test/Analysis/array-struct.c +++ b/test/Analysis/array-struct.c @@ -1,4 +1,3 @@ -// RUN: clang-cc -analyze -checker-simple -analyzer-store=basic -analyzer-constraints=basic -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s diff --git a/test/Analysis/complex.c b/test/Analysis/complex.c index f29fc70c49442..cef624577a6dc 100644 --- a/test/Analysis/complex.c +++ b/test/Analysis/complex.c @@ -1,4 +1,3 @@ -// RUN: clang-cc -analyze -checker-simple -analyzer-store=basic -analyzer-constraints=basic -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify %s && diff --git a/test/Analysis/dead-stores.c b/test/Analysis/dead-stores.c index c100344adf6d7..6d3b7e6f540d7 100644 --- a/test/Analysis/dead-stores.c +++ b/test/Analysis/dead-stores.c @@ -1,6 +1,4 @@ // RUN: clang-cc -analyze -warn-dead-stores -verify %s && -// RUN: clang-cc -analyze -checker-simple -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -verify %s && -// RUN: clang-cc -analyze -checker-simple -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -verify %s && diff --git a/test/Analysis/elementtype.c b/test/Analysis/elementtype.c index 10328e69efa22..2bdaad423a393 100644 --- a/test/Analysis/elementtype.c +++ b/test/Analysis/elementtype.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-simple -analyzer-store=region %s +// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region %s typedef struct added_obj_st { int type; diff --git a/test/Analysis/exercise-ps.c b/test/Analysis/exercise-ps.c index 08842b1b8dbfd..c309349ab3a9e 100644 --- a/test/Analysis/exercise-ps.c +++ b/test/Analysis/exercise-ps.c @@ -1,4 +1,3 @@ -// RUN: clang-cc -analyze -checker-simple -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s // diff --git a/test/Analysis/func.c b/test/Analysis/func.c index a018d0afc1cce..2b4e7b0db0762 100644 --- a/test/Analysis/func.c +++ b/test/Analysis/func.c @@ -1,5 +1,3 @@ -// RUN: clang-cc -analyze -checker-simple -verify %s && -// RUN: clang-cc -analyze -checker-simple -analyzer-store=region -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c index 09b9c2ffa3b75..6e2074146c307 100644 --- a/test/Analysis/null-deref-ps.c +++ b/test/Analysis/null-deref-ps.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -analyze -std=gnu99 -checker-simple -verify %s && -// RUN: clang-cc -analyze -std=gnu99 -checker-simple -verify %s -analyzer-constraints=range && -// RUN: clang-cc -analyze -std=gnu99 -checker-simple -analyzer-store=region -analyzer-purge-dead=false -verify %s && -// RUN: clang-cc -analyze -std=gnu99 -checker-cfref -analyzer-store=region -verify %s +// RUN: clang-cc -analyze -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=basic -analyzer-store=basic && +// RUN: clang-cc -analyze -std=gnu99 -checker-cfref -verify %s -analyzer-constraints=range -analyzer-store=basic && +// RUN: clang-cc -analyze -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -analyzer-purge-dead=false -verify %s && +// RUN: clang-cc -analyze -std=gnu99 -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify %s #include #include diff --git a/test/Analysis/outofbound.c b/test/Analysis/outofbound.c index 953075fe03d79..527a311d2b7dd 100644 --- a/test/Analysis/outofbound.c +++ b/test/Analysis/outofbound.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-simple -analyzer-store=region -verify %s +// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s char f1() { char* s = "abcd"; diff --git a/test/Analysis/ptr-arith.c b/test/Analysis/ptr-arith.c index 34840c7b7c582..4f2c7d9edb0b6 100644 --- a/test/Analysis/ptr-arith.c +++ b/test/Analysis/ptr-arith.c @@ -1,4 +1,3 @@ -// RUN: clang-cc -analyze -checker-simple -analyzer-store=region -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify -triple x86_64-apple-darwin9 %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify -triple i686-apple-darwin9 %s diff --git a/test/Analysis/region-only-test.c b/test/Analysis/region-only-test.c index fdc740488a2cd..64d3fcd57b2a1 100644 --- a/test/Analysis/region-only-test.c +++ b/test/Analysis/region-only-test.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-simple -analyzer-store=region -verify %s +// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s // Region store must be enabled for tests in this file. diff --git a/test/Analysis/stack-addr-ps.c b/test/Analysis/stack-addr-ps.c index 4bc9a7def2c82..2f7a4bdf74088 100644 --- a/test/Analysis/stack-addr-ps.c +++ b/test/Analysis/stack-addr-ps.c @@ -1,4 +1,3 @@ -// RUN: clang-cc -analyze -checker-simple -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s diff --git a/test/Analysis/uninit-msg-expr.m b/test/Analysis/uninit-msg-expr.m index 161ab8041de11..5ec878ea3c37f 100644 --- a/test/Analysis/uninit-msg-expr.m +++ b/test/Analysis/uninit-msg-expr.m @@ -1,4 +1,3 @@ -// RUN: clang-cc -analyze -checker-simple -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s diff --git a/test/Analysis/uninit-vals-ps-region.c b/test/Analysis/uninit-vals-ps-region.c index 6f3762ee10bf3..32f787db4aeb8 100644 --- a/test/Analysis/uninit-vals-ps-region.c +++ b/test/Analysis/uninit-vals-ps-region.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -analyze -checker-simple -analyzer-store=region -verify %s +// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s struct s { int data; diff --git a/test/CXX/class/class.local/p1.cpp b/test/CXX/class/class.local/p1.cpp new file mode 100644 index 0000000000000..8a84f5dbed8af --- /dev/null +++ b/test/CXX/class/class.local/p1.cpp @@ -0,0 +1,18 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +int x; +void f() +{ + static int s; + int x; // expected-note{{'x' declared here}} + extern int g(); + + struct local { + int g() { return x; } // expected-error{{reference to local variable 'x' declared in enclosed function 'f'}} + int h() { return s; } + int k() { return :: x; } + int l() { return g(); } + }; +} + +local* p = 0; // expected-error{{unknown type name 'local'}} diff --git a/test/CXX/class/class.local/p2.cpp b/test/CXX/class/class.local/p2.cpp new file mode 100644 index 0000000000000..854415fe307de --- /dev/null +++ b/test/CXX/class/class.local/p2.cpp @@ -0,0 +1,12 @@ +// RUN: clang-cc -fsyntax-only -verify %s -faccess-control + +struct A { }; + +void f() { + struct B : private A {}; // expected-note{{'private' inheritance specifier here}} + + B b; + + A *a = &b; // expected-error{{conversion from 'struct B' to inaccessible base class 'struct A'}} \ + expected-error{{incompatible type initializing 'struct B *', expected 'struct A *'}} +} diff --git a/test/CXX/class/class.local/p3.cpp b/test/CXX/class/class.local/p3.cpp new file mode 100644 index 0000000000000..d888a6d936330 --- /dev/null +++ b/test/CXX/class/class.local/p3.cpp @@ -0,0 +1,30 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +void f1() { + struct X { + struct Y; + }; + + struct X::Y { + void f() {} + }; +} + +void f2() { + struct X { + struct Y; + + struct Y { + void f() {} + }; + }; +} + +// A class nested within a local class is a local class. +void f3(int a) { // expected-note{{'a' declared here}} + struct X { + struct Y { + int f() { return a; } // expected-error{{reference to local variable 'a' declared in enclosed function 'f3'}} + }; + }; +} \ No newline at end of file diff --git a/test/CXX/class/class.local/p4.cpp b/test/CXX/class/class.local/p4.cpp new file mode 100644 index 0000000000000..40702ad968993 --- /dev/null +++ b/test/CXX/class/class.local/p4.cpp @@ -0,0 +1,10 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +void f() { + struct X { + static int a; // expected-error {{static data member 'a' not allowed in local class 'X'}} + int b; + + static void f() { } + }; +} \ No newline at end of file diff --git a/test/CXX/class/class.nested.type/p1.cpp b/test/CXX/class/class.nested.type/p1.cpp new file mode 100644 index 0000000000000..33bf4b4473e50 --- /dev/null +++ b/test/CXX/class/class.nested.type/p1.cpp @@ -0,0 +1,11 @@ +class X { +public: + typedef int I; + class Y { }; + I a; +}; + +I b; // expected-error{{unknown type name 'I'}} +Y c; // expected-error{{unknown type name 'Y'}} +X::Y d; +X::I e; \ No newline at end of file diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp new file mode 100644 index 0000000000000..fa3101c6736c6 --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp @@ -0,0 +1,13 @@ +// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x +void f() { + auto a = a; // expected-error{{variable 'a' declared with 'auto' type cannot appear in its own initializer}} +} + +struct S { auto a; }; // expected-error{{'auto' not allowed in struct member}} + +void f(auto a) // expected-error{{'auto' not allowed in function prototype}} +{ + try { } catch (auto a) { } // expected-error{{'auto' not allowed in exception declaration}} +} + +template class C { }; // expected-error{{'auto' not allowed in template parameter}} diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp new file mode 100644 index 0000000000000..d97f2b83d1a7c --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp @@ -0,0 +1,21 @@ +// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s + +template +struct is_same { + static const bool value = false; +}; + +template +struct is_same { + static const bool value = true; +}; + +const int&& foo(); +int i; +struct A { double x; }; +const A* a = new A(); + +static_assert(is_same::value, ""); +static_assert(is_same::value, ""); +static_assert(is_samex), double>::value, ""); +static_assert(is_samex)), const double&>::value, ""); diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp new file mode 100644 index 0000000000000..9d855349f295a --- /dev/null +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp @@ -0,0 +1,6 @@ +// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x + +void f() { + int b[5]; + auto a[5] = b; // expected-error{{'a' declared as array of 'auto'}} +} diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4-neg.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4-neg.cpp new file mode 100644 index 0000000000000..b482955818cb4 --- /dev/null +++ b/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4-neg.cpp @@ -0,0 +1,27 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +template void f0(T) { } // expected-note{{previous}} +template void f0(U) { } // expected-error{{redefinition}} + +template void f0() { } // expected-note{{previous}} +template void f0() { } // expected-error{{redefinition}} + +typedef int INT; + +template class X> + void f0() { } // expected-note{{previous}} +template class> + void f0() { } // expected-error{{redefinition}} + +template +struct MetaFun; + +template + typename MetaFun::type f0(const T&) { } // expected-note{{previous}} +template + typename MetaFun::type f0(const U&) { } // expected-error{{redefinition}} + +// FIXME: We need canonicalization of expressions for this to work +// template struct A { }; +// template void f0(A) { } // Xpected-note{{previous}} +// template void f0(A) { } // Xpected-error{{redefinition}} \ No newline at end of file diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4.cpp new file mode 100644 index 0000000000000..de1a883bcd7a0 --- /dev/null +++ b/test/CXX/temp/temp.decls/temp.fct/temp.over.link/p4.cpp @@ -0,0 +1,13 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// All of these function templates are distinct. +template void f0(T) { } +template void f0(T) { } +template void f0(U) { } +void f0(); +template void f0(T*); +void f0(int); +template void f0(); +template void f0(); + + diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp new file mode 100644 index 0000000000000..beb6aad2c089a --- /dev/null +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/basic.cpp @@ -0,0 +1,28 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +template struct A { }; + +template A f0(T*); + +void test_f0(int *ip, float const *cfp) { + A a0 = f0(ip); + A a1 = f0(cfp); +} + +template void f1(T*, int); + +void test_f1(int *ip, float fv) { + f1(ip, fv); +} + +template void f2(T*, T*); + +struct ConvToIntPtr { + operator int*() const; +}; + +void test_f2(int *ip, float *fp) { + f2(ip, ConvToIntPtr()); // expected-error{{no matching function}} + f2(ip, ip); // okay + f2(ip, fp); // expected-error{{no matching function}} +} diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp new file mode 100644 index 0000000000000..6f27d3636892e --- /dev/null +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p2.cpp @@ -0,0 +1,31 @@ +// RUN: clang-cc -fsyntax-only -verify %s +template struct A { }; + +// bullet 1 +template A f0(T* ptr); + +void test_f0_bullet1() { + int arr0[6]; + A a0 = f0(arr0); + const int arr1[] = { 1, 2, 3, 4, 5 }; + A a1 = f0(arr1); +} + +// bullet 2 +int g0(int, int); +float g1(float); + +void test_f0_bullet2() { + A a0 = f0(g0); + A a1 = f0(g1); +} + +// bullet 3 +struct X { }; +const X get_X(); + +template A f1(T); + +void test_f1_bullet3() { + A a0 = f1(get_X()); +} diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp new file mode 100644 index 0000000000000..c014c663598cc --- /dev/null +++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp @@ -0,0 +1,60 @@ +// RUN: clang-cc -fsyntax-only %s + +template struct A { }; + +// Top-level cv-qualifiers of P's type are ignored for type deduction. +template A f0(const T); + +void test_f0(int i, const int ci) { + A a0 = f0(i); + A a1 = f0(ci); +} + +// If P is a reference type, the type referred to by P is used for type +// deduction. +template A f1(T&); + +void test_f1(int i, const int ci, volatile int vi) { + A a0 = f1(i); + A a1 = f1(ci); + A a2 = f1(vi); +} + +template struct B { }; +template B g0(T (&array)[N]); + +void test_g0() { + int array0[5]; + B b0 = g0(array0); + const int array1[] = { 1, 2, 3}; + B b1 = g0(array1); +} + +template B g1(const A&); + +void test_g1(A af) { + B b0 = g1(af); + B b1 = g1(A()); +} + +// - If the original P is a reference type, the deduced A (i.e., the type +// referred to by the reference) can be more cv-qualified than the +// transformed A. +template A f2(const T&); + +void test_f2(int i, const int ci, volatile int vi) { + A a0 = f2(i); + A a1 = f2(ci); + A a2 = f2(vi); +} + +// - The transformed A can be another pointer or pointer to member type that +// can be converted to the deduced A via a qualification conversion (4.4). +template A f3(T * * const * const); + +void test_f3(int ***ip, volatile int ***vip) { + A a0 = f3(ip); + A a1 = f3(vip); +} + +// FIXME: the next bullet requires a lot of effort. diff --git a/test/CodeGen/2009-06-16-inc_test.c b/test/CodeGen/2009-06-16-inc_test.c index b28f63a1c580e..e69de29bb2d1d 100644 --- a/test/CodeGen/2009-06-16-inc_test.c +++ b/test/CodeGen/2009-06-16-inc_test.c @@ -1,3 +0,0 @@ -// RUN: clang -c -g %s -o /dev/null -// PR 4228 -#include "2009-06-16-test.c" diff --git a/test/CodeGen/2009-06-16-test.c b/test/CodeGen/2009-06-16-test.c index 4189d06812af7..e69de29bb2d1d 100644 --- a/test/CodeGen/2009-06-16-test.c +++ b/test/CodeGen/2009-06-16-test.c @@ -1,15 +0,0 @@ - -#ifndef TEST -#define TEST -#define INSIDE_RECURSION -#include "2009-06-16-test.c" -#undef INSIDE_RECURSION -#endif - -#ifndef INSIDE_RECURSION -int i; -#endif - -#ifdef INSIDE_RECURSION -int j; -#endif diff --git a/test/CodeGenObjC/deadcode_strip_used_var.m b/test/CodeGenObjC/deadcode_strip_used_var.m new file mode 100644 index 0000000000000..444cf766f7dd6 --- /dev/null +++ b/test/CodeGenObjC/deadcode_strip_used_var.m @@ -0,0 +1,9 @@ +// RUN: clang-cc %s -emit-llvm -o %t -triple i386-apple-darwin10 && +// RUN: grep "llvm.used" %t | count 1 && +// RUN: clang-cc %s -emit-llvm -o %t -triple x86_64-apple-darwin10 && +// RUN: grep "llvm.used" %t | count 1 + + +__attribute__((used)) static int XXXXXX __attribute__ ((section ("__DATA,__Xinterpose"))) ; +__attribute__((used)) static int YYYY __attribute__ ((section ("__DATA,__Xinterpose"))) ; + diff --git a/test/Coverage/html-diagnostics.c b/test/Coverage/html-diagnostics.c index 6144f2fb98a30..e3db1668d8363 100644 --- a/test/Coverage/html-diagnostics.c +++ b/test/Coverage/html-diagnostics.c @@ -1,5 +1,5 @@ // RUN: rm -rf %t && -// RUN: clang-cc --html-diags=%t -checker-simple %s +// RUN: clang-cc --html-diags=%t -checker-cfref %s void f0(int x) { int *p = &x; diff --git a/test/Index/resolve-loc.c b/test/Index/resolve-loc.c new file mode 100644 index 0000000000000..d04b79b024edd --- /dev/null +++ b/test/Index/resolve-loc.c @@ -0,0 +1,24 @@ +// RUN: clang-cc -emit-pch %s -o %t.ast && +// RUN: index-test %t.ast -point-at %s:15:8 | grep top_var && +// RUN: index-test %t.ast -point-at %s:17:15 | grep top_func_decl && +// RUN: index-test %t.ast -point-at %s:17:25 | grep param1 && +// RUN: index-test %t.ast -point-at %s:19:17 | grep top_func_def && +// RUN: index-test %t.ast -point-at %s:19:23 | grep param2 && +// RUN: index-test %t.ast -point-at %s:20:10 | grep local_var1 && +// RUN: index-test %t.ast -point-at %s:21:15 | grep for_var && +// RUN: index-test %t.ast -point-at %s:21:43 | grep top_func_def && +// RUN: index-test %t.ast -point-at %s:21:43 | grep '++for_var' && +// RUN: index-test %t.ast -point-at %s:22:9 | grep local_var2 && +// RUN: index-test %t.ast -point-at %s:22:30 | grep local_var2 && +// RUN: index-test %t.ast -point-at %s:22:30 | grep 'for_var + 1' + +int top_var; + +void top_func_decl(int param1); + +void top_func_def(int param2) { + int local_var1; + for (int for_var = 100; for_var < 500; ++for_var) { + int local_var2 = for_var + 1; + } +} diff --git a/test/Parser/check-syntax-1.m b/test/Parser/check-syntax-1.m index f4aa430cde18f..af1b7a8b714ac 100644 --- a/test/Parser/check-syntax-1.m +++ b/test/Parser/check-syntax-1.m @@ -2,3 +2,10 @@ 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 + diff --git a/test/Parser/cxx-template-decl.cpp b/test/Parser/cxx-template-decl.cpp index 75b26a98e44ec..6955018790985 100644 --- a/test/Parser/cxx-template-decl.cpp +++ b/test/Parser/cxx-template-decl.cpp @@ -33,11 +33,11 @@ template class X2; // Forward declarations w/template template parameters template