From 74aa7e1eaeb8a38ee5d97ae85a498d6d46b5635d Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Fri, 1 Aug 2008 00:01:51 +0000 Subject: Support constructor and destructor attributes in CodeGen - There is an miscompilation issue remaining due to a poor interaction between the delayed emission of static functions and the emission of constructors, but that already existed prior to this change. llvm-svn: 54258 --- clang/test/CodeGen/constructor-attribute.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 clang/test/CodeGen/constructor-attribute.c (limited to 'clang/test/CodeGen') diff --git a/clang/test/CodeGen/constructor-attribute.c b/clang/test/CodeGen/constructor-attribute.c new file mode 100644 index 00000000000..0ecc47babfe --- /dev/null +++ b/clang/test/CodeGen/constructor-attribute.c @@ -0,0 +1,20 @@ +// RUN: clang -emit-llvm -o %t %s && +// RUN: grep -e "global_ctors.*@A" %t && +// RUN: grep -e "global_dtors.*@B" %t + +#include + +void A() __attribute__((constructor)); +void B() __attribute__((destructor)); + +void A() { + printf("A\n"); +} + +void B() { + printf("B\n"); +} + +int main() { + return 0; +} -- cgit v1.2.3