Changeset ba54f7d for src/SynTree


Ignore:
Timestamp:
Sep 13, 2017, 3:11:24 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
c57ded70, db70fe4
Parents:
d130fe8 (diff), 982832e (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 plg2:software/cfa/cfa-cc

Location:
src/SynTree
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/AddressExpr.cc

    rd130fe8 rba54f7d  
    4747                } else {
    4848                        // taking address of non-lvalue -- must be a reference, loses one layer of reference
    49                         ReferenceType * refType = safe_dynamic_cast< ReferenceType * >( arg->get_result() );
     49                        ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( arg->get_result() );
    5050                        set_result( addrType( refType->get_base() ) );
    5151                }
  • src/SynTree/ApplicationExpr.cc

    rd130fe8 rba54f7d  
    1414//
    1515
    16 #include <cassert>               // for safe_dynamic_cast, assert
     16#include <cassert>               // for strict_dynamic_cast, assert
    1717#include <list>                  // for list
    1818#include <map>                   // for _Rb_tree_const_iterator, map, map<>:...
     
    5050
    5151ApplicationExpr::ApplicationExpr( Expression *funcExpr, const std::list<Expression *> & args ) : function( funcExpr ), args( args ) {
    52         PointerType *pointer = safe_dynamic_cast< PointerType* >( funcExpr->get_result() );
    53         FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
     52        PointerType *pointer = strict_dynamic_cast< PointerType* >( funcExpr->get_result() );
     53        FunctionType *function = strict_dynamic_cast< FunctionType* >( pointer->get_base() );
    5454
    5555        set_result( ResolvExpr::extractResultType( function ) );
  • src/SynTree/CompoundStmt.cc

    rd130fe8 rba54f7d  
    1414//
    1515
    16 #include <cassert>                    // for assert, safe_dynamic_cast
     16#include <cassert>                    // for assert, strict_dynamic_cast
    1717#include <list>                       // for list, _List_const_iterator, lis...
    1818#include <ostream>                    // for operator<<, ostream, basic_ostream
     
    5252                Statement * origStmt = *origit++;
    5353                if ( DeclStmt * declStmt = dynamic_cast< DeclStmt * >( s ) ) {
    54                         DeclStmt * origDeclStmt = safe_dynamic_cast< DeclStmt * >( origStmt );
     54                        DeclStmt * origDeclStmt = strict_dynamic_cast< DeclStmt * >( origStmt );
    5555                        if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * > ( declStmt->get_decl() ) ) {
    56                                 DeclarationWithType * origdwt = safe_dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() );
     56                                DeclarationWithType * origdwt = strict_dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() );
    5757                                assert( dwt->get_name() == origdwt->get_name() );
    5858                                declMap[ origdwt ] = dwt;
  • src/SynTree/Constant.cc

    rd130fe8 rba54f7d  
    1414//
    1515
    16 #include <cassert>   // for safe_dynamic_cast, assertf
     16#include <cassert>   // for strict_dynamic_cast, assertf
    1717#include <iostream>  // for operator<<, ostream, basic_ostream
    1818#include <string>    // for to_string, string, char_traits, operator<<
     
    5858
    5959unsigned long long Constant::get_ival() const {
    60         assertf( safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." );
     60        assertf( strict_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." );
    6161        return val.ival;
    6262}
    6363
    6464double Constant::get_dval() const {
    65         assertf( ! safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve dval from integer constant." );
     65        assertf( ! strict_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve dval from integer constant." );
    6666        return val.dval;
    6767}
  • src/SynTree/Declaration.h

    rd130fe8 rba54f7d  
    157157        virtual ~FunctionDecl();
    158158
    159         Type * get_type() const;
    160         virtual void set_type(Type *);
     159        Type * get_type() const { return type; }
     160        virtual void set_type(Type * t) { type = strict_dynamic_cast< FunctionType* >( t ); }
    161161
    162162        FunctionType * get_functionType() const { return type; }
  • src/SynTree/Expression.h

    rd130fe8 rba54f7d  
    8686  public:
    8787        Expression * function;
     88        std::list<Expression *> args;
     89        InferredParams inferParams;
    8890
    8991        ApplicationExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() );
     
    100102        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    101103        virtual void print( std::ostream & os, int indent = 0 ) const;
    102 
    103   private:
    104         std::list<Expression *> args;
    105         InferredParams inferParams;
    106104};
    107105
  • src/SynTree/FunctionDecl.cc

    rd130fe8 rba54f7d  
    4444        delete type;
    4545        delete statements;
    46 }
    47 
    48 Type * FunctionDecl::get_type() const {
    49         return type;
    50 }
    51 
    52 void FunctionDecl::set_type( Type *t ) {
    53         type = dynamic_cast< FunctionType* >( t );
    54         assert( type );
    5546}
    5647
  • src/SynTree/Statement.h

    rd130fe8 rba54f7d  
    155155  public:
    156156        Expression * condition;
     157        std::list<Statement *> statements;
    157158
    158159        SwitchStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &statements );
     
    170171        virtual SwitchStmt *clone() const { return new SwitchStmt( *this ); }
    171172        virtual void print( std::ostream &os, int indent = 0 ) const;
    172   private:
    173         std::list<Statement *> statements;
     173
    174174};
    175175
     
    327327class TryStmt : public Statement {
    328328  public:
    329         CompoundStmt *block;
     329        CompoundStmt * block;
    330330        std::list<CatchStmt *> handlers;
    331         FinallyStmt *finallyBlock;
     331        FinallyStmt * finallyBlock;
    332332
    333333        TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 );
  • src/SynTree/TupleExpr.cc

    rd130fe8 rba54f7d  
    1414//
    1515
    16 #include <cassert>              // for assert, safe_dynamic_cast, assertf
     16#include <cassert>              // for assert, strict_dynamic_cast, assertf
    1717#include <iterator>             // for next
    1818#include <list>                 // for list, _List_iterator
     
    6464
    6565TupleIndexExpr::TupleIndexExpr( Expression * tuple, unsigned int index ) : tuple( tuple ), index( index )  {
    66         TupleType * type = safe_dynamic_cast< TupleType * >( tuple->get_result() );
     66        TupleType * type = strict_dynamic_cast< TupleType * >( tuple->get_result() );
    6767        assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested index %d in expr %s", type->size(), index, toString( tuple ).c_str() );
    6868        set_result( (*std::next( type->get_types().begin(), index ))->clone() );
  • src/SynTree/Visitor.h

    rd130fe8 rba54f7d  
    148148}
    149149
    150 template< typename Container, typename VisitorType >
    151 void acceptAllFold( Container &container, VisitorType &visitor, VisitorType &around ) {
    152         SemanticError errors;
    153         for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    154                 try {
    155                         if ( *i ) {
    156                                 VisitorType *v = new VisitorType;
    157                                 (*i)->accept( *v );
    158 
    159                                 typename Container::iterator nxt = i; nxt++; // forward_iterator
    160                                 if ( nxt == container.end() )
    161                                         visitor += *v;
    162                                 else
    163                                         visitor += *v + around;
    164 
    165                                 delete v;
    166                         } // if
    167                 } catch( SemanticError &e ) {
    168                         e.set_location( (*i)->location );
    169                         errors.append( e );
    170                 } // try
    171         } // for
    172         if ( ! errors.isEmpty() ) {
    173                 throw errors;
    174         } // if
    175 }
    176 
    177150// Local Variables: //
    178151// tab-width: 4 //
Note: See TracChangeset for help on using the changeset viewer.