Changeset a65d92e for src/Tests/ResolvExpr
- Timestamp:
- Jun 5, 2015, 9:34:43 AM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 59db689
- Parents:
- 44b5ca0
- Location:
- src/Tests/ResolvExpr
- Files:
-
- 16 edited
-
Abstype.c (modified) (2 diffs)
-
Attributes.c (modified) (2 diffs)
-
Cast.c (modified) (1 diff)
-
CastError.c (modified) (1 diff)
-
Forall.c (modified) (1 diff)
-
Function.c (modified) (2 diffs)
-
InferParam.c (modified) (2 diffs)
-
Members.c (modified) (3 diffs)
-
Misc.c (modified) (1 diff)
-
MiscError.c (modified) (1 diff)
-
OccursError.c (modified) (1 diff)
-
Operators.c (modified) (1 diff)
-
Quad.c (modified) (1 diff)
-
Rank2.c (modified) (1 diff)
-
ShortCircuit.c (modified) (1 diff)
-
Statement.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/Tests/ResolvExpr/Abstype.c
r44b5ca0 ra65d92e 3 3 type T | { T x( T ); }; 4 4 5 T y( T t ) 6 { 5 T y( T t ) { 7 6 T t_instance; 8 7 return x( t ); 9 8 } 10 9 11 forall( type T) lvalue T *?( T* );12 int ?++( int *);13 int ?=?( int *, int );14 forall( dtype DT) DT* ?=?( DT * *, DT* );10 forall( type T ) lvalue T *?( T * ); 11 int ?++( int *); 12 int ?=?( int *, int ); 13 forall( dtype DT ) DT * ?=?( DT **, DT * ); 15 14 16 type U = int *;15 type U = int *; 17 16 18 U x( U u ) 19 { 17 U x( U u ) { 20 18 U u_instance = u; 21 19 (*u)++; … … 23 21 } 24 22 25 int *break_abstraction( U u ) 26 { 23 int *break_abstraction( U u ) { 27 24 return u; 28 25 } 26 27 // Local Variables: // 28 // tab-width: 4 // 29 // End: // -
src/Tests/ResolvExpr/Attributes.c
r44b5ca0 ra65d92e 1 // "cfa-cpp -ne simple.c"2 3 1 int @voon; 4 2 double @voon; … … 9 7 void g( int ); 10 8 11 void 12 f() 13 { 14 float x; 15 double x; 16 @bort(x); 17 @bort(int); 18 g( @voon ); 9 void f() { 10 float x; 11 double x; 12 @bort(x); 13 @bort(int); 14 g( @voon ); 19 15 } 16 17 // Local Variables: // 18 // tab-width: 4 // 19 // End: // -
src/Tests/ResolvExpr/Cast.c
r44b5ca0 ra65d92e 1 1 char f; 2 void f() 3 {4 char f;5 double f;6 (int)f;7 short f;8 (int)f;9 (void(*)())f;10 ([long, long double, *[]()])([f, f, f]);2 3 void f() { 4 char f; 5 double f; 6 (int)f; 7 short f; 8 (int)f; 9 (void(*)())f; 10 ([long, long double, *[]()])([f, f, f]); 11 11 } 12 13 // Local Variables: // 14 // tab-width: 4 // 15 // End: // -
src/Tests/ResolvExpr/CastError.c
r44b5ca0 ra65d92e 1 1 int f; 2 void f() 3 {4 int f;5 double f;6 (char)f;7 (int(*)())f;2 3 void f() { 4 int f; 5 double f; 6 (char)f; 7 (int(*)())f; 8 8 } 9 10 // Local Variables: // 11 // tab-width: 4 // 12 // End: // -
src/Tests/ResolvExpr/Forall.c
r44b5ca0 ra65d92e 6 6 void (* ?=?( void (**)(void), void (*)(void) ))(void); 7 7 8 void g1() 9 { 10 forall( type T ) T f( T ); 11 void f( int ); 12 void h( void (*p)(void) ); 8 void g1() { 9 forall( type T ) T f( T ); 10 void f( int ); 11 void h( void (*p)(void) ); 13 12 14 int x;15 void (*y)(void);16 char z;17 float w;13 int x; 14 void (*y)(void); 15 char z; 16 float w; 18 17 19 f( x );20 f( y );21 f( z );22 f( w );23 h( f( y ) );18 f( x ); 19 f( y ); 20 f( z ); 21 f( w ); 22 h( f( y ) ); 24 23 } 25 24 26 void g2() 27 { 28 forall( type T ) void f( T, T ); 29 forall( type T, type U ) void f( T, U ); 25 void g2() { 26 forall( type T ) void f( T, T ); 27 forall( type T, type U ) void f( T, U ); 30 28 31 int x;32 float y;33 int *z;34 float *w;29 int x; 30 float y; 31 int *z; 32 float *w; 35 33 36 f( x, y );37 f( z, w );38 f( x, z );34 f( x, y ); 35 f( z, w ); 36 f( x, z ); 39 37 } 38 39 // Local Variables: // 40 // tab-width: 4 // 41 // End: // -
src/Tests/ResolvExpr/Function.c
r44b5ca0 ra65d92e 4 4 float f( float ); 5 5 6 void g() 7 { 8 // selects the same f and a each time 9 // but without a cast would be ambiguous 10 f( (int)a ); 11 (int)f( a ); 6 void g() { 7 // selects the same f each time but without a cast would be ambiguous 8 f( (int)a ); 9 (int)f( a ); 12 10 } 13 11 … … 24 22 [ int, int ] r( int, int, int, int ); 25 23 26 void s() 27 { 28 r( p, q ); 29 r( [ q, p ] ); 30 r( r( p, q ), r( q, q ) ); 24 void s() { 25 r( p, q ); 26 r( [ q, p ] ); 27 r( r( p, q ), r( q, q ) ); 31 28 } 29 30 // Local Variables: // 31 // tab-width: 4 // 32 // End: // -
src/Tests/ResolvExpr/InferParam.c
r44b5ca0 ra65d92e 8 8 void i( float ); 9 9 10 void h() 11 { 12 int a; 13 i( g( a ) ); 10 void h() { 11 int a; 12 i( g( a ) ); 14 13 } 15 14 16 context has_f_and_j( type T, type U ) 17 { 18 U f( T ); 19 U j( T, U ); 15 context has_f_and_j( type T, type U ) { 16 U f( T ); 17 U j( T, U ); 20 18 }; 21 19 … … 23 21 forall( type T, type U | has_f_and_j( T, U ) ) U k( T ); 24 22 25 void l() 26 { 27 int b; 28 i( k( b ) ); 23 void l() { 24 int b; 25 i( k( b ) ); 29 26 } 27 28 // Local Variables: // 29 // tab-width: 4 // 30 // End: // -
src/Tests/ResolvExpr/Members.c
r44b5ca0 ra65d92e 1 // "../../cfa-cpp -nc Members.c"2 3 1 char ?=?( char*, char ); 4 2 int ?=?( int*, int ); … … 13 11 void d( float* ); 14 12 15 struct a_struct 16 { 17 int a; 18 char a; 19 float a; 13 struct a_struct { 14 int a; 15 char a; 16 float a; 20 17 }; 21 18 22 union b_struct 23 { 24 int *a; 25 char *a; 26 float *a; 19 union b_struct { 20 int *a; 21 char *a; 22 float *a; 27 23 }; 28 24 29 void f() 30 { 31 struct a_struct the_struct; 32 union b_struct the_struct; 25 void f() { 26 struct a_struct the_struct; 27 union b_struct the_struct; 33 28 34 a( the_struct.a );35 b( the_struct.a );36 c( the_struct.a );37 d( the_struct.a );29 a( the_struct.a ); 30 b( the_struct.a ); 31 c( the_struct.a ); 32 d( the_struct.a ); 38 33 } 39 34 40 struct c_struct 41 { 42 int; 43 char; 44 float; 35 struct c_struct { 36 int; 37 char; 38 float; 45 39 }; 46 40 47 union d_struct 48 { 49 int*; 50 char*; 51 float*; 41 union d_struct { 42 int*; 43 char*; 44 float*; 52 45 }; 53 46 54 void g() 55 { 56 unsigned short x; 57 struct c_struct x; 58 union d_struct x; 47 void g() { 48 unsigned short x; 49 struct c_struct x; 50 union d_struct x; 59 51 60 a( x ); // the 'a' and 'b' calls resolve to the ushort61 b( x ); // it's debatable whether this is good62 c( x );63 d( x );52 a( x ); // the 'a' and 'b' calls resolve to the ushort 53 b( x ); // it's debatable whether this is good 54 c( x ); 55 d( x ); 64 56 } 65 57 … … 72 64 struct forward { int y; }; 73 65 74 void h() 75 { 66 void h() { 76 67 q->y; 77 68 } 69 70 // Local Variables: // 71 // tab-width: 4 // 72 // End: // -
src/Tests/ResolvExpr/Misc.c
r44b5ca0 ra65d92e 6 6 void g( unsigned ); 7 7 8 void 9 f( void ) 10 { 11 g( (a, b) ); 12 g( (a, a, b) ); 13 g( sizeof a ); 14 g( sizeof( int ) ); 8 void f( void ) { 9 g( (a, b) ); 10 g( (a, a, b) ); 11 g( sizeof a ); 12 g( sizeof( int ) ); 15 13 } 14 15 // Local Variables: // 16 // tab-width: 4 // 17 // End: // -
src/Tests/ResolvExpr/MiscError.c
r44b5ca0 ra65d92e 5 5 void g( int ); 6 6 7 void 8 f( void ) 9 { 10 g( (b, a) ); 11 g( (b, a, b) ); 12 g( (a, b, b) ); 13 sizeof b; 7 void f( void ) { 8 g( (b, a) ); 9 g( (b, a, b) ); 10 g( (a, b, b) ); 11 sizeof b; 14 12 } 13 14 // Local Variables: // 15 // tab-width: 4 // 16 // End: // -
src/Tests/ResolvExpr/OccursError.c
r44b5ca0 ra65d92e 1 // "./cfa-cpp -c simple.c"2 // "./cfa -v simple.c"3 // "./cfa -CFA simple.c > simple_out.c"4 5 1 forall( type T ) void f( void (*)( T, T* ) ); 6 2 forall( type U ) void g( U*, U ); 7 3 8 void test() 9 { 10 f( g ); 4 void test() { 5 f( g ); 11 6 } 7 8 // Local Variables: // 9 // tab-width: 4 // 10 // End: // -
src/Tests/ResolvExpr/Operators.c
r44b5ca0 ra65d92e 1 1 int ?*?( int, int ); 2 2 3 int 4 ?()( int number1, int number2 ) 5 { 6 return number1 * number2; 3 int ?()( int number1, int number2 ) { 4 return number1 * number2; 7 5 } 8 6 9 7 int ?+?( int, int ); 10 8 11 int ?=?( int*, int ); 12 struct accumulator 13 { 14 int total; 9 int ?=?( int *, int ); 10 struct accumulator { 11 int total; 15 12 }; 16 13 17 14 char ?()( struct accumulator a, char number1, char number2 ); 18 15 19 void 20 f( void ) 21 { 22 char a, b; 23 ?()( a, b ); 24 a(b); 25 a + b; 26 struct accumulator ?+?; // why not, eh? 27 a + b; 16 void f( void ) { 17 char a, b; 18 ?()( a, b ); 19 a(b); 20 a + b; 21 struct accumulator ?+?; // why not, eh? 22 a + b; 28 23 } 24 25 // Local Variables: // 26 // tab-width: 4 // 27 // End: // -
src/Tests/ResolvExpr/Quad.c
r44b5ca0 ra65d92e 1 int ?=?( int *, int );1 int ?=?( int *, int ); 2 2 int ?*?( int, int ); 3 3 4 4 forall( type T | { T ?*?( T, T ); } ) 5 T square( T t ) 6 { 7 return t * t; 5 T square( T t ) { 6 return t * t; 8 7 } 9 8 10 9 forall( type U | { U square( U ); } ) 11 U quad( U u ) 12 { 13 return square( square( u ) ); 10 U quad( U u ) { 11 return square( square( u ) ); 14 12 } 15 13 16 void f() 17 { 18 quad( 7 ); 14 void f() { 15 quad( 7 ); 19 16 } 17 18 // Local Variables: // 19 // tab-width: 4 // 20 // End: // -
src/Tests/ResolvExpr/Rank2.c
r44b5ca0 ra65d92e 1 int ?=?( int *, int );2 forall(dtype DT) DT * ?=?( DT * *, DT* );1 int ?=?( int *, int ); 2 forall(dtype DT) DT * ?=?( DT **, DT * ); 3 3 4 void a() 5 { 6 forall( type T ) void f( T ); 7 void g( forall( type U ) void p( U ) ); 8 g( f ); 4 void a() { 5 forall( type T ) void f( T ); 6 void g( forall( type U ) void p( U ) ); 7 g( f ); 9 8 } 10 9 11 void g() 12 { 13 void h( int *null ); 14 forall( type T ) T id( T ); 15 forall( dtype T ) T *0; 16 int 0; 17 h( id( id( id( 0 ) ) ) ); 10 void g() { 11 void h( int *null ); 12 forall( type T ) T id( T ); 13 forall( dtype T ) T *0; 14 int 0; 15 h( id( id( id( 0 ) ) ) ); 18 16 } 17 18 // Local Variables: // 19 // tab-width: 4 // 20 // End: // -
src/Tests/ResolvExpr/ShortCircuit.c
r44b5ca0 ra65d92e 6 6 void g( int ); 7 7 8 void f( int a ) 9 { 10 int b; 11 float c; 12 g( a ? b : c ); 13 g( a && c ); 14 g( a || b ); 8 void f( int a ) { 9 int b; 10 float c; 11 g( a ? b : c ); 12 g( a && c ); 13 g( a || b ); 15 14 } 15 16 // Local Variables: // 17 // tab-width: 4 // 18 // End: // -
src/Tests/ResolvExpr/Statement.c
r44b5ca0 ra65d92e 1 int ?=?( int *, int );1 int ?=?( int *, int ); 2 2 int ?!=?( int, int ); 3 3 int 0; 4 4 5 void f() 6 { 5 void f() { 7 6 int a; 8 7 struct { int b; } a; 9 8 if ( a ) { 10 while ( a ) {11 int *b;12 for ( b; a; b ) {13 }14 }9 while ( a ) { 10 int *b; 11 for ( b; a; b ) { 12 } 13 } 15 14 } 16 15 } 16 17 // Local Variables: // 18 // tab-width: 4 // 19 // End: //
Note:
See TracChangeset
for help on using the changeset viewer.