Changeset 839ccbb


Ignore:
Timestamp:
Nov 20, 2015, 4:19:13 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
5189888
Parents:
05587c2 (diff), ed94eac (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.
git-author:
Peter A. Buhr <pabuhr@…> (11/20/15 12:51:58)
git-committer:
Peter A. Buhr <pabuhr@…> (11/20/15 16:19:13)
Message:

Merge branch 'master' of plg2:software/cfa/cfa-cc

Location:
src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/InstantiateGeneric.cc

    r05587c2 r839ccbb  
    219219                StructDecl *concDecl = instantiations.lookup( inst );
    220220                if ( ! concDecl ) {
     221                        assert( inst->get_baseParameters() && "Base struct has parameters" );
    221222                        // set concDecl to new type, insert type declaration into statements to add
    222223                        concDecl = new StructDecl( typeNamer.newName( inst->get_name() ) );
    223224                        substituteMembers( inst->get_baseStruct()->get_members(),
    224                                                                 inst->get_baseParameters(), inst->get_parameters(),
     225                                                                *inst->get_baseParameters(), inst->get_parameters(),
    225226                                                                concDecl->get_members() );
    226227                        addDeclaration( concDecl );
     
    246247                if ( ! concDecl ) {
    247248                        // set concDecl to new type, insert type declaration into statements to add
     249                        assert( inst->get_baseParameters() && "Base union has parameters" );
    248250                        concDecl = new UnionDecl( typeNamer.newName( inst->get_name() ) );
    249251                        substituteMembers( inst->get_baseUnion()->get_members(),
    250                                                                 inst->get_baseParameters(), inst->get_parameters(),
     252                                                                *inst->get_baseParameters(), inst->get_parameters(),
    251253                                                                concDecl->get_members() );
    252254                        addDeclaration( concDecl );
  • src/SymTab/Validate.cc

    r05587c2 r839ccbb  
    1010// Created On       : Sun May 17 21:50:04 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Aug 11 16:59:35 2015
    13 // Update Count     : 196
     12// Last Modified On : Thu Nov 19 22:31:41 2015
     13// Update Count     : 197
    1414//
    1515
     
    195195                acceptAll( translationUnit, pass1 );
    196196                acceptAll( translationUnit, pass2 );
    197                 // need to collect all of the assignment operators prior to
    198                 // this point and only generate assignment operators if one doesn't exist
     197                // need to collect all of the assignment operators prior to this point and only generate assignment operators if
     198                // one doesn't exist
    199199                AddStructAssignment::addStructAssignment( translationUnit );
    200200                acceptAll( translationUnit, pass3 );
  • src/SynTree/Mutator.h

    r05587c2 r839ccbb  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 23 23:24:18 2015
    13 // Update Count     : 7
     12// Last Modified On : Thu Nov 19 22:26:16 2015
     13// Update Count     : 8
    1414//
    1515#include <cassert>
     
    103103inline TreeType *maybeMutate( TreeType *tree, MutatorType &mutator ) {
    104104        if ( tree ) {
    105                 TreeType *newnode = dynamic_cast< TreeType* >( tree->acceptMutator( mutator ) );
     105                TreeType *newnode = dynamic_cast< TreeType * >( tree->acceptMutator( mutator ) );
    106106                assert( newnode );
    107107                return newnode;
  • src/SynTree/ReferenceToType.cc

    r05587c2 r839ccbb  
    5959std::string StructInstType::typeString() const { return "struct"; }
    6060
    61 std::list<TypeDecl*>& StructInstType::get_baseParameters() { return baseStruct->get_parameters(); }
     61std::list<TypeDecl*>* StructInstType::get_baseParameters() {
     62        if ( ! baseStruct ) return NULL;
     63        return &baseStruct->get_parameters();
     64}
    6265
    6366void StructInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
     
    6871std::string UnionInstType::typeString() const { return "union"; }
    6972
    70 std::list<TypeDecl*>& UnionInstType::get_baseParameters() { return baseUnion->get_parameters(); }
     73std::list<TypeDecl*>* UnionInstType::get_baseParameters() {
     74        if ( ! baseUnion ) return NULL;
     75        return &baseUnion->get_parameters();
     76}
    7177
    7278void UnionInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
  • src/SynTree/Type.h

    r05587c2 r839ccbb  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul  9 16:46:15 2015
    13 // Update Count     : 14
     12// Last Modified On : Fri Nov 20 12:54:09 2015
     13// Update Count     : 15
    1414//
    1515
     
    201201        std::list<DeclarationWithType*> parameters;
    202202
    203         // does the function accept a variable number of arguments following the arguments
    204         // specified in the parameters list.    This could be because of
     203        // Does the function accept a variable number of arguments following the arguments specified in the parameters list.
     204        // This could be because of
    205205        // - an ellipsis in a prototype declaration
    206206        // - an unprototyped declaration
     
    238238        void set_baseStruct( StructDecl *newValue ) { baseStruct = newValue; }
    239239
    240         /// Accesses generic parameters of base struct
    241         std::list<TypeDecl*>& get_baseParameters();
     240        /// Accesses generic parameters of base struct (NULL if none such)
     241        std::list<TypeDecl*> * get_baseParameters();
    242242       
    243243        /// Looks up the members of this struct named "name" and places them into "foundDecls".
     
    265265        void set_baseUnion( UnionDecl *newValue ) { baseUnion = newValue; }
    266266
    267         /// Accesses generic parameters of base union
    268         std::list<TypeDecl*>& get_baseParameters();
     267        /// Accesses generic parameters of base union (NULL if none such)
     268        std::list<TypeDecl*> * get_baseParameters();
    269269       
    270270        /// looks up the members of this union named "name" and places them into "foundDecls"
  • src/SynTree/TypeSubstitution.cc

    r05587c2 r839ccbb  
    147147        } // if
    148148        // bind type variables from generic type instantiations
    149         for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_baseParameters().begin(); tyvar != type->get_baseParameters().end(); ++tyvar ) {
    150                 boundVars.insert( (*tyvar)->get_name() );
    151         } // for
     149        std::list< TypeDecl* > *baseParameters = type->get_baseParameters();
     150        if ( baseParameters && ! type->get_parameters().empty() ) {
     151                for ( std::list< TypeDecl* >::const_iterator tyvar = baseParameters->begin(); tyvar != baseParameters->end(); ++tyvar ) {
     152                        boundVars.insert( (*tyvar)->get_name() );
     153                } // for
     154        } // if
    152155        Type *ret = Mutator::mutate( type );
    153156        boundVars = oldBoundVars;
  • src/examples/Makefile.am

    r05587c2 r839ccbb  
    1111## Created On       : Sun May 31 09:08:15 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Thu Nov 19 18:01:56 2015
    14 ## Update Count     : 23
     13## Last Modified On : Fri Nov 20 16:03:46 2015
     14## Update Count     : 24
    1515###############################################################################
    1616
     
    1919CC = @CFA_BINDIR@/cfa
    2020
    21 noinst_PROGRAMS = fstream_test vector_test
     21noinst_PROGRAMS = fstream_test vector_test # build but do not install
    2222fstream_test_SOURCES = iostream.c fstream.c fstream_test.c iterator.c
    2323vector_test_SOURCES = vector_int.c fstream.c iostream.c array.c iterator.c vector_test.c
  • src/examples/fstream.c

    r05587c2 r839ccbb  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May 27 18:12:33 2015
    13 // Update Count     : 2
     12// Last Modified On : Thu Nov 19 22:43:31 2015
     13// Update Count     : 4
    1414//
    1515
     
    3030                fwrite( data, size, 1, os->file );
    3131                os->fail = ferror( os->file );
    32         }
     32        } // if
    3333        return os;
    34 }
     34} // write
    3535
    3636int fail( ofstream *os ) {
    3737        return os->fail;
    38 }
     38} // fail
    3939
    4040static ofstream *make_ofstream() {
     
    4242        new_stream->fail = 0;
    4343        return new_stream;
    44 }
     44} // make_ofstream
    4545
    4646ofstream *ofstream_stdout() {
     
    4848        stdout_stream->file = stdout;
    4949        return stdout_stream;
    50 }
     50} // ofstream_stdout
    5151
    5252ofstream *ofstream_stderr() {
     
    5454        stderr_stream->file = stderr;
    5555        return stderr_stream;
    56 }
     56} // ofstream_stderr
    5757
    5858ofstream *ofstream_fromfile( const char *name ) {
  • src/examples/hello.c

    r05587c2 r839ccbb  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May 27 18:14:58 2015
    13 // Update Count     : 1
     12// Last Modified On : Fri Nov 20 16:02:50 2015
     13// Update Count     : 3
    1414//
    1515
     
    2828// Local Variables: //
    2929// tab-width: 4 //
    30 // compile-command: "cfa hello.c fstream.o iostream.o" //
     30// compile-command: "cfa hello.c fstream.o iostream.o iterator.o" //
    3131// End: //
  • src/examples/iostream.c

    r05587c2 r839ccbb  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Nov 19 17:54:38 2015
    13 // Update Count     : 4
     12// Last Modified On : Fri Nov 20 13:19:19 2015
     13// Update Count     : 9
    1414//
    1515
     
    1717extern "C" {
    1818#include <stdio.h>
    19 //#include <string.h>
    20 //#include <ctype.h>
    21         typedef long unsigned int size_t;
    22         size_t strlen(const char *s);
     19#include <string.h>                                                                             // strlen
    2320}
    2421
     
    2623ostype * ?<<?( ostype *os, char c ) {
    2724        return write( os, &c, 1 );
    28 }
     25} // ?<<?
    2926
    3027forall( dtype ostype | ostream( ostype ) )
     
    3330        sprintf( buffer, "%d", i );
    3431        return write( os, buffer, strlen( buffer ) );
    35 }
     32} // ?<<?
    3633
    3734forall( dtype ostype | ostream( ostype ) )
     
    4037        sprintf( buffer, "%g", d );
    4138        return write( os, buffer, strlen( buffer ) );
    42 }
     39} // ?<<?
    4340
    4441forall( dtype ostype | ostream( ostype ) )
    4542ostype * ?<<?( ostype *os, const char *cp ) {
    4643        return write( os, cp, strlen( cp ) );
    47 }
     44} // ?<<?
    4845
    4946forall( dtype ostype | ostream( ostype ) )
     
    5249        sprintf( buffer, "%p", p );
    5350        return write( os, buffer, strlen( buffer ) );
    54 }
     51} // ?<<?
    5552
    5653forall( type elt_type | writeable( elt_type ),
     
    6259        }
    6360        for_each( begin, end, print );
    64 }
     61} // ?<<?
    6562
    6663forall( type elt_type | writeable( elt_type ),
     
    7269        }
    7370        for_each_reverse( begin, end, print );
    74 }
     71} // ?<<?
    7572
    7673
     
    7875istype * ?>>?( istype *is, char *cp ) {
    7976        return read( is, cp, 1 );
    80 }
     77} // ?>>?
    8178
    8279forall( dtype istype | istream( istype ) )
     
    10097        unread( is, cur );
    10198        return is;
    102 }
     99} // ?>>?
    103100
    104101// Local Variables: //
  • src/main.cc

    r05587c2 r839ccbb  
    99// Author           : Richard C. Bilson
    1010// Created On       : Fri May 15 23:12:02 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Thu Jul 30 16:08:18 2015
    13 // Update Count     : 167
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Nov 19 22:31:40 2015
     13// Update Count     : 168
    1414//
    1515
     
    227227                } // if
    228228
    229                 // add the assignment statement after the
    230                 // initialization of a type parameter
     229                // add the assignment statement after the initialization of a type parameter
    231230                OPTPRINT( "validate" )
    232231                SymTab::validate( translationUnit, symtabp );
Note: See TracChangeset for help on using the changeset viewer.