Changeset 982832e for src/SynTree


Ignore:
Timestamp:
Sep 13, 2017, 2:44:01 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:
ba54f7d, c935c3a
Parents:
e3e16bc (diff), 7dc09294 (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/SynTree
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/BasicType.cc

    re3e16bc r982832e  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb  1 17:12:15 2017
    13 // Update Count     : 8
     12// Last Modified On : Mon Sep 11 12:52:05 2017
     13// Update Count     : 9
    1414//
    1515
     
    2525
    2626void BasicType::print( std::ostream &os, int indent ) const {
    27         static const char *kindNames[] = {     
    28                 "_Bool", "char", "signed char", "unsigned char", "short signed int", "short unsigned int",
    29                 "signed int", "unsigned int", "long signed int", "long unsigned int", "long long signed int",
    30                 "long long unsigned int", "float", "double", "long double", "float _Complex", "double _Complex",
    31                 "long double _Complex", "float _Imaginary", "double _Imaginary", "long double _Imaginary"
    32         };
    33 
    3427        Type::print( os, indent );
    35         os << kindNames[ kind ];
     28        os << BasicType::typeNames[ kind ];
    3629}
    3730
  • src/SynTree/Declaration.h

    re3e16bc r982832e  
    136136        Expression *get_bitfieldWidth() const { return bitfieldWidth; }
    137137        void set_bitfieldWidth( Expression *newValue ) { bitfieldWidth = newValue; }
     138
     139        static ObjectDecl * newObject( const std::string & name, Type * type, Initializer * init );
    138140
    139141        virtual ObjectDecl *clone() const { return new ObjectDecl( *this ); }
     
    230232        virtual TypeDecl *clone() const { return new TypeDecl( *this ); }
    231233        virtual void accept( Visitor &v ) { v.visit( this ); }
    232         virtual TypeDecl *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     234        virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    233235        virtual void print( std::ostream &os, int indent = 0 ) const;
    234236
  • src/SynTree/Mutator.cc

    re3e16bc r982832e  
    7878}
    7979
    80 TypeDecl * Mutator::mutate( TypeDecl *typeDecl ) {
     80Declaration * Mutator::mutate( TypeDecl *typeDecl ) {
    8181        handleNamedTypeDecl( typeDecl );
    8282        typeDecl->set_init( maybeMutate( typeDecl->get_init(), *this ) );
  • src/SynTree/Mutator.h

    re3e16bc r982832e  
    3131        virtual Declaration* mutate( EnumDecl *aggregateDecl );
    3232        virtual Declaration* mutate( TraitDecl *aggregateDecl );
    33         virtual TypeDecl* mutate( TypeDecl *typeDecl );
     33        virtual Declaration* mutate( TypeDecl *typeDecl );
    3434        virtual Declaration* mutate( TypedefDecl *typeDecl );
    3535        virtual AsmDecl* mutate( AsmDecl *asmDecl );
  • src/SynTree/ObjectDecl.cc

    re3e16bc r982832e  
    3838        delete init;
    3939        delete bitfieldWidth;
     40}
     41
     42ObjectDecl * ObjectDecl::newObject( const std::string & name, Type * type, Initializer * init ) {
     43        return new ObjectDecl( name, Type::StorageClasses(), LinkageSpec::C, 0, type, init );
    4044}
    4145
  • src/SynTree/Statement.cc

    re3e16bc r982832e  
    472472}
    473473
    474 NullStmt::NullStmt( std::list<Label> labels ) : CompoundStmt( labels ) {}
    475 NullStmt::NullStmt() : CompoundStmt( std::list<Label>() ) {}
     474NullStmt::NullStmt( std::list<Label> labels ) : Statement( labels ) {}
     475NullStmt::NullStmt() : Statement( std::list<Label>() ) {}
    476476
    477477void NullStmt::print( std::ostream &os, __attribute__((unused)) int indent ) const {
  • src/SynTree/Statement.h

    re3e16bc r982832e  
    6767};
    6868
    69 class NullStmt : public CompoundStmt {
     69class NullStmt : public Statement {
    7070  public:
    7171        NullStmt();
  • src/SynTree/Type.cc

    re3e16bc r982832e  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Aug  2 11:11:00 2017
    13 // Update Count     : 29
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Sep 11 13:21:25 2017
     13// Update Count     : 37
    1414//
    1515#include "Type.h"
     
    2626        "_Bool",
    2727        "char",
    28         "char",
     28        "signed char",
    2929        "unsigned char",
    30         "short",
    31         "short unsigned",
    32         "int",
     30        "signed short int",
     31        "unsigned short int",
     32        "signed int",
    3333        "unsigned int",
    34         "long int",
    35         "long unsigned int",
    36         "long long int",
    37         "long long unsigned int",
     34        "signed long int",
     35        "unsigned long int",
     36        "signed long long int",
     37        "unsigned long long int",
    3838        "float",
    3939        "double",
     
    6565
    6666Type * Type::stripDeclarator() {
    67         Type * type = this;
    68         while ( Type * at = InitTweak::getPointerBase( type ) ) {
    69                 type = at;
    70         }
     67        Type * type, * at;
     68        for ( type = this; (at = InitTweak::getPointerBase( type )); type = at );
    7169        return type;
    7270}
    7371
    7472Type * Type::stripReferences() {
    75         Type * type = this;
    76         while ( ReferenceType * ref = dynamic_cast<ReferenceType *>( type ) ) {
    77                 type = ref->get_base();
    78         }
     73        Type * type;
     74        ReferenceType * ref;
     75        for ( type = this; (ref = dynamic_cast<ReferenceType *>( type )); type = ref->get_base() );
    7976        return type;
    8077}
Note: See TracChangeset for help on using the changeset viewer.