From: Eric Christopher Date: Sat, 20 Aug 2011 00:09:39 +0000 (+0000) Subject: Migrate, FileCheckize and update: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2368b6af4a5f0c07c7b77f8900a956dce75bbf84;p=clang Migrate, FileCheckize and update: 2004-03-08-ReinterpretCastCopy.cpp 2004-03-09-UnmangledBuiltinMethods.cpp 2004-03-15-CleanupsAndGotos.cpp 2004-06-08-LateTemplateInstantiation.cpp 2004-09-27-CompilerCrash.cpp 2004-09-27-DidntEmitTemplate.cpp 2004-11-27-ExceptionCleanupAssertion.cpp 2004-11-27-FriendDefaultArgCrash.cpp 2005-01-03-StaticInitializers.cpp from llvm/test/FrontendC++. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138157 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGenCXX/2004-03-08-ReinterpretCastCopy.cpp b/test/CodeGenCXX/2004-03-08-ReinterpretCastCopy.cpp new file mode 100644 index 0000000000..a6e2e30dd5 --- /dev/null +++ b/test/CodeGenCXX/2004-03-08-ReinterpretCastCopy.cpp @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + +struct A { + virtual void Method() = 0; +}; + +struct B : public A { + virtual void Method() { } +}; + +typedef void (A::*fn_type_a)(void); +typedef void (B::*fn_type_b)(void); + +int main(int argc, char **argv) +{ + fn_type_a f = reinterpret_cast(&B::Method); + fn_type_b g = reinterpret_cast(f); + B b; + (b.*g)(); + return 0; +} diff --git a/test/CodeGenCXX/2004-03-09-UnmangledBuiltinMethods.cpp b/test/CodeGenCXX/2004-03-09-UnmangledBuiltinMethods.cpp new file mode 100644 index 0000000000..5d8c8b004b --- /dev/null +++ b/test/CodeGenCXX/2004-03-09-UnmangledBuiltinMethods.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s + +// CHECK: _ZN11AccessFlags6strlenEv +struct AccessFlags { + void strlen(); +}; + +void AccessFlags::strlen() { } diff --git a/test/CodeGenCXX/2004-03-15-CleanupsAndGotos.cpp b/test/CodeGenCXX/2004-03-15-CleanupsAndGotos.cpp new file mode 100644 index 0000000000..01350c00b9 --- /dev/null +++ b/test/CodeGenCXX/2004-03-15-CleanupsAndGotos.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + +// Testcase from Bug 291 + +struct X { + ~X(); +}; + +void foo() { + X v; + +TryAgain: + goto TryAgain; +} diff --git a/test/CodeGenCXX/2004-06-08-LateTemplateInstantiation.cpp b/test/CodeGenCXX/2004-06-08-LateTemplateInstantiation.cpp new file mode 100644 index 0000000000..97254c18a5 --- /dev/null +++ b/test/CodeGenCXX/2004-06-08-LateTemplateInstantiation.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + + +template +struct normal_iterator { + int FIELD; +}; + +void foo(normal_iterator); +normal_iterator baz(); + +void bar() { + foo(baz()); +} + +void *bar2() { + return (void*)foo; +} diff --git a/test/CodeGenCXX/2004-09-27-CompilerCrash.cpp b/test/CodeGenCXX/2004-09-27-CompilerCrash.cpp new file mode 100644 index 0000000000..5e5af4ab60 --- /dev/null +++ b/test/CodeGenCXX/2004-09-27-CompilerCrash.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - + +struct Pass {} ; +template +Pass *callDefaultCtor() { return new PassName(); } + +void foo(Pass *(*C)()); + +#include + +bool foo(std::string &X) { + return X.empty(); +} diff --git a/test/CodeGenCXX/2004-09-27-DidntEmitTemplate.cpp b/test/CodeGenCXX/2004-09-27-DidntEmitTemplate.cpp new file mode 100644 index 0000000000..618894fd72 --- /dev/null +++ b/test/CodeGenCXX/2004-09-27-DidntEmitTemplate.cpp @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +// This is a testcase for LLVM PR445, which was a problem where the +// instantiation of callDefaultCtor was not being emitted correctly. + +// CHECK-NOT: declare{{.*}}callDefaultCtor +struct Pass {}; + +template +Pass *callDefaultCtor() { return new Pass(); } + +void foo(Pass *(*C)()); + +struct basic_string { + bool empty() const { return true; } +}; + + +bool foo2(basic_string &X) { + return X.empty(); +} +void baz() { foo(callDefaultCtor); } diff --git a/test/CodeGenCXX/2004-11-27-ExceptionCleanupAssertion.cpp b/test/CodeGenCXX/2004-11-27-ExceptionCleanupAssertion.cpp new file mode 100644 index 0000000000..ebcce7796e --- /dev/null +++ b/test/CodeGenCXX/2004-11-27-ExceptionCleanupAssertion.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 %s -emit-llvm -o /dev/null + +// This is PR421 + +struct Strongbad { + Strongbad(const char *str ); + ~Strongbad(); + operator const char *() const; +}; + +void TheCheat () { + Strongbad foo(0); + Strongbad dirs[] = { Strongbad(0) + 1}; +} diff --git a/test/CodeGenCXX/2004-11-27-FriendDefaultArgCrash.cpp b/test/CodeGenCXX/2004-11-27-FriendDefaultArgCrash.cpp new file mode 100644 index 0000000000..3bfecd54b7 --- /dev/null +++ b/test/CodeGenCXX/2004-11-27-FriendDefaultArgCrash.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null + +// PR447 + +namespace nm { + struct str { + friend int foo(int arg = 0); + }; +} diff --git a/test/CodeGenCXX/2005-01-03-StaticInitializers.cpp b/test/CodeGenCXX/2005-01-03-StaticInitializers.cpp new file mode 100644 index 0000000000..875c412c6b --- /dev/null +++ b/test/CodeGenCXX/2005-01-03-StaticInitializers.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s + +struct S { + int A[2]; +}; + +// CHECK-NOT: llvm.global_ctor +int XX = (int)(long)&(((struct S*)0)->A[1]);