- Timestamp:
- Mar 21, 2017, 12:21:04 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 94a8123
- Parents:
- 2c4bc81
- Location:
- src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ExpressionNode.cc
r2c4bc81 r142cf5d 163 163 ConstantExpr *build_constantStr( const std::string & str ) { 164 164 // string should probably be a primitive type 165 ArrayType *at = new ArrayType( emptyQualifiers, new BasicType( emptyQualifiers, BasicType::Char ),165 ArrayType *at = new ArrayType( emptyQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), 166 166 new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::UnsignedInt ), 167 167 toString( str.size()+1-2 ) ) ), // +1 for '\0' and -2 for '"' -
src/SynTree/Type.h
r2c4bc81 r142cf5d 155 155 virtual Type * getComponent( unsigned i ) { assertf( size() == 1 && i == 0, "Type::getComponent was called with size %d and index %d\n", size(), i ); return this; } 156 156 157 /// return type without outer pointers and arrays 157 158 Type *stripDeclarator(); 158 159 -
src/tests/avltree/avl.h
r2c4bc81 r142cf5d 61 61 void ?{}(tree(K, V) *t, K key, V value); 62 62 63 forall(otype K | Comparable(K), otype V)63 forall(otype K, otype V) 64 64 void ^?{}(tree(K, V) * t); 65 65 -
src/tests/avltree/avl1.c
r2c4bc81 r142cf5d 12 12 } 13 13 14 forall(otype K | Comparable(K), otype V)14 forall(otype K, otype V) 15 15 void ^?{}(tree(K, V) * t){ 16 16 delete(t->left); -
src/tests/avltree/avl_test.c
r2c4bc81 r142cf5d 25 25 26 26 // int -> char * 27 tree(int, c har *) * smap = create(-1, "baz");27 tree(int, const char *) * smap = create(-1, "baz"); 28 28 insert(&smap, 12, "bar"); 29 29 insert(&smap, 2, "foo"); … … 35 35 delete(smap); 36 36 37 // char* -> char* 38 struct c_str { char *str; }; // wraps a C string 39 int ?<?(c_str a, c_str b) { 40 return strcmp(a.str,b.str) < 0; 37 // const char* -> const char* 38 int ?<?(const char * a, const char * b) { 39 return strcmp(a, b) < 0; 41 40 } 42 tree(c_str, char *) * ssmap = create((c_str){"queso"}, "cheese"); 43 insert(&ssmap, (c_str){"foo"}, "bar"); 44 insert(&ssmap, (c_str){"hello"}, "world"); 41 42 tree(const char *, const char *) * ssmap = create("queso", "cheese"); 43 insert(&ssmap, "foo", "bar"); 44 insert(&ssmap, "hello", "world"); 45 45 assert( height(ssmap) == 2 ); 46 46 47 printf("%s %s %s\n", *find(ssmap, (c_str){"hello"}), *find(ssmap, (c_str){"foo"}), *find(ssmap, (c_str){"queso"}));47 printf("%s %s %s\n", *find(ssmap, "hello"), *find(ssmap, "foo"), *find(ssmap, "queso")); 48 48 49 remove(&ssmap, (c_str){"foo"});49 remove(&ssmap, "foo"); 50 50 delete(ssmap); 51 51 } -
src/tests/completeTypeError.c
r2c4bc81 r142cf5d 62 62 63 63 forall(dtype T | sized(T)) 64 void qu x(T * z) {64 void quux(T * z) { 65 65 // okay 66 66 bar(z); -
src/tests/dtor-early-exit.c
r2c4bc81 r142cf5d 28 28 // don't want these called 29 29 void ?{}(A * a) { assert( false ); } 30 void ?{}(A * a, c har * name) { a->name = name; sout | "construct " | name | endl; a->x = (int*)malloc(); }31 void ?{}(A * a, c har * name, int * ptr) { assert( false ); }30 void ?{}(A * a, const char * name) { a->name = name; sout | "construct " | name | endl; a->x = (int*)malloc(); } 31 void ?{}(A * a, const char * name, int * ptr) { assert( false ); } 32 32 33 33 A ?=?(A * a, A a) { sout | "assign " | a->name | " " | a.name; return a; }
Note: See TracChangeset
for help on using the changeset viewer.