Migrate, FileCheckize and update:

2005-02-11-AnonymousUnion.cpp
2005-02-13-BadDynamicInit.cpp
2005-02-14-BitFieldOffset.cpp
2005-02-19-BitfieldStructCrash.cpp
2005-02-19-UnnamedVirtualThunkArgument.cpp
2005-02-20-BrokenReferenceTest.cpp
2006-03-01-GimplifyCrash.cpp
2006-03-06-C++RecurseCrash.cpp
2006-09-12-OpaqueStructCrash.cpp
2006-10-30-ClassBitfield.cpp
2006-11-20-GlobalSymbols.cpp
2006-11-20-GlobalSymbols.ll
2006-11-30-ConstantExprCrash.cpp

from llvm/test/FrontendC++.

llvm-svn: 138148
This commit is contained in:
Eric Christopher 2011-08-19 23:41:35 +00:00
parent 7d4cee4b02
commit 3bf8310d42
13 changed files with 240 additions and 0 deletions

View File

@ -0,0 +1,32 @@
// RUN: %clang_cc1 %s -emit-llvm -o -
// Test anonymous union with members of the same size.
int test1(float F) {
union {
float G;
int i;
};
G = F;
return i;
}
// test anonymous union with members of differing size.
int test2(short F) {
volatile union {
short G;
int i;
};
G = F;
return i;
}
// Make sure that normal unions work. duh :)
volatile union U_t {
short S;
int i;
} U;
int test3(short s) {
U.S = s;
return U.i;
}

View File

@ -0,0 +1,9 @@
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// This testcase corresponds to PR509
struct Data {
unsigned *data;
unsigned array[1];
};
// CHECK-NOT: llvm.global_ctors
Data shared_null = { shared_null.array };

View File

@ -0,0 +1,12 @@
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
// CHECK-NOT: i32 6
struct QVectorTypedData {
int size;
unsigned int sharable : 1;
unsigned short array[1];
};
void foo(QVectorTypedData *X) {
X->array[0] = 123;
}

View File

@ -0,0 +1,14 @@
// RUN: %clang_cc1 -emit-llvm %s -o -
struct QChar {unsigned short X; QChar(unsigned short); } ;
struct Command {
Command(QChar c) : c(c) {}
unsigned int type : 4;
QChar c;
};
Command X(QChar('c'));
void Foo(QChar );
void bar() { Foo(X.c); }

View File

@ -0,0 +1,22 @@
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
struct Foo {
Foo();
virtual ~Foo();
};
struct Bar {
Bar();
virtual ~Bar();
virtual bool test(bool) const;
};
struct Baz : public Foo, public Bar {
Baz();
virtual ~Baz();
virtual bool test(bool) const;
};
bool Baz::test(bool) const {
return true;
}

View File

@ -0,0 +1,10 @@
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
void test(unsigned char *b, int rb) {
typedef unsigned char imgfoo[10][rb];
imgfoo &br = *(imgfoo *)b;
br[0][0] = 1;
rb = br[0][0];
}

View File

@ -0,0 +1,14 @@
// RUN: %clang_cc1 -emit-llvm %s -o -
struct PrefMapElem {
virtual ~PrefMapElem();
unsigned int fPrefId;
};
int foo() {
PrefMapElem* fMap;
if (fMap[0].fPrefId == 1)
return 1;
return 0;
}

View File

@ -0,0 +1,23 @@
// RUN: %clang_cc1 -emit-llvm %s -o -
namespace std {
class exception { };
class type_info {
public:
virtual ~type_info();
};
}
namespace __cxxabiv1 {
class __si_class_type_info : public std::type_info {
~__si_class_type_info();
};
}
class recursive_init: public std::exception {
public:
virtual ~recursive_init() throw ();
};
recursive_init::~recursive_init() throw() { }

View File

