From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/INPUTS/Cocoa_h.m | 2 + clang/INPUTS/all-std-headers.cpp | 86 +++++ clang/INPUTS/c99-intconst-1.c | 639 +++++++++++++++++++++++++++++++++ clang/INPUTS/carbon_h.c | 4 + clang/INPUTS/cfg-big-switch.c | 27 ++ clang/INPUTS/cfg-long-chain1.c | 20 ++ clang/INPUTS/cfg-long-chain2.c | 20 ++ clang/INPUTS/cfg-long-chain3.c | 21 ++ clang/INPUTS/cfg-nested-switches.c | 36 ++ clang/INPUTS/cfg-nested-var-scopes.cpp | 59 +++ clang/INPUTS/iostream.cc | 5 + clang/INPUTS/macro_pounder_fn.c | 17 + clang/INPUTS/macro_pounder_obj.c | 16 + clang/INPUTS/stpcpy-test.c | 47 +++ 14 files changed, 999 insertions(+) create mode 100644 clang/INPUTS/Cocoa_h.m create mode 100644 clang/INPUTS/all-std-headers.cpp create mode 100644 clang/INPUTS/c99-intconst-1.c create mode 100644 clang/INPUTS/carbon_h.c create mode 100644 clang/INPUTS/cfg-big-switch.c create mode 100644 clang/INPUTS/cfg-long-chain1.c create mode 100644 clang/INPUTS/cfg-long-chain2.c create mode 100644 clang/INPUTS/cfg-long-chain3.c create mode 100644 clang/INPUTS/cfg-nested-switches.c create mode 100644 clang/INPUTS/cfg-nested-var-scopes.cpp create mode 100644 clang/INPUTS/iostream.cc create mode 100644 clang/INPUTS/macro_pounder_fn.c create mode 100644 clang/INPUTS/macro_pounder_obj.c create mode 100644 clang/INPUTS/stpcpy-test.c (limited to 'clang/INPUTS') diff --git a/clang/INPUTS/Cocoa_h.m b/clang/INPUTS/Cocoa_h.m new file mode 100644 index 0000000..e6ba599 --- /dev/null +++ b/clang/INPUTS/Cocoa_h.m @@ -0,0 +1,2 @@ + +#import diff --git a/clang/INPUTS/all-std-headers.cpp b/clang/INPUTS/all-std-headers.cpp new file mode 100644 index 0000000..5b5f4ec --- /dev/null +++ b/clang/INPUTS/all-std-headers.cpp @@ -0,0 +1,86 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if __has_include() +#include +#endif +#include +#include +#include +#include + +#if __cplusplus >= 201103 || defined(__GXX_EXPERIMENTAL_CXX0X__) +#include +#if __has_include() +#include +#endif +#include +#if __has_include() +#include +#endif +#include +#include +#if __has_include() +#include +#endif +#include +#include +#include +#include +#include +#if __has_include() +#include +#endif +#include +#include +#include +#include +#if __has_include() +#include +#endif +#include +#include +#endif diff --git a/clang/INPUTS/c99-intconst-1.c b/clang/INPUTS/c99-intconst-1.c new file mode 100644 index 0000000..629b0bc --- /dev/null +++ b/clang/INPUTS/c99-intconst-1.c @@ -0,0 +1,639 @@ +/* Test for integer constant types. */ + +/* Origin: Joseph Myers . */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +#include + +/* Assertion that constant C is of type T. */ +#define ASSERT_CONST_TYPE(C, T) \ + do { \ + typedef T type; \ + typedef type **typepp; \ + typedef __typeof__((C)) ctype; \ + typedef ctype **ctypepp; \ + typepp x = 0; \ + ctypepp y = 0; \ + x = y; \ + y = x; \ + } while (0) + +/* (T *) if E is zero, (void *) otherwise. */ +#define type_if_not(T, E) __typeof__(0 ? (T *)0 : (void *)(E)) + +/* (T *) if E is nonzero, (void *) otherwise. */ +#define type_if(T, E) type_if_not(T, !(E)) + +/* Combine pointer types, all but one (void *). */ +#define type_comb2(T1, T2) __typeof__(0 ? (T1)0 : (T2)0) +#define type_comb3(T1, T2, T3) type_comb2(T1, type_comb2(T2, T3)) +#define type_comb4(T1, T2, T3, T4) \ + type_comb2(T1, type_comb2(T2, type_comb2(T3, T4))) +#define type_comb6(T1, T2, T3, T4, T5, T6) \ + type_comb2(T1, \ + type_comb2(T2, \ + type_comb2(T3, \ + type_comb2(T4, \ + type_comb2(T5, T6))))) + +/* (T1 *) if E1, otherwise (T2 *) if E2. */ +#define first_of2p(T1, E1, T2, E2) type_comb2(type_if(T1, (E1)), \ + type_if(T2, (!(E1) && (E2)))) +/* (T1 *) if E1, otherwise (T2 *) if E2, otherwise (T3 *) if E3. */ +#define first_of3p(T1, E1, T2, E2, T3, E3) \ + type_comb3(type_if(T1, (E1)), \ + type_if(T2, (!(E1) && (E2))), \ + type_if(T3, (!(E1) && !(E2) && (E3)))) +/* (T1 *) if E1, otherwise (T2 *) if E2, otherwise (T3 *) if E3, otherwise + (T4 *) if E4. */ +#define first_of4p(T1, E1, T2, E2, T3, E3, T4, E4) \ + type_comb4(type_if(T1, (E1)), \ + type_if(T2, (!(E1) && (E2))), \ + type_if(T3, (!(E1) && !(E2) && (E3))), \ + type_if(T4, (!(E1) && !(E2) && !(E3) && (E4)))) +/* (T1 *) if E1, otherwise (T2 *) if E2, otherwise (T3 *) if E3, otherwise + (T4 *) if E4, otherwise (T5 *) if E5, otherwise (T6 *) if E6. */ +#define first_of6p(T1, E1, T2, E2, T3, E3, T4, E4, T5, E5, T6, E6) \ + type_comb6(type_if(T1, (E1)), \ + type_if(T2, (!(E1) && (E2))), \ + type_if(T3, (!(E1) && !(E2) && (E3))), \ + type_if(T4, (!(E1) && !(E2) && !(E3) && (E4))), \ + type_if(T5, (!(E1) && !(E2) && !(E3) && !(E4) && (E5))), \ + type_if(T6, (!(E1) && !(E2) && !(E3) \ + && !(E4) && !(E5) && (E6)))) + +/* Likewise, but return the original type rather than a pointer type. */ +#define first_of2(T1, E1, T2, E2) \ + __typeof__(*((first_of2p(T1, (E1), T2, (E2)))0)) +#define first_of3(T1, E1, T2, E2, T3, E3) \ + __typeof__(*((first_of3p(T1, (E1), T2, (E2), T3, (E3)))0)) +#define first_of4(T1, E1, T2, E2, T3, E3, T4, E4) \ + __typeof__(*((first_of4p(T1, (E1), T2, (E2), T3, (E3), T4, (E4)))0)) +#define first_of6(T1, E1, T2, E2, T3, E3, T4, E4, T5, E5, T6, E6) \ + __typeof__(*((first_of6p(T1, (E1), T2, (E2), T3, (E3), \ + T4, (E4), T5, (E5), T6, (E6)))0)) + +/* Types of constants according to the C99 rules. */ +#define C99_UNSUF_DEC_TYPE(C) \ + first_of3(int, (C) <= INT_MAX, \ + long int, (C) <= LONG_MAX, \ + long long int, (C) <= LLONG_MAX) +#define C99_UNSUF_OCTHEX_TYPE(C) \ + first_of6(int, (C) <= INT_MAX, \ + unsigned int, (C) <= UINT_MAX, \ + long int, (C) <= LONG_MAX, \ + unsigned long int, (C) <= ULONG_MAX, \ + long long int, (C) <= LLONG_MAX, \ + unsigned long long int, (C) <= ULLONG_MAX) +#define C99_SUFu_TYPE(C) \ + first_of3(unsigned int, (C) <= UINT_MAX, \ + unsigned long int, (C) <= ULONG_MAX, \ + unsigned long long int, (C) <= ULLONG_MAX) +#define C99_SUFl_DEC_TYPE(C) \ + first_of2(long int, (C) <= LONG_MAX, \ + long long int, (C) <= LLONG_MAX) +#define C99_SUFl_OCTHEX_TYPE(C) \ + first_of4(long int, (C) <= LONG_MAX, \ + unsigned long int, (C) <= ULONG_MAX, \ + long long int, (C) <= LLONG_MAX, \ + unsigned long long int, (C) <= ULLONG_MAX) +#define C99_SUFul_TYPE(C) \ + first_of2(unsigned long int, (C) <= ULONG_MAX, \ + unsigned long long int, (C) <= ULLONG_MAX) +#define C99_SUFll_OCTHEX_TYPE(C) \ + first_of2(long long int, (C) <= LLONG_MAX, \ + unsigned long long int, (C) <= ULLONG_MAX) + +/* Checks that constants have correct type. */ +#define CHECK_UNSUF_DEC_TYPE(C) ASSERT_CONST_TYPE((C), C99_UNSUF_DEC_TYPE((C))) +#define CHECK_UNSUF_OCTHEX_TYPE(C) \ + ASSERT_CONST_TYPE((C), C99_UNSUF_OCTHEX_TYPE((C))) +#define CHECK_SUFu_TYPE(C) ASSERT_CONST_TYPE((C), C99_SUFu_TYPE((C))) +#define CHECK_SUFl_DEC_TYPE(C) ASSERT_CONST_TYPE((C), C99_SUFl_DEC_TYPE((C))) +#define CHECK_SUFl_OCTHEX_TYPE(C) \ + ASSERT_CONST_TYPE((C), C99_SUFl_OCTHEX_TYPE((C))) +#define CHECK_SUFul_TYPE(C) ASSERT_CONST_TYPE((C), C99_SUFul_TYPE((C))) +#define CHECK_SUFll_DEC_TYPE(C) ASSERT_CONST_TYPE((C), long long int) +#define CHECK_SUFll_OCTHEX_TYPE(C) \ + ASSERT_CONST_TYPE((C), C99_SUFll_OCTHEX_TYPE((C))) +#define CHECK_SUFull_TYPE(C) ASSERT_CONST_TYPE((C), unsigned long long int) + +/* Check a decimal value, with all suffixes. */ +#define CHECK_DEC_CONST(C) \ + CHECK_UNSUF_DEC_TYPE(C); \ + CHECK_SUFu_TYPE(C##u); \ + CHECK_SUFu_TYPE(C##U); \ + CHECK_SUFl_DEC_TYPE(C##l); \ + CHECK_SUFl_DEC_TYPE(C##L); \ + CHECK_SUFul_TYPE(C##ul); \ + CHECK_SUFul_TYPE(C##uL); \ + CHECK_SUFul_TYPE(C##Ul); \ + CHECK_SUFul_TYPE(C##UL); \ + CHECK_SUFll_DEC_TYPE(C##ll); \ + CHECK_SUFll_DEC_TYPE(C##LL); \ + CHECK_SUFull_TYPE(C##ull); \ + CHECK_SUFull_TYPE(C##uLL); \ + CHECK_SUFull_TYPE(C##Ull); \ + CHECK_SUFull_TYPE(C##ULL); + +/* Check an octal or hexadecimal value, with all suffixes. */ +#define CHECK_OCTHEX_CONST(C) \ + CHECK_UNSUF_OCTHEX_TYPE(C); \ + CHECK_SUFu_TYPE(C##u); \ + CHECK_SUFu_TYPE(C##U); \ + CHECK_SUFl_OCTHEX_TYPE(C##l); \ + CHECK_SUFl_OCTHEX_TYPE(C##L); \ + CHECK_SUFul_TYPE(C##ul); \ + CHECK_SUFul_TYPE(C##uL); \ + CHECK_SUFul_TYPE(C##Ul); \ + CHECK_SUFul_TYPE(C##UL); \ + CHECK_SUFll_OCTHEX_TYPE(C##ll); \ + CHECK_SUFll_OCTHEX_TYPE(C##LL); \ + CHECK_SUFull_TYPE(C##ull); \ + CHECK_SUFull_TYPE(C##uLL); \ + CHECK_SUFull_TYPE(C##Ull); \ + CHECK_SUFull_TYPE(C##ULL); + +#define CHECK_OCT_CONST(C) CHECK_OCTHEX_CONST(C) +#define CHECK_HEX_CONST(C) \ + CHECK_OCTHEX_CONST(0x##C); \ + CHECK_OCTHEX_CONST(0X##C); + +/* True iff "long long" is at least B bits. This presumes that (B-2)/3 is at + most 63. */ +#define LLONG_AT_LEAST(B) \ + (LLONG_MAX >> ((B)-2)/3 >> ((B)-2)/3 \ + >> ((B)-2 - ((B)-2)/3 - ((B)-2)/3)) + +#define LLONG_HAS_BITS(B) (LLONG_AT_LEAST((B)) && !LLONG_AT_LEAST((B) + 1)) + +void +foo (void) +{ + /* Decimal. */ + /* Check all 2^n and 2^n - 1 up to 2^71 - 1. */ + CHECK_DEC_CONST(1); + CHECK_DEC_CONST(2); + CHECK_DEC_CONST(3); + CHECK_DEC_CONST(4); + CHECK_DEC_CONST(7); + CHECK_DEC_CONST(8); + CHECK_DEC_CONST(15); + CHECK_DEC_CONST(16); + CHECK_DEC_CONST(31); + CHECK_DEC_CONST(32); + CHECK_DEC_CONST(63); + CHECK_DEC_CONST(64); + CHECK_DEC_CONST(127); + CHECK_DEC_CONST(128); + CHECK_DEC_CONST(255); + CHECK_DEC_CONST(256); + CHECK_DEC_CONST(511); + CHECK_DEC_CONST(512); + CHECK_DEC_CONST(1023); + CHECK_DEC_CONST(1024); + CHECK_DEC_CONST(2047); + CHECK_DEC_CONST(2048); + CHECK_DEC_CONST(4095); + CHECK_DEC_CONST(4096); + CHECK_DEC_CONST(8191); + CHECK_DEC_CONST(8192); + CHECK_DEC_CONST(16383); + CHECK_DEC_CONST(16384); + CHECK_DEC_CONST(32767); + CHECK_DEC_CONST(32768); + CHECK_DEC_CONST(65535); + CHECK_DEC_CONST(65536); + CHECK_DEC_CONST(131071); + CHECK_DEC_CONST(131072); + CHECK_DEC_CONST(262143); + CHECK_DEC_CONST(262144); + CHECK_DEC_CONST(524287); + CHECK_DEC_CONST(524288); + CHECK_DEC_CONST(1048575); + CHECK_DEC_CONST(1048576); + CHECK_DEC_CONST(2097151); + CHECK_DEC_CONST(2097152); + CHECK_DEC_CONST(4194303); + CHECK_DEC_CONST(4194304); + CHECK_DEC_CONST(8388607); + CHECK_DEC_CONST(8388608); + CHECK_DEC_CONST(16777215); + CHECK_DEC_CONST(16777216); + CHECK_DEC_CONST(33554431); + CHECK_DEC_CONST(33554432); + CHECK_DEC_CONST(67108863); + CHECK_DEC_CONST(67108864); + CHECK_DEC_CONST(134217727); + CHECK_DEC_CONST(134217728); + CHECK_DEC_CONST(268435455); + CHECK_DEC_CONST(268435456); + CHECK_DEC_CONST(536870911); + CHECK_DEC_CONST(536870912); + CHECK_DEC_CONST(1073741823); + CHECK_DEC_CONST(1073741824); + CHECK_DEC_CONST(2147483647); + CHECK_DEC_CONST(2147483648); + CHECK_DEC_CONST(4294967295); + CHECK_DEC_CONST(4294967296); + CHECK_DEC_CONST(8589934591); + CHECK_DEC_CONST(8589934592); + CHECK_DEC_CONST(17179869183); + CHECK_DEC_CONST(17179869184); + CHECK_DEC_CONST(34359738367); + CHECK_DEC_CONST(34359738368); + CHECK_DEC_CONST(68719476735); + CHECK_DEC_CONST(68719476736); + CHECK_DEC_CONST(137438953471); + CHECK_DEC_CONST(137438953472); + CHECK_DEC_CONST(274877906943); + CHECK_DEC_CONST(274877906944); + CHECK_DEC_CONST(549755813887); + CHECK_DEC_CONST(549755813888); + CHECK_DEC_CONST(1099511627775); + CHECK_DEC_CONST(1099511627776); + CHECK_DEC_CONST(2199023255551); + CHECK_DEC_CONST(2199023255552); + CHECK_DEC_CONST(4398046511103); + CHECK_DEC_CONST(4398046511104); + CHECK_DEC_CONST(8796093022207); + CHECK_DEC_CONST(8796093022208); + CHECK_DEC_CONST(17592186044415); + CHECK_DEC_CONST(17592186044416); + CHECK_DEC_CONST(35184372088831); + CHECK_DEC_CONST(35184372088832); + CHECK_DEC_CONST(70368744177663); + CHECK_DEC_CONST(70368744177664); + CHECK_DEC_CONST(140737488355327); + CHECK_DEC_CONST(140737488355328); + CHECK_DEC_CONST(281474976710655); + CHECK_DEC_CONST(281474976710656); + CHECK_DEC_CONST(562949953421311); + CHECK_DEC_CONST(562949953421312); + CHECK_DEC_CONST(1125899906842623); + CHECK_DEC_CONST(1125899906842624); + CHECK_DEC_CONST(2251799813685247); + CHECK_DEC_CONST(2251799813685248); + CHECK_DEC_CONST(4503599627370495); + CHECK_DEC_CONST(4503599627370496); + CHECK_DEC_CONST(9007199254740991); + CHECK_DEC_CONST(9007199254740992); + CHECK_DEC_CONST(18014398509481983); + CHECK_DEC_CONST(18014398509481984); + CHECK_DEC_CONST(36028797018963967); + CHECK_DEC_CONST(36028797018963968); + CHECK_DEC_CONST(72057594037927935); + CHECK_DEC_CONST(72057594037927936); + CHECK_DEC_CONST(144115188075855871); + CHECK_DEC_CONST(144115188075855872); + CHECK_DEC_CONST(288230376151711743); + CHECK_DEC_CONST(288230376151711744); + CHECK_DEC_CONST(576460752303423487); + CHECK_DEC_CONST(576460752303423488); + CHECK_DEC_CONST(1152921504606846975); + CHECK_DEC_CONST(1152921504606846976); + CHECK_DEC_CONST(2305843009213693951); + CHECK_DEC_CONST(2305843009213693952); + CHECK_DEC_CONST(4611686018427387903); + CHECK_DEC_CONST(4611686018427387904); + CHECK_DEC_CONST(9223372036854775807); +#if LLONG_AT_LEAST(65) + CHECK_DEC_CONST(9223372036854775808); + CHECK_DEC_CONST(18446744073709551615); +#endif +#if LLONG_AT_LEAST(66) + CHECK_DEC_CONST(18446744073709551616); + CHECK_DEC_CONST(36893488147419103231); +#endif +#if LLONG_AT_LEAST(67) + CHECK_DEC_CONST(36893488147419103232); + CHECK_DEC_CONST(73786976294838206463); +#endif +#if LLONG_AT_LEAST(68) + CHECK_DEC_CONST(73786976294838206464); + CHECK_DEC_CONST(147573952589676412927); +#endif +#if LLONG_AT_LEAST(69) + CHECK_DEC_CONST(147573952589676412928); + CHECK_DEC_CONST(295147905179352825855); +#endif +#if LLONG_AT_LEAST(70) + CHECK_DEC_CONST(295147905179352825856); + CHECK_DEC_CONST(590295810358705651711); +#endif +#if LLONG_AT_LEAST(71) + CHECK_DEC_CONST(590295810358705651712); + CHECK_DEC_CONST(1180591620717411303423); +#endif +#if LLONG_AT_LEAST(72) + CHECK_DEC_CONST(1180591620717411303424); + CHECK_DEC_CONST(2361183241434822606847); +#endif + /* Octal and hexadecimal. */ + /* Check all 2^n and 2^n - 1 up to 2^72 - 1. */ + CHECK_OCT_CONST(0); + CHECK_HEX_CONST(0); + CHECK_OCT_CONST(01); + CHECK_HEX_CONST(1); + CHECK_OCT_CONST(02); + CHECK_HEX_CONST(2); + CHECK_OCT_CONST(03); + CHECK_HEX_CONST(3); + CHECK_OCT_CONST(04); + CHECK_HEX_CONST(4); + CHECK_OCT_CONST(07); + CHECK_HEX_CONST(7); + CHECK_OCT_CONST(010); + CHECK_HEX_CONST(8); + CHECK_OCT_CONST(017); + CHECK_HEX_CONST(f); + CHECK_OCT_CONST(020); + CHECK_HEX_CONST(10); + CHECK_OCT_CONST(037); + CHECK_HEX_CONST(1f); + CHECK_OCT_CONST(040); + CHECK_HEX_CONST(20); + CHECK_OCT_CONST(077); + CHECK_HEX_CONST(3f); + CHECK_OCT_CONST(0100); + CHECK_HEX_CONST(40); + CHECK_OCT_CONST(0177); + CHECK_HEX_CONST(7f); + CHECK_OCT_CONST(0200); + CHECK_HEX_CONST(80); + CHECK_OCT_CONST(0377); + CHECK_HEX_CONST(ff); + CHECK_OCT_CONST(0400); + CHECK_HEX_CONST(100); + CHECK_OCT_CONST(0777); + CHECK_HEX_CONST(1ff); + CHECK_OCT_CONST(01000); + CHECK_HEX_CONST(200); + CHECK_OCT_CONST(01777); + CHECK_HEX_CONST(3ff); + CHECK_OCT_CONST(02000); + CHECK_HEX_CONST(400); + CHECK_OCT_CONST(03777); + CHECK_HEX_CONST(7ff); + CHECK_OCT_CONST(04000); + CHECK_HEX_CONST(800); + CHECK_OCT_CONST(07777); + CHECK_HEX_CONST(fff); + CHECK_OCT_CONST(010000); + CHECK_HEX_CONST(1000); + CHECK_OCT_CONST(017777); + CHECK_HEX_CONST(1fff); + CHECK_OCT_CONST(020000); + CHECK_HEX_CONST(2000); + CHECK_OCT_CONST(037777); + CHECK_HEX_CONST(3fff); + CHECK_OCT_CONST(040000); + CHECK_HEX_CONST(4000); + CHECK_OCT_CONST(077777); + CHECK_HEX_CONST(7fff); + CHECK_OCT_CONST(0100000); + CHECK_HEX_CONST(8000); + CHECK_OCT_CONST(0177777); + CHECK_HEX_CONST(ffff); + CHECK_OCT_CONST(0200000); + CHECK_HEX_CONST(10000); + CHECK_OCT_CONST(0377777); + CHECK_HEX_CONST(1ffff); + CHECK_OCT_CONST(0400000); + CHECK_HEX_CONST(20000); + CHECK_OCT_CONST(0777777); + CHECK_HEX_CONST(3ffff); + CHECK_OCT_CONST(01000000); + CHECK_HEX_CONST(40000); + CHECK_OCT_CONST(01777777); + CHECK_HEX_CONST(7ffff); + CHECK_OCT_CONST(02000000); + CHECK_HEX_CONST(80000); + CHECK_OCT_CONST(03777777); + CHECK_HEX_CONST(fffff); + CHECK_OCT_CONST(04000000); + CHECK_HEX_CONST(100000); + CHECK_OCT_CONST(07777777); + CHECK_HEX_CONST(1fffff); + CHECK_OCT_CONST(010000000); + CHECK_HEX_CONST(200000); + CHECK_OCT_CONST(017777777); + CHECK_HEX_CONST(3fffff); + CHECK_OCT_CONST(020000000); + CHECK_HEX_CONST(400000); + CHECK_OCT_CONST(037777777); + CHECK_HEX_CONST(7fffff); + CHECK_OCT_CONST(040000000); + CHECK_HEX_CONST(800000); + CHECK_OCT_CONST(077777777); + CHECK_HEX_CONST(ffffff); + CHECK_OCT_CONST(0100000000); + CHECK_HEX_CONST(1000000); + CHECK_OCT_CONST(0177777777); + CHECK_HEX_CONST(1ffffff); + CHECK_OCT_CONST(0200000000); + CHECK_HEX_CONST(2000000); + CHECK_OCT_CONST(0377777777); + CHECK_HEX_CONST(3ffffff); + CHECK_OCT_CONST(0400000000); + CHECK_HEX_CONST(4000000); + CHECK_OCT_CONST(0777777777); + CHECK_HEX_CONST(7ffffff); + CHECK_OCT_CONST(01000000000); + CHECK_HEX_CONST(8000000); + CHECK_OCT_CONST(01777777777); + CHECK_HEX_CONST(fffffff); + CHECK_OCT_CONST(02000000000); + CHECK_HEX_CONST(10000000); + CHECK_OCT_CONST(03777777777); + CHECK_HEX_CONST(1fffffff); + CHECK_OCT_CONST(04000000000); + CHECK_HEX_CONST(20000000); + CHECK_OCT_CONST(07777777777); + CHECK_HEX_CONST(3fffffff); + CHECK_OCT_CONST(010000000000); + CHECK_HEX_CONST(40000000); + CHECK_OCT_CONST(017777777777); + CHECK_HEX_CONST(7fffffff); + CHECK_OCT_CONST(020000000000); + CHECK_HEX_CONST(80000000); + CHECK_OCT_CONST(037777777777); + CHECK_HEX_CONST(ffffffff); + CHECK_OCT_CONST(040000000000); + CHECK_HEX_CONST(100000000); + CHECK_OCT_CONST(077777777777); + CHECK_HEX_CONST(1ffffffff); + CHECK_OCT_CONST(0100000000000); + CHECK_HEX_CONST(200000000); + CHECK_OCT_CONST(0177777777777); + CHECK_HEX_CONST(3ffffffff); + CHECK_OCT_CONST(0200000000000); + CHECK_HEX_CONST(400000000); + CHECK_OCT_CONST(0377777777777); + CHECK_HEX_CONST(7ffffffff); + CHECK_OCT_CONST(0400000000000); + CHECK_HEX_CONST(800000000); + CHECK_OCT_CONST(0777777777777); + CHECK_HEX_CONST(fffffffff); + CHECK_OCT_CONST(01000000000000); + CHECK_HEX_CONST(1000000000); + CHECK_OCT_CONST(01777777777777); + CHECK_HEX_CONST(1fffffffff); + CHECK_OCT_CONST(02000000000000); + CHECK_HEX_CONST(2000000000); + CHECK_OCT_CONST(03777777777777); + CHECK_HEX_CONST(3fffffffff); + CHECK_OCT_CONST(04000000000000); + CHECK_HEX_CONST(4000000000); + CHECK_OCT_CONST(07777777777777); + CHECK_HEX_CONST(7fffffffff); + CHECK_OCT_CONST(010000000000000); + CHECK_HEX_CONST(8000000000); + CHECK_OCT_CONST(017777777777777); + CHECK_HEX_CONST(ffffffffff); + CHECK_OCT_CONST(020000000000000); + CHECK_HEX_CONST(10000000000); + CHECK_OCT_CONST(037777777777777); + CHECK_HEX_CONST(1ffffffffff); + CHECK_OCT_CONST(040000000000000); + CHECK_HEX_CONST(20000000000); + CHECK_OCT_CONST(077777777777777); + CHECK_HEX_CONST(3ffffffffff); + CHECK_OCT_CONST(0100000000000000); + CHECK_HEX_CONST(40000000000); + CHECK_OCT_CONST(0177777777777777); + CHECK_HEX_CONST(7ffffffffff); + CHECK_OCT_CONST(0200000000000000); + CHECK_HEX_CONST(80000000000); + CHECK_OCT_CONST(0377777777777777); + CHECK_HEX_CONST(fffffffffff); + CHECK_OCT_CONST(0400000000000000); + CHECK_HEX_CONST(100000000000); + CHECK_OCT_CONST(0777777777777777); + CHECK_HEX_CONST(1fffffffffff); + CHECK_OCT_CONST(01000000000000000); + CHECK_HEX_CONST(200000000000); + CHECK_OCT_CONST(01777777777777777); + CHECK_HEX_CONST(3fffffffffff); + CHECK_OCT_CONST(02000000000000000); + CHECK_HEX_CONST(400000000000); + CHECK_OCT_CONST(03777777777777777); + CHECK_HEX_CONST(7fffffffffff); + CHECK_OCT_CONST(04000000000000000); + CHECK_HEX_CONST(800000000000); + CHECK_OCT_CONST(07777777777777777); + CHECK_HEX_CONST(ffffffffffff); + CHECK_OCT_CONST(010000000000000000); + CHECK_HEX_CONST(1000000000000); + CHECK_OCT_CONST(017777777777777777); + CHECK_HEX_CONST(1ffffffffffff); + CHECK_OCT_CONST(020000000000000000); + CHECK_HEX_CONST(2000000000000); + CHECK_OCT_CONST(037777777777777777); + CHECK_HEX_CONST(3ffffffffffff); + CHECK_OCT_CONST(040000000000000000); + CHECK_HEX_CONST(4000000000000); + CHECK_OCT_CONST(077777777777777777); + CHECK_HEX_CONST(7ffffffffffff); + CHECK_OCT_CONST(0100000000000000000); + CHECK_HEX_CONST(8000000000000); + CHECK_OCT_CONST(0177777777777777777); + CHECK_HEX_CONST(fffffffffffff); + CHECK_OCT_CONST(0200000000000000000); + CHECK_HEX_CONST(10000000000000); + CHECK_OCT_CONST(0377777777777777777); + CHECK_HEX_CONST(1fffffffffffff); + CHECK_OCT_CONST(0400000000000000000); + CHECK_HEX_CONST(20000000000000); + CHECK_OCT_CONST(0777777777777777777); + CHECK_HEX_CONST(3fffffffffffff); + CHECK_OCT_CONST(01000000000000000000); + CHECK_HEX_CONST(40000000000000); + CHECK_OCT_CONST(01777777777777777777); + CHECK_HEX_CONST(7fffffffffffff); + CHECK_OCT_CONST(02000000000000000000); + CHECK_HEX_CONST(80000000000000); + CHECK_OCT_CONST(03777777777777777777); + CHECK_HEX_CONST(ffffffffffffff); + CHECK_OCT_CONST(04000000000000000000); + CHECK_HEX_CONST(100000000000000); + CHECK_OCT_CONST(07777777777777777777); + CHECK_HEX_CONST(1ffffffffffffff); + CHECK_OCT_CONST(010000000000000000000); + CHECK_HEX_CONST(200000000000000); + CHECK_OCT_CONST(017777777777777777777); + CHECK_HEX_CONST(3ffffffffffffff); + CHECK_OCT_CONST(020000000000000000000); + CHECK_HEX_CONST(400000000000000); + CHECK_OCT_CONST(037777777777777777777); + CHECK_HEX_CONST(7ffffffffffffff); + CHECK_OCT_CONST(040000000000000000000); + CHECK_HEX_CONST(800000000000000); + CHECK_OCT_CONST(077777777777777777777); + CHECK_HEX_CONST(fffffffffffffff); + CHECK_OCT_CONST(0100000000000000000000); + CHECK_HEX_CONST(1000000000000000); + CHECK_OCT_CONST(0177777777777777777777); + CHECK_HEX_CONST(1fffffffffffffff); + CHECK_OCT_CONST(0200000000000000000000); + CHECK_HEX_CONST(2000000000000000); + CHECK_OCT_CONST(0377777777777777777777); + CHECK_HEX_CONST(3fffffffffffffff); + CHECK_OCT_CONST(0400000000000000000000); + CHECK_HEX_CONST(4000000000000000); + CHECK_OCT_CONST(0777777777777777777777); + CHECK_HEX_CONST(7fffffffffffffff); + CHECK_OCT_CONST(01000000000000000000000); + CHECK_HEX_CONST(8000000000000000); + CHECK_OCT_CONST(01777777777777777777777); + CHECK_HEX_CONST(ffffffffffffffff); +#if LLONG_AT_LEAST(65) + CHECK_OCT_CONST(02000000000000000000000); + CHECK_HEX_CONST(10000000000000000); + CHECK_OCT_CONST(03777777777777777777777); + CHECK_HEX_CONST(1ffffffffffffffff); +#endif +#if LLONG_AT_LEAST(66) + CHECK_OCT_CONST(04000000000000000000000); + CHECK_HEX_CONST(20000000000000000); + CHECK_OCT_CONST(07777777777777777777777); + CHECK_HEX_CONST(3ffffffffffffffff); +#endif +#if LLONG_AT_LEAST(67) + CHECK_OCT_CONST(010000000000000000000000); + CHECK_HEX_CONST(40000000000000000); + CHECK_OCT_CONST(017777777777777777777777); + CHECK_HEX_CONST(7ffffffffffffffff); +#endif +#if LLONG_AT_LEAST(68) + CHECK_OCT_CONST(020000000000000000000000); + CHECK_HEX_CONST(80000000000000000); + CHECK_OCT_CONST(037777777777777777777777); + CHECK_HEX_CONST(fffffffffffffffff); +#endif +#if LLONG_AT_LEAST(69) + CHECK_OCT_CONST(040000000000000000000000); + CHECK_HEX_CONST(100000000000000000); + CHECK_OCT_CONST(077777777777777777777777); + CHECK_HEX_CONST(1fffffffffffffffff); +#endif +#if LLONG_AT_LEAST(70) + CHECK_OCT_CONST(0100000000000000000000000); + CHECK_HEX_CONST(200000000000000000); + CHECK_OCT_CONST(0177777777777777777777777); + CHECK_HEX_CONST(3fffffffffffffffff); +#endif +#if LLONG_AT_LEAST(71) + CHECK_OCT_CONST(0200000000000000000000000); + CHECK_HEX_CONST(400000000000000000); + CHECK_OCT_CONST(0377777777777777777777777); + CHECK_HEX_CONST(7fffffffffffffffff); +#endif +#if LLONG_AT_LEAST(72) + CHECK_OCT_CONST(0400000000000000000000000); + CHECK_HEX_CONST(800000000000000000); + CHECK_OCT_CONST(0777777777777777777777777); + CHECK_HEX_CONST(ffffffffffffffffff); +#endif +} diff --git a/clang/INPUTS/carbon_h.c b/clang/INPUTS/carbon_h.c new file mode 100644 index 0000000..599f123 --- /dev/null +++ b/clang/INPUTS/carbon_h.c @@ -0,0 +1,4 @@ + +#include + +//#import diff --git a/clang/INPUTS/cfg-big-switch.c b/clang/INPUTS/cfg-big-switch.c new file mode 100644 index 0000000..a48b51a --- /dev/null +++ b/clang/INPUTS/cfg-big-switch.c @@ -0,0 +1,27 @@ +#define EXPAND_2_CASES(i, x, y) CASE(i, x, y); CASE(i + 1, x, y); +#define EXPAND_4_CASES(i, x, y) EXPAND_2_CASES(i, x, y) EXPAND_2_CASES(i + 2, x, y) +#define EXPAND_8_CASES(i, x, y) EXPAND_4_CASES(i, x, y) EXPAND_4_CASES(i + 4, x, y) +#define EXPAND_16_CASES(i, x, y) EXPAND_8_CASES(i, x, y) EXPAND_8_CASES(i + 8, x, y) +#define EXPAND_32_CASES(i, x, y) EXPAND_16_CASES(i, x, y) EXPAND_16_CASES(i + 16, x, y) +#define EXPAND_64_CASES(i, x, y) EXPAND_32_CASES(i, x, y) EXPAND_32_CASES(i + 32, x, y) +#define EXPAND_128_CASES(i, x, y) EXPAND_64_CASES(i, x, y) EXPAND_64_CASES(i + 64, x, y) +#define EXPAND_256_CASES(i, x, y) EXPAND_128_CASES(i, x, y) EXPAND_128_CASES(i + 128, x, y) +#define EXPAND_512_CASES(i, x, y) EXPAND_256_CASES(i, x, y) EXPAND_256_CASES(i + 256, x, y) +#define EXPAND_1024_CASES(i, x, y) EXPAND_512_CASES(i, x, y) EXPAND_512_CASES(i + 512, x, y) +#define EXPAND_2048_CASES(i, x, y) EXPAND_1024_CASES(i, x, y) EXPAND_1024_CASES(i + 1024, x, y) +#define EXPAND_4096_CASES(i, x, y) EXPAND_2048_CASES(i, x, y) EXPAND_2048_CASES(i + 2048, x, y) + +// This has a *monstrous* single fan-out in the CFG, across 8000 blocks inside +// the while loop. +unsigned cfg_big_switch(int x) { + unsigned y = 0; + while (x > 0) { + switch(x) { +#define CASE(i, x, y) \ + case i: { int case_var = 3*x + i; y += case_var - 1; break; } +EXPAND_4096_CASES(0, x, y); + } + --x; + } + return y; +} diff --git a/clang/INPUTS/cfg-long-chain1.c b/clang/INPUTS/cfg-long-chain1.c new file mode 100644 index 0000000..2f55b2a --- /dev/null +++ b/clang/INPUTS/cfg-long-chain1.c @@ -0,0 +1,20 @@ +#define EXPAND_2_BRANCHES(i, x, y) BRANCH(i, x, y); BRANCH(i + 1, x, y); +#define EXPAND_4_BRANCHES(i, x, y) EXPAND_2_BRANCHES(i, x, y) EXPAND_2_BRANCHES(i + 2, x, y) +#define EXPAND_8_BRANCHES(i, x, y) EXPAND_4_BRANCHES(i, x, y) EXPAND_4_BRANCHES(i + 4, x, y) +#define EXPAND_16_BRANCHES(i, x, y) EXPAND_8_BRANCHES(i, x, y) EXPAND_8_BRANCHES(i + 8, x, y) +#define EXPAND_32_BRANCHES(i, x, y) EXPAND_16_BRANCHES(i, x, y) EXPAND_16_BRANCHES(i + 16, x, y) +#define EXPAND_64_BRANCHES(i, x, y) EXPAND_32_BRANCHES(i, x, y) EXPAND_32_BRANCHES(i + 32, x, y) +#define EXPAND_128_BRANCHES(i, x, y) EXPAND_64_BRANCHES(i, x, y) EXPAND_64_BRANCHES(i + 64, x, y) +#define EXPAND_256_BRANCHES(i, x, y) EXPAND_128_BRANCHES(i, x, y) EXPAND_128_BRANCHES(i + 128, x, y) +#define EXPAND_512_BRANCHES(i, x, y) EXPAND_256_BRANCHES(i, x, y) EXPAND_256_BRANCHES(i + 256, x, y) +#define EXPAND_1024_BRANCHES(i, x, y) EXPAND_512_BRANCHES(i, x, y) EXPAND_512_BRANCHES(i + 512, x, y) +#define EXPAND_2048_BRANCHES(i, x, y) EXPAND_1024_BRANCHES(i, x, y) EXPAND_1024_BRANCHES(i + 1024, x, y) +#define EXPAND_4096_BRANCHES(i, x, y) EXPAND_2048_BRANCHES(i, x, y) EXPAND_2048_BRANCHES(i + 2048, x, y) + +unsigned cfg_long_chain_single_exit(unsigned x) { + unsigned y = 0; +#define BRANCH(i, x, y) if ((x % 13171) < i) { int var = x / 13171; y ^= var; } + EXPAND_4096_BRANCHES(1, x, y); +#undef BRANCH + return y; +} diff --git a/clang/INPUTS/cfg-long-chain2.c b/clang/INPUTS/cfg-long-chain2.c new file mode 100644 index 0000000..150a084 --- /dev/null +++ b/clang/INPUTS/cfg-long-chain2.c @@ -0,0 +1,20 @@ +#define EXPAND_2_BRANCHES(i, x, y) BRANCH(i, x, y); BRANCH(i + 1, x, y); +#define EXPAND_4_BRANCHES(i, x, y) EXPAND_2_BRANCHES(i, x, y) EXPAND_2_BRANCHES(i + 2, x, y) +#define EXPAND_8_BRANCHES(i, x, y) EXPAND_4_BRANCHES(i, x, y) EXPAND_4_BRANCHES(i + 4, x, y) +#define EXPAND_16_BRANCHES(i, x, y) EXPAND_8_BRANCHES(i, x, y) EXPAND_8_BRANCHES(i + 8, x, y) +#define EXPAND_32_BRANCHES(i, x, y) EXPAND_16_BRANCHES(i, x, y) EXPAND_16_BRANCHES(i + 16, x, y) +#define EXPAND_64_BRANCHES(i, x, y) EXPAND_32_BRANCHES(i, x, y) EXPAND_32_BRANCHES(i + 32, x, y) +#define EXPAND_128_BRANCHES(i, x, y) EXPAND_64_BRANCHES(i, x, y) EXPAND_64_BRANCHES(i + 64, x, y) +#define EXPAND_256_BRANCHES(i, x, y) EXPAND_128_BRANCHES(i, x, y) EXPAND_128_BRANCHES(i + 128, x, y) +#define EXPAND_512_BRANCHES(i, x, y) EXPAND_256_BRANCHES(i, x, y) EXPAND_256_BRANCHES(i + 256, x, y) +#define EXPAND_1024_BRANCHES(i, x, y) EXPAND_512_BRANCHES(i, x, y) EXPAND_512_BRANCHES(i + 512, x, y) +#define EXPAND_2048_BRANCHES(i, x, y) EXPAND_1024_BRANCHES(i, x, y) EXPAND_1024_BRANCHES(i + 1024, x, y) +#define EXPAND_4096_BRANCHES(i, x, y) EXPAND_2048_BRANCHES(i, x, y) EXPAND_2048_BRANCHES(i + 2048, x, y) + +unsigned cfg_long_chain_multiple_exit(unsigned x) { + unsigned y = 0; +#define BRANCH(i, x, y) if (((x % 13171) + ++y) < i) { int var = x / 13171 + y; return var; } + EXPAND_4096_BRANCHES(1, x, y); +#undef BRANCH + return 42; +} diff --git a/clang/INPUTS/cfg-long-chain3.c b/clang/INPUTS/cfg-long-chain3.c new file mode 100644 index 0000000..cca4bdc --- /dev/null +++ b/clang/INPUTS/cfg-long-chain3.c @@ -0,0 +1,21 @@ +#define EXPAND_2_BRANCHES(i, x, y) BRANCH(i, x, y); BRANCH(i + 1, x, y); +#define EXPAND_4_BRANCHES(i, x, y) EXPAND_2_BRANCHES(i, x, y) EXPAND_2_BRANCHES(i + 2, x, y) +#define EXPAND_8_BRANCHES(i, x, y) EXPAND_4_BRANCHES(i, x, y) EXPAND_4_BRANCHES(i + 4, x, y) +#define EXPAND_16_BRANCHES(i, x, y) EXPAND_8_BRANCHES(i, x, y) EXPAND_8_BRANCHES(i + 8, x, y) +#define EXPAND_32_BRANCHES(i, x, y) EXPAND_16_BRANCHES(i, x, y) EXPAND_16_BRANCHES(i + 16, x, y) +#define EXPAND_64_BRANCHES(i, x, y) EXPAND_32_BRANCHES(i, x, y) EXPAND_32_BRANCHES(i + 32, x, y) +#define EXPAND_128_BRANCHES(i, x, y) EXPAND_64_BRANCHES(i, x, y) EXPAND_64_BRANCHES(i + 64, x, y) +#define EXPAND_256_BRANCHES(i, x, y) EXPAND_128_BRANCHES(i, x, y) EXPAND_128_BRANCHES(i + 128, x, y) +#define EXPAND_512_BRANCHES(i, x, y) EXPAND_256_BRANCHES(i, x, y) EXPAND_256_BRANCHES(i + 256, x, y) +#define EXPAND_1024_BRANCHES(i, x, y) EXPAND_512_BRANCHES(i, x, y) EXPAND_512_BRANCHES(i + 512, x, y) +#define EXPAND_2048_BRANCHES(i, x, y) EXPAND_1024_BRANCHES(i, x, y) EXPAND_1024_BRANCHES(i + 1024, x, y) +#define EXPAND_4096_BRANCHES(i, x, y) EXPAND_2048_BRANCHES(i, x, y) EXPAND_2048_BRANCHES(i + 2048, x, y) + +unsigned cfg_long_chain_many_preds(unsigned x) { + unsigned y = 0; +#define BRANCH(i, x, y) if ((x % 13171) < i) { int var = x / 13171; y ^= var; } else + EXPAND_4096_BRANCHES(1, x, y); +#undef BRANCH + int var = x / 13171; y^= var; + return y; +} diff --git a/clang/INPUTS/cfg-nested-switches.c b/clang/INPUTS/cfg-nested-switches.c new file mode 100644 index 0000000..3db10b4 --- /dev/null +++ b/clang/INPUTS/cfg-nested-switches.c @@ -0,0 +1,36 @@ +#define EXPAND_2_INNER_CASES(i, x, y) INNER_CASE(i, x, y); INNER_CASE(i + 1, x, y); +#define EXPAND_4_INNER_CASES(i, x, y) EXPAND_2_INNER_CASES(i, x, y) EXPAND_2_INNER_CASES(i + 2, x, y) +#define EXPAND_8_INNER_CASES(i, x, y) EXPAND_4_INNER_CASES(i, x, y) EXPAND_4_INNER_CASES(i + 4, x, y) +#define EXPAND_16_INNER_CASES(i, x, y) EXPAND_8_INNER_CASES(i, x, y) EXPAND_8_INNER_CASES(i + 8, x, y) +#define EXPAND_32_INNER_CASES(i, x, y) EXPAND_16_INNER_CASES(i, x, y) EXPAND_16_INNER_CASES(i + 16, x, y) +#define EXPAND_64_INNER_CASES(i, x, y) EXPAND_32_INNER_CASES(i, x, y) EXPAND_32_INNER_CASES(i + 32, x, y) + +#define EXPAND_2_OUTER_CASES(i, x, y) OUTER_CASE(i, x, y); OUTER_CASE(i + 1, x, y); +#define EXPAND_4_OUTER_CASES(i, x, y) EXPAND_2_OUTER_CASES(i, x, y) EXPAND_2_OUTER_CASES(i + 2, x, y) +#define EXPAND_8_OUTER_CASES(i, x, y) EXPAND_4_OUTER_CASES(i, x, y) EXPAND_4_OUTER_CASES(i + 4, x, y) +#define EXPAND_16_OUTER_CASES(i, x, y) EXPAND_8_OUTER_CASES(i, x, y) EXPAND_8_OUTER_CASES(i + 8, x, y) +#define EXPAND_32_OUTER_CASES(i, x, y) EXPAND_16_OUTER_CASES(i, x, y) EXPAND_16_OUTER_CASES(i + 16, x, y) +#define EXPAND_64_OUTER_CASES(i, x, y) EXPAND_32_OUTER_CASES(i, x, y) EXPAND_32_OUTER_CASES(i + 32, x, y) + +// Rather than a single monstrous fan-out, this fans out in smaller increments, +// but to a similar size. +unsigned cfg_nested_switch(int x) { + unsigned y = 0; + while (x > 0) { + switch (x) { +#define INNER_CASE(i, x, y) \ + case i: { int case_var = 3*x + i; y += case_var - 1; break; } +#define OUTER_CASE(i, x, y) \ + case i: { \ + int case_var = y >> 8; \ + switch (case_var) { \ + EXPAND_64_INNER_CASES(0, x, y); \ + } \ + break; \ + } +EXPAND_64_OUTER_CASES(0, x, y); + } + --x; + } + return y; +} diff --git a/clang/INPUTS/cfg-nested-var-scopes.cpp b/clang/INPUTS/cfg-nested-var-scopes.cpp new file mode 100644 index 0000000..0944ec2 --- /dev/null +++ b/clang/INPUTS/cfg-nested-var-scopes.cpp @@ -0,0 +1,59 @@ +// Hammer the CFG with large numbers of overlapping variable scopes, which +// implicit destructors triggered at each edge. + +#define EXPAND_BASIC_STRUCT(i) struct X##i { X##i(int); ~X##i(); }; +#define EXPAND_NORET_STRUCT(i) struct X##i { X##i(int); ~X##i() __attribute__((noreturn)); }; +EXPAND_BASIC_STRUCT(0000); EXPAND_NORET_STRUCT(0001); +EXPAND_BASIC_STRUCT(0010); EXPAND_BASIC_STRUCT(0011); +EXPAND_BASIC_STRUCT(0100); EXPAND_NORET_STRUCT(0101); +EXPAND_NORET_STRUCT(0110); EXPAND_BASIC_STRUCT(0111); +EXPAND_BASIC_STRUCT(1000); EXPAND_NORET_STRUCT(1001); +EXPAND_BASIC_STRUCT(1010); EXPAND_BASIC_STRUCT(1011); +EXPAND_NORET_STRUCT(1100); EXPAND_NORET_STRUCT(1101); +EXPAND_BASIC_STRUCT(1110); EXPAND_BASIC_STRUCT(1111); + +#define EXPAND_2_VARS(c, i, x) const X##i var_##c##_##i##0(x), &var_##c##_##i##1 = X##i(x) +#define EXPAND_4_VARS(c, i, x) EXPAND_2_VARS(c, i##0, x); EXPAND_2_VARS(c, i##1, x) +#define EXPAND_8_VARS(c, i, x) EXPAND_4_VARS(c, i##0, x); EXPAND_4_VARS(c, i##1, x) +#define EXPAND_16_VARS(c, i, x) EXPAND_8_VARS(c, i##0, x); EXPAND_8_VARS(c, i##1, x) +#define EXPAND_32_VARS(c, x) EXPAND_16_VARS(c, 0, x); EXPAND_16_VARS(c, 1, x) + +#define EXPAND_2_INNER_CASES(i, x, y) INNER_CASE(i, x, y); INNER_CASE(i + 1, x, y); +#define EXPAND_4_INNER_CASES(i, x, y) EXPAND_2_INNER_CASES(i, x, y) EXPAND_2_INNER_CASES(i + 2, x, y) +#define EXPAND_8_INNER_CASES(i, x, y) EXPAND_4_INNER_CASES(i, x, y) EXPAND_4_INNER_CASES(i + 4, x, y) +#define EXPAND_16_INNER_CASES(i, x, y) EXPAND_8_INNER_CASES(i, x, y) EXPAND_8_INNER_CASES(i + 8, x, y) +#define EXPAND_32_INNER_CASES(i, x, y) EXPAND_16_INNER_CASES(i, x, y) EXPAND_16_INNER_CASES(i + 16, x, y) + +#define EXPAND_2_OUTER_CASES(i, x, y) OUTER_CASE(i, x, y); OUTER_CASE(i + 1, x, y); +#define EXPAND_4_OUTER_CASES(i, x, y) EXPAND_2_OUTER_CASES(i, x, y) EXPAND_2_OUTER_CASES(i + 2, x, y) +#define EXPAND_8_OUTER_CASES(i, x, y) EXPAND_4_OUTER_CASES(i, x, y) EXPAND_4_OUTER_CASES(i + 4, x, y) +#define EXPAND_16_OUTER_CASES(i, x, y) EXPAND_8_OUTER_CASES(i, x, y) EXPAND_8_OUTER_CASES(i + 8, x, y) +#define EXPAND_32_OUTER_CASES(i, x, y) EXPAND_16_OUTER_CASES(i, x, y) EXPAND_16_OUTER_CASES(i + 16, x, y) + +unsigned cfg_nested_vars(int x) { + int y = 0; + while (x > 0) { + EXPAND_32_VARS(a, x); + switch (x) { +#define INNER_CASE(i, x, y) \ + case i: { \ + int case_var = 3*x + i; \ + EXPAND_32_VARS(c, case_var); \ + y += case_var - 1; \ + break; \ + } +#define OUTER_CASE(i, x, y) \ + case i: { \ + int case_var = y >> 8; \ + EXPAND_32_VARS(b, y); \ + switch (case_var) { \ + EXPAND_32_INNER_CASES(0, x, y); \ + } \ + break; \ + } +EXPAND_32_OUTER_CASES(0, x, y); + } + --x; + } + return y; +} diff --git a/clang/INPUTS/iostream.cc b/clang/INPUTS/iostream.cc new file mode 100644 index 0000000..eb12fc9 --- /dev/null +++ b/clang/INPUTS/iostream.cc @@ -0,0 +1,5 @@ +// clang -I/usr/include/c++/4.0.0 -I/usr/include/c++/4.0.0/powerpc-apple-darwin8 -I/usr/include/c++/4.0.0/backward INPUTS/iostream.cc -Eonly + +#include + +#include diff --git a/clang/INPUTS/macro_pounder_fn.c b/clang/INPUTS/macro_pounder_fn.c new file mode 100644 index 0000000..73f40a1 --- /dev/null +++ b/clang/INPUTS/macro_pounder_fn.c @@ -0,0 +1,17 @@ + +// This pounds on macro expansion for performance reasons. This is currently +// heavily constrained by darwin's malloc. + +// Function-like macros. +#define A0(A, B) A B +#define A1(A, B) A0(A,B) A0(A,B) A0(A,B) A0(A,B) A0(A,B) A0(A,B) +#define A2(A, B) A1(A,B) A1(A,B) A1(A,B) A1(A,B) A1(A,B) A1(A,B) +#define A3(A, B) A2(A,B) A2(A,B) A2(A,B) A2(A,B) A2(A,B) A2(A,B) +#define A4(A, B) A3(A,B) A3(A,B) A3(A,B) A3(A,B) A3(A,B) A3(A,B) +#define A5(A, B) A4(A,B) A4(A,B) A4(A,B) A4(A,B) A4(A,B) A4(A,B) +#define A6(A, B) A5(A,B) A5(A,B) A5(A,B) A5(A,B) A5(A,B) A5(A,B) +#define A7(A, B) A6(A,B) A6(A,B) A6(A,B) A6(A,B) A6(A,B) A6(A,B) +#define A8(A, B) A7(A,B) A7(A,B) A7(A,B) A7(A,B) A7(A,B) A7(A,B) + +A8(a, b) + diff --git a/clang/INPUTS/macro_pounder_obj.c b/clang/INPUTS/macro_pounder_obj.c new file mode 100644 index 0000000..d2465f3 --- /dev/null +++ b/clang/INPUTS/macro_pounder_obj.c @@ -0,0 +1,16 @@ + +// This pounds on macro expansion for performance reasons. This is currently +// heavily constrained by darwin's malloc. + +// Object-like expansions +#define A0 a b +#define A1 A0 A0 A0 A0 A0 A0 +#define A2 A1 A1 A1 A1 A1 A1 +#define A3 A2 A2 A2 A2 A2 A2 +#define A4 A3 A3 A3 A3 A3 A3 +#define A5 A4 A4 A4 A4 A4 A4 +#define A6 A5 A5 A5 A5 A5 A5 +#define A7 A6 A6 A6 A6 A6 A6 +#define A8 A7 A7 A7 A7 A7 A7 + +A8 diff --git a/clang/INPUTS/stpcpy-test.c b/clang/INPUTS/stpcpy-test.c new file mode 100644 index 0000000..b96a806 --- /dev/null +++ b/clang/INPUTS/stpcpy-test.c @@ -0,0 +1,47 @@ +#define __extension__ + +#define __stpcpy(dest, src) (__extension__ (__builtin_constant_p (src) ? (__string2_1bptr_p (src) && strlen (src) + 1 <= 8 ? __stpcpy_small (dest, __stpcpy_args (src), strlen (src) + 1) : ((char *) __mempcpy (dest, src, strlen (src) + 1) - 1)) : __stpcpy (dest, src))) +#define stpcpy(dest, src) __stpcpy (dest, src) +#define __stpcpy_args(src) __extension__ __STRING2_SMALL_GET16 (src, 0), __extension__ __STRING2_SMALL_GET16 (src, 4), __extension__ __STRING2_SMALL_GET32 (src, 0), __extension__ __STRING2_SMALL_GET32 (src, 4) + +#define __mempcpy(dest, src, n) (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) && __string2_1bptr_p (src) && n <= 8 ? __mempcpy_small (dest, __mempcpy_args (src), n) : __mempcpy (dest, src, n))) +#define mempcpy(dest, src, n) __mempcpy (dest, src, n) +#define __mempcpy_args(src) ((char *) (src))[0], ((char *) (src))[2], ((char *) (src))[4], ((char *) (src))[6], __extension__ __STRING2_SMALL_GET16 (src, 0), __extension__ __STRING2_SMALL_GET16 (src, 4), __extension__ __STRING2_SMALL_GET32 (src, 0), __extension__ __STRING2_SMALL_GET32 (src, 4) + +#define __STRING2_SMALL_GET16(src, idx) (((__const unsigned char *) (__const char *) (src))[idx + 1] << 8 | ((__const unsigned char *) (__const char *) (src))[idx]) + +#define __STRING2_SMALL_GET32(src, idx) (((((__const unsigned char *) (__const char *) (src))[idx + 3] << 8 | ((__const unsigned char *) (__const char *) (src))[idx + 2]) << 8 | ((__const unsigned char *) (__const char *) (src))[idx + 1]) << 8 | ((__const unsigned char *) (__const char *) (src))[idx]) + +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) +stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e) -- cgit v1.2.3