forked from OSchip/llvm-project
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++. llvm-svn: 138157
This commit is contained in:
parent
74cfab0fbe
commit
6672b33511
|
@ -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<fn_type_a>(&B::Method);
|
||||
fn_type_b g = reinterpret_cast<fn_type_b>(f);
|
||||
B b;
|
||||
(b.*g)();
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
|
||||
|
||||
// CHECK: _ZN11AccessFlags6strlenEv
|
||||
struct AccessFlags {
|
||||
void strlen();
|
||||
};
|
||||
|
||||
void AccessFlags::strlen() { }
|
|
@ -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;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o -
|
||||
|
||||
|
||||
template<typename Ty>
|
||||
struct normal_iterator {
|
||||
int FIELD;
|
||||
};
|
||||
|
||||
void foo(normal_iterator<int>);
|
||||
normal_iterator<int> baz();
|
||||
|
||||
void bar() {
|
||||
foo(baz());
|
||||
}
|
||||
|
||||
void *bar2() {
|
||||
return (void*)foo;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o -
|
||||
|
||||
struct Pass {} ;
|
||||
template<typename PassName>
|
||||
Pass *callDefaultCtor() { return new PassName(); }
|
||||
|
||||
void foo(Pass *(*C)());
|
||||
|
||||
#include <string>
|
||||
|
||||
bool foo(std::string &X) {
|
||||
return X.empty();
|
||||
}
|
|
@ -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<typename PassName>
|
||||
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<Pass>); }
|
|
@ -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};
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
// PR447
|
||||
|
||||
namespace nm {
|
||||
struct str {
|
||||
friend int foo(int arg = 0);
|
||||
};
|
||||
}
|
|
@ -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]);
|
Loading…
Reference in New Issue