Changeset 05d55ff for src


Ignore:
Timestamp:
Jun 7, 2019, 4:15:03 PM (3 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
2d11663, 46438e4
Parents:
60aaa51d (diff), be8518f (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
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/AST/AssertAcyclic.cpp

    r60aaa51d r05d55ff  
    1010// Created On       : Thu Jun 06 15:00:00 2019
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu Jun 06 15:00:00 2019
    13 // Update Count     : 0
     12// Last Modified On : Fri Jun 07 14:32:00 2019
     13// Update Count     : 1
    1414//
    1515
     
    2020namespace {
    2121
    22 class NoStrongCyclesCore : public ast::WithGuards {
     22class NoStrongCyclesCore {
    2323    std::vector<const ast::Node *> parents;
    2424public:
    25         void previsit ( const ast::Node * node ) {
    26                 for (auto & p : parents) {
    27                         assert(p != node);
     25        void previsit( const ast::Node * node ) {
     26                for (auto & parent : parents) {
     27                        assert(parent != node);
    2828                }
    2929                parents.push_back(node);
    30                 GuardAction( [this]() { parents.pop_back(); } );
     30        }
     31        void postvisit( const ast::Node * ) {
     32                parents.pop_back();
    3133        }
    3234};
     
    3638namespace ast {
    3739
    38 void assertAcyclic( const std::list< ast::ptr< ast::Decl > > translationUnit ) {
     40void assertAcyclic( const std::list< ast::ptr< ast::Decl > > & translationUnit ) {
    3941        Pass<NoStrongCyclesCore> visitor;
    4042        for ( auto & decl : translationUnit ) {
  • src/AST/AssertAcyclic.hpp

    r60aaa51d r05d55ff  
    88//
    99// Author           : Andrew Beach
    10 // Created On       : Thr May 6 15:00:00 2019
     10// Created On       : Thr Jun 6 15:00:00 2019
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr May 6 15:00:00 2019
    13 // Update Count     : 0
     12// Last Modified On : Fri Jun  7 14:32:00 2019
     13// Update Count     : 1
    1414//
    1515
     
    2525namespace ast {
    2626
    27 void assertAcyclic( const std::list< ast::ptr< ast::Decl > > translationUnit );
     27void assertAcyclic( const std::list< ast::ptr< ast::Decl > > & translationUnit );
    2828
    2929}
  • src/AST/Convert.cpp

    r60aaa51d r05d55ff  
    736736                expr->var = get<DeclarationWithType>().accept1(node->var);
    737737                Type * type = expr->var->get_type()->clone();
     738                if(FunctionType * ft = dynamic_cast<FunctionType*>(type)) {
     739                        if(node->result.as<ast::PointerType>()) {
     740                                type = new PointerType({}, ft);
     741                        }
     742                }
     743
    738744                type->set_lvalue( true );
    739                 expr->set_result( type );
     745                expr->result = type ;
    740746                this->node = expr;
    741747                return nullptr;
     
    783789                        assert (!rslt->isType);
    784790                }
    785                 if (node->type) {
     791                else {
     792                        assert(node->type);
    786793                        rslt = new SizeofExpr(
    787794                                get<Type>().accept1(node->type)
     
    804811                        assert (!rslt->isType);
    805812                }
    806                 if (node->type) {
     813                else {
     814                        assert(node->type);
    807815                        rslt = new AlignofExpr(
    808816                                get<Type>().accept1(node->type)
     
    21642172                );
    21652173
    2166                 visitBaseExpr( old,
     2174                visitBaseExpr_SkipResultType( old,
    21672175                        expr
    21682176                );
     
    21702178                expr->var = GET_ACCEPT_1(var, DeclWithType);
    21712179                expr->result = expr->var->get_type();
     2180                if(const ast::FunctionType * ft = expr->result.as<ast::FunctionType>()) {
     2181                        if(dynamic_cast<PointerType *>(old->result)) {
     2182                                expr->result = new ast::PointerType(ft);
     2183                        }
     2184                }
    21722185                add_qualifiers( expr->result, ast::CV::Lvalue );
    21732186                this->node = expr;
  • src/AST/Pass.hpp

    r60aaa51d r05d55ff  
    287287                at_cleanup( [func](void *) { func(); }, nullptr );
    288288        }
     289
     290        /// When this node is finished being visited, call a member of an object.
     291        template<typename T>
     292        void GuardMethod( T * obj, void (T::*method)() ) {
     293                at_cleanup( [ method ]( void * object ) {
     294                        static_cast< T * >( object )->method();
     295                }, static_cast< void * >( obj ) );
     296        }
    289297};
    290298
  • src/CodeGen/CodeGenerator.cc

    r60aaa51d r05d55ff  
    116116        }
    117117
    118         CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC, bool lineMarks, bool printExprTypes ) : indent( CodeGenerator::tabsize ), output( os ), printLabels( *this ), options( pretty, genC, lineMarks, printExprTypes ), endl( *this ) {}
    119         CodeGenerator::CodeGenerator( std::ostream & os, const Options &options ) : indent( CodeGenerator::tabsize ), output( os ), printLabels( *this ), options(options), endl( *this ) {}
     118        CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC, bool lineMarks, bool printExprTypes ) : indent( 0, CodeGenerator::tabsize ), output( os ), printLabels( *this ), options( pretty, genC, lineMarks, printExprTypes ), endl( *this ) {}
     119        CodeGenerator::CodeGenerator( std::ostream & os, const Options &options ) : indent( 0, CodeGenerator::tabsize ), output( os ), printLabels( *this ), options(options), endl( *this ) {}
    120120
    121121        string CodeGenerator::mangleName( DeclarationWithType * decl ) {
  • src/Common/Indenter.h

    r60aaa51d r05d55ff  
    2323        unsigned int amt;         ///< spaces in one level of indentation
    2424
    25         Indenter( unsigned int indent = 0, unsigned int amt = tabsize ) 
    26         : indent( indent*amt ), amt( amt ) {}
    27        
    28         Indenter & operator+=(int nlevels) { indent += amt*nlevels; return *this; }
    29         Indenter & operator-=(int nlevels) { indent -= amt*nlevels; return *this; }
     25        Indenter( unsigned int indent = 0, unsigned int amt = tabsize )
     26        : indent( indent ), amt( amt ) {}
     27
     28        Indenter & operator+=(int nlevels) { indent += nlevels; return *this; }
     29        Indenter & operator-=(int nlevels) { indent -= nlevels; return *this; }
    3030        Indenter operator+(int nlevels) { Indenter indenter = *this; return indenter += nlevels; }
    3131        Indenter operator-(int nlevels) { Indenter indenter = *this; return indenter -= nlevels; }
     
    3535
    3636inline std::ostream & operator<<( std::ostream & out, const Indenter & indent ) {
    37         return out << std::string(indent.indent, ' ');
     37        return out << std::string(indent.indent * indent.amt, ' ');
    3838}
    3939
  • src/GenPoly/Lvalue.cc

    r60aaa51d r05d55ff  
    196196                                unsigned int i = 0;
    197197                                const unsigned int end = ftype->parameters.size();
     198
     199                                /// The for loop may eagerly dereference the iterators and fail on empty lists
     200                                if(i == end) { return appExpr; }
    198201                                for ( auto p : unsafe_group_iterate( appExpr->args, ftype->parameters ) ) {
    199202                                        if (i == end) break;
  • src/InitTweak/FixInit.cc

    r60aaa51d r05d55ff  
    301301                                replacement = new CastExpr( replacement, base->clone() );
    302302                        }
    303                         size_t replaced = DeclReplacer::replace( dtor, { std::make_pair( objDecl, replacement ) } );
    304                         if(replaced == 0) {
    305                                 objDecl->print(std::cerr);
    306                                 std::cerr << "-----" << std::endl;
    307                                 dtor->print(std::cerr);
    308                                 std::cerr << "Failed to replace " << objDecl << std::endl;
    309                                 abort();
    310                         }
     303                        DeclReplacer::replace( dtor, { std::make_pair( objDecl, replacement ) } );
    311304                        dtorFunc->statements->push_back( strict_dynamic_cast<Statement *>( dtor ) );
    312305
Note: See TracChangeset for help on using the changeset viewer.