Changeset da6d4566


Ignore:
Timestamp:
Mar 21, 2017, 3:11:35 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
a53e10a
Parents:
9c31349 (diff), 168c007 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    r9c31349 rda6d4566  
    534534                        } else {
    535535                                // expr isn't a call expr, so create a new temporary variable to use to hold the value of the unique expression
    536                                 unqExpr->set_object( new ObjectDecl( toString("_unq_expr_", unqExpr->get_id()), Type::StorageClasses(), LinkageSpec::C, nullptr, unqExpr->get_result()->clone(), nullptr ) );
     536                                unqExpr->set_object( new ObjectDecl( toString("_unq", unqExpr->get_id()), Type::StorageClasses(), LinkageSpec::C, nullptr, unqExpr->get_result()->clone(), nullptr ) );
    537537                                unqExpr->set_var( new VariableExpr( unqExpr->get_object() ) );
    538538                        }
     
    764764                                                }
    765765                                        } else {
    766                                                 stmtsToAddAfter.push_back( ctor );
     766                                                ImplicitCtorDtorStmt * implicit = safe_dynamic_cast< ImplicitCtorDtorStmt * > ( ctor );
     767                                                ExprStmt * ctorStmt = dynamic_cast< ExprStmt * >( implicit->get_callStmt() );
     768                                                ApplicationExpr * ctorCall = nullptr;
     769                                                if ( ctorStmt && (ctorCall = isIntrinsicCallExpr( ctorStmt->get_expr() )) && ctorCall->get_args().size() == 2 ) {
     770                                                        // clean up intrinsic copy constructor calls by making them into SingleInits
     771                                                        objDecl->set_init( new SingleInit( ctorCall->get_args().back() ) );
     772                                                        ctorCall->get_args().pop_back();
     773                                                } else {
     774                                                        stmtsToAddAfter.push_back( ctor );
     775                                                        objDecl->set_init( NULL );
     776                                                        ctorInit->set_ctor( NULL );
     777                                                }
    767778                                        } // if
    768                                         objDecl->set_init( NULL );
    769                                         ctorInit->set_ctor( NULL );
    770779                                } else if ( Initializer * init = ctorInit->get_init() ) {
    771780                                        objDecl->set_init( init );
  • src/Parser/ExpressionNode.cc

    r9c31349 rda6d4566  
    163163ConstantExpr *build_constantStr( const std::string & str ) {
    164164        // 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 ),
    166166                                new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::UnsignedInt ),
    167167                                                                                        toString( str.size()+1-2 ) ) ),  // +1 for '\0' and -2 for '"'
  • src/SynTree/Type.h

    r9c31349 rda6d4566  
    157157        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; }
    158158
     159        /// return type without outer pointers and arrays
    159160        Type *stripDeclarator();
    160161
  • src/Tuples/TupleExpansion.cc

    r9c31349 rda6d4566  
    194194                        }
    195195                        BasicType * boolType = new BasicType( Type::Qualifiers(), BasicType::Bool );
    196                         ObjectDecl * finished = new ObjectDecl( toString( "_unq_expr_finished_", id ), Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::Bool ), new SingleInit( new ConstantExpr( Constant( boolType->clone(), "0" ) ), noDesignators ) );
     196                        ObjectDecl * finished = new ObjectDecl( toString( "_unq", id, "_finished_" ), Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::Bool ), new SingleInit( new ConstantExpr( Constant( boolType->clone(), "0" ) ), noDesignators ) );
    197197                        addDeclaration( finished );
    198198                        // (finished ? _unq_expr_N : (_unq_expr_N = <unqExpr->get_expr()>, finished = 1, _unq_expr_N))
     
    225225                if ( ! typeMap.count( tupleSize ) ) {
    226226                        // generate struct type to replace tuple type based on the number of components in the tuple
    227                         StructDecl * decl = new StructDecl( toString( "_tuple_type_", tupleSize ) );
     227                        StructDecl * decl = new StructDecl( toString( "_tuple", tupleSize, "_" ) );
    228228                        decl->set_body( true );
    229229                        for ( size_t i = 0; i < tupleSize; ++i ) {
  • src/libcfa/iostream.c

    r9c31349 rda6d4566  
    203203        os | arg | ", ";
    204204        os | rest;
     205        return os;
    205206} // ?|?
    206207
  • src/tests/avltree/avl.h

    r9c31349 rda6d4566  
    6161void ?{}(tree(K, V) *t, K key, V value);
    6262
    63 forall(otype K | Comparable(K), otype V)
     63forall(otype K, otype V)
    6464void ^?{}(tree(K, V) * t);
    6565
  • src/tests/avltree/avl1.c

    r9c31349 rda6d4566  
    1212}
    1313
    14 forall(otype K | Comparable(K), otype V)
     14forall(otype K, otype V)
    1515void ^?{}(tree(K, V) * t){
    1616  delete(t->left);
  • src/tests/avltree/avl_test.c

    r9c31349 rda6d4566  
    2525
    2626  // int -> char *
    27   tree(int, char *) * smap = create(-1, "baz");
     27  tree(int, const char *) * smap = create(-1, "baz");
    2828  insert(&smap, 12, "bar");
    2929  insert(&smap, 2, "foo");
     
    3535  delete(smap);
    3636
    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;
    4140  }
    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");
    4545  assert( height(ssmap) == 2 );
    4646
    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"));
    4848
    49   remove(&ssmap, (c_str){"foo"});
     49  remove(&ssmap, "foo");
    5050  delete(ssmap);
    5151}
  • src/tests/completeTypeError.c

    r9c31349 rda6d4566  
    6262
    6363forall(dtype T | sized(T))
    64 void qux(T * z) {
     64void quux(T * z) {
    6565        // okay
    6666        bar(z);
  • src/tests/dtor-early-exit.c

    r9c31349 rda6d4566  
    2828// don't want these called
    2929void ?{}(A * a) { assert( false ); }
    30 void ?{}(A * a, char * name) { a->name = name; sout | "construct " | name | endl; a->x = (int*)malloc(); }
    31 void ?{}(A * a, char * name, int * ptr) { assert( false ); }
     30void ?{}(A * a, const char * name) { a->name = name; sout | "construct " | name | endl; a->x = (int*)malloc(); }
     31void ?{}(A * a, const char * name, int * ptr) { assert( false ); }
    3232
    3333A ?=?(A * a, A a) {  sout | "assign " | a->name | " " | a.name; return a; }
Note: See TracChangeset for help on using the changeset viewer.