Changeset 6ea8748


Ignore:
Timestamp:
Jul 14, 2017, 5:25:25 PM (4 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
bac5158
Parents:
4b234f0
Message:

That should be all the base code for 'tree structures' to work.

Location:
src
Files:
4 added
11 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r4b234f0 r6ea8748  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:27:00 2017
    13 // Update Count     : 1019
     12// Last Modified On : Fri Jul 14 16:55:00 2017
     13// Update Count     : 1020
    1414//
    1515
     
    253253        newnode->type->aggregate.fields = fields;
    254254        newnode->type->aggregate.body = body;
     255        newnode->type->aggregate.tagged = false;
     256        newnode->type->aggregate.parent = nullptr;
    255257        return newnode;
    256258} // DeclarationNode::newAggregate
     
    273275        return newnode;
    274276} // DeclarationNode::newEnumConstant
     277
     278DeclarationNode * DeclarationNode::newTreeStruct( Aggregate kind, const string * name, const string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body ) {
     279        assert( name );
     280        DeclarationNode * newnode = new DeclarationNode;
     281        newnode->type = new TypeData( TypeData::Aggregate );
     282        newnode->type->aggregate.kind = kind;
     283        newnode->type->aggregate.name = name;
     284        newnode->type->aggregate.actuals = actuals;
     285        newnode->type->aggregate.fields = fields;
     286        newnode->type->aggregate.body = body;
     287        newnode->type->aggregate.tagged = true;
     288        newnode->type->aggregate.parent = parent;
     289        return newnode;
     290} // DeclarationNode::newTreeStruct
    275291
    276292DeclarationNode * DeclarationNode::newName( string * name ) {
  • src/Parser/ParseNode.h

    r4b234f0 r6ea8748  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Jun 12 13:00:00 2017
    13 // Update Count     : 779
     12// Last Modified On : Fri Jul 14 16:56:00 2017
     13// Update Count     : 780
    1414//
    1515
     
    248248        static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement
    249249
     250        // Perhaps this would best fold into newAggragate.
     251        static DeclarationNode * newTreeStruct( Aggregate kind, const std::string * name, const std::string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body );
     252
    250253        DeclarationNode();
    251254        ~DeclarationNode();
     
    332335
    333336        static UniqueName anonymous;
     337
     338        // Temp to test TreeStruct
     339        const std::string * parent_name;
    334340}; // DeclarationNode
    335341
  • src/Parser/TypeData.cc

    r4b234f0 r6ea8748  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:28:00 2017
    13 // Update Count     : 564
     12// Last Modified On : Fri Jul 14 16:58:00 2017
     13// Update Count     : 565
    1414//
    1515
     
    6363                aggregate.fields = nullptr;
    6464                aggregate.body = false;
     65                aggregate.tagged = false;
     66                aggregate.parent = nullptr;
    6567                break;
    6668          case AggregateInst:
     
    121123                delete aggregate.actuals;
    122124                delete aggregate.fields;
     125                delete aggregate.parent;
    123126                // delete aggregate;
    124127                break;
     
    192195                newtype->aggregate.kind = aggregate.kind;
    193196                newtype->aggregate.body = aggregate.body;
     197                newtype->aggregate.tagged = aggregate.tagged;
     198                newtype->aggregate.parent = aggregate.parent ? new string( *aggregate.parent ) : nullptr;
    194199                break;
    195200          case AggregateInst:
     
    619624        switch ( td->aggregate.kind ) {
    620625          case DeclarationNode::Struct:
     626                if ( td->aggregate.tagged ) {
     627                        at = new StructDecl( *td->aggregate.name, td->aggregate.parent, attributes, linkage );
     628                        buildForall( td->aggregate.params, at->get_parameters() );
     629                        break;
     630                }
    621631          case DeclarationNode::Coroutine:
    622632          case DeclarationNode::Monitor:
  • src/Parser/TypeData.h

    r4b234f0 r6ea8748  
    1010// Created On       : Sat May 16 15:18:36 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:29:00 2017
    13 // Update Count     : 186
     12// Last Modified On : Fri Jul 14 16:57:00 2017
     13// Update Count     : 187
    1414//
    1515
     
    3131                DeclarationNode * fields;
    3232                bool body;
     33
     34                bool tagged;
     35                const std::string * parent;
    3336        };
    3437
  • src/Parser/parser.yy

    r4b234f0 r6ea8748  
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat Sep  1 20:22:55 2001
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 13 14:38:54 2017
    13 // Update Count     : 2431
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri Jul 14 16:58:00 2017
     13// Update Count     : 2432
    1414//
    1515
     
    16671667        | aggregate_key attribute_list_opt typegen_name         // CFA
    16681668                { $$ = $3->addQualifiers( $2 ); }
     1669
     1670// Temp, testing TreeStruct
     1671    | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name
     1672        {
     1673            typedefTable.makeTypedef( *$4 );            // create typedef
     1674            if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $
     1675            forall = false;                             // reset
     1676        }
     1677      '{' field_declaration_list '}'
     1678        {
     1679            $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,
     1680                $4, nullptr, nullptr, $7, true )->addQualifiers( $3 );
     1681        }
     1682    | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name TYPEDEFname
     1683        {
     1684            typedefTable.makeTypedef( *$4 );            // create typedef
     1685            if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $
     1686            forall = false;                             // reset
     1687        }
     1688      '{' field_declaration_list '}'
     1689        {
     1690            $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,
     1691                $4, $5, nullptr, $8, true )->addQualifiers( $3 );
     1692        }
    16691693        ;
    16701694
  • src/SymTab/Autogen.cc

    r4b234f0 r6ea8748  
    1010// Created On       : Thu Mar 03 15:45:56 2016
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:30:00 2017
    13 // Update Count     : 61
     12// Last Modified On : Fri Jul 14 16:41:00 2017
     13// Update Count     : 62
    1414//
    1515
     
    401401        void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd, const std::vector< FuncData > & data ) {
    402402                // Builtins do not use autogeneration.
    403                 if ( aggregateDecl->get_linkage() == LinkageSpec::Builtin ||
     403                if ( aggregateDecl->get_linkage() == LinkageSpec::BuiltinCFA ||
    404404                         aggregateDecl->get_linkage() == LinkageSpec::BuiltinC ) {
    405405                        return;
  • src/SymTab/module.mk

    r4b234f0 r6ea8748  
    1010## Author           : Richard C. Bilson
    1111## Created On       : Mon Jun  1 17:49:17 2015
    12 ## Last Modified By : Rob Schluntz
    13 ## Last Modified On : Tue Jul 07 16:22:23 2015
    14 ## Update Count     : 2
     12## Last Modified By : Andrew Beach
     13## Last Modified On : Wed Jul 12 13:06:00 2017
     14## Update Count     : 3
    1515###############################################################################
    1616
     
    2121       SymTab/ImplementationType.cc \
    2222       SymTab/TypeEquality.cc \
    23        SymTab/Autogen.cc
     23       SymTab/Autogen.cc \
     24       SymTab/TreeStruct.cc
  • src/SynTree/Constant.cc

    r4b234f0 r6ea8748  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Jun 22 10:11:00 2017
    13 // Update Count     : 28
     12// Last Modified On : Fri Jul 14 14:50:00 2017
     13// Update Count     : 29
    1414//
    1515
     
    4646}
    4747
     48Constant Constant::null( Type * ptrtype ) {
     49        if ( nullptr == ptrtype ) {
     50                ptrtype = new PointerType(
     51                        Type::Qualifiers(),
     52                        new VoidType( Type::Qualifiers() )
     53                        );
     54        }
     55
     56        return Constant( ptrtype, "0", (unsigned long long int)0 );
     57}
     58
    4859unsigned long long Constant::get_ival() const {
    4960        assertf( safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." );
  • src/SynTree/Constant.h

    r4b234f0 r6ea8748  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Jun 22 10:13:00 2017
    13 // Update Count     : 15
     12// Last Modified On : Fri Jul 14 13:33:00 2017
     13// Update Count     : 16
    1414//
    1515
     
    4444        static Constant from_double( double d );
    4545
     46        /// generates a null pointer value for the given type. void * if omitted.
     47        static Constant null( Type * ptrtype = nullptr );
     48
    4649        virtual void accept( Visitor & v ) { v.visit( this ); }
    4750        virtual Constant * acceptMutator( Mutator & m ) { return m.mutate( this ); }
  • src/SynTree/Declaration.h

    r4b234f0 r6ea8748  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Jun 27 15:31:00 2017
    13 // Update Count     : 122
     12// Last Modified On : Fri Jul 14 16:59:00 2017
     13// Update Count     : 123
    1414//
    1515
     
    266266        typedef AggregateDecl Parent;
    267267  public:
    268         StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ) {}
     268        StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ), tagged( false ), parent_name( "" ) {}
     269        StructDecl( const std::string &name, const std::string *parent, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( DeclarationNode::Struct ), tagged( true ), parent_name( parent ? *parent : "" ) {}
    269270        StructDecl( const StructDecl &other ) : Parent( other ) {}
    270271
     
    273274        bool is_thread() { return kind == DeclarationNode::Thread; }
    274275
     276        // Tagged/Tree Structure Excetion
     277        bool get_tagged() { return tagged; }
     278        void set_tagged( bool newValue ) { tagged = newValue; }
     279        bool has_parent() { return parent_name != ""; }
     280        std::string get_parentName() { return parent_name; }
     281
    275282        virtual StructDecl *clone() const { return new StructDecl( *this ); }
    276283        virtual void accept( Visitor &v ) { v.visit( this ); }
     
    279286        DeclarationNode::Aggregate kind;
    280287        virtual std::string typeString() const;
     288
     289        bool tagged;
     290        std::string parent_name;
    281291};
    282292
  • src/libcfa/Makefile.am

    r4b234f0 r6ea8748  
    1111## Created On       : Sun May 31 08:54:01 2015
    1212## Last Modified By : Andrew Beach
    13 ## Last Modified On : Wed Jun 28 15:36:00 2017
    14 ## Update Count     : 215
     13## Last Modified On : Fri Jun 14 17:00:00 2017
     14## Update Count     : 216
    1515###############################################################################
    1616
     
    5151
    5252libobjs = ${headers:=.o}
    53 libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} exception.c
     53libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \
     54        exception.c typeobject.c
    5455
    5556# not all platforms support concurrency, add option do disable it
     
    6869        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    6970
     71libcfa_a-typeobject.o : typeobject.c
     72        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
     73
    7074concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c
    7175        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    7276
    7377libcfa_d_a-exception.o : exception.c
     78        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
     79
     80libcfa_d_a-typeobject.o : typeobject.c
    7481        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    7582
Note: See TracChangeset for help on using the changeset viewer.