@ -0,0 +1,27 @@
// RUN: %clang_cc1 -emit-llvm -o - %s
struct A {
virtual ~A();
};
template <typename Ty>
struct B : public A {
~B () { delete [] val; }
private:
Ty* val;
};
template <typename Ty>
struct C : public A {
C ();
~C ();
};
template <typename Ty>
struct D : public A {
D () {}
private:
B<C<Ty> > blocks;
};
template class D<double>;

View File

@ -0,0 +1,16 @@
// RUN: %clang_cc1 -emit-llvm %s -o -
// PR954
struct _Refcount_Base {
unsigned long _M_ref_count;
int _M_ref_count_lock;
_Refcount_Base() : _M_ref_count(0) {}
};
struct _Rope_RopeRep : public _Refcount_Base
{
public:
int _M_tag:8;
};
int foo(_Rope_RopeRep* r) { return r->_M_tag; }

View File

@ -0,0 +1,11 @@
// PR1013
// Check to make sure debug symbols use the correct name for globals and
// functions. Will not assemble if it fails to.
// RUN: %clang_cc1 -emit-llvm -g -o - %s | FileCheck %s
// CHECK: @"\01f\01oo"
int foo __asm__("f\001oo");
int bar() {
return foo;
}

View File

@ -0,0 +1,29 @@
; ModuleID = '/Volumes/Data/sources/llvm/tools/clang/test/CodeGenCXX/2006-11-20-GlobalSymbols.cpp'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-darwin11.1.0"
@"\01f\01oo" = global i32 0, align 4
define i32 @_Z3barv() nounwind {
entry:
%tmp = load i32* @"\01f\01oo", align 4, !dbg !13
ret i32 %tmp, !dbg !13
}
!llvm.dbg.cu = !{!0}
!0 = metadata !{i32 720913, i32 0, i32 4, metadata !"/Volumes/Data/sources/llvm/tools/clang/test/CodeGenCXX/<unknown>", metadata !"/Volumes/Data/builds/build-llvm/tools/clang/test/CodeGenCXX", metadata !"clang version 3.0 (trunk 138139)", i1 true, i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !3, metadata !10} ; [ DW_TAG_compile_unit ]
!1 = metadata !{metadata !2}
!2 = metadata !{i32 0}
!3 = metadata !{metadata !4}
!4 = metadata !{metadata !5}
!5 = metadata !{i32 720942, i32 0, metadata !6, metadata !"bar", metadata !"bar", metadata !"_Z3barv", metadata !6, i32 8, metadata !7, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 false, i32 ()* @_Z3barv, null, null} ; [ DW_TAG_subprogram ]
!6 = metadata !{i32 720937, metadata !"/Volumes/Data/sources/llvm/tools/clang/test/CodeGenCXX/2006-11-20-GlobalSymbols.cpp", metadata !"/Volumes/Data/builds/build-llvm/tools/clang/test/CodeGenCXX", null} ; [ DW_TAG_file_type ]
!7 = metadata !{i32 720917, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
!8 = metadata !{metadata !9}
!9 = metadata !{i32 720932, null, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!10 = metadata !{metadata !11}
!11 = metadata !{metadata !12}
!12 = metadata !{i32 720948, i32 0, null, metadata !"foo", metadata !"foo", metadata !"\01f\01oo", metadata !6, i32 6, metadata !9, i32 0, i32 1, i32* @"\01f\01oo"} ; [ DW_TAG_variable ]
!13 = metadata !{i32 9, i32 3, metadata !14, null}
!14 = metadata !{i32 720907, metadata !5, i32 8, i32 11, metadata !6, i32 0} ; [ DW_TAG_lexical_block ]

View File

@ -0,0 +1,21 @@
// RUN: %clang_cc1 %s -emit-llvm -o -
// PR1027
struct sys_var {
unsigned name_length;
bool no_support_one_shot;
sys_var() {}
};
struct sys_var_thd : public sys_var {
};
extern sys_var_thd sys_auto_is_null;
sys_var *getsys_variables() {
return &sys_auto_is_null;
}
sys_var *sys_variables = &sys_auto_is_null;