Changeset 32cab5b for src/CodeGen


Ignore:
Timestamp:
Apr 17, 2018, 12:01:09 PM (8 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, stuck-waitfor-destruct, with_gc
Children:
3265399
Parents:
b2fe1c9 (diff), 81bb114 (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/CodeGen
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    rb2fe1c9 r32cab5b  
    203203
    204204        void CodeGenerator::handleAggregate( AggregateDecl * aggDecl, const std::string & kind ) {
    205                 genAttributes( aggDecl->get_attributes() );
    206 
    207205                if( ! aggDecl->get_parameters().empty() && ! genC ) {
    208206                        // assertf( ! genC, "Aggregate type parameters should not reach code generation." );
     
    213211                }
    214212
    215                 output << kind << aggDecl->get_name();
     213                output << kind;
     214                genAttributes( aggDecl->get_attributes() );
     215                output << aggDecl->get_name();
    216216
    217217                if ( aggDecl->has_body() ) {
     
    298298                        output << " }";
    299299                }
     300        }
     301
     302        void CodeGenerator::postvisit( StaticAssertDecl * assertDecl ) {
     303                output << "_Static_assert(";
     304                assertDecl->condition->accept( *visitor );
     305                output << ", ";
     306                assertDecl->message->accept( *visitor );
     307                output << ")";
    300308        }
    301309
     
    928936                        output << "continue";
    929937                        break;
     938                  case BranchStmt::FallThrough:
     939                  case BranchStmt::FallThroughDefault:
     940                        assertf( ! genC, "fallthru should not reach code generation." );
     941                  output << "fallthru";
     942                        break;
    930943                } // switch
     944                // print branch target for labelled break/continue/fallthru in debug mode
     945                if ( ! genC && branchStmt->get_type() != BranchStmt::Goto ) {
     946                        if ( ! branchStmt->get_target().empty() ) {
     947                                output << " " << branchStmt->get_target();
     948                        } else if ( branchStmt->get_type() == BranchStmt::FallThrough ) {
     949                                output << " default";
     950                        }
     951                }
    931952                output << ";";
    932953        }
  • src/CodeGen/CodeGenerator.h

    rb2fe1c9 r32cab5b  
    4242                void postvisit( FunctionDecl * );
    4343                void postvisit( ObjectDecl * );
    44                 void postvisit( UnionDecl *aggregateDecl );
    45                 void postvisit( EnumDecl *aggregateDecl );
    46                 void postvisit( TraitDecl *aggregateDecl );
    47                 void postvisit( TypedefDecl *typeDecl );
    48                 void postvisit( TypeDecl *typeDecl );
     44                void postvisit( UnionDecl * aggregateDecl );
     45                void postvisit( EnumDecl * aggregateDecl );
     46                void postvisit( TraitDecl * aggregateDecl );
     47                void postvisit( TypedefDecl * typeDecl );
     48                void postvisit( TypeDecl * typeDecl );
     49                void postvisit( StaticAssertDecl * assertDecl );
    4950
    5051                //*** Initializer
  • src/CodeGen/OperatorTable.cc

    rb2fe1c9 r32cab5b  
    7979        } // namespace
    8080
    81         bool operatorLookup( std::string funcName, OperatorInfo &info ) {
     81        bool operatorLookup( const std::string & funcName, OperatorInfo & info ) {
    8282                static bool init = false;
    8383                if ( ! init ) {
     
    100100                        return true;
    101101                } // if
     102        }
     103
     104        bool isOperator( const std::string & funcName ) {
     105                OperatorInfo info;
     106                return operatorLookup( funcName, info );
    102107        }
    103108
  • src/CodeGen/OperatorTable.h

    rb2fe1c9 r32cab5b  
    4141        };
    4242
    43         bool operatorLookup( std::string funcName, OperatorInfo &info );
     43        bool isOperator( const std::string & funcName );
     44        bool operatorLookup( const std::string & funcName, OperatorInfo & info );
    4445
    4546        bool isConstructor( const std::string & );
Note: See TracChangeset for help on using the changeset viewer.