From: Eric Christopher Date: Fri, 19 Aug 2011 23:41:35 +0000 (+0000) Subject: Migrate, FileCheckize and update: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=16d482ebe8abb5a8eaf5d3407e90c96e6afa397b;p=clang 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++. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138148 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGenCXX/2005-02-11-AnonymousUnion.cpp b/test/CodeGenCXX/2005-02-11-AnonymousUnion.cpp new file mode 100644 index 0000000000..dee5817360 --- /dev/null +++ b/test/CodeGenCXX/2005-02-11-AnonymousUnion.cpp @@ -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; +} diff --git a/test/CodeGenCXX/2005-02-13-BadDynamicInit.cpp b/test/CodeGenCXX/2005-02-13-BadDynamicInit.cpp new file mode 100644 index 0000000000..b1db67aebf --- /dev/null +++ b/test/CodeGenCXX/2005-02-13-BadDynamicInit.cpp @@ -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 }; diff --git a/test/CodeGenCXX/2005-02-14-BitFieldOffset.cpp b/test/CodeGenCXX/2005-02-14-BitFieldOffset.cpp new file mode 100644 index 0000000000..c37f5dce32 --- /dev/null +++ b/test/CodeGenCXX/2005-02-14-BitFieldOffset.cpp @@ -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; +} diff --git a/test/CodeGenCXX/2005-02-19-BitfieldStructCrash.cpp b/test/CodeGenCXX/2005-02-19-BitfieldStructCrash.cpp new file mode 100644 index 0000000000..937a300b5d --- /dev/null +++ b/test/CodeGenCXX/2005-02-19-BitfieldStructCrash.cpp @@ -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); } diff --git a/test/CodeGenCXX/2005-02-19-UnnamedVirtualThunkArgument.cpp b/test/CodeGenCXX/2005-02-19-UnnamedVirtualThunkArgument.cpp new file mode 100644 index 0000000000..986001ada0 --- /dev/null +++ b/test/CodeGenCXX/2005-02-19-UnnamedVirtualThunkArgument.cpp @@ -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; +} diff --git a/test/CodeGenCXX/2005-02-20-BrokenReferenceTest.cpp b/test/CodeGenCXX/2005-02-20-BrokenReferenceTest.cpp new file mode 100644 index 0000000000..36f911e227 --- /dev/null +++ b/test/CodeGenCXX/2005-02-20-BrokenReferenceTest.cpp @@ -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]; +} diff --git a/test/CodeGenCXX/2006-03-01-GimplifyCrash.cpp b/test/CodeGenCXX/2006-03-01-GimplifyCrash.cpp new file mode 100644 index 0000000000..b809751cd0 --- /dev/null +++ b/test/CodeGenCXX/2006-03-01-GimplifyCrash.cpp @@ -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; +} diff --git a/test/CodeGenCXX/2006-03-06-C++RecurseCrash.cpp b/test/CodeGenCXX/2006-03-06-C++RecurseCrash.cpp new file mode 100644 index 0000000000..01476b7ff0 --- /dev/null +++ b/test/CodeGenCXX/2006-03-06-C++RecurseCrash.cpp @@ -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() { } diff --git a/test/CodeGenCXX/2006-09-12-OpaqueStructCrash.cpp b/test/CodeGenCXX/2006-09-12-OpaqueStructCrash.cpp new file mode 100644 index 0000000000..bd270dd602 --- /dev/null +++ b/test/CodeGenCXX/2006-09-12-OpaqueStructCrash.cpp @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s + +struct A { + virtual ~A(); +}; + +template +struct B : public A { + ~B () { delete [] val; } +private: + Ty* val; +}; + +template +struct C : public A { + C (); + ~C (); +}; + +template +struct D : public A { + D () {} + private: + B > blocks; +}; + +template class D; diff --git a/test/CodeGenCXX/2006-10-30-ClassBitfield.cpp b/test/CodeGenCXX/2006-10-30-ClassBitfield.cpp new file mode 100644 index 0000000000..8f61f7b10a --- /dev/null +++ b/test/CodeGenCXX/2006-10-30-ClassBitfield.cpp @@ -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; } diff --git a/test/CodeGenCXX/2006-11-20-GlobalSymbols.cpp b/test/CodeGenCXX/2006-11-20-GlobalSymbols.cpp new file mode 100644 index 0000000000..dfca59dc96 --- /dev/null +++ b/test/CodeGenCXX/2006-11-20-GlobalSymbols.cpp @@ -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; +} diff --git a/test/CodeGenCXX/2006-11-20-GlobalSymbols.ll b/test/CodeGenCXX/2006-11-20-GlobalSymbols.ll new file mode 100644 index 0000000000..2df4434fde --- /dev/null +++ b/test/CodeGenCXX/2006-11-20-GlobalSymbols.ll @@ -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/", 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 ] diff --git a/test/CodeGenCXX/2006-11-30-ConstantExprCrash.cpp b/test/CodeGenCXX/2006-11-30-ConstantExprCrash.cpp new file mode 100644 index 0000000000..2088e63fd5 --- /dev/null +++ b/test/CodeGenCXX/2006-11-30-ConstantExprCrash.cpp @@ -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;