Changeset 90152a4 for src


Ignore:
Timestamp:
Aug 27, 2018, 4:40:34 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
b7c89aa
Parents:
f9feab8 (diff), 305581d (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' into cleanup-dtors

Location:
src
Files:
16 added
97 deleted
123 edited
1 moved

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    rf9feab8 r90152a4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep  3 20:42:52 2017
    13 // Update Count     : 490
     12// Last Modified On : Sat May  5 09:08:32 2018
     13// Update Count     : 494
    1414//
    1515#include "CodeGenerator.h"
     
    1818#include <list>                      // for _List_iterator, list, list<>::it...
    1919
    20 #include "Common/SemanticError.h"    // for SemanticError
    2120#include "Common/UniqueName.h"       // for UniqueName
    2221#include "Common/utility.h"          // for CodeLocation, toString
     
    117116        }
    118117
    119         CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC, bool lineMarks ) : indent( CodeGenerator::tabsize ), output( os ), printLabels( *this ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ), endl( *this ) {}
     118        CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC, bool lineMarks, bool printExprTypes ) : indent( CodeGenerator::tabsize ), output( os ), printLabels( *this ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ), printExprTypes( printExprTypes ), endl( *this ) {}
    120119
    121120        string CodeGenerator::mangleName( DeclarationWithType * decl ) {
    122                 if ( pretty ) return decl->get_name();
    123                 if ( decl->get_mangleName() != "" ) {
     121                // GCC builtins should always be printed unmangled
     122                if ( pretty || decl->linkage.is_gcc_builtin ) return decl->name;
     123                if ( decl->mangleName != "" ) {
    124124                        // need to incorporate scope level in order to differentiate names for destructors
    125125                        return decl->get_scopedMangleName();
    126126                } else {
    127                         return decl->get_name();
     127                        return decl->name;
    128128                } // if
    129129        }
     
    133133                output << "__attribute__ ((";
    134134                for ( list< Attribute * >::iterator attr( attributes.begin() );; ) {
    135                         output << (*attr)->get_name();
    136                         if ( ! (*attr)->get_parameters().empty() ) {
     135                        output << (*attr)->name;
     136                        if ( ! (*attr)->parameters.empty() ) {
    137137                                output << "(";
    138                                 genCommaList( (*attr)->get_parameters().begin(), (*attr)->get_parameters().end() );
     138                                genCommaList( (*attr)->parameters.begin(), (*attr)->parameters.end() );
    139139                                output << ")";
    140140                        } // if
     
    160160        }
    161161
     162        // *** Expression
     163        void CodeGenerator::previsit( Expression * node ) {
     164                previsit( (BaseSyntaxNode *)node );
     165                GuardAction( [this, node](){
     166                        if ( printExprTypes && node->result ) {
     167                                output << " /* " << genType( node->result, "", pretty, genC ) << " */ ";
     168                        }
     169                } );
     170        }
     171
    162172        // *** Declarations
    163173        void CodeGenerator::postvisit( FunctionDecl * functionDecl ) {
     174                // deleted decls should never be used, so don't print them
     175                if ( functionDecl->isDeleted && genC ) return;
    164176                extension( functionDecl );
    165177                genAttributes( functionDecl->get_attributes() );
     
    175187                        functionDecl->get_statements()->accept( *visitor );
    176188                } // if
     189                if ( functionDecl->isDeleted ) {
     190                        output << " = void";
     191                }
    177192        }
    178193
    179194        void CodeGenerator::postvisit( ObjectDecl * objectDecl ) {
     195                // deleted decls should never be used, so don't print them
     196                if ( objectDecl->isDeleted && genC ) return;
    180197                if (objectDecl->get_name().empty() && genC ) {
    181198                        // only generate an anonymous name when generating C code, otherwise it clutters the output too much
     
    196213                        objectDecl->get_init()->accept( *visitor );
    197214                } // if
     215                if ( objectDecl->isDeleted ) {
     216                        output << " = void";
     217                }
    198218
    199219                if ( objectDecl->get_bitfieldWidth() ) {
     
    204224
    205225        void CodeGenerator::handleAggregate( AggregateDecl * aggDecl, const std::string & kind ) {
    206                 genAttributes( aggDecl->get_attributes() );
    207 
    208                 if( ! aggDecl->get_parameters().empty() && ! genC ) {
     226                if( ! aggDecl->parameters.empty() && ! genC ) {
    209227                        // assertf( ! genC, "Aggregate type parameters should not reach code generation." );
    210228                        output << "forall(";
    211                         genCommaList( aggDecl->get_parameters().begin(), aggDecl->get_parameters().end() );
     229                        genCommaList( aggDecl->parameters.begin(), aggDecl->parameters.end() );
    212230                        output << ")" << endl;
    213231                        output << indent;
    214232                }
    215233
    216                 output << kind << aggDecl->get_name();
     234                output << kind;
     235                genAttributes( aggDecl->attributes );
     236                output << aggDecl->name;
    217237
    218238                if ( aggDecl->has_body() ) {
    219                         std::list< Declaration * > & memb = aggDecl->get_members();
     239                        std::list< Declaration * > & memb = aggDecl->members;
    220240                        output << " {" << endl;
    221241
     
    299319                        output << " }";
    300320                }
     321        }
     322
     323        void CodeGenerator::postvisit( StaticAssertDecl * assertDecl ) {
     324                output << "_Static_assert(";
     325                assertDecl->condition->accept( *visitor );
     326                output << ", ";
     327                assertDecl->message->accept( *visitor );
     328                output << ")";
    301329        }
    302330
     
    353381
    354382        void CodeGenerator::postvisit( Constant * constant ) {
    355                 output << constant->get_value() ;
     383                output << constant->get_value();
    356384        }
    357385
     
    570598                output << "(";
    571599                if ( castExpr->get_result()->isVoid() ) {
    572                         output << "(void)" ;
     600                        output << "(void)";
    573601                } else {
    574602                        // at least one result type of cast.
     
    579607                        output << ")";
    580608                } // if
    581                 castExpr->get_arg()->accept( *visitor );
     609                castExpr->arg->accept( *visitor );
     610                output << ")";
     611        }
     612
     613        void CodeGenerator::postvisit( KeywordCastExpr * castExpr ) {
     614                assertf( ! genC, "KeywordCast should not reach code generation." );
     615                extension( castExpr );
     616                output << "((" << castExpr->targetString() << " &)";
     617                castExpr->arg->accept( *visitor );
    582618                output << ")";
    583619        }
     
    764800
    765801        void CodeGenerator::postvisit( StmtExpr * stmtExpr ) {
    766                 std::list< Statement * > & stmts = stmtExpr->get_statements()->get_kids();
     802                std::list< Statement * > & stmts = stmtExpr->statements->kids;
    767803                output << "({" << endl;
    768804                ++indent;
     
    775811                                // cannot cast to void, otherwise the expression statement has no value
    776812                                if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( stmt ) ) {
    777                                         exprStmt->get_expr()->accept( *visitor );
     813                                        exprStmt->expr->accept( *visitor );
    778814                                        output << ";" << endl;
    779815                                        ++i;
     
    796832                expr->callExpr->accept( *visitor );
    797833        }
     834
     835        void CodeGenerator::postvisit( DeletedExpr * expr ) {
     836                assertf( ! genC, "Deleted expressions should not reach code generation." );
     837                expr->expr->accept( *visitor );
     838        }
     839
     840        void CodeGenerator::postvisit( DefaultArgExpr * arg ) {
     841                assertf( ! genC, "Default argument expressions should not reach code generation." );
     842                arg->expr->accept( *visitor );
     843        }
     844
     845        void CodeGenerator::postvisit( GenericExpr * expr ) {
     846                assertf( ! genC, "C11 _Generic expressions should not reach code generation." );
     847                output << "_Generic(";
     848                expr->control->accept( *visitor );
     849                output << ", ";
     850                unsigned int numAssocs = expr->associations.size();
     851                unsigned int i = 0;
     852                for ( GenericExpr::Association & assoc : expr->associations ) {
     853                        if (assoc.isDefault) {
     854                                output << "default: ";
     855                        } else {
     856                                output << genType( assoc.type, "", pretty, genC ) << ": ";
     857                        }
     858                        assoc.expr->accept( *visitor );
     859                        if ( i+1 != numAssocs ) {
     860                                output << ", ";
     861                        }
     862                        i++;
     863                }
     864                output << ")";
     865        }
     866
    798867
    799868        // *** Statements
     
    848917                        } // for
    849918                } // if
    850                 output << " );" ;
     919                output << " );";
    851920        }
    852921
     
    856925                output << "( ";
    857926                if ( asmStmt->get_instruction() ) asmStmt->get_instruction()->accept( *visitor );
    858                 output << " )" ;
     927                output << " )";
     928        }
     929
     930        void CodeGenerator::postvisit( DirectiveStmt * dirStmt ) {
     931                output << endl << dirStmt->directive;                   // endl prevents spaces before directive
    859932        }
    860933
     
    873946
    874947        void CodeGenerator::postvisit( SwitchStmt * switchStmt ) {
    875                 output << "switch ( " ;
     948                output << "switch ( ";
    876949                switchStmt->get_condition()->accept( *visitor );
    877950                output << " ) ";
     
    899972                ++indent;
    900973                for ( std::list<Statement *>::iterator i = sts.begin(); i != sts.end();  i++) {
    901                         output << indent << printLabels( (*i)->get_labels() )  ;
     974                        output << indent << printLabels( (*i)->get_labels() ) ;
    902975                        (*i)->accept( *visitor );
    903976                        output << endl;
     
    924997                        output << "continue";
    925998                        break;
     999                  case BranchStmt::FallThrough:
     1000                  case BranchStmt::FallThroughDefault:
     1001                        assertf( ! genC, "fallthru should not reach code generation." );
     1002                  output << "fallthru";
     1003                        break;
    9261004                } // switch
     1005                // print branch target for labelled break/continue/fallthru in debug mode
     1006                if ( ! genC && branchStmt->get_type() != BranchStmt::Goto ) {
     1007                        if ( ! branchStmt->get_target().empty() ) {
     1008                                output << " " << branchStmt->get_target();
     1009                        } else if ( branchStmt->get_type() == BranchStmt::FallThrough ) {
     1010                                output << " default";
     1011                        }
     1012                }
    9271013                output << ";";
    9281014        }
     
    10231109        void CodeGenerator::postvisit( WhileStmt * whileStmt ) {
    10241110                if ( whileStmt->get_isDoWhile() ) {
    1025                         output << "do" ;
     1111                        output << "do";
    10261112                } else {
    1027                         output << "while (" ;
     1113                        output << "while (";
    10281114                        whileStmt->get_condition()->accept( *visitor );
    10291115                        output << ")";
     
    10371123
    10381124                if ( whileStmt->get_isDoWhile() ) {
    1039                         output << " while (" ;
     1125                        output << " while (";
    10401126                        whileStmt->get_condition()->accept( *visitor );
    10411127                        output << ");";
  • src/CodeGen/CodeGenerator.h

    rf9feab8 r90152a4  
    2727
    2828namespace CodeGen {
    29         struct CodeGenerator : public WithShortCircuiting, public WithVisitorRef<CodeGenerator> {
     29        struct CodeGenerator : public WithShortCircuiting, public WithGuards, public WithVisitorRef<CodeGenerator> {
    3030          static int tabsize;
    3131
    32                 CodeGenerator( std::ostream &os, bool pretty = false, bool genC = false, bool lineMarks = false );
     32                CodeGenerator( std::ostream &os, bool pretty = false, bool genC = false, bool lineMarks = false, bool printExprTypes = false );
    3333
    3434                //*** Turn off visit_children for all nodes
     
    3838                void postvisit( BaseSyntaxNode * );
    3939
     40                //*** print type for all expressions
     41                void previsit( Expression * node );
     42
    4043                //*** Declaration
    4144                void postvisit( StructDecl * );
    4245                void postvisit( FunctionDecl * );
    4346                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 );
     47                void postvisit( UnionDecl * aggregateDecl );
     48                void postvisit( EnumDecl * aggregateDecl );
     49                void postvisit( TraitDecl * aggregateDecl );
     50                void postvisit( TypedefDecl * typeDecl );
     51                void postvisit( TypeDecl * typeDecl );
     52                void postvisit( StaticAssertDecl * assertDecl );
    4953
    5054                //*** Initializer
     
    6569                void postvisit( LabelAddressExpr *addressExpr );
    6670                void postvisit( CastExpr *castExpr );
     71                void postvisit( KeywordCastExpr * castExpr );
    6772                void postvisit( VirtualCastExpr *castExpr );
    6873                void postvisit( UntypedMemberExpr *memberExpr );
     
    8893                void postvisit( StmtExpr * );
    8994                void postvisit( ConstructorExpr * );
     95                void postvisit( DeletedExpr * );
     96                void postvisit( DefaultArgExpr * );
     97                void postvisit( GenericExpr * );
    9098
    9199                //*** Statements
     
    93101                void postvisit( ExprStmt * );
    94102                void postvisit( AsmStmt * );
     103                void postvisit( DirectiveStmt * );
    95104                void postvisit( AsmDecl * );                            // special: statement in declaration context
    96105                void postvisit( IfStmt * );
     
    138147                bool genC = false;    // true if output has to be C code
    139148                bool lineMarks = false;
     149                bool printExprTypes = false;
    140150        public:
    141151                LineEnder endl;
  • src/CodeGen/FixMain.cc

    rf9feab8 r90152a4  
    2323
    2424#include "Common/SemanticError.h"  // for SemanticError
     25#include "CodeGen/GenType.h"       // for GenType
    2526#include "SynTree/Declaration.h"   // for FunctionDecl, operator<<
    2627#include "SynTree/Type.h"          // for FunctionType
     
    3031        std::unique_ptr<FunctionDecl> FixMain::main_signature = nullptr;
    3132
     33        template<typename container>
     34        std::string genTypeAt(const container& p, size_t idx) {
     35                return genType((*std::next(p.begin(), idx))->get_type(), "");
     36        }
     37
    3238        void FixMain::registerMain(FunctionDecl* functionDecl)
    3339        {
    3440                if(main_signature) {
    35                         throw SemanticError("Multiple definition of main routine\n", functionDecl);
     41                        SemanticError(functionDecl, "Multiple definition of main routine\n");
    3642                }
    3743                main_signature.reset( functionDecl->clone() );
     
    4349
    4450                        os << main_signature->get_scopedMangleName() << "(";
    45                         switch(main_signature->get_functionType()->get_parameters().size()) {
    46                                 case 3: os << "argc, argv, envp"; break;
    47                                 case 2: os << "argc, argv"; break;
     51                        const auto& params = main_signature->get_functionType()->get_parameters();
     52                        switch(params.size()) {
     53                                case 3: os << "(" << genTypeAt(params, 0) << ")argc, (" << genTypeAt(params, 1) << ")argv, (" << genTypeAt(params, 2) << ")envp"; break;
     54                                case 2: os << "(" << genTypeAt(params, 0) << ")argc, (" << genTypeAt(params, 1) << ")argv"; break;
    4855                                case 0: break;
    4956                                default : assert(false);
  • src/CodeGen/FixNames.cc

    rf9feab8 r90152a4  
    5656                auto && name = SymTab::Mangler::mangle( mainDecl.get() );
    5757                // std::cerr << name << std::endl;
    58                 return name;
     58                return std::move(name);
    5959        }
    6060        std::string mangle_main_args() {
     
    7979                auto&& name = SymTab::Mangler::mangle( mainDecl.get() );
    8080                // std::cerr << name << std::endl;
    81                 return name;
     81                return std::move(name);
    8282        }
    8383
     
    118118                        int nargs = functionDecl->get_functionType()->get_parameters().size();
    119119                        if( !(nargs == 0 || nargs == 2 || nargs == 3) ) {
    120                                 throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl);
     120                                SemanticError(functionDecl, "Main expected to have 0, 2 or 3 arguments\n");
    121121                        }
    122122                        functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( new ConstantExpr( Constant::from_int( 0 ) ) ) );
  • src/CodeGen/GenType.cc

    rf9feab8 r90152a4  
    2626
    2727namespace CodeGen {
    28         class GenType : public Visitor {
    29           public:
    30                 GenType( const std::string &typeString, bool pretty = false, bool genC = false, bool lineMarks = false );
    31                 std::string get_typeString() const { return typeString; }
    32                 void set_typeString( const std::string &newValue ) { typeString = newValue; }
    33 
    34                 virtual void visit( FunctionType *funcType );
    35                 virtual void visit( VoidType *voidType );
    36                 virtual void visit( BasicType *basicType );
    37                 virtual void visit( PointerType *pointerType );
    38                 virtual void visit( ArrayType *arrayType );
    39                 virtual void visit( ReferenceType *refType );
    40                 virtual void visit( StructInstType *structInst );
    41                 virtual void visit( UnionInstType *unionInst );
    42                 virtual void visit( EnumInstType *enumInst );
    43                 virtual void visit( TypeInstType *typeInst );
    44                 virtual void visit( TupleType * tupleType );
    45                 virtual void visit( VarArgsType *varArgsType );
    46                 virtual void visit( ZeroType *zeroType );
    47                 virtual void visit( OneType *oneType );
     28        struct GenType : public WithVisitorRef<GenType>, public WithShortCircuiting {
     29                std::string typeString;
     30                GenType( const std::string &typeString, bool pretty, bool genC, bool lineMarks );
     31
     32                void previsit( BaseSyntaxNode * );
     33                void postvisit( BaseSyntaxNode * );
     34
     35                void postvisit( FunctionType * funcType );
     36                void postvisit( VoidType * voidType );
     37                void postvisit( BasicType * basicType );
     38                void postvisit( PointerType * pointerType );
     39                void postvisit( ArrayType * arrayType );
     40                void postvisit( ReferenceType * refType );
     41                void postvisit( StructInstType * structInst );
     42                void postvisit( UnionInstType * unionInst );
     43                void postvisit( EnumInstType * enumInst );
     44                void postvisit( TypeInstType * typeInst );
     45                void postvisit( TupleType  * tupleType );
     46                void postvisit( VarArgsType * varArgsType );
     47                void postvisit( ZeroType * zeroType );
     48                void postvisit( OneType * oneType );
     49                void postvisit( GlobalScopeType * globalType );
     50                void postvisit( TraitInstType * inst );
     51                void postvisit( TypeofType * typeof );
     52                void postvisit( QualifiedType * qualType );
    4853
    4954          private:
     
    5257                void genArray( const Type::Qualifiers &qualifiers, Type *base, Expression *dimension, bool isVarLen, bool isStatic );
    5358
    54                 std::string typeString;
    55                 bool pretty = false; // pretty print
    56                 bool genC = false;   // generating C code?
    57                 bool lineMarks = false;
     59                bool pretty = false;    // pretty print
     60                bool genC = false;      // generating C code?
     61                bool lineMarks = false; // lineMarks on for CodeGenerator?
    5862        };
    5963
    6064        std::string genType( Type *type, const std::string &baseString, bool pretty, bool genC , bool lineMarks ) {
    61                 GenType gt( baseString, pretty, genC, lineMarks );
     65                PassVisitor<GenType> gt( baseString, pretty, genC, lineMarks );
    6266                std::ostringstream os;
    6367
     
    6872
    6973                type->accept( gt );
    70                 return os.str() + gt.get_typeString();
     74                return os.str() + gt.pass.typeString;
    7175        }
    7276
     
    7781        GenType::GenType( const std::string &typeString, bool pretty, bool genC, bool lineMarks ) : typeString( typeString ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ) {}
    7882
    79         void GenType::visit( VoidType *voidType ) {
     83        // *** BaseSyntaxNode
     84        void GenType::previsit( BaseSyntaxNode * ) {
     85                // turn off automatic recursion for all nodes, to allow each visitor to
     86                // precisely control the order in which its children are visited.
     87                visit_children = false;
     88        }
     89
     90        void GenType::postvisit( BaseSyntaxNode * node ) {
     91                std::stringstream ss;
     92                node->print( ss );
     93                assertf( false, "Unhandled node reached in GenType: %s", ss.str().c_str() );
     94        }
     95
     96        void GenType::postvisit( VoidType * voidType ) {
    8097                typeString = "void " + typeString;
    8198                handleQualifiers( voidType );
    8299        }
    83100
    84         void GenType::visit( BasicType *basicType ) {
    85                 BasicType::Kind kind = basicType->get_kind();
     101        void GenType::postvisit( BasicType * basicType ) {
     102                BasicType::Kind kind = basicType->kind;
    86103                assert( 0 <= kind && kind < BasicType::NUMBER_OF_BASIC_TYPES );
    87104                typeString = std::string( BasicType::typeNames[kind] ) + " " + typeString;
     
    89106        }
    90107
    91         void GenType::genArray( const Type::Qualifiers &qualifiers, Type *base, Expression *dimension, bool isVarLen, bool isStatic ) {
     108        void GenType::genArray( const Type::Qualifiers & qualifiers, Type * base, Expression *dimension, bool isVarLen, bool isStatic ) {
    92109                std::ostringstream os;
    93110                if ( typeString != "" ) {
     
    126143                typeString = os.str();
    127144
    128                 base->accept( *this );
    129         }
    130 
    131         void GenType::visit( PointerType *pointerType ) {
    132                 assert( pointerType->get_base() != 0);
    133                 if ( pointerType->get_isStatic() || pointerType->get_isVarLen() || pointerType->get_dimension() ) {
    134                         genArray( pointerType->get_qualifiers(), pointerType->get_base(), pointerType->get_dimension(), pointerType->get_isVarLen(), pointerType->get_isStatic() );
     145                base->accept( *visitor );
     146        }
     147
     148        void GenType::postvisit( PointerType * pointerType ) {
     149                assert( pointerType->base != 0);
     150                if ( pointerType->get_isStatic() || pointerType->get_isVarLen() || pointerType->dimension ) {
     151                        genArray( pointerType->get_qualifiers(), pointerType->base, pointerType->dimension, pointerType->get_isVarLen(), pointerType->get_isStatic() );
    135152                } else {
    136153                        handleQualifiers( pointerType );
     
    140157                                typeString = "*" + typeString;
    141158                        } // if
    142                         pointerType->get_base()->accept( *this );
    143                 } // if
    144         }
    145 
    146         void GenType::visit( ArrayType *arrayType ) {
    147                 genArray( arrayType->get_qualifiers(), arrayType->get_base(), arrayType->get_dimension(), arrayType->get_isVarLen(), arrayType->get_isStatic() );
    148         }
    149 
    150         void GenType::visit( ReferenceType *refType ) {
    151                 assert( refType->get_base() != 0);
     159                        pointerType->base->accept( *visitor );
     160                } // if
     161        }
     162
     163        void GenType::postvisit( ArrayType * arrayType ) {
     164                genArray( arrayType->get_qualifiers(), arrayType->base, arrayType->dimension, arrayType->get_isVarLen(), arrayType->get_isStatic() );
     165        }
     166
     167        void GenType::postvisit( ReferenceType * refType ) {
     168                assert( refType->base != 0);
    152169                assertf( ! genC, "Reference types should not reach code generation." );
    153170                handleQualifiers( refType );
    154171                typeString = "&" + typeString;
    155                 refType->get_base()->accept( *this );
    156         }
    157 
    158         void GenType::visit( FunctionType *funcType ) {
     172                refType->base->accept( *visitor );
     173        }
     174
     175        void GenType::postvisit( FunctionType * funcType ) {
    159176                std::ostringstream os;
    160177
     
    169186                /************* parameters ***************/
    170187
    171                 const std::list<DeclarationWithType *> &pars = funcType->get_parameters();
     188                const std::list<DeclarationWithType *> &pars = funcType->parameters;
    172189
    173190                if ( pars.empty() ) {
     
    191208                typeString = os.str();
    192209
    193                 if ( funcType->get_returnVals().size() == 0 ) {
     210                if ( funcType->returnVals.size() == 0 ) {
    194211                        typeString = "void " + typeString;
    195212                } else {
    196                         funcType->get_returnVals().front()->get_type()->accept( *this );
     213                        funcType->returnVals.front()->get_type()->accept( *visitor );
    197214                } // if
    198215
    199216                // add forall
    200                 if( ! funcType->get_forall().empty() && ! genC ) {
     217                if( ! funcType->forall.empty() && ! genC ) {
    201218                        // assertf( ! genC, "Aggregate type parameters should not reach code generation." );
    202219                        std::ostringstream os;
    203220                        PassVisitor<CodeGenerator> cg( os, pretty, genC, lineMarks );
    204221                        os << "forall(";
    205                         cg.pass.genCommaList( funcType->get_forall().begin(), funcType->get_forall().end() );
     222                        cg.pass.genCommaList( funcType->forall.begin(), funcType->forall.end() );
    206223                        os << ")" << std::endl;
    207224                        typeString = os.str() + typeString;
     
    221238        }
    222239
    223         void GenType::visit( StructInstType *structInst )  {
    224                 typeString = structInst->get_name() + handleGeneric( structInst ) + " " + typeString;
     240        void GenType::postvisit( StructInstType * structInst )  {
     241                typeString = structInst->name + handleGeneric( structInst ) + " " + typeString;
    225242                if ( genC ) typeString = "struct " + typeString;
    226243                handleQualifiers( structInst );
    227244        }
    228245
    229         void GenType::visit( UnionInstType *unionInst ) {
    230                 typeString = unionInst->get_name() + handleGeneric( unionInst ) + " " + typeString;
     246        void GenType::postvisit( UnionInstType * unionInst ) {
     247                typeString = unionInst->name + handleGeneric( unionInst ) + " " + typeString;
    231248                if ( genC ) typeString = "union " + typeString;
    232249                handleQualifiers( unionInst );
    233250        }
    234251
    235         void GenType::visit( EnumInstType *enumInst ) {
    236                 typeString = enumInst->get_name() + " " + typeString;
     252        void GenType::postvisit( EnumInstType * enumInst ) {
     253                typeString = enumInst->name + " " + typeString;
    237254                if ( genC ) typeString = "enum " + typeString;
    238255                handleQualifiers( enumInst );
    239256        }
    240257
    241         void GenType::visit( TypeInstType *typeInst ) {
    242                 typeString = typeInst->get_name() + " " + typeString;
     258        void GenType::postvisit( TypeInstType * typeInst ) {
     259                typeString = typeInst->name + " " + typeString;
    243260                handleQualifiers( typeInst );
    244261        }
    245262
    246         void GenType::visit( TupleType * tupleType ) {
     263        void GenType::postvisit( TupleType * tupleType ) {
    247264                assertf( ! genC, "Tuple types should not reach code generation." );
    248265                unsigned int i = 0;
     
    257274        }
    258275
    259         void GenType::visit( VarArgsType *varArgsType ) {
     276        void GenType::postvisit( VarArgsType * varArgsType ) {
    260277                typeString = "__builtin_va_list " + typeString;
    261278                handleQualifiers( varArgsType );
    262279        }
    263280
    264         void GenType::visit( ZeroType *zeroType ) {
     281        void GenType::postvisit( ZeroType * zeroType ) {
    265282                // ideally these wouldn't hit codegen at all, but should be safe to make them ints
    266283                typeString = (pretty ? "zero_t " : "long int ") + typeString;
     
    268285        }
    269286
    270         void GenType::visit( OneType *oneType ) {
     287        void GenType::postvisit( OneType * oneType ) {
    271288                // ideally these wouldn't hit codegen at all, but should be safe to make them ints
    272289                typeString = (pretty ? "one_t " : "long int ") + typeString;
     
    274291        }
    275292
    276         void GenType::handleQualifiers( Type *type ) {
     293        void GenType::postvisit( GlobalScopeType * globalType ) {
     294                assertf( ! genC, "Global scope type should not reach code generation." );
     295                handleQualifiers( globalType );
     296        }
     297
     298        void GenType::postvisit( TraitInstType * inst ) {
     299                assertf( ! genC, "Trait types should not reach code generation." );
     300                typeString = inst->name + " " + typeString;
     301                handleQualifiers( inst );
     302        }
     303
     304        void GenType::postvisit( TypeofType * typeof ) {
     305                std::ostringstream os;
     306                PassVisitor<CodeGenerator> cg( os, pretty, genC, lineMarks );
     307                os << "typeof(";
     308                typeof->expr->accept( cg );
     309                os << ") " << typeString;
     310                typeString = os.str();
     311                handleQualifiers( typeof );
     312        }
     313
     314        void GenType::postvisit( QualifiedType * qualType ) {
     315                assertf( ! genC, "Qualified types should not reach code generation." );
     316                std::ostringstream os;
     317                os << genType( qualType->parent, "", pretty, genC, lineMarks ) << "." << genType( qualType->child, "", pretty, genC, lineMarks ) << typeString;
     318                typeString = os.str();
     319                handleQualifiers( qualType );
     320        }
     321
     322        void GenType::handleQualifiers( Type * type ) {
    277323                if ( type->get_const() ) {
    278324                        typeString = "const " + typeString;
  • src/CodeGen/Generate.cc

    rf9feab8 r90152a4  
    4646        } // namespace
    4747
    48         void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC, bool lineMarks ) {
     48        void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC, bool lineMarks, bool printExprTypes ) {
    4949                cleanTree( translationUnit );
    5050
    51                 PassVisitor<CodeGenerator> cgv( os, pretty, generateC, lineMarks );
     51                PassVisitor<CodeGenerator> cgv( os, pretty, generateC, lineMarks, printExprTypes );
    5252                for ( auto & dcl : translationUnit ) {
    5353                        if ( LinkageSpec::isGeneratable( dcl->get_linkage() ) && (doIntrinsics || ! LinkageSpec::isBuiltin( dcl->get_linkage() ) ) ) {
     
    6666                        os << CodeGen::genPrettyType( type, "" );
    6767                } else {
    68                         PassVisitor<CodeGenerator> cgv( os, true, false, false );
     68                        PassVisitor<CodeGenerator> cgv( os, true, false, false, false );
    6969                        node->accept( cgv );
    7070                }
  • src/CodeGen/Generate.h

    rf9feab8 r90152a4  
    2424namespace CodeGen {
    2525        /// Generates code. doIntrinsics determines if intrinsic functions are printed, pretty formats output nicely (e.g., uses unmangled names, etc.), generateC is true when the output must consist only of C code (allows some assertions, etc.)
    26         void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC = false , bool lineMarks = false );
     26        void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC = false , bool lineMarks = false, bool printTypeExpr = false );
    2727
    2828        /// Generate code for a single node -- helpful for debugging in gdb
  • src/CodeGen/OperatorTable.cc

    rf9feab8 r90152a4  
    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

    rf9feab8 r90152a4  
    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 & );
  • src/CodeTools/DeclStats.cc

    rf9feab8 r90152a4  
    2323#include <utility>                 // for pair, make_pair
    2424
    25 #include "Common/SemanticError.h"  // for SemanticError
     25#include "Common/PassVisitor.h"
    2626#include "Common/VectorMap.h"      // for VectorMap
    2727#include "GenPoly/GenPoly.h"       // for hasPolyBase
     
    3535namespace CodeTools {
    3636
    37         class DeclStats : public Visitor {
     37        struct DeclStats : public WithShortCircuiting {
    3838                template<typename T>
    3939                static void sum(T& a, const T& b) { a += b; }
     
    6161
    6262                struct ArgPackStats {
    63                         VectorMap<unsigned> n;                 ///< Count of decls with each number of elements
    64                         VectorMap<unsigned> n_basic;           ///< Count of decls with each number of basic type elements
    65                         VectorMap<unsigned> n_poly;            ///< Count of decls with each number of polymorphic elements
    66                         std::map<unsigned, unsigned> p_basic;  ///< Count of decls with each percentage of basic type elements
    67                         std::map<unsigned, unsigned> p_poly;   ///< Count of decls with each percentage of polymorphic elements
    68                         VectorMap<unsigned> n_types;           ///< Count of decls with each number of distinct types in the pack
     63                        VectorMap<unsigned> n;                   ///< Count of decls with each number of elements
     64                        VectorMap<unsigned> n_basic;             ///< Count of decls with each number of basic type elements
     65                        VectorMap<unsigned> n_generic;           ///< Count of decls with each number of generic type elements
     66                        VectorMap<unsigned> n_poly;              ///< Count of decls with each number of polymorphic elements
     67                        VectorMap<unsigned> n_compound;          ///< Count of decls with each number of non-generic compound types
     68                        std::map<unsigned, unsigned> p_basic;    ///< Count of decls with each percentage of basic type elements
     69                        std::map<unsigned, unsigned> p_generic;  ///< Count of decls with each percentage of generic type elements
     70                        std::map<unsigned, unsigned> p_poly;     ///< Count of decls with each percentage of polymorphic elements
     71                        std::map<unsigned, unsigned> p_compound; ///< Count of decls with each percentage of non-generic compound type elements
     72                        VectorMap<unsigned> n_types;             ///< Count of decls with each number of distinct types in the pack
    6973                        /// Count of decls with each percentage of new types in lists.
    7074                        /// Types used in the parameter list that recur in the return list are not considered to be new.
     
    7478                                sum(n, o.n);
    7579                                sum(n_basic, o.n_basic);
     80                                sum(n_generic, o.n_generic);
    7681                                sum(n_poly, o.n_poly);
     82                                sum(n_compound, o.n_compound);
    7783                                sum(p_basic, o.p_basic);
     84                                sum(p_generic, o.p_generic);
    7885                                sum(p_poly, o.p_poly);
     86                                sum(p_compound, o.p_compound);
    7987                                sum(n_types, o.n_types);
    8088                                sum(p_new, o.p_new);
     
    8896                        /// Count of declarations with each number of assertion parameters
    8997                        VectorMap<unsigned> n_type_params;
     98                        /// Count of generic types with each number of type parameters
     99                        VectorMap<unsigned> n_generic_params;
     100                        /// Count of maximum nesting depth of types
     101                        VectorMap<unsigned> n_generic_nesting;
    90102                        /// Count of declarations with each name
    91103                        std::unordered_map<std::string, unsigned> by_name;
    92104                        /// Count of uses of each basic type
    93105                        std::unordered_map<std::string, unsigned> basic_type_names;
    94                         /// Count of uses of each non-basic type
     106                        /// Count of uses of each generic type name (includes "*", "[]", "(*)", "[,]")
     107                        std::unordered_map<std::string, unsigned> generic_type_names;
     108                        /// Count of uses of each non-generic aggregate type
    95109                        std::unordered_map<std::string, unsigned> compound_type_names;
    96110                        /// Count of decls using each basic type
    97111                        std::unordered_map<std::string, unsigned> basic_type_decls;
     112                        /// Count of decls using each generic type (includes "*", "[]", "(*)", "[,]")
     113                        std::unordered_map<std::string, unsigned> generic_type_decls;
    98114                        /// Count of decls using each compound type
    99115                        std::unordered_map<std::string, unsigned> compound_type_decls;
     
    110126                        ArgPackStats assn_returns;
    111127
    112                         Stats() : n_decls(0), n_type_params(), by_name(), basic_type_names(), compound_type_names(), basic_type_decls(), compound_type_decls(), params(), returns(), n_assns(), assn_params(), assn_returns() {}
     128                        Stats() : n_decls(0), n_type_params(), n_generic_params(), n_generic_nesting(),
     129                                by_name(), basic_type_names(), generic_type_names(), compound_type_names(),
     130                                basic_type_decls(), generic_type_decls(), compound_type_decls(), params(),
     131                                returns(), n_assns(), assn_params(), assn_returns() {}
    113132
    114133                public:
     
    116135                                sum( n_decls, o.n_decls );
    117136                                sum( n_type_params, o.n_type_params );
     137                                sum( n_generic_params, o.n_generic_params );
     138                                sum( n_generic_nesting, o.n_generic_nesting );
    118139                                sum( by_name, o.by_name );
    119140                                sum( basic_type_names, o.basic_type_names );
     141                                sum( generic_type_names, o.generic_type_names );
    120142                                sum( compound_type_names, o.compound_type_names );
    121143                                sum( basic_type_decls, o.basic_type_decls );
     144                                sum( generic_type_decls, o.generic_type_decls );
    122145                                sum( compound_type_decls, o.compound_type_decls );
    123146                                sum( params, o.params );
     
    131154                };
    132155
    133                 Stats for_linkage[LinkageSpec::NoOfSpecs];   ///< Stores separate stats per linkage
     156                /// number of counting bins for linkages
     157                static const unsigned n_named_specs = 8;
     158                /// map from total number of specs to bins
     159                static const unsigned ind_for_linkage[16];
     160
     161                Stats for_linkage[n_named_specs];            ///< Stores separate stats per linkage
    134162                std::unordered_set<std::string> seen_names;  ///< Stores manglenames already seen to avoid double-counting
    135163                Stats total;
     
    137165                std::map<std::pair<unsigned, unsigned>, unsigned> exprs_by_fanout_at_depth;
    138166
     167                void countType( const std::string& name, unsigned& n, std::unordered_map<std::string,
     168                                unsigned>& names, std::unordered_map<std::string, unsigned>& decls,
     169                                std::unordered_set<std::string>& elSeen ) {
     170                        ++n;
     171                        ++names[ name ];
     172                        if ( elSeen.insert( name ).second ) { ++decls[ name ]; }
     173                }
     174
     175                void update_max( unsigned& max, unsigned crnt ) {
     176                        if ( crnt > max ) max = crnt;
     177                }
     178
     179                void analyzeSubtype( Type* ty, Stats& stats, std::unordered_set<std::string>& elSeen,
     180                                unsigned& n_poly, bool& seen_poly, unsigned& max_depth, unsigned depth ) {
     181                        unsigned x;
     182                        analyzeType( ty, stats, elSeen, x, x, n_poly, x, seen_poly, max_depth, depth + 1 );
     183                }
     184
     185                void analyzeSubtypes( std::list<DeclarationWithType*>& tys, Stats& stats,
     186                                std::unordered_set<std::string>& elSeen, unsigned& n_poly, bool& seen_poly,
     187                                unsigned& max_depth, unsigned depth, unsigned& n_subs ) {
     188                        for ( DeclarationWithType* dwt : tys ) {
     189                                Type* ty = dwt->get_type();
     190                                n_subs += (unsigned)( dynamic_cast<VoidType*>(ty) != nullptr );
     191                                analyzeSubtype( ty, stats, elSeen, n_poly, seen_poly, max_depth, depth );
     192                        }
     193                }
     194
     195                void analyzeSubtypes( std::list<Expression*>& tys, Stats& stats,
     196                                std::unordered_set<std::string>& elSeen, unsigned& n_poly, bool& seen_poly,
     197                                unsigned& max_depth, unsigned depth ) {
     198                        for ( Expression* expr : tys ) {
     199                                TypeExpr* texpr = dynamic_cast<TypeExpr*>(expr);
     200                                if ( ! texpr ) continue;
     201                                Type* ty = texpr->get_type();
     202                                analyzeSubtype( ty, stats, elSeen, n_poly, seen_poly, max_depth, depth );
     203                        }
     204                }
     205
     206                void analyzeSubtypes( std::list<Type*>& tys, Stats& stats,
     207                                std::unordered_set<std::string>& elSeen, unsigned& n_poly, bool& seen_poly,
     208                                unsigned& max_depth, unsigned depth ) {
     209                        for ( Type* ty : tys ) {
     210                                analyzeSubtype( ty, stats, elSeen, n_poly, seen_poly, max_depth, depth );
     211                        }
     212                }
     213
     214                void analyzeType( Type* ty, Stats& stats, std::unordered_set<std::string>& elSeen,
     215                                unsigned& n_basic, unsigned& n_generic, unsigned& n_poly, unsigned& n_agg,
     216                                bool& seen_poly, unsigned& max_depth, unsigned depth = 0 ) {
     217                        if ( BasicType* bt = dynamic_cast<BasicType*>(ty) ) {
     218                                std::string name = BasicType::typeNames[ bt->get_kind() ];
     219                                countType( name, n_basic, stats.basic_type_names, stats.basic_type_decls, elSeen );
     220                                update_max( max_depth, depth );
     221                        } else if ( PointerType* pt = dynamic_cast<PointerType*>(ty) ) {
     222                                std::string name = "*";
     223                                countType(
     224                                        name, n_generic, stats.generic_type_names, stats.generic_type_decls, elSeen);
     225                                analyzeSubtype(
     226                                        pt->get_base(), stats, elSeen, n_poly, seen_poly, max_depth, depth );
     227                                ++stats.n_generic_params.at( 1 );
     228                        } else if ( ArrayType* at = dynamic_cast<ArrayType*>(ty) ) {
     229                                std::string name = "[]";
     230                                countType(
     231                                        name, n_generic, stats.generic_type_names, stats.generic_type_decls, elSeen);
     232                                analyzeSubtype(
     233                                        at->get_base(), stats, elSeen, n_poly, seen_poly, max_depth, depth );
     234                                ++stats.n_generic_params.at( 1 );
     235                        } else if ( ReferenceType* rt = dynamic_cast<ReferenceType*>(ty) ) {
     236                                std::string name = "&";
     237                                countType(
     238                                        name, n_generic, stats.generic_type_names, stats.generic_type_decls, elSeen);
     239                                analyzeSubtype(
     240                                        rt->get_base(), stats, elSeen, n_poly, seen_poly, max_depth, depth );
     241                                ++stats.n_generic_params.at( 1 );
     242                        } else if ( FunctionType* ft = dynamic_cast<FunctionType*>(ty) ) {
     243                                std::string name = "(*)";
     244                                countType(
     245                                        name, n_generic, stats.generic_type_names, stats.generic_type_decls, elSeen);
     246                                unsigned n_subs = 0;
     247                                analyzeSubtypes(
     248                                        ft->get_returnVals(), stats, elSeen, n_poly, seen_poly, max_depth, depth,
     249                                        n_subs );
     250                                analyzeSubtypes(
     251                                        ft->get_parameters(), stats, elSeen, n_poly, seen_poly, max_depth, depth,
     252                                        n_subs );
     253                                ++stats.n_generic_params.at( n_subs );
     254                        } else if ( TypeInstType* vt = dynamic_cast<TypeInstType*>(ty) ) {
     255                                if ( ! seen_poly ) {
     256                                        ++n_poly;
     257                                        seen_poly = true;
     258                                }
     259                                countType(
     260                                        vt->get_name(), n_agg, stats.compound_type_names, stats.compound_type_decls,
     261                                        elSeen );
     262                                update_max( max_depth, depth );
     263                        } else if ( ReferenceToType* st = dynamic_cast<ReferenceToType*>(ty) ) {
     264                                std::list<Expression*>& params = st->get_parameters();
     265                                if ( params.empty() ) {
     266                                        countType(
     267                                                st->get_name(), n_agg, stats.compound_type_names,
     268                                                stats.compound_type_decls, elSeen );
     269                                        update_max( max_depth, depth );
     270                                } else {
     271                                        countType(
     272                                                st->get_name(), n_generic, stats.generic_type_names,
     273                                                stats.generic_type_decls, elSeen);
     274                                        analyzeSubtypes( params, stats, elSeen, n_poly, seen_poly, max_depth, depth );
     275                                        ++stats.n_generic_params.at( params.size() );
     276                                }
     277                        } else if ( TupleType* tt = dynamic_cast<TupleType*>(ty) ) {
     278                                std::string name = "[,]";
     279                                countType(
     280                                        name, n_generic, stats.generic_type_names, stats.generic_type_decls, elSeen);
     281                                analyzeSubtypes(
     282                                        tt->get_types(), stats, elSeen, n_poly, seen_poly, max_depth, depth );
     283                                ++stats.n_generic_params.at( tt->size() );
     284                        } else if ( dynamic_cast<VarArgsType*>(ty) ) {
     285                                std::string name = "...";
     286                                countType(
     287                                        name, n_agg, stats.compound_type_names, stats.compound_type_decls, elSeen );
     288                                update_max( max_depth, depth );
     289                        } else if ( dynamic_cast<ZeroType*>(ty) ) {
     290                                std::string name = "0";
     291                                countType( name, n_basic, stats.basic_type_names, stats.basic_type_decls, elSeen );
     292                                update_max( max_depth, depth );
     293                        } else if ( dynamic_cast<OneType*>(ty) ) {
     294                                std::string name = "1";
     295                                countType( name, n_basic, stats.basic_type_names, stats.basic_type_decls, elSeen );
     296                                update_max( max_depth, depth );
     297                        }
     298                }
     299
    139300                /// Update arg pack stats based on a declaration list
    140                 void analyze( Stats& stats, std::unordered_set<std::string>& seen, ArgPackStats& pstats, std::list<DeclarationWithType*>& decls ) {
     301                void analyze( Stats& stats, std::unordered_set<std::string>& seen,
     302                                std::unordered_set<std::string>& elSeen, ArgPackStats& pstats,
     303                                std::list<DeclarationWithType*>& decls ) {
    141304                        std::unordered_set<std::string> types;
    142                         unsigned n = 0;        ///< number of args/returns
    143                         unsigned n_basic = 0;  ///< number of basic types
    144                         unsigned n_poly = 0;   ///< number of polymorphic types
    145                         unsigned n_new = 0;    ///< number of new types
     305                        unsigned n = 0;                 ///< number of args/returns
     306                        unsigned n_basic = 0;           ///< number of basic types
     307                        unsigned n_generic = 0;         ///< number of generic types (includes "*", "&", "[]", "(*)", "[,]")
     308                        unsigned n_poly = 0;            ///< number of polymorphic types
     309                        unsigned n_agg = 0;             ///< number of non-generic aggregate types
     310                        unsigned n_new = 0;             ///< number of new types
     311
    146312                        for ( auto decl : decls ) {
    147313                                Type* dt = decl->get_type();
     
    152318                                dt->print( ss );
    153319                                types.insert( ss.str() );
    154                                 bool this_new = seen.insert( ss.str() ).second;
    155                                 if ( this_new ) { ++n_new; }
    156 
    157                                 if ( dynamic_cast<BasicType*>( dt ) ) {
    158                                         ++n_basic;
    159                                         ++stats.basic_type_names[ ss.str() ];
    160                                         if ( this_new ) {
    161                                                 ++stats.basic_type_decls[ ss.str() ];
    162                                         }
    163                                 } else if ( GenPoly::hasPolyBase( dt ) ) {
    164                                         ++n_poly;
    165                                 } else {
    166                                         ++stats.compound_type_names[ ss.str() ];
    167                                         if ( this_new ) {
    168                                                 ++stats.compound_type_decls[ ss.str() ];
    169                                         }
    170                                 }
    171                         }
     320                                if ( seen.insert( ss.str() ).second ) { ++n_new; }
     321
     322                                bool seen_poly = false;
     323                                unsigned max_depth = 0;
     324                                analyzeType(
     325                                        dt, stats, elSeen, n_basic, n_generic, n_poly, n_agg, seen_poly, max_depth );
     326                                ++stats.n_generic_nesting.at( max_depth );
     327                        }
     328
    172329                        ++pstats.n.at( n );
    173330                        ++pstats.n_basic.at( n_basic );
     331                        ++pstats.n_generic.at( n_generic );
    174332                        ++pstats.n_poly.at( n_poly );
     333                        ++pstats.n_compound.at( n_agg );
    175334                        if ( n > 0 ) {
    176335                                ++pstats.p_basic[ n_basic*100/n ];
     336                                ++pstats.p_generic[ n_generic*100/n ];
    177337                                ++pstats.p_poly[ n_poly*100/n ];
    178                                 ++pstats.p_new[ n_new*100/n ];
     338                                ++pstats.p_compound[ n_agg*100/n ];
     339                                if ( n > 1 ) ++pstats.p_new[ (n_new-1)*100/(n-1) ];
    179340                        }
    180341                        ++pstats.n_types.at( types.size() );
     
    183344                void analyzeFunc( FunctionType* fnTy, Stats& stats, ArgPackStats& params, ArgPackStats& returns ) {
    184345                        std::unordered_set<std::string> seen;
    185                         analyze( stats, seen, params, fnTy->get_parameters() );
    186                         analyze( stats, seen, returns, fnTy->get_returnVals() );
     346                        std::unordered_set<std::string> elSeen;
     347                        analyze( stats, seen, elSeen, params, fnTy->get_parameters() );
     348                        analyze( stats, seen, elSeen, returns, fnTy->get_returnVals() );
    187349                }
    188350
     
    200362
    201363        public:
    202                 using Visitor::visit;
    203 
    204                 virtual void visit( FunctionDecl *decl ) {
     364                void previsit( FunctionDecl *decl ) {
    205365                        // skip if already seen declaration for this function
    206                         const std::string& mangleName = decl->get_mangleName().empty() ? decl->get_name() : decl->get_mangleName();
    207                         if ( ! seen_names.insert( mangleName ).second ) {
    208                                 maybeAccept( decl->get_statements(), *this );
    209                                 return;
    210                         }
    211 
    212                         Stats& stats = for_linkage[ decl->get_linkage() ];
    213 
    214                         ++stats.n_decls;
    215                         FunctionType* fnTy = decl->get_functionType();
    216                         const Type::ForallList& forall = fnTy->get_forall();
    217                         ++stats.n_type_params.at( forall.size() );
    218                         unsigned n_assns = 0;
    219                         for ( TypeDecl* fdecl : forall ) {
    220                                 n_assns += fdecl->get_assertions().size();
    221                                 for ( DeclarationWithType* assn : fdecl->get_assertions() ) {
    222                                         FunctionType *assnTy = 0;
    223                                         if ( ObjectDecl *assnObj = dynamic_cast<ObjectDecl*>(assn) ) {
    224                                                 if ( PointerType *ptrTy = dynamic_cast<PointerType*>(assnObj->get_type()) ) {
    225                                                         assnTy = dynamic_cast<FunctionType*>(ptrTy->get_base());
    226                                                 } else assnTy = dynamic_cast<FunctionType*>(assnObj->get_type());
    227                                         } else if ( FunctionDecl *assnDecl = dynamic_cast<FunctionDecl*>(assn) ) {
    228                                                 assnTy = assnDecl->get_functionType();
     366                        const std::string& mangleName = decl->get_mangleName().empty() ? decl->name : decl->get_mangleName();
     367                        if ( seen_names.insert( mangleName ).second ) {
     368                                Stats& stats = for_linkage[ ind_for_linkage[ decl->linkage ] ];
     369
     370                                ++stats.n_decls;
     371                                FunctionType* fnTy = decl->type;
     372                                const Type::ForallList& forall = fnTy->forall;
     373                                ++stats.n_type_params.at( forall.size() );
     374                                unsigned n_assns = 0;
     375                                for ( TypeDecl* fdecl : forall ) {
     376                                        n_assns += fdecl->assertions.size();
     377                                        for ( DeclarationWithType* assn : fdecl->assertions ) {
     378                                                FunctionType *assnTy = nullptr;
     379                                                if ( ObjectDecl *assnObj = dynamic_cast<ObjectDecl*>(assn) ) {
     380                                                        if ( PointerType *ptrTy = dynamic_cast<PointerType*>(assnObj->get_type()) ) {
     381                                                                assnTy = dynamic_cast<FunctionType*>(ptrTy->base);
     382                                                        } else assnTy = dynamic_cast<FunctionType*>(assnObj->get_type());
     383                                                } else if ( FunctionDecl *assnDecl = dynamic_cast<FunctionDecl*>(assn) ) {
     384                                                        assnTy = assnDecl->type;
     385                                                }
     386                                                if ( assnTy ) analyzeFunc( assnTy, stats, stats.assn_params, stats.assn_returns );
    229387                                        }
    230                                         if ( assnTy ) analyzeFunc( assnTy, stats, stats.assn_params, stats.assn_returns );
    231                                 }
    232                         }
    233                         ++stats.n_assns[ n_assns ];
    234 
    235                         ++stats.by_name[ decl->get_name() ];
    236 
    237                         analyzeFunc( fnTy, stats, stats.params, stats.returns );
    238 
    239                         // analyze expressions in decl statements
    240                         maybeAccept( decl->get_statements(), *this );
    241                 }
    242 
    243                 virtual void visit( UntypedExpr *expr ) {
     388                                }
     389                                ++stats.n_assns[ n_assns ];
     390                                ++stats.by_name[ decl->name ];
     391                                analyzeFunc( fnTy, stats, stats.params, stats.returns );
     392                        }
     393                }
     394
     395                void previsit( UntypedExpr *expr ) {
     396                        visit_children = false;
    244397                        analyzeExpr( expr, 0 );
    245398                }
     
    272425                template<typename F>
    273426                void printAllHisto( const std::string& name, F extract ) {
    274                         VectorMap<unsigned> histos[LinkageSpec::NoOfSpecs];
     427                        VectorMap<unsigned> histos[n_named_specs];
    275428                        VectorMap<unsigned> thisto;
    276429
    277430                        for ( const auto& entry : extract(total) ) { ++thisto.at( entry.second ); }
    278431
    279                         for ( unsigned i = 0; i < LinkageSpec::NoOfSpecs; ++i ) {
     432                        for ( unsigned i = 0; i < n_named_specs; ++i ) {
    280433                                // can't be a higher count in one of the sub-histograms than the total
    281434                                histos[i].reserve( thisto.size() );
     
    295448                template<typename F>
    296449                void printAllSparseHisto( const std::string& name, F extract ) {
    297                         std::map<unsigned, unsigned> histos[LinkageSpec::NoOfSpecs];
     450                        std::map<unsigned, unsigned> histos[n_named_specs];
    298451                        std::map<unsigned, unsigned> thisto;
    299452
    300453                        for ( const auto& entry : extract(total) ) { ++thisto[ entry.second ]; }
    301454
    302                         for ( unsigned i = 0; i < LinkageSpec::NoOfSpecs; ++i ) {
     455                        for ( unsigned i = 0; i < n_named_specs; ++i ) {
    303456                                for ( const auto& entry : extract(for_linkage[i]) ) { ++histos[i][entry.second]; }
    304457                        }
     
    307460                                const auto& key = entry.first;
    308461                                std::cout << "\"" << name << "\"," << key;
    309                                 for ( unsigned i = 0; i < LinkageSpec::NoOfSpecs; ++i ) {
     462                                for ( unsigned i = 0; i < n_named_specs; ++i ) {
    310463                                        auto it = histos[i].find( key );
    311464                                        if ( it == histos[i].end() ) std::cout << ",0";
     
    319472                void printAllPack( const std::string& name, F extract ) {
    320473                        printAllMap("n_basic_" + name, [&extract](const Stats& stats) { return extract(stats).n_basic; });
     474                        printAllMap("n_generic_" + name, [&extract](const Stats& stats) { return extract(stats).n_generic; });
    321475                        printAllMap("n_poly_" + name, [&extract](const Stats& stats) { return extract(stats).n_poly; });
     476                        printAllMap("n_compound_" + name, [&extract](const Stats& stats) { return extract(stats).n_compound; });
    322477                        printAllMap("n_" + name, [&extract](const Stats& stats) { return extract(stats).n; });
    323478                        printAllMap("%_basic_" + name, [&extract](const Stats& stats) { return extract(stats).p_basic; });
     479                        printAllMap("%_generic_" + name, [&extract](const Stats& stats) { return extract(stats).p_generic; });
    324480                        printAllMap("%_poly_" + name, [&extract](const Stats& stats) { return extract(stats).p_poly; });
     481                        printAllMap("%_compound_" + name, [&extract](const Stats& stats) { return extract(stats).p_compound; });
    325482                        printAllMap("n_distinct_types_" + name, [&extract](const Stats& stats) { return extract(stats).n_types; });
    326483                        printAllMap("%_new_types_in_" + name, [&extract](const Stats& stats) { return extract(stats).p_new; });
     
    342499                        }
    343500
    344                         std::cout << ",,\"intrinsic\",\"Cforall\",\"C\",\"autogen\",\"builtin\",\"TOTAL\"" << std::endl;
     501                        std::cout << ",,\"intrinsic\",\"Cforall\",\"C\",\"autogen\",\"compiler\",\"builtinCFA\",\"builtinC\",\"other\",\"TOTAL\"" << std::endl;
    345502
    346503                        printAllMap("n_type_params", [](const Stats& stats) { return stats.n_type_params; });
     504                        printAllMap("n_generic_params", [](const Stats& stats) { return stats.n_generic_params; });
     505                        printAllMap("n_generic_nesting", [](const Stats& stats) { return stats.n_generic_nesting; });
    347506                        printAll("n_decls", [](const Stats& stats) { return stats.n_decls; });
    348507                        printAll("unique_names", [](const Stats& stats) { return stats.by_name.size(); });
     
    351510                        printAllSparseHisto("basic_type_uses", [](const Stats& stats) { return stats.basic_type_names; });
    352511                        printAllSparseHisto("decls_using_basic_type", [](const Stats& stats) { return stats.basic_type_decls; });
     512                        printAll("generic_type_names", [](const Stats& stats) { return stats.generic_type_names.size(); });
     513                        printAllSparseHisto("generic_type_uses", [](const Stats& stats) { return stats.generic_type_names; });
     514                        printAllSparseHisto("decls_using_generic_type", [](const Stats& stats) { return stats.generic_type_decls; });
    353515                        printAll("compound_type_names", [](const Stats& stats) { return stats.compound_type_names.size(); });
    354516                        printAllSparseHisto("compound_type_uses", [](const Stats& stats) { return stats.compound_type_names; });
     
    365527        };
    366528
     529        const unsigned DeclStats::ind_for_linkage[]
     530                = { 7, 7, 2, 1,   7, 7, 7, 3,   4, 7, 6, 5,   7, 7, 7, 0 };
     531
    367532        void printDeclStats( std::list< Declaration * > &translationUnit ) {
    368                 DeclStats stats;
     533                PassVisitor<DeclStats> stats;
    369534                acceptAll( translationUnit, stats );
    370                 stats.print();
     535                stats.pass.print();
    371536        }
    372537
  • src/CodeTools/TrackLoc.cc

    rf9feab8 r90152a4  
    2424
    2525#include "Common/PassVisitor.h"      // for PassVisitor
    26 #include "Common/SemanticError.h"    // for SemanticError
    2726#include "Common/utility.h"          // for CodeLocation
    2827#include "SynTree/BaseSyntaxNode.h"  // for BaseSyntaxNode
     
    6463                                }
    6564                                else {
    66                                         assertf( false, "Top level node has no CodeLocation %s", name.c_str() );
     65                                        assertf( false, "Top level node has no CodeLocation %s", toString( node ).c_str() );
    6766                                }
    6867                        }
  • src/Common/Debug.h

    rf9feab8 r90152a4  
    2828namespace Debug {
    2929        /// debug codegen a translation unit
    30         static inline void codeGen( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label ) {
     30        static inline void codeGen( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label, __attribute__((unused)) LinkageSpec::Spec linkageFilter = LinkageSpec::Builtin ) {
    3131        #ifdef DEBUG
    3232                std::list< Declaration * > decls;
    3333
    34                 filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), []( Declaration * decl ) {
    35                         return ! LinkageSpec::isBuiltin( decl->get_linkage() );
     34                filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), [linkageFilter]( Declaration * decl ) {
     35                        return ! (decl->linkage & linkageFilter);
    3636                });
    3737
    3838                std::cerr << "======" << label << "======" << std::endl;
    39                 CodeGen::generate( decls, std::cerr, false, true );
     39                CodeGen::generate(
     40                        decls,
     41                        std::cerr,
     42                        true /* doIntrinsics */,
     43                        true /* pretty */,
     44                        false /* generateC */,
     45                        false /* lineMarks */,
     46                        true /* printTypeExpr */
     47                );
    4048        #endif
    4149        } // dump
    4250
    43         static inline void treeDump( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label ) {
     51        static inline void treeDump( __attribute__((unused)) const std::list< Declaration * > & translationUnit, __attribute__((unused)) const std::string & label, __attribute__((unused)) LinkageSpec::Spec linkageFilter = LinkageSpec::Compiler ) {
    4452        #ifdef DEBUG
    4553                std::list< Declaration * > decls;
    4654
    47                 filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), []( Declaration * decl ) {
    48                         return ! LinkageSpec::isBuiltin( decl->get_linkage() );
     55                filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), [linkageFilter]( Declaration * decl ) {
     56                        return ! (decl->linkage & linkageFilter);
    4957                });
    5058
  • src/Common/PassVisitor.h

    rf9feab8 r90152a4  
    1919#include "SynTree/Expression.h"
    2020#include "SynTree/Constant.h"
    21 #include "SynTree/TypeSubstitution.h"
     21
     22class TypeSubstitution;
    2223
    2324#include "PassVisitor.proto.h"
     
    6566        virtual void visit( TypedefDecl * typeDecl ) override final;
    6667        virtual void visit( AsmDecl * asmDecl ) override final;
     68        virtual void visit( StaticAssertDecl * assertDecl ) override final;
    6769
    6870        virtual void visit( CompoundStmt * compoundStmt ) override final;
    6971        virtual void visit( ExprStmt * exprStmt ) override final;
    7072        virtual void visit( AsmStmt * asmStmt ) override final;
     73        virtual void visit( DirectiveStmt * dirStmt ) override final;
    7174        virtual void visit( IfStmt * ifStmt ) override final;
    7275        virtual void visit( WhileStmt * whileStmt ) override final;
     
    9093        virtual void visit( NameExpr * nameExpr ) override final;
    9194        virtual void visit( CastExpr * castExpr ) override final;
     95        virtual void visit( KeywordCastExpr * castExpr ) override final;
    9296        virtual void visit( VirtualCastExpr * castExpr ) override final;
    9397        virtual void visit( AddressExpr * addressExpr ) override final;
     
    118122        virtual void visit( StmtExpr *  stmtExpr ) override final;
    119123        virtual void visit( UniqueExpr *  uniqueExpr ) override final;
     124        virtual void visit( UntypedInitExpr *  initExpr ) override final;
     125        virtual void visit( InitExpr *  initExpr ) override final;
     126        virtual void visit( DeletedExpr *  delExpr ) override final;
     127        virtual void visit( DefaultArgExpr * argExpr ) override final;
     128        virtual void visit( GenericExpr * genExpr ) override final;
    120129
    121130        virtual void visit( VoidType * basicType ) override final;
     
    124133        virtual void visit( ArrayType * arrayType ) override final;
    125134        virtual void visit( ReferenceType * referenceType ) override final;
     135        virtual void visit( QualifiedType * qualType ) override final;
    126136        virtual void visit( FunctionType * functionType ) override final;
    127137        virtual void visit( StructInstType * aggregateUseType ) override final;
     
    136146        virtual void visit( ZeroType * zeroType ) override final;
    137147        virtual void visit( OneType * oneType ) override final;
     148        virtual void visit( GlobalScopeType * globalType ) override final;
    138149
    139150        virtual void visit( Designation * designation ) override final;
     
    157168        virtual Declaration * mutate( TypedefDecl * typeDecl ) override final;
    158169        virtual AsmDecl * mutate( AsmDecl * asmDecl ) override final;
     170        virtual StaticAssertDecl * mutate( StaticAssertDecl * assertDecl ) override final;
    159171
    160172        virtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) override final;
    161173        virtual Statement * mutate( ExprStmt * exprStmt ) override final;
    162174        virtual Statement * mutate( AsmStmt * asmStmt ) override final;
     175        virtual Statement * mutate( DirectiveStmt * dirStmt ) override final;
    163176        virtual Statement * mutate( IfStmt * ifStmt ) override final;
    164177        virtual Statement * mutate( WhileStmt * whileStmt ) override final;
     
    181194        virtual Expression * mutate( UntypedExpr * untypedExpr ) override final;
    182195        virtual Expression * mutate( NameExpr * nameExpr ) override final;
    183         virtual Expression * mutate( AddressExpr * castExpr ) override final;
     196        virtual Expression * mutate( AddressExpr * addrExpr ) override final;
    184197        virtual Expression * mutate( LabelAddressExpr * labAddressExpr ) override final;
    185198        virtual Expression * mutate( CastExpr * castExpr ) override final;
     199        virtual Expression * mutate( KeywordCastExpr * castExpr ) override final;
    186200        virtual Expression * mutate( VirtualCastExpr * castExpr ) override final;
    187201        virtual Expression * mutate( UntypedMemberExpr * memberExpr ) override final;
     
    210224        virtual Expression * mutate( StmtExpr *  stmtExpr ) override final;
    211225        virtual Expression * mutate( UniqueExpr *  uniqueExpr ) override final;
     226        virtual Expression * mutate( UntypedInitExpr *  initExpr ) override final;
     227        virtual Expression * mutate( InitExpr *  initExpr ) override final;
     228        virtual Expression * mutate( DeletedExpr *  delExpr ) override final;
     229        virtual Expression * mutate( DefaultArgExpr * argExpr ) override final;
     230        virtual Expression * mutate( GenericExpr * genExpr ) override final;
    212231
    213232        virtual Type * mutate( VoidType * basicType ) override final;
     
    216235        virtual Type * mutate( ArrayType * arrayType ) override final;
    217236        virtual Type * mutate( ReferenceType * referenceType ) override final;
     237        virtual Type * mutate( QualifiedType * qualType ) override final;
    218238        virtual Type * mutate( FunctionType * functionType ) override final;
    219239        virtual Type * mutate( StructInstType * aggregateUseType ) override final;
     
    228248        virtual Type * mutate( ZeroType * zeroType ) override final;
    229249        virtual Type * mutate( OneType * oneType ) override final;
     250        virtual Type * mutate( GlobalScopeType * globalType ) override final;
    230251
    231252        virtual Designation * mutate( Designation * designation ) override final;
     
    243264
    244265private:
     266        bool inFunction = false;
     267
    245268        template<typename pass_t> friend void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_t >& visitor );
    246269        template<typename pass_t> friend void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_t >& visitor );
     
    286309        bool_ref * get_visit_children_ptr() { return visit_children_impl(pass, 0); }
    287310
    288         void indexerScopeEnter  ()                             { indexer_impl_enterScope  ( pass, 0       ); }
    289         void indexerScopeLeave  ()                             { indexer_impl_leaveScope  ( pass, 0       ); }
    290         void indexerAddId       ( DeclarationWithType * node ) { indexer_impl_addId       ( pass, 0, node ); }
    291         void indexerAddType     ( NamedTypeDecl       * node ) { indexer_impl_addType     ( pass, 0, node ); }
    292         void indexerAddStruct   ( const std::string   & id   ) { indexer_impl_addStruct   ( pass, 0, id   ); }
    293         void indexerAddStruct   ( StructDecl          * node ) { indexer_impl_addStruct   ( pass, 0, node ); }
    294         void indexerAddStructFwd( StructDecl          * node ) { indexer_impl_addStructFwd( pass, 0, node ); }
    295         void indexerAddEnum     ( EnumDecl            * node ) { indexer_impl_addEnum     ( pass, 0, node ); }
    296         void indexerAddUnion    ( const std::string   & id   ) { indexer_impl_addUnion    ( pass, 0, id   ); }
    297         void indexerAddUnion    ( UnionDecl           * node ) { indexer_impl_addUnion    ( pass, 0, node ); }
    298         void indexerAddUnionFwd ( UnionDecl           * node ) { indexer_impl_addUnionFwd ( pass, 0, node ); }
    299         void indexerAddTrait    ( TraitDecl           * node ) { indexer_impl_addTrait    ( pass, 0, node ); }
    300         void indexerAddWith     ( WithStmt            * node ) { indexer_impl_addWith    ( pass, 0, node ); }
     311        void indexerScopeEnter  ()                                    { indexer_impl_enterScope  ( pass, 0       ); }
     312        void indexerScopeLeave  ()                                    { indexer_impl_leaveScope  ( pass, 0       ); }
     313        void indexerAddId       ( DeclarationWithType       * node ) { indexer_impl_addId       ( pass, 0, node ); }
     314        void indexerAddType     ( NamedTypeDecl             * node ) { indexer_impl_addType     ( pass, 0, node ); }
     315        void indexerAddStruct   ( const std::string         & id    ) { indexer_impl_addStruct   ( pass, 0, id   ); }
     316        void indexerAddStruct   ( StructDecl                * node ) { indexer_impl_addStruct   ( pass, 0, node ); }
     317        void indexerAddStructFwd( StructDecl                * node ) { indexer_impl_addStructFwd( pass, 0, node ); }
     318        void indexerAddEnum     ( EnumDecl                  * node ) { indexer_impl_addEnum     ( pass, 0, node ); }
     319        void indexerAddUnion    ( const std::string         & id    ) { indexer_impl_addUnion    ( pass, 0, id   ); }
     320        void indexerAddUnion    ( UnionDecl                 * node ) { indexer_impl_addUnion    ( pass, 0, node ); }
     321        void indexerAddUnionFwd ( UnionDecl                 * node ) { indexer_impl_addUnionFwd ( pass, 0, node ); }
     322        void indexerAddTrait    ( TraitDecl                 * node ) { indexer_impl_addTrait    ( pass, 0, node ); }
     323        void indexerAddWith     ( std::list< Expression * > & exprs, BaseSyntaxNode * withStmt ) { indexer_impl_addWith( pass, 0, exprs, withStmt ); }
    301324
    302325
     
    403426};
    404427
     428#include "SynTree/TypeSubstitution.h"
    405429#include "PassVisitor.impl.h"
  • src/Common/PassVisitor.impl.h

    rf9feab8 r90152a4  
    6262
    6363template< typename pass_type >
    64 static inline void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& visitor ) {
     64inline void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& visitor ) {
    6565        DeclList_t* beforeDecls = visitor.get_beforeDecls();
    6666        DeclList_t* afterDecls  = visitor.get_afterDecls();
    67         SemanticError errors;
     67        SemanticErrorException errors;
    6868
    6969        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
     
    7676                        // run visitor on declaration
    7777                        maybeAccept_impl( *i, visitor );
    78                 } catch( SemanticError &e ) {
    79                         e.set_location( (*i)->location );
     78                } catch( SemanticErrorException &e ) {
    8079                        errors.append( e );
    8180                }
     
    9089
    9190template< typename pass_type >
    92 static inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) {
     91inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) {
    9392        DeclList_t* beforeDecls = mutator.get_beforeDecls();
    9493        DeclList_t* afterDecls  = mutator.get_afterDecls();
    95         SemanticError errors;
     94        SemanticErrorException errors;
    9695
    9796        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
     
    103102                        // run mutator on declaration
    104103                        maybeMutate_impl( *i, mutator );
    105                 } catch( SemanticError &e ) {
    106                         e.set_location( (*i)->location );
     104                } catch( SemanticErrorException &e ) {
    107105                        errors.append( e );
    108106                }
     
    127125inline void maybeAccept_impl( Container & container, PassVisitor< pass_type > & visitor ) {
    128126        if ( ! visitor.get_visit_children() ) return;
    129         SemanticError errors;
     127        SemanticErrorException errors;
    130128        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    131129                try {
     
    133131                                (*i)->accept( visitor );
    134132                        }
    135                 } catch( SemanticError &e ) {
    136                         e.set_location( (*i)->location );
     133                } catch( SemanticErrorException &e ) {
    137134                        errors.append( e );
    138135                }
     
    155152inline void maybeMutate_impl( Container & container, PassVisitor< pass_type > & mutator ) {
    156153        if ( ! mutator.get_visit_children() ) return;
    157         SemanticError errors;
     154        SemanticErrorException errors;
    158155        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    159156                try {
     
    162159                                assert( *i );
    163160                        } // if
    164                 } catch( SemanticError &e ) {
    165                         e.set_location( (*i)->location );
     161                } catch( SemanticErrorException &e ) {
    166162                        errors.append( e );
    167163                } // try
     
    176172void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) {
    177173        if ( ! get_visit_children() ) return;
    178         SemanticError errors;
     174        SemanticErrorException errors;
    179175
    180176        // don't want statements from outer CompoundStmts to be added to this CompoundStmt
     
    199195                            || ( empty( beforeDecls ) && empty( afterDecls )) );
    200196
    201                 } catch ( SemanticError &e ) {
    202                         e.set_location( (*i)->location );
     197                } catch ( SemanticErrorException &e ) {
    203198                        errors.append( e );
    204199                }
     
    365360        maybeAccept_impl   ( node->attributes   , *this );
    366361
    367         if ( node->name != "" ) {
    368                 indexerAddId( node );
    369         }
     362        indexerAddId( node );
    370363
    371364        VISIT_END( node );
     
    381374        maybeMutate_impl   ( node->attributes   , *this );
    382375
    383         if ( node->name != "" ) {
    384                 indexerAddId( node );
    385         }
     376        indexerAddId( node );
    386377
    387378        MUTATE_END( DeclarationWithType, node );
     
    394385        VISIT_START( node );
    395386
    396         if ( node->name != "" ) {
    397                 indexerAddId( node );
    398         }
    399 
     387        indexerAddId( node );
     388
     389        maybeAccept_impl( node->withExprs, *this );
    400390        {
     391                // with clause introduces a level of scope (for the with expression members).
     392                // with clause exprs are added to the indexer before parameters so that parameters
     393                // shadow with exprs and not the other way around.
    401394                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    402                 // implicit add __func__ identifier as specified in the C manual 6.4.2.2
    403                 static ObjectDecl func(
    404                         "__func__", noStorageClasses, LinkageSpec::C, nullptr,
    405                         new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
    406                         nullptr
    407                 );
    408                 indexerAddId( &func );
    409                 maybeAccept_impl( node->type, *this );
    410                 maybeAccept_impl( node->statements, *this );
    411                 maybeAccept_impl( node->attributes, *this );
     395                indexerAddWith( node->withExprs, node );
     396                {
     397                        auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     398                        // implicit add __func__ identifier as specified in the C manual 6.4.2.2
     399                        static ObjectDecl func(
     400                                "__func__", noStorageClasses, LinkageSpec::C, nullptr,
     401                                new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
     402                                nullptr
     403                        );
     404                        indexerAddId( &func );
     405                        maybeAccept_impl( node->type, *this );
     406                        // function body needs to have the same scope as parameters - CompoundStmt will not enter
     407                        // a new scope if inFunction is true
     408                        ValueGuard< bool > oldInFunction( inFunction );
     409                        inFunction = true;
     410                        maybeAccept_impl( node->statements, *this );
     411                        maybeAccept_impl( node->attributes, *this );
     412                }
    412413        }
    413414
     
    419420        MUTATE_START( node );
    420421
    421         if ( node->name != "" ) {
    422                 indexerAddId( node );
    423         }
     422        indexerAddId( node );
    424423
    425424        {
     425                // with clause introduces a level of scope (for the with expression members).
     426                // with clause exprs are added to the indexer before parameters so that parameters
     427                // shadow with exprs and not the other way around.
    426428                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    427                 // implicit add __func__ identifier as specified in the C manual 6.4.2.2
    428                 static ObjectDecl func(
    429                         "__func__", noStorageClasses, LinkageSpec::C, nullptr,
    430                         new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
    431                         nullptr
    432                 );
    433                 indexerAddId( &func );
    434                 maybeMutate_impl( node->type, *this );
    435                 maybeMutate_impl( node->statements, *this );
    436                 maybeMutate_impl( node->attributes, *this );
     429                indexerAddWith( node->withExprs, node );
     430                {
     431                        auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     432                        // implicit add __func__ identifier as specified in the C manual 6.4.2.2
     433                        static ObjectDecl func(
     434                                "__func__", noStorageClasses, LinkageSpec::C, nullptr,
     435                                new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
     436                                nullptr
     437                        );
     438                        indexerAddId( &func );
     439                        maybeMutate_impl( node->type, *this );
     440                        // function body needs to have the same scope as parameters - CompoundStmt will not enter
     441                        // a new scope if inFunction is true
     442                        ValueGuard< bool > oldInFunction( inFunction );
     443                        inFunction = true;
     444                        maybeMutate_impl( node->statements, *this );
     445                        maybeMutate_impl( node->attributes, *this );
     446                }
    437447        }
    438448
     
    683693
    684694//--------------------------------------------------------------------------
     695// StaticAssertDecl
     696template< typename pass_type >
     697void PassVisitor< pass_type >::visit( StaticAssertDecl * node ) {
     698        VISIT_START( node );
     699
     700        node->condition = visitExpression( node->condition );
     701        maybeAccept_impl( node->message, *this );
     702
     703        VISIT_END( node );
     704}
     705
     706template< typename pass_type >
     707StaticAssertDecl * PassVisitor< pass_type >::mutate( StaticAssertDecl * node ) {
     708        MUTATE_START( node );
     709
     710        node->condition = mutateExpression( node->condition );
     711        maybeMutate_impl( node->message, *this );
     712
     713        MUTATE_END( StaticAssertDecl, node );
     714}
     715
     716//--------------------------------------------------------------------------
    685717// CompoundStmt
    686718template< typename pass_type >
     
    688720        VISIT_START( node );
    689721        {
    690                 auto guard1 = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     722                // do not enter a new scope if inFunction is true - needs to check old state before the assignment
     723                ValueGuard< bool > oldInFunction( inFunction );
     724                auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } );
    691725                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
     726                inFunction = false;
    692727                visitStatementList( node->kids );
    693728        }
     
    699734        MUTATE_START( node );
    700735        {
    701                 auto guard1 = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     736                // do not enter a new scope if inFunction is true - needs to check old state before the assignment
     737                ValueGuard< bool > oldInFunction( inFunction );
     738                auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } );
    702739                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
     740                inFunction = false;
    703741                mutateStatementList( node->kids );
    704742        }
     
    730768template< typename pass_type >
    731769void PassVisitor< pass_type >::visit( AsmStmt * node ) {
    732         VISIT_BODY( node );
     770        VISIT_START( node )
     771
     772        maybeAccept_impl( node->instruction, *this );
     773        maybeAccept_impl( node->output, *this );
     774        maybeAccept_impl( node->input, *this );
     775        maybeAccept_impl( node->clobber, *this );
     776
     777        VISIT_END( node );
    733778}
    734779
    735780template< typename pass_type >
    736781Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) {
    737         MUTATE_BODY( Statement, node );
     782        MUTATE_START( node );
     783
     784        maybeMutate_impl( node->instruction, *this );
     785        maybeMutate_impl( node->output, *this );
     786        maybeMutate_impl( node->input, *this );
     787        maybeMutate_impl( node->clobber, *this );
     788
     789        MUTATE_END( Statement, node );
     790}
     791
     792//--------------------------------------------------------------------------
     793// AsmStmt
     794template< typename pass_type >
     795void PassVisitor< pass_type >::visit( DirectiveStmt * node ) {
     796        VISIT_START( node )
     797
     798        VISIT_END( node );
     799}
     800
     801template< typename pass_type >
     802Statement * PassVisitor< pass_type >::mutate( DirectiveStmt * node ) {
     803        MUTATE_START( node );
     804
     805        MUTATE_END( Statement, node );
    738806}
    739807
     
    774842        VISIT_START( node );
    775843
    776         visitExpression( node->condition );
    777         node->body = visitStatement( node->body );
     844        {
     845                // while statements introduce a level of scope (for the initialization)
     846                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     847                maybeAccept_impl( node->initialization, *this );
     848                visitExpression ( node->condition );
     849                node->body = visitStatement( node->body );
     850        }
    778851
    779852        VISIT_END( node );
     
    784857        MUTATE_START( node );
    785858
    786         node->condition = mutateExpression( node->condition );
    787         node->body      = mutateStatement ( node->body      );
     859        {
     860                // while statements introduce a level of scope (for the initialization)
     861                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     862                maybeMutate_impl( node->initialization, *this );
     863                node->condition = mutateExpression( node->condition );
     864                node->body      = mutateStatement ( node->body      );
     865        }
     866
    788867
    789868        MUTATE_END( Statement, node );
     
    868947template< typename pass_type >
    869948void PassVisitor< pass_type >::visit( BranchStmt * node ) {
    870         VISIT_BODY( node );
     949        VISIT_START( node );
     950        VISIT_END( node );
    871951}
    872952
    873953template< typename pass_type >
    874954Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) {
    875         MUTATE_BODY( Statement, node );
     955        MUTATE_START( node );
     956        MUTATE_END( Statement, node );
    876957}
    877958
     
    901982template< typename pass_type >
    902983void PassVisitor< pass_type >::visit( ThrowStmt * node ) {
    903         VISIT_BODY( node );
     984        VISIT_START( node );
     985
     986        maybeAccept_impl( node->expr, *this );
     987        maybeAccept_impl( node->target, *this );
     988
     989        VISIT_END( node );
    904990}
    905991
    906992template< typename pass_type >
    907993Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) {
    908         MUTATE_BODY( Statement, node );
     994        MUTATE_START( node );
     995
     996        maybeMutate_impl( node->expr, *this );
     997        maybeMutate_impl( node->target, *this );
     998
     999        MUTATE_END( Statement, node );
    9091000}
    9101001
     
    9651056template< typename pass_type >
    9661057void PassVisitor< pass_type >::visit( FinallyStmt * node ) {
    967         VISIT_BODY( node );
     1058        VISIT_START( node );
     1059
     1060        maybeAccept_impl( node->block, *this );
     1061
     1062        VISIT_END( node );
    9681063}
    9691064
    9701065template< typename pass_type >
    9711066Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) {
    972         MUTATE_BODY( Statement, node );
     1067        MUTATE_START( node );
     1068
     1069        maybeMutate_impl( node->block, *this );
     1070
     1071        MUTATE_END( Statement, node );
    9731072}
    9741073
     
    9771076template< typename pass_type >
    9781077void PassVisitor< pass_type >::visit( WaitForStmt * node ) {
    979         VISIT_BODY( node );
     1078        VISIT_START( node );
     1079
     1080        for( auto & clause : node->clauses ) {
     1081                maybeAccept_impl( clause.target.function, *this );
     1082                maybeAccept_impl( clause.target.arguments, *this );
     1083
     1084                maybeAccept_impl( clause.statement, *this );
     1085                maybeAccept_impl( clause.condition, *this );
     1086        }
     1087
     1088        maybeAccept_impl( node->timeout.time, *this );
     1089        maybeAccept_impl( node->timeout.statement, *this );
     1090        maybeAccept_impl( node->timeout.condition, *this );
     1091        maybeAccept_impl( node->orelse.statement, *this );
     1092        maybeAccept_impl( node->orelse.condition, *this );
     1093
     1094        VISIT_END( node );
    9801095}
    9811096
    9821097template< typename pass_type >
    9831098Statement * PassVisitor< pass_type >::mutate( WaitForStmt * node ) {
    984         MUTATE_BODY( Statement, node );
     1099        MUTATE_START( node );
     1100
     1101        for( auto & clause : node->clauses ) {
     1102                maybeMutate_impl( clause.target.function, *this );
     1103                maybeMutate_impl( clause.target.arguments, *this );
     1104
     1105                maybeMutate_impl( clause.statement, *this );
     1106                maybeMutate_impl( clause.condition, *this );
     1107        }
     1108
     1109        maybeMutate_impl( node->timeout.time, *this );
     1110        maybeMutate_impl( node->timeout.statement, *this );
     1111        maybeMutate_impl( node->timeout.condition, *this );
     1112        maybeMutate_impl( node->orelse.statement, *this );
     1113        maybeMutate_impl( node->orelse.condition, *this );
     1114
     1115        MUTATE_END( Statement, node );
    9851116}
    9861117
     
    9961127                // catch statements introduce a level of scope (for the caught exception)
    9971128                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    998                 indexerAddWith( node );
     1129                indexerAddWith( node->exprs, node );
    9991130                maybeAccept_impl( node->stmt, *this );
    10001131        }
     
    10091140                // catch statements introduce a level of scope (for the caught exception)
    10101141                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1011                 indexerAddWith( node );
     1142                indexerAddWith( node->exprs, node );
    10121143                maybeMutate_impl( node->stmt, *this );
    10131144        }
     
    10191150template< typename pass_type >
    10201151void PassVisitor< pass_type >::visit( NullStmt * node ) {
    1021         VISIT_BODY( node );
     1152        VISIT_START( node );
     1153        VISIT_END( node );
    10221154}
    10231155
    10241156template< typename pass_type >
    10251157NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) {
    1026         MUTATE_BODY( NullStmt, node );
     1158        MUTATE_START( node );
     1159        MUTATE_END( NullStmt, node );
    10271160}
    10281161
     
    10311164template< typename pass_type >
    10321165void PassVisitor< pass_type >::visit( DeclStmt * node ) {
    1033         VISIT_BODY( node );
     1166        VISIT_START( node );
     1167
     1168        maybeAccept_impl( node->decl, *this );
     1169
     1170        VISIT_END( node );
    10341171}
    10351172
    10361173template< typename pass_type >
    10371174Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) {
    1038         MUTATE_BODY( Statement, node );
     1175        MUTATE_START( node );
     1176
     1177        maybeMutate_impl( node->decl, *this );
     1178
     1179        MUTATE_END( Statement, node );
    10391180}
    10401181
     
    10431184template< typename pass_type >
    10441185void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) {
    1045         VISIT_BODY( node );
     1186        VISIT_START( node );
     1187
     1188        maybeAccept_impl( node->callStmt, *this );
     1189
     1190        VISIT_END( node );
    10461191}
    10471192
    10481193template< typename pass_type >
    10491194Statement * PassVisitor< pass_type >::mutate( ImplicitCtorDtorStmt * node ) {
    1050         MUTATE_BODY( Statement, node );
     1195        MUTATE_START( node );
     1196
     1197        maybeMutate_impl( node->callStmt, *this );
     1198
     1199        MUTATE_END( Statement, node );
    10511200}
    10521201
     
    11411290template< typename pass_type >
    11421291Expression * PassVisitor< pass_type >::mutate( CastExpr * node ) {
     1292        MUTATE_START( node );
     1293
     1294        indexerScopedMutate( node->env   , *this );
     1295        indexerScopedMutate( node->result, *this );
     1296        maybeMutate_impl   ( node->arg   , *this );
     1297
     1298        MUTATE_END( Expression, node );
     1299}
     1300
     1301//--------------------------------------------------------------------------
     1302// KeywordCastExpr
     1303template< typename pass_type >
     1304void PassVisitor< pass_type >::visit( KeywordCastExpr * node ) {
     1305        VISIT_START( node );
     1306
     1307        indexerScopedAccept( node->result, *this );
     1308        maybeAccept_impl        ( node->arg   , *this );
     1309
     1310        VISIT_END( node );
     1311}
     1312
     1313template< typename pass_type >
     1314Expression * PassVisitor< pass_type >::mutate( KeywordCastExpr * node ) {
    11431315        MUTATE_START( node );
    11441316
     
    14041576        indexerScopedAccept( node->result, *this );
    14051577        maybeAccept_impl   ( node->type  , *this );
    1406         maybeAccept_impl   ( node->member, *this );
    14071578
    14081579        VISIT_END( node );
     
    14161587        indexerScopedMutate( node->result, *this );
    14171588        maybeMutate_impl   ( node->type  , *this );
    1418         maybeMutate_impl   ( node->member, *this );
    14191589
    14201590        MUTATE_END( Expression, node );
     
    18532023}
    18542024
     2025//--------------------------------------------------------------------------
     2026// UntypedInitExpr
     2027template< typename pass_type >
     2028void PassVisitor< pass_type >::visit( UntypedInitExpr * node ) {
     2029        VISIT_START( node );
     2030
     2031        indexerScopedAccept( node->result, *this );
     2032        maybeAccept_impl   ( node->expr  , *this );
     2033        // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver.
     2034
     2035        VISIT_END( node );
     2036}
     2037
     2038template< typename pass_type >
     2039Expression * PassVisitor< pass_type >::mutate( UntypedInitExpr * node ) {
     2040        MUTATE_START( node );
     2041
     2042        indexerScopedMutate( node->env   , *this );
     2043        indexerScopedMutate( node->result, *this );
     2044        maybeMutate_impl   ( node->expr  , *this );
     2045        // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver.
     2046
     2047        MUTATE_END( Expression, node );
     2048}
     2049
     2050//--------------------------------------------------------------------------
     2051// InitExpr
     2052template< typename pass_type >
     2053void PassVisitor< pass_type >::visit( InitExpr * node ) {
     2054        VISIT_START( node );
     2055
     2056        indexerScopedAccept( node->result, *this );
     2057        maybeAccept_impl   ( node->expr  , *this );
     2058        maybeAccept_impl   ( node->designation, *this );
     2059
     2060        VISIT_END( node );
     2061}
     2062
     2063template< typename pass_type >
     2064Expression * PassVisitor< pass_type >::mutate( InitExpr * node ) {
     2065        MUTATE_START( node );
     2066
     2067        indexerScopedMutate( node->env   , *this );
     2068        indexerScopedMutate( node->result, *this );
     2069        maybeMutate_impl   ( node->expr  , *this );
     2070        maybeMutate_impl   ( node->designation, *this );
     2071
     2072        MUTATE_END( Expression, node );
     2073}
     2074
     2075//--------------------------------------------------------------------------
     2076// DeletedExpr
     2077template< typename pass_type >
     2078void PassVisitor< pass_type >::visit( DeletedExpr * node ) {
     2079        VISIT_START( node );
     2080
     2081        indexerScopedAccept( node->result, *this );
     2082        maybeAccept_impl( node->expr, *this );
     2083        // don't visit deleteStmt, because it is a pointer to somewhere else in the tree.
     2084
     2085        VISIT_END( node );
     2086}
     2087
     2088template< typename pass_type >
     2089Expression * PassVisitor< pass_type >::mutate( DeletedExpr * node ) {
     2090        MUTATE_START( node );
     2091
     2092        indexerScopedMutate( node->env, *this );
     2093        indexerScopedMutate( node->result, *this );
     2094        maybeMutate_impl( node->expr, *this );
     2095
     2096        MUTATE_END( Expression, node );
     2097}
     2098
     2099//--------------------------------------------------------------------------
     2100// DefaultArgExpr
     2101template< typename pass_type >
     2102void PassVisitor< pass_type >::visit( DefaultArgExpr * node ) {
     2103        VISIT_START( node );
     2104
     2105        indexerScopedAccept( node->result, *this );
     2106        maybeAccept_impl( node->expr, *this );
     2107
     2108        VISIT_END( node );
     2109}
     2110
     2111template< typename pass_type >
     2112Expression * PassVisitor< pass_type >::mutate( DefaultArgExpr * node ) {
     2113        MUTATE_START( node );
     2114
     2115        indexerScopedMutate( node->env, *this );
     2116        indexerScopedMutate( node->result, *this );
     2117        maybeMutate_impl( node->expr, *this );
     2118
     2119        MUTATE_END( Expression, node );
     2120}
     2121
     2122//--------------------------------------------------------------------------
     2123// GenericExpr
     2124template< typename pass_type >
     2125void PassVisitor< pass_type >::visit( GenericExpr * node ) {
     2126        VISIT_START( node );
     2127
     2128        indexerScopedAccept( node->result, *this );
     2129        maybeAccept_impl( node->control, *this );
     2130        for ( GenericExpr::Association & assoc : node->associations ) {
     2131                indexerScopedAccept( assoc.type, *this );
     2132                maybeAccept_impl( assoc.expr, *this );
     2133        }
     2134
     2135        VISIT_END( node );
     2136}
     2137
     2138template< typename pass_type >
     2139Expression * PassVisitor< pass_type >::mutate( GenericExpr * node ) {
     2140        MUTATE_START( node );
     2141
     2142        indexerScopedMutate( node->env, *this );
     2143        indexerScopedMutate( node->result, *this );
     2144        maybeMutate_impl( node->control, *this );
     2145        for ( GenericExpr::Association & assoc : node->associations ) {
     2146                indexerScopedMutate( assoc.type, *this );
     2147                maybeMutate_impl( assoc.expr, *this );
     2148        }
     2149
     2150        MUTATE_END( Expression, node );
     2151}
     2152
     2153//--------------------------------------------------------------------------
     2154// VoidType
    18552155template< typename pass_type >
    18562156void PassVisitor< pass_type >::visit( VoidType * node ) {
    1857         VISIT_BODY( node );
    1858 }
    1859 
     2157        VISIT_START( node );
     2158
     2159        maybeAccept_impl( node->forall, *this );
     2160
     2161        VISIT_END( node );
     2162}
     2163
     2164template< typename pass_type >
     2165Type * PassVisitor< pass_type >::mutate( VoidType * node ) {
     2166        MUTATE_START( node );
     2167
     2168        maybeMutate_impl( node->forall, *this );
     2169
     2170        MUTATE_END( Type, node );
     2171}
     2172
     2173//--------------------------------------------------------------------------
     2174// BasicType
    18602175template< typename pass_type >
    18612176void PassVisitor< pass_type >::visit( BasicType * node ) {
    1862         VISIT_BODY( node );
    1863 }
    1864 
     2177        VISIT_START( node );
     2178
     2179        maybeAccept_impl( node->forall, *this );
     2180
     2181        VISIT_END( node );
     2182}
     2183
     2184template< typename pass_type >
     2185Type * PassVisitor< pass_type >::mutate( BasicType * node ) {
     2186        MUTATE_START( node );
     2187
     2188        maybeMutate_impl( node->forall, *this );
     2189
     2190        MUTATE_END( Type, node );
     2191}
     2192
     2193//--------------------------------------------------------------------------
     2194// PointerType
    18652195template< typename pass_type >
    18662196void PassVisitor< pass_type >::visit( PointerType * node ) {
    1867         VISIT_BODY( node );
    1868 }
    1869 
     2197        VISIT_START( node );
     2198
     2199        maybeAccept_impl( node->forall, *this );
     2200        // xxx - should PointerType visit/mutate dimension?
     2201        maybeAccept_impl( node->base, *this );
     2202
     2203        VISIT_END( node );
     2204}
     2205
     2206template< typename pass_type >
     2207Type * PassVisitor< pass_type >::mutate( PointerType * node ) {
     2208        MUTATE_START( node );
     2209
     2210        maybeMutate_impl( node->forall, *this );
     2211        // xxx - should PointerType visit/mutate dimension?
     2212        maybeMutate_impl( node->base, *this );
     2213
     2214        MUTATE_END( Type, node );
     2215}
     2216
     2217//--------------------------------------------------------------------------
     2218// ArrayType
    18702219template< typename pass_type >
    18712220void PassVisitor< pass_type >::visit( ArrayType * node ) {
    1872         VISIT_BODY( node );
    1873 }
    1874 
     2221        VISIT_START( node );
     2222
     2223        maybeAccept_impl( node->forall, *this );
     2224        maybeAccept_impl( node->dimension, *this );
     2225        maybeAccept_impl( node->base, *this );
     2226
     2227        VISIT_END( node );
     2228}
     2229
     2230template< typename pass_type >
     2231Type * PassVisitor< pass_type >::mutate( ArrayType * node ) {
     2232        MUTATE_START( node );
     2233
     2234        maybeMutate_impl( node->forall, *this );
     2235        maybeMutate_impl( node->dimension, *this );
     2236        maybeMutate_impl( node->base, *this );
     2237
     2238        MUTATE_END( Type, node );
     2239}
     2240
     2241//--------------------------------------------------------------------------
     2242// ReferenceType
    18752243template< typename pass_type >
    18762244void PassVisitor< pass_type >::visit( ReferenceType * node ) {
    1877         VISIT_BODY( node );
    1878 }
    1879 
     2245        VISIT_START( node );
     2246
     2247        maybeAccept_impl( node->forall, *this );
     2248        maybeAccept_impl( node->base, *this );
     2249
     2250        VISIT_END( node );
     2251}
     2252
     2253template< typename pass_type >
     2254Type * PassVisitor< pass_type >::mutate( ReferenceType * node ) {
     2255        MUTATE_START( node );
     2256
     2257        maybeMutate_impl( node->forall, *this );
     2258        maybeMutate_impl( node->base, *this );
     2259
     2260        MUTATE_END( Type, node );
     2261}
     2262
     2263//--------------------------------------------------------------------------
     2264// QualifiedType
     2265template< typename pass_type >
     2266void PassVisitor< pass_type >::visit( QualifiedType * node ) {
     2267        VISIT_START( node );
     2268
     2269        maybeAccept_impl( node->forall, *this );
     2270        maybeAccept_impl( node->parent, *this );
     2271        maybeAccept_impl( node->child, *this );
     2272
     2273        VISIT_END( node );
     2274}
     2275
     2276template< typename pass_type >
     2277Type * PassVisitor< pass_type >::mutate( QualifiedType * node ) {
     2278        MUTATE_START( node );
     2279
     2280        maybeMutate_impl( node->forall, *this );
     2281        maybeMutate_impl( node->parent, *this );
     2282        maybeMutate_impl( node->child, *this );
     2283
     2284        MUTATE_END( Type, node );
     2285}
     2286
     2287//--------------------------------------------------------------------------
     2288// FunctionType
    18802289template< typename pass_type >
    18812290void PassVisitor< pass_type >::visit( FunctionType * node ) {
    1882         VISIT_BODY( node );
     2291        VISIT_START( node );
     2292
     2293        maybeAccept_impl( node->forall, *this );
     2294        maybeAccept_impl( node->returnVals, *this );
     2295        maybeAccept_impl( node->parameters, *this );
     2296
     2297        VISIT_END( node );
     2298}
     2299
     2300template< typename pass_type >
     2301Type * PassVisitor< pass_type >::mutate( FunctionType * node ) {
     2302        MUTATE_START( node );
     2303
     2304        maybeMutate_impl( node->forall, *this );
     2305        maybeMutate_impl( node->returnVals, *this );
     2306        maybeMutate_impl( node->parameters, *this );
     2307
     2308        MUTATE_END( Type, node );
    18832309}
    18842310
     
    19512377template< typename pass_type >
    19522378void PassVisitor< pass_type >::visit( EnumInstType * node ) {
    1953         VISIT_BODY( node );
     2379        VISIT_START( node );
     2380
     2381        maybeAccept_impl( node->forall, *this );
     2382        maybeAccept_impl( node->parameters, *this );
     2383
     2384        VISIT_END( node );
    19542385}
    19552386
    19562387template< typename pass_type >
    19572388Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) {
    1958         MUTATE_BODY( Type, node );
     2389        MUTATE_START( node );
     2390
     2391        maybeMutate_impl( node->forall, *this );
     2392        maybeMutate_impl( node->parameters, *this );
     2393
     2394        MUTATE_END( Type, node );
    19592395}
    19602396
     
    19852421template< typename pass_type >
    19862422void PassVisitor< pass_type >::visit( TypeInstType * node ) {
    1987         VISIT_BODY( node );
    1988 }
    1989 
     2423        VISIT_START( node );
     2424
     2425        maybeAccept_impl( node->forall    , *this );
     2426        maybeAccept_impl( node->parameters, *this );
     2427
     2428        VISIT_END( node );
     2429}
     2430
     2431template< typename pass_type >
     2432Type * PassVisitor< pass_type >::mutate( TypeInstType * node ) {
     2433        MUTATE_START( node );
     2434
     2435        maybeMutate_impl( node->forall    , *this );
     2436        maybeMutate_impl( node->parameters, *this );
     2437
     2438        MUTATE_END( Type, node );
     2439}
     2440
     2441//--------------------------------------------------------------------------
     2442// TupleType
    19902443template< typename pass_type >
    19912444void PassVisitor< pass_type >::visit( TupleType * node ) {
    1992         VISIT_BODY( node );
    1993 }
    1994 
     2445        VISIT_START( node );
     2446
     2447        maybeAccept_impl( node->forall, *this );
     2448        maybeAccept_impl( node->types, *this );
     2449        maybeAccept_impl( node->members, *this );
     2450
     2451        VISIT_END( node );
     2452}
     2453
     2454template< typename pass_type >
     2455Type * PassVisitor< pass_type >::mutate( TupleType * node ) {
     2456        MUTATE_START( node );
     2457
     2458        maybeMutate_impl( node->forall, *this );
     2459        maybeMutate_impl( node->types, *this );
     2460        maybeMutate_impl( node->members, *this );
     2461
     2462        MUTATE_END( Type, node );
     2463}
     2464
     2465//--------------------------------------------------------------------------
     2466// TypeofType
    19952467template< typename pass_type >
    19962468void PassVisitor< pass_type >::visit( TypeofType * node ) {
    1997         VISIT_BODY( node );
    1998 }
    1999 
     2469        VISIT_START( node );
     2470
     2471        assert( node->expr );
     2472        maybeAccept_impl( node->expr, *this );
     2473
     2474        VISIT_END( node );
     2475}
     2476
     2477template< typename pass_type >
     2478Type * PassVisitor< pass_type >::mutate( TypeofType * node ) {
     2479        MUTATE_START( node );
     2480
     2481        assert( node->expr );
     2482        maybeMutate_impl( node->expr, *this );
     2483
     2484        MUTATE_END( Type, node );
     2485}
     2486
     2487//--------------------------------------------------------------------------
     2488// AttrType
    20002489template< typename pass_type >
    20012490void PassVisitor< pass_type >::visit( AttrType * node ) {
    2002         VISIT_BODY( node );
    2003 }
    2004 
     2491        VISIT_START( node );
     2492
     2493        if ( node->isType ) {
     2494                assert( node->type );
     2495                maybeAccept_impl( node->type, *this );
     2496        } else {
     2497                assert( node->expr );
     2498                maybeAccept_impl( node->expr, *this );
     2499        } // if
     2500
     2501        VISIT_END( node );
     2502}
     2503
     2504template< typename pass_type >
     2505Type * PassVisitor< pass_type >::mutate( AttrType * node ) {
     2506        MUTATE_START( node );
     2507
     2508        if ( node->isType ) {
     2509                assert( node->type );
     2510                maybeMutate_impl( node->type, *this );
     2511        } else {
     2512                assert( node->expr );
     2513                maybeMutate_impl( node->expr, *this );
     2514        } // if
     2515
     2516        MUTATE_END( Type, node );
     2517}
     2518
     2519//--------------------------------------------------------------------------
     2520// VarArgsType
    20052521template< typename pass_type >
    20062522void PassVisitor< pass_type >::visit( VarArgsType * node ) {
    2007         VISIT_BODY( node );
    2008 }
    2009 
     2523        VISIT_START( node );
     2524
     2525        maybeAccept_impl( node->forall, *this );
     2526
     2527        VISIT_END( node );
     2528}
     2529
     2530template< typename pass_type >
     2531Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) {
     2532        MUTATE_START( node );
     2533
     2534        maybeMutate_impl( node->forall, *this );
     2535
     2536        MUTATE_END( Type, node );
     2537}
     2538
     2539//--------------------------------------------------------------------------
     2540// ZeroType
    20102541template< typename pass_type >
    20112542void PassVisitor< pass_type >::visit( ZeroType * node ) {
    2012         VISIT_BODY( node );
    2013 }
    2014 
     2543        VISIT_START( node );
     2544
     2545        maybeAccept_impl( node->forall, *this );
     2546
     2547        VISIT_END( node );
     2548}
     2549
     2550template< typename pass_type >
     2551Type * PassVisitor< pass_type >::mutate( ZeroType * node ) {
     2552        MUTATE_START( node );
     2553
     2554        maybeMutate_impl( node->forall, *this );
     2555
     2556        MUTATE_END( Type, node );
     2557}
     2558
     2559//--------------------------------------------------------------------------
     2560// OneType
    20152561template< typename pass_type >
    20162562void PassVisitor< pass_type >::visit( OneType * node ) {
    2017         VISIT_BODY( node );
    2018 }
    2019 
     2563        VISIT_START( node );
     2564
     2565        maybeAccept_impl( node->forall, *this );
     2566
     2567        VISIT_END( node );
     2568}
     2569
     2570template< typename pass_type >
     2571Type * PassVisitor< pass_type >::mutate( OneType * node ) {
     2572        MUTATE_START( node );
     2573
     2574        maybeMutate_impl( node->forall, *this );
     2575
     2576        MUTATE_END( Type, node );
     2577}
     2578
     2579//--------------------------------------------------------------------------
     2580// GlobalScopeType
     2581template< typename pass_type >
     2582void PassVisitor< pass_type >::visit( GlobalScopeType * node ) {
     2583        VISIT_START( node );
     2584
     2585        maybeAccept_impl( node->forall, *this );
     2586
     2587        VISIT_END( node );
     2588}
     2589
     2590template< typename pass_type >
     2591Type * PassVisitor< pass_type >::mutate( GlobalScopeType * node ) {
     2592        MUTATE_START( node );
     2593
     2594        maybeMutate_impl( node->forall, *this );
     2595
     2596        MUTATE_END( Type, node );
     2597}
     2598
     2599//--------------------------------------------------------------------------
     2600// Designation
    20202601template< typename pass_type >
    20212602void PassVisitor< pass_type >::visit( Designation * node ) {
    20222603        VISIT_START( node );
    20232604
    2024         maybeAccept_impl( node->get_designators(), *this );
     2605        maybeAccept_impl( node->designators, *this );
    20252606
    20262607        VISIT_END( node );
     
    20312612        MUTATE_START( node );
    20322613
    2033         maybeMutate_impl( node->get_designators(), *this );
     2614        maybeMutate_impl( node->designators, *this );
    20342615
    20352616        MUTATE_END( Designation, node );
     
    20422623        VISIT_START( node );
    20432624
    2044         visitExpression( node->get_value() );
     2625        visitExpression( node->value );
    20452626
    20462627        VISIT_END( node );
     
    20512632        MUTATE_START( node );
    20522633
    2053         node->set_value( mutateExpression( node->get_value() ) );
     2634        node->value = mutateExpression( node->value );
    20542635
    20552636        MUTATE_END( Initializer, node );
    20562637}
    20572638
     2639//--------------------------------------------------------------------------
     2640// ListInit
    20582641template< typename pass_type >
    20592642void PassVisitor< pass_type >::visit( ListInit * node ) {
    2060         VISIT_BODY( node );
    2061 }
    2062 
     2643        VISIT_START( node );
     2644
     2645        maybeAccept_impl( node->designations, *this );
     2646        maybeAccept_impl( node->initializers, *this );
     2647
     2648        VISIT_END( node );
     2649}
     2650
     2651template< typename pass_type >
     2652Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) {
     2653        MUTATE_START( node );
     2654
     2655        maybeMutate_impl( node->designations, *this );
     2656        maybeMutate_impl( node->initializers, *this );
     2657
     2658        MUTATE_END( Initializer, node );
     2659}
     2660
     2661//--------------------------------------------------------------------------
     2662// ConstructorInit
    20632663template< typename pass_type >
    20642664void PassVisitor< pass_type >::visit( ConstructorInit * node ) {
    2065         VISIT_BODY( node );
    2066 }
    2067 
     2665        VISIT_START( node );
     2666
     2667        maybeAccept_impl( node->ctor, *this );
     2668        maybeAccept_impl( node->dtor, *this );
     2669        maybeAccept_impl( node->init, *this );
     2670
     2671        VISIT_END( node );
     2672}
     2673
     2674template< typename pass_type >
     2675Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) {
     2676        MUTATE_START( node );
     2677
     2678        maybeMutate_impl( node->ctor, *this );
     2679        maybeMutate_impl( node->dtor, *this );
     2680        maybeMutate_impl( node->init, *this );
     2681
     2682        MUTATE_END( Initializer, node );
     2683}
     2684
     2685//--------------------------------------------------------------------------
     2686// Subrange
    20682687template< typename pass_type >
    20692688void PassVisitor< pass_type >::visit( Subrange * node ) {
    2070         VISIT_BODY( node );
    2071 }
    2072 
     2689        VISIT_START( node );
     2690
     2691        VISIT_END( node );
     2692}
     2693
     2694template< typename pass_type >
     2695Subrange * PassVisitor< pass_type >::mutate( Subrange * node  )  {
     2696        MUTATE_START( node );
     2697
     2698        MUTATE_END( Subrange, node );
     2699}
     2700
     2701//--------------------------------------------------------------------------
     2702// Attribute
    20732703template< typename pass_type >
    20742704void PassVisitor< pass_type >::visit( Constant * node ) {
    2075         VISIT_BODY( node );
    2076 }
    2077 
     2705        VISIT_START( node );
     2706
     2707        VISIT_END( node );
     2708}
     2709
     2710template< typename pass_type >
     2711Constant * PassVisitor< pass_type >::mutate( Constant * node  )  {
     2712        MUTATE_START( node );
     2713
     2714        MUTATE_END( Constant, node );
     2715}
     2716
     2717//--------------------------------------------------------------------------
     2718// Attribute
    20782719template< typename pass_type >
    20792720void PassVisitor< pass_type >::visit( Attribute * node ) {
    2080         VISIT_BODY( node );
    2081 }
    2082 
    2083 //---------------------------------------------------------------------------------------------------------------
    2084 template< typename pass_type >
    2085 Type * PassVisitor< pass_type >::mutate( VoidType * node ) {
    2086         MUTATE_BODY( Type, node );
    2087 }
    2088 
    2089 template< typename pass_type >
    2090 Type * PassVisitor< pass_type >::mutate( BasicType * node ) {
    2091         MUTATE_BODY( Type, node );
    2092 }
    2093 
    2094 template< typename pass_type >
    2095 Type * PassVisitor< pass_type >::mutate( PointerType * node ) {
    2096         MUTATE_BODY( Type, node );
    2097 }
    2098 
    2099 template< typename pass_type >
    2100 Type * PassVisitor< pass_type >::mutate( ArrayType * node ) {
    2101         MUTATE_BODY( Type, node );
    2102 }
    2103 
    2104 template< typename pass_type >
    2105 Type * PassVisitor< pass_type >::mutate( ReferenceType * node ) {
    2106         MUTATE_BODY( Type, node );
    2107 }
    2108 
    2109 template< typename pass_type >
    2110 Type * PassVisitor< pass_type >::mutate( FunctionType * node ) {
    2111         MUTATE_BODY( Type, node );
    2112 }
    2113 
    2114 template< typename pass_type >
    2115 Type * PassVisitor< pass_type >::mutate( TypeInstType * node ) {
    2116         MUTATE_BODY( Type, node );
    2117 }
    2118 
    2119 template< typename pass_type >
    2120 Type * PassVisitor< pass_type >::mutate( TupleType * node ) {
    2121         MUTATE_BODY( Type, node );
    2122 }
    2123 
    2124 template< typename pass_type >
    2125 Type * PassVisitor< pass_type >::mutate( TypeofType * node ) {
    2126         MUTATE_BODY( Type, node );
    2127 }
    2128 
    2129 template< typename pass_type >
    2130 Type * PassVisitor< pass_type >::mutate( AttrType * node ) {
    2131         MUTATE_BODY( Type, node );
    2132 }
    2133 
    2134 template< typename pass_type >
    2135 Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) {
    2136         MUTATE_BODY( Type, node );
    2137 }
    2138 
    2139 template< typename pass_type >
    2140 Type * PassVisitor< pass_type >::mutate( ZeroType * node ) {
    2141         MUTATE_BODY( Type, node );
    2142 }
    2143 
    2144 template< typename pass_type >
    2145 Type * PassVisitor< pass_type >::mutate( OneType * node ) {
    2146         MUTATE_BODY( Type, node );
    2147 }
    2148 
    2149 template< typename pass_type >
    2150 Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) {
    2151         MUTATE_BODY( Initializer, node );
    2152 }
    2153 
    2154 template< typename pass_type >
    2155 Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) {
    2156         MUTATE_BODY( Initializer, node );
    2157 }
    2158 
    2159 template< typename pass_type >
    2160 Subrange * PassVisitor< pass_type >::mutate( Subrange * node  )  {
    2161         MUTATE_BODY( Subrange, node );
    2162 }
    2163 
    2164 template< typename pass_type >
    2165 Constant * PassVisitor< pass_type >::mutate( Constant * node  )  {
    2166         MUTATE_BODY( Constant, node );
     2721        VISIT_START( node );
     2722
     2723        maybeAccept_impl( node->parameters, *this );
     2724
     2725        VISIT_END( node );
    21672726}
    21682727
    21692728template< typename pass_type >
    21702729Attribute * PassVisitor< pass_type >::mutate( Attribute * node  )  {
    2171         MUTATE_BODY( Attribute, node );
    2172 }
    2173 
     2730        MUTATE_START( node );
     2731
     2732        maybeMutate_impl( node->parameters, *this );
     2733
     2734        MUTATE_END( Attribute, node );
     2735}
     2736
     2737//--------------------------------------------------------------------------
     2738// TypeSubstitution
    21742739template< typename pass_type >
    21752740TypeSubstitution * PassVisitor< pass_type >::mutate( TypeSubstitution * node ) {
  • src/Common/PassVisitor.proto.h

    rf9feab8 r90152a4  
    4747
    4848        operator bool() { return m_ref ? *m_ref : true; }
    49         bool operator=( bool val ) { return *m_ref = val; }
     49        bool operator=( bool val ) { assert(m_ref); return *m_ref = val; }
    5050
    5151private:
     
    5353        friend class ChildrenGuard;
    5454
    55         bool * set( bool & val ) {
     55        bool * set( bool * val ) {
    5656                bool * prev = m_ref;
    57                 m_ref = &val;
     57                m_ref = val;
    5858                return prev;
    5959        }
     
    6767        ChildrenGuard( bool_ref * ref )
    6868                : m_val ( true )
    69                 , m_prev( ref ? ref->set( m_val ) : nullptr )
     69                , m_prev( ref ? ref->set( &m_val ) : nullptr )
    7070                , m_ref ( ref )
    7171        {}
     
    7373        ~ChildrenGuard() {
    7474                if( m_ref ) {
    75                         m_ref->set( *m_prev );
     75                        m_ref->set( m_prev );
    7676                }
    7777        }
     
    193193
    194194
    195 #define INDEXER_FUNC( func, type )                                                                                             \
     195#define INDEXER_FUNC1( func, type )                                                                                             \
    196196template<typename pass_type>                                                                                                   \
    197197static inline auto indexer_impl_##func ( pass_type & pass, int, type arg ) -> decltype( pass.indexer.func( arg ), void() ) {   \
     
    202202static inline void indexer_impl_##func ( pass_type &, long, type ) { }                                                          \
    203203
    204 INDEXER_FUNC( addId     , DeclarationWithType * );
    205 INDEXER_FUNC( addType   , NamedTypeDecl *       );
    206 INDEXER_FUNC( addStruct , StructDecl *          );
    207 INDEXER_FUNC( addEnum   , EnumDecl *            );
    208 INDEXER_FUNC( addUnion  , UnionDecl *           );
    209 INDEXER_FUNC( addTrait  , TraitDecl *           );
    210 INDEXER_FUNC( addWith   , WithStmt *            );
     204#define INDEXER_FUNC2( func, type1, type2 )                                                                                             \
     205template<typename pass_type>                                                                                                   \
     206static inline auto indexer_impl_##func ( pass_type & pass, int, type1 arg1, type2 arg2 ) -> decltype( pass.indexer.func( arg1, arg2 ), void() ) {   \
     207        pass.indexer.func( arg1, arg2 );                                                                                                \
     208}                                                                                                                              \
     209                                                                                                                               \
     210template<typename pass_type>                                                                                                   \
     211static inline void indexer_impl_##func ( pass_type &, long, type1, type2 ) { }
     212
     213
     214INDEXER_FUNC1( addId     , DeclarationWithType *       );
     215INDEXER_FUNC1( addType   , NamedTypeDecl *             );
     216INDEXER_FUNC1( addStruct , StructDecl *                );
     217INDEXER_FUNC1( addEnum   , EnumDecl *                  );
     218INDEXER_FUNC1( addUnion  , UnionDecl *                 );
     219INDEXER_FUNC1( addTrait  , TraitDecl *                 );
     220INDEXER_FUNC2( addWith   , std::list< Expression * > &, BaseSyntaxNode * );
    211221
    212222
  • src/Common/ScopedMap.h

    rf9feab8 r90152a4  
    1010// Created On       : Wed Dec 2 11:37:00 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 21 22:18:24 2017
    13 // Update Count     : 2
     12// Last Modified On : Mon May 21 15:22:40 2018
     13// Update Count     : 3
    1414//
    1515
     
    2222#include <vector>
    2323
     24/// Default (empty) ScopedMap note type
     25struct EmptyNote {};
     26
    2427/// A map where the items are placed into nested scopes;
    25 /// inserted items are placed into the innermost scope, lookup looks from the innermost scope outward
    26 template<typename Key, typename Value>
     28/// inserted items are placed into the innermost scope, lookup looks from the innermost scope outward.
     29/// Scopes may be annotated with a value; the annotation defaults to empty
     30template<typename Key, typename Value, typename Note = EmptyNote>
    2731class ScopedMap {
    28         typedef std::map< Key, Value > Scope;
     32        typedef std::map< Key, Value > MapType;
     33        struct Scope {
     34                MapType map;
     35                Note note;
     36
     37                template<typename N>
     38                Scope(N&& n) : map(), note(std::forward<N>(n)) {}
     39               
     40                Scope() = default;
     41                Scope(const Scope&) = default;
     42                Scope(Scope&&) = default;
     43                Scope& operator= (const Scope&) = default;
     44                Scope& operator= (Scope&&) = default;
     45        };
    2946        typedef std::vector< Scope > ScopeList;
    3047
    3148        ScopeList scopes; ///< scoped list of maps
    3249public:
    33         typedef typename Scope::key_type key_type;
    34         typedef typename Scope::mapped_type mapped_type;
    35         typedef typename Scope::value_type value_type;
     50        typedef typename MapType::key_type key_type;
     51        typedef typename MapType::mapped_type mapped_type;
     52        typedef typename MapType::value_type value_type;
    3653        typedef typename ScopeList::size_type size_type;
    3754        typedef typename ScopeList::difference_type difference_type;
    38         typedef typename Scope::reference reference;
    39         typedef typename Scope::const_reference const_reference;
    40         typedef typename Scope::pointer pointer;
    41         typedef typename Scope::const_pointer const_pointer;
     55        typedef typename MapType::reference reference;
     56        typedef typename MapType::const_reference const_reference;
     57        typedef typename MapType::pointer pointer;
     58        typedef typename MapType::const_pointer const_pointer;
    4259
    4360        class iterator : public std::iterator< std::bidirectional_iterator_tag,
     
    4562        friend class ScopedMap;
    4663        friend class const_iterator;
    47                 typedef typename std::map< Key, Value >::iterator wrapped_iterator;
    48                 typedef typename std::vector< std::map< Key, Value > > scope_list;
     64                typedef typename ScopedMap::MapType::iterator wrapped_iterator;
     65                typedef typename ScopedMap::ScopeList scope_list;
    4966                typedef typename scope_list::size_type size_type;
    5067
    5168                /// Checks if this iterator points to a valid item
    5269                bool is_valid() const {
    53                         return it != (*scopes)[level].end();
     70                        return it != (*scopes)[level].map.end();
    5471                }
    5572
     
    7996
    8097                iterator& operator++ () {
    81                         if ( it == (*scopes)[level].end() ) {
     98                        if ( it == (*scopes)[level].map.end() ) {
    8299                                if ( level == 0 ) return *this;
    83100                                --level;
    84                                 it = (*scopes)[level].begin();
     101                                it = (*scopes)[level].map.begin();
    85102                        } else {
    86103                                ++it;
     
    92109                iterator& operator-- () {
    93110                        // may fail if this is the begin iterator; allowed by STL spec
    94                         if ( it == (*scopes)[level].begin() ) {
     111                        if ( it == (*scopes)[level].map.begin() ) {
    95112                                ++level;
    96                                 it = (*scopes)[level].end();
     113                                it = (*scopes)[level].map.end();
    97114                        }
    98115                        --it;
     
    107124
    108125                size_type get_level() const { return level; }
     126
     127                Note& get_note() { return (*scopes)[level].note; }
     128                const Note& get_note() const { return (*scopes)[level].note; }
    109129
    110130        private:
     
    117137                                                     value_type > {
    118138        friend class ScopedMap;
    119                 typedef typename std::map< Key, Value >::iterator wrapped_iterator;
    120                 typedef typename std::map< Key, Value >::const_iterator wrapped_const_iterator;
    121                 typedef typename std::vector< std::map< Key, Value > > scope_list;
     139                typedef typename ScopedMap::MapType::iterator wrapped_iterator;
     140                typedef typename ScopedMap::MapType::const_iterator wrapped_const_iterator;
     141                typedef typename ScopedMap::ScopeList scope_list;
    122142                typedef typename scope_list::size_type size_type;
    123143
    124144                /// Checks if this iterator points to a valid item
    125145                bool is_valid() const {
    126                         return it != (*scopes)[level].end();
     146                        return it != (*scopes)[level].map.end();
    127147                }
    128148
     
    157177
    158178                const_iterator& operator++ () {
    159                         if ( it == (*scopes)[level].end() ) {
     179                        if ( it == (*scopes)[level].map.end() ) {
    160180                                if ( level == 0 ) return *this;
    161181                                --level;
    162                                 it = (*scopes)[level].begin();
     182                                it = (*scopes)[level].map.begin();
    163183                        } else {
    164184                                ++it;
     
    170190                const_iterator& operator-- () {
    171191                        // may fail if this is the begin iterator; allowed by STL spec
    172                         if ( it == (*scopes)[level].begin() ) {
     192                        if ( it == (*scopes)[level].map.begin() ) {
    173193                                ++level;
    174                                 it = (*scopes)[level].end();
     194                                it = (*scopes)[level].map.end();
    175195                        }
    176196                        --it;
     
    185205
    186206                size_type get_level() const { return level; }
     207
     208                const Note& get_note() const { return (*scopes)[level].note; }
    187209
    188210        private:
     
    197219        }
    198220
     221        // Starts a new scope with the given note
     222        template<typename N>
     223        void beginScope( N&& n ) {
     224                scopes.emplace_back( std::forward<N>(n) );
     225        }
     226
    199227        /// Ends a scope; invalidates any iterators pointing to elements of that scope
    200228        void endScope() {
     
    204232
    205233        /// Default constructor initializes with one scope
    206         ScopedMap() { beginScope(); }
    207 
    208         iterator begin() { return iterator(scopes, scopes.back().begin(), currentScope()).next_valid(); }
    209         const_iterator begin() const { return const_iterator(scopes, scopes.back().begin(), currentScope()).next_valid(); }
    210         const_iterator cbegin() const { return const_iterator(scopes, scopes.back().begin(), currentScope()).next_valid(); }
    211         iterator end() { return iterator(scopes, scopes[0].end(), 0); }
    212         const_iterator end() const { return const_iterator(scopes, scopes[0].end(), 0); }
    213         const_iterator cend() const { return const_iterator(scopes, scopes[0].end(), 0); }
     234        ScopedMap() : scopes() { beginScope(); }
     235
     236        /// Constructs with a given note on the outermost scope
     237        template<typename N>
     238        ScopedMap( N&& n ) : scopes() { beginScope(std::forward<N>(n)); }
     239
     240        iterator begin() { return iterator(scopes, scopes.back().map.begin(), currentScope()).next_valid(); }
     241        const_iterator begin() const { return const_iterator(scopes, scopes.back().map.begin(), currentScope()).next_valid(); }
     242        const_iterator cbegin() const { return const_iterator(scopes, scopes.back().map.begin(), currentScope()).next_valid(); }
     243        iterator end() { return iterator(scopes, scopes[0].map.end(), 0); }
     244        const_iterator end() const { return const_iterator(scopes, scopes[0].map.end(), 0); }
     245        const_iterator cend() const { return const_iterator(scopes, scopes[0].map.end(), 0); }
    214246
    215247        /// Gets the index of the current scope (counted from 1)
    216248        size_type currentScope() const { return scopes.size() - 1; }
     249
     250        /// Gets the note at the given scope
     251        Note& getNote( size_type i ) { return scopes[i].note; }
     252        const Note& getNote( size_type i ) const { return scopes[i].note; }
    217253
    218254        /// Finds the given key in the outermost scope it occurs; returns end() for none such
    219255        iterator find( const Key &key ) {
    220256                for ( size_type i = scopes.size() - 1; ; --i ) {
    221                         typename Scope::iterator val = scopes[i].find( key );
    222                         if ( val != scopes[i].end() ) return iterator( scopes, val, i );
     257                        typename MapType::iterator val = scopes[i].map.find( key );
     258                        if ( val != scopes[i].map.end() ) return iterator( scopes, val, i );
    223259                        if ( i == 0 ) break;
    224260                }
     
    226262        }
    227263        const_iterator find( const Key &key ) const {
    228                         return const_iterator( const_cast< ScopedMap< Key, Value >* >(this)->find( key ) );
     264                        return const_iterator( const_cast< ScopedMap< Key, Value, Note >* >(this)->find( key ) );
    229265        }
    230266
    231267        /// Finds the given key in the provided scope; returns end() for none such
    232268        iterator findAt( size_type scope, const Key& key ) {
    233                 typename Scope::iterator val = scopes[scope].find( key );
    234                 if ( val != scopes[scope].end() ) return iterator( scopes, val, scope );
     269                typename MapType::iterator val = scopes[scope].map.find( key );
     270                if ( val != scopes[scope].map.end() ) return iterator( scopes, val, scope );
    235271                return end();
    236272        }
    237273        const_iterator findAt( size_type scope, const Key& key ) const {
    238                 return const_iterator( const_cast< ScopedMap< Key, Value >* >(this)->findAt( scope, key ) );
     274                return const_iterator( const_cast< ScopedMap< Key, Value, Note >* >(this)->findAt( scope, key ) );
    239275        }
    240276
     
    243279                if ( it.level == 0 ) return end();
    244280                for ( size_type i = it.level - 1; ; --i ) {
    245                         typename Scope::iterator val = scopes[i].find( key );
    246                         if ( val != scopes[i].end() ) return iterator( scopes, val, i );
     281                        typename MapType::iterator val = scopes[i].map.find( key );
     282                        if ( val != scopes[i].map.end() ) return iterator( scopes, val, i );
    247283                        if ( i == 0 ) break;
    248284                }
     
    250286        }
    251287        const_iterator findNext( const_iterator &it, const Key &key ) const {
    252                         return const_iterator( const_cast< ScopedMap< Key, Value >* >(this)->findNext( it, key ) );
     288                        return const_iterator( const_cast< ScopedMap< Key, Value, Note >* >(this)->findNext( it, key ) );
    253289        }
    254290
     
    256292        template< typename value_type_t >
    257293        std::pair< iterator, bool > insert( value_type_t&& value ) {
    258                 std::pair< typename Scope::iterator, bool > res = scopes.back().insert( std::forward<value_type_t>( value ) );
     294                std::pair< typename MapType::iterator, bool > res = scopes.back().map.insert( std::forward<value_type_t>( value ) );
    259295                return std::make_pair( iterator(scopes, std::move( res.first ), scopes.size()-1), std::move( res.second ) );
    260296        }
     
    262298        template< typename value_type_t >
    263299        std::pair< iterator, bool > insert( iterator at, value_type_t&& value ) {
    264                 Scope& scope = (*at.scopes) [ at.level ];
    265                 std::pair< typename Scope::iterator, bool > res = scope.insert( std::forward<value_type_t>( value ) );
     300                MapType& scope = (*at.scopes)[ at.level ].map;
     301                std::pair< typename MapType::iterator, bool > res = scope.insert( std::forward<value_type_t>( value ) );
    266302                return std::make_pair( iterator(scopes, std::move( res.first ), at.level), std::move( res.second ) );
    267303        }
     
    272308        template< typename value_type_t >
    273309        std::pair< iterator, bool > insertAt( size_type scope, value_type_t&& value ) {
    274                 std::pair< typename Scope::iterator, bool > res = scopes.at(scope).insert( std::forward<value_type_t>( value ) );
     310                std::pair< typename MapType::iterator, bool > res = scopes.at(scope).map.insert( std::forward<value_type_t>( value ) );
    275311                return std::make_pair( iterator(scopes, std::move( res.first ), scope), std::move( res.second ) );
     312        }
     313
     314        template< typename value_t >
     315        std::pair< iterator, bool > insertAt( size_type scope, const Key& key, value_t&& value ) {
     316                return insertAt( scope, std::make_pair( key, std::forward<value_t>( value ) ) );
    276317        }
    277318
     
    283324
    284325        iterator erase( iterator pos ) {
    285                 Scope& scope = (*pos.scopes) [ pos.level ];
     326                MapType& scope = (*pos.scopes)[ pos.level ].map;
    286327                const typename iterator::wrapped_iterator& new_it = scope.erase( pos.it );
    287328                iterator it( *pos.scopes, new_it, pos.level );
  • src/Common/SemanticError.cc

    rf9feab8 r90152a4  
    77// SemanticError.cc --
    88//
    9 // Author           : Richard C. Bilson
     9// Author           : Thierry Delisle
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Aug 29 18:17:35 2017
    13 // Update Count     : 3
     12// Last Modified On : Thu Jun  7 08:05:26 2018
     13// Update Count     : 10
    1414//
    1515
     16#include <cstdarg>
    1617#include <cstdio>                                                                               // for fileno, stderr
     18#include <cstring>
    1719#include <unistd.h>                                                                             // for isatty
    1820#include <iostream>                                                                             // for basic_ostream, operator<<, ostream
    1921#include <list>                                                                                 // for list, _List_iterator
    2022#include <string>                                                                               // for string, operator<<, operator+, to_string
     23#include <vector>
    2124
    2225#include "Common/utility.h"                                                             // for to_string, CodeLocation (ptr only)
    2326#include "SemanticError.h"
    2427
    25 SemanticError::SemanticError() {
     28//-----------------------------------------------------------------------------
     29// Severity Handling
     30std::vector<Severity> & get_severities() {
     31        static std::vector<Severity> severities;
     32        if(severities.empty()) {
     33                severities.reserve((size_t)Warning::NUMBER_OF_WARNINGS);
     34                for ( const auto w : WarningFormats ) {
     35                        severities.push_back( w.default_severity );
     36                } // for
     37        }
     38        return severities;
    2639}
    2740
    28 SemanticError::SemanticError( std::string error ) {
    29         append( error );
     41void SemanticWarning_SuppressAll() {
     42        for( auto & s : get_severities() ) {
     43                s = Severity::Suppress;
     44        }
    3045}
    3146
    32 void SemanticError::append( SemanticError &other ) {
     47void SemanticWarning_EnableAll() {
     48        for( auto & s : get_severities() ) {
     49                s = Severity::Warn;
     50        }
     51}
     52
     53void SemanticWarning_WarningAsError() {
     54        for( auto & s : get_severities() ) {
     55                if(s == Severity::Warn) s = Severity::Error;
     56        }
     57}
     58
     59void SemanticWarning_Set(const char * const name, Severity s) {
     60        size_t idx = 0;
     61        for ( const auto & w : WarningFormats ) {
     62                if ( std::strcmp( name, w.name ) == 0 ) {
     63                        get_severities()[idx] = s;
     64                        break;
     65                }
     66                idx++;
     67        }
     68}
     69
     70//-----------------------------------------------------------------------------
     71// Semantic Error
     72bool SemanticErrorThrow = false;
     73
     74SemanticErrorException::SemanticErrorException( CodeLocation location, std::string error ) {
     75        append( location, error );
     76}
     77
     78void SemanticErrorException::append( SemanticErrorException &other ) {
    3379        errors.splice( errors.end(), other.errors );
    3480}
    3581
    36 void SemanticError::append( const std::string & msg ) {
    37         errors.emplace_back( error_str() + msg );
     82void SemanticErrorException::append( CodeLocation location, const std::string & msg ) {
     83        errors.emplace_back( location, msg );
    3884}
    3985
    40 bool SemanticError::isEmpty() const {
     86bool SemanticErrorException::isEmpty() const {
    4187        return errors.empty();
    4288}
    4389
    44 void SemanticError::print( std::ostream &os ) {
     90void SemanticErrorException::print() {
    4591        using std::to_string;
    4692        for( auto err : errors ) {
    47                 os << err.location << err.description << std::endl;
     93                std::cerr << ErrorHelpers::bold() << err.location << ErrorHelpers::error_str() << ErrorHelpers::reset_font() << err.description << std::endl;
    4894        }
    4995}
    5096
    51 void SemanticError::set_location( const CodeLocation& location ) {
    52         errors.begin()->maybeSet( location );
     97void SemanticError( CodeLocation location, std::string error ) {
     98        SemanticErrorThrow = true;
     99        throw SemanticErrorException( location, error );
     100}
     101
     102namespace {
     103        // convert format string and arguments into a single string
     104        std::string fmtToString(const char * fmt, va_list ap) {
     105                int size = 128;
     106                while ( true ) {
     107                        char buf[size];
     108                        va_list args;
     109                        va_copy( args, ap );
     110                        int n = vsnprintf(&buf[0], size, fmt, args);
     111                        va_end( args );
     112                        if ( n < size && n >= 0 ) return buf;
     113                        size *= 2;
     114                }
     115                assert( false );
     116        }
     117}
     118
     119void SemanticWarningImpl( CodeLocation location, Warning warning, const char * const fmt, ... ) {
     120        Severity severity = get_severities()[(int)warning];
     121        switch(severity) {
     122        case Severity::Suppress :
     123                break;
     124        case Severity::Warn :
     125                {
     126                        va_list args;
     127                        va_start(args, fmt);
     128                        std::string msg = fmtToString( fmt, args );
     129                        va_end(args);
     130                        std::cerr << ErrorHelpers::bold() << location << ErrorHelpers::warning_str() << ErrorHelpers::reset_font() << msg << std::endl;
     131                }
     132                break;
     133        case Severity::Error :
     134                {
     135                        va_list args;
     136                        va_start(args, fmt);
     137                        std::string msg = fmtToString( fmt, args );
     138                        va_end(args);
     139                        SemanticError(location, msg);
     140                }
     141                break;
     142        case Severity::Critical :
     143                assertf(false, "Critical errors not implemented yet");
     144                break;
     145        }
     146}
     147
     148//-----------------------------------------------------------------------------
     149// Helpers
     150namespace ErrorHelpers {
     151        const std::string & error_str() {
     152                static std::string str = isatty( STDERR_FILENO ) ? "\e[31merror:\e[39m " : "error: ";
     153                return str;
     154        }
     155
     156        const std::string & warning_str() {
     157                static std::string str = isatty( STDERR_FILENO ) ? "\e[95mwarning:\e[39m " : "warning: ";
     158                return str;
     159        }
     160
     161        const std::string & bold_ttycode() {
     162                static std::string str = isatty( STDERR_FILENO ) ? "\e[1m" : "";
     163                return str;
     164        }
     165
     166        const std::string & reset_font_ttycode() {
     167                static std::string str = isatty( STDERR_FILENO ) ? "\e[0m" : "";
     168                return str;
     169        }
     170
     171        std::string make_bold( const std::string & str ) {
     172                return bold_ttycode() + str + reset_font_ttycode();
     173        }
     174
     175        std::ostream & operator<<(std::ostream & os, bold) {
     176                os << bold_ttycode();
     177                return os;
     178        }
     179
     180        std::ostream & operator<<(std::ostream & os, reset_font) {
     181                os << reset_font_ttycode();
     182                return os;
     183        }
    53184}
    54185
  • src/Common/SemanticError.h

    rf9feab8 r90152a4  
    77// SemanticError.h --
    88//
    9 // Author           : Richard C. Bilson
     9// Author           : Thierry Delisle
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Aug 29 22:03:36 2017
    13 // Update Count     : 17
     12// Last Modified On : Thu Jul 19 10:09:17 2018
     13// Update Count     : 31
    1414//
    1515
    1616#pragma once
    1717
    18 #include <exception>                                                                    // for exception
    19 #include <iostream>                                                                             // for ostream
    20 #include <list>                                                                                 // for list
    21 #include <string>                                                                               // for string
    22 #include <unistd.h>                                                                             // for isatty
     18#include "ErrorObjects.h"
     19#include <cstring>
    2320
    24 #include "CodeLocation.h"                                                               // for CodeLocation, toString
     21//-----------------------------------------------------------------------------
     22// Errors
    2523
    26 struct error {
    27         std::string description;
    28         CodeLocation location;
     24extern bool SemanticErrorThrow;
    2925
    30         error() = default;
    31         error( const std::string & str ) : description( str ) {}
     26__attribute__((noreturn)) void SemanticError( CodeLocation location, std::string error );
    3227
    33         void maybeSet( const CodeLocation & location ) {
    34                 if( this->location.isUnset() ) {
    35                         this->location = location;
    36                 }
    37         }
     28template< typename T >
     29__attribute__((noreturn)) static inline void SemanticError( const T * obj, const std::string & error ) {
     30        SemanticError( obj->location, toString( error, obj ) );
     31}
     32
     33template< typename T >
     34__attribute__((noreturn)) static inline void SemanticError( CodeLocation location, const T * obj, const std::string & error ) {
     35        SemanticError( location, toString( error, obj ) );
     36}
     37
     38//-----------------------------------------------------------------------------
     39// Warnings
     40
     41enum class Severity {
     42        Suppress,
     43        Warn,
     44        Error,
     45        Critical
    3846};
    3947
    40 class SemanticError : public std::exception {
    41   public:
    42         SemanticError();
    43         SemanticError( std::string error );
    44         template< typename T > SemanticError( const std::string & error, const T * obj );
    45         ~SemanticError() throw() {}
    46 
    47         static inline const std::string & error_str() {
    48                 static std::string str = isatty( STDERR_FILENO ) ? "\e[31merror:\e[39m " : "error: ";
    49                 return str;
    50         }
    51 
    52         void append( SemanticError & other );
    53         void append( const std::string & );
    54         bool isEmpty() const;
    55         void print( std::ostream & os );
    56 
    57         void set_location( const CodeLocation & location );
    58         // constructs an exception using the given message and the printed representation of the obj (T must have a print
    59         // method)
    60   private:
    61         std::list< error > errors;
     48struct WarningData {
     49        const char * const name;
     50        const char * const message;
     51        const Severity default_severity;
    6252};
    6353
    64 template< typename T >
    65 SemanticError::SemanticError( const std::string & error, const T * obj ) {
    66         append( toString( error, obj ) );
     54constexpr WarningData WarningFormats[] = {
     55        {"self-assign"            , "self assignment of expression: %s"            , Severity::Warn},
     56        {"reference-conversion"   , "rvalue to reference conversion of rvalue: %s" , Severity::Warn},
     57        {"qualifiers-zero_t-one_t", "questionable use of type qualifier %s with %s", Severity::Warn},
     58        {"aggregate-forward-decl" , "forward declaration of nested aggregate: %s"  , Severity::Warn},
     59        {"superfluous-decl"       , "declaration does not allocate storage: %s"    , Severity::Warn},
     60        {"gcc-attributes"         , "invalid attribute: %s"                        , Severity::Warn},
     61};
     62
     63enum class Warning {
     64        SelfAssignment,
     65        RvalueToReferenceConversion,
     66        BadQualifiersZeroOne,
     67        AggrForwardDecl,
     68        SuperfluousDecl,
     69        GccAttributes,
     70        NUMBER_OF_WARNINGS, // This MUST be the last warning
     71};
     72
     73static_assert(
     74        (sizeof(WarningFormats) / sizeof(WarningFormats[0])) == ((unsigned long)Warning::NUMBER_OF_WARNINGS),
     75        "Each warning format should have a corresponding warning enum value"
     76);
     77
     78#define SemanticWarning(loc, id, ...) SemanticWarningImpl(loc, id, WarningFormats[(int)id].message, __VA_ARGS__)
     79
     80void SemanticWarningImpl (CodeLocation loc, Warning warn, const char * const fmt, ...) __attribute__((format(printf, 3, 4)));
     81
     82void SemanticWarning_SuppressAll   ();
     83void SemanticWarning_EnableAll     ();
     84void SemanticWarning_WarningAsError();
     85void SemanticWarning_Set           (const char * const name, Severity s);
     86
     87// SKULLDUGGERY: cfa.cc is built before SemanticError.cc but needs this routine.
     88static inline bool SemanticWarning_Exist(const char * const name) {
     89        for ( const auto & w : WarningFormats ) {
     90                if ( std::strcmp( name, w.name ) == 0 ) return true;
     91        }
     92        return false;
     93}
     94
     95//-----------------------------------------------------------------------------
     96// Helpers
     97namespace ErrorHelpers {
     98        const std::string & error_str();
     99        const std::string & warning_str();
     100        const std::string & bold_ttycode();
     101        const std::string & reset_font_ttycode();
     102
     103        std::string make_bold( const std::string & str );
     104
     105        struct bold {};
     106        std::ostream & operator<<(std::ostream & os, bold);
     107
     108        struct reset_font {};
     109        std::ostream & operator<<(std::ostream & os, reset_font);
    67110}
    68111
  • src/Common/module.mk

    rf9feab8 r90152a4  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk -- 
     8## module.mk --
    99##
    1010## Author           : Richard C. Bilson
     
    1818       Common/UniqueName.cc \
    1919       Common/DebugMalloc.cc \
    20        Common/Assert.cc
     20       Common/Assert.cc \
     21       Common/Heap.cc \
     22       Common/Eval.cc
  • src/Common/utility.h

    rf9feab8 r90152a4  
    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 : Thr Aug 17 11:38:00 2017
    13 // Update Count     : 34
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sun May  6 22:24:16 2018
     13// Update Count     : 40
    1414//
    1515
     
    3131#include "Common/Indenter.h"
    3232
     33class Expression;
     34
    3335template< typename T >
    3436static inline T * maybeClone( const T *orig ) {
     
    98100}
    99101
     102template< typename SrcContainer, typename DestContainer, typename Predicate >
     103void cloneAll_if( const SrcContainer &src, DestContainer &dest, Predicate pred ) {
     104        std::back_insert_iterator< DestContainer > out( dest );
     105        for ( auto x : src ) {
     106                if ( pred(x) ) {
     107                        *out++ = x->clone();
     108                }
     109        } // while
     110}
     111
    100112template< typename Container >
    101113void assertAll( const Container &container ) {
     
    151163        return os.str();
    152164}
     165
     166#define toCString( ... ) toString( __VA_ARGS__ ).c_str()
    153167
    154168// replace element of list with all elements of another list
     
    424438}
    425439
    426 
     440// -----------------------------------------------------------------------------
     441// O(1) polymorphic integer ilog2, using clz, which returns the number of leading 0-bits, starting at the most
     442// significant bit (single instruction on x86)
     443
     444template<typename T>
     445inline
     446#if defined(__GNUC__) && __GNUC__ > 4
     447constexpr
     448#endif
     449T ilog2(const T & t) {
     450        if(std::is_integral<T>::value) {
     451                const constexpr int r = sizeof(t) * __CHAR_BIT__ - 1;
     452                if( sizeof(T) == sizeof(unsigned       int) ) return r - __builtin_clz  ( t );
     453                if( sizeof(T) == sizeof(unsigned      long) ) return r - __builtin_clzl ( t );
     454                if( sizeof(T) == sizeof(unsigned long long) ) return r - __builtin_clzll( t );
     455        }
     456        assert(false);
     457        return -1;
     458} // ilog2
     459
     460// -----------------------------------------------------------------------------
     461/// evaluates expr as a long long int. If second is false, expr could not be evaluated
     462std::pair<long long int, bool> eval(Expression * expr);
    427463
    428464// Local Variables: //
  • src/Concurrency/Keywords.cc

    rf9feab8 r90152a4  
    2525#include "InitTweak/InitTweak.h"   // for getPointerBase
    2626#include "Parser/LinkageSpec.h"    // for Cforall
    27 #include "SymTab/AddVisit.h"       // for acceptAndAdd
    2827#include "SynTree/Constant.h"      // for Constant
    2928#include "SynTree/Declaration.h"   // for StructDecl, FunctionDecl, ObjectDecl
     
    5453          public:
    5554
    56                 ConcurrentSueKeyword( std::string&& type_name, std::string&& field_name, std::string&& getter_name, std::string&& context_error, bool needs_main ) :
    57                   type_name( type_name ), field_name( field_name ), getter_name( getter_name ), context_error( context_error ), needs_main( needs_main ) {}
     55                ConcurrentSueKeyword( std::string&& type_name, std::string&& field_name, std::string&& getter_name, std::string&& context_error, bool needs_main, KeywordCastExpr::Target cast_target ) :
     56                  type_name( type_name ), field_name( field_name ), getter_name( getter_name ), context_error( context_error ), needs_main( needs_main ), cast_target( cast_target ) {}
    5857
    5958                virtual ~ConcurrentSueKeyword() {}
    6059
    61                 void postvisit( StructDecl * decl );
     60                Declaration * postmutate( StructDecl * decl );
    6261
    6362                void handle( StructDecl * );
     
    6766
    6867                virtual bool is_target( StructDecl * decl ) = 0;
     68
     69                Expression * postmutate( KeywordCastExpr * cast );
    6970
    7071          private:
     
    7475                const std::string context_error;
    7576                bool needs_main;
     77                KeywordCastExpr::Target cast_target;
    7678
    7779                StructDecl* type_decl = nullptr;
     
    9597                        "__thrd",
    9698                        "get_thread",
    97                         "thread keyword requires threads to be in scope, add #include <thread>",
    98                         true
     99                        "thread keyword requires threads to be in scope, add #include <thread.hfa>",
     100                        true,
     101                        KeywordCastExpr::Thread
    99102                )
    100103                {}
     
    106109                static void implement( std::list< Declaration * > & translationUnit ) {
    107110                        PassVisitor< ThreadKeyword > impl;
    108                         acceptAll( translationUnit, impl );
     111                        mutateAll( translationUnit, impl );
    109112                }
    110113        };
     
    126129                        "__cor",
    127130                        "get_coroutine",
    128                         "coroutine keyword requires coroutines to be in scope, add #include <coroutine>",
    129                         true
     131                        "coroutine keyword requires coroutines to be in scope, add #include <coroutine.hfa>",
     132                        true,
     133                        KeywordCastExpr::Coroutine
    130134                )
    131135                {}
     
    137141                static void implement( std::list< Declaration * > & translationUnit ) {
    138142                        PassVisitor< CoroutineKeyword > impl;
    139                         acceptAll( translationUnit, impl );
     143                        mutateAll( translationUnit, impl );
    140144                }
    141145        };
     
    157161                        "__mon",
    158162                        "get_monitor",
    159                         "monitor keyword requires monitors to be in scope, add #include <monitor>",
    160                         false
     163                        "monitor keyword requires monitors to be in scope, add #include <monitor.hfa>",
     164                        false,
     165                        KeywordCastExpr::Monitor
    161166                )
    162167                {}
     
    168173                static void implement( std::list< Declaration * > & translationUnit ) {
    169174                        PassVisitor< MonitorKeyword > impl;
    170                         acceptAll( translationUnit, impl );
     175                        mutateAll( translationUnit, impl );
    171176                }
    172177        };
     
    186191                void postvisit(   StructDecl * decl );
    187192
    188                 std::list<DeclarationWithType*> findMutexArgs( FunctionDecl* );
     193                std::list<DeclarationWithType*> findMutexArgs( FunctionDecl*, bool & first );
    189194                void validate( DeclarationWithType * );
    190195                void addDtorStatments( FunctionDecl* func, CompoundStmt *, const std::list<DeclarationWithType * > &);
     
    257262        // Generic keyword implementation
    258263        //=============================================================================================
    259         void ConcurrentSueKeyword::postvisit(StructDecl * decl) {
     264        void fixupGenerics(FunctionType * func, StructDecl * decl) {
     265                cloneAll(decl->parameters, func->forall);
     266                for ( TypeDecl * td : func->forall ) {
     267                        strict_dynamic_cast<StructInstType*>(
     268                                func->parameters.front()->get_type()->stripReferences()
     269                        )->parameters.push_back(
     270                                new TypeExpr( new TypeInstType( noQualifiers, td->name, td ) )
     271                        );
     272                }
     273        }
     274
     275        Declaration * ConcurrentSueKeyword::postmutate(StructDecl * decl) {
    260276                if( decl->name == type_name && decl->body ) {
    261277                        assert( !type_decl );
     
    265281                        handle( decl );
    266282                }
    267 
    268         }
     283                return decl;
     284        }
     285
     286        Expression * ConcurrentSueKeyword::postmutate( KeywordCastExpr * cast ) {
     287                if ( cast_target == cast->target ) {
     288                        // convert (thread &)t to (thread_desc &)*get_thread(t), etc.
     289                        if( !type_decl ) SemanticError( cast, context_error );
     290                        Expression * arg = cast->arg;
     291                        cast->arg = nullptr;
     292                        delete cast;
     293                        return new CastExpr(
     294                                UntypedExpr::createDeref(
     295                                        new UntypedExpr( new NameExpr( getter_name ), { arg } )
     296                                ),
     297                                new ReferenceType(
     298                                        noQualifiers,
     299                                        new StructInstType( noQualifiers, type_decl ) )
     300                                );
     301                }
     302                return cast;
     303        }
     304
    269305
    270306        void ConcurrentSueKeyword::handle( StructDecl * decl ) {
    271307                if( ! decl->body ) return;
    272308
    273                 if( !type_decl ) throw SemanticError( context_error, decl );
     309                if( !type_decl ) SemanticError( decl, context_error );
    274310
    275311                FunctionDecl * func = forwardDeclare( decl );
     
    301337                );
    302338
    303                 get_type->get_parameters().push_back( this_decl );
     339                get_type->get_parameters().push_back( this_decl->clone() );
    304340                get_type->get_returnVals().push_back(
    305341                        new ObjectDecl(
     
    318354                        )
    319355                );
     356                fixupGenerics(get_type, decl);
    320357
    321358                FunctionDecl * get_decl = new FunctionDecl(
     
    343380                                nullptr
    344381                        );
    345                 }
     382                        fixupGenerics(main_type, decl);
     383                }
     384
     385                delete this_decl;
    346386
    347387                declsToAddBefore.push_back( forward );
     
    377417                                        new MemberExpr(
    378418                                                field,
    379                                                 UntypedExpr::createDeref( new VariableExpr( func->get_functionType()->get_parameters().front() ) )
     419                                                new CastExpr(
     420                                                        new VariableExpr( func->get_functionType()->get_parameters().front() ),
     421                                                        func->get_functionType()->get_parameters().front()->get_type()->stripReferences()->clone()
     422                                                )
    380423                                        )
    381424                                )
     
    398441        void MutexKeyword::postvisit(FunctionDecl* decl) {
    399442
    400                 std::list<DeclarationWithType*> mutexArgs = findMutexArgs( decl );
    401                 if( mutexArgs.empty() ) return;
    402 
    403                 if( CodeGen::isConstructor(decl->name) ) throw SemanticError( "constructors cannot have mutex parameters", decl );
    404 
     443                bool first = false;
     444                std::list<DeclarationWithType*> mutexArgs = findMutexArgs( decl, first );
    405445                bool isDtor = CodeGen::isDestructor( decl->name );
    406446
    407                 if( isDtor && mutexArgs.size() != 1 ) throw SemanticError( "destructors can only have 1 mutex argument", decl );
    408 
     447                // Is this function relevant to monitors
     448                if( mutexArgs.empty() ) {
     449                        // If this is the destructor for a monitor it must be mutex
     450                        if(isDtor) {
     451                                Type* ty = decl->get_functionType()->get_parameters().front()->get_type();
     452
     453                                // If it's a copy, it's not a mutex
     454                                ReferenceType* rty = dynamic_cast< ReferenceType * >( ty );
     455                                if( ! rty ) return;
     456
     457                                // If we are not pointing directly to a type, it's not a mutex
     458                                Type* base = rty->get_base();
     459                                if( dynamic_cast< ReferenceType * >( base ) ) return;
     460                                if( dynamic_cast< PointerType * >( base ) ) return;
     461
     462                                // Check if its a struct
     463                                StructInstType * baseStruct = dynamic_cast< StructInstType * >( base );
     464                                if( !baseStruct ) return;
     465
     466                                // Check if its a monitor
     467                                if(baseStruct->baseStruct->is_monitor() || baseStruct->baseStruct->is_thread())
     468                                        SemanticError( decl, "destructors for structures declared as \"monitor\" must use mutex parameters\n" );
     469                        }
     470                        return;
     471                }
     472
     473                // Monitors can't be constructed with mutual exclusion
     474                if( CodeGen::isConstructor(decl->name) && !first ) SemanticError( decl, "constructors cannot have mutex parameters" );
     475
     476                // It makes no sense to have multiple mutex parameters for the destructor
     477                if( isDtor && mutexArgs.size() != 1 ) SemanticError( decl, "destructors can only have 1 mutex argument" );
     478
     479                // Make sure all the mutex arguments are monitors
    409480                for(auto arg : mutexArgs) {
    410481                        validate( arg );
    411482                }
    412483
     484                // Check if we need to instrument the body
    413485                CompoundStmt* body = decl->get_statements();
    414486                if( ! body ) return;
    415487
    416                 if( !monitor_decl ) throw SemanticError( "mutex keyword requires monitors to be in scope, add #include <monitor>", decl );
    417                 if( !guard_decl ) throw SemanticError( "mutex keyword requires monitors to be in scope, add #include <monitor>", decl );
    418                 if( !dtor_guard_decl ) throw SemanticError( "mutex keyword requires monitors to be in scope, add #include <monitor>", decl );
    419 
     488                // Do we have the required headers
     489                if( !monitor_decl || !guard_decl || !dtor_guard_decl )
     490                        SemanticError( decl, "mutex keyword requires monitors to be in scope, add #include <monitor.hfa>\n" );
     491
     492                // Instrument the body
    420493                if( isDtor ) {
    421494                        addDtorStatments( decl, body, mutexArgs );
     
    428501        void MutexKeyword::postvisit(StructDecl* decl) {
    429502
    430                 if( decl->name == "monitor_desc" ) {
     503                if( decl->name == "monitor_desc" && decl->body ) {
    431504                        assert( !monitor_decl );
    432505                        monitor_decl = decl;
    433506                }
    434                 else if( decl->name == "monitor_guard_t" ) {
     507                else if( decl->name == "monitor_guard_t" && decl->body ) {
    435508                        assert( !guard_decl );
    436509                        guard_decl = decl;
    437510                }
    438                 else if( decl->name == "monitor_dtor_guard_t" ) {
     511                else if( decl->name == "monitor_dtor_guard_t" && decl->body ) {
    439512                        assert( !dtor_guard_decl );
    440513                        dtor_guard_decl = decl;
     
    442515        }
    443516
    444         std::list<DeclarationWithType*> MutexKeyword::findMutexArgs( FunctionDecl* decl ) {
     517        std::list<DeclarationWithType*> MutexKeyword::findMutexArgs( FunctionDecl* decl, bool & first ) {
    445518                std::list<DeclarationWithType*> mutexArgs;
    446519
     520                bool once = true;
    447521                for( auto arg : decl->get_functionType()->get_parameters()) {
    448522                        //Find mutex arguments
     
    450524                        if( ! ty->get_mutex() ) continue;
    451525
     526                        if(once) {first = true;}
     527                        once = false;
     528
    452529                        //Append it to the list
    453530                        mutexArgs.push_back( arg );
     
    462539                //Makes sure it's not a copy
    463540                ReferenceType* rty = dynamic_cast< ReferenceType * >( ty );
    464                 if( ! rty ) throw SemanticError( "Mutex argument must be of reference type ", arg );
     541                if( ! rty ) SemanticError( arg, "Mutex argument must be of reference type " );
    465542
    466543                //Make sure the we are pointing directly to a type
    467544                Type* base = rty->get_base();
    468                 if( dynamic_cast< ReferenceType * >( base ) ) throw SemanticError( "Mutex argument have exactly one level of indirection ", arg );
    469                 if( dynamic_cast< PointerType * >( base ) ) throw SemanticError( "Mutex argument have exactly one level of indirection ", arg );
     545                if( dynamic_cast< ReferenceType * >( base ) ) SemanticError( arg, "Mutex argument have exactly one level of indirection " );
     546                if( dynamic_cast< PointerType * >( base ) ) SemanticError( arg, "Mutex argument have exactly one level of indirection " );
    470547
    471548                //Make sure that typed isn't mutex
    472                 if( base->get_mutex() ) throw SemanticError( "mutex keyword may only appear once per argument ", arg );
     549                if( base->get_mutex() ) SemanticError( arg, "mutex keyword may only appear once per argument " );
    473550        }
    474551
     
    608685                if( type && type->get_baseStruct()->is_thread() ) {
    609686                        if( !thread_decl || !thread_ctor_seen ) {
    610                                 throw SemanticError("thread keyword requires threads to be in scope, add #include <thread>");
     687                                SemanticError( type->get_baseStruct()->location, "thread keyword requires threads to be in scope, add #include <thread.hfa>");
    611688                        }
    612689
  • src/Concurrency/Waitfor.cc

    rf9feab8 r90152a4  
    249249
    250250        Statement * GenerateWaitForPass::postmutate( WaitForStmt * waitfor ) {
    251                 if( !decl_monitor || !decl_acceptable || !decl_mask ) throw SemanticError( "waitfor keyword requires monitors to be in scope, add #include <monitor>", waitfor );
     251                if( !decl_monitor || !decl_acceptable || !decl_mask )
     252                        SemanticError( waitfor, "waitfor keyword requires monitors to be in scope, add #include <monitor.hfa>" );
    252253
    253254                CompoundStmt * stmt = new CompoundStmt();
     
    507508                        new ListInit({
    508509                                new SingleInit( new AddressExpr( new VariableExpr( index ) ) ),
    509                                 new SingleInit( new VariableExpr( acceptables ) ),
    510                                 new SingleInit( new ConstantExpr( Constant::from_ulong( count ) ) )
     510                                new ListInit({
     511                                        new SingleInit( new VariableExpr( acceptables ) ),
     512                                        new SingleInit( new ConstantExpr( Constant::from_ulong( count ) ) )
     513                                })
    511514                        })
    512515                );
  • src/ControlStruct/ExceptTranslate.cc

    rf9feab8 r90152a4  
    3434#include "SynTree/Statement.h"        // for CompoundStmt, CatchStmt, ThrowStmt
    3535#include "SynTree/Type.h"             // for FunctionType, Type, noQualifiers
    36 #include "SynTree/VarExprReplacer.h"  // for VarExprReplacer, VarExprReplace...
     36#include "SynTree/DeclReplacer.h"     // for DeclReplacer
    3737#include "SynTree/Visitor.h"          // for acceptAll
    3838
     
    314314                        // Update variables in the body to point to this local copy.
    315315                        {
    316                                 VarExprReplacer::DeclMap mapping;
    317                                 mapping[ handler_decl ] = new VariableExpr( local_except );
    318                                 VarExprReplacer mapper( mapping );
    319                                 handler->body->acceptMutator( mapper );
     316                                DeclReplacer::DeclMap mapping;
     317                                mapping[ handler_decl ] = local_except;
     318                                DeclReplacer::replace( handler->body, mapping );
    320319                        }
    321320
     
    573572                        // Pass.
    574573                } else if ( CatchStmt::Terminate == catchStmt->get_kind() ) {
    575                         throw SemanticError("catch must have exception type");
     574                        SemanticError(catchStmt->location, "catch must have exception type");
    576575                } else {
    577                         throw SemanticError("catchResume must have exception type");
     576                        SemanticError(catchStmt->location, "catchResume must have exception type");
    578577                }
    579578
  • src/ControlStruct/ForExprMutator.cc

    rf9feab8 r90152a4  
    4545                return hoist( forStmt, forStmt->initialization );
    4646        }
     47        Statement *ForExprMutator::postmutate( WhileStmt *whileStmt ) {
     48                return hoist( whileStmt, whileStmt->initialization );
     49        }
    4750} // namespace ControlStruct
    4851
  • src/ControlStruct/ForExprMutator.h

    rf9feab8 r90152a4  
    1818class IfStmt;
    1919class ForStmt;
     20class WhileStmt;
    2021class Statement;
    2122
     
    2526                Statement *postmutate( IfStmt * );
    2627                Statement *postmutate( ForStmt * );
     28                Statement *postmutate( WhileStmt * );
    2729        };
    2830} // namespace ControlStruct
  • src/ControlStruct/LabelFixer.cc

    rf9feab8 r90152a4  
    4444
    4545        void LabelFixer::postvisit( FunctionDecl * functionDecl ) {
    46                 MLEMutator mlemut( resolveJumps(), generator );
     46                PassVisitor<MLEMutator> mlemut( resolveJumps(), generator );
    4747                functionDecl->acceptMutator( mlemut );
    4848        }
     
    9292                        } else if ( labelTable[ l ]->defined() ) {
    9393                                // defined twice, error
    94                                 throw SemanticError( "Duplicate definition of label: " + l.get_name() );
     94                                SemanticError( l.get_statement()->location, "Duplicate definition of label: " + l.get_name() );
    9595                        }       else {
    9696                                // used previously, but undefined until now -> link with this entry
     
    117117
    118118        // Builds a table that maps a label to its defining statement.
    119         std::map<Label, Statement * > *LabelFixer::resolveJumps() throw ( SemanticError ) {
     119        std::map<Label, Statement * > *LabelFixer::resolveJumps() throw ( SemanticErrorException ) {
    120120                std::map< Label, Statement * > *ret = new std::map< Label, Statement * >();
    121121                for ( std::map< Label, Entry * >::iterator i = labelTable.begin(); i != labelTable.end(); ++i ) {
    122122                        if ( ! i->second->defined() ) {
    123                                 throw SemanticError( "Use of undefined label: " + i->first.get_name() );
     123                                SemanticError( i->first.get_statement()->location, "Use of undefined label: " + i->first.get_name() );
    124124                        }
    125125                        (*ret)[ i->first ] = i->second->get_definition();
  • src/ControlStruct/LabelFixer.h

    rf9feab8 r90152a4  
    3333                LabelFixer( LabelGenerator *gen = 0 );
    3434
    35                 std::map < Label, Statement * > *resolveJumps() throw ( SemanticError );
     35                std::map < Label, Statement * > *resolveJumps() throw ( SemanticErrorException );
    3636
    3737                // Declarations
  • src/ControlStruct/MLEMutator.cc

    rf9feab8 r90152a4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug  4 11:21:32 2016
    13 // Update Count     : 202
     12// Last Modified On : Thu Mar  8 17:08:25 2018
     13// Update Count     : 219
    1414//
    1515
     
    3838        }
    3939        namespace {
    40                 Statement * isLoop( Statement * stmt ) { return dynamic_cast< WhileStmt * >( stmt ) ? stmt : dynamic_cast< ForStmt * >( stmt ) ? stmt : 0; }
    41         }
     40                bool isLoop( const MLEMutator::Entry & e ) { return dynamic_cast< WhileStmt * >( e.get_controlStructure() ) || dynamic_cast< ForStmt * >( e.get_controlStructure() ); }
     41                bool isSwitch( const MLEMutator::Entry & e ) { return dynamic_cast< SwitchStmt *>( e.get_controlStructure() ); }
     42
     43                bool isBreakTarget( const MLEMutator::Entry & e ) { return isLoop( e ) || isSwitch( e ) || dynamic_cast< CompoundStmt *>( e.get_controlStructure() ); }
     44                bool isContinueTarget( const MLEMutator::Entry & e ) { return isLoop( e ); }
     45                bool isFallthroughTarget( const MLEMutator::Entry & e ) { return dynamic_cast< CaseStmt *>( e.get_controlStructure() );; }
     46                bool isFallthroughDefaultTarget( const MLEMutator::Entry & e ) { return isSwitch( e ); }
     47        } // namespace
    4248
    4349        // break labels have to come after the statement they break out of, so mutate a statement, then if they inform us
    4450        // through the breakLabel field tha they need a place to jump to on a break statement, add the break label to the
    4551        // body of statements
    46         void MLEMutator::fixBlock( std::list< Statement * > &kids ) {
     52        void MLEMutator::fixBlock( std::list< Statement * > &kids, bool caseClause ) {
     53                SemanticErrorException errors;
     54
    4755                for ( std::list< Statement * >::iterator k = kids.begin(); k != kids.end(); k++ ) {
    48                         *k = (*k)->acceptMutator(*this);
     56                        if ( caseClause ) {
     57                                // once a label is seen, it's no longer a valid fallthrough target
     58                                for ( Label & l : (*k)->labels ) {
     59                                        fallthroughLabels.erase( l );
     60                                }
     61                        }
     62
     63                        // aggregate errors since the PassVisitor mutate loop was unrollled
     64                        try {
     65                                *k = (*k)->acceptMutator(*visitor);
     66                        } catch( SemanticErrorException &e ) {
     67                                errors.append( e );
     68                        }
    4969
    5070                        if ( ! get_breakLabel().empty() ) {
     
    5575                        } // if
    5676                } // for
    57         }
    58 
    59         CompoundStmt* MLEMutator::mutate( CompoundStmt *cmpndStmt ) {
    60                 bool labeledBlock = !(cmpndStmt->get_labels().empty());
     77
     78                if ( ! errors.isEmpty() ) {
     79                        throw errors;
     80                }
     81        }
     82
     83        void MLEMutator::premutate( CompoundStmt *cmpndStmt ) {
     84                visit_children = false;
     85                bool labeledBlock = !(cmpndStmt->labels.empty());
    6186                if ( labeledBlock ) {
    6287                        Label brkLabel = generator->newLabel("blockBreak", cmpndStmt);
    6388                        enclosingControlStructures.push_back( Entry( cmpndStmt, brkLabel ) );
     89                        GuardAction( [this]() { enclosingControlStructures.pop_back(); } );
    6490                } // if
    6591
    6692                // a child statement may set the break label - if they do, attach it to the next statement
    67                 std::list< Statement * > &kids = cmpndStmt->get_kids();
     93                std::list< Statement * > &kids = cmpndStmt->kids;
    6894                fixBlock( kids );
    6995
     
    7399                                set_breakLabel( enclosingControlStructures.back().useBreakExit() );
    74100                        } // if
    75                         enclosingControlStructures.pop_back();
    76                 } // if
    77 
    78                 return cmpndStmt;
    79         }
    80 
    81         template< typename LoopClass >
    82         Statement *MLEMutator::handleLoopStmt( LoopClass *loopStmt ) {
    83                 // remember this as the most recent enclosing loop, then mutate the body of the loop -- this will determine
    84                 // whether brkLabel and contLabel are used with branch statements and will recursively do the same to nested
    85                 // loops
    86                 Label brkLabel = generator->newLabel("loopBreak", loopStmt);
    87                 Label contLabel = generator->newLabel("loopContinue", loopStmt);
    88                 enclosingControlStructures.push_back( Entry( loopStmt, brkLabel, contLabel ) );
    89                 loopStmt->set_body ( loopStmt->get_body()->acceptMutator( *this ) );
    90 
    91                 assert( ! enclosingControlStructures.empty() );
    92                 Entry &e = enclosingControlStructures.back();
    93                 // sanity check that the enclosing loops have been popped correctly
    94                 assert ( e == loopStmt );
    95 
    96                 // this will take the necessary steps to add definitions of the previous two labels, if they are used.
    97                 loopStmt->set_body( mutateLoop( loopStmt->get_body(), e ) );
    98                 enclosingControlStructures.pop_back();
    99 
    100                 return loopStmt;
    101         }
    102 
    103         Statement *MLEMutator::mutate( CaseStmt *caseStmt ) {
    104                 caseStmt->set_condition( maybeMutate( caseStmt->get_condition(), *this ) );
    105                 fixBlock( caseStmt->get_statements() );
    106 
    107                 return caseStmt;
    108         }
    109 
    110         template< typename IfClass >
    111         Statement *MLEMutator::handleIfStmt( IfClass *ifStmt ) {
    112                 // generate a label for breaking out of a labeled if
    113                 bool labeledBlock = !(ifStmt->get_labels().empty());
    114                 if ( labeledBlock ) {
    115                         Label brkLabel = generator->newLabel("blockBreak", ifStmt);
    116                         enclosingControlStructures.push_back( Entry( ifStmt, brkLabel ) );
    117                 } // if
    118 
    119                 Parent::mutate( ifStmt );
    120 
    121                 if ( labeledBlock ) {
    122                         if ( ! enclosingControlStructures.back().useBreakExit().empty() ) {
    123                                 set_breakLabel( enclosingControlStructures.back().useBreakExit() );
    124                         } // if
    125                         enclosingControlStructures.pop_back();
    126                 } // if
    127                 return ifStmt;
    128         }
    129 
    130         template< typename SwitchClass >
    131         Statement *MLEMutator::handleSwitchStmt( SwitchClass *switchStmt ) {
    132                 // generate a label for breaking out of a labeled switch
    133                 Label brkLabel = generator->newLabel("switchBreak", switchStmt);
    134                 enclosingControlStructures.push_back( Entry(switchStmt, brkLabel) );
    135                 mutateAll( switchStmt->get_statements(), *this );
    136 
    137                 Entry &e = enclosingControlStructures.back();
    138                 assert ( e == switchStmt );
    139 
    140                 // only generate break label if labeled break is used
    141                 if ( e.isBreakUsed() ) {
    142                         // for the purposes of keeping switch statements uniform (i.e. all statements that are direct children of a
    143                         // switch should be CastStmts), append the exit label + break to the last case statement; create a default
    144                         // case if there are no cases
    145                         std::list< Statement * > &statements = switchStmt->get_statements();
    146                         if ( statements.empty() ) {
    147                                 statements.push_back( CaseStmt::makeDefault() );
    148                         } // if
    149 
    150                         if ( CaseStmt * c = dynamic_cast< CaseStmt * >( statements.back() ) ) {
    151                                 Statement * stmt = new BranchStmt( Label("brkLabel"), BranchStmt::Break );
    152                                 stmt->labels.push_back( brkLabel );
    153                                 c->get_statements().push_back( stmt );
    154                         } else assert(0); // as of this point, all statements of a switch are still CaseStmts
    155                 } // if
    156 
    157                 assert ( enclosingControlStructures.back() == switchStmt );
    158                 enclosingControlStructures.pop_back();
    159                 return switchStmt;
    160         }
     101                } // if
     102        }
     103
    161104
    162105        void addUnused( Statement * stmt, const Label & originalTarget ) {
     
    179122
    180123
    181         Statement *MLEMutator::mutate( BranchStmt *branchStmt ) throw ( SemanticError ) {
    182                 std::string originalTarget = branchStmt->get_originalTarget();
     124        Statement *MLEMutator::postmutate( BranchStmt *branchStmt ) throw ( SemanticErrorException ) {
     125                std::string originalTarget = branchStmt->originalTarget;
    183126
    184127                std::list< Entry >::reverse_iterator targetEntry;
     
    193136                                        if ( isContinue ) {
    194137                                                // continue target is outermost loop
    195                                                 targetEntry = std::find_if( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), [](Entry &e) { return isLoop( e.get_controlStructure() ); } );
     138                                                targetEntry = std::find_if( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), isContinueTarget );
    196139                                        } else {
    197                                                 // break target is outmost control structure
    198                                                 if ( enclosingControlStructures.empty() ) throw SemanticError( "'break' outside a loop, switch, or labelled block" );
    199                                                 targetEntry = enclosingControlStructures.rbegin();
     140                                                // break target is outermost loop, switch, or block control structure
     141                                                if ( enclosingControlStructures.empty() ) SemanticError( branchStmt->location, "'break' outside a loop, 'switch', or labelled block" );
     142                                                targetEntry = std::find_if( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), isBreakTarget );
    200143                                        } // if
    201144                                } else {
     
    204147                                } // if
    205148                                // ensure that selected target is valid
    206                                 if ( targetEntry == enclosingControlStructures.rend() || (isContinue && ! isLoop( targetEntry->get_controlStructure() ) ) ) {
    207                                         throw SemanticError( toString( (isContinue ? "'continue'" : "'break'"), " target must be an enclosing ", (isContinue ? "loop: " : "control structure: "), originalTarget ) );
     149                                if ( targetEntry == enclosingControlStructures.rend() || (isContinue && ! isContinueTarget( *targetEntry ) ) ) {
     150                                        SemanticError( branchStmt->location, toString( (isContinue ? "'continue'" : "'break'"), " target must be an enclosing ", (isContinue ? "loop: " : "control structure: "), originalTarget ) );
    208151                                } // if
    209152                                break;
    210153                        }
     154                        case BranchStmt::FallThrough:
     155                                targetEntry = std::find_if( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), isFallthroughTarget );
     156                                // ensure that selected target is valid
     157                                if ( targetEntry == enclosingControlStructures.rend() ) {
     158                                        SemanticError( branchStmt->location, "'fallthrough' must be enclosed in a 'switch' or 'choose'" );
     159                                } // if
     160                                if ( branchStmt->get_target() != "" ) {
     161                                        // labelled fallthrough
     162                                        // target must be in the set of valid fallthrough labels
     163                                        if ( ! fallthroughLabels.count( branchStmt->get_target() ) ) {
     164                                                SemanticError( branchStmt->location, toString( "'fallthrough' target must be a later case statement: ", originalTarget ) );
     165                                        }
     166                                        return new BranchStmt( originalTarget, BranchStmt::Goto );
     167                                }
     168                                break;
     169                        case BranchStmt::FallThroughDefault: {
     170                                // fallthrough default
     171                                targetEntry = std::find_if( enclosingControlStructures.rbegin(), enclosingControlStructures.rend(), isFallthroughDefaultTarget );
     172
     173                                // ensure that fallthrough is within a switch or choose
     174                                if ( targetEntry == enclosingControlStructures.rend() ) {
     175                                        SemanticError( branchStmt->location, "'fallthrough' must be enclosed in a 'switch' or 'choose'" );
     176                                } // if
     177
     178                                // ensure that switch or choose has a default clause
     179                                SwitchStmt * switchStmt = strict_dynamic_cast< SwitchStmt * >( targetEntry->get_controlStructure() );
     180                                bool foundDefault = false;
     181                                for ( Statement * stmt : switchStmt->statements ) {
     182                                        CaseStmt * caseStmt = strict_dynamic_cast< CaseStmt * >( stmt );
     183                                        if ( caseStmt->isDefault() ) {
     184                                                foundDefault = true;
     185                                        } // if
     186                                } // for
     187                                if ( ! foundDefault ) {
     188                                        SemanticError( branchStmt->location, "'fallthrough default' must be enclosed in a 'switch' or 'choose' control structure with a 'default' clause" );
     189                                }
     190                                break;
     191                        }
     192
    211193                        default:
    212194                                assert( false );
     
    215197                // branch error checks, get the appropriate label name and create a goto
    216198                Label exitLabel;
    217                 switch ( branchStmt->get_type() ) {
     199                switch ( branchStmt->type ) {
    218200                  case BranchStmt::Break:
    219201                                assert( targetEntry->useBreakExit() != "");
     
    224206                                exitLabel = targetEntry->useContExit();
    225207                                break;
     208                  case BranchStmt::FallThrough:
     209                                assert( targetEntry->useFallExit() != "");
     210                                exitLabel = targetEntry->useFallExit();
     211                                break;
     212                  case BranchStmt::FallThroughDefault:
     213                                assert( targetEntry->useFallDefaultExit() != "");
     214                                exitLabel = targetEntry->useFallDefaultExit();
     215                                // check that fallthrough default comes before the default clause
     216                                if ( ! targetEntry->isFallDefaultValid() ) {
     217                                        SemanticError( branchStmt->location, "'fallthrough default' must precede the 'default' clause" );
     218                                }
     219                                break;
    226220                  default:
    227221                                assert(0);                                      // shouldn't be here
     
    229223
    230224                // add unused attribute to label to silence warnings
    231                 addUnused( targetEntry->get_controlStructure(), branchStmt->get_originalTarget() );
     225                addUnused( targetEntry->get_controlStructure(), branchStmt->originalTarget );
    232226
    233227                // transform break/continue statements into goto to simplify later handling of branches
     
    260254        }
    261255
    262         Statement *MLEMutator::mutate( WhileStmt *whileStmt ) {
    263                 return handleLoopStmt( whileStmt );
    264         }
    265 
    266         Statement *MLEMutator::mutate( ForStmt *forStmt ) {
    267                 return handleLoopStmt( forStmt );
    268         }
    269 
    270         Statement *MLEMutator::mutate( IfStmt *ifStmt ) {
    271                 return handleIfStmt( ifStmt );
    272         }
    273 
    274         Statement *MLEMutator::mutate( SwitchStmt *switchStmt ) {
    275                 return handleSwitchStmt( switchStmt );
     256        template< typename LoopClass >
     257        void MLEMutator::prehandleLoopStmt( LoopClass * loopStmt ) {
     258                // remember this as the most recent enclosing loop, then mutate the body of the loop -- this will determine
     259                // whether brkLabel and contLabel are used with branch statements and will recursively do the same to nested
     260                // loops
     261                Label brkLabel = generator->newLabel("loopBreak", loopStmt);
     262                Label contLabel = generator->newLabel("loopContinue", loopStmt);
     263                enclosingControlStructures.push_back( Entry( loopStmt, brkLabel, contLabel ) );
     264                GuardAction( [this]() { enclosingControlStructures.pop_back(); } );
     265        }
     266
     267        template< typename LoopClass >
     268        Statement * MLEMutator::posthandleLoopStmt( LoopClass * loopStmt ) {
     269                assert( ! enclosingControlStructures.empty() );
     270                Entry &e = enclosingControlStructures.back();
     271                // sanity check that the enclosing loops have been popped correctly
     272                assert ( e == loopStmt );
     273
     274                // this will take the necessary steps to add definitions of the previous two labels, if they are used.
     275                loopStmt->body = mutateLoop( loopStmt->get_body(), e );
     276                return loopStmt;
     277        }
     278
     279        void MLEMutator::premutate( WhileStmt * whileStmt ) {
     280                return prehandleLoopStmt( whileStmt );
     281        }
     282
     283        void MLEMutator::premutate( ForStmt * forStmt ) {
     284                return prehandleLoopStmt( forStmt );
     285        }
     286
     287        Statement * MLEMutator::postmutate( WhileStmt * whileStmt ) {
     288                return posthandleLoopStmt( whileStmt );
     289        }
     290
     291        Statement * MLEMutator::postmutate( ForStmt * forStmt ) {
     292                return posthandleLoopStmt( forStmt );
     293        }
     294
     295        void MLEMutator::premutate( IfStmt * ifStmt ) {
     296                // generate a label for breaking out of a labeled if
     297                bool labeledBlock = !(ifStmt->get_labels().empty());
     298                if ( labeledBlock ) {
     299                        Label brkLabel = generator->newLabel("blockBreak", ifStmt);
     300                        enclosingControlStructures.push_back( Entry( ifStmt, brkLabel ) );
     301                        GuardAction( [this]() { enclosingControlStructures.pop_back(); } );
     302                } // if
     303        }
     304
     305        Statement * MLEMutator::postmutate( IfStmt * ifStmt ) {
     306                bool labeledBlock = !(ifStmt->get_labels().empty());
     307                if ( labeledBlock ) {
     308                        if ( ! enclosingControlStructures.back().useBreakExit().empty() ) {
     309                                set_breakLabel( enclosingControlStructures.back().useBreakExit() );
     310                        } // if
     311                } // if
     312                return ifStmt;
     313        }
     314
     315        void MLEMutator::premutate( CaseStmt *caseStmt ) {
     316                visit_children = false;
     317
     318                // mark default as seen before visiting its statements to catch default loops
     319                if ( caseStmt->isDefault() ) {
     320                        enclosingControlStructures.back().seenDefault();
     321                } // if
     322
     323                caseStmt->condition = maybeMutate( caseStmt->condition, *visitor );
     324                Label fallLabel = generator->newLabel( "fallThrough", caseStmt );
     325                {
     326                        // ensure that stack isn't corrupted by exceptions in fixBlock
     327                        auto guard = makeFuncGuard( [&]() { enclosingControlStructures.push_back( Entry( caseStmt, fallLabel ) ); }, [this]() { enclosingControlStructures.pop_back(); } );
     328
     329                        // empty case statement
     330                        if( ! caseStmt->stmts.empty() ) {
     331                                // the parser ensures that all statements in a case are grouped into a block
     332                                CompoundStmt * block = strict_dynamic_cast< CompoundStmt * >( caseStmt->stmts.front() );
     333                                fixBlock( block->kids, true );
     334
     335                                // add fallthrough label if necessary
     336                                assert( ! enclosingControlStructures.empty() );
     337                                if ( enclosingControlStructures.back().isFallUsed() ) {
     338                                        std::list<Label> ls{ enclosingControlStructures.back().useFallExit() };
     339                                        caseStmt->stmts.push_back( new NullStmt( ls ) );
     340                                } // if
     341                        } // if
     342                }
     343                assert( ! enclosingControlStructures.empty() );
     344                assertf( dynamic_cast<SwitchStmt *>( enclosingControlStructures.back().get_controlStructure() ), "Control structure enclosing a case clause must be a switch, but is: %s", toCString( enclosingControlStructures.back().get_controlStructure() ) );
     345                if ( caseStmt->isDefault() ) {
     346                        if ( enclosingControlStructures.back().isFallDefaultUsed() ) {
     347                                // add fallthrough default label if necessary
     348                                std::list<Label> ls{ enclosingControlStructures.back().useFallDefaultExit() };
     349                                caseStmt->stmts.push_front( new NullStmt( ls ) );
     350                        } // if
     351                } // if
     352        }
     353
     354        void MLEMutator::premutate( SwitchStmt *switchStmt ) {
     355                // generate a label for breaking out of a labeled switch
     356                Label brkLabel = generator->newLabel("switchBreak", switchStmt);
     357                auto it = std::find_if( switchStmt->statements.rbegin(), switchStmt->statements.rend(), [](Statement * stmt) {
     358                        CaseStmt * caseStmt = strict_dynamic_cast< CaseStmt * >( stmt );
     359                        return caseStmt->isDefault();
     360                });
     361                CaseStmt * defaultCase = it != switchStmt->statements.rend() ? strict_dynamic_cast<CaseStmt *>( *it ) : nullptr;
     362                Label fallDefaultLabel = defaultCase ? generator->newLabel( "fallThroughDefault", defaultCase ) : "";
     363                enclosingControlStructures.push_back( Entry(switchStmt, brkLabel, fallDefaultLabel) );
     364                GuardAction( [this]() { enclosingControlStructures.pop_back(); } );
     365
     366                // Collect valid labels for fallthrough. This is initially all labels at the same level as a case statement.
     367                // As labels are seen during traversal, they are removed, since fallthrough is not allowed to jump backwards.
     368                for ( Statement * stmt : switchStmt->statements ) {
     369                        CaseStmt * caseStmt = strict_dynamic_cast< CaseStmt * >( stmt );
     370                        if ( caseStmt->stmts.empty() ) continue;
     371                        CompoundStmt * block = dynamic_cast< CompoundStmt * >( caseStmt->stmts.front() );
     372                        for ( Statement * stmt : block->kids ) {
     373                                for ( Label & l : stmt->labels ) {
     374                                        fallthroughLabels.insert( l );
     375                                }
     376                        }
     377                }
     378        }
     379
     380        Statement * MLEMutator::postmutate( SwitchStmt * switchStmt ) {
     381                Entry &e = enclosingControlStructures.back();
     382                assert ( e == switchStmt );
     383
     384                // only generate break label if labeled break is used
     385                if ( e.isBreakUsed() ) {
     386                        // for the purposes of keeping switch statements uniform (i.e. all statements that are direct children of a
     387                        // switch should be CastStmts), append the exit label + break to the last case statement; create a default
     388                        // case if there are no cases
     389                        std::list< Statement * > &statements = switchStmt->statements;
     390                        if ( statements.empty() ) {
     391                                statements.push_back( CaseStmt::makeDefault() );
     392                        } // if
     393
     394                        if ( CaseStmt * c = dynamic_cast< CaseStmt * >( statements.back() ) ) {
     395                                Statement * stmt = new BranchStmt( Label("brkLabel"), BranchStmt::Break );
     396                                stmt->labels.push_back( e.useBreakExit() );
     397                                c->stmts.push_back( stmt );
     398                        } else assert(0); // as of this point, all statements of a switch are still CaseStmts
     399                } // if
     400
     401                assert ( enclosingControlStructures.back() == switchStmt );
     402                return switchStmt;
    276403        }
    277404} // namespace ControlStruct
  • src/ControlStruct/MLEMutator.h

    rf9feab8 r90152a4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:19:59 2017
    13 // Update Count     : 35
     12// Last Modified On : Thu Mar  8 16:42:32 2018
     13// Update Count     : 41
    1414//
    1515
     
    1919#include <map>                     // for map
    2020#include <string>                  // for string
     21#include <set>                     // for unordered_set
    2122
     23#include "Common/PassVisitor.h"
    2224#include "Common/SemanticError.h"  // for SemanticError
    2325#include "SynTree/Label.h"         // for Label
     
    2628
    2729namespace ControlStruct {
    28 class LabelGenerator;
     30        class LabelGenerator;
    2931
    30         class MLEMutator : public Mutator {
     32        class MLEMutator : public WithVisitorRef<MLEMutator>, public WithShortCircuiting, public WithGuards {
     33          public:
    3134                class Entry;
    32 
    33                 typedef Mutator Parent;
    34           public:
    3535                MLEMutator( std::map<Label, Statement *> *t, LabelGenerator *gen = 0 ) : targetTable( t ), breakLabel(std::string("")), generator( gen ) {}
    3636                ~MLEMutator();
    3737
    38                 virtual CompoundStmt *mutate( CompoundStmt *cmpndStmt ) override;
    39                 virtual Statement *mutate( WhileStmt *whileStmt ) override;
    40                 virtual Statement *mutate( ForStmt *forStmt ) override;
    41                 virtual Statement *mutate( BranchStmt *branchStmt ) throw ( SemanticError ) override;
    42                 virtual Statement *mutate( CaseStmt *caseStmt ) override;
    43                 virtual Statement *mutate( IfStmt *ifStmt ) override;
    44                 virtual Statement *mutate( SwitchStmt *switchStmt ) override;
     38                void premutate( CompoundStmt *cmpndStmt );
     39                Statement * postmutate( BranchStmt *branchStmt ) throw ( SemanticErrorException );
     40                void premutate( WhileStmt *whileStmt );
     41                Statement * postmutate( WhileStmt *whileStmt );
     42                void premutate( ForStmt *forStmt );
     43                Statement * postmutate( ForStmt *forStmt );
     44                void premutate( CaseStmt *caseStmt );
     45                void premutate( IfStmt *ifStmt );
     46                Statement * postmutate( IfStmt *ifStmt );
     47                void premutate( SwitchStmt *switchStmt );
     48                Statement * postmutate( SwitchStmt *switchStmt );
    4549
    4650                Statement *mutateLoop( Statement *bodyLoop, Entry &e );
     
    4852                Label &get_breakLabel() { return breakLabel; }
    4953                void set_breakLabel( Label newValue ) { breakLabel = newValue; }
    50           private:
     54
    5155                class Entry {
    5256                  public:
    53                         explicit Entry( Statement *_loop, Label _breakExit, Label _contExit = Label("") ) :
    54                                 loop( _loop ), breakExit( _breakExit ), contExit( _contExit ), breakUsed(false), contUsed(false) {}
     57                        // specialized constructors for each combination of statement with labelled break/continue/fallthrough that is valid to cleanup the use cases
     58                        explicit Entry( ForStmt *stmt, Label breakExit, Label contExit ) :
     59                                stmt( stmt ), breakExit( breakExit ), contExit( contExit ) {}
    5560
    56                         bool operator==( const Statement *stmt ) { return ( loop == stmt ); }
    57                         bool operator!=( const Statement *stmt ) { return ( loop != stmt ); }
     61                        explicit Entry( WhileStmt *stmt, Label breakExit, Label contExit ) :
     62                                stmt( stmt ), breakExit( breakExit ), contExit( contExit ) {}
    5863
    59                         bool operator==( const Entry &other ) { return ( loop == other.get_controlStructure() ); }
     64                        explicit Entry( CompoundStmt *stmt, Label breakExit ) :
     65                                stmt( stmt ), breakExit( breakExit ) {}
    6066
    61                         Statement *get_controlStructure() const { return loop; }
     67                        explicit Entry( IfStmt *stmt, Label breakExit ) :
     68                                stmt( stmt ), breakExit( breakExit ) {}
     69
     70                        explicit Entry( CaseStmt *stmt, Label fallExit ) :
     71                                stmt( stmt ), fallExit( fallExit ) {}
     72
     73                        explicit Entry( SwitchStmt *stmt, Label breakExit, Label fallDefaultExit ) :
     74                                stmt( stmt ), breakExit( breakExit ), fallDefaultExit( fallDefaultExit ) {}
     75
     76                        bool operator==( const Statement *other ) { return stmt == other; }
     77                        bool operator!=( const Statement *other ) { return stmt != other; }
     78
     79                        bool operator==( const Entry &other ) { return stmt == other.get_controlStructure(); }
     80
     81                        Statement *get_controlStructure() const { return stmt; }
    6282
    6383                        Label useContExit() { contUsed = true; return contExit; }
    6484                        Label useBreakExit() { breakUsed = true; return breakExit; }
     85                        Label useFallExit() { fallUsed = true; return fallExit; }
     86                        Label useFallDefaultExit() { fallDefaultUsed = true; return fallDefaultExit; }
    6587
    6688                        bool isContUsed() const { return contUsed; }
    6789                        bool isBreakUsed() const { return breakUsed; }
     90                        bool isFallUsed() const { return fallUsed; }
     91                        bool isFallDefaultUsed() const { return fallDefaultUsed; }
     92                        void seenDefault() { fallDefaultValid = false; }
     93                        bool isFallDefaultValid() const { return fallDefaultValid; }
    6894                  private:
    69                         Statement *loop;
    70                         Label breakExit, contExit;
    71                         bool breakUsed, contUsed;
     95                        Statement *stmt;
     96                        Label breakExit, contExit, fallExit, fallDefaultExit;
     97                        bool breakUsed = false, contUsed = false, fallUsed = false, fallDefaultUsed = false;
     98                        bool fallDefaultValid = true;
    7299                };
    73100
     101          private:
    74102                std::map< Label, Statement * > *targetTable;
     103                std::set< Label > fallthroughLabels;
    75104                std::list< Entry > enclosingControlStructures;
    76105                Label breakLabel;
     
    78107
    79108                template< typename LoopClass >
    80                 Statement *handleLoopStmt( LoopClass *loopStmt );
     109                void prehandleLoopStmt( LoopClass * loopStmt );
    81110
    82                 template< typename IfClass >
    83                 Statement *handleIfStmt( IfClass *switchStmt );
     111                template< typename LoopClass >
     112                Statement * posthandleLoopStmt( LoopClass * loopStmt );
    84113
    85                 template< typename SwitchClass >
    86                 Statement *handleSwitchStmt( SwitchClass *switchStmt );
    87 
    88                 void fixBlock( std::list< Statement * > &kids );
     114                void fixBlock( std::list< Statement * > &kids, bool caseClause = false );
    89115        };
    90116} // namespace ControlStruct
  • src/ControlStruct/Mutate.cc

    rf9feab8 r90152a4  
    1818
    1919#include "Common/PassVisitor.h"    // for mutateAll
    20 #include "Common/SemanticError.h"  // for SemanticError
    2120#include "ForExprMutator.h"        // for ForExprMutator
    2221#include "LabelFixer.h"            // for LabelFixer
     
    2827#include "SynTree/Visitor.h"       // for acceptAll
    2928
    30 using namespace std;
     29namespace ControlStruct {
     30        void fixLabels( std::list< Declaration * > & translationUnit ) {
     31                PassVisitor<LabelFixer> lfix;
     32                acceptAll( translationUnit, lfix );
     33        }
    3134
    32 namespace ControlStruct {
    33         void mutate( std::list< Declaration * > translationUnit ) {
    34                 // hoist initialization out of for statements
     35        void hoistControlDecls( std::list< Declaration * > & translationUnit ) {
    3536                PassVisitor<ForExprMutator> formut;
    36 
    37                 // normalizes label definitions and generates multi-level exit labels
    38                 PassVisitor<LabelFixer> lfix;
    39 
    4037                mutateAll( translationUnit, formut );
    41                 acceptAll( translationUnit, lfix );
    4238        }
    4339} // namespace CodeGen
  • src/ControlStruct/Mutate.h

    rf9feab8 r90152a4  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Mutate.h -- 
     7// Mutate.h --
    88//
    99// Author           : Rodolfo G. Esteves
     
    2020class Declaration;
    2121
     22/// Desugars Cforall control structures
    2223namespace ControlStruct {
    23         /// Desugars Cforall control structures
    24         void mutate( std::list< Declaration* > translationUnit );
     24        /// normalizes label definitions and generates multi-level exit labels
     25        void fixLabels( std::list< Declaration * > & translationUnit );
     26
     27        /// hoist initialization out of for statements
     28        void hoistControlDecls( std::list< Declaration * > & translationUnit );
    2529} // namespace ControlStruct
    2630
  • src/GenPoly/Box.cc

    rf9feab8 r90152a4  
    163163                        void premutate( DeclStmt *declStmt );
    164164                        Expression *postmutate( MemberExpr *memberExpr );
     165                        void premutate( AddressExpr *addrExpr );
     166                        Expression *postmutate( AddressExpr *addrExpr );
    165167                        Expression *postmutate( SizeofExpr *sizeofExpr );
    166168                        Expression *postmutate( AlignofExpr *alignofExpr );
     
    182184                        /// change the type of generic aggregate members to char[]
    183185                        void mutateMembers( AggregateDecl * aggrDecl );
     186                        /// returns the calculated sizeof expression for ty, or nullptr for use C sizeof()
     187                        Expression* genSizeof( Type* ty );
    184188
    185189                        /// Enters a new scope for type-variables, adding the type variables from ty
     
    193197                        ScopedSet< std::string > knownOffsets;          ///< Set of non-generic types for which the offset array exists in the current scope, indexed by offsetofName
    194198                        UniqueName bufNamer;                           ///< Namer for VLA buffers
     199                        Expression * addrMember = nullptr;             ///< AddressExpr argument is MemberExpr?
    195200                };
    196201
     
    215220        inline void mutateTranslationUnit( std::list< Declaration* > &translationUnit, MutatorType &mutator ) {
    216221                bool seenIntrinsic = false;
    217                 SemanticError errors;
     222                SemanticErrorException errors;
    218223                for ( typename std::list< Declaration* >::iterator i = translationUnit.begin(); i != translationUnit.end(); ++i ) {
    219224                        try {
     
    228233                                        assert( *i );
    229234                                } // if
    230                         } catch( SemanticError &e ) {
    231                                 e.set_location( (*i)->location );
     235                        } catch( SemanticErrorException &e ) {
    232236                                errors.append( e );
    233237                        } // try
     
    302306        Expression *makeOp( const std::string &name, Expression *arg ) {
    303307                UntypedExpr *expr = new UntypedExpr( new NameExpr( name ) );
    304                 expr->get_args().push_back( arg );
     308                expr->args.push_back( arg );
    305309                return expr;
    306310        }
     
    309313        Expression *makeOp( const std::string &name, Expression *lhs, Expression *rhs ) {
    310314                UntypedExpr *expr = new UntypedExpr( new NameExpr( name ) );
    311                 expr->get_args().push_back( lhs );
    312                 expr->get_args().push_back( rhs );
     315                expr->args.push_back( lhs );
     316                expr->args.push_back( rhs );
    313317                return expr;
    314318        }
     
    316320        /// Returns the dereference of a local pointer variable
    317321        Expression *derefVar( ObjectDecl *var ) {
    318                 return makeOp( "*?", new VariableExpr( var ) );
     322                return UntypedExpr::createDeref( new VariableExpr( var ) );
    319323        }
    320324
     
    380384                unsigned long n_members = 0;
    381385                bool firstMember = true;
    382                 for ( std::list< Declaration* >::const_iterator member = structDecl->get_members().begin(); member != structDecl->get_members().end(); ++member ) {
    383                         DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( *member );
     386                for ( Declaration* member : structDecl->get_members() ) {
     387                        DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( member );
    384388                        assert( dwt );
    385389                        Type *memberType = dwt->get_type();
     
    576580                                                }
    577581                                        } else {
    578                                                 throw SemanticError( "Cannot pass non-struct type for generic struct: ", argBaseType );
     582                                                SemanticError( argBaseType, "Cannot pass non-struct type for generic struct: " );
    579583                                        }
    580584                                }
     
    598602                                        } else {
    599603                                                // xxx - should this be an assertion?
    600                                                 throw SemanticError( toString( *env, "\nunbound type variable: ", tyParm->first, " in application " ), appExpr );
     604                                                SemanticError( appExpr, toString( *env, "\nunbound type variable: ", tyParm->first, " in application " ) );
    601605                                        } // if
    602606                                } // if
     
    831835                                if ( ! isPolyType( arg->get_type() ) ) {
    832836                                        UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
    833                                         deref->get_args().push_back( new CastExpr( new VariableExpr( param ), new PointerType( Type::Qualifiers(), arg->get_type()->clone() ) ) );
    834                                         deref->set_result( arg->get_type()->clone() );
     837                                        deref->args.push_back( new CastExpr( new VariableExpr( param ), new PointerType( Type::Qualifiers(), arg->get_type()->clone() ) ) );
     838                                        deref->result = arg->get_type()->clone();
     839                                        deref->result->set_lvalue( true );
    835840                                        return deref;
    836841                                } // if
     
    987992
    988993                Expression *Pass1::handleIntrinsics( ApplicationExpr *appExpr ) {
    989                         if ( VariableExpr *varExpr = dynamic_cast< VariableExpr *>( appExpr->get_function() ) ) {
    990                                 if ( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic ) {
    991                                         if ( varExpr->get_var()->get_name() == "?[?]" ) {
     994                        if ( VariableExpr *varExpr = dynamic_cast< VariableExpr *>( appExpr->function ) ) {
     995                                if ( varExpr->var->linkage == LinkageSpec::Intrinsic ) {
     996                                        if ( varExpr->var->name == "?[?]" ) {
    992997                                                assert( appExpr->result );
    993998                                                assert( appExpr->get_args().size() == 2 );
    994                                                 Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result(), scopeTyVars, env );
    995                                                 Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_result(), scopeTyVars, env );
     999                                                Type *baseType1 = isPolyPtr( appExpr->args.front()->result, scopeTyVars, env );
     1000                                                Type *baseType2 = isPolyPtr( appExpr->args.back()->result, scopeTyVars, env );
    9961001                                                assert( ! baseType1 || ! baseType2 ); // the arguments cannot both be polymorphic pointers
    9971002                                                UntypedExpr *ret = 0;
     
    11741179                        if ( expr->result && isPolyType( expr->result, scopeTyVars, env ) ) {
    11751180                                if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->function ) ) {
    1176                                         if ( name->get_name() == "*?" ) {
     1181                                        if ( name->name == "*?" ) {
    11771182                                                Expression *ret = expr->args.front();
    11781183                                                expr->args.clear();
     
    11871192                void Pass1::premutate( AddressExpr * ) { visit_children = false; }
    11881193                Expression * Pass1::postmutate( AddressExpr * addrExpr ) {
    1189                         assert( addrExpr->get_arg()->result && ! addrExpr->get_arg()->get_result()->isVoid() );
     1194                        assert( addrExpr->arg->result && ! addrExpr->arg->result->isVoid() );
    11901195
    11911196                        bool needs = false;
    1192                         if ( UntypedExpr *expr = dynamic_cast< UntypedExpr *>( addrExpr->get_arg() ) ) {
    1193                                 if ( expr->result && isPolyType( expr->get_result(), scopeTyVars, env ) ) {
    1194                                         if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) {
    1195                                                 if ( name->get_name() == "*?" ) {
    1196                                                         if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr->get_args().front() ) ) {
    1197                                                                 assert( appExpr->get_function()->result );
    1198                                                                 FunctionType *function = getFunctionType( appExpr->get_function()->get_result() );
     1197                        if ( UntypedExpr *expr = dynamic_cast< UntypedExpr *>( addrExpr->arg ) ) {
     1198                                if ( expr->result && isPolyType( expr->result, scopeTyVars, env ) ) {
     1199                                        if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->function ) ) {
     1200                                                if ( name->name == "*?" ) {
     1201                                                        if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr->args.front() ) ) {
     1202                                                                assert( appExpr->function->result );
     1203                                                                FunctionType *function = getFunctionType( appExpr->function->result );
    11991204                                                                assert( function );
    12001205                                                                needs = needsAdapter( function, scopeTyVars );
     
    12061211                        // isPolyType check needs to happen before mutating addrExpr arg, so pull it forward
    12071212                        // out of the if condition.
    1208                         addrExpr->arg = addrExpr->get_arg()->acceptMutator( *visitor );
     1213                        addrExpr->arg = addrExpr->arg->acceptMutator( *visitor );
    12091214                        // ... but must happen after mutate, since argument might change (e.g. intrinsic *?, ?[?]) - re-evaluate above comment
    1210                         bool polytype = isPolyType( addrExpr->get_arg()->get_result(), scopeTyVars, env );
     1215                        bool polytype = isPolyType( addrExpr->arg->result, scopeTyVars, env );
    12111216                        if ( polytype || needs ) {
    1212                                 Expression *ret = addrExpr->get_arg();
    1213                                 delete ret->get_result();
    1214                                 ret->set_result( addrExpr->get_result()->clone() );
    1215                                 addrExpr->set_arg( 0 );
     1217                                Expression *ret = addrExpr->arg;
     1218                                delete ret->result;
     1219                                ret->result = addrExpr->result->clone();
     1220                                addrExpr->arg = nullptr;
    12161221                                delete addrExpr;
    12171222                                return ret;
     
    12501255
    12511256                void Pass2::addAdapters( FunctionType *functionType ) {
    1252                         std::list< DeclarationWithType *> &paramList = functionType->get_parameters();
     1257                        std::list< DeclarationWithType *> &paramList = functionType->parameters;
    12531258                        std::list< FunctionType *> functions;
    12541259                        for ( std::list< DeclarationWithType *>::iterator arg = paramList.begin(); arg != paramList.end(); ++arg ) {
     
    12711276
    12721277                DeclarationWithType * Pass2::postmutate( FunctionDecl *functionDecl ) {
    1273                         FunctionType * ftype = functionDecl->get_functionType();
    1274                         if ( ! ftype->get_returnVals().empty() && functionDecl->get_statements() ) {
    1275                                 if ( ! isPrefix( functionDecl->get_name(), "_thunk" ) && ! isPrefix( functionDecl->get_name(), "_adapter" ) ) { // xxx - remove check for prefix once thunks properly use ctor/dtors
    1276                                         assert( ftype->get_returnVals().size() == 1 );
    1277                                         DeclarationWithType * retval = ftype->get_returnVals().front();
    1278                                         if ( retval->get_name() == "" ) {
    1279                                                 retval->set_name( "_retval" );
     1278                        FunctionType * ftype = functionDecl->type;
     1279                        if ( ! ftype->returnVals.empty() && functionDecl->statements ) {
     1280                                if ( ! isPrefix( functionDecl->name, "_thunk" ) && ! isPrefix( functionDecl->name, "_adapter" ) ) { // xxx - remove check for prefix once thunks properly use ctor/dtors
     1281                                        assert( ftype->returnVals.size() == 1 );
     1282                                        DeclarationWithType * retval = ftype->returnVals.front();
     1283                                        if ( retval->name == "" ) {
     1284                                                retval->name = "_retval";
    12801285                                        }
    1281                                         functionDecl->get_statements()->get_kids().push_front( new DeclStmt( retval ) );
     1286                                        functionDecl->statements->kids.push_front( new DeclStmt( retval ) );
    12821287                                        DeclarationWithType * newRet = retval->clone(); // for ownership purposes
    1283                                         ftype->get_returnVals().front() = newRet;
     1288                                        ftype->returnVals.front() = newRet;
    12841289                                }
    12851290                        }
    12861291                        // errors should have been caught by this point, remove initializers from parameters to allow correct codegen of default arguments
    1287                         for ( Declaration * param : functionDecl->get_functionType()->get_parameters() ) {
     1292                        for ( Declaration * param : functionDecl->type->parameters ) {
    12881293                                if ( ObjectDecl * obj = dynamic_cast< ObjectDecl * >( param ) ) {
    1289                                         delete obj->get_init();
    1290                                         obj->set_init( nullptr );
     1294                                        delete obj->init;
     1295                                        obj->init = nullptr;
    12911296                                }
    12921297                        }
     
    15541559                        // only mutate member expressions for polymorphic types
    15551560                        int tyDepth;
    1556                         Type *objectType = hasPolyBase( memberExpr->get_aggregate()->get_result(), scopeTyVars, &tyDepth );
     1561                        Type *objectType = hasPolyBase( memberExpr->aggregate->result, scopeTyVars, &tyDepth );
    15571562                        if ( ! objectType ) return memberExpr;
    15581563                        findGeneric( objectType ); // ensure layout for this type is available
    15591564
    15601565                        // replace member expression with dynamically-computed layout expression
    1561                         Expression *newMemberExpr = 0;
     1566                        Expression *newMemberExpr = nullptr;
    15621567                        if ( StructInstType *structType = dynamic_cast< StructInstType* >( objectType ) ) {
    15631568                                // look up offset index
    1564                                 long i = findMember( memberExpr->get_member(), structType->get_baseStruct()->get_members() );
     1569                                long i = findMember( memberExpr->member, structType->baseStruct->members );
    15651570                                if ( i == -1 ) return memberExpr;
    15661571
    15671572                                // replace member expression with pointer to base plus offset
    15681573                                UntypedExpr *fieldLoc = new UntypedExpr( new NameExpr( "?+?" ) );
    1569                                 Expression * aggr = memberExpr->get_aggregate()->clone();
    1570                                 delete aggr->get_env(); // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it
    1571                                 aggr->set_env( nullptr );
     1574                                Expression * aggr = memberExpr->aggregate->clone();
     1575                                delete aggr->env; // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it
     1576                                aggr->env = nullptr;
    15721577                                fieldLoc->get_args().push_back( aggr );
    15731578                                fieldLoc->get_args().push_back( makeOffsetIndex( objectType, i ) );
    1574                                 fieldLoc->set_result( memberExpr->get_result()->clone() );
     1579                                fieldLoc->set_result( memberExpr->result->clone() );
    15751580                                newMemberExpr = fieldLoc;
    15761581                        } else if ( dynamic_cast< UnionInstType* >( objectType ) ) {
    15771582                                // union members are all at offset zero, so just use the aggregate expr
    1578                                 Expression * aggr = memberExpr->get_aggregate()->clone();
    1579                                 delete aggr->get_env(); // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it
    1580                                 aggr->set_env( nullptr );
     1583                                Expression * aggr = memberExpr->aggregate->clone();
     1584                                delete aggr->env; // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it
     1585                                aggr->env= nullptr;
    15811586                                newMemberExpr = aggr;
    1582                                 newMemberExpr->set_result( memberExpr->get_result()->clone() );
     1587                                newMemberExpr->result = memberExpr->result->clone();
    15831588                        } else return memberExpr;
    15841589                        assert( newMemberExpr );
    15851590
    1586                         Type *memberType = memberExpr->get_member()->get_type();
     1591                        // Must apply the generic substitution to the member type to handle cases where the member is a generic parameter substituted by a known concrete type, e.g.
     1592                        //   forall(otype T) struct Box { T x; }
     1593                        //   forall(otype T) f() {
     1594                        //     Box(T *) b; b.x;
     1595                        //   }
     1596                        // TODO: memberExpr->result should be exactly memberExpr->member->get_type() after substitution, so it doesn't seem like it should be necessary to apply the substitution manually. For some reason this is not currently the case. This requires more investigation.
     1597                        Type *memberType = memberExpr->member->get_type()->clone();
     1598                        TypeSubstitution sub = objectType->genericSubstitution();
     1599                        sub.apply( memberType );
    15871600                        if ( ! isPolyType( memberType, scopeTyVars ) ) {
    15881601                                // Not all members of a polymorphic type are themselves of polymorphic type; in this case the member expression should be wrapped and dereferenced to form an lvalue
     
    15921605                        }
    15931606
     1607                        delete memberType;
    15941608                        delete memberExpr;
    15951609                        return newMemberExpr;
    15961610                }
    15971611
     1612                void PolyGenericCalculator::premutate( AddressExpr * addrExpr ) {
     1613                        GuardValue( addrMember );
     1614                        // is the argument a MemberExpr before mutating?
     1615                        addrMember = dynamic_cast< MemberExpr * >( addrExpr->arg );
     1616                }
     1617
     1618                Expression * PolyGenericCalculator::postmutate( AddressExpr * addrExpr ) {
     1619                        if ( addrMember && addrMember != addrExpr->arg ) {
     1620                                // arg was a MemberExpr and has been mutated
     1621                                if ( UntypedExpr * untyped = dynamic_cast< UntypedExpr * >( addrExpr->arg ) ) {
     1622                                        if ( InitTweak::getFunctionName( untyped ) == "?+?" ) {
     1623                                                // MemberExpr was converted to pointer+offset, and it is not valid C to take the address of an addition, so strip the address-of
     1624                                                // TODO: should  addrExpr->arg->result be changed to addrExpr->result?
     1625                                                Expression * ret = addrExpr->arg;
     1626                                                addrExpr->arg = nullptr;
     1627                                                std::swap( addrExpr->env, ret->env );
     1628                                                delete addrExpr;
     1629                                                return ret;
     1630                                        }
     1631                                }
     1632                        }
     1633                        return addrExpr;
     1634                }
     1635
    15981636                ObjectDecl *PolyGenericCalculator::makeVar( const std::string &name, Type *type, Initializer *init ) {
    1599                         ObjectDecl *newObj = new ObjectDecl( name, Type::StorageClasses(), LinkageSpec::C, 0, type, init );
     1637                        ObjectDecl *newObj = new ObjectDecl( name, Type::StorageClasses(), LinkageSpec::C, nullptr, type, init );
    16001638                        stmtsToAddBefore.push_back( new DeclStmt( newObj ) );
    16011639                        return newObj;
     
    17111749                }
    17121750
     1751                Expression * PolyGenericCalculator::genSizeof( Type* ty ) {
     1752                        if ( ArrayType * aty = dynamic_cast<ArrayType *>(ty) ) {
     1753                                // generate calculated size for possibly generic array
     1754                                Expression * sizeofBase = genSizeof( aty->get_base() );
     1755                                if ( ! sizeofBase ) return nullptr;
     1756                                Expression * dim = aty->get_dimension();
     1757                                aty->set_dimension( nullptr );
     1758                                return makeOp( "?*?", sizeofBase, dim );
     1759                        } else if ( findGeneric( ty ) ) {
     1760                                // generate calculated size for generic type
     1761                                return new NameExpr( sizeofName( mangleType( ty ) ) );
     1762                        } else return nullptr;
     1763                }
     1764
    17131765                Expression *PolyGenericCalculator::postmutate( SizeofExpr *sizeofExpr ) {
    1714                         Type *ty = sizeofExpr->get_isType() ? sizeofExpr->get_type() : sizeofExpr->get_expr()->get_result();
    1715                         if ( findGeneric( ty ) ) {
    1716                                 Expression *ret = new NameExpr( sizeofName( mangleType( ty ) ) );
     1766                        Type *ty = sizeofExpr->get_isType() ?
     1767                                sizeofExpr->get_type() : sizeofExpr->get_expr()->get_result();
     1768                       
     1769                        Expression * gen = genSizeof( ty );
     1770                        if ( gen ) {
    17171771                                delete sizeofExpr;
    1718                                 return ret;
    1719                         }
    1720                         return sizeofExpr;
     1772                                return gen;
     1773                        } else return sizeofExpr;
    17211774                }
    17221775
  • src/GenPoly/FindFunction.cc

    rf9feab8 r90152a4  
    1919
    2020#include "Common/PassVisitor.h"         // for PassVisitor
    21 #include "Common/SemanticError.h"       // for SemanticError
    2221#include "GenPoly/ErasableScopedMap.h"  // for ErasableScopedMap<>::iterator
    2322#include "GenPoly/GenPoly.h"            // for TyVarMap
  • src/GenPoly/GenPoly.cc

    rf9feab8 r90152a4  
    100100                if ( dynamic_cast< TypeInstType * >( type ) ) {
    101101                        return type;
     102                } else if ( ArrayType * arrayType = dynamic_cast< ArrayType * >( type ) ) {
     103                        return isPolyType( arrayType->base, env );
    102104                } else if ( StructInstType *structType = dynamic_cast< StructInstType* >( type ) ) {
    103105                        if ( hasPolyParams( structType->get_parameters(), env ) ) return type;
     
    115117                                return type;
    116118                        }
     119                } else if ( ArrayType * arrayType = dynamic_cast< ArrayType * >( type ) ) {
     120                        return isPolyType( arrayType->base, tyVars, env );
    117121                } else if ( StructInstType *structType = dynamic_cast< StructInstType* >( type ) ) {
    118122                        if ( hasPolyParams( structType->get_parameters(), tyVars, env ) ) return type;
     
    367371                        return is<VoidType>( ap->get_base() ) || is<VoidType>( bp->get_base() )
    368372                                || typesPolyCompatible( ap->get_base(), bp->get_base() );
     373                } else if ( aid == type_index{typeid(ReferenceType)} ) {
     374                        ReferenceType *ap = as<ReferenceType>(a), *bp = as<ReferenceType>(b);
     375                        return is<VoidType>( ap->get_base() ) || is<VoidType>( bp->get_base() )
     376                                || typesPolyCompatible( ap->get_base(), bp->get_base() );
    369377                } else if ( aid == type_index{typeid(ArrayType)} ) {
    370378                        ArrayType *aa = as<ArrayType>(a), *ba = as<ArrayType>(b);
  • src/GenPoly/InstantiateGeneric.cc

    rf9feab8 r90152a4  
    2424#include "Common/PassVisitor.h"        // for PassVisitor, WithDeclsToAdd
    2525#include "Common/ScopedMap.h"          // for ScopedMap
    26 #include "Common/SemanticError.h"      // for SemanticError
    2726#include "Common/UniqueName.h"         // for UniqueName
    2827#include "Common/utility.h"            // for deleteAll, cloneAll
     
    476475                        DeclarationWithType * field = strict_dynamic_cast< DeclarationWithType * >( member );
    477476                        MemberExpr * ret = new MemberExpr( field, memberExpr->aggregate->clone() );
     477                        ResolvExpr::adjustExprType( ret->result ); // pointer decay
    478478                        std::swap( ret->env, memberExpr->env );
    479479                        delete memberExpr;
     
    496496        Expression * FixDtypeStatic::fixMemberExpr( AggrInst * inst, MemberExpr * memberExpr ) {
    497497                // need to cast dtype-static member expressions to their actual type before that type is erased.
     498                // NOTE: the casts here have the third argument (isGenerated) set to false so that these casts persist until Box, where they are needed.
    498499                auto & baseParams = *inst->get_baseParameters();
    499500                if ( isDtypeStatic( baseParams ) ) {
     
    515516                                        // Note: this currently creates more temporaries than is strictly necessary, since it does not check for duplicate uses of the same member expression.
    516517                                        static UniqueName tmpNamer( "_dtype_static_member_" );
    517                                         Expression * init = new CastExpr( new AddressExpr( memberExpr ), new PointerType( Type::Qualifiers(), concType->clone() ) );
     518                                        Expression * init = new CastExpr( new AddressExpr( memberExpr ), new PointerType( Type::Qualifiers(), concType->clone() ), false );
    518519                                        ObjectDecl * tmp = ObjectDecl::newObject( tmpNamer.newName(), new ReferenceType( Type::Qualifiers(), concType ), new SingleInit( init ) );
    519520                                        stmtsToAddBefore.push_back( new DeclStmt( tmp ) );
     
    521522                                } else {
    522523                                        // can simply add a cast to actual type
    523                                         return new CastExpr( memberExpr, concType );
     524                                        return new CastExpr( memberExpr, concType, false );
    524525                                }
    525526                        }
  • src/GenPoly/Lvalue.cc

    rf9feab8 r90152a4  
    1818
    1919#include "Common/PassVisitor.h"
    20 #include "Common/SemanticError.h"        // for SemanticError
    2120#include "GenPoly.h"                     // for isPolyType
    2221#include "Lvalue.h"
     
    4645                Expression * mkDeref( Expression * arg ) {
    4746                        if ( SymTab::dereferenceOperator ) {
     47                                // note: reference depth can be arbitrarily deep here, so peel off the outermost pointer/reference, not just pointer because they are effecitvely equivalent in this pass
    4848                                VariableExpr * deref = new VariableExpr( SymTab::dereferenceOperator );
    49                                 deref->set_result( new PointerType( Type::Qualifiers(), deref->get_result() ) );
    50                                 Type * base = InitTweak::getPointerBase( arg->get_result() );
    51                                 assertf( base, "expected pointer type in dereference (type was %s)", toString( arg->get_result() ).c_str() );
     49                                deref->result = new PointerType( Type::Qualifiers(), deref->result );
     50                                Type * base = InitTweak::getPointerBase( arg->result );
     51                                assertf( base, "expected pointer type in dereference (type was %s)", toString( arg->result ).c_str() );
    5252                                ApplicationExpr * ret = new ApplicationExpr( deref, { arg } );
    53                                 delete ret->get_result();
    54                                 ret->set_result( base->clone() );
    55                                 ret->get_result()->set_lvalue( true );
     53                                delete ret->result;
     54                                ret->result = base->clone();
     55                                ret->result->set_lvalue( true );
    5656                                return ret;
    5757                        } else {
     
    6060                }
    6161
    62                 struct ReferenceConversions final {
     62                struct ReferenceConversions final : public WithStmtsToAdd {
    6363                        Expression * postmutate( CastExpr * castExpr );
    6464                        Expression * postmutate( AddressExpr * addrExpr );
     
    9898                };
    9999
    100                 struct AddrRef final : public WithGuards {
     100                struct AddrRef final : public WithGuards, public WithVisitorRef<AddrRef>, public WithShortCircuiting {
    101101                        void premutate( AddressExpr * addrExpr );
    102102                        Expression * postmutate( AddressExpr * addrExpr );
    103103                        void premutate( Expression * expr );
     104                        void premutate( ApplicationExpr * appExpr );
     105                        void premutate( SingleInit * init );
     106
     107                        void handleNonAddr( Expression * );
    104108
    105109                        bool first = true;
    106110                        bool current = false;
    107111                        int refDepth = 0;
     112                        bool addCast = false;
    108113                };
    109114        } // namespace
     
    115120        }
    116121
    117         void convertLvalue( std::list< Declaration* >& translationUnit ) {
     122        void convertLvalue( std::list< Declaration* > & translationUnit ) {
    118123                PassVisitor<ReferenceConversions> refCvt;
    119124                PassVisitor<ReferenceTypeElimination> elim;
     
    141146
    142147        namespace {
    143                 // true for intrinsic function calls that return a reference
     148                // true for intrinsic function calls that return an lvalue in C
    144149                bool isIntrinsicReference( Expression * expr ) {
     150                        // known intrinsic-reference prelude functions
     151                        static std::set<std::string> lvalueFunctions = { "*?", "?[?]" };
    145152                        if ( UntypedExpr * untyped = dynamic_cast< UntypedExpr * >( expr ) ) {
    146153                                std::string fname = InitTweak::getFunctionName( untyped );
    147                                 // known intrinsic-reference prelude functions
    148                                 return fname == "*?" || fname == "?[?]";
     154                                return lvalueFunctions.count(fname);
    149155                        } else if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * > ( expr ) ) {
    150156                                if ( DeclarationWithType * func = InitTweak::getFunction( appExpr ) ) {
    151                                         // use type of return variable rather than expr result type, since it may have been changed to a pointer type
    152                                         FunctionType * ftype = GenPoly::getFunctionType( func->get_type() );
    153                                         Type * ret = ftype->get_returnVals().empty() ? nullptr : ftype->get_returnVals().front()->get_type();
    154                                         return func->get_linkage() == LinkageSpec::Intrinsic && dynamic_cast<ReferenceType *>( ret );
     157                                        return func->linkage == LinkageSpec::Intrinsic && lvalueFunctions.count(func->name);
    155158                                }
    156159                        }
     
    161164                        if ( isIntrinsicReference( appExpr ) ) {
    162165                                // eliminate reference types from intrinsic applications - now they return lvalues
    163                                 Type * result = appExpr->get_result();
    164                                 appExpr->set_result( result->stripReferences()->clone() );
    165                                 appExpr->get_result()->set_lvalue( true );
     166                                ReferenceType * result = strict_dynamic_cast< ReferenceType * >( appExpr->result );
     167                                appExpr->result = result->base->clone();
     168                                appExpr->result->set_lvalue( true );
    166169                                if ( ! inIntrinsic ) {
    167170                                        // when not in an intrinsic function, add a cast to
    168171                                        // don't add cast when in an intrinsic function, since they already have the cast
    169172                                        Expression * ret = new CastExpr( appExpr, result );
    170                                         ret->set_env( appExpr->get_env() );
    171                                         appExpr->set_env( nullptr );
     173                                        std::swap( ret->env, appExpr->env );
    172174                                        return ret;
    173175                                }
     
    179181                void FixIntrinsicResult::premutate( FunctionDecl * funcDecl ) {
    180182                        GuardValue( inIntrinsic );
    181                         inIntrinsic =  funcDecl->linkage == LinkageSpec::Intrinsic;
     183                        inIntrinsic = funcDecl->linkage == LinkageSpec::Intrinsic;
    182184                }
    183185
     
    188190                                assertf( ftype, "Function declaration does not have function type." );
    189191                                // can be of differing lengths only when function is variadic
    190                                 assertf( ftype->get_parameters().size() == appExpr->get_args().size() || ftype->get_isVarArgs(), "ApplicationExpr args do not match formal parameter type." );
     192                                assertf( ftype->parameters.size() == appExpr->args.size() || ftype->isVarArgs, "ApplicationExpr args do not match formal parameter type." );
    191193
    192194
    193195                                unsigned int i = 0;
    194                                 const unsigned int end = ftype->get_parameters().size();
    195                                 for ( auto p : unsafe_group_iterate( appExpr->get_args(), ftype->get_parameters() ) ) {
     196                                const unsigned int end = ftype->parameters.size();
     197                                for ( auto p : unsafe_group_iterate( appExpr->args, ftype->parameters ) ) {
    196198                                        if (i == end) break;
    197199                                        Expression *& arg = std::get<0>( p );
     
    199201                                        PRINT(
    200202                                                std::cerr << "pair<0>: " << arg << std::endl;
     203                                                std::cerr << " -- " << arg->result << std::endl;
    201204                                                std::cerr << "pair<1>: " << formal << std::endl;
    202205                                        )
    203206                                        if ( dynamic_cast<ReferenceType*>( formal ) ) {
    204                                                 if ( isIntrinsicReference( arg ) ) { // do not combine conditions, because that changes the meaning of the else if
    205                                                         if ( function->get_linkage() != LinkageSpec::Intrinsic ) { // intrinsic functions that turn pointers into references
    206                                                                 // if argument is dereference or array subscript, the result isn't REALLY a reference, so it's not necessary to fix the argument
    207                                                                 PRINT(
    208                                                                         std::cerr << "===is intrinsic arg in non-intrinsic call - adding address" << std::endl;
    209                                                                 )
    210                                                                 arg = new AddressExpr( arg );
    211                                                         }
    212                                                 } else if ( function->get_linkage() == LinkageSpec::Intrinsic ) {
    213                                                         // std::cerr << "===adding deref to arg" << std::endl;
    214                                                         // if the parameter is a reference, add a dereference to the reference-typed argument.
    215                                                         Type * baseType = InitTweak::getPointerBase( arg->get_result() );
    216                                                         assertf( baseType, "parameter is reference, arg must be pointer or reference: %s", toString( arg->get_result() ).c_str() );
     207                                                PRINT(
     208                                                        std::cerr << "===formal is reference" << std::endl;
     209                                                )
     210                                                // TODO: it's likely that the second condition should be ... && ! isIntrinsicReference( arg ), but this requires investigation.
     211
     212                                                if ( function->linkage != LinkageSpec::Intrinsic && isIntrinsicReference( arg ) ) {
     213                                                        // needed for definition of prelude functions, etc.
     214                                                        // if argument is dereference or array subscript, the result isn't REALLY a reference, but non-intrinsic functions expect a reference: take address
     215
     216                                                        // NOTE: previously, this condition fixed
     217                                                        //   void f(int *&);
     218                                                        //   int & x = ...;
     219                                                        //   f(&x);
     220                                                        // But now this is taken care of by a reference cast added by AddrRef. Need to find a new
     221                                                        // example or remove this branch.
     222
     223                                                        PRINT(
     224                                                                std::cerr << "===is intrinsic arg in non-intrinsic call - adding address" << std::endl;
     225                                                        )
     226                                                        arg = new AddressExpr( arg );
     227                                                // } else if ( function->get_linkage() == LinkageSpec::Intrinsic && InitTweak::getPointerBase( arg->result ) ) {
     228                                                } else if ( function->linkage == LinkageSpec::Intrinsic && arg->result->referenceDepth() != 0 ) {
     229                                                        // argument is a 'real' reference, but function expects a C lvalue: add a dereference to the reference-typed argument
     230                                                        PRINT(
     231                                                                std::cerr << "===is non-intrinsic arg in intrinsic call - adding deref to arg" << std::endl;
     232                                                        )
     233                                                        Type * baseType = InitTweak::getPointerBase( arg->result );
     234                                                        assertf( baseType, "parameter is reference, arg must be pointer or reference: %s", toString( arg->result ).c_str() );
    217235                                                        PointerType * ptrType = new PointerType( Type::Qualifiers(), baseType->clone() );
    218                                                         delete arg->get_result();
    219                                                         arg->set_result( ptrType );
     236                                                        delete arg->result;
     237                                                        arg->result = ptrType;
    220238                                                        arg = mkDeref( arg );
     239                                                        // assertf( arg->result->referenceDepth() == 0, "Reference types should have been eliminated from intrinsic function calls, but weren't: %s", toCString( arg->result ) );
    221240                                                }
    222241                                        }
     
    228247
    229248                // idea: &&&E: get outer &, inner &
    230                 // at inner &, record depth D of reference type
     249                // at inner &, record depth D of reference type of argument of &
    231250                // at outer &, add D derefs.
    232                 void AddrRef::premutate( Expression * ) {
     251                void AddrRef::handleNonAddr( Expression * ) {
     252                        // non-address-of: reset status variables:
     253                        // * current expr is NOT the first address-of expr in an address-of chain
     254                        // * next seen address-of expr IS the first in the chain.
    233255                        GuardValue( current );
    234256                        GuardValue( first );
     
    237259                }
    238260
     261                void AddrRef::premutate( Expression * expr ) {
     262                        handleNonAddr( expr );
     263                        GuardValue( addCast );
     264                        addCast = false;
     265                }
     266
    239267                void AddrRef::premutate( AddressExpr * ) {
    240268                        GuardValue( current );
    241269                        GuardValue( first );
    242                         current = first;
    243                         first = false;
    244                         if ( current ) {
     270                        current = first; // is this the first address-of in the chain?
     271                        first = false;   // from here out, no longer possible for next address-of to be first in chain
     272                        if ( current ) { // this is the outermost address-of in a chain
    245273                                GuardValue( refDepth );
    246                                 refDepth = 0;
     274                                refDepth = 0;  // set depth to 0 so that postmutate can find the innermost address-of easily
    247275                        }
    248276                }
    249277
    250278                Expression * AddrRef::postmutate( AddressExpr * addrExpr ) {
     279                        PRINT( std::cerr << "addr ref at " << addrExpr << std::endl; )
    251280                        if ( refDepth == 0 ) {
    252                                 if ( ! isIntrinsicReference( addrExpr->get_arg() ) ) {
     281                                PRINT( std::cerr << "depth 0, get new depth..." << std::endl; )
     282                                // this is the innermost address-of in a chain, record depth D
     283                                if ( ! isIntrinsicReference( addrExpr->arg ) ) {
    253284                                        // try to avoid ?[?]
    254                                         refDepth = addrExpr->get_arg()->get_result()->referenceDepth();
    255                                 }
    256                         }
    257                         if ( current ) {
     285                                        // xxx - is this condition still necessary? intrinsicReferences should have a cast around them at this point, so I don't think this condition ever fires.
     286                                        refDepth = addrExpr->arg->result->referenceDepth();
     287                                        PRINT( std::cerr << "arg not intrinsic reference, new depth is: " << refDepth << std::endl; )
     288                                } else {
     289                                        assertf( false, "AddrRef : address-of should not have intrinsic reference argument: %s", toCString( addrExpr->arg ) );
     290                                }
     291                        }
     292                        if ( current ) { // this is the outermost address-of in a chain
     293                                PRINT( std::cerr << "current, depth is: " << refDepth << std::endl; )
    258294                                Expression * ret = addrExpr;
    259295                                while ( refDepth ) {
     296                                        // add one dereference for each
    260297                                        ret = mkDeref( ret );
    261298                                        refDepth--;
    262299                                }
     300
     301                                // if addrExpr depth is 0, then the result is a pointer because the arg was depth 1 and not lvalue.
     302                                // This means the dereference result is not a reference, is lvalue, and one less pointer depth than
     303                                // the addrExpr. Thus the cast is meaningless.
     304                                // TODO: One thing to double check is whether it is possible for the types to differ outside of the single
     305                                // pointer level (i.e. can the base type of addrExpr differ from the type of addrExpr-arg?).
     306                                // If so then the cast might need to be added, conditional on a more sophisticated check.
     307                                if ( addCast && addrExpr->result->referenceDepth() != 0 ) {
     308                                        PRINT( std::cerr << "adding cast to " << addrExpr->result << std::endl; )
     309                                        return new CastExpr( ret, addrExpr->result->clone() );
     310                                }
    263311                                return ret;
    264312                        }
     313                        PRINT( std::cerr << "not current..." << std::endl; )
    265314                        return addrExpr;
    266315                }
     316
     317                void AddrRef::premutate( ApplicationExpr * appExpr ) {
     318                        visit_children = false;
     319                        GuardValue( addCast );
     320                        handleNonAddr( appExpr );
     321                        for ( Expression *& arg : appExpr->args ) {
     322                                // each argument with address-of requires a cast
     323                                addCast = true;
     324                                arg = arg->acceptMutator( *visitor );
     325                        }
     326                }
     327
     328                void AddrRef::premutate( SingleInit * ) {
     329                        GuardValue( addCast );
     330                        // each initialization context with address-of requires a cast
     331                        addCast = true;
     332                }
     333
    267334
    268335                Expression * ReferenceConversions::postmutate( AddressExpr * addrExpr ) {
     
    281348                        // pointer casts in the right places.
    282349
    283                         // conversion to reference type
    284                         if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( castExpr->get_result() ) ) {
    285                                 (void)refType;
    286                                 if ( ReferenceType * otherRef = dynamic_cast< ReferenceType * >( castExpr->get_arg()->get_result() ) ) {
    287                                         // nothing to do if casting from reference to reference.
    288                                         (void)otherRef;
    289                                         PRINT( std::cerr << "convert reference to reference -- nop" << std::endl; )
    290                                         if ( isIntrinsicReference( castExpr->get_arg() ) ) {
    291                                                 Expression * callExpr = castExpr->get_arg();
    292                                                 PRINT(
    293                                                         std::cerr << "but arg is deref -- &" << std::endl;
    294                                                         std::cerr << callExpr << std::endl;
    295                                                 )
    296                                                 callExpr = new AddressExpr( callExpr ); // this doesn't work properly for multiple casts
    297                                                 delete callExpr->get_result();
    298                                                 callExpr->set_result( refType->clone() );
    299                                                 // move environment out to new top-level
    300                                                 callExpr->set_env( castExpr->get_env() );
    301                                                 castExpr->set_arg( nullptr );
    302                                                 castExpr->set_env( nullptr );
    303                                                 delete castExpr;
    304                                                 return callExpr;
    305                                         }
    306                                         int depth1 = refType->referenceDepth();
    307                                         int depth2 = otherRef->referenceDepth();
    308                                         int diff = depth1-depth2;
    309                                         if ( diff == 0 ) {
    310                                                 assertf( depth1 == depth2, "non-intrinsic reference with cast of reference to reference not yet supported: %d %d %s", depth1, depth2, toString( castExpr ).c_str() );
    311                                                 PRINT( std::cerr << castExpr << std::endl; )
    312                                                 return castExpr;
    313                                         } else if ( diff < 0 ) {
    314                                                 Expression * ret = castExpr->get_arg();
    315                                                 for ( int i = 0; i < diff; ++i ) {
    316                                                         ret = mkDeref( ret );
    317                                                 }
    318                                                 ret->set_env( castExpr->get_env() );
    319                                                 delete ret->get_result();
    320                                                 ret->set_result( castExpr->get_result() );
    321                                                 castExpr->set_env( nullptr );
    322                                                 castExpr->set_arg( nullptr );
    323                                                 castExpr->set_result( nullptr );
    324                                                 delete castExpr;
    325                                                 return ret;
    326                                         } else if ( diff > 0 ) {
    327                                                 Expression * ret = castExpr->get_arg();
    328                                                 for ( int i = 0; i < diff; ++i ) {
    329                                                         ret = new AddressExpr( ret );
    330                                                 }
    331                                                 ret->set_env( castExpr->get_env() );
    332                                                 delete ret->get_result();
    333                                                 ret->set_result( castExpr->get_result() );
    334                                                 castExpr->set_env( nullptr );
    335                                                 castExpr->set_arg( nullptr );
    336                                                 castExpr->set_result( nullptr );
    337                                                 delete castExpr;
    338                                                 return ret;
    339                                         }
    340 
    341                                         assertf( depth1 == depth2, "non-intrinsic reference with cast of reference to reference not yet supported: %d %d %s", depth1, depth2, toString( castExpr ).c_str() );
    342                                         PRINT( std::cerr << castExpr << std::endl; )
     350                        // Note: reference depth difference is the determining factor in what code is run, rather than whether something is
     351                        // reference type or not, since conversion still needs to occur when both types are references that differ in depth.
     352
     353                        Type * destType = castExpr->result;
     354                        Type * srcType = castExpr->arg->result;
     355                        int depth1 = destType->referenceDepth();
     356                        int depth2 = srcType->referenceDepth();
     357                        int diff = depth1 - depth2;
     358
     359                        if ( diff > 0 && ! srcType->get_lvalue() ) {
     360                                // rvalue to reference conversion -- introduce temporary
     361                                // know that reference depth of cast argument is 0, need to introduce n temporaries for reference depth of n, e.g.
     362                                //   (int &&&)3;
     363                                // becomes
     364                                //   int __ref_tmp_0 = 3;
     365                                //   int & __ref_tmp_1 = _&_ref_tmp_0;
     366                                //   int && __ref_tmp_2 = &__ref_tmp_1;
     367                                //   &__ref_tmp_2;
     368                                // the last & comes from the remaining reference conversion code
     369                                SemanticWarning( castExpr->arg->location, Warning::RvalueToReferenceConversion, toCString( castExpr->arg ) );
     370
     371                                static UniqueName tempNamer( "__ref_tmp_" );
     372                                ObjectDecl * temp = ObjectDecl::newObject( tempNamer.newName(), castExpr->arg->result->clone(), new SingleInit( castExpr->arg ) );
     373                                PRINT( std::cerr << "made temp: " << temp << std::endl; )
     374                                stmtsToAddBefore.push_back( new DeclStmt( temp ) );
     375                                for ( int i = 0; i < depth1-1; i++ ) { // xxx - maybe this should be diff-1? check how this works with reference type for srcType
     376                                        ObjectDecl * newTemp = ObjectDecl::newObject( tempNamer.newName(), new ReferenceType( Type::Qualifiers(), temp->type->clone() ), new SingleInit( new AddressExpr( new VariableExpr( temp ) ) ) );
     377                                        PRINT( std::cerr << "made temp" << i << ": " << newTemp << std::endl; )
     378                                        stmtsToAddBefore.push_back( new DeclStmt( newTemp ) );
     379                                        temp = newTemp;
     380                                }
     381                                // update diff so that remaining code works out correctly
     382                                castExpr->arg = new VariableExpr( temp );
     383                                PRINT( std::cerr << "update cast to: " << castExpr << std::endl; )
     384                                srcType = castExpr->arg->result;
     385                                depth2 = srcType->referenceDepth();
     386                                diff = depth1 - depth2;
     387                                assert( diff == 1 );
     388                        }
     389
     390                        // handle conversion between different depths
     391                        PRINT (
     392                                if ( depth1 || depth2 ) {
     393                                        std::cerr << "destType: " << destType << " / srcType: " << srcType << std::endl;
     394                                        std::cerr << "depth: " << depth1 << " / " << depth2 << std::endl;
     395                                }
     396                        )
     397                        if ( diff > 0 ) {
     398                                // conversion to type with more depth (e.g. int & -> int &&): add address-of for each level of difference
     399                                Expression * ret = castExpr->arg;
     400                                for ( int i = 0; i < diff; ++i ) {
     401                                        ret = new AddressExpr( ret );
     402                                }
     403                                if ( srcType->get_lvalue() && ! ResolvExpr::typesCompatible( srcType, strict_dynamic_cast<ReferenceType *>( destType )->base, SymTab::Indexer() ) ) {
     404                                        // must keep cast if cast-to type is different from the actual type
     405                                        castExpr->arg = ret;
    343406                                        return castExpr;
    344                                 } else if ( castExpr->get_arg()->get_result()->get_lvalue() ) {
    345                                         // conversion from lvalue to reference
    346                                         // xxx - keep cast, but turn into pointer cast??
    347                                         // xxx - memory
     407                                }
     408                                ret->env = castExpr->env;
     409                                delete ret->result;
     410                                ret->result = castExpr->result;
     411                                castExpr->env = nullptr;
     412                                castExpr->arg = nullptr;
     413                                castExpr->result = nullptr;
     414                                delete castExpr;
     415                                return ret;
     416                        } else if ( diff < 0 ) {
     417                                // conversion to type with less depth (e.g. int && -> int &): add dereferences for each level of difference
     418                                diff = -diff; // care only about magnitude now
     419                                Expression * ret = castExpr->arg;
     420                                for ( int i = 0; i < diff; ++i ) {
     421                                        ret = mkDeref( ret );
     422                                        // xxx - try removing one reference here? actually, looks like mkDeref already does this, so more closely look at the types generated.
     423                                }
     424                                if ( ! ResolvExpr::typesCompatibleIgnoreQualifiers( destType->stripReferences(), srcType->stripReferences(), SymTab::Indexer() ) ) {
     425                                        // must keep cast if types are different
     426                                        castExpr->arg = ret;
     427                                        return castExpr;
     428                                }
     429                                ret->env = castExpr->env;
     430                                delete ret->result;
     431                                ret->result = castExpr->result;
     432                                ret->result->set_lvalue( true ); // ensure result is lvalue
     433                                castExpr->env = nullptr;
     434                                castExpr->arg = nullptr;
     435                                castExpr->result = nullptr;
     436                                delete castExpr;
     437                                return ret;
     438                        } else {
     439                                assert( diff == 0 );
     440                                // conversion between references of the same depth
     441                                if ( ResolvExpr::typesCompatible( castExpr->result, castExpr->arg->result, SymTab::Indexer() ) && castExpr->isGenerated ) {
     442                                        // Remove useless generated casts
    348443                                        PRINT(
    349                                                 std::cerr << "convert lvalue to reference -- &" << std::endl;
    350                                                 std::cerr << castExpr->get_arg() << std::endl;
     444                                                std::cerr << "types are compatible, removing cast: " << castExpr << std::endl;
     445                                                std::cerr << "-- " << castExpr->result << std::endl;
     446                                                std::cerr << "-- " << castExpr->arg->result << std::endl;
    351447                                        )
    352                                         AddressExpr * ret = new AddressExpr( castExpr->get_arg() );
    353                                         if ( refType->get_base()->get_qualifiers() != castExpr->get_arg()->get_result()->get_qualifiers() ) {
    354                                                 // must keep cast if cast-to type is different from the actual type
    355                                                 castExpr->set_arg( ret );
    356                                                 return castExpr;
    357                                         }
    358                                         ret->set_env( castExpr->get_env() );
    359                                         delete ret->get_result();
    360                                         ret->set_result( castExpr->get_result() );
    361                                         castExpr->set_env( nullptr );
    362                                         castExpr->set_arg( nullptr );
    363                                         castExpr->set_result( nullptr );
     448                                        Expression * ret = castExpr->arg;
     449                                        castExpr->arg = nullptr;
     450                                        std::swap( castExpr->env, ret->env );
    364451                                        delete castExpr;
    365452                                        return ret;
    366                                 } else {
    367                                         // rvalue to reference conversion -- introduce temporary
    368                                 }
    369                                 assertf( false, "Only conversions to reference from lvalue are currently supported: %s", toString( castExpr ).c_str() );
    370                         } else if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( castExpr->get_arg()->get_result() ) ) {
    371                                 (void)refType;
    372                                 // conversion from reference to rvalue
    373                                 PRINT(
    374                                         std::cerr << "convert reference to rvalue -- *" << std::endl;
    375                                         std::cerr << "was = " << castExpr << std::endl;
    376                                 )
    377                                 Expression * ret = castExpr->get_arg();
    378                                 TypeSubstitution * env = castExpr->get_env();
    379                                 castExpr->set_env( nullptr );
    380                                 if ( ! isIntrinsicReference( ret ) ) {
    381                                         // dereference if not already dereferenced
    382                                         ret = mkDeref( ret );
    383                                 }
    384                                 if ( ResolvExpr::typesCompatibleIgnoreQualifiers( castExpr->get_result(), castExpr->get_arg()->get_result()->stripReferences(), SymTab::Indexer() ) ) {
    385                                         // can remove cast if types are compatible, changing expression type to value type
    386                                         ret->set_result( castExpr->get_result()->clone() );
    387                                         castExpr->set_arg( nullptr );
    388                                         delete castExpr;
    389                                 } else {
    390                                         // must keep cast if types are different
    391                                         castExpr->set_arg( ret );
    392                                         ret = castExpr;
    393                                 }
    394                                 ret->set_env( env );
    395                                 PRINT( std::cerr << "now: " << ret << std::endl; )
    396                                 return ret;
    397                         }
    398                         return castExpr;
     453                                }
     454                                return castExpr;
     455                        }
    399456                }
    400457
    401458                Type * ReferenceTypeElimination::postmutate( ReferenceType * refType ) {
    402                         Type * base = refType->get_base();
     459                        Type * base = refType->base;
    403460                        Type::Qualifiers qualifiers = refType->get_qualifiers();
    404                         refType->set_base( nullptr );
     461                        refType->base = nullptr;
    405462                        delete refType;
    406463                        return new PointerType( qualifiers, base );
     
    410467                Expression * GeneralizedLvalue::applyTransformation( Expression * expr, Expression * arg, Func mkExpr ) {
    411468                        if ( CommaExpr * commaExpr = dynamic_cast< CommaExpr * >( arg ) ) {
    412                                 Expression * arg1 = commaExpr->get_arg1()->clone();
    413                                 Expression * arg2 = commaExpr->get_arg2()->clone();
     469                                Expression * arg1 = commaExpr->arg1->clone();
     470                                Expression * arg2 = commaExpr->arg2->clone();
    414471                                Expression * ret = new CommaExpr( arg1, mkExpr( arg2 )->acceptMutator( *visitor ) );
    415                                 ret->set_env( expr->get_env() );
    416                                 expr->set_env( nullptr );
     472                                ret->env = expr->env;
     473                                expr->env = nullptr;
    417474                                delete expr;
    418475                                return ret;
    419476                        } else if ( ConditionalExpr * condExpr = dynamic_cast< ConditionalExpr * >( arg ) ) {
    420                                 Expression * arg1 = condExpr->get_arg1()->clone();
    421                                 Expression * arg2 = condExpr->get_arg2()->clone();
    422                                 Expression * arg3 = condExpr->get_arg3()->clone();
     477                                Expression * arg1 = condExpr->arg1->clone();
     478                                Expression * arg2 = condExpr->arg2->clone();
     479                                Expression * arg3 = condExpr->arg3->clone();
    423480                                ConditionalExpr * ret = new ConditionalExpr( arg1, mkExpr( arg2 )->acceptMutator( *visitor ), mkExpr( arg3 )->acceptMutator( *visitor ) );
    424                                 ret->set_env( expr->get_env() );
    425                                 expr->set_env( nullptr );
     481                                ret->env = expr->env;
     482                                expr->env = nullptr;
    426483                                delete expr;
    427484
     
    432489                                AssertionSet needAssertions, haveAssertions;
    433490                                OpenVarSet openVars;
    434                                 unify( ret->get_arg2()->get_result(), ret->get_arg3()->get_result(), newEnv, needAssertions, haveAssertions, openVars, SymTab::Indexer(), commonType );
    435                                 ret->set_result( commonType ? commonType : ret->get_arg2()->get_result()->clone() );
     491                                unify( ret->arg2->result, ret->arg3->result, newEnv, needAssertions, haveAssertions, openVars, SymTab::Indexer(), commonType );
     492                                ret->result = commonType ? commonType : ret->arg2->result->clone();
    436493                                return ret;
    437494                        }
     
    440497
    441498                Expression * GeneralizedLvalue::postmutate( MemberExpr * memExpr ) {
    442                         return applyTransformation( memExpr, memExpr->get_aggregate(), [=]( Expression * aggr ) { return new MemberExpr( memExpr->get_member(), aggr ); } );
     499                        return applyTransformation( memExpr, memExpr->aggregate, [=]( Expression * aggr ) { return new MemberExpr( memExpr->member, aggr ); } );
    443500                }
    444501
    445502                Expression * GeneralizedLvalue::postmutate( AddressExpr * addrExpr ) {
    446                         return applyTransformation( addrExpr, addrExpr->get_arg(), []( Expression * arg ) { return new AddressExpr( arg ); } );
     503                        return applyTransformation( addrExpr, addrExpr->arg, []( Expression * arg ) { return new AddressExpr( arg ); } );
    447504                }
    448505
    449506                Expression * CollapseAddrDeref::postmutate( AddressExpr * addrExpr ) {
    450                         Expression * arg = addrExpr->get_arg();
     507                        Expression * arg = addrExpr->arg;
    451508                        if ( isIntrinsicReference( arg ) ) {
    452509                                std::string fname = InitTweak::getFunctionName( arg );
     
    454511                                        Expression *& arg0 = InitTweak::getCallArg( arg, 0 );
    455512                                        Expression * ret = arg0;
    456                                         ret->set_env( addrExpr->get_env() );
     513                                        ret->set_env( addrExpr->env );
    457514                                        arg0 = nullptr;
    458                                         addrExpr->set_env( nullptr );
     515                                        addrExpr->env = nullptr;
    459516                                        delete addrExpr;
    460517                                        return ret;
     518                                }
     519                        } else if ( CastExpr * castExpr = dynamic_cast< CastExpr * > ( arg ) ) {
     520                                // need to move cast to pointer type out a level since address of pointer
     521                                // is not valid C code (can be introduced in prior passes, e.g., InstantiateGeneric)
     522                                if ( InitTweak::getPointerBase( castExpr->result ) ) {
     523                                        addrExpr->arg = castExpr->arg;
     524                                        castExpr->arg = addrExpr;
     525                                        castExpr->result = new PointerType( Type::Qualifiers(), castExpr->result );
     526                                        return castExpr;
    461527                                }
    462528                        }
     
    474540                                        // }
    475541                                        if ( AddressExpr * addrExpr = dynamic_cast< AddressExpr * >( arg ) ) {
    476                                                 Expression * ret = addrExpr->get_arg();
    477                                                 ret->set_env( appExpr->get_env() );
    478                                                 addrExpr->set_arg( nullptr );
    479                                                 appExpr->set_env( nullptr );
     542                                                Expression * ret = addrExpr->arg;
     543                                                ret->env = appExpr->env;
     544                                                addrExpr->arg = nullptr;
     545                                                appExpr->env = nullptr;
    480546                                                delete appExpr;
    481547                                                return ret;
  • src/GenPoly/ScrubTyVars.cc

    rf9feab8 r90152a4  
    2525
    2626namespace GenPoly {
    27         Type * ScrubTyVars::mutate( TypeInstType *typeInst ) {
     27        Type * ScrubTyVars::postmutate( TypeInstType * typeInst ) {
    2828                if ( ! tyVars ) {
    2929                        if ( typeInst->get_isFtype() ) {
     
    3131                                return new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) );
    3232                        } else {
    33                                 PointerType *ret = new PointerType( Type::Qualifiers(), new VoidType( typeInst->get_qualifiers() ) );
     33                                PointerType * ret = new PointerType( Type::Qualifiers(), new VoidType( typeInst->get_qualifiers() ) );
    3434                                delete typeInst;
    3535                                return ret;
     
    3737                }
    3838
    39                 TyVarMap::const_iterator tyVar = tyVars->find( typeInst->get_name() );
     39                TyVarMap::const_iterator tyVar = tyVars->find( typeInst->name );
    4040                if ( tyVar != tyVars->end() ) {
    4141                        switch ( tyVar->second.kind ) {
     
    4343                          case TypeDecl::Ttype:
    4444                                {
    45                                         PointerType *ret = new PointerType( Type::Qualifiers(), new VoidType( typeInst->get_qualifiers() ) );
     45                                        PointerType * ret = new PointerType( Type::Qualifiers(), new VoidType( typeInst->get_qualifiers() ) );
    4646                                        delete typeInst;
    4747                                        return ret;
     
    5050                                delete typeInst;
    5151                                return new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) );
     52                          default:
     53                                assertf(false, "Unhandled tyvar kind: %d", tyVar->second.kind);
    5254                        } // switch
    5355                } // if
     
    5557        }
    5658
    57         Type * ScrubTyVars::mutateAggregateType( Type *ty ) {
     59        Type * ScrubTyVars::mutateAggregateType( Type * ty ) {
    5860                if ( shouldScrub( ty ) ) {
    59                         PointerType *ret = new PointerType( Type::Qualifiers(), new VoidType( ty->get_qualifiers() ) );
     61                        PointerType * ret = new PointerType( Type::Qualifiers(), new VoidType( ty->get_qualifiers() ) );
    6062                        delete ty;
    6163                        return ret;
     
    6466        }
    6567
    66         Type * ScrubTyVars::mutate( StructInstType *structInst ) {
     68        Type * ScrubTyVars::postmutate( StructInstType * structInst ) {
    6769                return mutateAggregateType( structInst );
    6870        }
    6971
    70         Type * ScrubTyVars::mutate( UnionInstType *unionInst ) {
     72        Type * ScrubTyVars::postmutate( UnionInstType * unionInst ) {
    7173                return mutateAggregateType( unionInst );
    7274        }
    7375
    74         Expression * ScrubTyVars::mutate( SizeofExpr *szeof ) {
     76        void ScrubTyVars::primeBaseScrub( Type * type ) {
     77                // need to determine whether type needs to be scrubbed to determine whether
     78                // automatic recursion is necessary
     79                if ( Type * t = shouldScrub( type ) ) {
     80                        visit_children = false;
     81                        GuardValue( dynType );
     82                        dynType = t;
     83                }
     84        }
     85
     86        Expression * ScrubTyVars::postmutate( SizeofExpr * szeof ) {
    7587                // sizeof( T ) => _sizeof_T parameter, which is the size of T
    76                 if ( Type *dynType = shouldScrub( szeof->get_type() ) ) {
     88                if ( dynType ) {
    7789                        Expression *expr = new NameExpr( sizeofName( mangleType( dynType ) ) );
    7890                        return expr;
    79                 } else {
    80                         return Mutator::mutate( szeof );
    8191                } // if
     92                return szeof;
    8293        }
    8394
    84         Expression * ScrubTyVars::mutate( AlignofExpr *algnof ) {
     95        Expression * ScrubTyVars::postmutate( AlignofExpr * algnof ) {
    8596                // alignof( T ) => _alignof_T parameter, which is the alignment of T
    86                 if ( Type *dynType = shouldScrub( algnof->get_type() ) ) {
     97                if ( dynType ) {
    8798                        Expression *expr = new NameExpr( alignofName( mangleType( dynType ) ) );
    8899                        return expr;
    89                 } else {
    90                         return Mutator::mutate( algnof );
    91100                } // if
     101                return algnof;
    92102        }
    93103
    94         Type * ScrubTyVars::mutate( PointerType *pointer ) {
    95 //              // special case of shouldScrub that takes all TypeInstType pointer bases, even if they're not dynamic
    96 //              Type *base = pointer->get_base();
    97 //              Type *dynType = 0;
    98 //              if ( dynamicOnly ) {
    99 //                      if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( base ) ) {
    100 //                              if ( tyVars.find( typeInst->get_name() ) != tyVars.end() ) { dynType = typeInst; }
    101 //                      } else {
    102 //                              dynType = isDynType( base, tyVars );
    103 //                      }
    104 //              } else {
    105 //                      dynType = isPolyType( base, tyVars );
    106 //              }
    107 //              if ( dynType ) {
    108                 if ( Type *dynType = shouldScrub( pointer->get_base() ) ) {
    109                         Type *ret = dynType->acceptMutator( *this );
     104        Type * ScrubTyVars::postmutate( PointerType * pointer ) {
     105                if ( dynType ) {
     106                        Type * ret = dynType->acceptMutator( *visitor );
    110107                        ret->get_qualifiers() |= pointer->get_qualifiers();
    111                         pointer->set_base( 0 );
     108                        pointer->base = nullptr;
    112109                        delete pointer;
    113110                        return ret;
    114111                }
    115                 return Mutator::mutate( pointer );
     112                return pointer;
    116113        }
    117114} // namespace GenPoly
  • src/GenPoly/ScrubTyVars.h

    rf9feab8 r90152a4  
    1818#include <cassert>            // for assert
    1919
     20#include "Common/PassVisitor.h"
    2021#include "GenPoly.h"          // for TyVarMap, isPolyType, isDynType
    2122#include "SynTree/Mutator.h"  // for Mutator
     
    2728
    2829namespace GenPoly {
    29         class ScrubTyVars : public Mutator {
     30        struct ScrubTyVars : public WithVisitorRef<ScrubTyVars>, public WithShortCircuiting, public WithGuards {
    3031                /// Whether to scrub all type variables from the provided map, dynamic type variables from the provided map, or all type variables
    3132                enum ScrubMode { FromMap, DynamicFromMap, All };
     
    5152                static SynTreeClass *scrubAll( SynTreeClass *target );
    5253
    53                 virtual Type* mutate( TypeInstType *typeInst );
    54                 virtual Type* mutate( StructInstType *structInst );
    55                 virtual Type* mutate( UnionInstType *unionInst );
    56                 virtual Expression* mutate( SizeofExpr *szeof );
    57                 virtual Expression* mutate( AlignofExpr *algnof );
    58                 virtual Type* mutate( PointerType *pointer );
     54                /// determine if children should be visited based on whether base type should be scrubbed.
     55                void primeBaseScrub( Type * );
     56
     57                void premutate( TypeInstType * ) { visit_children = false; }
     58                void premutate( StructInstType * ) { visit_children = false; }
     59                void premutate( UnionInstType * ) { visit_children = false; }
     60                void premutate( SizeofExpr * szeof ) { primeBaseScrub( szeof->type ); }
     61                void premutate( AlignofExpr * algnof ) { primeBaseScrub( algnof->type ); }
     62                void premutate( PointerType * pointer ) { primeBaseScrub( pointer->base ); }
     63
     64                Type * postmutate( TypeInstType * typeInst );
     65                Type * postmutate( StructInstType * structInst );
     66                Type * postmutate( UnionInstType * unionInst );
     67                Expression * postmutate( SizeofExpr * szeof );
     68                Expression * postmutate( AlignofExpr * algnof );
     69                Type * postmutate( PointerType * pointer );
    5970
    6071          private:
     
    7586                const TyVarMap *tyVars;  ///< Type variables to scrub
    7687                ScrubMode mode;          ///< which type variables to scrub? [FromMap]
     88
     89                Type * dynType = nullptr; ///< result of shouldScrub
    7790        };
    7891
    7992        template< typename SynTreeClass >
    8093        SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) {
    81                 ScrubTyVars scrubber( tyVars );
     94                PassVisitor<ScrubTyVars> scrubber( tyVars );
    8295                return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
    8396        }
     
    8598        template< typename SynTreeClass >
    8699        SynTreeClass * ScrubTyVars::scrubDynamic( SynTreeClass *target, const TyVarMap &tyVars ) {
    87                 ScrubTyVars scrubber( tyVars, ScrubTyVars::DynamicFromMap );
     100                PassVisitor<ScrubTyVars> scrubber( tyVars, ScrubTyVars::DynamicFromMap );
    88101                return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
    89102        }
     
    91104        template< typename SynTreeClass >
    92105        SynTreeClass * ScrubTyVars::scrubAll( SynTreeClass *target ) {
    93                 ScrubTyVars scrubber;
     106                PassVisitor<ScrubTyVars> scrubber;
    94107                return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
    95108        }
  • src/GenPoly/Specialize.cc

    rf9feab8 r90152a4  
    2323
    2424#include "Common/PassVisitor.h"
    25 #include "Common/SemanticError.h"        // for SemanticError
    2625#include "Common/UniqueName.h"           // for UniqueName
    2726#include "Common/utility.h"              // for group_iterate
     
    201200        }
    202201
    203         struct EnvTrimmer {
    204                 TypeSubstitution * env, * newEnv;
    205                 EnvTrimmer( TypeSubstitution * env, TypeSubstitution * newEnv ) : env( env ), newEnv( newEnv ){}
    206                 void previsit( TypeDecl * tyDecl ) {
    207                         // transfer known bindings for seen type variables
    208                         if ( Type * t = env->lookup( tyDecl->name ) ) {
    209                                 newEnv->add( tyDecl->name, t );
    210                         }
    211                 }
    212         };
    213 
    214         /// reduce environment to just the parts that are referenced in a given expression
    215         TypeSubstitution * trimEnv( ApplicationExpr * expr, TypeSubstitution * env ) {
    216                 if ( env ) {
    217                         TypeSubstitution * newEnv = new TypeSubstitution();
    218                         PassVisitor<EnvTrimmer> trimmer( env, newEnv );
    219                         expr->accept( trimmer );
    220                         return newEnv;
    221                 }
    222                 return nullptr;
    223         }
    224 
    225202        /// Generates a thunk that calls `actual` with type `funType` and returns its address
    226203        Expression * Specialize::createThunkFunction( FunctionType *funType, Expression *actual, InferredParams *inferParams ) {
     
    266243                }
    267244
    268                 appExpr->set_env( trimEnv( appExpr, env ) );
     245                appExpr->env = TypeSubstitution::newFromExpr( appExpr, env );
    269246                if ( inferParams ) {
    270247                        appExpr->get_inferParams() = *inferParams;
  • src/InitTweak/FixGlobalInit.cc

    rf9feab8 r90152a4  
    2121
    2222#include "Common/PassVisitor.h"
    23 #include "Common/SemanticError.h"  // for SemanticError
    2423#include "Common/UniqueName.h"     // for UniqueName
    2524#include "InitTweak.h"             // for isIntrinsicSingleArgCallStmt
     
    3837        class GlobalFixer : public WithShortCircuiting {
    3938          public:
    40                 GlobalFixer( const std::string & name, bool inLibrary );
     39                GlobalFixer( bool inLibrary );
    4140
    4241                void previsit( ObjectDecl *objDecl );
     
    5352        };
    5453
    55         void fixGlobalInit( std::list< Declaration * > & translationUnit, const std::string & name, bool inLibrary ) {
    56                 PassVisitor<GlobalFixer> visitor( name, inLibrary );
     54        void fixGlobalInit( std::list< Declaration * > & translationUnit, bool inLibrary ) {
     55                PassVisitor<GlobalFixer> visitor( inLibrary );
    5756                acceptAll( translationUnit, visitor );
    5857                GlobalFixer & fixer = visitor.pass;
     
    7170        }
    7271
    73   std::string globalFunctionName( const std::string & name ) {
    74         // get basename
    75         std::string ret = name.substr( 0, name.find( '.' ) );
    76         // replace invalid characters with _
    77                 static std::string invalid = "/-";
    78         replace_if( ret.begin(), ret.end(), []( char c ) { return invalid.find(c) != std::string::npos; }, '_' );
    79         return ret;
    80   }
    81 
    82         GlobalFixer::GlobalFixer( const std::string & name, bool inLibrary ) : tempNamer( "_global_init" ) {
    83                 std::string fixedName = globalFunctionName( name );
     72        GlobalFixer::GlobalFixer( bool inLibrary ) : tempNamer( "_global_init" ) {
    8473                std::list< Expression * > ctorParameters;
    8574                std::list< Expression * > dtorParameters;
     
    9180                        // for library code are run before constructors and destructors for user code,
    9281                        // specify a priority when building the library. Priorities 0-100 are reserved by gcc.
    93                         ctorParameters.push_back( new ConstantExpr( Constant::from_int( 102 ) ) );
    94                         dtorParameters.push_back( new ConstantExpr( Constant::from_int( 102 ) ) );
     82                        // Priorities 101-200 are reserved by cfa, so use priority 200 for CFA library globals,
     83                        // allowing room for overriding with a higher priority.
     84                        ctorParameters.push_back( new ConstantExpr( Constant::from_int( 200 ) ) );
     85                        dtorParameters.push_back( new ConstantExpr( Constant::from_int( 200 ) ) );
    9586                }
    96                 initFunction = new FunctionDecl( "_init_" + fixedName, Type::StorageClasses( Type::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt() );
     87                initFunction = new FunctionDecl( "__global_init__", Type::StorageClasses( Type::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt() );
    9788                initFunction->get_attributes().push_back( new Attribute( "constructor", ctorParameters ) );
    98                 destroyFunction = new FunctionDecl( "_destroy_" + fixedName, Type::StorageClasses( Type::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt() );
     89                destroyFunction = new FunctionDecl( "__global_destroy__", Type::StorageClasses( Type::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt() );
    9990                destroyFunction->get_attributes().push_back( new Attribute( "destructor", dtorParameters ) );
    10091        }
     
    111102                if ( ConstructorInit * ctorInit = dynamic_cast< ConstructorInit * >( objDecl->get_init() ) ) {
    112103                        // a decision should have been made by the resolver, so ctor and init are not both non-NULL
    113                         assert( ! ctorInit->get_ctor() || ! ctorInit->get_init() );
     104                        assert( ! ctorInit->ctor || ! ctorInit->init );
    114105
    115                         Statement * dtor = ctorInit->get_dtor();
     106                        Statement * dtor = ctorInit->dtor;
    116107                        if ( dtor && ! isIntrinsicSingleArgCallStmt( dtor ) ) {
    117108                                // don't need to call intrinsic dtor, because it does nothing, but
    118109                                // non-intrinsic dtors must be called
    119110                                destroyStatements.push_front( dtor );
    120                                 ctorInit->set_dtor( NULL );
     111                                ctorInit->dtor = nullptr;
    121112                        } // if
    122                         if ( Statement * ctor = ctorInit->get_ctor() ) {
     113                        if ( Statement * ctor = ctorInit->ctor ) {
    123114                                initStatements.push_back( ctor );
    124                                 objDecl->set_init( NULL );
    125                                 ctorInit->set_ctor( NULL );
    126                         } else if ( Initializer * init = ctorInit->get_init() ) {
    127                                 objDecl->set_init( init );
    128                                 ctorInit->set_init( NULL );
     115                                objDecl->init = nullptr;
     116                                ctorInit->ctor = nullptr;
     117                        } else if ( Initializer * init = ctorInit->init ) {
     118                                objDecl->init = init;
     119                                ctorInit->init = nullptr;
    129120                        } else {
    130121                                // no constructor and no initializer, which is okay
    131                                 objDecl->set_init( NULL );
     122                                objDecl->init = nullptr;
    132123                        } // if
    133124                        delete ctorInit;
  • src/InitTweak/FixGlobalInit.h

    rf9feab8 r90152a4  
    2222
    2323namespace InitTweak {
    24   /// Moves global initialization into an _init function that is unique to the translation unit.
    25   /// Sets the priority of the initialization function depending on whether the initialization
    26   /// function is for library code.
    27   void fixGlobalInit( std::list< Declaration * > & translationUnit, const std::string & name, bool inLibrary );
    28 
    29   /// Apply transformations to a file name to get a valid C identifier which will be used as
    30   /// the name of the generated initializer function.
    31   std::string globalFunctionName( const std::string & name );
     24        /// Moves global initialization into an _init function that is unique to the translation unit.
     25        /// Sets the priority of the initialization function depending on whether the initialization
     26        /// function is for library code.
     27        void fixGlobalInit( std::list< Declaration * > & translationUnit, bool inLibrary );
    3228} // namespace
    3329
  • src/InitTweak/FixInit.cc

    rf9feab8 r90152a4  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FixInit.h --
     7// FixInit.cc --
    88//
    99// Author           : Rob Schluntz
     
    5454#include "SynTree/Type.h"              // for Type, Type::StorageClasses
    5555#include "SynTree/TypeSubstitution.h"  // for TypeSubstitution, operator<<
    56 #include "SynTree/VarExprReplacer.h"   // for VarExprReplacer
     56#include "SynTree/DeclReplacer.h"      // for DeclReplacer
    5757#include "SynTree/Visitor.h"           // for acceptAll, maybeAccept
    5858
     
    6868        namespace {
    6969                typedef std::unordered_map< int, int > UnqCount;
     70
     71                struct SelfAssignChecker {
     72                        void previsit( ApplicationExpr * appExpr );
     73                };
    7074
    7175                struct InsertImplicitCalls : public WithTypeSubstitution {
     
    180184                };
    181185
    182                 class FixCopyCtors final : public WithStmtsToAdd, public WithShortCircuiting, public WithVisitorRef<FixCopyCtors> {
     186                class FixCopyCtors final : public WithStmtsToAdd, public WithShortCircuiting, public WithVisitorRef<FixCopyCtors>, public WithTypeSubstitution {
    183187                  public:
    184188                        FixCopyCtors( UnqCount & unqCount ) : unqCount( unqCount ){}
     
    194198                };
    195199
    196                 struct GenStructMemberCalls final : public WithGuards, public WithShortCircuiting, public WithIndexer {
     200                struct GenStructMemberCalls final : public WithGuards, public WithShortCircuiting, public WithIndexer, public WithVisitorRef<GenStructMemberCalls> {
    197201                        /// generate default/copy ctor and dtor calls for user-defined struct ctor/dtors
    198202                        /// for any member that is missing a corresponding ctor/dtor call.
     
    200204                        static void generate( std::list< Declaration * > & translationUnit );
    201205
    202                         void previsit( StructDecl * structDecl );
    203 
    204                         void previsit( FunctionDecl * funcDecl );
    205                         void postvisit( FunctionDecl * funcDecl );
    206 
    207                         void previsit( MemberExpr * memberExpr );
    208                         void previsit( ApplicationExpr * appExpr );
    209 
    210                         SemanticError errors;
     206                        void premutate( StructDecl * structDecl );
     207
     208                        void premutate( FunctionDecl * funcDecl );
     209                        DeclarationWithType * postmutate( FunctionDecl * funcDecl );
     210
     211                        void premutate( MemberExpr * memberExpr );
     212                        void premutate( ApplicationExpr * appExpr );
     213
     214                        /// Note: this post mutate used to be in a separate visitor. If this pass breaks, one place to examine is whether it is
     215                        /// okay for this part of the recursion to occur alongside the rest.
     216                        Expression * postmutate( UntypedExpr * expr );
     217
     218                        SemanticErrorException errors;
    211219                  private:
    212220                        template< typename... Params >
     
    225233                };
    226234
    227                 // very simple resolver-like mutator class - used to
    228                 // resolve UntypedExprs that are found within newly
    229                 // generated constructor/destructor calls
    230                 class MutatingResolver final : public Mutator {
    231                   public:
    232                         MutatingResolver( SymTab::Indexer & indexer ) : indexer( indexer ) {}
    233 
    234                         using Mutator::mutate;
    235                         virtual DeclarationWithType* mutate( ObjectDecl *objectDecl ) override;
    236                         virtual Expression* mutate( UntypedExpr *untypedExpr ) override;
    237 
    238                   private:
    239                         SymTab::Indexer & indexer;
    240                 };
    241 
    242235                struct FixCtorExprs final : public WithDeclsToAdd, public WithIndexer {
    243236                        /// expands ConstructorExpr nodes into comma expressions, using a temporary for the first argument
     
    248241        } // namespace
    249242
    250         void fix( std::list< Declaration * > & translationUnit, const std::string & filename, bool inLibrary ) {
     243        void fix( std::list< Declaration * > & translationUnit, bool inLibrary ) {
     244                PassVisitor<SelfAssignChecker> checker;
     245                acceptAll( translationUnit, checker );
     246
    251247                // fixes ConstructorInit for global variables. should happen before fixInitializers.
    252                 InitTweak::fixGlobalInit( translationUnit, filename, inLibrary );
     248                InitTweak::fixGlobalInit( translationUnit, inLibrary );
    253249
    254250                UnqCount unqCount;
     
    290286                        // can't use mutateAll, because need to insert declarations at top-level
    291287                        // can't use DeclMutator, because sometimes need to insert IfStmt, etc.
    292                         SemanticError errors;
     288                        SemanticErrorException errors;
    293289                        for ( std::list< Declaration * >::iterator i = translationUnit.begin(); i != translationUnit.end(); ++i ) {
    294290                                try {
    295291                                        maybeMutate( *i, fixer );
    296292                                        translationUnit.splice( i, fixer.pass.staticDtorDecls );
    297                                 } catch( SemanticError &e ) {
    298                                         e.set_location( (*i)->location );
     293                                } catch( SemanticErrorException &e ) {
    299294                                        errors.append( e );
    300295                                } // try
     
    318313                void GenStructMemberCalls::generate( std::list< Declaration * > & translationUnit ) {
    319314                        PassVisitor<GenStructMemberCalls> warner;
    320                         acceptAll( translationUnit, warner );
     315                        mutateAll( translationUnit, warner );
    321316                }
    322317
     
    324319                        PassVisitor<FixCtorExprs> fixer;
    325320                        mutateAll( translationUnit, fixer );
     321                }
     322
     323                namespace {
     324                        // Relatively simple structural comparison for expressions, needed to determine
     325                        // if two expressions are "the same" (used to determine if self assignment occurs)
     326                        struct StructuralChecker {
     327                                Expression * stripCasts( Expression * expr ) {
     328                                        // this might be too permissive. It's possible that only particular casts are relevant.
     329                                        while ( CastExpr * cast = dynamic_cast< CastExpr * >( expr ) ) {
     330                                                expr = cast->arg;
     331                                        }
     332                                        return expr;
     333                                }
     334
     335                                void previsit( Expression * ) {
     336                                        // anything else does not qualify
     337                                        isSimilar = false;
     338                                }
     339
     340                                template<typename T>
     341                                T * cast( Expression * node ) {
     342                                        // all expressions need to ignore casts, so this bit has been factored out
     343                                        return dynamic_cast< T * >( stripCasts( node ) );
     344                                }
     345
     346                                // ignore casts
     347                                void previsit( CastExpr * ) {}
     348
     349                                void previsit( MemberExpr * memExpr ) {
     350                                        if ( MemberExpr * otherMember = cast< MemberExpr >( other ) ) {
     351                                                if ( otherMember->member == memExpr->member ) {
     352                                                        other = otherMember->aggregate;
     353                                                        return;
     354                                                }
     355                                        }
     356                                        isSimilar = false;
     357                                }
     358
     359                                void previsit( VariableExpr * varExpr ) {
     360                                        if ( VariableExpr * otherVar = cast< VariableExpr >( other ) ) {
     361                                                if ( otherVar->var == varExpr->var ) {
     362                                                        return;
     363                                                }
     364                                        }
     365                                        isSimilar = false;
     366                                }
     367
     368                                void previsit( AddressExpr * ) {
     369                                        if ( AddressExpr * addrExpr = cast< AddressExpr >( other ) ) {
     370                                                other = addrExpr->arg;
     371                                                return;
     372                                        }
     373                                        isSimilar = false;
     374                                }
     375
     376                                Expression * other = nullptr;
     377                                bool isSimilar = true;
     378                        };
     379
     380                        bool structurallySimilar( Expression * e1, Expression * e2 ) {
     381                                PassVisitor<StructuralChecker> checker;
     382                                checker.pass.other = e2;
     383                                e1->accept( checker );
     384                                return checker.pass.isSimilar;
     385                        }
     386                }
     387
     388                void SelfAssignChecker::previsit( ApplicationExpr * appExpr ) {
     389                        DeclarationWithType * function = getFunction( appExpr );
     390                        if ( function->name == "?=?" ) { // doesn't use isAssignment, because ?+=?, etc. should not count as self-assignment
     391                                if ( appExpr->args.size() == 2 ) {
     392                                        // check for structural similarity (same variable use, ignore casts, etc. - but does not look too deeply, anything looking like a function is off limits)
     393                                        if ( structurallySimilar( appExpr->args.front(), appExpr->args.back() ) ) {
     394                                                SemanticWarning( appExpr->location, Warning::SelfAssignment, toCString( appExpr->args.front() ) );
     395                                        }
     396                                }
     397                        }
    326398                }
    327399
     
    368440                        // arrays are not copy constructed, so this should always be an ExprStmt
    369441                        ImplicitCtorDtorStmt * stmt = genCtorDtor( fname, var, cpArg );
    370                         ExprStmt * exprStmt = strict_dynamic_cast< ExprStmt * >( stmt->get_callStmt() );
     442                        assertf( stmt, "ResolveCopyCtors: genCtorDtor returned nullptr: %s / %s / %s", fname.c_str(), toString( var ).c_str(), toString( cpArg ).c_str() );
     443                        ExprStmt * exprStmt = strict_dynamic_cast< ExprStmt * >( stmt->callStmt );
    371444                        Expression * resolved = exprStmt->expr;
    372445                        exprStmt->expr = nullptr; // take ownership of expr
     
    378451                        ResolvExpr::findVoidExpression( resolved, indexer );
    379452                        assert( resolved );
    380                         if ( resolved->get_env() ) {
     453                        if ( resolved->env ) {
    381454                                // Extract useful information and discard new environments. Keeping them causes problems in PolyMutator passes.
    382                                 env->add( *resolved->get_env() );
    383                                 delete resolved->get_env();
    384                                 resolved->set_env( nullptr );
     455                                env->add( *resolved->env );
     456                                delete resolved->env;
     457                                resolved->env = nullptr;
    385458                        } // if
    386459                        delete stmt;
     460                        if ( TupleAssignExpr * assign = dynamic_cast< TupleAssignExpr * >( resolved ) ) {
     461                                // fix newly generated StmtExpr
     462                                postvisit( assign->stmtExpr );
     463                        }
    387464                        return resolved;
    388465                }
     
    478555                                static UniqueName retNamer("_tmp_stmtexpr_ret");
    479556
    480                                 // create variable that will hold the result of the stmt expr
    481557                                result = result->clone();
    482558                                env->apply( result );
     559                                if ( ! InitTweak::isConstructable( result ) ) {
     560                                        delete result;
     561                                        return;
     562                                }
     563
     564                                // create variable that will hold the result of the stmt expr
    483565                                ObjectDecl * ret = ObjectDecl::newObject( retNamer.newName(), result, nullptr );
    484                                 ret->get_type()->set_const( false );
    485                                 stmtExpr->get_returnDecls().push_front( ret );
     566                                ret->type->set_const( false );
     567                                stmtExpr->returnDecls.push_front( ret );
    486568
    487569                                // must have a non-empty body, otherwise it wouldn't have a result
    488                                 CompoundStmt * body = stmtExpr->get_statements();
     570                                CompoundStmt * body = stmtExpr->statements;
    489571                                assert( ! body->get_kids().empty() );
    490572                                // must be an ExprStmt, otherwise it wouldn't have a result
    491573                                ExprStmt * last = strict_dynamic_cast< ExprStmt * >( body->get_kids().back() );
    492                                 last->set_expr( makeCtorDtor( "?{}", ret, last->get_expr() ) );
    493 
    494                                 stmtExpr->get_dtors().push_front( makeCtorDtor( "^?{}", ret ) );
     574                                last->expr = makeCtorDtor( "?{}", ret, last->get_expr() );
     575
     576                                stmtExpr->dtors.push_front( makeCtorDtor( "^?{}", ret ) );
    495577                        } // if
    496578                }
     
    555637                        // add destructors after current statement
    556638                        for ( Expression * dtor : dtors ) {
     639                                // take relevant bindings from environment
     640                                assert( ! dtor->env );
     641                                dtor->env =  maybeClone( env );
    557642                                stmtsToAddAfter.push_back( new ExprStmt( dtor ) );
    558643                        } // for
     
    593678                        // to the outer context, rather than inside of the statement expression.
    594679                        visit_children = false;
    595                         std::list< Statement * > & stmts = stmtExpr->get_statements()->get_kids();
     680                        std::list< Statement * > & stmts = stmtExpr->statements->get_kids();
    596681                        for ( Statement *& stmt : stmts ) {
    597682                                stmt = stmt->acceptMutator( *visitor );
    598683                        } // for
    599                         assert( stmtExpr->get_result() );
    600                         Type * result = stmtExpr->get_result();
     684                        assert( stmtExpr->result );
     685                        Type * result = stmtExpr->result;
    601686                        if ( ! result->isVoid() ) {
    602                                 for ( ObjectDecl * obj : stmtExpr->get_returnDecls() ) {
     687                                for ( ObjectDecl * obj : stmtExpr->returnDecls ) {
    603688                                        stmtsToAddBefore.push_back( new DeclStmt( obj ) );
    604689                                } // for
    605690                                // add destructors after current statement
    606                                 for ( Expression * dtor : stmtExpr->get_dtors() ) {
     691                                for ( Expression * dtor : stmtExpr->dtors ) {
    607692                                        stmtsToAddAfter.push_back( new ExprStmt( dtor ) );
    608693                                } // for
    609694                                // must have a non-empty body, otherwise it wouldn't have a result
    610695                                assert( ! stmts.empty() );
    611                                 assert( ! stmtExpr->get_returnDecls().empty() );
    612                                 stmts.push_back( new ExprStmt( new VariableExpr( stmtExpr->get_returnDecls().front() ) ) );
    613                                 stmtExpr->get_returnDecls().clear();
    614                                 stmtExpr->get_dtors().clear();
    615                         }
    616                         assert( stmtExpr->get_returnDecls().empty() );
    617                         assert( stmtExpr->get_dtors().empty() );
     696                                assertf( ! stmtExpr->returnDecls.empty() || stmtExpr->dtors.empty(), "StmtExpr returns non-void, but no return decls: %s", toString( stmtExpr ).c_str() );
     697                                // if there is a return decl, add a use as the last statement; will not have return decl on non-constructable returns
     698                                if ( ! stmtExpr->returnDecls.empty() ) {
     699                                        stmts.push_back( new ExprStmt( new VariableExpr( stmtExpr->returnDecls.front() ) ) );
     700                                }
     701                                stmtExpr->returnDecls.clear();
     702                                stmtExpr->dtors.clear();
     703                        }
     704                        assert( stmtExpr->returnDecls.empty() );
     705                        assert( stmtExpr->dtors.empty() );
    618706                }
    619707
     
    692780                                replacement = new CastExpr( replacement, base->clone() );
    693781                        }
    694                         VarExprReplacer::replace( dtor, { std::make_pair( objDecl, replacement ) } );
    695                         dtorFunc->statements->push_back( dtor );
     782                        DeclReplacer::replace( dtor, { std::make_pair( objDecl, replacement ) } );
     783                        dtorFunc->statements->push_back( strict_dynamic_cast<Statement *>( dtor ) );
    696784
    697785                        return dtorFunc;
     
    905993                        )
    906994                        if ( ! diff.empty() ) {
    907                                 throw SemanticError( std::string("jump to label '") + stmt->get_target().get_name() + "' crosses initialization of " + (*diff.begin())->get_name() + " ", stmt );
     995                                SemanticError( stmt, std::string("jump to label '") + stmt->get_target().get_name() + "' crosses initialization of " + (*diff.begin())->get_name() + " " );
    908996                        } // if
    909997                }
     
    9311019                }
    9321020
    933                 void GenStructMemberCalls::previsit( StructDecl * structDecl ) {
     1021                void GenStructMemberCalls::premutate( StructDecl * structDecl ) {
    9341022                        if ( ! dtorStruct && structDecl->name == "__Destructor" ) {
    9351023                                dtorStruct = structDecl;
     
    9371025                }
    9381026
    939                 void GenStructMemberCalls::previsit( FunctionDecl * funcDecl ) {
     1027                void GenStructMemberCalls::premutate( FunctionDecl * funcDecl ) {
    9401028                        GuardValue( function );
    9411029                        GuardValue( unhandled );
     
    9441032                        GuardValue( isCtor );
    9451033                        GuardValue( structDecl );
    946                         errors = SemanticError();  // clear previous errors
     1034                        errors = SemanticErrorException();  // clear previous errors
    9471035
    9481036                        // need to start with fresh sets
     
    9771065                }
    9781066
    979                 void GenStructMemberCalls::postvisit( FunctionDecl * funcDecl ) {
     1067                DeclarationWithType * GenStructMemberCalls::postmutate( FunctionDecl * funcDecl ) {
    9801068                        // remove the unhandled objects from usedUninit, because a call is inserted
    9811069                        // to handle them - only objects that are later constructed are used uninitialized.
     
    10311119                                                Statement * callStmt = stmt.front();
    10321120
    1033                                                 MutatingResolver resolver( indexer );
    10341121                                                try {
    1035                                                         callStmt->acceptMutator( resolver );
     1122                                                        callStmt->acceptMutator( *visitor );
    10361123                                                        if ( isCtor ) {
    10371124                                                                function->statements->push_front( callStmt );
     
    10611148                                                                function->statements->kids.splice( function->statements->kids.begin(), stmtsToAdd );
    10621149                                                        }
    1063                                                 } catch ( SemanticError & error ) {
     1150                                                } catch ( SemanticErrorException & error ) {
    10641151                                                        emit( funcDecl->location, "in ", CodeGen::genPrettyType( function->get_functionType(), function->get_name() ), ", field ", field->get_name(), " not explicitly ", isCtor ? "constructed" : "destructed",  " and no ", isCtor ? "default constructor" : "destructor", " found" );
    10651152                                                }
     
    10701157                                throw errors;
    10711158                        }
     1159                        return funcDecl;
    10721160                }
    10731161
     
    10951183                }
    10961184
    1097                 void GenStructMemberCalls::previsit( ApplicationExpr * appExpr ) {
     1185                void GenStructMemberCalls::premutate( ApplicationExpr * appExpr ) {
    10981186                        if ( ! checkWarnings( function ) ) {
    10991187                                visit_children = false;
     
    11021190
    11031191                        std::string fname = getFunctionName( appExpr );
    1104                         if ( fname == function->get_name() ) {
     1192                        if ( fname == function->name ) {
    11051193                                // call to same kind of function
    1106                                 Expression * firstParam = appExpr->get_args().front();
     1194                                Expression * firstParam = appExpr->args.front();
    11071195
    11081196                                if ( isThisExpression( firstParam, thisParam ) ) {
     
    11131201                                        // if first parameter is a member expression on the this parameter,
    11141202                                        // then remove the member from unhandled set.
    1115                                         if ( isThisExpression( memberExpr->get_aggregate(), thisParam ) ) {
    1116                                                 unhandled.erase( memberExpr->get_member() );
     1203                                        if ( isThisExpression( memberExpr->aggregate, thisParam ) ) {
     1204                                                unhandled.erase( memberExpr->member );
    11171205                                        }
    11181206                                }
     
    11201208                }
    11211209
    1122                 void GenStructMemberCalls::previsit( MemberExpr * memberExpr ) {
     1210                void GenStructMemberCalls::premutate( MemberExpr * memberExpr ) {
    11231211                        if ( ! checkWarnings( function ) || ! isCtor ) {
    11241212                                visit_children = false;
     
    11361224                template< typename Visitor, typename... Params >
    11371225                void error( Visitor & v, CodeLocation loc, const Params &... params ) {
    1138                         SemanticError err( toString( params... ) );
    1139                         err.set_location( loc );
     1226                        SemanticErrorException err( loc, toString( params... ) );
    11401227                        v.errors.append( err );
    11411228                }
     
    11481235                }
    11491236
    1150                 DeclarationWithType * MutatingResolver::mutate( ObjectDecl * objectDecl ) {
    1151                         // add object to the indexer assumes that there will be no name collisions
    1152                         // in generated code. If this changes, add mutate methods for entities with
    1153                         // scope and call {enter,leave}Scope explicitly.
    1154                         indexer.addId( objectDecl );
    1155                         return objectDecl;
    1156                 }
    1157 
    1158                 Expression * MutatingResolver::mutate( UntypedExpr * untypedExpr ) {
     1237                Expression * GenStructMemberCalls::postmutate( UntypedExpr * untypedExpr ) {
    11591238                        Expression * newExpr = untypedExpr;
    11601239                        ResolvExpr::findVoidExpression( newExpr, indexer );
  • src/InitTweak/FixInit.h

    rf9feab8 r90152a4  
    2424  /// replace constructor initializers with expression statements
    2525  /// and unwrap basic C-style initializers
    26         void fix( std::list< Declaration * > & translationUnit, const std::string & name, bool inLibrary );
     26        void fix( std::list< Declaration * > & translationUnit, bool inLibrary );
    2727} // namespace
    2828
  • src/InitTweak/GenInit.cc

    rf9feab8 r90152a4  
    3030#include "InitTweak.h"             // for isConstExpr, InitExpander, checkIn...
    3131#include "Parser/LinkageSpec.h"    // for isOverridable, C
     32#include "ResolvExpr/Resolver.h"
    3233#include "SymTab/Autogen.h"        // for genImplicitCall, SizeType
    3334#include "SymTab/Mangler.h"        // for Mangler
     
    4041#include "SynTree/Type.h"          // for Type, ArrayType, Type::Qualifiers
    4142#include "SynTree/Visitor.h"       // for acceptAll, maybeAccept
     43#include "Tuples/Tuples.h"         // for maybeImpure
    4244
    4345namespace InitTweak {
     
    8991        };
    9092
    91         struct HoistArrayDimension final : public WithDeclsToAdd, public WithShortCircuiting, public WithGuards {
     93        struct HoistArrayDimension final : public WithDeclsToAdd, public WithShortCircuiting, public WithGuards, public WithIndexer {
    9294                /// hoist dimension from array types in object declaration so that it uses a single
    9395                /// const variable of type size_t, so that side effecting array dimensions are only
     
    104106                void premutate( FunctionType * ) { visit_children = false; }
    105107
     108                // need this so that enumerators are added to the indexer, due to premutate(AggregateDecl *)
     109                void premutate( EnumDecl * ) {}
     110
    106111                void hoist( Type * type );
    107112
     
    135140                                if ( varExpr->var == retVal ) return;
    136141                        }
    137                         stmtsToAddBefore.push_back( genCtorDtor( "?{}", retVal, returnStmt->get_expr() ) );
     142                        Statement * stmt = genCtorDtor( "?{}", retVal, returnStmt->expr );
     143                        assertf( stmt, "ReturnFixer: genCtorDtor returned nullptr: %s / %s", toString( retVal ).c_str(), toString( returnStmt->expr ).c_str() );
     144                        stmtsToAddBefore.push_back( stmt );
    138145
    139146                        // return the retVal object
     
    178185                        if ( ! arrayType->get_dimension() ) return; // xxx - recursive call to hoist?
    179186
    180                         // don't need to hoist dimension if it's a constexpr - only need to if there's potential for side effects.
    181                         if ( isConstExpr( arrayType->get_dimension() ) ) return;
     187                        // need to resolve array dimensions in order to accurately determine if constexpr
     188                        ResolvExpr::findSingleExpression( arrayType->dimension, SymTab::SizeType->clone(), indexer );
     189                        // array is variable-length when the dimension is not constexpr
     190                        arrayType->isVarLen = ! isConstExpr( arrayType->dimension );
     191                        // don't need to hoist dimension if it's definitely pure - only need to if there's potential for side effects.
     192                        if ( ! Tuples::maybeImpure( arrayType->dimension ) ) return;
    182193
    183194                        ObjectDecl * arrayDimension = new ObjectDecl( dimensionName.newName(), storageClasses, LinkageSpec::C, 0, SymTab::SizeType->clone(), new SingleInit( arrayType->get_dimension() ) );
     
    194205        void HoistArrayDimension::premutate( FunctionDecl * ) {
    195206                GuardValue( inFunction );
     207                inFunction = true;
    196208        }
    197209
     
    220232                Type * type = objDecl->get_type();
    221233                while ( ArrayType * at = dynamic_cast< ArrayType * >( type ) ) {
     234                        // must always construct VLAs with an initializer, since this is an error in C
     235                        if ( at->isVarLen && objDecl->init ) return true;
    222236                        type = at->get_base();
    223237                }
     
    303317                if ( tryConstruct( objDecl ) && ( managedTypes.isManaged( objDecl ) || ((! inFunction || objDecl->get_storageClasses().is_static ) && ! isConstExpr( objDecl->get_init() ) ) ) ) {
    304318                        // constructed objects cannot be designated
    305                         if ( isDesignated( objDecl->get_init() ) ) throw SemanticError( "Cannot include designations in the initializer for a managed Object. If this is really what you want, then initialize with @=.\n", objDecl );
     319                        if ( isDesignated( objDecl->get_init() ) ) SemanticError( objDecl, "Cannot include designations in the initializer for a managed Object. If this is really what you want, then initialize with @=.\n" );
    306320                        // constructed objects should not have initializers nested too deeply
    307                         if ( ! checkInitDepth( objDecl ) ) throw SemanticError( "Managed object's initializer is too deep ", objDecl );
     321                        if ( ! checkInitDepth( objDecl ) ) SemanticError( objDecl, "Managed object's initializer is too deep " );
    308322
    309323                        objDecl->set_init( genCtorInit( objDecl ) );
  • src/InitTweak/InitTweak.cc

    rf9feab8 r90152a4  
    225225                                        // xxx - this shouldn't be an error, but need a way to
    226226                                        // terminate without creating output, so should catch this error
    227                                         throw SemanticError( "unbalanced list initializers" );
     227                                        SemanticError( init->location, "unbalanced list initializers" );
    228228                                }
    229229
     
    296296                ObjectDecl * objDecl = dynamic_cast< ObjectDecl * >( dwt );
    297297                if ( ! objDecl ) return false;
    298                 return ! LinkageSpec::isBuiltin( objDecl->get_linkage() ) &&
    299                         (objDecl->get_init() == nullptr ||
     298                return (objDecl->get_init() == nullptr ||
    300299                                ( objDecl->get_init() != nullptr && objDecl->get_init()->get_maybeConstructed() ))
    301300                        && ! objDecl->get_storageClasses().is_extern
     
    409408                return allofCtorDtor( stmt, []( Expression * callExpr ){
    410409                        if ( ApplicationExpr * appExpr = isIntrinsicCallExpr( callExpr ) ) {
    411                                 FunctionType *funcType = GenPoly::getFunctionType( appExpr->get_function()->get_result() );
     410                                FunctionType *funcType = GenPoly::getFunctionType( appExpr->function->result );
    412411                                assert( funcType );
    413412                                return funcType->get_parameters().size() == 1;
     
    529528                }
    530529                if ( dynamic_cast< ReferenceType * >( dst->result ) ) {
    531                         dst = new AddressExpr( dst );
     530                        for (int depth = dst->result->referenceDepth(); depth > 0; depth--) {
     531                                dst = new AddressExpr( dst );
     532                        }
    532533                } else {
    533534                        dst = new CastExpr( dst, new ReferenceType( noQualifiers, dst->result->clone() ) );
    534535                }
    535536                if ( dynamic_cast< ReferenceType * >( src->result ) ) {
    536                         src = new CastExpr( src, new ReferenceType( noQualifiers, src->result->stripReferences()->clone() ) );
     537                        for (int depth = src->result->referenceDepth(); depth > 0; depth--) {
     538                                src = new AddressExpr( src );
     539                        }
     540                        // src = new CastExpr( src, new ReferenceType( noQualifiers, src->result->stripReferences()->clone() ) );
    537541                }
    538542                return new ApplicationExpr( VariableExpr::functionPointer( assign ), { dst, src } );
     
    564568                void previsit( ConstantExpr * ) {}
    565569
     570                void previsit( VariableExpr * varExpr ) {
     571                        visit_children = false;
     572
     573                        if ( EnumInstType * inst = dynamic_cast< EnumInstType * >( varExpr->result ) ) {
     574                                long long int value;
     575                                if ( inst->baseEnum->valueOf( varExpr->var, value ) ) {
     576                                        // enumerators are const expr
     577                                        return;
     578                                }
     579                        }
     580                        isConstExpr = false;
     581                }
     582
    566583                bool isConstExpr = true;
    567584        };
  • src/Makefile.am

    rf9feab8 r90152a4  
    1616
    1717# create object files in directory with source files
    18 AUTOMAKE_OPTIONS = subdir-objects
     18AUTOMAKE_OPTIONS = foreign subdir-objects
    1919
    2020SRC = main.cc \
    21       MakeLibCfa.cc
     21      MakeLibCfa.cc \
     22      CompilationState.cc
    2223
    2324MAINTAINERCLEANFILES =
     25MOSTLYCLEANFILES =
    2426
    2527# Is there a way to use a variable for the directory names?
     
    3739include SynTree/module.mk
    3840include Tuples/module.mk
     41include Validate/module.mk
    3942include Virtual/module.mk
    4043
    4144# put into lib for now
    42 cfa_cpplibdir = ${CFA_LIBDIR}
    43 cfa_cpplib_PROGRAMS = driver/cfa-cpp
    44 driver_cfa_cpp_SOURCES = ${SRC}
    45 driver_cfa_cpp_LDADD = -ldl                     # yywrap
    46 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -Wextra -DDEBUG_ALL -I${abs_top_srcdir}/src/include -DYY_NO_INPUT -O2 -g -std=c++14
    47 driver_cfa_cpp_LDFLAGS = -Xlinker -export-dynamic
     45cfa_cpplibdir = $(CFA_LIBDIR)
     46cfa_cpplib_PROGRAMS = ../driver/cfa-cpp demangler
     47___driver_cfa_cpp_SOURCES = $(SRC)
     48___driver_cfa_cpp_LDADD = -ldl                  # yywrap
     49
     50AM_CXXFLAGS = @HOST_FLAGS@ -Wno-deprecated -Wall -Wextra -DDEBUG_ALL -I./Parser -I$(srcdir)/Parser -I$(srcdir)/include -DYY_NO_INPUT -O2 -g -std=c++14
     51AM_LDFLAGS  = @HOST_FLAGS@ -Xlinker -export-dynamic
     52
     53demangler_SOURCES = SymTab/demangler.cc
     54
     55demangler_LDADD = libdemangle.a     # yywrap
     56
     57noinst_LIBRARIES = libdemangle.a
     58libdemangle_a_SOURCES = SymTab/Demangle.cc SymTab/ManglerCommon.cc \
     59  SynTree/Type.cc \
     60  SynTree/VoidType.cc \
     61  SynTree/BasicType.cc \
     62  SynTree/PointerType.cc \
     63  SynTree/ArrayType.cc \
     64  SynTree/ReferenceType.cc \
     65  SynTree/FunctionType.cc \
     66  SynTree/ReferenceToType.cc \
     67  SynTree/TupleType.cc \
     68  SynTree/TypeofType.cc \
     69  SynTree/AttrType.cc \
     70  SynTree/VarArgsType.cc \
     71  SynTree/ZeroOneType.cc \
     72  SynTree/Constant.cc \
     73  SynTree/Expression.cc \
     74  SynTree/TupleExpr.cc \
     75  SynTree/CommaExpr.cc \
     76  SynTree/TypeExpr.cc \
     77  SynTree/ApplicationExpr.cc \
     78  SynTree/AddressExpr.cc \
     79  SynTree/Statement.cc \
     80  SynTree/CompoundStmt.cc \
     81  SynTree/DeclStmt.cc \
     82  SynTree/Declaration.cc \
     83  SynTree/DeclarationWithType.cc \
     84  SynTree/ObjectDecl.cc \
     85  SynTree/FunctionDecl.cc \
     86  SynTree/AggregateDecl.cc \
     87  SynTree/NamedTypeDecl.cc \
     88  SynTree/TypeDecl.cc \
     89  SynTree/Initializer.cc \
     90  SynTree/TypeSubstitution.cc \
     91  SynTree/Attribute.cc \
     92  SynTree/DeclReplacer.cc \
     93  CompilationState.cc \
     94  CodeGen/CodeGenerator.cc \
     95  CodeGen/FixMain.cc \
     96  CodeGen/GenType.cc \
     97  CodeGen/OperatorTable.cc \
     98  Common/Assert.cc \
     99  Common/Eval.cc \
     100  Common/SemanticError.cc \
     101  Common/UniqueName.cc \
     102  Concurrency/Keywords.cc \
     103  ControlStruct/ForExprMutator.cc \
     104  ControlStruct/LabelFixer.cc \
     105  ControlStruct/LabelGenerator.cc \
     106  ControlStruct/MLEMutator.cc \
     107  ControlStruct/Mutate.cc \
     108  GenPoly/GenPoly.cc \
     109  GenPoly/Lvalue.cc \
     110  InitTweak/GenInit.cc \
     111  InitTweak/InitTweak.cc \
     112  Parser/LinkageSpec.cc \
     113  ResolvExpr/AdjustExprType.cc \
     114  ResolvExpr/Alternative.cc \
     115  ResolvExpr/AlternativeFinder.cc \
     116  ResolvExpr/ExplodedActual.cc \
     117  ResolvExpr/CastCost.cc \
     118  ResolvExpr/CommonType.cc \
     119  ResolvExpr/ConversionCost.cc \
     120  ResolvExpr/CurrentObject.cc \
     121  ResolvExpr/FindOpenVars.cc \
     122  ResolvExpr/Occurs.cc \
     123  ResolvExpr/PolyCost.cc \
     124  ResolvExpr/PtrsAssignable.cc \
     125  ResolvExpr/PtrsCastable.cc \
     126  ResolvExpr/RenameVars.cc \
     127  ResolvExpr/Resolver.cc \
     128  ResolvExpr/ResolveTypeof.cc \
     129  ResolvExpr/TypeEnvironment.cc \
     130  ResolvExpr/Unify.cc \
     131  SymTab/Autogen.cc \
     132  SymTab/FixFunction.cc \
     133  SymTab/Indexer.cc \
     134  SymTab/Mangler.cc \
     135  SymTab/Validate.cc \
     136  Tuples/Explode.cc \
     137  Tuples/TupleAssignment.cc \
     138  Tuples/TupleExpansion.cc \
     139  Validate/HandleAttributes.cc
    48140
    49141MAINTAINERCLEANFILES += ${libdir}/${notdir ${cfa_cpplib_PROGRAMS}}
  • src/Makefile.in

    rf9feab8 r90152a4  
    5959######################### -*- Mode: Makefile-Gmake -*- ########################
    6060###############################################################################
     61
     62######################### -*- Mode: Makefile-Gmake -*- ########################
     63###############################################################################
     64
    6165
    6266VPATH = @srcdir@
     
    134138build_triplet = @build@
    135139host_triplet = @host@
    136 cfa_cpplib_PROGRAMS = driver/cfa-cpp$(EXEEXT)
     140cfa_cpplib_PROGRAMS = ../driver/cfa-cpp$(EXEEXT) demangler$(EXEEXT)
    137141subdir = src
    138142ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    139 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
     143am__aclocal_m4_deps = $(top_srcdir)/automake/cfa.m4 \
     144        $(top_srcdir)/configure.ac
    140145am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    141146        $(ACLOCAL_M4)
     
    145150CONFIG_CLEAN_FILES =
    146151CONFIG_CLEAN_VPATH_FILES =
     152LIBRARIES = $(noinst_LIBRARIES)
     153AR = ar
     154ARFLAGS = cru
     155AM_V_AR = $(am__v_AR_@AM_V@)
     156am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
     157am__v_AR_0 = @echo "  AR      " $@;
     158am__v_AR_1 =
     159libdemangle_a_AR = $(AR) $(ARFLAGS)
     160libdemangle_a_LIBADD =
     161am__dirstamp = $(am__leading_dot)dirstamp
     162am_libdemangle_a_OBJECTS = SymTab/Demangle.$(OBJEXT) \
     163        SymTab/ManglerCommon.$(OBJEXT) SynTree/Type.$(OBJEXT) \
     164        SynTree/VoidType.$(OBJEXT) SynTree/BasicType.$(OBJEXT) \
     165        SynTree/PointerType.$(OBJEXT) SynTree/ArrayType.$(OBJEXT) \
     166        SynTree/ReferenceType.$(OBJEXT) SynTree/FunctionType.$(OBJEXT) \
     167        SynTree/ReferenceToType.$(OBJEXT) SynTree/TupleType.$(OBJEXT) \
     168        SynTree/TypeofType.$(OBJEXT) SynTree/AttrType.$(OBJEXT) \
     169        SynTree/VarArgsType.$(OBJEXT) SynTree/ZeroOneType.$(OBJEXT) \
     170        SynTree/Constant.$(OBJEXT) SynTree/Expression.$(OBJEXT) \
     171        SynTree/TupleExpr.$(OBJEXT) SynTree/CommaExpr.$(OBJEXT) \
     172        SynTree/TypeExpr.$(OBJEXT) SynTree/ApplicationExpr.$(OBJEXT) \
     173        SynTree/AddressExpr.$(OBJEXT) SynTree/Statement.$(OBJEXT) \
     174        SynTree/CompoundStmt.$(OBJEXT) SynTree/DeclStmt.$(OBJEXT) \
     175        SynTree/Declaration.$(OBJEXT) \
     176        SynTree/DeclarationWithType.$(OBJEXT) \
     177        SynTree/ObjectDecl.$(OBJEXT) SynTree/FunctionDecl.$(OBJEXT) \
     178        SynTree/AggregateDecl.$(OBJEXT) \
     179        SynTree/NamedTypeDecl.$(OBJEXT) SynTree/TypeDecl.$(OBJEXT) \
     180        SynTree/Initializer.$(OBJEXT) \
     181        SynTree/TypeSubstitution.$(OBJEXT) SynTree/Attribute.$(OBJEXT) \
     182        SynTree/DeclReplacer.$(OBJEXT) CompilationState.$(OBJEXT) \
     183        CodeGen/CodeGenerator.$(OBJEXT) CodeGen/FixMain.$(OBJEXT) \
     184        CodeGen/GenType.$(OBJEXT) CodeGen/OperatorTable.$(OBJEXT) \
     185        Common/Assert.$(OBJEXT) Common/Eval.$(OBJEXT) \
     186        Common/SemanticError.$(OBJEXT) Common/UniqueName.$(OBJEXT) \
     187        Concurrency/Keywords.$(OBJEXT) \
     188        ControlStruct/ForExprMutator.$(OBJEXT) \
     189        ControlStruct/LabelFixer.$(OBJEXT) \
     190        ControlStruct/LabelGenerator.$(OBJEXT) \
     191        ControlStruct/MLEMutator.$(OBJEXT) \
     192        ControlStruct/Mutate.$(OBJEXT) GenPoly/GenPoly.$(OBJEXT) \
     193        GenPoly/Lvalue.$(OBJEXT) InitTweak/GenInit.$(OBJEXT) \
     194        InitTweak/InitTweak.$(OBJEXT) Parser/LinkageSpec.$(OBJEXT) \
     195        ResolvExpr/AdjustExprType.$(OBJEXT) \
     196        ResolvExpr/Alternative.$(OBJEXT) \
     197        ResolvExpr/AlternativeFinder.$(OBJEXT) \
     198        ResolvExpr/ExplodedActual.$(OBJEXT) \
     199        ResolvExpr/CastCost.$(OBJEXT) ResolvExpr/CommonType.$(OBJEXT) \
     200        ResolvExpr/ConversionCost.$(OBJEXT) \
     201        ResolvExpr/CurrentObject.$(OBJEXT) \
     202        ResolvExpr/FindOpenVars.$(OBJEXT) ResolvExpr/Occurs.$(OBJEXT) \
     203        ResolvExpr/PolyCost.$(OBJEXT) \
     204        ResolvExpr/PtrsAssignable.$(OBJEXT) \
     205        ResolvExpr/PtrsCastable.$(OBJEXT) \
     206        ResolvExpr/RenameVars.$(OBJEXT) ResolvExpr/Resolver.$(OBJEXT) \
     207        ResolvExpr/ResolveTypeof.$(OBJEXT) \
     208        ResolvExpr/TypeEnvironment.$(OBJEXT) \
     209        ResolvExpr/Unify.$(OBJEXT) SymTab/Autogen.$(OBJEXT) \
     210        SymTab/FixFunction.$(OBJEXT) SymTab/Indexer.$(OBJEXT) \
     211        SymTab/Mangler.$(OBJEXT) SymTab/Validate.$(OBJEXT) \
     212        Tuples/Explode.$(OBJEXT) Tuples/TupleAssignment.$(OBJEXT) \
     213        Tuples/TupleExpansion.$(OBJEXT) \
     214        Validate/HandleAttributes.$(OBJEXT)
     215libdemangle_a_OBJECTS = $(am_libdemangle_a_OBJECTS)
    147216am__installdirs = "$(DESTDIR)$(cfa_cpplibdir)"
    148217PROGRAMS = $(cfa_cpplib_PROGRAMS)
    149 am__dirstamp = $(am__leading_dot)dirstamp
    150 am__objects_1 = driver_cfa_cpp-main.$(OBJEXT) \
    151         driver_cfa_cpp-MakeLibCfa.$(OBJEXT) \
    152         CodeGen/driver_cfa_cpp-Generate.$(OBJEXT) \
    153         CodeGen/driver_cfa_cpp-CodeGenerator.$(OBJEXT) \
    154         CodeGen/driver_cfa_cpp-GenType.$(OBJEXT) \
    155         CodeGen/driver_cfa_cpp-FixNames.$(OBJEXT) \
    156         CodeGen/driver_cfa_cpp-FixMain.$(OBJEXT) \
    157         CodeGen/driver_cfa_cpp-OperatorTable.$(OBJEXT) \
    158         CodeTools/driver_cfa_cpp-DeclStats.$(OBJEXT) \
    159         CodeTools/driver_cfa_cpp-TrackLoc.$(OBJEXT) \
    160         Concurrency/driver_cfa_cpp-Keywords.$(OBJEXT) \
    161         Concurrency/driver_cfa_cpp-Waitfor.$(OBJEXT) \
    162         Common/driver_cfa_cpp-SemanticError.$(OBJEXT) \
    163         Common/driver_cfa_cpp-UniqueName.$(OBJEXT) \
    164         Common/driver_cfa_cpp-DebugMalloc.$(OBJEXT) \
    165         Common/driver_cfa_cpp-Assert.$(OBJEXT) \
    166         ControlStruct/driver_cfa_cpp-LabelGenerator.$(OBJEXT) \
    167         ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT) \
    168         ControlStruct/driver_cfa_cpp-MLEMutator.$(OBJEXT) \
    169         ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT) \
    170         ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) \
    171         ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT) \
    172         GenPoly/driver_cfa_cpp-Box.$(OBJEXT) \
    173         GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT) \
    174         GenPoly/driver_cfa_cpp-ScrubTyVars.$(OBJEXT) \
    175         GenPoly/driver_cfa_cpp-Lvalue.$(OBJEXT) \
    176         GenPoly/driver_cfa_cpp-Specialize.$(OBJEXT) \
    177         GenPoly/driver_cfa_cpp-FindFunction.$(OBJEXT) \
    178         GenPoly/driver_cfa_cpp-InstantiateGeneric.$(OBJEXT) \
    179         InitTweak/driver_cfa_cpp-GenInit.$(OBJEXT) \
    180         InitTweak/driver_cfa_cpp-FixInit.$(OBJEXT) \
    181         InitTweak/driver_cfa_cpp-FixGlobalInit.$(OBJEXT) \
    182         InitTweak/driver_cfa_cpp-InitTweak.$(OBJEXT) \
    183         Parser/driver_cfa_cpp-parser.$(OBJEXT) \
    184         Parser/driver_cfa_cpp-lex.$(OBJEXT) \
    185         Parser/driver_cfa_cpp-TypedefTable.$(OBJEXT) \
    186         Parser/driver_cfa_cpp-ParseNode.$(OBJEXT) \
    187         Parser/driver_cfa_cpp-DeclarationNode.$(OBJEXT) \
    188         Parser/driver_cfa_cpp-ExpressionNode.$(OBJEXT) \
    189         Parser/driver_cfa_cpp-StatementNode.$(OBJEXT) \
    190         Parser/driver_cfa_cpp-InitializerNode.$(OBJEXT) \
    191         Parser/driver_cfa_cpp-TypeData.$(OBJEXT) \
    192         Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT) \
    193         Parser/driver_cfa_cpp-parserutility.$(OBJEXT) \
    194         ResolvExpr/driver_cfa_cpp-AlternativeFinder.$(OBJEXT) \
    195         ResolvExpr/driver_cfa_cpp-Alternative.$(OBJEXT) \
    196         ResolvExpr/driver_cfa_cpp-Unify.$(OBJEXT) \
    197         ResolvExpr/driver_cfa_cpp-PtrsAssignable.$(OBJEXT) \
    198         ResolvExpr/driver_cfa_cpp-CommonType.$(OBJEXT) \
    199         ResolvExpr/driver_cfa_cpp-ConversionCost.$(OBJEXT) \
    200         ResolvExpr/driver_cfa_cpp-CastCost.$(OBJEXT) \
    201         ResolvExpr/driver_cfa_cpp-PtrsCastable.$(OBJEXT) \
    202         ResolvExpr/driver_cfa_cpp-AdjustExprType.$(OBJEXT) \
    203         ResolvExpr/driver_cfa_cpp-AlternativePrinter.$(OBJEXT) \
    204         ResolvExpr/driver_cfa_cpp-Resolver.$(OBJEXT) \
    205         ResolvExpr/driver_cfa_cpp-ResolveTypeof.$(OBJEXT) \
    206         ResolvExpr/driver_cfa_cpp-RenameVars.$(OBJEXT) \
    207         ResolvExpr/driver_cfa_cpp-FindOpenVars.$(OBJEXT) \
    208         ResolvExpr/driver_cfa_cpp-PolyCost.$(OBJEXT) \
    209         ResolvExpr/driver_cfa_cpp-Occurs.$(OBJEXT) \
    210         ResolvExpr/driver_cfa_cpp-TypeEnvironment.$(OBJEXT) \
    211         ResolvExpr/driver_cfa_cpp-CurrentObject.$(OBJEXT) \
    212         ResolvExpr/driver_cfa_cpp-ExplodedActual.$(OBJEXT) \
    213         SymTab/driver_cfa_cpp-Indexer.$(OBJEXT) \
    214         SymTab/driver_cfa_cpp-Mangler.$(OBJEXT) \
    215         SymTab/driver_cfa_cpp-Validate.$(OBJEXT) \
    216         SymTab/driver_cfa_cpp-FixFunction.$(OBJEXT) \
    217         SymTab/driver_cfa_cpp-Autogen.$(OBJEXT) \
    218         SynTree/driver_cfa_cpp-Type.$(OBJEXT) \
    219         SynTree/driver_cfa_cpp-VoidType.$(OBJEXT) \
    220         SynTree/driver_cfa_cpp-BasicType.$(OBJEXT) \
    221         SynTree/driver_cfa_cpp-PointerType.$(OBJEXT) \
    222         SynTree/driver_cfa_cpp-ArrayType.$(OBJEXT) \
    223         SynTree/driver_cfa_cpp-ReferenceType.$(OBJEXT) \
    224         SynTree/driver_cfa_cpp-FunctionType.$(OBJEXT) \
    225         SynTree/driver_cfa_cpp-ReferenceToType.$(OBJEXT) \
    226         SynTree/driver_cfa_cpp-TupleType.$(OBJEXT) \
    227         SynTree/driver_cfa_cpp-TypeofType.$(OBJEXT) \
    228         SynTree/driver_cfa_cpp-AttrType.$(OBJEXT) \
    229         SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT) \
    230         SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT) \
    231         SynTree/driver_cfa_cpp-Constant.$(OBJEXT) \
    232         SynTree/driver_cfa_cpp-Expression.$(OBJEXT) \
    233         SynTree/driver_cfa_cpp-TupleExpr.$(OBJEXT) \
    234         SynTree/driver_cfa_cpp-CommaExpr.$(OBJEXT) \
    235         SynTree/driver_cfa_cpp-TypeExpr.$(OBJEXT) \
    236         SynTree/driver_cfa_cpp-ApplicationExpr.$(OBJEXT) \
    237         SynTree/driver_cfa_cpp-AddressExpr.$(OBJEXT) \
    238         SynTree/driver_cfa_cpp-Statement.$(OBJEXT) \
    239         SynTree/driver_cfa_cpp-CompoundStmt.$(OBJEXT) \
    240         SynTree/driver_cfa_cpp-DeclStmt.$(OBJEXT) \
    241         SynTree/driver_cfa_cpp-Declaration.$(OBJEXT) \
    242         SynTree/driver_cfa_cpp-DeclarationWithType.$(OBJEXT) \
    243         SynTree/driver_cfa_cpp-ObjectDecl.$(OBJEXT) \
    244         SynTree/driver_cfa_cpp-FunctionDecl.$(OBJEXT) \
    245         SynTree/driver_cfa_cpp-AggregateDecl.$(OBJEXT) \
    246         SynTree/driver_cfa_cpp-NamedTypeDecl.$(OBJEXT) \
    247         SynTree/driver_cfa_cpp-TypeDecl.$(OBJEXT) \
    248         SynTree/driver_cfa_cpp-Initializer.$(OBJEXT) \
    249         SynTree/driver_cfa_cpp-Visitor.$(OBJEXT) \
    250         SynTree/driver_cfa_cpp-Mutator.$(OBJEXT) \
    251         SynTree/driver_cfa_cpp-TypeSubstitution.$(OBJEXT) \
    252         SynTree/driver_cfa_cpp-Attribute.$(OBJEXT) \
    253         SynTree/driver_cfa_cpp-VarExprReplacer.$(OBJEXT) \
    254         Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT) \
    255         Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT) \
    256         Tuples/driver_cfa_cpp-Explode.$(OBJEXT) \
    257         Virtual/driver_cfa_cpp-ExpandCasts.$(OBJEXT)
    258 am_driver_cfa_cpp_OBJECTS = $(am__objects_1)
    259 driver_cfa_cpp_OBJECTS = $(am_driver_cfa_cpp_OBJECTS)
    260 driver_cfa_cpp_DEPENDENCIES =
    261 driver_cfa_cpp_LINK = $(CXXLD) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) \
    262         $(driver_cfa_cpp_LDFLAGS) $(LDFLAGS) -o $@
     218am__objects_1 = main.$(OBJEXT) MakeLibCfa.$(OBJEXT) \
     219        CompilationState.$(OBJEXT) CodeGen/Generate.$(OBJEXT) \
     220        CodeGen/CodeGenerator.$(OBJEXT) CodeGen/GenType.$(OBJEXT) \
     221        CodeGen/FixNames.$(OBJEXT) CodeGen/FixMain.$(OBJEXT) \
     222        CodeGen/OperatorTable.$(OBJEXT) CodeTools/DeclStats.$(OBJEXT) \
     223        CodeTools/TrackLoc.$(OBJEXT) Concurrency/Keywords.$(OBJEXT) \
     224        Concurrency/Waitfor.$(OBJEXT) Common/SemanticError.$(OBJEXT) \
     225        Common/UniqueName.$(OBJEXT) Common/DebugMalloc.$(OBJEXT) \
     226        Common/Assert.$(OBJEXT) Common/Heap.$(OBJEXT) \
     227        Common/Eval.$(OBJEXT) ControlStruct/LabelGenerator.$(OBJEXT) \
     228        ControlStruct/LabelFixer.$(OBJEXT) \
     229        ControlStruct/MLEMutator.$(OBJEXT) \
     230        ControlStruct/Mutate.$(OBJEXT) \
     231        ControlStruct/ForExprMutator.$(OBJEXT) \
     232        ControlStruct/ExceptTranslate.$(OBJEXT) GenPoly/Box.$(OBJEXT) \
     233        GenPoly/GenPoly.$(OBJEXT) GenPoly/ScrubTyVars.$(OBJEXT) \
     234        GenPoly/Lvalue.$(OBJEXT) GenPoly/Specialize.$(OBJEXT) \
     235        GenPoly/FindFunction.$(OBJEXT) \
     236        GenPoly/InstantiateGeneric.$(OBJEXT) \
     237        InitTweak/GenInit.$(OBJEXT) InitTweak/FixInit.$(OBJEXT) \
     238        InitTweak/FixGlobalInit.$(OBJEXT) \
     239        InitTweak/InitTweak.$(OBJEXT) Parser/parser.$(OBJEXT) \
     240        Parser/lex.$(OBJEXT) Parser/TypedefTable.$(OBJEXT) \
     241        Parser/ParseNode.$(OBJEXT) Parser/DeclarationNode.$(OBJEXT) \
     242        Parser/ExpressionNode.$(OBJEXT) Parser/StatementNode.$(OBJEXT) \
     243        Parser/InitializerNode.$(OBJEXT) Parser/TypeData.$(OBJEXT) \
     244        Parser/LinkageSpec.$(OBJEXT) Parser/parserutility.$(OBJEXT) \
     245        ResolvExpr/AlternativeFinder.$(OBJEXT) \
     246        ResolvExpr/Alternative.$(OBJEXT) ResolvExpr/Unify.$(OBJEXT) \
     247        ResolvExpr/PtrsAssignable.$(OBJEXT) \
     248        ResolvExpr/CommonType.$(OBJEXT) \
     249        ResolvExpr/ConversionCost.$(OBJEXT) \
     250        ResolvExpr/CastCost.$(OBJEXT) \
     251        ResolvExpr/PtrsCastable.$(OBJEXT) \
     252        ResolvExpr/AdjustExprType.$(OBJEXT) \
     253        ResolvExpr/AlternativePrinter.$(OBJEXT) \
     254        ResolvExpr/Resolver.$(OBJEXT) \
     255        ResolvExpr/ResolveTypeof.$(OBJEXT) \
     256        ResolvExpr/RenameVars.$(OBJEXT) \
     257        ResolvExpr/FindOpenVars.$(OBJEXT) \
     258        ResolvExpr/PolyCost.$(OBJEXT) ResolvExpr/Occurs.$(OBJEXT) \
     259        ResolvExpr/TypeEnvironment.$(OBJEXT) \
     260        ResolvExpr/CurrentObject.$(OBJEXT) \
     261        ResolvExpr/ExplodedActual.$(OBJEXT) SymTab/Indexer.$(OBJEXT) \
     262        SymTab/Mangler.$(OBJEXT) SymTab/ManglerCommon.$(OBJEXT) \
     263        SymTab/Validate.$(OBJEXT) SymTab/FixFunction.$(OBJEXT) \
     264        SymTab/Autogen.$(OBJEXT) SynTree/Type.$(OBJEXT) \
     265        SynTree/VoidType.$(OBJEXT) SynTree/BasicType.$(OBJEXT) \
     266        SynTree/PointerType.$(OBJEXT) SynTree/ArrayType.$(OBJEXT) \
     267        SynTree/ReferenceType.$(OBJEXT) SynTree/FunctionType.$(OBJEXT) \
     268        SynTree/ReferenceToType.$(OBJEXT) SynTree/TupleType.$(OBJEXT) \
     269        SynTree/TypeofType.$(OBJEXT) SynTree/AttrType.$(OBJEXT) \
     270        SynTree/VarArgsType.$(OBJEXT) SynTree/ZeroOneType.$(OBJEXT) \
     271        SynTree/Constant.$(OBJEXT) SynTree/Expression.$(OBJEXT) \
     272        SynTree/TupleExpr.$(OBJEXT) SynTree/CommaExpr.$(OBJEXT) \
     273        SynTree/TypeExpr.$(OBJEXT) SynTree/ApplicationExpr.$(OBJEXT) \
     274        SynTree/AddressExpr.$(OBJEXT) SynTree/Statement.$(OBJEXT) \
     275        SynTree/CompoundStmt.$(OBJEXT) SynTree/DeclStmt.$(OBJEXT) \
     276        SynTree/Declaration.$(OBJEXT) \
     277        SynTree/DeclarationWithType.$(OBJEXT) \
     278        SynTree/ObjectDecl.$(OBJEXT) SynTree/FunctionDecl.$(OBJEXT) \
     279        SynTree/AggregateDecl.$(OBJEXT) \
     280        SynTree/NamedTypeDecl.$(OBJEXT) SynTree/TypeDecl.$(OBJEXT) \
     281        SynTree/Initializer.$(OBJEXT) \
     282        SynTree/TypeSubstitution.$(OBJEXT) SynTree/Attribute.$(OBJEXT) \
     283        SynTree/DeclReplacer.$(OBJEXT) \
     284        Tuples/TupleAssignment.$(OBJEXT) \
     285        Tuples/TupleExpansion.$(OBJEXT) Tuples/Explode.$(OBJEXT) \
     286        Validate/HandleAttributes.$(OBJEXT) \
     287        Virtual/ExpandCasts.$(OBJEXT)
     288am____driver_cfa_cpp_OBJECTS = $(am__objects_1)
     289___driver_cfa_cpp_OBJECTS = $(am____driver_cfa_cpp_OBJECTS)
     290___driver_cfa_cpp_DEPENDENCIES =
     291am_demangler_OBJECTS = SymTab/demangler.$(OBJEXT)
     292demangler_OBJECTS = $(am_demangler_OBJECTS)
     293demangler_DEPENDENCIES = libdemangle.a
    263294AM_V_P = $(am__v_P_@AM_V@)
    264295am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     
    277308am__depfiles_maybe = depfiles
    278309am__mv = mv -f
    279 AM_V_lt = $(am__v_lt_@AM_V@)
    280 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
    281 am__v_lt_0 = --silent
    282 am__v_lt_1 =
    283310CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
    284311        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
     
    294321am__v_CXXLD_0 = @echo "  CXXLD   " $@;
    295322am__v_CXXLD_1 =
    296 @MAINTAINER_MODE_FALSE@am__skiplex = test -f $@ ||
    297323LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS)
    298324AM_V_LEX = $(am__v_LEX_@AM_V@)
     
    301327am__v_LEX_1 =
    302328YLWRAP = $(top_srcdir)/automake/ylwrap
    303 @MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ ||
    304329am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \
    305330                   -e s/c++$$/h++/ -e s/c$$/h/
     
    321346am__v_CCLD_0 = @echo "  CCLD    " $@;
    322347am__v_CCLD_1 =
    323 SOURCES = $(driver_cfa_cpp_SOURCES)
    324 DIST_SOURCES = $(driver_cfa_cpp_SOURCES)
     348SOURCES = $(libdemangle_a_SOURCES) $(___driver_cfa_cpp_SOURCES) \
     349        $(demangler_SOURCES)
     350DIST_SOURCES = $(libdemangle_a_SOURCES) $(___driver_cfa_cpp_SOURCES) \
     351        $(demangler_SOURCES)
    325352am__can_run_installinfo = \
    326353  case $$AM_UPDATE_INFO_DIR in \
     
    328355    *) (install-info --version) >/dev/null 2>&1;; \
    329356  esac
    330 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     357am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
     358        $(LISP)config.h.in
    331359# Read a list of newline-separated strings from the standard input,
    332360# and print each of them once, without duplicates.  Input order is
     
    354382        $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk \
    355383        $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk \
    356         $(srcdir)/Tuples/module.mk $(srcdir)/Virtual/module.mk \
    357         $(top_srcdir)/automake/depcomp $(top_srcdir)/automake/ylwrap \
    358         Parser/lex.cc Parser/parser.cc Parser/parser.hh
     384        $(srcdir)/Tuples/module.mk $(srcdir)/Validate/module.mk \
     385        $(srcdir)/Virtual/module.mk $(top_srcdir)/automake/depcomp \
     386        $(top_srcdir)/automake/ylwrap Parser/lex.cc Parser/parser.cc \
     387        Parser/parser.hh
    359388DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    360389ACLOCAL = @ACLOCAL@
     
    367396AWK = @AWK@
    368397BACKEND_CC = @BACKEND_CC@
     398BUILD_IN_TREE_FLAGS = @BUILD_IN_TREE_FLAGS@
    369399CC = @CC@
    370400CCAS = @CCAS@
     
    372402CCASFLAGS = @CCASFLAGS@
    373403CCDEPMODE = @CCDEPMODE@
     404CFACC = @CFACC@
     405CFACPP = @CFACPP@
    374406CFA_BACKEND_CC = @CFA_BACKEND_CC@
    375407CFA_BINDIR = @CFA_BINDIR@
     
    388420DEFS = @DEFS@
    389421DEPDIR = @DEPDIR@
     422DRIVER_DIR = @DRIVER_DIR@
    390423ECHO_C = @ECHO_C@
    391424ECHO_N = @ECHO_N@
     
    394427EXEEXT = @EXEEXT@
    395428GREP = @GREP@
     429HOST_FLAGS = @HOST_FLAGS@
    396430INSTALL = @INSTALL@
    397431INSTALL_DATA = @INSTALL_DATA@
     
    403437LEXLIB = @LEXLIB@
    404438LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
     439LIBCFA_TARGET_DIRS = @LIBCFA_TARGET_DIRS@
     440LIBCFA_TARGET_MAKEFILES = @LIBCFA_TARGET_MAKEFILES@
    405441LIBOBJS = @LIBOBJS@
    406442LIBS = @LIBS@
    407443LTLIBOBJS = @LTLIBOBJS@
    408 MACHINE_TYPE = @MACHINE_TYPE@
    409 MAINT = @MAINT@
    410444MAKEINFO = @MAKEINFO@
    411445MKDIR_P = @MKDIR_P@
     
    423457SHELL = @SHELL@
    424458STRIP = @STRIP@
     459TARGET_HOSTS = @TARGET_HOSTS@
    425460VERSION = @VERSION@
    426461YACC = @YACC@
     
    480515
    481516# create object files in directory with source files
    482 AUTOMAKE_OPTIONS = subdir-objects
    483 SRC = main.cc MakeLibCfa.cc CodeGen/Generate.cc \
     517AUTOMAKE_OPTIONS = foreign subdir-objects
     518SRC = main.cc MakeLibCfa.cc CompilationState.cc CodeGen/Generate.cc \
    484519        CodeGen/CodeGenerator.cc CodeGen/GenType.cc \
    485520        CodeGen/FixNames.cc CodeGen/FixMain.cc \
     
    488523        Concurrency/Waitfor.cc Common/SemanticError.cc \
    489524        Common/UniqueName.cc Common/DebugMalloc.cc Common/Assert.cc \
    490         ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \
    491         ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \
    492         ControlStruct/ForExprMutator.cc \
     525        Common/Heap.cc Common/Eval.cc ControlStruct/LabelGenerator.cc \
     526        ControlStruct/LabelFixer.cc ControlStruct/MLEMutator.cc \
     527        ControlStruct/Mutate.cc ControlStruct/ForExprMutator.cc \
    493528        ControlStruct/ExceptTranslate.cc GenPoly/Box.cc \
    494529        GenPoly/GenPoly.cc GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc \
     
    511546        ResolvExpr/Occurs.cc ResolvExpr/TypeEnvironment.cc \
    512547        ResolvExpr/CurrentObject.cc ResolvExpr/ExplodedActual.cc \
    513         SymTab/Indexer.cc SymTab/Mangler.cc SymTab/Validate.cc \
    514         SymTab/FixFunction.cc SymTab/Autogen.cc SynTree/Type.cc \
    515         SynTree/VoidType.cc SynTree/BasicType.cc \
     548        SymTab/Indexer.cc SymTab/Mangler.cc SymTab/ManglerCommon.cc \
     549        SymTab/Validate.cc SymTab/FixFunction.cc SymTab/Autogen.cc \
     550        SynTree/Type.cc SynTree/VoidType.cc SynTree/BasicType.cc \
    516551        SynTree/PointerType.cc SynTree/ArrayType.cc \
    517552        SynTree/ReferenceType.cc SynTree/FunctionType.cc \
     
    527562        SynTree/FunctionDecl.cc SynTree/AggregateDecl.cc \
    528563        SynTree/NamedTypeDecl.cc SynTree/TypeDecl.cc \
    529         SynTree/Initializer.cc SynTree/Visitor.cc SynTree/Mutator.cc \
    530         SynTree/TypeSubstitution.cc SynTree/Attribute.cc \
    531         SynTree/VarExprReplacer.cc Tuples/TupleAssignment.cc \
    532         Tuples/TupleExpansion.cc Tuples/Explode.cc \
     564        SynTree/Initializer.cc SynTree/TypeSubstitution.cc \
     565        SynTree/Attribute.cc SynTree/DeclReplacer.cc \
     566        Tuples/TupleAssignment.cc Tuples/TupleExpansion.cc \
     567        Tuples/Explode.cc Validate/HandleAttributes.cc \
    533568        Virtual/ExpandCasts.cc
    534 MAINTAINERCLEANFILES = Parser/parser.output ${libdir}/${notdir \
    535         ${cfa_cpplib_PROGRAMS}}
     569MAINTAINERCLEANFILES = ${libdir}/${notdir ${cfa_cpplib_PROGRAMS}}
     570MOSTLYCLEANFILES = Parser/parser.hh Parser/parser.output
    536571BUILT_SOURCES = Parser/parser.hh
    537572AM_YFLAGS = -d -t -v
     
    540575
    541576# put into lib for now
    542 cfa_cpplibdir = ${CFA_LIBDIR}
    543 driver_cfa_cpp_SOURCES = ${SRC}
    544 driver_cfa_cpp_LDADD = -ldl                     # yywrap
    545 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -Wextra -DDEBUG_ALL -I${abs_top_srcdir}/src/include -DYY_NO_INPUT -O2 -g -std=c++14
    546 driver_cfa_cpp_LDFLAGS = -Xlinker -export-dynamic
     577cfa_cpplibdir = $(CFA_LIBDIR)
     578___driver_cfa_cpp_SOURCES = $(SRC)
     579___driver_cfa_cpp_LDADD = -ldl                  # yywrap
     580AM_CXXFLAGS = @HOST_FLAGS@ -Wno-deprecated -Wall -Wextra -DDEBUG_ALL -I./Parser -I$(srcdir)/Parser -I$(srcdir)/include -DYY_NO_INPUT -O2 -g -std=c++14
     581AM_LDFLAGS = @HOST_FLAGS@ -Xlinker -export-dynamic
     582demangler_SOURCES = SymTab/demangler.cc
     583demangler_LDADD = libdemangle.a     # yywrap
     584noinst_LIBRARIES = libdemangle.a
     585libdemangle_a_SOURCES = SymTab/Demangle.cc SymTab/ManglerCommon.cc \
     586  SynTree/Type.cc \
     587  SynTree/VoidType.cc \
     588  SynTree/BasicType.cc \
     589  SynTree/PointerType.cc \
     590  SynTree/ArrayType.cc \
     591  SynTree/ReferenceType.cc \
     592  SynTree/FunctionType.cc \
     593  SynTree/ReferenceToType.cc \
     594  SynTree/TupleType.cc \
     595  SynTree/TypeofType.cc \
     596  SynTree/AttrType.cc \
     597  SynTree/VarArgsType.cc \
     598  SynTree/ZeroOneType.cc \
     599  SynTree/Constant.cc \
     600  SynTree/Expression.cc \
     601  SynTree/TupleExpr.cc \
     602  SynTree/CommaExpr.cc \
     603  SynTree/TypeExpr.cc \
     604  SynTree/ApplicationExpr.cc \
     605  SynTree/AddressExpr.cc \
     606  SynTree/Statement.cc \
     607  SynTree/CompoundStmt.cc \
     608  SynTree/DeclStmt.cc \
     609  SynTree/Declaration.cc \
     610  SynTree/DeclarationWithType.cc \
     611  SynTree/ObjectDecl.cc \
     612  SynTree/FunctionDecl.cc \
     613  SynTree/AggregateDecl.cc \
     614  SynTree/NamedTypeDecl.cc \
     615  SynTree/TypeDecl.cc \
     616  SynTree/Initializer.cc \
     617  SynTree/TypeSubstitution.cc \
     618  SynTree/Attribute.cc \
     619  SynTree/DeclReplacer.cc \
     620  CompilationState.cc \
     621  CodeGen/CodeGenerator.cc \
     622  CodeGen/FixMain.cc \
     623  CodeGen/GenType.cc \
     624  CodeGen/OperatorTable.cc \
     625  Common/Assert.cc \
     626  Common/Eval.cc \
     627  Common/SemanticError.cc \
     628  Common/UniqueName.cc \
     629  Concurrency/Keywords.cc \
     630  ControlStruct/ForExprMutator.cc \
     631  ControlStruct/LabelFixer.cc \
     632  ControlStruct/LabelGenerator.cc \
     633  ControlStruct/MLEMutator.cc \
     634  ControlStruct/Mutate.cc \
     635  GenPoly/GenPoly.cc \
     636  GenPoly/Lvalue.cc \
     637  InitTweak/GenInit.cc \
     638  InitTweak/InitTweak.cc \
     639  Parser/LinkageSpec.cc \
     640  ResolvExpr/AdjustExprType.cc \
     641  ResolvExpr/Alternative.cc \
     642  ResolvExpr/AlternativeFinder.cc \
     643  ResolvExpr/ExplodedActual.cc \
     644  ResolvExpr/CastCost.cc \
     645  ResolvExpr/CommonType.cc \
     646  ResolvExpr/ConversionCost.cc \
     647  ResolvExpr/CurrentObject.cc \
     648  ResolvExpr/FindOpenVars.cc \
     649  ResolvExpr/Occurs.cc \
     650  ResolvExpr/PolyCost.cc \
     651  ResolvExpr/PtrsAssignable.cc \
     652  ResolvExpr/PtrsCastable.cc \
     653  ResolvExpr/RenameVars.cc \
     654  ResolvExpr/Resolver.cc \
     655  ResolvExpr/ResolveTypeof.cc \
     656  ResolvExpr/TypeEnvironment.cc \
     657  ResolvExpr/Unify.cc \
     658  SymTab/Autogen.cc \
     659  SymTab/FixFunction.cc \
     660  SymTab/Indexer.cc \
     661  SymTab/Mangler.cc \
     662  SymTab/Validate.cc \
     663  Tuples/Explode.cc \
     664  Tuples/TupleAssignment.cc \
     665  Tuples/TupleExpansion.cc \
     666  Validate/HandleAttributes.cc
     667
    547668all: $(BUILT_SOURCES)
    548669        $(MAKE) $(AM_MAKEFLAGS) all-am
     
    550671.SUFFIXES:
    551672.SUFFIXES: .cc .ll .o .obj .yy
    552 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/CodeGen/module.mk $(srcdir)/CodeTools/module.mk $(srcdir)/Concurrency/module.mk $(srcdir)/Common/module.mk $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk $(srcdir)/InitTweak/module.mk $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk $(srcdir)/Tuples/module.mk $(srcdir)/Virtual/module.mk $(am__configure_deps)
     673$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(srcdir)/CodeGen/module.mk $(srcdir)/CodeTools/module.mk $(srcdir)/Concurrency/module.mk $(srcdir)/Common/module.mk $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk $(srcdir)/InitTweak/module.mk $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk $(srcdir)/Tuples/module.mk $(srcdir)/Validate/module.mk $(srcdir)/Virtual/module.mk $(am__configure_deps)
    553674        @for dep in $?; do \
    554675          case '$(am__configure_deps)' in \
     
    570691            cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
    571692        esac;
    572 $(srcdir)/CodeGen/module.mk $(srcdir)/CodeTools/module.mk $(srcdir)/Concurrency/module.mk $(srcdir)/Common/module.mk $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk $(srcdir)/InitTweak/module.mk $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk $(srcdir)/Tuples/module.mk $(srcdir)/Virtual/module.mk $(am__empty):
     693$(srcdir)/CodeGen/module.mk $(srcdir)/CodeTools/module.mk $(srcdir)/Concurrency/module.mk $(srcdir)/Common/module.mk $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk $(srcdir)/InitTweak/module.mk $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk $(srcdir)/Tuples/module.mk $(srcdir)/Validate/module.mk $(srcdir)/Virtual/module.mk $(am__empty):
    573694
    574695$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
    575696        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    576697
    577 $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
     698$(top_srcdir)/configure: $(am__configure_deps)
    578699        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    579 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
     700$(ACLOCAL_M4): $(am__aclocal_m4_deps)
    580701        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    581702$(am__aclocal_m4_deps):
     703
     704clean-noinstLIBRARIES:
     705        -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
     706SymTab/$(am__dirstamp):
     707        @$(MKDIR_P) SymTab
     708        @: > SymTab/$(am__dirstamp)
     709SymTab/$(DEPDIR)/$(am__dirstamp):
     710        @$(MKDIR_P) SymTab/$(DEPDIR)
     711        @: > SymTab/$(DEPDIR)/$(am__dirstamp)
     712SymTab/Demangle.$(OBJEXT): SymTab/$(am__dirstamp) \
     713        SymTab/$(DEPDIR)/$(am__dirstamp)
     714SymTab/ManglerCommon.$(OBJEXT): SymTab/$(am__dirstamp) \
     715        SymTab/$(DEPDIR)/$(am__dirstamp)
     716SynTree/$(am__dirstamp):
     717        @$(MKDIR_P) SynTree
     718        @: > SynTree/$(am__dirstamp)
     719SynTree/$(DEPDIR)/$(am__dirstamp):
     720        @$(MKDIR_P) SynTree/$(DEPDIR)
     721        @: > SynTree/$(DEPDIR)/$(am__dirstamp)
     722SynTree/Type.$(OBJEXT): SynTree/$(am__dirstamp) \
     723        SynTree/$(DEPDIR)/$(am__dirstamp)
     724SynTree/VoidType.$(OBJEXT): SynTree/$(am__dirstamp) \
     725        SynTree/$(DEPDIR)/$(am__dirstamp)
     726SynTree/BasicType.$(OBJEXT): SynTree/$(am__dirstamp) \
     727        SynTree/$(DEPDIR)/$(am__dirstamp)
     728SynTree/PointerType.$(OBJEXT): SynTree/$(am__dirstamp) \
     729        SynTree/$(DEPDIR)/$(am__dirstamp)
     730SynTree/ArrayType.$(OBJEXT): SynTree/$(am__dirstamp) \
     731        SynTree/$(DEPDIR)/$(am__dirstamp)
     732SynTree/ReferenceType.$(OBJEXT): SynTree/$(am__dirstamp) \
     733        SynTree/$(DEPDIR)/$(am__dirstamp)
     734SynTree/FunctionType.$(OBJEXT): SynTree/$(am__dirstamp) \
     735        SynTree/$(DEPDIR)/$(am__dirstamp)
     736SynTree/ReferenceToType.$(OBJEXT): SynTree/$(am__dirstamp) \
     737        SynTree/$(DEPDIR)/$(am__dirstamp)
     738SynTree/TupleType.$(OBJEXT): SynTree/$(am__dirstamp) \
     739        SynTree/$(DEPDIR)/$(am__dirstamp)
     740SynTree/TypeofType.$(OBJEXT): SynTree/$(am__dirstamp) \
     741        SynTree/$(DEPDIR)/$(am__dirstamp)
     742SynTree/AttrType.$(OBJEXT): SynTree/$(am__dirstamp) \
     743        SynTree/$(DEPDIR)/$(am__dirstamp)
     744SynTree/VarArgsType.$(OBJEXT): SynTree/$(am__dirstamp) \
     745        SynTree/$(DEPDIR)/$(am__dirstamp)
     746SynTree/ZeroOneType.$(OBJEXT): SynTree/$(am__dirstamp) \
     747        SynTree/$(DEPDIR)/$(am__dirstamp)
     748SynTree/Constant.$(OBJEXT): SynTree/$(am__dirstamp) \
     749        SynTree/$(DEPDIR)/$(am__dirstamp)
     750SynTree/Expression.$(OBJEXT): SynTree/$(am__dirstamp) \
     751        SynTree/$(DEPDIR)/$(am__dirstamp)
     752SynTree/TupleExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     753        SynTree/$(DEPDIR)/$(am__dirstamp)
     754SynTree/CommaExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     755        SynTree/$(DEPDIR)/$(am__dirstamp)
     756SynTree/TypeExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     757        SynTree/$(DEPDIR)/$(am__dirstamp)
     758SynTree/ApplicationExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     759        SynTree/$(DEPDIR)/$(am__dirstamp)
     760SynTree/AddressExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     761        SynTree/$(DEPDIR)/$(am__dirstamp)
     762SynTree/Statement.$(OBJEXT): SynTree/$(am__dirstamp) \
     763        SynTree/$(DEPDIR)/$(am__dirstamp)
     764SynTree/CompoundStmt.$(OBJEXT): SynTree/$(am__dirstamp) \
     765        SynTree/$(DEPDIR)/$(am__dirstamp)
     766SynTree/DeclStmt.$(OBJEXT): SynTree/$(am__dirstamp) \
     767        SynTree/$(DEPDIR)/$(am__dirstamp)
     768SynTree/Declaration.$(OBJEXT): SynTree/$(am__dirstamp) \
     769        SynTree/$(DEPDIR)/$(am__dirstamp)
     770SynTree/DeclarationWithType.$(OBJEXT): SynTree/$(am__dirstamp) \
     771        SynTree/$(DEPDIR)/$(am__dirstamp)
     772SynTree/ObjectDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     773        SynTree/$(DEPDIR)/$(am__dirstamp)
     774SynTree/FunctionDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     775        SynTree/$(DEPDIR)/$(am__dirstamp)
     776SynTree/AggregateDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     777        SynTree/$(DEPDIR)/$(am__dirstamp)
     778SynTree/NamedTypeDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     779        SynTree/$(DEPDIR)/$(am__dirstamp)
     780SynTree/TypeDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     781        SynTree/$(DEPDIR)/$(am__dirstamp)
     782SynTree/Initializer.$(OBJEXT): SynTree/$(am__dirstamp) \
     783        SynTree/$(DEPDIR)/$(am__dirstamp)
     784SynTree/TypeSubstitution.$(OBJEXT): SynTree/$(am__dirstamp) \
     785        SynTree/$(DEPDIR)/$(am__dirstamp)
     786SynTree/Attribute.$(OBJEXT): SynTree/$(am__dirstamp) \
     787        SynTree/$(DEPDIR)/$(am__dirstamp)
     788SynTree/DeclReplacer.$(OBJEXT): SynTree/$(am__dirstamp) \
     789        SynTree/$(DEPDIR)/$(am__dirstamp)
     790CodeGen/$(am__dirstamp):
     791        @$(MKDIR_P) CodeGen
     792        @: > CodeGen/$(am__dirstamp)
     793CodeGen/$(DEPDIR)/$(am__dirstamp):
     794        @$(MKDIR_P) CodeGen/$(DEPDIR)
     795        @: > CodeGen/$(DEPDIR)/$(am__dirstamp)
     796CodeGen/CodeGenerator.$(OBJEXT): CodeGen/$(am__dirstamp) \
     797        CodeGen/$(DEPDIR)/$(am__dirstamp)
     798CodeGen/FixMain.$(OBJEXT): CodeGen/$(am__dirstamp) \
     799        CodeGen/$(DEPDIR)/$(am__dirstamp)
     800CodeGen/GenType.$(OBJEXT): CodeGen/$(am__dirstamp) \
     801        CodeGen/$(DEPDIR)/$(am__dirstamp)
     802CodeGen/OperatorTable.$(OBJEXT): CodeGen/$(am__dirstamp) \
     803        CodeGen/$(DEPDIR)/$(am__dirstamp)
     804Common/$(am__dirstamp):
     805        @$(MKDIR_P) Common
     806        @: > Common/$(am__dirstamp)
     807Common/$(DEPDIR)/$(am__dirstamp):
     808        @$(MKDIR_P) Common/$(DEPDIR)
     809        @: > Common/$(DEPDIR)/$(am__dirstamp)
     810Common/Assert.$(OBJEXT): Common/$(am__dirstamp) \
     811        Common/$(DEPDIR)/$(am__dirstamp)
     812Common/Eval.$(OBJEXT): Common/$(am__dirstamp) \
     813        Common/$(DEPDIR)/$(am__dirstamp)
     814Common/SemanticError.$(OBJEXT): Common/$(am__dirstamp) \
     815        Common/$(DEPDIR)/$(am__dirstamp)
     816Common/UniqueName.$(OBJEXT): Common/$(am__dirstamp) \
     817        Common/$(DEPDIR)/$(am__dirstamp)
     818Concurrency/$(am__dirstamp):
     819        @$(MKDIR_P) Concurrency
     820        @: > Concurrency/$(am__dirstamp)
     821Concurrency/$(DEPDIR)/$(am__dirstamp):
     822        @$(MKDIR_P) Concurrency/$(DEPDIR)
     823        @: > Concurrency/$(DEPDIR)/$(am__dirstamp)
     824Concurrency/Keywords.$(OBJEXT): Concurrency/$(am__dirstamp) \
     825        Concurrency/$(DEPDIR)/$(am__dirstamp)
     826ControlStruct/$(am__dirstamp):
     827        @$(MKDIR_P) ControlStruct
     828        @: > ControlStruct/$(am__dirstamp)
     829ControlStruct/$(DEPDIR)/$(am__dirstamp):
     830        @$(MKDIR_P) ControlStruct/$(DEPDIR)
     831        @: > ControlStruct/$(DEPDIR)/$(am__dirstamp)
     832ControlStruct/ForExprMutator.$(OBJEXT): ControlStruct/$(am__dirstamp) \
     833        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     834ControlStruct/LabelFixer.$(OBJEXT): ControlStruct/$(am__dirstamp) \
     835        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     836ControlStruct/LabelGenerator.$(OBJEXT): ControlStruct/$(am__dirstamp) \
     837        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     838ControlStruct/MLEMutator.$(OBJEXT): ControlStruct/$(am__dirstamp) \
     839        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     840ControlStruct/Mutate.$(OBJEXT): ControlStruct/$(am__dirstamp) \
     841        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     842GenPoly/$(am__dirstamp):
     843        @$(MKDIR_P) GenPoly
     844        @: > GenPoly/$(am__dirstamp)
     845GenPoly/$(DEPDIR)/$(am__dirstamp):
     846        @$(MKDIR_P) GenPoly/$(DEPDIR)
     847        @: > GenPoly/$(DEPDIR)/$(am__dirstamp)
     848GenPoly/GenPoly.$(OBJEXT): GenPoly/$(am__dirstamp) \
     849        GenPoly/$(DEPDIR)/$(am__dirstamp)
     850GenPoly/Lvalue.$(OBJEXT): GenPoly/$(am__dirstamp) \
     851        GenPoly/$(DEPDIR)/$(am__dirstamp)
     852InitTweak/$(am__dirstamp):
     853        @$(MKDIR_P) InitTweak
     854        @: > InitTweak/$(am__dirstamp)
     855InitTweak/$(DEPDIR)/$(am__dirstamp):
     856        @$(MKDIR_P) InitTweak/$(DEPDIR)
     857        @: > InitTweak/$(DEPDIR)/$(am__dirstamp)
     858InitTweak/GenInit.$(OBJEXT): InitTweak/$(am__dirstamp) \
     859        InitTweak/$(DEPDIR)/$(am__dirstamp)
     860InitTweak/InitTweak.$(OBJEXT): InitTweak/$(am__dirstamp) \
     861        InitTweak/$(DEPDIR)/$(am__dirstamp)
     862Parser/$(am__dirstamp):
     863        @$(MKDIR_P) Parser
     864        @: > Parser/$(am__dirstamp)
     865Parser/$(DEPDIR)/$(am__dirstamp):
     866        @$(MKDIR_P) Parser/$(DEPDIR)
     867        @: > Parser/$(DEPDIR)/$(am__dirstamp)
     868Parser/LinkageSpec.$(OBJEXT): Parser/$(am__dirstamp) \
     869        Parser/$(DEPDIR)/$(am__dirstamp)
     870ResolvExpr/$(am__dirstamp):
     871        @$(MKDIR_P) ResolvExpr
     872        @: > ResolvExpr/$(am__dirstamp)
     873ResolvExpr/$(DEPDIR)/$(am__dirstamp):
     874        @$(MKDIR_P) ResolvExpr/$(DEPDIR)
     875        @: > ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     876ResolvExpr/AdjustExprType.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     877        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     878ResolvExpr/Alternative.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     879        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     880ResolvExpr/AlternativeFinder.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     881        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     882ResolvExpr/ExplodedActual.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     883        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     884ResolvExpr/CastCost.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     885        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     886ResolvExpr/CommonType.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     887        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     888ResolvExpr/ConversionCost.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     889        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     890ResolvExpr/CurrentObject.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     891        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     892ResolvExpr/FindOpenVars.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     893        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     894ResolvExpr/Occurs.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     895        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     896ResolvExpr/PolyCost.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     897        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     898ResolvExpr/PtrsAssignable.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     899        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     900ResolvExpr/PtrsCastable.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     901        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     902ResolvExpr/RenameVars.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     903        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     904ResolvExpr/Resolver.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     905        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     906ResolvExpr/ResolveTypeof.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     907        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     908ResolvExpr/TypeEnvironment.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     909        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     910ResolvExpr/Unify.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     911        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     912SymTab/Autogen.$(OBJEXT): SymTab/$(am__dirstamp) \
     913        SymTab/$(DEPDIR)/$(am__dirstamp)
     914SymTab/FixFunction.$(OBJEXT): SymTab/$(am__dirstamp) \
     915        SymTab/$(DEPDIR)/$(am__dirstamp)
     916SymTab/Indexer.$(OBJEXT): SymTab/$(am__dirstamp) \
     917        SymTab/$(DEPDIR)/$(am__dirstamp)
     918SymTab/Mangler.$(OBJEXT): SymTab/$(am__dirstamp) \
     919        SymTab/$(DEPDIR)/$(am__dirstamp)
     920SymTab/Validate.$(OBJEXT): SymTab/$(am__dirstamp) \
     921        SymTab/$(DEPDIR)/$(am__dirstamp)
     922Tuples/$(am__dirstamp):
     923        @$(MKDIR_P) Tuples
     924        @: > Tuples/$(am__dirstamp)
     925Tuples/$(DEPDIR)/$(am__dirstamp):
     926        @$(MKDIR_P) Tuples/$(DEPDIR)
     927        @: > Tuples/$(DEPDIR)/$(am__dirstamp)
     928Tuples/Explode.$(OBJEXT): Tuples/$(am__dirstamp) \
     929        Tuples/$(DEPDIR)/$(am__dirstamp)
     930Tuples/TupleAssignment.$(OBJEXT): Tuples/$(am__dirstamp) \
     931        Tuples/$(DEPDIR)/$(am__dirstamp)
     932Tuples/TupleExpansion.$(OBJEXT): Tuples/$(am__dirstamp) \
     933        Tuples/$(DEPDIR)/$(am__dirstamp)
     934Validate/$(am__dirstamp):
     935        @$(MKDIR_P) Validate
     936        @: > Validate/$(am__dirstamp)
     937Validate/$(DEPDIR)/$(am__dirstamp):
     938        @$(MKDIR_P) Validate/$(DEPDIR)
     939        @: > Validate/$(DEPDIR)/$(am__dirstamp)
     940Validate/HandleAttributes.$(OBJEXT): Validate/$(am__dirstamp) \
     941        Validate/$(DEPDIR)/$(am__dirstamp)
     942
     943libdemangle.a: $(libdemangle_a_OBJECTS) $(libdemangle_a_DEPENDENCIES) $(EXTRA_libdemangle_a_DEPENDENCIES)
     944        $(AM_V_at)-rm -f libdemangle.a
     945        $(AM_V_AR)$(libdemangle_a_AR) libdemangle.a $(libdemangle_a_OBJECTS) $(libdemangle_a_LIBADD)
     946        $(AM_V_at)$(RANLIB) libdemangle.a
    582947install-cfa_cpplibPROGRAMS: $(cfa_cpplib_PROGRAMS)
    583948        @$(NORMAL_INSTALL)
     
    622987clean-cfa_cpplibPROGRAMS:
    623988        -test -z "$(cfa_cpplib_PROGRAMS)" || rm -f $(cfa_cpplib_PROGRAMS)
    624 CodeGen/$(am__dirstamp):
    625         @$(MKDIR_P) CodeGen
    626         @: > CodeGen/$(am__dirstamp)
    627 CodeGen/$(DEPDIR)/$(am__dirstamp):
    628         @$(MKDIR_P) CodeGen/$(DEPDIR)
    629         @: > CodeGen/$(DEPDIR)/$(am__dirstamp)
    630 CodeGen/driver_cfa_cpp-Generate.$(OBJEXT): CodeGen/$(am__dirstamp) \
     989CodeGen/Generate.$(OBJEXT): CodeGen/$(am__dirstamp) \
    631990        CodeGen/$(DEPDIR)/$(am__dirstamp)
    632 CodeGen/driver_cfa_cpp-CodeGenerator.$(OBJEXT):  \
    633         CodeGen/$(am__dirstamp) CodeGen/$(DEPDIR)/$(am__dirstamp)
    634 CodeGen/driver_cfa_cpp-GenType.$(OBJEXT): CodeGen/$(am__dirstamp) \
     991CodeGen/FixNames.$(OBJEXT): CodeGen/$(am__dirstamp) \
    635992        CodeGen/$(DEPDIR)/$(am__dirstamp)
    636 CodeGen/driver_cfa_cpp-FixNames.$(OBJEXT): CodeGen/$(am__dirstamp) \
    637         CodeGen/$(DEPDIR)/$(am__dirstamp)
    638 CodeGen/driver_cfa_cpp-FixMain.$(OBJEXT): CodeGen/$(am__dirstamp) \
    639         CodeGen/$(DEPDIR)/$(am__dirstamp)
    640 CodeGen/driver_cfa_cpp-OperatorTable.$(OBJEXT):  \
    641         CodeGen/$(am__dirstamp) CodeGen/$(DEPDIR)/$(am__dirstamp)
    642993CodeTools/$(am__dirstamp):
    643994        @$(MKDIR_P) CodeTools
     
    646997        @$(MKDIR_P) CodeTools/$(DEPDIR)
    647998        @: > CodeTools/$(DEPDIR)/$(am__dirstamp)
    648 CodeTools/driver_cfa_cpp-DeclStats.$(OBJEXT):  \
    649         CodeTools/$(am__dirstamp) CodeTools/$(DEPDIR)/$(am__dirstamp)
    650 CodeTools/driver_cfa_cpp-TrackLoc.$(OBJEXT):  \
    651         CodeTools/$(am__dirstamp) CodeTools/$(DEPDIR)/$(am__dirstamp)
    652 Concurrency/$(am__dirstamp):
    653         @$(MKDIR_P) Concurrency
    654         @: > Concurrency/$(am__dirstamp)
    655 Concurrency/$(DEPDIR)/$(am__dirstamp):
    656         @$(MKDIR_P) Concurrency/$(DEPDIR)
    657         @: > Concurrency/$(DEPDIR)/$(am__dirstamp)
    658 Concurrency/driver_cfa_cpp-Keywords.$(OBJEXT):  \
    659         Concurrency/$(am__dirstamp) \
     999CodeTools/DeclStats.$(OBJEXT): CodeTools/$(am__dirstamp) \
     1000        CodeTools/$(DEPDIR)/$(am__dirstamp)
     1001CodeTools/TrackLoc.$(OBJEXT): CodeTools/$(am__dirstamp) \
     1002        CodeTools/$(DEPDIR)/$(am__dirstamp)
     1003Concurrency/Waitfor.$(OBJEXT): Concurrency/$(am__dirstamp) \
    6601004        Concurrency/$(DEPDIR)/$(am__dirstamp)
    661 Concurrency/driver_cfa_cpp-Waitfor.$(OBJEXT):  \
    662         Concurrency/$(am__dirstamp) \
    663         Concurrency/$(DEPDIR)/$(am__dirstamp)
    664 Common/$(am__dirstamp):
    665         @$(MKDIR_P) Common
    666         @: > Common/$(am__dirstamp)
    667 Common/$(DEPDIR)/$(am__dirstamp):
    668         @$(MKDIR_P) Common/$(DEPDIR)
    669         @: > Common/$(DEPDIR)/$(am__dirstamp)
    670 Common/driver_cfa_cpp-SemanticError.$(OBJEXT): Common/$(am__dirstamp) \
     1005Common/DebugMalloc.$(OBJEXT): Common/$(am__dirstamp) \
    6711006        Common/$(DEPDIR)/$(am__dirstamp)
    672 Common/driver_cfa_cpp-UniqueName.$(OBJEXT): Common/$(am__dirstamp) \
     1007Common/Heap.$(OBJEXT): Common/$(am__dirstamp) \
    6731008        Common/$(DEPDIR)/$(am__dirstamp)
    674 Common/driver_cfa_cpp-DebugMalloc.$(OBJEXT): Common/$(am__dirstamp) \
    675         Common/$(DEPDIR)/$(am__dirstamp)
    676 Common/driver_cfa_cpp-Assert.$(OBJEXT): Common/$(am__dirstamp) \
    677         Common/$(DEPDIR)/$(am__dirstamp)
    678 ControlStruct/$(am__dirstamp):
    679         @$(MKDIR_P) ControlStruct
    680         @: > ControlStruct/$(am__dirstamp)
    681 ControlStruct/$(DEPDIR)/$(am__dirstamp):
    682         @$(MKDIR_P) ControlStruct/$(DEPDIR)
    683         @: > ControlStruct/$(DEPDIR)/$(am__dirstamp)
    684 ControlStruct/driver_cfa_cpp-LabelGenerator.$(OBJEXT):  \
     1009ControlStruct/ExceptTranslate.$(OBJEXT):  \
    6851010        ControlStruct/$(am__dirstamp) \
    6861011        ControlStruct/$(DEPDIR)/$(am__dirstamp)
    687 ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT):  \
    688         ControlStruct/$(am__dirstamp) \
    689         ControlStruct/$(DEPDIR)/$(am__dirstamp)
    690 ControlStruct/driver_cfa_cpp-MLEMutator.$(OBJEXT):  \
    691         ControlStruct/$(am__dirstamp) \
    692         ControlStruct/$(DEPDIR)/$(am__dirstamp)
    693 ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT):  \
    694         ControlStruct/$(am__dirstamp) \
    695         ControlStruct/$(DEPDIR)/$(am__dirstamp)
    696 ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT):  \
    697         ControlStruct/$(am__dirstamp) \
    698         ControlStruct/$(DEPDIR)/$(am__dirstamp)
    699 ControlStruct/driver_cfa_cpp-ExceptTranslate.$(OBJEXT):  \
    700         ControlStruct/$(am__dirstamp) \
    701         ControlStruct/$(DEPDIR)/$(am__dirstamp)
    702 GenPoly/$(am__dirstamp):
    703         @$(MKDIR_P) GenPoly
    704         @: > GenPoly/$(am__dirstamp)
    705 GenPoly/$(DEPDIR)/$(am__dirstamp):
    706         @$(MKDIR_P) GenPoly/$(DEPDIR)
    707         @: > GenPoly/$(DEPDIR)/$(am__dirstamp)
    708 GenPoly/driver_cfa_cpp-Box.$(OBJEXT): GenPoly/$(am__dirstamp) \
     1012GenPoly/Box.$(OBJEXT): GenPoly/$(am__dirstamp) \
    7091013        GenPoly/$(DEPDIR)/$(am__dirstamp)
    710 GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT): GenPoly/$(am__dirstamp) \
     1014GenPoly/ScrubTyVars.$(OBJEXT): GenPoly/$(am__dirstamp) \
    7111015        GenPoly/$(DEPDIR)/$(am__dirstamp)
    712 GenPoly/driver_cfa_cpp-ScrubTyVars.$(OBJEXT): GenPoly/$(am__dirstamp) \
     1016GenPoly/Specialize.$(OBJEXT): GenPoly/$(am__dirstamp) \
    7131017        GenPoly/$(DEPDIR)/$(am__dirstamp)
    714 GenPoly/driver_cfa_cpp-Lvalue.$(OBJEXT): GenPoly/$(am__dirstamp) \
     1018GenPoly/FindFunction.$(OBJEXT): GenPoly/$(am__dirstamp) \
    7151019        GenPoly/$(DEPDIR)/$(am__dirstamp)
    716 GenPoly/driver_cfa_cpp-Specialize.$(OBJEXT): GenPoly/$(am__dirstamp) \
     1020GenPoly/InstantiateGeneric.$(OBJEXT): GenPoly/$(am__dirstamp) \
    7171021        GenPoly/$(DEPDIR)/$(am__dirstamp)
    718 GenPoly/driver_cfa_cpp-FindFunction.$(OBJEXT):  \
    719         GenPoly/$(am__dirstamp) GenPoly/$(DEPDIR)/$(am__dirstamp)
    720 GenPoly/driver_cfa_cpp-InstantiateGeneric.$(OBJEXT):  \
    721         GenPoly/$(am__dirstamp) GenPoly/$(DEPDIR)/$(am__dirstamp)
    722 InitTweak/$(am__dirstamp):
    723         @$(MKDIR_P) InitTweak
    724         @: > InitTweak/$(am__dirstamp)
    725 InitTweak/$(DEPDIR)/$(am__dirstamp):
    726         @$(MKDIR_P) InitTweak/$(DEPDIR)
    727         @: > InitTweak/$(DEPDIR)/$(am__dirstamp)
    728 InitTweak/driver_cfa_cpp-GenInit.$(OBJEXT): InitTweak/$(am__dirstamp) \
     1022InitTweak/FixInit.$(OBJEXT): InitTweak/$(am__dirstamp) \
    7291023        InitTweak/$(DEPDIR)/$(am__dirstamp)
    730 InitTweak/driver_cfa_cpp-FixInit.$(OBJEXT): InitTweak/$(am__dirstamp) \
     1024InitTweak/FixGlobalInit.$(OBJEXT): InitTweak/$(am__dirstamp) \
    7311025        InitTweak/$(DEPDIR)/$(am__dirstamp)
    732 InitTweak/driver_cfa_cpp-FixGlobalInit.$(OBJEXT):  \
    733         InitTweak/$(am__dirstamp) InitTweak/$(DEPDIR)/$(am__dirstamp)
    734 InitTweak/driver_cfa_cpp-InitTweak.$(OBJEXT):  \
    735         InitTweak/$(am__dirstamp) InitTweak/$(DEPDIR)/$(am__dirstamp)
    7361026Parser/parser.hh: Parser/parser.cc
    7371027        @if test ! -f $@; then rm -f Parser/parser.cc; else :; fi
    7381028        @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) Parser/parser.cc; else :; fi
    739 Parser/$(am__dirstamp):
    740         @$(MKDIR_P) Parser
    741         @: > Parser/$(am__dirstamp)
    742 Parser/$(DEPDIR)/$(am__dirstamp):
    743         @$(MKDIR_P) Parser/$(DEPDIR)
    744         @: > Parser/$(DEPDIR)/$(am__dirstamp)
    745 Parser/driver_cfa_cpp-parser.$(OBJEXT): Parser/$(am__dirstamp) \
     1029Parser/parser.$(OBJEXT): Parser/$(am__dirstamp) \
    7461030        Parser/$(DEPDIR)/$(am__dirstamp)
    747 Parser/driver_cfa_cpp-lex.$(OBJEXT): Parser/$(am__dirstamp) \
     1031Parser/lex.$(OBJEXT): Parser/$(am__dirstamp) \
    7481032        Parser/$(DEPDIR)/$(am__dirstamp)
    749 Parser/driver_cfa_cpp-TypedefTable.$(OBJEXT): Parser/$(am__dirstamp) \
     1033Parser/TypedefTable.$(OBJEXT): Parser/$(am__dirstamp) \
    7501034        Parser/$(DEPDIR)/$(am__dirstamp)
    751 Parser/driver_cfa_cpp-ParseNode.$(OBJEXT): Parser/$(am__dirstamp) \
     1035Parser/ParseNode.$(OBJEXT): Parser/$(am__dirstamp) \
    7521036        Parser/$(DEPDIR)/$(am__dirstamp)
    753 Parser/driver_cfa_cpp-DeclarationNode.$(OBJEXT):  \
    754         Parser/$(am__dirstamp) Parser/$(DEPDIR)/$(am__dirstamp)
    755 Parser/driver_cfa_cpp-ExpressionNode.$(OBJEXT):  \
    756         Parser/$(am__dirstamp) Parser/$(DEPDIR)/$(am__dirstamp)
    757 Parser/driver_cfa_cpp-StatementNode.$(OBJEXT): Parser/$(am__dirstamp) \
     1037Parser/DeclarationNode.$(OBJEXT): Parser/$(am__dirstamp) \
    7581038        Parser/$(DEPDIR)/$(am__dirstamp)
    759 Parser/driver_cfa_cpp-InitializerNode.$(OBJEXT):  \
    760         Parser/$(am__dirstamp) Parser/$(DEPDIR)/$(am__dirstamp)
    761 Parser/driver_cfa_cpp-TypeData.$(OBJEXT): Parser/$(am__dirstamp) \
     1039Parser/ExpressionNode.$(OBJEXT): Parser/$(am__dirstamp) \
    7621040        Parser/$(DEPDIR)/$(am__dirstamp)
    763 Parser/driver_cfa_cpp-LinkageSpec.$(OBJEXT): Parser/$(am__dirstamp) \
     1041Parser/StatementNode.$(OBJEXT): Parser/$(am__dirstamp) \
    7641042        Parser/$(DEPDIR)/$(am__dirstamp)
    765 Parser/driver_cfa_cpp-parserutility.$(OBJEXT): Parser/$(am__dirstamp) \
     1043Parser/InitializerNode.$(OBJEXT): Parser/$(am__dirstamp) \
    7661044        Parser/$(DEPDIR)/$(am__dirstamp)
    767 ResolvExpr/$(am__dirstamp):
    768         @$(MKDIR_P) ResolvExpr
    769         @: > ResolvExpr/$(am__dirstamp)
    770 ResolvExpr/$(DEPDIR)/$(am__dirstamp):
    771         @$(MKDIR_P) ResolvExpr/$(DEPDIR)
    772         @: > ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    773 ResolvExpr/driver_cfa_cpp-AlternativeFinder.$(OBJEXT):  \
    774         ResolvExpr/$(am__dirstamp) \
    775         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    776 ResolvExpr/driver_cfa_cpp-Alternative.$(OBJEXT):  \
    777         ResolvExpr/$(am__dirstamp) \
    778         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    779 ResolvExpr/driver_cfa_cpp-Unify.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    780         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    781 ResolvExpr/driver_cfa_cpp-PtrsAssignable.$(OBJEXT):  \
    782         ResolvExpr/$(am__dirstamp) \
    783         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    784 ResolvExpr/driver_cfa_cpp-CommonType.$(OBJEXT):  \
    785         ResolvExpr/$(am__dirstamp) \
    786         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    787 ResolvExpr/driver_cfa_cpp-ConversionCost.$(OBJEXT):  \
    788         ResolvExpr/$(am__dirstamp) \
    789         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    790 ResolvExpr/driver_cfa_cpp-CastCost.$(OBJEXT):  \
    791         ResolvExpr/$(am__dirstamp) \
    792         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    793 ResolvExpr/driver_cfa_cpp-PtrsCastable.$(OBJEXT):  \
    794         ResolvExpr/$(am__dirstamp) \
    795         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    796 ResolvExpr/driver_cfa_cpp-AdjustExprType.$(OBJEXT):  \
    797         ResolvExpr/$(am__dirstamp) \
    798         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    799 ResolvExpr/driver_cfa_cpp-AlternativePrinter.$(OBJEXT):  \
    800         ResolvExpr/$(am__dirstamp) \
    801         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    802 ResolvExpr/driver_cfa_cpp-Resolver.$(OBJEXT):  \
    803         ResolvExpr/$(am__dirstamp) \
    804         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    805 ResolvExpr/driver_cfa_cpp-ResolveTypeof.$(OBJEXT):  \
    806         ResolvExpr/$(am__dirstamp) \
    807         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    808 ResolvExpr/driver_cfa_cpp-RenameVars.$(OBJEXT):  \
    809         ResolvExpr/$(am__dirstamp) \
    810         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    811 ResolvExpr/driver_cfa_cpp-FindOpenVars.$(OBJEXT):  \
    812         ResolvExpr/$(am__dirstamp) \
    813         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    814 ResolvExpr/driver_cfa_cpp-PolyCost.$(OBJEXT):  \
    815         ResolvExpr/$(am__dirstamp) \
    816         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    817 ResolvExpr/driver_cfa_cpp-Occurs.$(OBJEXT):  \
    818         ResolvExpr/$(am__dirstamp) \
    819         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    820 ResolvExpr/driver_cfa_cpp-TypeEnvironment.$(OBJEXT):  \
    821         ResolvExpr/$(am__dirstamp) \
    822         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    823 ResolvExpr/driver_cfa_cpp-CurrentObject.$(OBJEXT):  \
    824         ResolvExpr/$(am__dirstamp) \
    825         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    826 ResolvExpr/driver_cfa_cpp-ExplodedActual.$(OBJEXT):  \
    827         ResolvExpr/$(am__dirstamp) \
    828         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    829 SymTab/$(am__dirstamp):
    830         @$(MKDIR_P) SymTab
    831         @: > SymTab/$(am__dirstamp)
    832 SymTab/$(DEPDIR)/$(am__dirstamp):
    833         @$(MKDIR_P) SymTab/$(DEPDIR)
    834         @: > SymTab/$(DEPDIR)/$(am__dirstamp)
    835 SymTab/driver_cfa_cpp-Indexer.$(OBJEXT): SymTab/$(am__dirstamp) \
    836         SymTab/$(DEPDIR)/$(am__dirstamp)
    837 SymTab/driver_cfa_cpp-Mangler.$(OBJEXT): SymTab/$(am__dirstamp) \
    838         SymTab/$(DEPDIR)/$(am__dirstamp)
    839 SymTab/driver_cfa_cpp-Validate.$(OBJEXT): SymTab/$(am__dirstamp) \
    840         SymTab/$(DEPDIR)/$(am__dirstamp)
    841 SymTab/driver_cfa_cpp-FixFunction.$(OBJEXT): SymTab/$(am__dirstamp) \
    842         SymTab/$(DEPDIR)/$(am__dirstamp)
    843 SymTab/driver_cfa_cpp-Autogen.$(OBJEXT): SymTab/$(am__dirstamp) \
    844         SymTab/$(DEPDIR)/$(am__dirstamp)
    845 SynTree/$(am__dirstamp):
    846         @$(MKDIR_P) SynTree
    847         @: > SynTree/$(am__dirstamp)
    848 SynTree/$(DEPDIR)/$(am__dirstamp):
    849         @$(MKDIR_P) SynTree/$(DEPDIR)
    850         @: > SynTree/$(DEPDIR)/$(am__dirstamp)
    851 SynTree/driver_cfa_cpp-Type.$(OBJEXT): SynTree/$(am__dirstamp) \
    852         SynTree/$(DEPDIR)/$(am__dirstamp)
    853 SynTree/driver_cfa_cpp-VoidType.$(OBJEXT): SynTree/$(am__dirstamp) \
    854         SynTree/$(DEPDIR)/$(am__dirstamp)
    855 SynTree/driver_cfa_cpp-BasicType.$(OBJEXT): SynTree/$(am__dirstamp) \
    856         SynTree/$(DEPDIR)/$(am__dirstamp)
    857 SynTree/driver_cfa_cpp-PointerType.$(OBJEXT): SynTree/$(am__dirstamp) \
    858         SynTree/$(DEPDIR)/$(am__dirstamp)
    859 SynTree/driver_cfa_cpp-ArrayType.$(OBJEXT): SynTree/$(am__dirstamp) \
    860         SynTree/$(DEPDIR)/$(am__dirstamp)
    861 SynTree/driver_cfa_cpp-ReferenceType.$(OBJEXT):  \
    862         SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    863 SynTree/driver_cfa_cpp-FunctionType.$(OBJEXT):  \
    864         SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    865 SynTree/driver_cfa_cpp-ReferenceToType.$(OBJEXT):  \
    866         SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    867 SynTree/driver_cfa_cpp-TupleType.$(OBJEXT): SynTree/$(am__dirstamp) \
    868         SynTree/$(DEPDIR)/$(am__dirstamp)
    869 SynTree/driver_cfa_cpp-TypeofType.$(OBJEXT): SynTree/$(am__dirstamp) \
    870         SynTree/$(DEPDIR)/$(am__dirstamp)
    871 SynTree/driver_cfa_cpp-AttrType.$(OBJEXT): SynTree/$(am__dirstamp) \
    872         SynTree/$(DEPDIR)/$(am__dirstamp)
    873 SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT): SynTree/$(am__dirstamp) \
    874         SynTree/$(DEPDIR)/$(am__dirstamp)
    875 SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT): SynTree/$(am__dirstamp) \
    876         SynTree/$(DEPDIR)/$(am__dirstamp)
    877 SynTree/driver_cfa_cpp-Constant.$(OBJEXT): SynTree/$(am__dirstamp) \
    878         SynTree/$(DEPDIR)/$(am__dirstamp)
    879 SynTree/driver_cfa_cpp-Expression.$(OBJEXT): SynTree/$(am__dirstamp) \
    880         SynTree/$(DEPDIR)/$(am__dirstamp)
    881 SynTree/driver_cfa_cpp-TupleExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    882         SynTree/$(DEPDIR)/$(am__dirstamp)
    883 SynTree/driver_cfa_cpp-CommaExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    884         SynTree/$(DEPDIR)/$(am__dirstamp)
    885 SynTree/driver_cfa_cpp-TypeExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    886         SynTree/$(DEPDIR)/$(am__dirstamp)
    887 SynTree/driver_cfa_cpp-ApplicationExpr.$(OBJEXT):  \
    888         SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    889 SynTree/driver_cfa_cpp-AddressExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    890         SynTree/$(DEPDIR)/$(am__dirstamp)
    891 SynTree/driver_cfa_cpp-Statement.$(OBJEXT): SynTree/$(am__dirstamp) \
    892         SynTree/$(DEPDIR)/$(am__dirstamp)
    893 SynTree/driver_cfa_cpp-CompoundStmt.$(OBJEXT):  \
    894         SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    895 SynTree/driver_cfa_cpp-DeclStmt.$(OBJEXT): SynTree/$(am__dirstamp) \
    896         SynTree/$(DEPDIR)/$(am__dirstamp)
    897 SynTree/driver_cfa_cpp-Declaration.$(OBJEXT): SynTree/$(am__dirstamp) \
    898         SynTree/$(DEPDIR)/$(am__dirstamp)
    899 SynTree/driver_cfa_cpp-DeclarationWithType.$(OBJEXT):  \
    900         SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    901 SynTree/driver_cfa_cpp-ObjectDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    902         SynTree/$(DEPDIR)/$(am__dirstamp)
    903 SynTree/driver_cfa_cpp-FunctionDecl.$(OBJEXT):  \
    904         SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    905 SynTree/driver_cfa_cpp-AggregateDecl.$(OBJEXT):  \
    906         SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    907 SynTree/driver_cfa_cpp-NamedTypeDecl.$(OBJEXT):  \
    908         SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    909 SynTree/driver_cfa_cpp-TypeDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    910         SynTree/$(DEPDIR)/$(am__dirstamp)
    911 SynTree/driver_cfa_cpp-Initializer.$(OBJEXT): SynTree/$(am__dirstamp) \
    912         SynTree/$(DEPDIR)/$(am__dirstamp)
    913 SynTree/driver_cfa_cpp-Visitor.$(OBJEXT): SynTree/$(am__dirstamp) \
    914         SynTree/$(DEPDIR)/$(am__dirstamp)
    915 SynTree/driver_cfa_cpp-Mutator.$(OBJEXT): SynTree/$(am__dirstamp) \
    916         SynTree/$(DEPDIR)/$(am__dirstamp)
    917 SynTree/driver_cfa_cpp-TypeSubstitution.$(OBJEXT):  \
    918         SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    919 SynTree/driver_cfa_cpp-Attribute.$(OBJEXT): SynTree/$(am__dirstamp) \
    920         SynTree/$(DEPDIR)/$(am__dirstamp)
    921 SynTree/driver_cfa_cpp-VarExprReplacer.$(OBJEXT):  \
    922         SynTree/$(am__dirstamp) SynTree/$(DEPDIR)/$(am__dirstamp)
    923 Tuples/$(am__dirstamp):
    924         @$(MKDIR_P) Tuples
    925         @: > Tuples/$(am__dirstamp)
    926 Tuples/$(DEPDIR)/$(am__dirstamp):
    927         @$(MKDIR_P) Tuples/$(DEPDIR)
    928         @: > Tuples/$(DEPDIR)/$(am__dirstamp)
    929 Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT):  \
    930         Tuples/$(am__dirstamp) Tuples/$(DEPDIR)/$(am__dirstamp)
    931 Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT):  \
    932         Tuples/$(am__dirstamp) Tuples/$(DEPDIR)/$(am__dirstamp)
    933 Tuples/driver_cfa_cpp-Explode.$(OBJEXT): Tuples/$(am__dirstamp) \
    934         Tuples/$(DEPDIR)/$(am__dirstamp)
     1045Parser/TypeData.$(OBJEXT): Parser/$(am__dirstamp) \
     1046        Parser/$(DEPDIR)/$(am__dirstamp)
     1047Parser/parserutility.$(OBJEXT): Parser/$(am__dirstamp) \
     1048        Parser/$(DEPDIR)/$(am__dirstamp)
     1049ResolvExpr/AlternativePrinter.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     1050        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    9351051Virtual/$(am__dirstamp):
    9361052        @$(MKDIR_P) Virtual
     
    9391055        @$(MKDIR_P) Virtual/$(DEPDIR)
    9401056        @: > Virtual/$(DEPDIR)/$(am__dirstamp)
    941 Virtual/driver_cfa_cpp-ExpandCasts.$(OBJEXT): Virtual/$(am__dirstamp) \
     1057Virtual/ExpandCasts.$(OBJEXT): Virtual/$(am__dirstamp) \
    9421058        Virtual/$(DEPDIR)/$(am__dirstamp)
    943 driver/$(am__dirstamp):
    944         @$(MKDIR_P) driver
    945         @: > driver/$(am__dirstamp)
    946 
    947 driver/cfa-cpp$(EXEEXT): $(driver_cfa_cpp_OBJECTS) $(driver_cfa_cpp_DEPENDENCIES) $(EXTRA_driver_cfa_cpp_DEPENDENCIES) driver/$(am__dirstamp)
    948         @rm -f driver/cfa-cpp$(EXEEXT)
    949         $(AM_V_CXXLD)$(driver_cfa_cpp_LINK) $(driver_cfa_cpp_OBJECTS) $(driver_cfa_cpp_LDADD) $(LIBS)
     1059../driver/$(am__dirstamp):
     1060        @$(MKDIR_P) ../driver
     1061        @: > ../driver/$(am__dirstamp)
     1062
     1063../driver/cfa-cpp$(EXEEXT): $(___driver_cfa_cpp_OBJECTS) $(___driver_cfa_cpp_DEPENDENCIES) $(EXTRA____driver_cfa_cpp_DEPENDENCIES) ../driver/$(am__dirstamp)
     1064        @rm -f ../driver/cfa-cpp$(EXEEXT)
     1065        $(AM_V_CXXLD)$(CXXLINK) $(___driver_cfa_cpp_OBJECTS) $(___driver_cfa_cpp_LDADD) $(LIBS)
     1066SymTab/demangler.$(OBJEXT): SymTab/$(am__dirstamp) \
     1067        SymTab/$(DEPDIR)/$(am__dirstamp)
     1068
     1069demangler$(EXEEXT): $(demangler_OBJECTS) $(demangler_DEPENDENCIES) $(EXTRA_demangler_DEPENDENCIES)
     1070        @rm -f demangler$(EXEEXT)
     1071        $(AM_V_CXXLD)$(CXXLINK) $(demangler_OBJECTS) $(demangler_LDADD) $(LIBS)
    9501072
    9511073mostlyclean-compile:
     
    9631085        -rm -f SynTree/*.$(OBJEXT)
    9641086        -rm -f Tuples/*.$(OBJEXT)
     1087        -rm -f Validate/*.$(OBJEXT)
    9651088        -rm -f Virtual/*.$(OBJEXT)
    9661089
     
    9681091        -rm -f *.tab.c
    9691092
    970 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/driver_cfa_cpp-MakeLibCfa.Po@am__quote@
    971 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/driver_cfa_cpp-main.Po@am__quote@
    972 @AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/driver_cfa_cpp-CodeGenerator.Po@am__quote@
    973 @AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/driver_cfa_cpp-FixMain.Po@am__quote@
    974 @AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/driver_cfa_cpp-FixNames.Po@am__quote@
    975 @AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/driver_cfa_cpp-GenType.Po@am__quote@
    976 @AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/driver_cfa_cpp-Generate.Po@am__quote@
    977 @AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/driver_cfa_cpp-OperatorTable.Po@am__quote@
    978 @AMDEP_TRUE@@am__include@ @am__quote@CodeTools/$(DEPDIR)/driver_cfa_cpp-DeclStats.Po@am__quote@
    979 @AMDEP_TRUE@@am__include@ @am__quote@CodeTools/$(DEPDIR)/driver_cfa_cpp-TrackLoc.Po@am__quote@
    980 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-Assert.Po@am__quote@
    981 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Po@am__quote@
    982 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Po@am__quote@
    983 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@
    984 @AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/driver_cfa_cpp-Keywords.Po@am__quote@
    985 @AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Po@am__quote@
    986 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po@am__quote@
    987 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Po@am__quote@
    988 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Po@am__quote@
    989 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelGenerator.Po@am__quote@
    990 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-MLEMutator.Po@am__quote@
    991 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-Mutate.Po@am__quote@
    992 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Po@am__quote@
    993 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-FindFunction.Po@am__quote@
    994 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-GenPoly.Po@am__quote@
    995 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-InstantiateGeneric.Po@am__quote@
    996 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-Lvalue.Po@am__quote@
    997 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-ScrubTyVars.Po@am__quote@
    998 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-Specialize.Po@am__quote@
    999 @AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Po@am__quote@
    1000 @AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/driver_cfa_cpp-FixInit.Po@am__quote@
    1001 @AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/driver_cfa_cpp-GenInit.Po@am__quote@
    1002 @AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/driver_cfa_cpp-InitTweak.Po@am__quote@
    1003 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-DeclarationNode.Po@am__quote@
    1004 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-ExpressionNode.Po@am__quote@
    1005 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-InitializerNode.Po@am__quote@
    1006 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-LinkageSpec.Po@am__quote@
    1007 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-ParseNode.Po@am__quote@
    1008 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-StatementNode.Po@am__quote@
    1009 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-TypeData.Po@am__quote@
    1010 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-TypedefTable.Po@am__quote@
    1011 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-lex.Po@am__quote@
    1012 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parser.Po@am__quote@
    1013 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po@am__quote@
    1014 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AdjustExprType.Po@am__quote@
    1015 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Alternative.Po@am__quote@
    1016 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AlternativeFinder.Po@am__quote@
    1017 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AlternativePrinter.Po@am__quote@
    1018 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CastCost.Po@am__quote@
    1019 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CommonType.Po@am__quote@
    1020 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ConversionCost.Po@am__quote@
    1021 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Po@am__quote@
    1022 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ExplodedActual.Po@am__quote@
    1023 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-FindOpenVars.Po@am__quote@
    1024 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Occurs.Po@am__quote@
    1025 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PolyCost.Po@am__quote@
    1026 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PtrsAssignable.Po@am__quote@
    1027 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PtrsCastable.Po@am__quote@
    1028 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-RenameVars.Po@am__quote@
    1029 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ResolveTypeof.Po@am__quote@
    1030 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Resolver.Po@am__quote@
    1031 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-TypeEnvironment.Po@am__quote@
    1032 @AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Unify.Po@am__quote@
    1033 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Autogen.Po@am__quote@
    1034 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-FixFunction.Po@am__quote@
    1035 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Po@am__quote@
    1036 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Mangler.Po@am__quote@
    1037 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Validate.Po@am__quote@
    1038 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-AddressExpr.Po@am__quote@
    1039 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-AggregateDecl.Po@am__quote@
    1040 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ApplicationExpr.Po@am__quote@
    1041 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ArrayType.Po@am__quote@
    1042 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-AttrType.Po@am__quote@
    1043 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Attribute.Po@am__quote@
    1044 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-BasicType.Po@am__quote@
    1045 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-CommaExpr.Po@am__quote@
    1046 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-CompoundStmt.Po@am__quote@
    1047 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Constant.Po@am__quote@
    1048 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-DeclStmt.Po@am__quote@
    1049 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Declaration.Po@am__quote@
    1050 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-DeclarationWithType.Po@am__quote@
    1051 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Expression.Po@am__quote@
    1052 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionDecl.Po@am__quote@
    1053 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionType.Po@am__quote@
    1054 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Initializer.Po@am__quote@
    1055 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Mutator.Po@am__quote@
    1056 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-NamedTypeDecl.Po@am__quote@
    1057 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ObjectDecl.Po@am__quote@
    1058 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-PointerType.Po@am__quote@
    1059 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceToType.Po@am__quote@
    1060 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Po@am__quote@
    1061 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Statement.Po@am__quote@
    1062 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-TupleExpr.Po@am__quote@
    1063 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-TupleType.Po@am__quote@
    1064 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Type.Po@am__quote@
    1065 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-TypeDecl.Po@am__quote@
    1066 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-TypeExpr.Po@am__quote@
    1067 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-TypeSubstitution.Po@am__quote@
    1068 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-TypeofType.Po@am__quote@
    1069 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Po@am__quote@
    1070 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Po@am__quote@
    1071 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Po@am__quote@
    1072 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Po@am__quote@
    1073 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po@am__quote@
    1074 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-Explode.Po@am__quote@
    1075 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Po@am__quote@
    1076 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po@am__quote@
    1077 @AMDEP_TRUE@@am__include@ @am__quote@Virtual/$(DEPDIR)/driver_cfa_cpp-ExpandCasts.Po@am__quote@
     1093@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CompilationState.Po@am__quote@
     1094@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MakeLibCfa.Po@am__quote@
     1095@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
     1096@AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/CodeGenerator.Po@am__quote@
     1097@AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/FixMain.Po@am__quote@
     1098@AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/FixNames.Po@am__quote@
     1099@AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/GenType.Po@am__quote@
     1100@AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/Generate.Po@am__quote@
     1101@AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/OperatorTable.Po@am__quote@
     1102@AMDEP_TRUE@@am__include@ @am__quote@CodeTools/$(DEPDIR)/DeclStats.Po@am__quote@
     1103@AMDEP_TRUE@@am__include@ @am__quote@CodeTools/$(DEPDIR)/TrackLoc.Po@am__quote@
     1104@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/Assert.Po@am__quote@
     1105@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/DebugMalloc.Po@am__quote@
     1106@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/Eval.Po@am__quote@
     1107@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/Heap.Po@am__quote@
     1108@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/SemanticError.Po@am__quote@
     1109@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/UniqueName.Po@am__quote@
     1110@AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/Keywords.Po@am__quote@
     1111@AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/Waitfor.Po@am__quote@
     1112@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/ExceptTranslate.Po@am__quote@
     1113@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/ForExprMutator.Po@am__quote@
     1114@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/LabelFixer.Po@am__quote@
     1115@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/LabelGenerator.Po@am__quote@
     1116@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/MLEMutator.Po@am__quote@
     1117@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/Mutate.Po@am__quote@
     1118@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/Box.Po@am__quote@
     1119@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/FindFunction.Po@am__quote@
     1120@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/GenPoly.Po@am__quote@
     1121@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/InstantiateGeneric.Po@am__quote@
     1122@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/Lvalue.Po@am__quote@
     1123@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/ScrubTyVars.Po@am__quote@
     1124@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/Specialize.Po@am__quote@
     1125@AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/FixGlobalInit.Po@am__quote@
     1126@AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/FixInit.Po@am__quote@
     1127@AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/GenInit.Po@am__quote@
     1128@AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/InitTweak.Po@am__quote@
     1129@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/DeclarationNode.Po@am__quote@
     1130@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/ExpressionNode.Po@am__quote@
     1131@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/InitializerNode.Po@am__quote@
     1132@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/LinkageSpec.Po@am__quote@
     1133@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/ParseNode.Po@am__quote@
     1134@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/StatementNode.Po@am__quote@
     1135@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/TypeData.Po@am__quote@
     1136@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/TypedefTable.Po@am__quote@
     1137@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/lex.Po@am__quote@
     1138@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/parser.Po@am__quote@
     1139@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/parserutility.Po@am__quote@
     1140@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/AdjustExprType.Po@am__quote@
     1141@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/Alternative.Po@am__quote@
     1142@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/AlternativeFinder.Po@am__quote@
     1143@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/AlternativePrinter.Po@am__quote@
     1144@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/CastCost.Po@am__quote@
     1145@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/CommonType.Po@am__quote@
     1146@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/ConversionCost.Po@am__quote@
     1147@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/CurrentObject.Po@am__quote@
     1148@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/ExplodedActual.Po@am__quote@
     1149@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/FindOpenVars.Po@am__quote@
     1150@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/Occurs.Po@am__quote@
     1151@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/PolyCost.Po@am__quote@
     1152@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/PtrsAssignable.Po@am__quote@
     1153@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/PtrsCastable.Po@am__quote@
     1154@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/RenameVars.Po@am__quote@
     1155@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/ResolveTypeof.Po@am__quote@
     1156@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/Resolver.Po@am__quote@
     1157@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/TypeEnvironment.Po@am__quote@
     1158@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/Unify.Po@am__quote@
     1159@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/Autogen.Po@am__quote@
     1160@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/Demangle.Po@am__quote@
     1161@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/FixFunction.Po@am__quote@
     1162@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/Indexer.Po@am__quote@
     1163@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/Mangler.Po@am__quote@
     1164@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/ManglerCommon.Po@am__quote@
     1165@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/Validate.Po@am__quote@
     1166@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/demangler.Po@am__quote@
     1167@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/AddressExpr.Po@am__quote@
     1168@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/AggregateDecl.Po@am__quote@
     1169@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/ApplicationExpr.Po@am__quote@
     1170@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/ArrayType.Po@am__quote@
     1171@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/AttrType.Po@am__quote@
     1172@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/Attribute.Po@am__quote@
     1173@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/BasicType.Po@am__quote@
     1174@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/CommaExpr.Po@am__quote@
     1175@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/CompoundStmt.Po@am__quote@
     1176@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/Constant.Po@am__quote@
     1177@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/DeclReplacer.Po@am__quote@
     1178@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/DeclStmt.Po@am__quote@
     1179@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/Declaration.Po@am__quote@
     1180@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/DeclarationWithType.Po@am__quote@
     1181@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/Expression.Po@am__quote@
     1182@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/FunctionDecl.Po@am__quote@
     1183@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/FunctionType.Po@am__quote@
     1184@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/Initializer.Po@am__quote@
     1185@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/NamedTypeDecl.Po@am__quote@
     1186@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/ObjectDecl.Po@am__quote@
     1187@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/PointerType.Po@am__quote@
     1188@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/ReferenceToType.Po@am__quote@
     1189@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/ReferenceType.Po@am__quote@
     1190@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/Statement.Po@am__quote@
     1191@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TupleExpr.Po@am__quote@
     1192@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TupleType.Po@am__quote@
     1193@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/Type.Po@am__quote@
     1194@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TypeDecl.Po@am__quote@
     1195@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TypeExpr.Po@am__quote@
     1196@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TypeSubstitution.Po@am__quote@
     1197@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TypeofType.Po@am__quote@
     1198@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/VarArgsType.Po@am__quote@
     1199@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/VoidType.Po@am__quote@
     1200@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/ZeroOneType.Po@am__quote@
     1201@AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/Explode.Po@am__quote@
     1202@AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/TupleAssignment.Po@am__quote@
     1203@AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/TupleExpansion.Po@am__quote@
     1204@AMDEP_TRUE@@am__include@ @am__quote@Validate/$(DEPDIR)/HandleAttributes.Po@am__quote@
     1205@AMDEP_TRUE@@am__include@ @am__quote@Virtual/$(DEPDIR)/ExpandCasts.Po@am__quote@
    10781206
    10791207.cc.o:
     
    10921220@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    10931221@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    1094 
    1095 driver_cfa_cpp-main.o: main.cc
    1096 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT driver_cfa_cpp-main.o -MD -MP -MF $(DEPDIR)/driver_cfa_cpp-main.Tpo -c -o driver_cfa_cpp-main.o `test -f 'main.cc' || echo '$(srcdir)/'`main.cc
    1097 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/driver_cfa_cpp-main.Tpo $(DEPDIR)/driver_cfa_cpp-main.Po
    1098 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='main.cc' object='driver_cfa_cpp-main.o' libtool=no @AMDEPBACKSLASH@
    1099 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1100 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o driver_cfa_cpp-main.o `test -f 'main.cc' || echo '$(srcdir)/'`main.cc
    1101 
    1102 driver_cfa_cpp-main.obj: main.cc
    1103 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT driver_cfa_cpp-main.obj -MD -MP -MF $(DEPDIR)/driver_cfa_cpp-main.Tpo -c -o driver_cfa_cpp-main.obj `if test -f 'main.cc'; then $(CYGPATH_W) 'main.cc'; else $(CYGPATH_W) '$(srcdir)/main.cc'; fi`
    1104 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/driver_cfa_cpp-main.Tpo $(DEPDIR)/driver_cfa_cpp-main.Po
    1105 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='main.cc' object='driver_cfa_cpp-main.obj' libtool=no @AMDEPBACKSLASH@
    1106 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1107 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o driver_cfa_cpp-main.obj `if test -f 'main.cc'; then $(CYGPATH_W) 'main.cc'; else $(CYGPATH_W) '$(srcdir)/main.cc'; fi`
    1108 
    1109 driver_cfa_cpp-MakeLibCfa.o: MakeLibCfa.cc
    1110 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT driver_cfa_cpp-MakeLibCfa.o -MD -MP -MF $(DEPDIR)/driver_cfa_cpp-MakeLibCfa.Tpo -c -o driver_cfa_cpp-MakeLibCfa.o `test -f 'MakeLibCfa.cc' || echo '$(srcdir)/'`MakeLibCfa.cc
    1111 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/driver_cfa_cpp-MakeLibCfa.Tpo $(DEPDIR)/driver_cfa_cpp-MakeLibCfa.Po
    1112 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='MakeLibCfa.cc' object='driver_cfa_cpp-MakeLibCfa.o' libtool=no @AMDEPBACKSLASH@
    1113 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1114 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o driver_cfa_cpp-MakeLibCfa.o `test -f 'MakeLibCfa.cc' || echo '$(srcdir)/'`MakeLibCfa.cc
    1115 
    1116 driver_cfa_cpp-MakeLibCfa.obj: MakeLibCfa.cc
    1117 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT driver_cfa_cpp-MakeLibCfa.obj -MD -MP -MF $(DEPDIR)/driver_cfa_cpp-MakeLibCfa.Tpo -c -o driver_cfa_cpp-MakeLibCfa.obj `if test -f 'MakeLibCfa.cc'; then $(CYGPATH_W) 'MakeLibCfa.cc'; else $(CYGPATH_W) '$(srcdir)/MakeLibCfa.cc'; fi`
    1118 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) $(DEPDIR)/driver_cfa_cpp-MakeLibCfa.Tpo $(DEPDIR)/driver_cfa_cpp-MakeLibCfa.Po
    1119 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='MakeLibCfa.cc' object='driver_cfa_cpp-MakeLibCfa.obj' libtool=no @AMDEPBACKSLASH@
    1120 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1121 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o driver_cfa_cpp-MakeLibCfa.obj `if test -f 'MakeLibCfa.cc'; then $(CYGPATH_W) 'MakeLibCfa.cc'; else $(CYGPATH_W) '$(srcdir)/MakeLibCfa.cc'; fi`
    1122 
    1123 CodeGen/driver_cfa_cpp-Generate.o: CodeGen/Generate.cc
    1124 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeGen/driver_cfa_cpp-Generate.o -MD -MP -MF CodeGen/$(DEPDIR)/driver_cfa_cpp-Generate.Tpo -c -o CodeGen/driver_cfa_cpp-Generate.o `test -f 'CodeGen/Generate.cc' || echo '$(srcdir)/'`CodeGen/Generate.cc
    1125 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeGen/$(DEPDIR)/driver_cfa_cpp-Generate.Tpo CodeGen/$(DEPDIR)/driver_cfa_cpp-Generate.Po
    1126 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeGen/Generate.cc' object='CodeGen/driver_cfa_cpp-Generate.o' libtool=no @AMDEPBACKSLASH@
    1127 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1128 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeGen/driver_cfa_cpp-Generate.o `test -f 'CodeGen/Generate.cc' || echo '$(srcdir)/'`CodeGen/Generate.cc
    1129 
    1130 CodeGen/driver_cfa_cpp-Generate.obj: CodeGen/Generate.cc
    1131 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeGen/driver_cfa_cpp-Generate.obj -MD -MP -MF CodeGen/$(DEPDIR)/driver_cfa_cpp-Generate.Tpo -c -o CodeGen/driver_cfa_cpp-Generate.obj `if test -f 'CodeGen/Generate.cc'; then $(CYGPATH_W) 'CodeGen/Generate.cc'; else $(CYGPATH_W) '$(srcdir)/CodeGen/Generate.cc'; fi`
    1132 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeGen/$(DEPDIR)/driver_cfa_cpp-Generate.Tpo CodeGen/$(DEPDIR)/driver_cfa_cpp-Generate.Po
    1133 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeGen/Generate.cc' object='CodeGen/driver_cfa_cpp-Generate.obj' libtool=no @AMDEPBACKSLASH@
    1134 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1135 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeGen/driver_cfa_cpp-Generate.obj `if test -f 'CodeGen/Generate.cc'; then $(CYGPATH_W) 'CodeGen/Generate.cc'; else $(CYGPATH_W) '$(srcdir)/CodeGen/Generate.cc'; fi`
    1136 
    1137 CodeGen/driver_cfa_cpp-CodeGenerator.o: CodeGen/CodeGenerator.cc
    1138 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeGen/driver_cfa_cpp-CodeGenerator.o -MD -MP -MF CodeGen/$(DEPDIR)/driver_cfa_cpp-CodeGenerator.Tpo -c -o CodeGen/driver_cfa_cpp-CodeGenerator.o `test -f 'CodeGen/CodeGenerator.cc' || echo '$(srcdir)/'`CodeGen/CodeGenerator.cc
    1139 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeGen/$(DEPDIR)/driver_cfa_cpp-CodeGenerator.Tpo CodeGen/$(DEPDIR)/driver_cfa_cpp-CodeGenerator.Po
    1140 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeGen/CodeGenerator.cc' object='CodeGen/driver_cfa_cpp-CodeGenerator.o' libtool=no @AMDEPBACKSLASH@
    1141 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1142 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeGen/driver_cfa_cpp-CodeGenerator.o `test -f 'CodeGen/CodeGenerator.cc' || echo '$(srcdir)/'`CodeGen/CodeGenerator.cc
    1143 
    1144 CodeGen/driver_cfa_cpp-CodeGenerator.obj: CodeGen/CodeGenerator.cc
    1145 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeGen/driver_cfa_cpp-CodeGenerator.obj -MD -MP -MF CodeGen/$(DEPDIR)/driver_cfa_cpp-CodeGenerator.Tpo -c -o CodeGen/driver_cfa_cpp-CodeGenerator.obj `if test -f 'CodeGen/CodeGenerator.cc'; then $(CYGPATH_W) 'CodeGen/CodeGenerator.cc'; else $(CYGPATH_W) '$(srcdir)/CodeGen/CodeGenerator.cc'; fi`
    1146 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeGen/$(DEPDIR)/driver_cfa_cpp-CodeGenerator.Tpo CodeGen/$(DEPDIR)/driver_cfa_cpp-CodeGenerator.Po
    1147 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeGen/CodeGenerator.cc' object='CodeGen/driver_cfa_cpp-CodeGenerator.obj' libtool=no @AMDEPBACKSLASH@
    1148 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1149 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeGen/driver_cfa_cpp-CodeGenerator.obj `if test -f 'CodeGen/CodeGenerator.cc'; then $(CYGPATH_W) 'CodeGen/CodeGenerator.cc'; else $(CYGPATH_W) '$(srcdir)/CodeGen/CodeGenerator.cc'; fi`
    1150 
    1151 CodeGen/driver_cfa_cpp-GenType.o: CodeGen/GenType.cc
    1152 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeGen/driver_cfa_cpp-GenType.o -MD -MP -MF CodeGen/$(DEPDIR)/driver_cfa_cpp-GenType.Tpo -c -o CodeGen/driver_cfa_cpp-GenType.o `test -f 'CodeGen/GenType.cc' || echo '$(srcdir)/'`CodeGen/GenType.cc
    1153 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeGen/$(DEPDIR)/driver_cfa_cpp-GenType.Tpo CodeGen/$(DEPDIR)/driver_cfa_cpp-GenType.Po
    1154 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeGen/GenType.cc' object='CodeGen/driver_cfa_cpp-GenType.o' libtool=no @AMDEPBACKSLASH@
    1155 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1156 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeGen/driver_cfa_cpp-GenType.o `test -f 'CodeGen/GenType.cc' || echo '$(srcdir)/'`CodeGen/GenType.cc
    1157 
    1158 CodeGen/driver_cfa_cpp-GenType.obj: CodeGen/GenType.cc
    1159 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeGen/driver_cfa_cpp-GenType.obj -MD -MP -MF CodeGen/$(DEPDIR)/driver_cfa_cpp-GenType.Tpo -c -o CodeGen/driver_cfa_cpp-GenType.obj `if test -f 'CodeGen/GenType.cc'; then $(CYGPATH_W) 'CodeGen/GenType.cc'; else $(CYGPATH_W) '$(srcdir)/CodeGen/GenType.cc'; fi`
    1160 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeGen/$(DEPDIR)/driver_cfa_cpp-GenType.Tpo CodeGen/$(DEPDIR)/driver_cfa_cpp-GenType.Po
    1161 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeGen/GenType.cc' object='CodeGen/driver_cfa_cpp-GenType.obj' libtool=no @AMDEPBACKSLASH@
    1162 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1163 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeGen/driver_cfa_cpp-GenType.obj `if test -f 'CodeGen/GenType.cc'; then $(CYGPATH_W) 'CodeGen/GenType.cc'; else $(CYGPATH_W) '$(srcdir)/CodeGen/GenType.cc'; fi`
    1164 
    1165 CodeGen/driver_cfa_cpp-FixNames.o: CodeGen/FixNames.cc
    1166 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeGen/driver_cfa_cpp-FixNames.o -MD -MP -MF CodeGen/$(DEPDIR)/driver_cfa_cpp-FixNames.Tpo -c -o CodeGen/driver_cfa_cpp-FixNames.o `test -f 'CodeGen/FixNames.cc' || echo '$(srcdir)/'`CodeGen/FixNames.cc
    1167 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeGen/$(DEPDIR)/driver_cfa_cpp-FixNames.Tpo CodeGen/$(DEPDIR)/driver_cfa_cpp-FixNames.Po
    1168 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeGen/FixNames.cc' object='CodeGen/driver_cfa_cpp-FixNames.o' libtool=no @AMDEPBACKSLASH@
    1169 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1170 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeGen/driver_cfa_cpp-FixNames.o `test -f 'CodeGen/FixNames.cc' || echo '$(srcdir)/'`CodeGen/FixNames.cc
    1171 
    1172 CodeGen/driver_cfa_cpp-FixNames.obj: CodeGen/FixNames.cc
    1173 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeGen/driver_cfa_cpp-FixNames.obj -MD -MP -MF CodeGen/$(DEPDIR)/driver_cfa_cpp-FixNames.Tpo -c -o CodeGen/driver_cfa_cpp-FixNames.obj `if test -f 'CodeGen/FixNames.cc'; then $(CYGPATH_W) 'CodeGen/FixNames.cc'; else $(CYGPATH_W) '$(srcdir)/CodeGen/FixNames.cc'; fi`
    1174 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeGen/$(DEPDIR)/driver_cfa_cpp-FixNames.Tpo CodeGen/$(DEPDIR)/driver_cfa_cpp-FixNames.Po
    1175 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeGen/FixNames.cc' object='CodeGen/driver_cfa_cpp-FixNames.obj' libtool=no @AMDEPBACKSLASH@
    1176 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1177 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeGen/driver_cfa_cpp-FixNames.obj `if test -f 'CodeGen/FixNames.cc'; then $(CYGPATH_W) 'CodeGen/FixNames.cc'; else $(CYGPATH_W) '$(srcdir)/CodeGen/FixNames.cc'; fi`
    1178 
    1179 CodeGen/driver_cfa_cpp-FixMain.o: CodeGen/FixMain.cc
    1180 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeGen/driver_cfa_cpp-FixMain.o -MD -MP -MF CodeGen/$(DEPDIR)/driver_cfa_cpp-FixMain.Tpo -c -o CodeGen/driver_cfa_cpp-FixMain.o `test -f 'CodeGen/FixMain.cc' || echo '$(srcdir)/'`CodeGen/FixMain.cc
    1181 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeGen/$(DEPDIR)/driver_cfa_cpp-FixMain.Tpo CodeGen/$(DEPDIR)/driver_cfa_cpp-FixMain.Po
    1182 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeGen/FixMain.cc' object='CodeGen/driver_cfa_cpp-FixMain.o' libtool=no @AMDEPBACKSLASH@
    1183 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1184 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeGen/driver_cfa_cpp-FixMain.o `test -f 'CodeGen/FixMain.cc' || echo '$(srcdir)/'`CodeGen/FixMain.cc
    1185 
    1186 CodeGen/driver_cfa_cpp-FixMain.obj: CodeGen/FixMain.cc
    1187 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeGen/driver_cfa_cpp-FixMain.obj -MD -MP -MF CodeGen/$(DEPDIR)/driver_cfa_cpp-FixMain.Tpo -c -o CodeGen/driver_cfa_cpp-FixMain.obj `if test -f 'CodeGen/FixMain.cc'; then $(CYGPATH_W) 'CodeGen/FixMain.cc'; else $(CYGPATH_W) '$(srcdir)/CodeGen/FixMain.cc'; fi`
    1188 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeGen/$(DEPDIR)/driver_cfa_cpp-FixMain.Tpo CodeGen/$(DEPDIR)/driver_cfa_cpp-FixMain.Po
    1189 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeGen/FixMain.cc' object='CodeGen/driver_cfa_cpp-FixMain.obj' libtool=no @AMDEPBACKSLASH@
    1190 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1191 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeGen/driver_cfa_cpp-FixMain.obj `if test -f 'CodeGen/FixMain.cc'; then $(CYGPATH_W) 'CodeGen/FixMain.cc'; else $(CYGPATH_W) '$(srcdir)/CodeGen/FixMain.cc'; fi`
    1192 
    1193 CodeGen/driver_cfa_cpp-OperatorTable.o: CodeGen/OperatorTable.cc
    1194 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeGen/driver_cfa_cpp-OperatorTable.o -MD -MP -MF CodeGen/$(DEPDIR)/driver_cfa_cpp-OperatorTable.Tpo -c -o CodeGen/driver_cfa_cpp-OperatorTable.o `test -f 'CodeGen/OperatorTable.cc' || echo '$(srcdir)/'`CodeGen/OperatorTable.cc
    1195 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeGen/$(DEPDIR)/driver_cfa_cpp-OperatorTable.Tpo CodeGen/$(DEPDIR)/driver_cfa_cpp-OperatorTable.Po
    1196 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeGen/OperatorTable.cc' object='CodeGen/driver_cfa_cpp-OperatorTable.o' libtool=no @AMDEPBACKSLASH@
    1197 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1198 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeGen/driver_cfa_cpp-OperatorTable.o `test -f 'CodeGen/OperatorTable.cc' || echo '$(srcdir)/'`CodeGen/OperatorTable.cc
    1199 
    1200 CodeGen/driver_cfa_cpp-OperatorTable.obj: CodeGen/OperatorTable.cc
    1201 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeGen/driver_cfa_cpp-OperatorTable.obj -MD -MP -MF CodeGen/$(DEPDIR)/driver_cfa_cpp-OperatorTable.Tpo -c -o CodeGen/driver_cfa_cpp-OperatorTable.obj `if test -f 'CodeGen/OperatorTable.cc'; then $(CYGPATH_W) 'CodeGen/OperatorTable.cc'; else $(CYGPATH_W) '$(srcdir)/CodeGen/OperatorTable.cc'; fi`
    1202 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeGen/$(DEPDIR)/driver_cfa_cpp-OperatorTable.Tpo CodeGen/$(DEPDIR)/driver_cfa_cpp-OperatorTable.Po
    1203 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeGen/OperatorTable.cc' object='CodeGen/driver_cfa_cpp-OperatorTable.obj' libtool=no @AMDEPBACKSLASH@
    1204 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1205 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeGen/driver_cfa_cpp-OperatorTable.obj `if test -f 'CodeGen/OperatorTable.cc'; then $(CYGPATH_W) 'CodeGen/OperatorTable.cc'; else $(CYGPATH_W) '$(srcdir)/CodeGen/OperatorTable.cc'; fi`
    1206 
    1207 CodeTools/driver_cfa_cpp-DeclStats.o: CodeTools/DeclStats.cc
    1208 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeTools/driver_cfa_cpp-DeclStats.o -MD -MP -MF CodeTools/$(DEPDIR)/driver_cfa_cpp-DeclStats.Tpo -c -o CodeTools/driver_cfa_cpp-DeclStats.o `test -f 'CodeTools/DeclStats.cc' || echo '$(srcdir)/'`CodeTools/DeclStats.cc
    1209 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeTools/$(DEPDIR)/driver_cfa_cpp-DeclStats.Tpo CodeTools/$(DEPDIR)/driver_cfa_cpp-DeclStats.Po
    1210 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeTools/DeclStats.cc' object='CodeTools/driver_cfa_cpp-DeclStats.o' libtool=no @AMDEPBACKSLASH@
    1211 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1212 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeTools/driver_cfa_cpp-DeclStats.o `test -f 'CodeTools/DeclStats.cc' || echo '$(srcdir)/'`CodeTools/DeclStats.cc
    1213 
    1214 CodeTools/driver_cfa_cpp-DeclStats.obj: CodeTools/DeclStats.cc
    1215 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeTools/driver_cfa_cpp-DeclStats.obj -MD -MP -MF CodeTools/$(DEPDIR)/driver_cfa_cpp-DeclStats.Tpo -c -o CodeTools/driver_cfa_cpp-DeclStats.obj `if test -f 'CodeTools/DeclStats.cc'; then $(CYGPATH_W) 'CodeTools/DeclStats.cc'; else $(CYGPATH_W) '$(srcdir)/CodeTools/DeclStats.cc'; fi`
    1216 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeTools/$(DEPDIR)/driver_cfa_cpp-DeclStats.Tpo CodeTools/$(DEPDIR)/driver_cfa_cpp-DeclStats.Po
    1217 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeTools/DeclStats.cc' object='CodeTools/driver_cfa_cpp-DeclStats.obj' libtool=no @AMDEPBACKSLASH@
    1218 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1219 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeTools/driver_cfa_cpp-DeclStats.obj `if test -f 'CodeTools/DeclStats.cc'; then $(CYGPATH_W) 'CodeTools/DeclStats.cc'; else $(CYGPATH_W) '$(srcdir)/CodeTools/DeclStats.cc'; fi`
    1220 
    1221 CodeTools/driver_cfa_cpp-TrackLoc.o: CodeTools/TrackLoc.cc
    1222 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeTools/driver_cfa_cpp-TrackLoc.o -MD -MP -MF CodeTools/$(DEPDIR)/driver_cfa_cpp-TrackLoc.Tpo -c -o CodeTools/driver_cfa_cpp-TrackLoc.o `test -f 'CodeTools/TrackLoc.cc' || echo '$(srcdir)/'`CodeTools/TrackLoc.cc
    1223 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeTools/$(DEPDIR)/driver_cfa_cpp-TrackLoc.Tpo CodeTools/$(DEPDIR)/driver_cfa_cpp-TrackLoc.Po
    1224 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeTools/TrackLoc.cc' object='CodeTools/driver_cfa_cpp-TrackLoc.o' libtool=no @AMDEPBACKSLASH@
    1225 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1226 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeTools/driver_cfa_cpp-TrackLoc.o `test -f 'CodeTools/TrackLoc.cc' || echo '$(srcdir)/'`CodeTools/TrackLoc.cc
    1227 
    1228 CodeTools/driver_cfa_cpp-TrackLoc.obj: CodeTools/TrackLoc.cc
    1229 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT CodeTools/driver_cfa_cpp-TrackLoc.obj -MD -MP -MF CodeTools/$(DEPDIR)/driver_cfa_cpp-TrackLoc.Tpo -c -o CodeTools/driver_cfa_cpp-TrackLoc.obj `if test -f 'CodeTools/TrackLoc.cc'; then $(CYGPATH_W) 'CodeTools/TrackLoc.cc'; else $(CYGPATH_W) '$(srcdir)/CodeTools/TrackLoc.cc'; fi`
    1230 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) CodeTools/$(DEPDIR)/driver_cfa_cpp-TrackLoc.Tpo CodeTools/$(DEPDIR)/driver_cfa_cpp-TrackLoc.Po
    1231 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='CodeTools/TrackLoc.cc' object='CodeTools/driver_cfa_cpp-TrackLoc.obj' libtool=no @AMDEPBACKSLASH@
    1232 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1233 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o CodeTools/driver_cfa_cpp-TrackLoc.obj `if test -f 'CodeTools/TrackLoc.cc'; then $(CYGPATH_W) 'CodeTools/TrackLoc.cc'; else $(CYGPATH_W) '$(srcdir)/CodeTools/TrackLoc.cc'; fi`
    1234 
    1235 Concurrency/driver_cfa_cpp-Keywords.o: Concurrency/Keywords.cc
    1236 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Concurrency/driver_cfa_cpp-Keywords.o -MD -MP -MF Concurrency/$(DEPDIR)/driver_cfa_cpp-Keywords.Tpo -c -o Concurrency/driver_cfa_cpp-Keywords.o `test -f 'Concurrency/Keywords.cc' || echo '$(srcdir)/'`Concurrency/Keywords.cc
    1237 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Concurrency/$(DEPDIR)/driver_cfa_cpp-Keywords.Tpo Concurrency/$(DEPDIR)/driver_cfa_cpp-Keywords.Po
    1238 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Concurrency/Keywords.cc' object='Concurrency/driver_cfa_cpp-Keywords.o' libtool=no @AMDEPBACKSLASH@
    1239 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1240 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Concurrency/driver_cfa_cpp-Keywords.o `test -f 'Concurrency/Keywords.cc' || echo '$(srcdir)/'`Concurrency/Keywords.cc
    1241 
    1242 Concurrency/driver_cfa_cpp-Keywords.obj: Concurrency/Keywords.cc
    1243 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Concurrency/driver_cfa_cpp-Keywords.obj -MD -MP -MF Concurrency/$(DEPDIR)/driver_cfa_cpp-Keywords.Tpo -c -o Concurrency/driver_cfa_cpp-Keywords.obj `if test -f 'Concurrency/Keywords.cc'; then $(CYGPATH_W) 'Concurrency/Keywords.cc'; else $(CYGPATH_W) '$(srcdir)/Concurrency/Keywords.cc'; fi`
    1244 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Concurrency/$(DEPDIR)/driver_cfa_cpp-Keywords.Tpo Concurrency/$(DEPDIR)/driver_cfa_cpp-Keywords.Po
    1245 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Concurrency/Keywords.cc' object='Concurrency/driver_cfa_cpp-Keywords.obj' libtool=no @AMDEPBACKSLASH@
    1246 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1247 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Concurrency/driver_cfa_cpp-Keywords.obj `if test -f 'Concurrency/Keywords.cc'; then $(CYGPATH_W) 'Concurrency/Keywords.cc'; else $(CYGPATH_W) '$(srcdir)/Concurrency/Keywords.cc'; fi`
    1248 
    1249 Concurrency/driver_cfa_cpp-Waitfor.o: Concurrency/Waitfor.cc
    1250 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Concurrency/driver_cfa_cpp-Waitfor.o -MD -MP -MF Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Tpo -c -o Concurrency/driver_cfa_cpp-Waitfor.o `test -f 'Concurrency/Waitfor.cc' || echo '$(srcdir)/'`Concurrency/Waitfor.cc
    1251 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Tpo Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Po
    1252 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Concurrency/Waitfor.cc' object='Concurrency/driver_cfa_cpp-Waitfor.o' libtool=no @AMDEPBACKSLASH@
    1253 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1254 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Concurrency/driver_cfa_cpp-Waitfor.o `test -f 'Concurrency/Waitfor.cc' || echo '$(srcdir)/'`Concurrency/Waitfor.cc
    1255 
    1256 Concurrency/driver_cfa_cpp-Waitfor.obj: Concurrency/Waitfor.cc
    1257 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Concurrency/driver_cfa_cpp-Waitfor.obj -MD -MP -MF Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Tpo -c -o Concurrency/driver_cfa_cpp-Waitfor.obj `if test -f 'Concurrency/Waitfor.cc'; then $(CYGPATH_W) 'Concurrency/Waitfor.cc'; else $(CYGPATH_W) '$(srcdir)/Concurrency/Waitfor.cc'; fi`
    1258 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Tpo Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Po
    1259 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Concurrency/Waitfor.cc' object='Concurrency/driver_cfa_cpp-Waitfor.obj' libtool=no @AMDEPBACKSLASH@
    1260 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1261 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Concurrency/driver_cfa_cpp-Waitfor.obj `if test -f 'Concurrency/Waitfor.cc'; then $(CYGPATH_W) 'Concurrency/Waitfor.cc'; else $(CYGPATH_W) '$(srcdir)/Concurrency/Waitfor.cc'; fi`
    1262 
    1263 Common/driver_cfa_cpp-SemanticError.o: Common/SemanticError.cc
    1264 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-SemanticError.o -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Tpo -c -o Common/driver_cfa_cpp-SemanticError.o `test -f 'Common/SemanticError.cc' || echo '$(srcdir)/'`Common/SemanticError.cc
    1265 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Tpo Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Po
    1266 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Common/SemanticError.cc' object='Common/driver_cfa_cpp-SemanticError.o' libtool=no @AMDEPBACKSLASH@
    1267 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1268 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-SemanticError.o `test -f 'Common/SemanticError.cc' || echo '$(srcdir)/'`Common/SemanticError.cc
    1269 
    1270 Common/driver_cfa_cpp-SemanticError.obj: Common/SemanticError.cc
    1271 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-SemanticError.obj -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Tpo -c -o Common/driver_cfa_cpp-SemanticError.obj `if test -f 'Common/SemanticError.cc'; then $(CYGPATH_W) 'Common/SemanticError.cc'; else $(CYGPATH_W) '$(srcdir)/Common/SemanticError.cc'; fi`
    1272 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Tpo Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Po
    1273 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Common/SemanticError.cc' object='Common/driver_cfa_cpp-SemanticError.obj' libtool=no @AMDEPBACKSLASH@
    1274 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1275 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-SemanticError.obj `if test -f 'Common/SemanticError.cc'; then $(CYGPATH_W) 'Common/SemanticError.cc'; else $(CYGPATH_W) '$(srcdir)/Common/SemanticError.cc'; fi`
    1276 
    1277 Common/driver_cfa_cpp-UniqueName.o: Common/UniqueName.cc
    1278 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-UniqueName.o -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Tpo -c -o Common/driver_cfa_cpp-UniqueName.o `test -f 'Common/UniqueName.cc' || echo '$(srcdir)/'`Common/UniqueName.cc
    1279 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Tpo Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po
    1280 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Common/UniqueName.cc' object='Common/driver_cfa_cpp-UniqueName.o' libtool=no @AMDEPBACKSLASH@
    1281 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1282 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-UniqueName.o `test -f 'Common/UniqueName.cc' || echo '$(srcdir)/'`Common/UniqueName.cc
    1283 
    1284 Common/driver_cfa_cpp-UniqueName.obj: Common/UniqueName.cc
    1285 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-UniqueName.obj -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Tpo -c -o Common/driver_cfa_cpp-UniqueName.obj `if test -f 'Common/UniqueName.cc'; then $(CYGPATH_W) 'Common/UniqueName.cc'; else $(CYGPATH_W) '$(srcdir)/Common/UniqueName.cc'; fi`
    1286 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Tpo Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po
    1287 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Common/UniqueName.cc' object='Common/driver_cfa_cpp-UniqueName.obj' libtool=no @AMDEPBACKSLASH@
    1288 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1289 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-UniqueName.obj `if test -f 'Common/UniqueName.cc'; then $(CYGPATH_W) 'Common/UniqueName.cc'; else $(CYGPATH_W) '$(srcdir)/Common/UniqueName.cc'; fi`
    1290 
    1291 Common/driver_cfa_cpp-DebugMalloc.o: Common/DebugMalloc.cc
    1292 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-DebugMalloc.o -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Tpo -c -o Common/driver_cfa_cpp-DebugMalloc.o `test -f 'Common/DebugMalloc.cc' || echo '$(srcdir)/'`Common/DebugMalloc.cc
    1293 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Tpo Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Po
    1294 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Common/DebugMalloc.cc' object='Common/driver_cfa_cpp-DebugMalloc.o' libtool=no @AMDEPBACKSLASH@
    1295 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1296 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-DebugMalloc.o `test -f 'Common/DebugMalloc.cc' || echo '$(srcdir)/'`Common/DebugMalloc.cc
    1297 
    1298 Common/driver_cfa_cpp-DebugMalloc.obj: Common/DebugMalloc.cc
    1299 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-DebugMalloc.obj -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Tpo -c -o Common/driver_cfa_cpp-DebugMalloc.obj `if test -f 'Common/DebugMalloc.cc'; then $(CYGPATH_W) 'Common/DebugMalloc.cc'; else $(CYGPATH_W) '$(srcdir)/Common/DebugMalloc.cc'; fi`
    1300 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Tpo Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Po
    1301 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Common/DebugMalloc.cc' object='Common/driver_cfa_cpp-DebugMalloc.obj' libtool=no @AMDEPBACKSLASH@
    1302 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1303 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-DebugMalloc.obj `if test -f 'Common/DebugMalloc.cc'; then $(CYGPATH_W) 'Common/DebugMalloc.cc'; else $(CYGPATH_W) '$(srcdir)/Common/DebugMalloc.cc'; fi`
    1304 
    1305 Common/driver_cfa_cpp-Assert.o: Common/Assert.cc
    1306 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-Assert.o -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-Assert.Tpo -c -o Common/driver_cfa_cpp-Assert.o `test -f 'Common/Assert.cc' || echo '$(srcdir)/'`Common/Assert.cc
    1307 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-Assert.Tpo Common/$(DEPDIR)/driver_cfa_cpp-Assert.Po
    1308 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Common/Assert.cc' object='Common/driver_cfa_cpp-Assert.o' libtool=no @AMDEPBACKSLASH@
    1309 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1310 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-Assert.o `test -f 'Common/Assert.cc' || echo '$(srcdir)/'`Common/Assert.cc
    1311 
    1312 Common/driver_cfa_cpp-Assert.obj: Common/Assert.cc
    1313 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-Assert.obj -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-Assert.Tpo -c -o Common/driver_cfa_cpp-Assert.obj `if test -f 'Common/Assert.cc'; then $(CYGPATH_W) 'Common/Assert.cc'; else $(CYGPATH_W) '$(srcdir)/Common/Assert.cc'; fi`
    1314 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-Assert.Tpo Common/$(DEPDIR)/driver_cfa_cpp-Assert.Po
    1315 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Common/Assert.cc' object='Common/driver_cfa_cpp-Assert.obj' libtool=no @AMDEPBACKSLASH@
    1316 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1317 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-Assert.obj `if test -f 'Common/Assert.cc'; then $(CYGPATH_W) 'Common/Assert.cc'; else $(CYGPATH_W) '$(srcdir)/Common/Assert.cc'; fi`
    1318 
    1319 ControlStruct/driver_cfa_cpp-LabelGenerator.o: ControlStruct/LabelGenerator.cc
    1320 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-LabelGenerator.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelGenerator.Tpo -c -o ControlStruct/driver_cfa_cpp-LabelGenerator.o `test -f 'ControlStruct/LabelGenerator.cc' || echo '$(srcdir)/'`ControlStruct/LabelGenerator.cc
    1321 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelGenerator.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelGenerator.Po
    1322 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/LabelGenerator.cc' object='ControlStruct/driver_cfa_cpp-LabelGenerator.o' libtool=no @AMDEPBACKSLASH@
    1323 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1324 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-LabelGenerator.o `test -f 'ControlStruct/LabelGenerator.cc' || echo '$(srcdir)/'`ControlStruct/LabelGenerator.cc
    1325 
    1326 ControlStruct/driver_cfa_cpp-LabelGenerator.obj: ControlStruct/LabelGenerator.cc
    1327 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-LabelGenerator.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelGenerator.Tpo -c -o ControlStruct/driver_cfa_cpp-LabelGenerator.obj `if test -f 'ControlStruct/LabelGenerator.cc'; then $(CYGPATH_W) 'ControlStruct/LabelGenerator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/LabelGenerator.cc'; fi`
    1328 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelGenerator.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelGenerator.Po
    1329 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/LabelGenerator.cc' object='ControlStruct/driver_cfa_cpp-LabelGenerator.obj' libtool=no @AMDEPBACKSLASH@
    1330 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1331 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-LabelGenerator.obj `if test -f 'ControlStruct/LabelGenerator.cc'; then $(CYGPATH_W) 'ControlStruct/LabelGenerator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/LabelGenerator.cc'; fi`
    1332 
    1333 ControlStruct/driver_cfa_cpp-LabelFixer.o: ControlStruct/LabelFixer.cc
    1334 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-LabelFixer.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Tpo -c -o ControlStruct/driver_cfa_cpp-LabelFixer.o `test -f 'ControlStruct/LabelFixer.cc' || echo '$(srcdir)/'`ControlStruct/LabelFixer.cc
    1335 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Po
    1336 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/LabelFixer.cc' object='ControlStruct/driver_cfa_cpp-LabelFixer.o' libtool=no @AMDEPBACKSLASH@
    1337 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1338 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-LabelFixer.o `test -f 'ControlStruct/LabelFixer.cc' || echo '$(srcdir)/'`ControlStruct/LabelFixer.cc
    1339 
    1340 ControlStruct/driver_cfa_cpp-LabelFixer.obj: ControlStruct/LabelFixer.cc
    1341 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-LabelFixer.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Tpo -c -o ControlStruct/driver_cfa_cpp-LabelFixer.obj `if test -f 'ControlStruct/LabelFixer.cc'; then $(CYGPATH_W) 'ControlStruct/LabelFixer.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/LabelFixer.cc'; fi`
    1342 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Po
    1343 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/LabelFixer.cc' object='ControlStruct/driver_cfa_cpp-LabelFixer.obj' libtool=no @AMDEPBACKSLASH@
    1344 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1345 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-LabelFixer.obj `if test -f 'ControlStruct/LabelFixer.cc'; then $(CYGPATH_W) 'ControlStruct/LabelFixer.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/LabelFixer.cc'; fi`
    1346 
    1347 ControlStruct/driver_cfa_cpp-MLEMutator.o: ControlStruct/MLEMutator.cc
    1348 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-MLEMutator.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-MLEMutator.Tpo -c -o ControlStruct/driver_cfa_cpp-MLEMutator.o `test -f 'ControlStruct/MLEMutator.cc' || echo '$(srcdir)/'`ControlStruct/MLEMutator.cc
    1349 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-MLEMutator.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-MLEMutator.Po
    1350 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/MLEMutator.cc' object='ControlStruct/driver_cfa_cpp-MLEMutator.o' libtool=no @AMDEPBACKSLASH@
    1351 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1352 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-MLEMutator.o `test -f 'ControlStruct/MLEMutator.cc' || echo '$(srcdir)/'`ControlStruct/MLEMutator.cc
    1353 
    1354 ControlStruct/driver_cfa_cpp-MLEMutator.obj: ControlStruct/MLEMutator.cc
    1355 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-MLEMutator.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-MLEMutator.Tpo -c -o ControlStruct/driver_cfa_cpp-MLEMutator.obj `if test -f 'ControlStruct/MLEMutator.cc'; then $(CYGPATH_W) 'ControlStruct/MLEMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/MLEMutator.cc'; fi`
    1356 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-MLEMutator.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-MLEMutator.Po
    1357 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/MLEMutator.cc' object='ControlStruct/driver_cfa_cpp-MLEMutator.obj' libtool=no @AMDEPBACKSLASH@
    1358 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1359 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-MLEMutator.obj `if test -f 'ControlStruct/MLEMutator.cc'; then $(CYGPATH_W) 'ControlStruct/MLEMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/MLEMutator.cc'; fi`
    1360 
    1361 ControlStruct/driver_cfa_cpp-Mutate.o: ControlStruct/Mutate.cc
    1362 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-Mutate.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-Mutate.Tpo -c -o ControlStruct/driver_cfa_cpp-Mutate.o `test -f 'ControlStruct/Mutate.cc' || echo '$(srcdir)/'`ControlStruct/Mutate.cc
    1363 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-Mutate.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-Mutate.Po
    1364 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/Mutate.cc' object='ControlStruct/driver_cfa_cpp-Mutate.o' libtool=no @AMDEPBACKSLASH@
    1365 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1366 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-Mutate.o `test -f 'ControlStruct/Mutate.cc' || echo '$(srcdir)/'`ControlStruct/Mutate.cc
    1367 
    1368 ControlStruct/driver_cfa_cpp-Mutate.obj: ControlStruct/Mutate.cc
    1369 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-Mutate.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-Mutate.Tpo -c -o ControlStruct/driver_cfa_cpp-Mutate.obj `if test -f 'ControlStruct/Mutate.cc'; then $(CYGPATH_W) 'ControlStruct/Mutate.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/Mutate.cc'; fi`
    1370 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-Mutate.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-Mutate.Po
    1371 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/Mutate.cc' object='ControlStruct/driver_cfa_cpp-Mutate.obj' libtool=no @AMDEPBACKSLASH@
    1372 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1373 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-Mutate.obj `if test -f 'ControlStruct/Mutate.cc'; then $(CYGPATH_W) 'ControlStruct/Mutate.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/Mutate.cc'; fi`
    1374 
    1375 ControlStruct/driver_cfa_cpp-ForExprMutator.o: ControlStruct/ForExprMutator.cc
    1376 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-ForExprMutator.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Tpo -c -o ControlStruct/driver_cfa_cpp-ForExprMutator.o `test -f 'ControlStruct/ForExprMutator.cc' || echo '$(srcdir)/'`ControlStruct/ForExprMutator.cc
    1377 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Po
    1378 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/ForExprMutator.cc' object='ControlStruct/driver_cfa_cpp-ForExprMutator.o' libtool=no @AMDEPBACKSLASH@
    1379 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1380 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ForExprMutator.o `test -f 'ControlStruct/ForExprMutator.cc' || echo '$(srcdir)/'`ControlStruct/ForExprMutator.cc
    1381 
    1382 ControlStruct/driver_cfa_cpp-ForExprMutator.obj: ControlStruct/ForExprMutator.cc
    1383 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-ForExprMutator.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Tpo -c -o ControlStruct/driver_cfa_cpp-ForExprMutator.obj `if test -f 'ControlStruct/ForExprMutator.cc'; then $(CYGPATH_W) 'ControlStruct/ForExprMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ForExprMutator.cc'; fi`
    1384 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Po
    1385 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/ForExprMutator.cc' object='ControlStruct/driver_cfa_cpp-ForExprMutator.obj' libtool=no @AMDEPBACKSLASH@
    1386 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1387 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ForExprMutator.obj `if test -f 'ControlStruct/ForExprMutator.cc'; then $(CYGPATH_W) 'ControlStruct/ForExprMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ForExprMutator.cc'; fi`
    1388 
    1389 ControlStruct/driver_cfa_cpp-ExceptTranslate.o: ControlStruct/ExceptTranslate.cc
    1390 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-ExceptTranslate.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.o `test -f 'ControlStruct/ExceptTranslate.cc' || echo '$(srcdir)/'`ControlStruct/ExceptTranslate.cc
    1391 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po
    1392 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/ExceptTranslate.cc' object='ControlStruct/driver_cfa_cpp-ExceptTranslate.o' libtool=no @AMDEPBACKSLASH@
    1393 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1394 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.o `test -f 'ControlStruct/ExceptTranslate.cc' || echo '$(srcdir)/'`ControlStruct/ExceptTranslate.cc
    1395 
    1396 ControlStruct/driver_cfa_cpp-ExceptTranslate.obj: ControlStruct/ExceptTranslate.cc
    1397 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-ExceptTranslate.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.obj `if test -f 'ControlStruct/ExceptTranslate.cc'; then $(CYGPATH_W) 'ControlStruct/ExceptTranslate.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ExceptTranslate.cc'; fi`
    1398 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po
    1399 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/ExceptTranslate.cc' object='ControlStruct/driver_cfa_cpp-ExceptTranslate.obj' libtool=no @AMDEPBACKSLASH@
    1400 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1401 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ExceptTranslate.obj `if test -f 'ControlStruct/ExceptTranslate.cc'; then $(CYGPATH_W) 'ControlStruct/ExceptTranslate.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ExceptTranslate.cc'; fi`
    1402 
    1403 GenPoly/driver_cfa_cpp-Box.o: GenPoly/Box.cc
    1404 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-Box.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Tpo -c -o GenPoly/driver_cfa_cpp-Box.o `test -f 'GenPoly/Box.cc' || echo '$(srcdir)/'`GenPoly/Box.cc
    1405 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Po
    1406 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/Box.cc' object='GenPoly/driver_cfa_cpp-Box.o' libtool=no @AMDEPBACKSLASH@
    1407 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1408 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-Box.o `test -f 'GenPoly/Box.cc' || echo '$(srcdir)/'`GenPoly/Box.cc
    1409 
    1410 GenPoly/driver_cfa_cpp-Box.obj: GenPoly/Box.cc
    1411 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-Box.obj -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Tpo -c -o GenPoly/driver_cfa_cpp-Box.obj `if test -f 'GenPoly/Box.cc'; then $(CYGPATH_W) 'GenPoly/Box.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/Box.cc'; fi`
    1412 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Po
    1413 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/Box.cc' object='GenPoly/driver_cfa_cpp-Box.obj' libtool=no @AMDEPBACKSLASH@
    1414 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1415 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-Box.obj `if test -f 'GenPoly/Box.cc'; then $(CYGPATH_W) 'GenPoly/Box.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/Box.cc'; fi`
    1416 
    1417 GenPoly/driver_cfa_cpp-GenPoly.o: GenPoly/GenPoly.cc
    1418 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-GenPoly.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-GenPoly.Tpo -c -o GenPoly/driver_cfa_cpp-GenPoly.o `test -f 'GenPoly/GenPoly.cc' || echo '$(srcdir)/'`GenPoly/GenPoly.cc
    1419 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-GenPoly.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-GenPoly.Po
    1420 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/GenPoly.cc' object='GenPoly/driver_cfa_cpp-GenPoly.o' libtool=no @AMDEPBACKSLASH@
    1421 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1422 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-GenPoly.o `test -f 'GenPoly/GenPoly.cc' || echo '$(srcdir)/'`GenPoly/GenPoly.cc
    1423 
    1424 GenPoly/driver_cfa_cpp-GenPoly.obj: GenPoly/GenPoly.cc
    1425 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-GenPoly.obj -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-GenPoly.Tpo -c -o GenPoly/driver_cfa_cpp-GenPoly.obj `if test -f 'GenPoly/GenPoly.cc'; then $(CYGPATH_W) 'GenPoly/GenPoly.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/GenPoly.cc'; fi`
    1426 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-GenPoly.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-GenPoly.Po
    1427 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/GenPoly.cc' object='GenPoly/driver_cfa_cpp-GenPoly.obj' libtool=no @AMDEPBACKSLASH@
    1428 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1429 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-GenPoly.obj `if test -f 'GenPoly/GenPoly.cc'; then $(CYGPATH_W) 'GenPoly/GenPoly.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/GenPoly.cc'; fi`
    1430 
    1431 GenPoly/driver_cfa_cpp-ScrubTyVars.o: GenPoly/ScrubTyVars.cc
    1432 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-ScrubTyVars.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-ScrubTyVars.Tpo -c -o GenPoly/driver_cfa_cpp-ScrubTyVars.o `test -f 'GenPoly/ScrubTyVars.cc' || echo '$(srcdir)/'`GenPoly/ScrubTyVars.cc
    1433 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-ScrubTyVars.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-ScrubTyVars.Po
    1434 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/ScrubTyVars.cc' object='GenPoly/driver_cfa_cpp-ScrubTyVars.o' libtool=no @AMDEPBACKSLASH@
    1435 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1436 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-ScrubTyVars.o `test -f 'GenPoly/ScrubTyVars.cc' || echo '$(srcdir)/'`GenPoly/ScrubTyVars.cc
    1437 
    1438 GenPoly/driver_cfa_cpp-ScrubTyVars.obj: GenPoly/ScrubTyVars.cc
    1439 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-ScrubTyVars.obj -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-ScrubTyVars.Tpo -c -o GenPoly/driver_cfa_cpp-ScrubTyVars.obj `if test -f 'GenPoly/ScrubTyVars.cc'; then $(CYGPATH_W) 'GenPoly/ScrubTyVars.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/ScrubTyVars.cc'; fi`
    1440 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-ScrubTyVars.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-ScrubTyVars.Po
    1441 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/ScrubTyVars.cc' object='GenPoly/driver_cfa_cpp-ScrubTyVars.obj' libtool=no @AMDEPBACKSLASH@
    1442 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1443 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-ScrubTyVars.obj `if test -f 'GenPoly/ScrubTyVars.cc'; then $(CYGPATH_W) 'GenPoly/ScrubTyVars.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/ScrubTyVars.cc'; fi`
    1444 
    1445 GenPoly/driver_cfa_cpp-Lvalue.o: GenPoly/Lvalue.cc
    1446 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-Lvalue.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-Lvalue.Tpo -c -o GenPoly/driver_cfa_cpp-Lvalue.o `test -f 'GenPoly/Lvalue.cc' || echo '$(srcdir)/'`GenPoly/Lvalue.cc
    1447 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-Lvalue.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-Lvalue.Po
    1448 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/Lvalue.cc' object='GenPoly/driver_cfa_cpp-Lvalue.o' libtool=no @AMDEPBACKSLASH@
    1449 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1450 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-Lvalue.o `test -f 'GenPoly/Lvalue.cc' || echo '$(srcdir)/'`GenPoly/Lvalue.cc
    1451 
    1452 GenPoly/driver_cfa_cpp-Lvalue.obj: GenPoly/Lvalue.cc
    1453 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-Lvalue.obj -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-Lvalue.Tpo -c -o GenPoly/driver_cfa_cpp-Lvalue.obj `if test -f 'GenPoly/Lvalue.cc'; then $(CYGPATH_W) 'GenPoly/Lvalue.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/Lvalue.cc'; fi`
    1454 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-Lvalue.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-Lvalue.Po
    1455 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/Lvalue.cc' object='GenPoly/driver_cfa_cpp-Lvalue.obj' libtool=no @AMDEPBACKSLASH@
    1456 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1457 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-Lvalue.obj `if test -f 'GenPoly/Lvalue.cc'; then $(CYGPATH_W) 'GenPoly/Lvalue.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/Lvalue.cc'; fi`
    1458 
    1459 GenPoly/driver_cfa_cpp-Specialize.o: GenPoly/Specialize.cc
    1460 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-Specialize.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-Specialize.Tpo -c -o GenPoly/driver_cfa_cpp-Specialize.o `test -f 'GenPoly/Specialize.cc' || echo '$(srcdir)/'`GenPoly/Specialize.cc
    1461 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-Specialize.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-Specialize.Po
    1462 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/Specialize.cc' object='GenPoly/driver_cfa_cpp-Specialize.o' libtool=no @AMDEPBACKSLASH@
    1463 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1464 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-Specialize.o `test -f 'GenPoly/Specialize.cc' || echo '$(srcdir)/'`GenPoly/Specialize.cc
    1465 
    1466 GenPoly/driver_cfa_cpp-Specialize.obj: GenPoly/Specialize.cc
    1467 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-Specialize.obj -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-Specialize.Tpo -c -o GenPoly/driver_cfa_cpp-Specialize.obj `if test -f 'GenPoly/Specialize.cc'; then $(CYGPATH_W) 'GenPoly/Specialize.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/Specialize.cc'; fi`
    1468 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-Specialize.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-Specialize.Po
    1469 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/Specialize.cc' object='GenPoly/driver_cfa_cpp-Specialize.obj' libtool=no @AMDEPBACKSLASH@
    1470 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1471 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-Specialize.obj `if test -f 'GenPoly/Specialize.cc'; then $(CYGPATH_W) 'GenPoly/Specialize.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/Specialize.cc'; fi`
    1472 
    1473 GenPoly/driver_cfa_cpp-FindFunction.o: GenPoly/FindFunction.cc
    1474 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-FindFunction.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-FindFunction.Tpo -c -o GenPoly/driver_cfa_cpp-FindFunction.o `test -f 'GenPoly/FindFunction.cc' || echo '$(srcdir)/'`GenPoly/FindFunction.cc
    1475 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-FindFunction.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-FindFunction.Po
    1476 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/FindFunction.cc' object='GenPoly/driver_cfa_cpp-FindFunction.o' libtool=no @AMDEPBACKSLASH@
    1477 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1478 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-FindFunction.o `test -f 'GenPoly/FindFunction.cc' || echo '$(srcdir)/'`GenPoly/FindFunction.cc
    1479 
    1480 GenPoly/driver_cfa_cpp-FindFunction.obj: GenPoly/FindFunction.cc
    1481 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-FindFunction.obj -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-FindFunction.Tpo -c -o GenPoly/driver_cfa_cpp-FindFunction.obj `if test -f 'GenPoly/FindFunction.cc'; then $(CYGPATH_W) 'GenPoly/FindFunction.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/FindFunction.cc'; fi`
    1482 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-FindFunction.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-FindFunction.Po
    1483 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/FindFunction.cc' object='GenPoly/driver_cfa_cpp-FindFunction.obj' libtool=no @AMDEPBACKSLASH@
    1484 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1485 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-FindFunction.obj `if test -f 'GenPoly/FindFunction.cc'; then $(CYGPATH_W) 'GenPoly/FindFunction.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/FindFunction.cc'; fi`
    1486 
    1487 GenPoly/driver_cfa_cpp-InstantiateGeneric.o: GenPoly/InstantiateGeneric.cc
    1488 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-InstantiateGeneric.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-InstantiateGeneric.Tpo -c -o GenPoly/driver_cfa_cpp-InstantiateGeneric.o `test -f 'GenPoly/InstantiateGeneric.cc' || echo '$(srcdir)/'`GenPoly/InstantiateGeneric.cc
    1489 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-InstantiateGeneric.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-InstantiateGeneric.Po
    1490 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/InstantiateGeneric.cc' object='GenPoly/driver_cfa_cpp-InstantiateGeneric.o' libtool=no @AMDEPBACKSLASH@
    1491 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1492 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-InstantiateGeneric.o `test -f 'GenPoly/InstantiateGeneric.cc' || echo '$(srcdir)/'`GenPoly/InstantiateGeneric.cc
    1493 
    1494 GenPoly/driver_cfa_cpp-InstantiateGeneric.obj: GenPoly/InstantiateGeneric.cc
    1495 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-InstantiateGeneric.obj -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-InstantiateGeneric.Tpo -c -o GenPoly/driver_cfa_cpp-InstantiateGeneric.obj `if test -f 'GenPoly/InstantiateGeneric.cc'; then $(CYGPATH_W) 'GenPoly/InstantiateGeneric.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/InstantiateGeneric.cc'; fi`
    1496 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) GenPoly/$(DEPDIR)/driver_cfa_cpp-InstantiateGeneric.Tpo GenPoly/$(DEPDIR)/driver_cfa_cpp-InstantiateGeneric.Po
    1497 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='GenPoly/InstantiateGeneric.cc' object='GenPoly/driver_cfa_cpp-InstantiateGeneric.obj' libtool=no @AMDEPBACKSLASH@
    1498 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1499 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/driver_cfa_cpp-InstantiateGeneric.obj `if test -f 'GenPoly/InstantiateGeneric.cc'; then $(CYGPATH_W) 'GenPoly/InstantiateGeneric.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/InstantiateGeneric.cc'; fi`
    1500 
    1501 InitTweak/driver_cfa_cpp-GenInit.o: InitTweak/GenInit.cc
    1502 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/driver_cfa_cpp-GenInit.o -MD -MP -MF InitTweak/$(DEPDIR)/driver_cfa_cpp-GenInit.Tpo -c -o InitTweak/driver_cfa_cpp-GenInit.o `test -f 'InitTweak/GenInit.cc' || echo '$(srcdir)/'`InitTweak/GenInit.cc
    1503 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) InitTweak/$(DEPDIR)/driver_cfa_cpp-GenInit.Tpo InitTweak/$(DEPDIR)/driver_cfa_cpp-GenInit.Po
    1504 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='InitTweak/GenInit.cc' object='InitTweak/driver_cfa_cpp-GenInit.o' libtool=no @AMDEPBACKSLASH@
    1505 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1506 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-GenInit.o `test -f 'InitTweak/GenInit.cc' || echo '$(srcdir)/'`InitTweak/GenInit.cc
    1507 
    1508 InitTweak/driver_cfa_cpp-GenInit.obj: InitTweak/GenInit.cc
    1509 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/driver_cfa_cpp-GenInit.obj -MD -MP -MF InitTweak/$(DEPDIR)/driver_cfa_cpp-GenInit.Tpo -c -o InitTweak/driver_cfa_cpp-GenInit.obj `if test -f 'InitTweak/GenInit.cc'; then $(CYGPATH_W) 'InitTweak/GenInit.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/GenInit.cc'; fi`
    1510 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) InitTweak/$(DEPDIR)/driver_cfa_cpp-GenInit.Tpo InitTweak/$(DEPDIR)/driver_cfa_cpp-GenInit.Po
    1511 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='InitTweak/GenInit.cc' object='InitTweak/driver_cfa_cpp-GenInit.obj' libtool=no @AMDEPBACKSLASH@
    1512 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1513 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-GenInit.obj `if test -f 'InitTweak/GenInit.cc'; then $(CYGPATH_W) 'InitTweak/GenInit.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/GenInit.cc'; fi`
    1514 
    1515 InitTweak/driver_cfa_cpp-FixInit.o: InitTweak/FixInit.cc
    1516 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/driver_cfa_cpp-FixInit.o -MD -MP -MF InitTweak/$(DEPDIR)/driver_cfa_cpp-FixInit.Tpo -c -o InitTweak/driver_cfa_cpp-FixInit.o `test -f 'InitTweak/FixInit.cc' || echo '$(srcdir)/'`InitTweak/FixInit.cc
    1517 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) InitTweak/$(DEPDIR)/driver_cfa_cpp-FixInit.Tpo InitTweak/$(DEPDIR)/driver_cfa_cpp-FixInit.Po
    1518 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='InitTweak/FixInit.cc' object='InitTweak/driver_cfa_cpp-FixInit.o' libtool=no @AMDEPBACKSLASH@
    1519 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1520 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-FixInit.o `test -f 'InitTweak/FixInit.cc' || echo '$(srcdir)/'`InitTweak/FixInit.cc
    1521 
    1522 InitTweak/driver_cfa_cpp-FixInit.obj: InitTweak/FixInit.cc
    1523 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/driver_cfa_cpp-FixInit.obj -MD -MP -MF InitTweak/$(DEPDIR)/driver_cfa_cpp-FixInit.Tpo -c -o InitTweak/driver_cfa_cpp-FixInit.obj `if test -f 'InitTweak/FixInit.cc'; then $(CYGPATH_W) 'InitTweak/FixInit.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/FixInit.cc'; fi`
    1524 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) InitTweak/$(DEPDIR)/driver_cfa_cpp-FixInit.Tpo InitTweak/$(DEPDIR)/driver_cfa_cpp-FixInit.Po
    1525 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='InitTweak/FixInit.cc' object='InitTweak/driver_cfa_cpp-FixInit.obj' libtool=no @AMDEPBACKSLASH@
    1526 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1527 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-FixInit.obj `if test -f 'InitTweak/FixInit.cc'; then $(CYGPATH_W) 'InitTweak/FixInit.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/FixInit.cc'; fi`
    1528 
    1529 InitTweak/driver_cfa_cpp-FixGlobalInit.o: InitTweak/FixGlobalInit.cc
    1530 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/driver_cfa_cpp-FixGlobalInit.o -MD -MP -MF InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Tpo -c -o InitTweak/driver_cfa_cpp-FixGlobalInit.o `test -f 'InitTweak/FixGlobalInit.cc' || echo '$(srcdir)/'`InitTweak/FixGlobalInit.cc
    1531 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Tpo InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Po
    1532 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='InitTweak/FixGlobalInit.cc' object='InitTweak/driver_cfa_cpp-FixGlobalInit.o' libtool=no @AMDEPBACKSLASH@
    1533 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1534 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-FixGlobalInit.o `test -f 'InitTweak/FixGlobalInit.cc' || echo '$(srcdir)/'`InitTweak/FixGlobalInit.cc
    1535 
    1536 InitTweak/driver_cfa_cpp-FixGlobalInit.obj: InitTweak/FixGlobalInit.cc
    1537 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/driver_cfa_cpp-FixGlobalInit.obj -MD -MP -MF InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Tpo -c -o InitTweak/driver_cfa_cpp-FixGlobalInit.obj `if test -f 'InitTweak/FixGlobalInit.cc'; then $(CYGPATH_W) 'InitTweak/FixGlobalInit.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/FixGlobalInit.cc'; fi`
    1538 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Tpo InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Po
    1539 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='InitTweak/FixGlobalInit.cc' object='InitTweak/driver_cfa_cpp-FixGlobalInit.obj' libtool=no @AMDEPBACKSLASH@
    1540 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1541 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-FixGlobalInit.obj `if test -f 'InitTweak/FixGlobalInit.cc'; then $(CYGPATH_W) 'InitTweak/FixGlobalInit.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/FixGlobalInit.cc'; fi`
    1542 
    1543 InitTweak/driver_cfa_cpp-InitTweak.o: InitTweak/InitTweak.cc
    1544 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/driver_cfa_cpp-InitTweak.o -MD -MP -MF InitTweak/$(DEPDIR)/driver_cfa_cpp-InitTweak.Tpo -c -o InitTweak/driver_cfa_cpp-InitTweak.o `test -f 'InitTweak/InitTweak.cc' || echo '$(srcdir)/'`InitTweak/InitTweak.cc
    1545 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) InitTweak/$(DEPDIR)/driver_cfa_cpp-InitTweak.Tpo InitTweak/$(DEPDIR)/driver_cfa_cpp-InitTweak.Po
    1546 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='InitTweak/InitTweak.cc' object='InitTweak/driver_cfa_cpp-InitTweak.o' libtool=no @AMDEPBACKSLASH@
    1547 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1548 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-InitTweak.o `test -f 'InitTweak/InitTweak.cc' || echo '$(srcdir)/'`InitTweak/InitTweak.cc
    1549 
    1550 InitTweak/driver_cfa_cpp-InitTweak.obj: InitTweak/InitTweak.cc
    1551 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/driver_cfa_cpp-InitTweak.obj -MD -MP -MF InitTweak/$(DEPDIR)/driver_cfa_cpp-InitTweak.Tpo -c -o InitTweak/driver_cfa_cpp-InitTweak.obj `if test -f 'InitTweak/InitTweak.cc'; then $(CYGPATH_W) 'InitTweak/InitTweak.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/InitTweak.cc'; fi`
    1552 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) InitTweak/$(DEPDIR)/driver_cfa_cpp-InitTweak.Tpo InitTweak/$(DEPDIR)/driver_cfa_cpp-InitTweak.Po
    1553 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='InitTweak/InitTweak.cc' object='InitTweak/driver_cfa_cpp-InitTweak.obj' libtool=no @AMDEPBACKSLASH@
    1554 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1555 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-InitTweak.obj `if test -f 'InitTweak/InitTweak.cc'; then $(CYGPATH_W) 'InitTweak/InitTweak.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/InitTweak.cc'; fi`
    1556 
    1557 Parser/driver_cfa_cpp-parser.o: Parser/parser.cc
    1558 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parser.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parser.Tpo -c -o Parser/driver_cfa_cpp-parser.o `test -f 'Parser/parser.cc' || echo '$(srcdir)/'`Parser/parser.cc
    1559 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parser.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parser.Po
    1560 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parser.cc' object='Parser/driver_cfa_cpp-parser.o' libtool=no @AMDEPBACKSLASH@
    1561 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1562 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parser.o `test -f 'Parser/parser.cc' || echo '$(srcdir)/'`Parser/parser.cc
    1563 
    1564 Parser/driver_cfa_cpp-parser.obj: Parser/parser.cc
    1565 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parser.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parser.Tpo -c -o Parser/driver_cfa_cpp-parser.obj `if test -f 'Parser/parser.cc'; then $(CYGPATH_W) 'Parser/parser.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parser.cc'; fi`
    1566 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parser.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parser.Po
    1567 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parser.cc' object='Parser/driver_cfa_cpp-parser.obj' libtool=no @AMDEPBACKSLASH@
    1568 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1569 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parser.obj `if test -f 'Parser/parser.cc'; then $(CYGPATH_W) 'Parser/parser.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parser.cc'; fi`
    1570 
    1571 Parser/driver_cfa_cpp-lex.o: Parser/lex.cc
    1572 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-lex.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-lex.Tpo -c -o Parser/driver_cfa_cpp-lex.o `test -f 'Parser/lex.cc' || echo '$(srcdir)/'`Parser/lex.cc
    1573 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-lex.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-lex.Po
    1574 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/lex.cc' object='Parser/driver_cfa_cpp-lex.o' libtool=no @AMDEPBACKSLASH@
    1575 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1576 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-lex.o `test -f 'Parser/lex.cc' || echo '$(srcdir)/'`Parser/lex.cc
    1577 
    1578 Parser/driver_cfa_cpp-lex.obj: Parser/lex.cc
    1579 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-lex.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-lex.Tpo -c -o Parser/driver_cfa_cpp-lex.obj `if test -f 'Parser/lex.cc'; then $(CYGPATH_W) 'Parser/lex.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/lex.cc'; fi`
    1580 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-lex.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-lex.Po
    1581 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/lex.cc' object='Parser/driver_cfa_cpp-lex.obj' libtool=no @AMDEPBACKSLASH@
    1582 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1583 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-lex.obj `if test -f 'Parser/lex.cc'; then $(CYGPATH_W) 'Parser/lex.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/lex.cc'; fi`
    1584 
    1585 Parser/driver_cfa_cpp-TypedefTable.o: Parser/TypedefTable.cc
    1586 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-TypedefTable.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-TypedefTable.Tpo -c -o Parser/driver_cfa_cpp-TypedefTable.o `test -f 'Parser/TypedefTable.cc' || echo '$(srcdir)/'`Parser/TypedefTable.cc
    1587 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-TypedefTable.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-TypedefTable.Po
    1588 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/TypedefTable.cc' object='Parser/driver_cfa_cpp-TypedefTable.o' libtool=no @AMDEPBACKSLASH@
    1589 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1590 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-TypedefTable.o `test -f 'Parser/TypedefTable.cc' || echo '$(srcdir)/'`Parser/TypedefTable.cc
    1591 
    1592 Parser/driver_cfa_cpp-TypedefTable.obj: Parser/TypedefTable.cc
    1593 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-TypedefTable.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-TypedefTable.Tpo -c -o Parser/driver_cfa_cpp-TypedefTable.obj `if test -f 'Parser/TypedefTable.cc'; then $(CYGPATH_W) 'Parser/TypedefTable.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/TypedefTable.cc'; fi`
    1594 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-TypedefTable.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-TypedefTable.Po
    1595 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/TypedefTable.cc' object='Parser/driver_cfa_cpp-TypedefTable.obj' libtool=no @AMDEPBACKSLASH@
    1596 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1597 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-TypedefTable.obj `if test -f 'Parser/TypedefTable.cc'; then $(CYGPATH_W) 'Parser/TypedefTable.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/TypedefTable.cc'; fi`
    1598 
    1599 Parser/driver_cfa_cpp-ParseNode.o: Parser/ParseNode.cc
    1600 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-ParseNode.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-ParseNode.Tpo -c -o Parser/driver_cfa_cpp-ParseNode.o `test -f 'Parser/ParseNode.cc' || echo '$(srcdir)/'`Parser/ParseNode.cc
    1601 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-ParseNode.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-ParseNode.Po
    1602 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/ParseNode.cc' object='Parser/driver_cfa_cpp-ParseNode.o' libtool=no @AMDEPBACKSLASH@
    1603 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1604 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-ParseNode.o `test -f 'Parser/ParseNode.cc' || echo '$(srcdir)/'`Parser/ParseNode.cc
    1605 
    1606 Parser/driver_cfa_cpp-ParseNode.obj: Parser/ParseNode.cc
    1607 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-ParseNode.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-ParseNode.Tpo -c -o Parser/driver_cfa_cpp-ParseNode.obj `if test -f 'Parser/ParseNode.cc'; then $(CYGPATH_W) 'Parser/ParseNode.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/ParseNode.cc'; fi`
    1608 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-ParseNode.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-ParseNode.Po
    1609 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/ParseNode.cc' object='Parser/driver_cfa_cpp-ParseNode.obj' libtool=no @AMDEPBACKSLASH@
    1610 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1611 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-ParseNode.obj `if test -f 'Parser/ParseNode.cc'; then $(CYGPATH_W) 'Parser/ParseNode.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/ParseNode.cc'; fi`
    1612 
    1613 Parser/driver_cfa_cpp-DeclarationNode.o: Parser/DeclarationNode.cc
    1614 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-DeclarationNode.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-DeclarationNode.Tpo -c -o Parser/driver_cfa_cpp-DeclarationNode.o `test -f 'Parser/DeclarationNode.cc' || echo '$(srcdir)/'`Parser/DeclarationNode.cc
    1615 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-DeclarationNode.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-DeclarationNode.Po
    1616 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/DeclarationNode.cc' object='Parser/driver_cfa_cpp-DeclarationNode.o' libtool=no @AMDEPBACKSLASH@
    1617 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1618 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-DeclarationNode.o `test -f 'Parser/DeclarationNode.cc' || echo '$(srcdir)/'`Parser/DeclarationNode.cc
    1619 
    1620 Parser/driver_cfa_cpp-DeclarationNode.obj: Parser/DeclarationNode.cc
    1621 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-DeclarationNode.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-DeclarationNode.Tpo -c -o Parser/driver_cfa_cpp-DeclarationNode.obj `if test -f 'Parser/DeclarationNode.cc'; then $(CYGPATH_W) 'Parser/DeclarationNode.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/DeclarationNode.cc'; fi`
    1622 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-DeclarationNode.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-DeclarationNode.Po
    1623 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/DeclarationNode.cc' object='Parser/driver_cfa_cpp-DeclarationNode.obj' libtool=no @AMDEPBACKSLASH@
    1624 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1625 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-DeclarationNode.obj `if test -f 'Parser/DeclarationNode.cc'; then $(CYGPATH_W) 'Parser/DeclarationNode.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/DeclarationNode.cc'; fi`
    1626 
    1627 Parser/driver_cfa_cpp-ExpressionNode.o: Parser/ExpressionNode.cc
    1628 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-ExpressionNode.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-ExpressionNode.Tpo -c -o Parser/driver_cfa_cpp-ExpressionNode.o `test -f 'Parser/ExpressionNode.cc' || echo '$(srcdir)/'`Parser/ExpressionNode.cc
    1629 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-ExpressionNode.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-ExpressionNode.Po
    1630 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/ExpressionNode.cc' object='Parser/driver_cfa_cpp-ExpressionNode.o' libtool=no @AMDEPBACKSLASH@
    1631 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1632 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-ExpressionNode.o `test -f 'Parser/ExpressionNode.cc' || echo '$(srcdir)/'`Parser/ExpressionNode.cc
    1633 
    1634 Parser/driver_cfa_cpp-ExpressionNode.obj: Parser/ExpressionNode.cc
    1635 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-ExpressionNode.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-ExpressionNode.Tpo -c -o Parser/driver_cfa_cpp-ExpressionNode.obj `if test -f 'Parser/ExpressionNode.cc'; then $(CYGPATH_W) 'Parser/ExpressionNode.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/ExpressionNode.cc'; fi`
    1636 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-ExpressionNode.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-ExpressionNode.Po
    1637 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/ExpressionNode.cc' object='Parser/driver_cfa_cpp-ExpressionNode.obj' libtool=no @AMDEPBACKSLASH@
    1638 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1639 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-ExpressionNode.obj `if test -f 'Parser/ExpressionNode.cc'; then $(CYGPATH_W) 'Parser/ExpressionNode.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/ExpressionNode.cc'; fi`
    1640 
    1641 Parser/driver_cfa_cpp-StatementNode.o: Parser/StatementNode.cc
    1642 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-StatementNode.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-StatementNode.Tpo -c -o Parser/driver_cfa_cpp-StatementNode.o `test -f 'Parser/StatementNode.cc' || echo '$(srcdir)/'`Parser/StatementNode.cc
    1643 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-StatementNode.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-StatementNode.Po
    1644 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/StatementNode.cc' object='Parser/driver_cfa_cpp-StatementNode.o' libtool=no @AMDEPBACKSLASH@
    1645 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1646 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-StatementNode.o `test -f 'Parser/StatementNode.cc' || echo '$(srcdir)/'`Parser/StatementNode.cc
    1647 
    1648 Parser/driver_cfa_cpp-StatementNode.obj: Parser/StatementNode.cc
    1649 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-StatementNode.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-StatementNode.Tpo -c -o Parser/driver_cfa_cpp-StatementNode.obj `if test -f 'Parser/StatementNode.cc'; then $(CYGPATH_W) 'Parser/StatementNode.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/StatementNode.cc'; fi`
    1650 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-StatementNode.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-StatementNode.Po
    1651 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/StatementNode.cc' object='Parser/driver_cfa_cpp-StatementNode.obj' libtool=no @AMDEPBACKSLASH@
    1652 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1653 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-StatementNode.obj `if test -f 'Parser/StatementNode.cc'; then $(CYGPATH_W) 'Parser/StatementNode.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/StatementNode.cc'; fi`
    1654 
    1655 Parser/driver_cfa_cpp-InitializerNode.o: Parser/InitializerNode.cc
    1656 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-InitializerNode.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-InitializerNode.Tpo -c -o Parser/driver_cfa_cpp-InitializerNode.o `test -f 'Parser/InitializerNode.cc' || echo '$(srcdir)/'`Parser/InitializerNode.cc
    1657 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-InitializerNode.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-InitializerNode.Po
    1658 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/InitializerNode.cc' object='Parser/driver_cfa_cpp-InitializerNode.o' libtool=no @AMDEPBACKSLASH@
    1659 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1660 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-InitializerNode.o `test -f 'Parser/InitializerNode.cc' || echo '$(srcdir)/'`Parser/InitializerNode.cc
    1661 
    1662 Parser/driver_cfa_cpp-InitializerNode.obj: Parser/InitializerNode.cc
    1663 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-InitializerNode.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-InitializerNode.Tpo -c -o Parser/driver_cfa_cpp-InitializerNode.obj `if test -f 'Parser/InitializerNode.cc'; then $(CYGPATH_W) 'Parser/InitializerNode.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/InitializerNode.cc'; fi`
    1664 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-InitializerNode.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-InitializerNode.Po
    1665 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/InitializerNode.cc' object='Parser/driver_cfa_cpp-InitializerNode.obj' libtool=no @AMDEPBACKSLASH@
    1666 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1667 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-InitializerNode.obj `if test -f 'Parser/InitializerNode.cc'; then $(CYGPATH_W) 'Parser/InitializerNode.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/InitializerNode.cc'; fi`
    1668 
    1669 Parser/driver_cfa_cpp-TypeData.o: Parser/TypeData.cc
    1670 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-TypeData.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-TypeData.Tpo -c -o Parser/driver_cfa_cpp-TypeData.o `test -f 'Parser/TypeData.cc' || echo '$(srcdir)/'`Parser/TypeData.cc
    1671 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-TypeData.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-TypeData.Po
    1672 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/TypeData.cc' object='Parser/driver_cfa_cpp-TypeData.o' libtool=no @AMDEPBACKSLASH@
    1673 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1674 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-TypeData.o `test -f 'Parser/TypeData.cc' || echo '$(srcdir)/'`Parser/TypeData.cc
    1675 
    1676 Parser/driver_cfa_cpp-TypeData.obj: Parser/TypeData.cc
    1677 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-TypeData.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-TypeData.Tpo -c -o Parser/driver_cfa_cpp-TypeData.obj `if test -f 'Parser/TypeData.cc'; then $(CYGPATH_W) 'Parser/TypeData.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/TypeData.cc'; fi`
    1678 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-TypeData.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-TypeData.Po
    1679 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/TypeData.cc' object='Parser/driver_cfa_cpp-TypeData.obj' libtool=no @AMDEPBACKSLASH@
    1680 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1681 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-TypeData.obj `if test -f 'Parser/TypeData.cc'; then $(CYGPATH_W) 'Parser/TypeData.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/TypeData.cc'; fi`
    1682 
    1683 Parser/driver_cfa_cpp-LinkageSpec.o: Parser/LinkageSpec.cc
    1684 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-LinkageSpec.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-LinkageSpec.Tpo -c -o Parser/driver_cfa_cpp-LinkageSpec.o `test -f 'Parser/LinkageSpec.cc' || echo '$(srcdir)/'`Parser/LinkageSpec.cc
    1685 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-LinkageSpec.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-LinkageSpec.Po
    1686 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/LinkageSpec.cc' object='Parser/driver_cfa_cpp-LinkageSpec.o' libtool=no @AMDEPBACKSLASH@
    1687 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1688 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-LinkageSpec.o `test -f 'Parser/LinkageSpec.cc' || echo '$(srcdir)/'`Parser/LinkageSpec.cc
    1689 
    1690 Parser/driver_cfa_cpp-LinkageSpec.obj: Parser/LinkageSpec.cc
    1691 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-LinkageSpec.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-LinkageSpec.Tpo -c -o Parser/driver_cfa_cpp-LinkageSpec.obj `if test -f 'Parser/LinkageSpec.cc'; then $(CYGPATH_W) 'Parser/LinkageSpec.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/LinkageSpec.cc'; fi`
    1692 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-LinkageSpec.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-LinkageSpec.Po
    1693 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/LinkageSpec.cc' object='Parser/driver_cfa_cpp-LinkageSpec.obj' libtool=no @AMDEPBACKSLASH@
    1694 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1695 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-LinkageSpec.obj `if test -f 'Parser/LinkageSpec.cc'; then $(CYGPATH_W) 'Parser/LinkageSpec.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/LinkageSpec.cc'; fi`
    1696 
    1697 Parser/driver_cfa_cpp-parserutility.o: Parser/parserutility.cc
    1698 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parserutility.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo -c -o Parser/driver_cfa_cpp-parserutility.o `test -f 'Parser/parserutility.cc' || echo '$(srcdir)/'`Parser/parserutility.cc
    1699 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po
    1700 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parserutility.cc' object='Parser/driver_cfa_cpp-parserutility.o' libtool=no @AMDEPBACKSLASH@
    1701 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1702 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parserutility.o `test -f 'Parser/parserutility.cc' || echo '$(srcdir)/'`Parser/parserutility.cc
    1703 
    1704 Parser/driver_cfa_cpp-parserutility.obj: Parser/parserutility.cc
    1705 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parserutility.obj -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo -c -o Parser/driver_cfa_cpp-parserutility.obj `if test -f 'Parser/parserutility.cc'; then $(CYGPATH_W) 'Parser/parserutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parserutility.cc'; fi`
    1706 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Tpo Parser/$(DEPDIR)/driver_cfa_cpp-parserutility.Po
    1707 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Parser/parserutility.cc' object='Parser/driver_cfa_cpp-parserutility.obj' libtool=no @AMDEPBACKSLASH@
    1708 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1709 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Parser/driver_cfa_cpp-parserutility.obj `if test -f 'Parser/parserutility.cc'; then $(CYGPATH_W) 'Parser/parserutility.cc'; else $(CYGPATH_W) '$(srcdir)/Parser/parserutility.cc'; fi`
    1710 
    1711 ResolvExpr/driver_cfa_cpp-AlternativeFinder.o: ResolvExpr/AlternativeFinder.cc
    1712 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-AlternativeFinder.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AlternativeFinder.Tpo -c -o ResolvExpr/driver_cfa_cpp-AlternativeFinder.o `test -f 'ResolvExpr/AlternativeFinder.cc' || echo '$(srcdir)/'`ResolvExpr/AlternativeFinder.cc
    1713 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AlternativeFinder.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AlternativeFinder.Po
    1714 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/AlternativeFinder.cc' object='ResolvExpr/driver_cfa_cpp-AlternativeFinder.o' libtool=no @AMDEPBACKSLASH@
    1715 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1716 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-AlternativeFinder.o `test -f 'ResolvExpr/AlternativeFinder.cc' || echo '$(srcdir)/'`ResolvExpr/AlternativeFinder.cc
    1717 
    1718 ResolvExpr/driver_cfa_cpp-AlternativeFinder.obj: ResolvExpr/AlternativeFinder.cc
    1719 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-AlternativeFinder.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AlternativeFinder.Tpo -c -o ResolvExpr/driver_cfa_cpp-AlternativeFinder.obj `if test -f 'ResolvExpr/AlternativeFinder.cc'; then $(CYGPATH_W) 'ResolvExpr/AlternativeFinder.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/AlternativeFinder.cc'; fi`
    1720 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AlternativeFinder.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AlternativeFinder.Po
    1721 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/AlternativeFinder.cc' object='ResolvExpr/driver_cfa_cpp-AlternativeFinder.obj' libtool=no @AMDEPBACKSLASH@
    1722 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1723 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-AlternativeFinder.obj `if test -f 'ResolvExpr/AlternativeFinder.cc'; then $(CYGPATH_W) 'ResolvExpr/AlternativeFinder.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/AlternativeFinder.cc'; fi`
    1724 
    1725 ResolvExpr/driver_cfa_cpp-Alternative.o: ResolvExpr/Alternative.cc
    1726 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-Alternative.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Alternative.Tpo -c -o ResolvExpr/driver_cfa_cpp-Alternative.o `test -f 'ResolvExpr/Alternative.cc' || echo '$(srcdir)/'`ResolvExpr/Alternative.cc
    1727 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Alternative.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Alternative.Po
    1728 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/Alternative.cc' object='ResolvExpr/driver_cfa_cpp-Alternative.o' libtool=no @AMDEPBACKSLASH@
    1729 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1730 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-Alternative.o `test -f 'ResolvExpr/Alternative.cc' || echo '$(srcdir)/'`ResolvExpr/Alternative.cc
    1731 
    1732 ResolvExpr/driver_cfa_cpp-Alternative.obj: ResolvExpr/Alternative.cc
    1733 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-Alternative.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Alternative.Tpo -c -o ResolvExpr/driver_cfa_cpp-Alternative.obj `if test -f 'ResolvExpr/Alternative.cc'; then $(CYGPATH_W) 'ResolvExpr/Alternative.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/Alternative.cc'; fi`
    1734 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Alternative.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Alternative.Po
    1735 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/Alternative.cc' object='ResolvExpr/driver_cfa_cpp-Alternative.obj' libtool=no @AMDEPBACKSLASH@
    1736 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1737 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-Alternative.obj `if test -f 'ResolvExpr/Alternative.cc'; then $(CYGPATH_W) 'ResolvExpr/Alternative.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/Alternative.cc'; fi`
    1738 
    1739 ResolvExpr/driver_cfa_cpp-Unify.o: ResolvExpr/Unify.cc
    1740 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-Unify.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Unify.Tpo -c -o ResolvExpr/driver_cfa_cpp-Unify.o `test -f 'ResolvExpr/Unify.cc' || echo '$(srcdir)/'`ResolvExpr/Unify.cc
    1741 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Unify.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Unify.Po
    1742 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/Unify.cc' object='ResolvExpr/driver_cfa_cpp-Unify.o' libtool=no @AMDEPBACKSLASH@
    1743 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1744 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-Unify.o `test -f 'ResolvExpr/Unify.cc' || echo '$(srcdir)/'`ResolvExpr/Unify.cc
    1745 
    1746 ResolvExpr/driver_cfa_cpp-Unify.obj: ResolvExpr/Unify.cc
    1747 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-Unify.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Unify.Tpo -c -o ResolvExpr/driver_cfa_cpp-Unify.obj `if test -f 'ResolvExpr/Unify.cc'; then $(CYGPATH_W) 'ResolvExpr/Unify.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/Unify.cc'; fi`
    1748 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Unify.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Unify.Po
    1749 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/Unify.cc' object='ResolvExpr/driver_cfa_cpp-Unify.obj' libtool=no @AMDEPBACKSLASH@
    1750 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1751 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-Unify.obj `if test -f 'ResolvExpr/Unify.cc'; then $(CYGPATH_W) 'ResolvExpr/Unify.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/Unify.cc'; fi`
    1752 
    1753 ResolvExpr/driver_cfa_cpp-PtrsAssignable.o: ResolvExpr/PtrsAssignable.cc
    1754 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-PtrsAssignable.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PtrsAssignable.Tpo -c -o ResolvExpr/driver_cfa_cpp-PtrsAssignable.o `test -f 'ResolvExpr/PtrsAssignable.cc' || echo '$(srcdir)/'`ResolvExpr/PtrsAssignable.cc
    1755 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PtrsAssignable.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PtrsAssignable.Po
    1756 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/PtrsAssignable.cc' object='ResolvExpr/driver_cfa_cpp-PtrsAssignable.o' libtool=no @AMDEPBACKSLASH@
    1757 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1758 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-PtrsAssignable.o `test -f 'ResolvExpr/PtrsAssignable.cc' || echo '$(srcdir)/'`ResolvExpr/PtrsAssignable.cc
    1759 
    1760 ResolvExpr/driver_cfa_cpp-PtrsAssignable.obj: ResolvExpr/PtrsAssignable.cc
    1761 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-PtrsAssignable.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PtrsAssignable.Tpo -c -o ResolvExpr/driver_cfa_cpp-PtrsAssignable.obj `if test -f 'ResolvExpr/PtrsAssignable.cc'; then $(CYGPATH_W) 'ResolvExpr/PtrsAssignable.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/PtrsAssignable.cc'; fi`
    1762 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PtrsAssignable.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PtrsAssignable.Po
    1763 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/PtrsAssignable.cc' object='ResolvExpr/driver_cfa_cpp-PtrsAssignable.obj' libtool=no @AMDEPBACKSLASH@
    1764 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1765 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-PtrsAssignable.obj `if test -f 'ResolvExpr/PtrsAssignable.cc'; then $(CYGPATH_W) 'ResolvExpr/PtrsAssignable.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/PtrsAssignable.cc'; fi`
    1766 
    1767 ResolvExpr/driver_cfa_cpp-CommonType.o: ResolvExpr/CommonType.cc
    1768 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-CommonType.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CommonType.Tpo -c -o ResolvExpr/driver_cfa_cpp-CommonType.o `test -f 'ResolvExpr/CommonType.cc' || echo '$(srcdir)/'`ResolvExpr/CommonType.cc
    1769 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CommonType.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CommonType.Po
    1770 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/CommonType.cc' object='ResolvExpr/driver_cfa_cpp-CommonType.o' libtool=no @AMDEPBACKSLASH@
    1771 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1772 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-CommonType.o `test -f 'ResolvExpr/CommonType.cc' || echo '$(srcdir)/'`ResolvExpr/CommonType.cc
    1773 
    1774 ResolvExpr/driver_cfa_cpp-CommonType.obj: ResolvExpr/CommonType.cc
    1775 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-CommonType.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CommonType.Tpo -c -o ResolvExpr/driver_cfa_cpp-CommonType.obj `if test -f 'ResolvExpr/CommonType.cc'; then $(CYGPATH_W) 'ResolvExpr/CommonType.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/CommonType.cc'; fi`
    1776 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CommonType.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CommonType.Po
    1777 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/CommonType.cc' object='ResolvExpr/driver_cfa_cpp-CommonType.obj' libtool=no @AMDEPBACKSLASH@
    1778 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1779 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-CommonType.obj `if test -f 'ResolvExpr/CommonType.cc'; then $(CYGPATH_W) 'ResolvExpr/CommonType.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/CommonType.cc'; fi`
    1780 
    1781 ResolvExpr/driver_cfa_cpp-ConversionCost.o: ResolvExpr/ConversionCost.cc
    1782 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-ConversionCost.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ConversionCost.Tpo -c -o ResolvExpr/driver_cfa_cpp-ConversionCost.o `test -f 'ResolvExpr/ConversionCost.cc' || echo '$(srcdir)/'`ResolvExpr/ConversionCost.cc
    1783 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ConversionCost.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ConversionCost.Po
    1784 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/ConversionCost.cc' object='ResolvExpr/driver_cfa_cpp-ConversionCost.o' libtool=no @AMDEPBACKSLASH@
    1785 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1786 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-ConversionCost.o `test -f 'ResolvExpr/ConversionCost.cc' || echo '$(srcdir)/'`ResolvExpr/ConversionCost.cc
    1787 
    1788 ResolvExpr/driver_cfa_cpp-ConversionCost.obj: ResolvExpr/ConversionCost.cc
    1789 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-ConversionCost.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ConversionCost.Tpo -c -o ResolvExpr/driver_cfa_cpp-ConversionCost.obj `if test -f 'ResolvExpr/ConversionCost.cc'; then $(CYGPATH_W) 'ResolvExpr/ConversionCost.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/ConversionCost.cc'; fi`
    1790 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ConversionCost.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ConversionCost.Po
    1791 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/ConversionCost.cc' object='ResolvExpr/driver_cfa_cpp-ConversionCost.obj' libtool=no @AMDEPBACKSLASH@
    1792 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1793 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-ConversionCost.obj `if test -f 'ResolvExpr/ConversionCost.cc'; then $(CYGPATH_W) 'ResolvExpr/ConversionCost.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/ConversionCost.cc'; fi`
    1794 
    1795 ResolvExpr/driver_cfa_cpp-CastCost.o: ResolvExpr/CastCost.cc
    1796 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-CastCost.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CastCost.Tpo -c -o ResolvExpr/driver_cfa_cpp-CastCost.o `test -f 'ResolvExpr/CastCost.cc' || echo '$(srcdir)/'`ResolvExpr/CastCost.cc
    1797 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CastCost.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CastCost.Po
    1798 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/CastCost.cc' object='ResolvExpr/driver_cfa_cpp-CastCost.o' libtool=no @AMDEPBACKSLASH@
    1799 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1800 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-CastCost.o `test -f 'ResolvExpr/CastCost.cc' || echo '$(srcdir)/'`ResolvExpr/CastCost.cc
    1801 
    1802 ResolvExpr/driver_cfa_cpp-CastCost.obj: ResolvExpr/CastCost.cc
    1803 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-CastCost.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CastCost.Tpo -c -o ResolvExpr/driver_cfa_cpp-CastCost.obj `if test -f 'ResolvExpr/CastCost.cc'; then $(CYGPATH_W) 'ResolvExpr/CastCost.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/CastCost.cc'; fi`
    1804 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CastCost.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CastCost.Po
    1805 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/CastCost.cc' object='ResolvExpr/driver_cfa_cpp-CastCost.obj' libtool=no @AMDEPBACKSLASH@
    1806 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1807 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-CastCost.obj `if test -f 'ResolvExpr/CastCost.cc'; then $(CYGPATH_W) 'ResolvExpr/CastCost.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/CastCost.cc'; fi`
    1808 
    1809 ResolvExpr/driver_cfa_cpp-PtrsCastable.o: ResolvExpr/PtrsCastable.cc
    1810 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-PtrsCastable.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PtrsCastable.Tpo -c -o ResolvExpr/driver_cfa_cpp-PtrsCastable.o `test -f 'ResolvExpr/PtrsCastable.cc' || echo '$(srcdir)/'`ResolvExpr/PtrsCastable.cc
    1811 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PtrsCastable.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PtrsCastable.Po
    1812 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/PtrsCastable.cc' object='ResolvExpr/driver_cfa_cpp-PtrsCastable.o' libtool=no @AMDEPBACKSLASH@
    1813 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1814 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-PtrsCastable.o `test -f 'ResolvExpr/PtrsCastable.cc' || echo '$(srcdir)/'`ResolvExpr/PtrsCastable.cc
    1815 
    1816 ResolvExpr/driver_cfa_cpp-PtrsCastable.obj: ResolvExpr/PtrsCastable.cc
    1817 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-PtrsCastable.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PtrsCastable.Tpo -c -o ResolvExpr/driver_cfa_cpp-PtrsCastable.obj `if test -f 'ResolvExpr/PtrsCastable.cc'; then $(CYGPATH_W) 'ResolvExpr/PtrsCastable.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/PtrsCastable.cc'; fi`
    1818 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PtrsCastable.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PtrsCastable.Po
    1819 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/PtrsCastable.cc' object='ResolvExpr/driver_cfa_cpp-PtrsCastable.obj' libtool=no @AMDEPBACKSLASH@
    1820 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1821 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-PtrsCastable.obj `if test -f 'ResolvExpr/PtrsCastable.cc'; then $(CYGPATH_W) 'ResolvExpr/PtrsCastable.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/PtrsCastable.cc'; fi`
    1822 
    1823 ResolvExpr/driver_cfa_cpp-AdjustExprType.o: ResolvExpr/AdjustExprType.cc
    1824 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-AdjustExprType.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AdjustExprType.Tpo -c -o ResolvExpr/driver_cfa_cpp-AdjustExprType.o `test -f 'ResolvExpr/AdjustExprType.cc' || echo '$(srcdir)/'`ResolvExpr/AdjustExprType.cc
    1825 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AdjustExprType.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AdjustExprType.Po
    1826 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/AdjustExprType.cc' object='ResolvExpr/driver_cfa_cpp-AdjustExprType.o' libtool=no @AMDEPBACKSLASH@
    1827 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1828 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-AdjustExprType.o `test -f 'ResolvExpr/AdjustExprType.cc' || echo '$(srcdir)/'`ResolvExpr/AdjustExprType.cc
    1829 
    1830 ResolvExpr/driver_cfa_cpp-AdjustExprType.obj: ResolvExpr/AdjustExprType.cc
    1831 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-AdjustExprType.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AdjustExprType.Tpo -c -o ResolvExpr/driver_cfa_cpp-AdjustExprType.obj `if test -f 'ResolvExpr/AdjustExprType.cc'; then $(CYGPATH_W) 'ResolvExpr/AdjustExprType.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/AdjustExprType.cc'; fi`
    1832 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AdjustExprType.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AdjustExprType.Po
    1833 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/AdjustExprType.cc' object='ResolvExpr/driver_cfa_cpp-AdjustExprType.obj' libtool=no @AMDEPBACKSLASH@
    1834 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1835 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-AdjustExprType.obj `if test -f 'ResolvExpr/AdjustExprType.cc'; then $(CYGPATH_W) 'ResolvExpr/AdjustExprType.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/AdjustExprType.cc'; fi`
    1836 
    1837 ResolvExpr/driver_cfa_cpp-AlternativePrinter.o: ResolvExpr/AlternativePrinter.cc
    1838 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-AlternativePrinter.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AlternativePrinter.Tpo -c -o ResolvExpr/driver_cfa_cpp-AlternativePrinter.o `test -f 'ResolvExpr/AlternativePrinter.cc' || echo '$(srcdir)/'`ResolvExpr/AlternativePrinter.cc
    1839 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AlternativePrinter.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AlternativePrinter.Po
    1840 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/AlternativePrinter.cc' object='ResolvExpr/driver_cfa_cpp-AlternativePrinter.o' libtool=no @AMDEPBACKSLASH@
    1841 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1842 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-AlternativePrinter.o `test -f 'ResolvExpr/AlternativePrinter.cc' || echo '$(srcdir)/'`ResolvExpr/AlternativePrinter.cc
    1843 
    1844 ResolvExpr/driver_cfa_cpp-AlternativePrinter.obj: ResolvExpr/AlternativePrinter.cc
    1845 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-AlternativePrinter.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AlternativePrinter.Tpo -c -o ResolvExpr/driver_cfa_cpp-AlternativePrinter.obj `if test -f 'ResolvExpr/AlternativePrinter.cc'; then $(CYGPATH_W) 'ResolvExpr/AlternativePrinter.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/AlternativePrinter.cc'; fi`
    1846 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AlternativePrinter.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-AlternativePrinter.Po
    1847 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/AlternativePrinter.cc' object='ResolvExpr/driver_cfa_cpp-AlternativePrinter.obj' libtool=no @AMDEPBACKSLASH@
    1848 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1849 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-AlternativePrinter.obj `if test -f 'ResolvExpr/AlternativePrinter.cc'; then $(CYGPATH_W) 'ResolvExpr/AlternativePrinter.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/AlternativePrinter.cc'; fi`
    1850 
    1851 ResolvExpr/driver_cfa_cpp-Resolver.o: ResolvExpr/Resolver.cc
    1852 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-Resolver.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Resolver.Tpo -c -o ResolvExpr/driver_cfa_cpp-Resolver.o `test -f 'ResolvExpr/Resolver.cc' || echo '$(srcdir)/'`ResolvExpr/Resolver.cc
    1853 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Resolver.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Resolver.Po
    1854 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/Resolver.cc' object='ResolvExpr/driver_cfa_cpp-Resolver.o' libtool=no @AMDEPBACKSLASH@
    1855 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1856 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-Resolver.o `test -f 'ResolvExpr/Resolver.cc' || echo '$(srcdir)/'`ResolvExpr/Resolver.cc
    1857 
    1858 ResolvExpr/driver_cfa_cpp-Resolver.obj: ResolvExpr/Resolver.cc
    1859 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-Resolver.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Resolver.Tpo -c -o ResolvExpr/driver_cfa_cpp-Resolver.obj `if test -f 'ResolvExpr/Resolver.cc'; then $(CYGPATH_W) 'ResolvExpr/Resolver.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/Resolver.cc'; fi`
    1860 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Resolver.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Resolver.Po
    1861 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/Resolver.cc' object='ResolvExpr/driver_cfa_cpp-Resolver.obj' libtool=no @AMDEPBACKSLASH@
    1862 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1863 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-Resolver.obj `if test -f 'ResolvExpr/Resolver.cc'; then $(CYGPATH_W) 'ResolvExpr/Resolver.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/Resolver.cc'; fi`
    1864 
    1865 ResolvExpr/driver_cfa_cpp-ResolveTypeof.o: ResolvExpr/ResolveTypeof.cc
    1866 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-ResolveTypeof.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ResolveTypeof.Tpo -c -o ResolvExpr/driver_cfa_cpp-ResolveTypeof.o `test -f 'ResolvExpr/ResolveTypeof.cc' || echo '$(srcdir)/'`ResolvExpr/ResolveTypeof.cc
    1867 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ResolveTypeof.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ResolveTypeof.Po
    1868 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/ResolveTypeof.cc' object='ResolvExpr/driver_cfa_cpp-ResolveTypeof.o' libtool=no @AMDEPBACKSLASH@
    1869 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1870 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-ResolveTypeof.o `test -f 'ResolvExpr/ResolveTypeof.cc' || echo '$(srcdir)/'`ResolvExpr/ResolveTypeof.cc
    1871 
    1872 ResolvExpr/driver_cfa_cpp-ResolveTypeof.obj: ResolvExpr/ResolveTypeof.cc
    1873 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-ResolveTypeof.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ResolveTypeof.Tpo -c -o ResolvExpr/driver_cfa_cpp-ResolveTypeof.obj `if test -f 'ResolvExpr/ResolveTypeof.cc'; then $(CYGPATH_W) 'ResolvExpr/ResolveTypeof.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/ResolveTypeof.cc'; fi`
    1874 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ResolveTypeof.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ResolveTypeof.Po
    1875 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/ResolveTypeof.cc' object='ResolvExpr/driver_cfa_cpp-ResolveTypeof.obj' libtool=no @AMDEPBACKSLASH@
    1876 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1877 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-ResolveTypeof.obj `if test -f 'ResolvExpr/ResolveTypeof.cc'; then $(CYGPATH_W) 'ResolvExpr/ResolveTypeof.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/ResolveTypeof.cc'; fi`
    1878 
    1879 ResolvExpr/driver_cfa_cpp-RenameVars.o: ResolvExpr/RenameVars.cc
    1880 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-RenameVars.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-RenameVars.Tpo -c -o ResolvExpr/driver_cfa_cpp-RenameVars.o `test -f 'ResolvExpr/RenameVars.cc' || echo '$(srcdir)/'`ResolvExpr/RenameVars.cc
    1881 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-RenameVars.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-RenameVars.Po
    1882 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/RenameVars.cc' object='ResolvExpr/driver_cfa_cpp-RenameVars.o' libtool=no @AMDEPBACKSLASH@
    1883 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1884 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-RenameVars.o `test -f 'ResolvExpr/RenameVars.cc' || echo '$(srcdir)/'`ResolvExpr/RenameVars.cc
    1885 
    1886 ResolvExpr/driver_cfa_cpp-RenameVars.obj: ResolvExpr/RenameVars.cc
    1887 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-RenameVars.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-RenameVars.Tpo -c -o ResolvExpr/driver_cfa_cpp-RenameVars.obj `if test -f 'ResolvExpr/RenameVars.cc'; then $(CYGPATH_W) 'ResolvExpr/RenameVars.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/RenameVars.cc'; fi`
    1888 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-RenameVars.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-RenameVars.Po
    1889 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/RenameVars.cc' object='ResolvExpr/driver_cfa_cpp-RenameVars.obj' libtool=no @AMDEPBACKSLASH@
    1890 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1891 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-RenameVars.obj `if test -f 'ResolvExpr/RenameVars.cc'; then $(CYGPATH_W) 'ResolvExpr/RenameVars.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/RenameVars.cc'; fi`
    1892 
    1893 ResolvExpr/driver_cfa_cpp-FindOpenVars.o: ResolvExpr/FindOpenVars.cc
    1894 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-FindOpenVars.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-FindOpenVars.Tpo -c -o ResolvExpr/driver_cfa_cpp-FindOpenVars.o `test -f 'ResolvExpr/FindOpenVars.cc' || echo '$(srcdir)/'`ResolvExpr/FindOpenVars.cc
    1895 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-FindOpenVars.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-FindOpenVars.Po
    1896 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/FindOpenVars.cc' object='ResolvExpr/driver_cfa_cpp-FindOpenVars.o' libtool=no @AMDEPBACKSLASH@
    1897 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1898 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-FindOpenVars.o `test -f 'ResolvExpr/FindOpenVars.cc' || echo '$(srcdir)/'`ResolvExpr/FindOpenVars.cc
    1899 
    1900 ResolvExpr/driver_cfa_cpp-FindOpenVars.obj: ResolvExpr/FindOpenVars.cc
    1901 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-FindOpenVars.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-FindOpenVars.Tpo -c -o ResolvExpr/driver_cfa_cpp-FindOpenVars.obj `if test -f 'ResolvExpr/FindOpenVars.cc'; then $(CYGPATH_W) 'ResolvExpr/FindOpenVars.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/FindOpenVars.cc'; fi`
    1902 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-FindOpenVars.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-FindOpenVars.Po
    1903 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/FindOpenVars.cc' object='ResolvExpr/driver_cfa_cpp-FindOpenVars.obj' libtool=no @AMDEPBACKSLASH@
    1904 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1905 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-FindOpenVars.obj `if test -f 'ResolvExpr/FindOpenVars.cc'; then $(CYGPATH_W) 'ResolvExpr/FindOpenVars.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/FindOpenVars.cc'; fi`
    1906 
    1907 ResolvExpr/driver_cfa_cpp-PolyCost.o: ResolvExpr/PolyCost.cc
    1908 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-PolyCost.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PolyCost.Tpo -c -o ResolvExpr/driver_cfa_cpp-PolyCost.o `test -f 'ResolvExpr/PolyCost.cc' || echo '$(srcdir)/'`ResolvExpr/PolyCost.cc
    1909 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PolyCost.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PolyCost.Po
    1910 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/PolyCost.cc' object='ResolvExpr/driver_cfa_cpp-PolyCost.o' libtool=no @AMDEPBACKSLASH@
    1911 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1912 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-PolyCost.o `test -f 'ResolvExpr/PolyCost.cc' || echo '$(srcdir)/'`ResolvExpr/PolyCost.cc
    1913 
    1914 ResolvExpr/driver_cfa_cpp-PolyCost.obj: ResolvExpr/PolyCost.cc
    1915 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-PolyCost.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PolyCost.Tpo -c -o ResolvExpr/driver_cfa_cpp-PolyCost.obj `if test -f 'ResolvExpr/PolyCost.cc'; then $(CYGPATH_W) 'ResolvExpr/PolyCost.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/PolyCost.cc'; fi`
    1916 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PolyCost.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-PolyCost.Po
    1917 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/PolyCost.cc' object='ResolvExpr/driver_cfa_cpp-PolyCost.obj' libtool=no @AMDEPBACKSLASH@
    1918 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1919 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-PolyCost.obj `if test -f 'ResolvExpr/PolyCost.cc'; then $(CYGPATH_W) 'ResolvExpr/PolyCost.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/PolyCost.cc'; fi`
    1920 
    1921 ResolvExpr/driver_cfa_cpp-Occurs.o: ResolvExpr/Occurs.cc
    1922 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-Occurs.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Occurs.Tpo -c -o ResolvExpr/driver_cfa_cpp-Occurs.o `test -f 'ResolvExpr/Occurs.cc' || echo '$(srcdir)/'`ResolvExpr/Occurs.cc
    1923 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Occurs.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Occurs.Po
    1924 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/Occurs.cc' object='ResolvExpr/driver_cfa_cpp-Occurs.o' libtool=no @AMDEPBACKSLASH@
    1925 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1926 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-Occurs.o `test -f 'ResolvExpr/Occurs.cc' || echo '$(srcdir)/'`ResolvExpr/Occurs.cc
    1927 
    1928 ResolvExpr/driver_cfa_cpp-Occurs.obj: ResolvExpr/Occurs.cc
    1929 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-Occurs.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Occurs.Tpo -c -o ResolvExpr/driver_cfa_cpp-Occurs.obj `if test -f 'ResolvExpr/Occurs.cc'; then $(CYGPATH_W) 'ResolvExpr/Occurs.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/Occurs.cc'; fi`
    1930 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Occurs.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-Occurs.Po
    1931 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/Occurs.cc' object='ResolvExpr/driver_cfa_cpp-Occurs.obj' libtool=no @AMDEPBACKSLASH@
    1932 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1933 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-Occurs.obj `if test -f 'ResolvExpr/Occurs.cc'; then $(CYGPATH_W) 'ResolvExpr/Occurs.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/Occurs.cc'; fi`
    1934 
    1935 ResolvExpr/driver_cfa_cpp-TypeEnvironment.o: ResolvExpr/TypeEnvironment.cc
    1936 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-TypeEnvironment.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-TypeEnvironment.Tpo -c -o ResolvExpr/driver_cfa_cpp-TypeEnvironment.o `test -f 'ResolvExpr/TypeEnvironment.cc' || echo '$(srcdir)/'`ResolvExpr/TypeEnvironment.cc
    1937 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-TypeEnvironment.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-TypeEnvironment.Po
    1938 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/TypeEnvironment.cc' object='ResolvExpr/driver_cfa_cpp-TypeEnvironment.o' libtool=no @AMDEPBACKSLASH@
    1939 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1940 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-TypeEnvironment.o `test -f 'ResolvExpr/TypeEnvironment.cc' || echo '$(srcdir)/'`ResolvExpr/TypeEnvironment.cc
    1941 
    1942 ResolvExpr/driver_cfa_cpp-TypeEnvironment.obj: ResolvExpr/TypeEnvironment.cc
    1943 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-TypeEnvironment.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-TypeEnvironment.Tpo -c -o ResolvExpr/driver_cfa_cpp-TypeEnvironment.obj `if test -f 'ResolvExpr/TypeEnvironment.cc'; then $(CYGPATH_W) 'ResolvExpr/TypeEnvironment.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/TypeEnvironment.cc'; fi`
    1944 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-TypeEnvironment.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-TypeEnvironment.Po
    1945 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/TypeEnvironment.cc' object='ResolvExpr/driver_cfa_cpp-TypeEnvironment.obj' libtool=no @AMDEPBACKSLASH@
    1946 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1947 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-TypeEnvironment.obj `if test -f 'ResolvExpr/TypeEnvironment.cc'; then $(CYGPATH_W) 'ResolvExpr/TypeEnvironment.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/TypeEnvironment.cc'; fi`
    1948 
    1949 ResolvExpr/driver_cfa_cpp-CurrentObject.o: ResolvExpr/CurrentObject.cc
    1950 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-CurrentObject.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Tpo -c -o ResolvExpr/driver_cfa_cpp-CurrentObject.o `test -f 'ResolvExpr/CurrentObject.cc' || echo '$(srcdir)/'`ResolvExpr/CurrentObject.cc
    1951 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Po
    1952 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/CurrentObject.cc' object='ResolvExpr/driver_cfa_cpp-CurrentObject.o' libtool=no @AMDEPBACKSLASH@
    1953 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1954 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-CurrentObject.o `test -f 'ResolvExpr/CurrentObject.cc' || echo '$(srcdir)/'`ResolvExpr/CurrentObject.cc
    1955 
    1956 ResolvExpr/driver_cfa_cpp-CurrentObject.obj: ResolvExpr/CurrentObject.cc
    1957 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-CurrentObject.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Tpo -c -o ResolvExpr/driver_cfa_cpp-CurrentObject.obj `if test -f 'ResolvExpr/CurrentObject.cc'; then $(CYGPATH_W) 'ResolvExpr/CurrentObject.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/CurrentObject.cc'; fi`
    1958 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-CurrentObject.Po
    1959 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/CurrentObject.cc' object='ResolvExpr/driver_cfa_cpp-CurrentObject.obj' libtool=no @AMDEPBACKSLASH@
    1960 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1961 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-CurrentObject.obj `if test -f 'ResolvExpr/CurrentObject.cc'; then $(CYGPATH_W) 'ResolvExpr/CurrentObject.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/CurrentObject.cc'; fi`
    1962 
    1963 ResolvExpr/driver_cfa_cpp-ExplodedActual.o: ResolvExpr/ExplodedActual.cc
    1964 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-ExplodedActual.o -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ExplodedActual.Tpo -c -o ResolvExpr/driver_cfa_cpp-ExplodedActual.o `test -f 'ResolvExpr/ExplodedActual.cc' || echo '$(srcdir)/'`ResolvExpr/ExplodedActual.cc
    1965 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ExplodedActual.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ExplodedActual.Po
    1966 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/ExplodedActual.cc' object='ResolvExpr/driver_cfa_cpp-ExplodedActual.o' libtool=no @AMDEPBACKSLASH@
    1967 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1968 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-ExplodedActual.o `test -f 'ResolvExpr/ExplodedActual.cc' || echo '$(srcdir)/'`ResolvExpr/ExplodedActual.cc
    1969 
    1970 ResolvExpr/driver_cfa_cpp-ExplodedActual.obj: ResolvExpr/ExplodedActual.cc
    1971 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ResolvExpr/driver_cfa_cpp-ExplodedActual.obj -MD -MP -MF ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ExplodedActual.Tpo -c -o ResolvExpr/driver_cfa_cpp-ExplodedActual.obj `if test -f 'ResolvExpr/ExplodedActual.cc'; then $(CYGPATH_W) 'ResolvExpr/ExplodedActual.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/ExplodedActual.cc'; fi`
    1972 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ExplodedActual.Tpo ResolvExpr/$(DEPDIR)/driver_cfa_cpp-ExplodedActual.Po
    1973 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ResolvExpr/ExplodedActual.cc' object='ResolvExpr/driver_cfa_cpp-ExplodedActual.obj' libtool=no @AMDEPBACKSLASH@
    1974 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1975 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ResolvExpr/driver_cfa_cpp-ExplodedActual.obj `if test -f 'ResolvExpr/ExplodedActual.cc'; then $(CYGPATH_W) 'ResolvExpr/ExplodedActual.cc'; else $(CYGPATH_W) '$(srcdir)/ResolvExpr/ExplodedActual.cc'; fi`
    1976 
    1977 SymTab/driver_cfa_cpp-Indexer.o: SymTab/Indexer.cc
    1978 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-Indexer.o -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Tpo -c -o SymTab/driver_cfa_cpp-Indexer.o `test -f 'SymTab/Indexer.cc' || echo '$(srcdir)/'`SymTab/Indexer.cc
    1979 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Po
    1980 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/Indexer.cc' object='SymTab/driver_cfa_cpp-Indexer.o' libtool=no @AMDEPBACKSLASH@
    1981 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1982 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-Indexer.o `test -f 'SymTab/Indexer.cc' || echo '$(srcdir)/'`SymTab/Indexer.cc
    1983 
    1984 SymTab/driver_cfa_cpp-Indexer.obj: SymTab/Indexer.cc
    1985 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-Indexer.obj -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Tpo -c -o SymTab/driver_cfa_cpp-Indexer.obj `if test -f 'SymTab/Indexer.cc'; then $(CYGPATH_W) 'SymTab/Indexer.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/Indexer.cc'; fi`
    1986 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Po
    1987 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/Indexer.cc' object='SymTab/driver_cfa_cpp-Indexer.obj' libtool=no @AMDEPBACKSLASH@
    1988 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1989 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-Indexer.obj `if test -f 'SymTab/Indexer.cc'; then $(CYGPATH_W) 'SymTab/Indexer.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/Indexer.cc'; fi`
    1990 
    1991 SymTab/driver_cfa_cpp-Mangler.o: SymTab/Mangler.cc
    1992 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-Mangler.o -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-Mangler.Tpo -c -o SymTab/driver_cfa_cpp-Mangler.o `test -f 'SymTab/Mangler.cc' || echo '$(srcdir)/'`SymTab/Mangler.cc
    1993 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-Mangler.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-Mangler.Po
    1994 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/Mangler.cc' object='SymTab/driver_cfa_cpp-Mangler.o' libtool=no @AMDEPBACKSLASH@
    1995 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1996 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-Mangler.o `test -f 'SymTab/Mangler.cc' || echo '$(srcdir)/'`SymTab/Mangler.cc
    1997 
    1998 SymTab/driver_cfa_cpp-Mangler.obj: SymTab/Mangler.cc
    1999 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-Mangler.obj -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-Mangler.Tpo -c -o SymTab/driver_cfa_cpp-Mangler.obj `if test -f 'SymTab/Mangler.cc'; then $(CYGPATH_W) 'SymTab/Mangler.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/Mangler.cc'; fi`
    2000 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-Mangler.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-Mangler.Po
    2001 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/Mangler.cc' object='SymTab/driver_cfa_cpp-Mangler.obj' libtool=no @AMDEPBACKSLASH@
    2002 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2003 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-Mangler.obj `if test -f 'SymTab/Mangler.cc'; then $(CYGPATH_W) 'SymTab/Mangler.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/Mangler.cc'; fi`
    2004 
    2005 SymTab/driver_cfa_cpp-Validate.o: SymTab/Validate.cc
    2006 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-Validate.o -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-Validate.Tpo -c -o SymTab/driver_cfa_cpp-Validate.o `test -f 'SymTab/Validate.cc' || echo '$(srcdir)/'`SymTab/Validate.cc
    2007 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-Validate.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-Validate.Po
    2008 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/Validate.cc' object='SymTab/driver_cfa_cpp-Validate.o' libtool=no @AMDEPBACKSLASH@
    2009 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2010 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-Validate.o `test -f 'SymTab/Validate.cc' || echo '$(srcdir)/'`SymTab/Validate.cc
    2011 
    2012 SymTab/driver_cfa_cpp-Validate.obj: SymTab/Validate.cc
    2013 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-Validate.obj -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-Validate.Tpo -c -o SymTab/driver_cfa_cpp-Validate.obj `if test -f 'SymTab/Validate.cc'; then $(CYGPATH_W) 'SymTab/Validate.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/Validate.cc'; fi`
    2014 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-Validate.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-Validate.Po
    2015 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/Validate.cc' object='SymTab/driver_cfa_cpp-Validate.obj' libtool=no @AMDEPBACKSLASH@
    2016 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2017 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-Validate.obj `if test -f 'SymTab/Validate.cc'; then $(CYGPATH_W) 'SymTab/Validate.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/Validate.cc'; fi`
    2018 
    2019 SymTab/driver_cfa_cpp-FixFunction.o: SymTab/FixFunction.cc
    2020 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-FixFunction.o -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-FixFunction.Tpo -c -o SymTab/driver_cfa_cpp-FixFunction.o `test -f 'SymTab/FixFunction.cc' || echo '$(srcdir)/'`SymTab/FixFunction.cc
    2021 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-FixFunction.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-FixFunction.Po
    2022 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/FixFunction.cc' object='SymTab/driver_cfa_cpp-FixFunction.o' libtool=no @AMDEPBACKSLASH@
    2023 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2024 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-FixFunction.o `test -f 'SymTab/FixFunction.cc' || echo '$(srcdir)/'`SymTab/FixFunction.cc
    2025 
    2026 SymTab/driver_cfa_cpp-FixFunction.obj: SymTab/FixFunction.cc
    2027 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-FixFunction.obj -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-FixFunction.Tpo -c -o SymTab/driver_cfa_cpp-FixFunction.obj `if test -f 'SymTab/FixFunction.cc'; then $(CYGPATH_W) 'SymTab/FixFunction.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/FixFunction.cc'; fi`
    2028 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-FixFunction.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-FixFunction.Po
    2029 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/FixFunction.cc' object='SymTab/driver_cfa_cpp-FixFunction.obj' libtool=no @AMDEPBACKSLASH@
    2030 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2031 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-FixFunction.obj `if test -f 'SymTab/FixFunction.cc'; then $(CYGPATH_W) 'SymTab/FixFunction.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/FixFunction.cc'; fi`
    2032 
    2033 SymTab/driver_cfa_cpp-Autogen.o: SymTab/Autogen.cc
    2034 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-Autogen.o -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-Autogen.Tpo -c -o SymTab/driver_cfa_cpp-Autogen.o `test -f 'SymTab/Autogen.cc' || echo '$(srcdir)/'`SymTab/Autogen.cc
    2035 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-Autogen.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-Autogen.Po
    2036 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/Autogen.cc' object='SymTab/driver_cfa_cpp-Autogen.o' libtool=no @AMDEPBACKSLASH@
    2037 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2038 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-Autogen.o `test -f 'SymTab/Autogen.cc' || echo '$(srcdir)/'`SymTab/Autogen.cc
    2039 
    2040 SymTab/driver_cfa_cpp-Autogen.obj: SymTab/Autogen.cc
    2041 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-Autogen.obj -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-Autogen.Tpo -c -o SymTab/driver_cfa_cpp-Autogen.obj `if test -f 'SymTab/Autogen.cc'; then $(CYGPATH_W) 'SymTab/Autogen.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/Autogen.cc'; fi`
    2042 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-Autogen.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-Autogen.Po
    2043 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/Autogen.cc' object='SymTab/driver_cfa_cpp-Autogen.obj' libtool=no @AMDEPBACKSLASH@
    2044 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2045 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-Autogen.obj `if test -f 'SymTab/Autogen.cc'; then $(CYGPATH_W) 'SymTab/Autogen.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/Autogen.cc'; fi`
    2046 
    2047 SynTree/driver_cfa_cpp-Type.o: SynTree/Type.cc
    2048 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Type.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Type.Tpo -c -o SynTree/driver_cfa_cpp-Type.o `test -f 'SynTree/Type.cc' || echo '$(srcdir)/'`SynTree/Type.cc
    2049 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Type.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Type.Po
    2050 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Type.cc' object='SynTree/driver_cfa_cpp-Type.o' libtool=no @AMDEPBACKSLASH@
    2051 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2052 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Type.o `test -f 'SynTree/Type.cc' || echo '$(srcdir)/'`SynTree/Type.cc
    2053 
    2054 SynTree/driver_cfa_cpp-Type.obj: SynTree/Type.cc
    2055 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Type.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Type.Tpo -c -o SynTree/driver_cfa_cpp-Type.obj `if test -f 'SynTree/Type.cc'; then $(CYGPATH_W) 'SynTree/Type.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Type.cc'; fi`
    2056 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Type.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Type.Po
    2057 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Type.cc' object='SynTree/driver_cfa_cpp-Type.obj' libtool=no @AMDEPBACKSLASH@
    2058 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2059 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Type.obj `if test -f 'SynTree/Type.cc'; then $(CYGPATH_W) 'SynTree/Type.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Type.cc'; fi`
    2060 
    2061 SynTree/driver_cfa_cpp-VoidType.o: SynTree/VoidType.cc
    2062 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-VoidType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Tpo -c -o SynTree/driver_cfa_cpp-VoidType.o `test -f 'SynTree/VoidType.cc' || echo '$(srcdir)/'`SynTree/VoidType.cc
    2063 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Po
    2064 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/VoidType.cc' object='SynTree/driver_cfa_cpp-VoidType.o' libtool=no @AMDEPBACKSLASH@
    2065 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2066 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-VoidType.o `test -f 'SynTree/VoidType.cc' || echo '$(srcdir)/'`SynTree/VoidType.cc
    2067 
    2068 SynTree/driver_cfa_cpp-VoidType.obj: SynTree/VoidType.cc
    2069 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-VoidType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Tpo -c -o SynTree/driver_cfa_cpp-VoidType.obj `if test -f 'SynTree/VoidType.cc'; then $(CYGPATH_W) 'SynTree/VoidType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/VoidType.cc'; fi`
    2070 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Po
    2071 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/VoidType.cc' object='SynTree/driver_cfa_cpp-VoidType.obj' libtool=no @AMDEPBACKSLASH@
    2072 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2073 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-VoidType.obj `if test -f 'SynTree/VoidType.cc'; then $(CYGPATH_W) 'SynTree/VoidType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/VoidType.cc'; fi`
    2074 
    2075 SynTree/driver_cfa_cpp-BasicType.o: SynTree/BasicType.cc
    2076 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-BasicType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-BasicType.Tpo -c -o SynTree/driver_cfa_cpp-BasicType.o `test -f 'SynTree/BasicType.cc' || echo '$(srcdir)/'`SynTree/BasicType.cc
    2077 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-BasicType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-BasicType.Po
    2078 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/BasicType.cc' object='SynTree/driver_cfa_cpp-BasicType.o' libtool=no @AMDEPBACKSLASH@
    2079 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2080 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-BasicType.o `test -f 'SynTree/BasicType.cc' || echo '$(srcdir)/'`SynTree/BasicType.cc
    2081 
    2082 SynTree/driver_cfa_cpp-BasicType.obj: SynTree/BasicType.cc
    2083 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-BasicType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-BasicType.Tpo -c -o SynTree/driver_cfa_cpp-BasicType.obj `if test -f 'SynTree/BasicType.cc'; then $(CYGPATH_W) 'SynTree/BasicType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/BasicType.cc'; fi`
    2084 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-BasicType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-BasicType.Po
    2085 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/BasicType.cc' object='SynTree/driver_cfa_cpp-BasicType.obj' libtool=no @AMDEPBACKSLASH@
    2086 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2087 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-BasicType.obj `if test -f 'SynTree/BasicType.cc'; then $(CYGPATH_W) 'SynTree/BasicType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/BasicType.cc'; fi`
    2088 
    2089 SynTree/driver_cfa_cpp-PointerType.o: SynTree/PointerType.cc
    2090 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-PointerType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-PointerType.Tpo -c -o SynTree/driver_cfa_cpp-PointerType.o `test -f 'SynTree/PointerType.cc' || echo '$(srcdir)/'`SynTree/PointerType.cc
    2091 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-PointerType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-PointerType.Po
    2092 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/PointerType.cc' object='SynTree/driver_cfa_cpp-PointerType.o' libtool=no @AMDEPBACKSLASH@
    2093 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2094 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-PointerType.o `test -f 'SynTree/PointerType.cc' || echo '$(srcdir)/'`SynTree/PointerType.cc
    2095 
    2096 SynTree/driver_cfa_cpp-PointerType.obj: SynTree/PointerType.cc
    2097 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-PointerType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-PointerType.Tpo -c -o SynTree/driver_cfa_cpp-PointerType.obj `if test -f 'SynTree/PointerType.cc'; then $(CYGPATH_W) 'SynTree/PointerType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/PointerType.cc'; fi`
    2098 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-PointerType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-PointerType.Po
    2099 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/PointerType.cc' object='SynTree/driver_cfa_cpp-PointerType.obj' libtool=no @AMDEPBACKSLASH@
    2100 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2101 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-PointerType.obj `if test -f 'SynTree/PointerType.cc'; then $(CYGPATH_W) 'SynTree/PointerType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/PointerType.cc'; fi`
    2102 
    2103 SynTree/driver_cfa_cpp-ArrayType.o: SynTree/ArrayType.cc
    2104 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ArrayType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ArrayType.Tpo -c -o SynTree/driver_cfa_cpp-ArrayType.o `test -f 'SynTree/ArrayType.cc' || echo '$(srcdir)/'`SynTree/ArrayType.cc
    2105 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ArrayType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ArrayType.Po
    2106 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ArrayType.cc' object='SynTree/driver_cfa_cpp-ArrayType.o' libtool=no @AMDEPBACKSLASH@
    2107 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2108 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ArrayType.o `test -f 'SynTree/ArrayType.cc' || echo '$(srcdir)/'`SynTree/ArrayType.cc
    2109 
    2110 SynTree/driver_cfa_cpp-ArrayType.obj: SynTree/ArrayType.cc
    2111 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ArrayType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ArrayType.Tpo -c -o SynTree/driver_cfa_cpp-ArrayType.obj `if test -f 'SynTree/ArrayType.cc'; then $(CYGPATH_W) 'SynTree/ArrayType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ArrayType.cc'; fi`
    2112 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ArrayType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ArrayType.Po
    2113 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ArrayType.cc' object='SynTree/driver_cfa_cpp-ArrayType.obj' libtool=no @AMDEPBACKSLASH@
    2114 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2115 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ArrayType.obj `if test -f 'SynTree/ArrayType.cc'; then $(CYGPATH_W) 'SynTree/ArrayType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ArrayType.cc'; fi`
    2116 
    2117 SynTree/driver_cfa_cpp-ReferenceType.o: SynTree/ReferenceType.cc
    2118 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ReferenceType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Tpo -c -o SynTree/driver_cfa_cpp-ReferenceType.o `test -f 'SynTree/ReferenceType.cc' || echo '$(srcdir)/'`SynTree/ReferenceType.cc
    2119 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Po
    2120 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ReferenceType.cc' object='SynTree/driver_cfa_cpp-ReferenceType.o' libtool=no @AMDEPBACKSLASH@
    2121 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2122 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ReferenceType.o `test -f 'SynTree/ReferenceType.cc' || echo '$(srcdir)/'`SynTree/ReferenceType.cc
    2123 
    2124 SynTree/driver_cfa_cpp-ReferenceType.obj: SynTree/ReferenceType.cc
    2125 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ReferenceType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Tpo -c -o SynTree/driver_cfa_cpp-ReferenceType.obj `if test -f 'SynTree/ReferenceType.cc'; then $(CYGPATH_W) 'SynTree/ReferenceType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ReferenceType.cc'; fi`
    2126 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceType.Po
    2127 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ReferenceType.cc' object='SynTree/driver_cfa_cpp-ReferenceType.obj' libtool=no @AMDEPBACKSLASH@
    2128 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2129 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ReferenceType.obj `if test -f 'SynTree/ReferenceType.cc'; then $(CYGPATH_W) 'SynTree/ReferenceType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ReferenceType.cc'; fi`
    2130 
    2131 SynTree/driver_cfa_cpp-FunctionType.o: SynTree/FunctionType.cc
    2132 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-FunctionType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionType.Tpo -c -o SynTree/driver_cfa_cpp-FunctionType.o `test -f 'SynTree/FunctionType.cc' || echo '$(srcdir)/'`SynTree/FunctionType.cc
    2133 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionType.Po
    2134 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/FunctionType.cc' object='SynTree/driver_cfa_cpp-FunctionType.o' libtool=no @AMDEPBACKSLASH@
    2135 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2136 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-FunctionType.o `test -f 'SynTree/FunctionType.cc' || echo '$(srcdir)/'`SynTree/FunctionType.cc
    2137 
    2138 SynTree/driver_cfa_cpp-FunctionType.obj: SynTree/FunctionType.cc
    2139 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-FunctionType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionType.Tpo -c -o SynTree/driver_cfa_cpp-FunctionType.obj `if test -f 'SynTree/FunctionType.cc'; then $(CYGPATH_W) 'SynTree/FunctionType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/FunctionType.cc'; fi`
    2140 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionType.Po
    2141 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/FunctionType.cc' object='SynTree/driver_cfa_cpp-FunctionType.obj' libtool=no @AMDEPBACKSLASH@
    2142 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2143 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-FunctionType.obj `if test -f 'SynTree/FunctionType.cc'; then $(CYGPATH_W) 'SynTree/FunctionType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/FunctionType.cc'; fi`
    2144 
    2145 SynTree/driver_cfa_cpp-ReferenceToType.o: SynTree/ReferenceToType.cc
    2146 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ReferenceToType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceToType.Tpo -c -o SynTree/driver_cfa_cpp-ReferenceToType.o `test -f 'SynTree/ReferenceToType.cc' || echo '$(srcdir)/'`SynTree/ReferenceToType.cc
    2147 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceToType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceToType.Po
    2148 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ReferenceToType.cc' object='SynTree/driver_cfa_cpp-ReferenceToType.o' libtool=no @AMDEPBACKSLASH@
    2149 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2150 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ReferenceToType.o `test -f 'SynTree/ReferenceToType.cc' || echo '$(srcdir)/'`SynTree/ReferenceToType.cc
    2151 
    2152 SynTree/driver_cfa_cpp-ReferenceToType.obj: SynTree/ReferenceToType.cc
    2153 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ReferenceToType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceToType.Tpo -c -o SynTree/driver_cfa_cpp-ReferenceToType.obj `if test -f 'SynTree/ReferenceToType.cc'; then $(CYGPATH_W) 'SynTree/ReferenceToType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ReferenceToType.cc'; fi`
    2154 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceToType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ReferenceToType.Po
    2155 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ReferenceToType.cc' object='SynTree/driver_cfa_cpp-ReferenceToType.obj' libtool=no @AMDEPBACKSLASH@
    2156 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2157 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ReferenceToType.obj `if test -f 'SynTree/ReferenceToType.cc'; then $(CYGPATH_W) 'SynTree/ReferenceToType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ReferenceToType.cc'; fi`
    2158 
    2159 SynTree/driver_cfa_cpp-TupleType.o: SynTree/TupleType.cc
    2160 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-TupleType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-TupleType.Tpo -c -o SynTree/driver_cfa_cpp-TupleType.o `test -f 'SynTree/TupleType.cc' || echo '$(srcdir)/'`SynTree/TupleType.cc
    2161 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-TupleType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-TupleType.Po
    2162 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/TupleType.cc' object='SynTree/driver_cfa_cpp-TupleType.o' libtool=no @AMDEPBACKSLASH@
    2163 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2164 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-TupleType.o `test -f 'SynTree/TupleType.cc' || echo '$(srcdir)/'`SynTree/TupleType.cc
    2165 
    2166 SynTree/driver_cfa_cpp-TupleType.obj: SynTree/TupleType.cc
    2167 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-TupleType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-TupleType.Tpo -c -o SynTree/driver_cfa_cpp-TupleType.obj `if test -f 'SynTree/TupleType.cc'; then $(CYGPATH_W) 'SynTree/TupleType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/TupleType.cc'; fi`
    2168 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-TupleType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-TupleType.Po
    2169 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/TupleType.cc' object='SynTree/driver_cfa_cpp-TupleType.obj' libtool=no @AMDEPBACKSLASH@
    2170 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2171 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-TupleType.obj `if test -f 'SynTree/TupleType.cc'; then $(CYGPATH_W) 'SynTree/TupleType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/TupleType.cc'; fi`
    2172 
    2173 SynTree/driver_cfa_cpp-TypeofType.o: SynTree/TypeofType.cc
    2174 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-TypeofType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-TypeofType.Tpo -c -o SynTree/driver_cfa_cpp-TypeofType.o `test -f 'SynTree/TypeofType.cc' || echo '$(srcdir)/'`SynTree/TypeofType.cc
    2175 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-TypeofType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-TypeofType.Po
    2176 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/TypeofType.cc' object='SynTree/driver_cfa_cpp-TypeofType.o' libtool=no @AMDEPBACKSLASH@
    2177 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2178 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-TypeofType.o `test -f 'SynTree/TypeofType.cc' || echo '$(srcdir)/'`SynTree/TypeofType.cc
    2179 
    2180 SynTree/driver_cfa_cpp-TypeofType.obj: SynTree/TypeofType.cc
    2181 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-TypeofType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-TypeofType.Tpo -c -o SynTree/driver_cfa_cpp-TypeofType.obj `if test -f 'SynTree/TypeofType.cc'; then $(CYGPATH_W) 'SynTree/TypeofType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/TypeofType.cc'; fi`
    2182 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-TypeofType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-TypeofType.Po
    2183 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/TypeofType.cc' object='SynTree/driver_cfa_cpp-TypeofType.obj' libtool=no @AMDEPBACKSLASH@
    2184 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2185 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-TypeofType.obj `if test -f 'SynTree/TypeofType.cc'; then $(CYGPATH_W) 'SynTree/TypeofType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/TypeofType.cc'; fi`
    2186 
    2187 SynTree/driver_cfa_cpp-AttrType.o: SynTree/AttrType.cc
    2188 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-AttrType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-AttrType.Tpo -c -o SynTree/driver_cfa_cpp-AttrType.o `test -f 'SynTree/AttrType.cc' || echo '$(srcdir)/'`SynTree/AttrType.cc
    2189 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-AttrType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-AttrType.Po
    2190 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/AttrType.cc' object='SynTree/driver_cfa_cpp-AttrType.o' libtool=no @AMDEPBACKSLASH@
    2191 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2192 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-AttrType.o `test -f 'SynTree/AttrType.cc' || echo '$(srcdir)/'`SynTree/AttrType.cc
    2193 
    2194 SynTree/driver_cfa_cpp-AttrType.obj: SynTree/AttrType.cc
    2195 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-AttrType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-AttrType.Tpo -c -o SynTree/driver_cfa_cpp-AttrType.obj `if test -f 'SynTree/AttrType.cc'; then $(CYGPATH_W) 'SynTree/AttrType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/AttrType.cc'; fi`
    2196 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-AttrType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-AttrType.Po
    2197 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/AttrType.cc' object='SynTree/driver_cfa_cpp-AttrType.obj' libtool=no @AMDEPBACKSLASH@
    2198 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2199 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-AttrType.obj `if test -f 'SynTree/AttrType.cc'; then $(CYGPATH_W) 'SynTree/AttrType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/AttrType.cc'; fi`
    2200 
    2201 SynTree/driver_cfa_cpp-VarArgsType.o: SynTree/VarArgsType.cc
    2202 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-VarArgsType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Tpo -c -o SynTree/driver_cfa_cpp-VarArgsType.o `test -f 'SynTree/VarArgsType.cc' || echo '$(srcdir)/'`SynTree/VarArgsType.cc
    2203 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Po
    2204 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/VarArgsType.cc' object='SynTree/driver_cfa_cpp-VarArgsType.o' libtool=no @AMDEPBACKSLASH@
    2205 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2206 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-VarArgsType.o `test -f 'SynTree/VarArgsType.cc' || echo '$(srcdir)/'`SynTree/VarArgsType.cc
    2207 
    2208 SynTree/driver_cfa_cpp-VarArgsType.obj: SynTree/VarArgsType.cc
    2209 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-VarArgsType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Tpo -c -o SynTree/driver_cfa_cpp-VarArgsType.obj `if test -f 'SynTree/VarArgsType.cc'; then $(CYGPATH_W) 'SynTree/VarArgsType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/VarArgsType.cc'; fi`
    2210 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Po
    2211 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/VarArgsType.cc' object='SynTree/driver_cfa_cpp-VarArgsType.obj' libtool=no @AMDEPBACKSLASH@
    2212 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2213 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-VarArgsType.obj `if test -f 'SynTree/VarArgsType.cc'; then $(CYGPATH_W) 'SynTree/VarArgsType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/VarArgsType.cc'; fi`
    2214 
    2215 SynTree/driver_cfa_cpp-ZeroOneType.o: SynTree/ZeroOneType.cc
    2216 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ZeroOneType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo -c -o SynTree/driver_cfa_cpp-ZeroOneType.o `test -f 'SynTree/ZeroOneType.cc' || echo '$(srcdir)/'`SynTree/ZeroOneType.cc
    2217 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po
    2218 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ZeroOneType.cc' object='SynTree/driver_cfa_cpp-ZeroOneType.o' libtool=no @AMDEPBACKSLASH@
    2219 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2220 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ZeroOneType.o `test -f 'SynTree/ZeroOneType.cc' || echo '$(srcdir)/'`SynTree/ZeroOneType.cc
    2221 
    2222 SynTree/driver_cfa_cpp-ZeroOneType.obj: SynTree/ZeroOneType.cc
    2223 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ZeroOneType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo -c -o SynTree/driver_cfa_cpp-ZeroOneType.obj `if test -f 'SynTree/ZeroOneType.cc'; then $(CYGPATH_W) 'SynTree/ZeroOneType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ZeroOneType.cc'; fi`
    2224 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po
    2225 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ZeroOneType.cc' object='SynTree/driver_cfa_cpp-ZeroOneType.obj' libtool=no @AMDEPBACKSLASH@
    2226 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2227 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ZeroOneType.obj `if test -f 'SynTree/ZeroOneType.cc'; then $(CYGPATH_W) 'SynTree/ZeroOneType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ZeroOneType.cc'; fi`
    2228 
    2229 SynTree/driver_cfa_cpp-Constant.o: SynTree/Constant.cc
    2230 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Constant.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Constant.Tpo -c -o SynTree/driver_cfa_cpp-Constant.o `test -f 'SynTree/Constant.cc' || echo '$(srcdir)/'`SynTree/Constant.cc
    2231 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Constant.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Constant.Po
    2232 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Constant.cc' object='SynTree/driver_cfa_cpp-Constant.o' libtool=no @AMDEPBACKSLASH@
    2233 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2234 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Constant.o `test -f 'SynTree/Constant.cc' || echo '$(srcdir)/'`SynTree/Constant.cc
    2235 
    2236 SynTree/driver_cfa_cpp-Constant.obj: SynTree/Constant.cc
    2237 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Constant.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Constant.Tpo -c -o SynTree/driver_cfa_cpp-Constant.obj `if test -f 'SynTree/Constant.cc'; then $(CYGPATH_W) 'SynTree/Constant.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Constant.cc'; fi`
    2238 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Constant.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Constant.Po
    2239 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Constant.cc' object='SynTree/driver_cfa_cpp-Constant.obj' libtool=no @AMDEPBACKSLASH@
    2240 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2241 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Constant.obj `if test -f 'SynTree/Constant.cc'; then $(CYGPATH_W) 'SynTree/Constant.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Constant.cc'; fi`
    2242 
    2243 SynTree/driver_cfa_cpp-Expression.o: SynTree/Expression.cc
    2244 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Expression.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Expression.Tpo -c -o SynTree/driver_cfa_cpp-Expression.o `test -f 'SynTree/Expression.cc' || echo '$(srcdir)/'`SynTree/Expression.cc
    2245 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Expression.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Expression.Po
    2246 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Expression.cc' object='SynTree/driver_cfa_cpp-Expression.o' libtool=no @AMDEPBACKSLASH@
    2247 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2248 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Expression.o `test -f 'SynTree/Expression.cc' || echo '$(srcdir)/'`SynTree/Expression.cc
    2249 
    2250 SynTree/driver_cfa_cpp-Expression.obj: SynTree/Expression.cc
    2251 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Expression.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Expression.Tpo -c -o SynTree/driver_cfa_cpp-Expression.obj `if test -f 'SynTree/Expression.cc'; then $(CYGPATH_W) 'SynTree/Expression.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Expression.cc'; fi`
    2252 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Expression.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Expression.Po
    2253 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Expression.cc' object='SynTree/driver_cfa_cpp-Expression.obj' libtool=no @AMDEPBACKSLASH@
    2254 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2255 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Expression.obj `if test -f 'SynTree/Expression.cc'; then $(CYGPATH_W) 'SynTree/Expression.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Expression.cc'; fi`
    2256 
    2257 SynTree/driver_cfa_cpp-TupleExpr.o: SynTree/TupleExpr.cc
    2258 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-TupleExpr.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-TupleExpr.Tpo -c -o SynTree/driver_cfa_cpp-TupleExpr.o `test -f 'SynTree/TupleExpr.cc' || echo '$(srcdir)/'`SynTree/TupleExpr.cc
    2259 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-TupleExpr.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-TupleExpr.Po
    2260 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/TupleExpr.cc' object='SynTree/driver_cfa_cpp-TupleExpr.o' libtool=no @AMDEPBACKSLASH@
    2261 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2262 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-TupleExpr.o `test -f 'SynTree/TupleExpr.cc' || echo '$(srcdir)/'`SynTree/TupleExpr.cc
    2263 
    2264 SynTree/driver_cfa_cpp-TupleExpr.obj: SynTree/TupleExpr.cc
    2265 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-TupleExpr.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-TupleExpr.Tpo -c -o SynTree/driver_cfa_cpp-TupleExpr.obj `if test -f 'SynTree/TupleExpr.cc'; then $(CYGPATH_W) 'SynTree/TupleExpr.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/TupleExpr.cc'; fi`
    2266 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-TupleExpr.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-TupleExpr.Po
    2267 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/TupleExpr.cc' object='SynTree/driver_cfa_cpp-TupleExpr.obj' libtool=no @AMDEPBACKSLASH@
    2268 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2269 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-TupleExpr.obj `if test -f 'SynTree/TupleExpr.cc'; then $(CYGPATH_W) 'SynTree/TupleExpr.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/TupleExpr.cc'; fi`
    2270 
    2271 SynTree/driver_cfa_cpp-CommaExpr.o: SynTree/CommaExpr.cc
    2272 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-CommaExpr.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-CommaExpr.Tpo -c -o SynTree/driver_cfa_cpp-CommaExpr.o `test -f 'SynTree/CommaExpr.cc' || echo '$(srcdir)/'`SynTree/CommaExpr.cc
    2273 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-CommaExpr.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-CommaExpr.Po
    2274 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/CommaExpr.cc' object='SynTree/driver_cfa_cpp-CommaExpr.o' libtool=no @AMDEPBACKSLASH@
    2275 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2276 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-CommaExpr.o `test -f 'SynTree/CommaExpr.cc' || echo '$(srcdir)/'`SynTree/CommaExpr.cc
    2277 
    2278 SynTree/driver_cfa_cpp-CommaExpr.obj: SynTree/CommaExpr.cc
    2279 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-CommaExpr.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-CommaExpr.Tpo -c -o SynTree/driver_cfa_cpp-CommaExpr.obj `if test -f 'SynTree/CommaExpr.cc'; then $(CYGPATH_W) 'SynTree/CommaExpr.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/CommaExpr.cc'; fi`
    2280 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-CommaExpr.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-CommaExpr.Po
    2281 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/CommaExpr.cc' object='SynTree/driver_cfa_cpp-CommaExpr.obj' libtool=no @AMDEPBACKSLASH@
    2282 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2283 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-CommaExpr.obj `if test -f 'SynTree/CommaExpr.cc'; then $(CYGPATH_W) 'SynTree/CommaExpr.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/CommaExpr.cc'; fi`
    2284 
    2285 SynTree/driver_cfa_cpp-TypeExpr.o: SynTree/TypeExpr.cc
    2286 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-TypeExpr.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-TypeExpr.Tpo -c -o SynTree/driver_cfa_cpp-TypeExpr.o `test -f 'SynTree/TypeExpr.cc' || echo '$(srcdir)/'`SynTree/TypeExpr.cc
    2287 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-TypeExpr.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-TypeExpr.Po
    2288 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/TypeExpr.cc' object='SynTree/driver_cfa_cpp-TypeExpr.o' libtool=no @AMDEPBACKSLASH@
    2289 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2290 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-TypeExpr.o `test -f 'SynTree/TypeExpr.cc' || echo '$(srcdir)/'`SynTree/TypeExpr.cc
    2291 
    2292 SynTree/driver_cfa_cpp-TypeExpr.obj: SynTree/TypeExpr.cc
    2293 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-TypeExpr.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-TypeExpr.Tpo -c -o SynTree/driver_cfa_cpp-TypeExpr.obj `if test -f 'SynTree/TypeExpr.cc'; then $(CYGPATH_W) 'SynTree/TypeExpr.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/TypeExpr.cc'; fi`
    2294 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-TypeExpr.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-TypeExpr.Po
    2295 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/TypeExpr.cc' object='SynTree/driver_cfa_cpp-TypeExpr.obj' libtool=no @AMDEPBACKSLASH@
    2296 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2297 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-TypeExpr.obj `if test -f 'SynTree/TypeExpr.cc'; then $(CYGPATH_W) 'SynTree/TypeExpr.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/TypeExpr.cc'; fi`
    2298 
    2299 SynTree/driver_cfa_cpp-ApplicationExpr.o: SynTree/ApplicationExpr.cc
    2300 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ApplicationExpr.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ApplicationExpr.Tpo -c -o SynTree/driver_cfa_cpp-ApplicationExpr.o `test -f 'SynTree/ApplicationExpr.cc' || echo '$(srcdir)/'`SynTree/ApplicationExpr.cc
    2301 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ApplicationExpr.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ApplicationExpr.Po
    2302 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ApplicationExpr.cc' object='SynTree/driver_cfa_cpp-ApplicationExpr.o' libtool=no @AMDEPBACKSLASH@
    2303 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2304 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ApplicationExpr.o `test -f 'SynTree/ApplicationExpr.cc' || echo '$(srcdir)/'`SynTree/ApplicationExpr.cc
    2305 
    2306 SynTree/driver_cfa_cpp-ApplicationExpr.obj: SynTree/ApplicationExpr.cc
    2307 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ApplicationExpr.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ApplicationExpr.Tpo -c -o SynTree/driver_cfa_cpp-ApplicationExpr.obj `if test -f 'SynTree/ApplicationExpr.cc'; then $(CYGPATH_W) 'SynTree/ApplicationExpr.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ApplicationExpr.cc'; fi`
    2308 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ApplicationExpr.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ApplicationExpr.Po
    2309 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ApplicationExpr.cc' object='SynTree/driver_cfa_cpp-ApplicationExpr.obj' libtool=no @AMDEPBACKSLASH@
    2310 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2311 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ApplicationExpr.obj `if test -f 'SynTree/ApplicationExpr.cc'; then $(CYGPATH_W) 'SynTree/ApplicationExpr.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ApplicationExpr.cc'; fi`
    2312 
    2313 SynTree/driver_cfa_cpp-AddressExpr.o: SynTree/AddressExpr.cc
    2314 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-AddressExpr.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-AddressExpr.Tpo -c -o SynTree/driver_cfa_cpp-AddressExpr.o `test -f 'SynTree/AddressExpr.cc' || echo '$(srcdir)/'`SynTree/AddressExpr.cc
    2315 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-AddressExpr.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-AddressExpr.Po
    2316 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/AddressExpr.cc' object='SynTree/driver_cfa_cpp-AddressExpr.o' libtool=no @AMDEPBACKSLASH@
    2317 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2318 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-AddressExpr.o `test -f 'SynTree/AddressExpr.cc' || echo '$(srcdir)/'`SynTree/AddressExpr.cc
    2319 
    2320 SynTree/driver_cfa_cpp-AddressExpr.obj: SynTree/AddressExpr.cc
    2321 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-AddressExpr.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-AddressExpr.Tpo -c -o SynTree/driver_cfa_cpp-AddressExpr.obj `if test -f 'SynTree/AddressExpr.cc'; then $(CYGPATH_W) 'SynTree/AddressExpr.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/AddressExpr.cc'; fi`
    2322 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-AddressExpr.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-AddressExpr.Po
    2323 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/AddressExpr.cc' object='SynTree/driver_cfa_cpp-AddressExpr.obj' libtool=no @AMDEPBACKSLASH@
    2324 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2325 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-AddressExpr.obj `if test -f 'SynTree/AddressExpr.cc'; then $(CYGPATH_W) 'SynTree/AddressExpr.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/AddressExpr.cc'; fi`
    2326 
    2327 SynTree/driver_cfa_cpp-Statement.o: SynTree/Statement.cc
    2328 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Statement.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Statement.Tpo -c -o SynTree/driver_cfa_cpp-Statement.o `test -f 'SynTree/Statement.cc' || echo '$(srcdir)/'`SynTree/Statement.cc
    2329 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Statement.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Statement.Po
    2330 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Statement.cc' object='SynTree/driver_cfa_cpp-Statement.o' libtool=no @AMDEPBACKSLASH@
    2331 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2332 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Statement.o `test -f 'SynTree/Statement.cc' || echo '$(srcdir)/'`SynTree/Statement.cc
    2333 
    2334 SynTree/driver_cfa_cpp-Statement.obj: SynTree/Statement.cc
    2335 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Statement.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Statement.Tpo -c -o SynTree/driver_cfa_cpp-Statement.obj `if test -f 'SynTree/Statement.cc'; then $(CYGPATH_W) 'SynTree/Statement.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Statement.cc'; fi`
    2336 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Statement.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Statement.Po
    2337 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Statement.cc' object='SynTree/driver_cfa_cpp-Statement.obj' libtool=no @AMDEPBACKSLASH@
    2338 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2339 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Statement.obj `if test -f 'SynTree/Statement.cc'; then $(CYGPATH_W) 'SynTree/Statement.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Statement.cc'; fi`
    2340 
    2341 SynTree/driver_cfa_cpp-CompoundStmt.o: SynTree/CompoundStmt.cc
    2342 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-CompoundStmt.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-CompoundStmt.Tpo -c -o SynTree/driver_cfa_cpp-CompoundStmt.o `test -f 'SynTree/CompoundStmt.cc' || echo '$(srcdir)/'`SynTree/CompoundStmt.cc
    2343 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-CompoundStmt.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-CompoundStmt.Po
    2344 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/CompoundStmt.cc' object='SynTree/driver_cfa_cpp-CompoundStmt.o' libtool=no @AMDEPBACKSLASH@
    2345 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2346 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-CompoundStmt.o `test -f 'SynTree/CompoundStmt.cc' || echo '$(srcdir)/'`SynTree/CompoundStmt.cc
    2347 
    2348 SynTree/driver_cfa_cpp-CompoundStmt.obj: SynTree/CompoundStmt.cc
    2349 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-CompoundStmt.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-CompoundStmt.Tpo -c -o SynTree/driver_cfa_cpp-CompoundStmt.obj `if test -f 'SynTree/CompoundStmt.cc'; then $(CYGPATH_W) 'SynTree/CompoundStmt.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/CompoundStmt.cc'; fi`
    2350 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-CompoundStmt.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-CompoundStmt.Po
    2351 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/CompoundStmt.cc' object='SynTree/driver_cfa_cpp-CompoundStmt.obj' libtool=no @AMDEPBACKSLASH@
    2352 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2353 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-CompoundStmt.obj `if test -f 'SynTree/CompoundStmt.cc'; then $(CYGPATH_W) 'SynTree/CompoundStmt.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/CompoundStmt.cc'; fi`
    2354 
    2355 SynTree/driver_cfa_cpp-DeclStmt.o: SynTree/DeclStmt.cc
    2356 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-DeclStmt.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-DeclStmt.Tpo -c -o SynTree/driver_cfa_cpp-DeclStmt.o `test -f 'SynTree/DeclStmt.cc' || echo '$(srcdir)/'`SynTree/DeclStmt.cc
    2357 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-DeclStmt.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-DeclStmt.Po
    2358 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/DeclStmt.cc' object='SynTree/driver_cfa_cpp-DeclStmt.o' libtool=no @AMDEPBACKSLASH@
    2359 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2360 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-DeclStmt.o `test -f 'SynTree/DeclStmt.cc' || echo '$(srcdir)/'`SynTree/DeclStmt.cc
    2361 
    2362 SynTree/driver_cfa_cpp-DeclStmt.obj: SynTree/DeclStmt.cc
    2363 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-DeclStmt.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-DeclStmt.Tpo -c -o SynTree/driver_cfa_cpp-DeclStmt.obj `if test -f 'SynTree/DeclStmt.cc'; then $(CYGPATH_W) 'SynTree/DeclStmt.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/DeclStmt.cc'; fi`
    2364 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-DeclStmt.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-DeclStmt.Po
    2365 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/DeclStmt.cc' object='SynTree/driver_cfa_cpp-DeclStmt.obj' libtool=no @AMDEPBACKSLASH@
    2366 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2367 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-DeclStmt.obj `if test -f 'SynTree/DeclStmt.cc'; then $(CYGPATH_W) 'SynTree/DeclStmt.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/DeclStmt.cc'; fi`
    2368 
    2369 SynTree/driver_cfa_cpp-Declaration.o: SynTree/Declaration.cc
    2370 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Declaration.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Declaration.Tpo -c -o SynTree/driver_cfa_cpp-Declaration.o `test -f 'SynTree/Declaration.cc' || echo '$(srcdir)/'`SynTree/Declaration.cc
    2371 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Declaration.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Declaration.Po
    2372 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Declaration.cc' object='SynTree/driver_cfa_cpp-Declaration.o' libtool=no @AMDEPBACKSLASH@
    2373 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2374 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Declaration.o `test -f 'SynTree/Declaration.cc' || echo '$(srcdir)/'`SynTree/Declaration.cc
    2375 
    2376 SynTree/driver_cfa_cpp-Declaration.obj: SynTree/Declaration.cc
    2377 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Declaration.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Declaration.Tpo -c -o SynTree/driver_cfa_cpp-Declaration.obj `if test -f 'SynTree/Declaration.cc'; then $(CYGPATH_W) 'SynTree/Declaration.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Declaration.cc'; fi`
    2378 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Declaration.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Declaration.Po
    2379 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Declaration.cc' object='SynTree/driver_cfa_cpp-Declaration.obj' libtool=no @AMDEPBACKSLASH@
    2380 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2381 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Declaration.obj `if test -f 'SynTree/Declaration.cc'; then $(CYGPATH_W) 'SynTree/Declaration.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Declaration.cc'; fi`
    2382 
    2383 SynTree/driver_cfa_cpp-DeclarationWithType.o: SynTree/DeclarationWithType.cc
    2384 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-DeclarationWithType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-DeclarationWithType.Tpo -c -o SynTree/driver_cfa_cpp-DeclarationWithType.o `test -f 'SynTree/DeclarationWithType.cc' || echo '$(srcdir)/'`SynTree/DeclarationWithType.cc
    2385 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-DeclarationWithType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-DeclarationWithType.Po
    2386 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/DeclarationWithType.cc' object='SynTree/driver_cfa_cpp-DeclarationWithType.o' libtool=no @AMDEPBACKSLASH@
    2387 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2388 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-DeclarationWithType.o `test -f 'SynTree/DeclarationWithType.cc' || echo '$(srcdir)/'`SynTree/DeclarationWithType.cc
    2389 
    2390 SynTree/driver_cfa_cpp-DeclarationWithType.obj: SynTree/DeclarationWithType.cc
    2391 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-DeclarationWithType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-DeclarationWithType.Tpo -c -o SynTree/driver_cfa_cpp-DeclarationWithType.obj `if test -f 'SynTree/DeclarationWithType.cc'; then $(CYGPATH_W) 'SynTree/DeclarationWithType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/DeclarationWithType.cc'; fi`
    2392 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-DeclarationWithType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-DeclarationWithType.Po
    2393 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/DeclarationWithType.cc' object='SynTree/driver_cfa_cpp-DeclarationWithType.obj' libtool=no @AMDEPBACKSLASH@
    2394 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2395 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-DeclarationWithType.obj `if test -f 'SynTree/DeclarationWithType.cc'; then $(CYGPATH_W) 'SynTree/DeclarationWithType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/DeclarationWithType.cc'; fi`
    2396 
    2397 SynTree/driver_cfa_cpp-ObjectDecl.o: SynTree/ObjectDecl.cc
    2398 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ObjectDecl.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ObjectDecl.Tpo -c -o SynTree/driver_cfa_cpp-ObjectDecl.o `test -f 'SynTree/ObjectDecl.cc' || echo '$(srcdir)/'`SynTree/ObjectDecl.cc
    2399 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ObjectDecl.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ObjectDecl.Po
    2400 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ObjectDecl.cc' object='SynTree/driver_cfa_cpp-ObjectDecl.o' libtool=no @AMDEPBACKSLASH@
    2401 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2402 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ObjectDecl.o `test -f 'SynTree/ObjectDecl.cc' || echo '$(srcdir)/'`SynTree/ObjectDecl.cc
    2403 
    2404 SynTree/driver_cfa_cpp-ObjectDecl.obj: SynTree/ObjectDecl.cc
    2405 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ObjectDecl.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ObjectDecl.Tpo -c -o SynTree/driver_cfa_cpp-ObjectDecl.obj `if test -f 'SynTree/ObjectDecl.cc'; then $(CYGPATH_W) 'SynTree/ObjectDecl.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ObjectDecl.cc'; fi`
    2406 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ObjectDecl.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ObjectDecl.Po
    2407 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/ObjectDecl.cc' object='SynTree/driver_cfa_cpp-ObjectDecl.obj' libtool=no @AMDEPBACKSLASH@
    2408 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2409 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ObjectDecl.obj `if test -f 'SynTree/ObjectDecl.cc'; then $(CYGPATH_W) 'SynTree/ObjectDecl.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ObjectDecl.cc'; fi`
    2410 
    2411 SynTree/driver_cfa_cpp-FunctionDecl.o: SynTree/FunctionDecl.cc
    2412 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-FunctionDecl.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionDecl.Tpo -c -o SynTree/driver_cfa_cpp-FunctionDecl.o `test -f 'SynTree/FunctionDecl.cc' || echo '$(srcdir)/'`SynTree/FunctionDecl.cc
    2413 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionDecl.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionDecl.Po
    2414 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/FunctionDecl.cc' object='SynTree/driver_cfa_cpp-FunctionDecl.o' libtool=no @AMDEPBACKSLASH@
    2415 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2416 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-FunctionDecl.o `test -f 'SynTree/FunctionDecl.cc' || echo '$(srcdir)/'`SynTree/FunctionDecl.cc
    2417 
    2418 SynTree/driver_cfa_cpp-FunctionDecl.obj: SynTree/FunctionDecl.cc
    2419 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-FunctionDecl.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionDecl.Tpo -c -o SynTree/driver_cfa_cpp-FunctionDecl.obj `if test -f 'SynTree/FunctionDecl.cc'; then $(CYGPATH_W) 'SynTree/FunctionDecl.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/FunctionDecl.cc'; fi`
    2420 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionDecl.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-FunctionDecl.Po
    2421 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/FunctionDecl.cc' object='SynTree/driver_cfa_cpp-FunctionDecl.obj' libtool=no @AMDEPBACKSLASH@
    2422 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2423 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-FunctionDecl.obj `if test -f 'SynTree/FunctionDecl.cc'; then $(CYGPATH_W) 'SynTree/FunctionDecl.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/FunctionDecl.cc'; fi`
    2424 
    2425 SynTree/driver_cfa_cpp-AggregateDecl.o: SynTree/AggregateDecl.cc
    2426 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-AggregateDecl.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-AggregateDecl.Tpo -c -o SynTree/driver_cfa_cpp-AggregateDecl.o `test -f 'SynTree/AggregateDecl.cc' || echo '$(srcdir)/'`SynTree/AggregateDecl.cc
    2427 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-AggregateDecl.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-AggregateDecl.Po
    2428 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/AggregateDecl.cc' object='SynTree/driver_cfa_cpp-AggregateDecl.o' libtool=no @AMDEPBACKSLASH@
    2429 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2430 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-AggregateDecl.o `test -f 'SynTree/AggregateDecl.cc' || echo '$(srcdir)/'`SynTree/AggregateDecl.cc
    2431 
    2432 SynTree/driver_cfa_cpp-AggregateDecl.obj: SynTree/AggregateDecl.cc
    2433 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-AggregateDecl.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-AggregateDecl.Tpo -c -o SynTree/driver_cfa_cpp-AggregateDecl.obj `if test -f 'SynTree/AggregateDecl.cc'; then $(CYGPATH_W) 'SynTree/AggregateDecl.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/AggregateDecl.cc'; fi`
    2434 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-AggregateDecl.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-AggregateDecl.Po
    2435 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/AggregateDecl.cc' object='SynTree/driver_cfa_cpp-AggregateDecl.obj' libtool=no @AMDEPBACKSLASH@
    2436 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2437 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-AggregateDecl.obj `if test -f 'SynTree/AggregateDecl.cc'; then $(CYGPATH_W) 'SynTree/AggregateDecl.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/AggregateDecl.cc'; fi`
    2438 
    2439 SynTree/driver_cfa_cpp-NamedTypeDecl.o: SynTree/NamedTypeDecl.cc
    2440 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-NamedTypeDecl.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-NamedTypeDecl.Tpo -c -o SynTree/driver_cfa_cpp-NamedTypeDecl.o `test -f 'SynTree/NamedTypeDecl.cc' || echo '$(srcdir)/'`SynTree/NamedTypeDecl.cc
    2441 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-NamedTypeDecl.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-NamedTypeDecl.Po
    2442 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/NamedTypeDecl.cc' object='SynTree/driver_cfa_cpp-NamedTypeDecl.o' libtool=no @AMDEPBACKSLASH@
    2443 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2444 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-NamedTypeDecl.o `test -f 'SynTree/NamedTypeDecl.cc' || echo '$(srcdir)/'`SynTree/NamedTypeDecl.cc
    2445 
    2446 SynTree/driver_cfa_cpp-NamedTypeDecl.obj: SynTree/NamedTypeDecl.cc
    2447 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-NamedTypeDecl.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-NamedTypeDecl.Tpo -c -o SynTree/driver_cfa_cpp-NamedTypeDecl.obj `if test -f 'SynTree/NamedTypeDecl.cc'; then $(CYGPATH_W) 'SynTree/NamedTypeDecl.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/NamedTypeDecl.cc'; fi`
    2448 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-NamedTypeDecl.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-NamedTypeDecl.Po
    2449 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/NamedTypeDecl.cc' object='SynTree/driver_cfa_cpp-NamedTypeDecl.obj' libtool=no @AMDEPBACKSLASH@
    2450 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2451 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-NamedTypeDecl.obj `if test -f 'SynTree/NamedTypeDecl.cc'; then $(CYGPATH_W) 'SynTree/NamedTypeDecl.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/NamedTypeDecl.cc'; fi`
    2452 
    2453 SynTree/driver_cfa_cpp-TypeDecl.o: SynTree/TypeDecl.cc
    2454 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-TypeDecl.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-TypeDecl.Tpo -c -o SynTree/driver_cfa_cpp-TypeDecl.o `test -f 'SynTree/TypeDecl.cc' || echo '$(srcdir)/'`SynTree/TypeDecl.cc
    2455 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-TypeDecl.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-TypeDecl.Po
    2456 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/TypeDecl.cc' object='SynTree/driver_cfa_cpp-TypeDecl.o' libtool=no @AMDEPBACKSLASH@
    2457 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2458 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-TypeDecl.o `test -f 'SynTree/TypeDecl.cc' || echo '$(srcdir)/'`SynTree/TypeDecl.cc
    2459 
    2460 SynTree/driver_cfa_cpp-TypeDecl.obj: SynTree/TypeDecl.cc
    2461 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-TypeDecl.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-TypeDecl.Tpo -c -o SynTree/driver_cfa_cpp-TypeDecl.obj `if test -f 'SynTree/TypeDecl.cc'; then $(CYGPATH_W) 'SynTree/TypeDecl.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/TypeDecl.cc'; fi`
    2462 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-TypeDecl.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-TypeDecl.Po
    2463 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/TypeDecl.cc' object='SynTree/driver_cfa_cpp-TypeDecl.obj' libtool=no @AMDEPBACKSLASH@
    2464 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2465 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-TypeDecl.obj `if test -f 'SynTree/TypeDecl.cc'; then $(CYGPATH_W) 'SynTree/TypeDecl.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/TypeDecl.cc'; fi`
    2466 
    2467 SynTree/driver_cfa_cpp-Initializer.o: SynTree/Initializer.cc
    2468 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Initializer.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Initializer.Tpo -c -o SynTree/driver_cfa_cpp-Initializer.o `test -f 'SynTree/Initializer.cc' || echo '$(srcdir)/'`SynTree/Initializer.cc
    2469 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Initializer.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Initializer.Po
    2470 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Initializer.cc' object='SynTree/driver_cfa_cpp-Initializer.o' libtool=no @AMDEPBACKSLASH@
    2471 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2472 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Initializer.o `test -f 'SynTree/Initializer.cc' || echo '$(srcdir)/'`SynTree/Initializer.cc
    2473 
    2474 SynTree/driver_cfa_cpp-Initializer.obj: SynTree/Initializer.cc
    2475 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Initializer.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Initializer.Tpo -c -o SynTree/driver_cfa_cpp-Initializer.obj `if test -f 'SynTree/Initializer.cc'; then $(CYGPATH_W) 'SynTree/Initializer.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Initializer.cc'; fi`
    2476 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Initializer.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Initializer.Po
    2477 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Initializer.cc' object='SynTree/driver_cfa_cpp-Initializer.obj' libtool=no @AMDEPBACKSLASH@
    2478 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2479 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Initializer.obj `if test -f 'SynTree/Initializer.cc'; then $(CYGPATH_W) 'SynTree/Initializer.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Initializer.cc'; fi`
    2480 
    2481 SynTree/driver_cfa_cpp-Visitor.o: SynTree/Visitor.cc
    2482 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Visitor.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Tpo -c -o SynTree/driver_cfa_cpp-Visitor.o `test -f 'SynTree/Visitor.cc' || echo '$(srcdir)/'`SynTree/Visitor.cc
    2483 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Po
    2484 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Visitor.cc' object='SynTree/driver_cfa_cpp-Visitor.o' libtool=no @AMDEPBACKSLASH@
    2485 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2486 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Visitor.o `test -f 'SynTree/Visitor.cc' || echo '$(srcdir)/'`SynTree/Visitor.cc
    2487 
    2488 SynTree/driver_cfa_cpp-Visitor.obj: SynTree/Visitor.cc
    2489 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Visitor.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Tpo -c -o SynTree/driver_cfa_cpp-Visitor.obj `if test -f 'SynTree/Visitor.cc'; then $(CYGPATH_W) 'SynTree/Visitor.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Visitor.cc'; fi`
    2490 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Po
    2491 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Visitor.cc' object='SynTree/driver_cfa_cpp-Visitor.obj' libtool=no @AMDEPBACKSLASH@
    2492 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2493 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Visitor.obj `if test -f 'SynTree/Visitor.cc'; then $(CYGPATH_W) 'SynTree/Visitor.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Visitor.cc'; fi`
    2494 
    2495 SynTree/driver_cfa_cpp-Mutator.o: SynTree/Mutator.cc
    2496 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Mutator.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Mutator.Tpo -c -o SynTree/driver_cfa_cpp-Mutator.o `test -f 'SynTree/Mutator.cc' || echo '$(srcdir)/'`SynTree/Mutator.cc
    2497 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Mutator.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Mutator.Po
    2498 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Mutator.cc' object='SynTree/driver_cfa_cpp-Mutator.o' libtool=no @AMDEPBACKSLASH@
    2499 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2500 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Mutator.o `test -f 'SynTree/Mutator.cc' || echo '$(srcdir)/'`SynTree/Mutator.cc
    2501 
    2502 SynTree/driver_cfa_cpp-Mutator.obj: SynTree/Mutator.cc
    2503 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Mutator.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Mutator.Tpo -c -o SynTree/driver_cfa_cpp-Mutator.obj `if test -f 'SynTree/Mutator.cc'; then $(CYGPATH_W) 'SynTree/Mutator.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Mutator.cc'; fi`
    2504 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Mutator.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Mutator.Po
    2505 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Mutator.cc' object='SynTree/driver_cfa_cpp-Mutator.obj' libtool=no @AMDEPBACKSLASH@
    2506 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2507 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Mutator.obj `if test -f 'SynTree/Mutator.cc'; then $(CYGPATH_W) 'SynTree/Mutator.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Mutator.cc'; fi`
    2508 
    2509 SynTree/driver_cfa_cpp-TypeSubstitution.o: SynTree/TypeSubstitution.cc
    2510 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-TypeSubstitution.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-TypeSubstitution.Tpo -c -o SynTree/driver_cfa_cpp-TypeSubstitution.o `test -f 'SynTree/TypeSubstitution.cc' || echo '$(srcdir)/'`SynTree/TypeSubstitution.cc
    2511 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-TypeSubstitution.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-TypeSubstitution.Po
    2512 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/TypeSubstitution.cc' object='SynTree/driver_cfa_cpp-TypeSubstitution.o' libtool=no @AMDEPBACKSLASH@
    2513 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2514 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-TypeSubstitution.o `test -f 'SynTree/TypeSubstitution.cc' || echo '$(srcdir)/'`SynTree/TypeSubstitution.cc
    2515 
    2516 SynTree/driver_cfa_cpp-TypeSubstitution.obj: SynTree/TypeSubstitution.cc
    2517 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-TypeSubstitution.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-TypeSubstitution.Tpo -c -o SynTree/driver_cfa_cpp-TypeSubstitution.obj `if test -f 'SynTree/TypeSubstitution.cc'; then $(CYGPATH_W) 'SynTree/TypeSubstitution.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/TypeSubstitution.cc'; fi`
    2518 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-TypeSubstitution.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-TypeSubstitution.Po
    2519 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/TypeSubstitution.cc' object='SynTree/driver_cfa_cpp-TypeSubstitution.obj' libtool=no @AMDEPBACKSLASH@
    2520 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2521 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-TypeSubstitution.obj `if test -f 'SynTree/TypeSubstitution.cc'; then $(CYGPATH_W) 'SynTree/TypeSubstitution.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/TypeSubstitution.cc'; fi`
    2522 
    2523 SynTree/driver_cfa_cpp-Attribute.o: SynTree/Attribute.cc
    2524 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Attribute.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Attribute.Tpo -c -o SynTree/driver_cfa_cpp-Attribute.o `test -f 'SynTree/Attribute.cc' || echo '$(srcdir)/'`SynTree/Attribute.cc
    2525 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Attribute.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Attribute.Po
    2526 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Attribute.cc' object='SynTree/driver_cfa_cpp-Attribute.o' libtool=no @AMDEPBACKSLASH@
    2527 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2528 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Attribute.o `test -f 'SynTree/Attribute.cc' || echo '$(srcdir)/'`SynTree/Attribute.cc
    2529 
    2530 SynTree/driver_cfa_cpp-Attribute.obj: SynTree/Attribute.cc
    2531 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-Attribute.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-Attribute.Tpo -c -o SynTree/driver_cfa_cpp-Attribute.obj `if test -f 'SynTree/Attribute.cc'; then $(CYGPATH_W) 'SynTree/Attribute.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Attribute.cc'; fi`
    2532 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-Attribute.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-Attribute.Po
    2533 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/Attribute.cc' object='SynTree/driver_cfa_cpp-Attribute.obj' libtool=no @AMDEPBACKSLASH@
    2534 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2535 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-Attribute.obj `if test -f 'SynTree/Attribute.cc'; then $(CYGPATH_W) 'SynTree/Attribute.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/Attribute.cc'; fi`
    2536 
    2537 SynTree/driver_cfa_cpp-VarExprReplacer.o: SynTree/VarExprReplacer.cc
    2538 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-VarExprReplacer.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Tpo -c -o SynTree/driver_cfa_cpp-VarExprReplacer.o `test -f 'SynTree/VarExprReplacer.cc' || echo '$(srcdir)/'`SynTree/VarExprReplacer.cc
    2539 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Po
    2540 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/VarExprReplacer.cc' object='SynTree/driver_cfa_cpp-VarExprReplacer.o' libtool=no @AMDEPBACKSLASH@
    2541 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2542 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-VarExprReplacer.o `test -f 'SynTree/VarExprReplacer.cc' || echo '$(srcdir)/'`SynTree/VarExprReplacer.cc
    2543 
    2544 SynTree/driver_cfa_cpp-VarExprReplacer.obj: SynTree/VarExprReplacer.cc
    2545 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-VarExprReplacer.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Tpo -c -o SynTree/driver_cfa_cpp-VarExprReplacer.obj `if test -f 'SynTree/VarExprReplacer.cc'; then $(CYGPATH_W) 'SynTree/VarExprReplacer.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/VarExprReplacer.cc'; fi`
    2546 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-VarExprReplacer.Po
    2547 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SynTree/VarExprReplacer.cc' object='SynTree/driver_cfa_cpp-VarExprReplacer.obj' libtool=no @AMDEPBACKSLASH@
    2548 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2549 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-VarExprReplacer.obj `if test -f 'SynTree/VarExprReplacer.cc'; then $(CYGPATH_W) 'SynTree/VarExprReplacer.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/VarExprReplacer.cc'; fi`
    2550 
    2551 Tuples/driver_cfa_cpp-TupleAssignment.o: Tuples/TupleAssignment.cc
    2552 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-TupleAssignment.o -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Tpo -c -o Tuples/driver_cfa_cpp-TupleAssignment.o `test -f 'Tuples/TupleAssignment.cc' || echo '$(srcdir)/'`Tuples/TupleAssignment.cc
    2553 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Po
    2554 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/TupleAssignment.cc' object='Tuples/driver_cfa_cpp-TupleAssignment.o' libtool=no @AMDEPBACKSLASH@
    2555 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2556 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-TupleAssignment.o `test -f 'Tuples/TupleAssignment.cc' || echo '$(srcdir)/'`Tuples/TupleAssignment.cc
    2557 
    2558 Tuples/driver_cfa_cpp-TupleAssignment.obj: Tuples/TupleAssignment.cc
    2559 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-TupleAssignment.obj -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Tpo -c -o Tuples/driver_cfa_cpp-TupleAssignment.obj `if test -f 'Tuples/TupleAssignment.cc'; then $(CYGPATH_W) 'Tuples/TupleAssignment.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleAssignment.cc'; fi`
    2560 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Po
    2561 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/TupleAssignment.cc' object='Tuples/driver_cfa_cpp-TupleAssignment.obj' libtool=no @AMDEPBACKSLASH@
    2562 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2563 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-TupleAssignment.obj `if test -f 'Tuples/TupleAssignment.cc'; then $(CYGPATH_W) 'Tuples/TupleAssignment.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleAssignment.cc'; fi`
    2564 
    2565 Tuples/driver_cfa_cpp-TupleExpansion.o: Tuples/TupleExpansion.cc
    2566 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-TupleExpansion.o -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo -c -o Tuples/driver_cfa_cpp-TupleExpansion.o `test -f 'Tuples/TupleExpansion.cc' || echo '$(srcdir)/'`Tuples/TupleExpansion.cc
    2567 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po
    2568 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/TupleExpansion.cc' object='Tuples/driver_cfa_cpp-TupleExpansion.o' libtool=no @AMDEPBACKSLASH@
    2569 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2570 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-TupleExpansion.o `test -f 'Tuples/TupleExpansion.cc' || echo '$(srcdir)/'`Tuples/TupleExpansion.cc
    2571 
    2572 Tuples/driver_cfa_cpp-TupleExpansion.obj: Tuples/TupleExpansion.cc
    2573 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-TupleExpansion.obj -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo -c -o Tuples/driver_cfa_cpp-TupleExpansion.obj `if test -f 'Tuples/TupleExpansion.cc'; then $(CYGPATH_W) 'Tuples/TupleExpansion.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleExpansion.cc'; fi`
    2574 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po
    2575 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/TupleExpansion.cc' object='Tuples/driver_cfa_cpp-TupleExpansion.obj' libtool=no @AMDEPBACKSLASH@
    2576 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2577 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-TupleExpansion.obj `if test -f 'Tuples/TupleExpansion.cc'; then $(CYGPATH_W) 'Tuples/TupleExpansion.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleExpansion.cc'; fi`
    2578 
    2579 Tuples/driver_cfa_cpp-Explode.o: Tuples/Explode.cc
    2580 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-Explode.o -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-Explode.Tpo -c -o Tuples/driver_cfa_cpp-Explode.o `test -f 'Tuples/Explode.cc' || echo '$(srcdir)/'`Tuples/Explode.cc
    2581 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-Explode.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-Explode.Po
    2582 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/Explode.cc' object='Tuples/driver_cfa_cpp-Explode.o' libtool=no @AMDEPBACKSLASH@
    2583 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2584 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-Explode.o `test -f 'Tuples/Explode.cc' || echo '$(srcdir)/'`Tuples/Explode.cc
    2585 
    2586 Tuples/driver_cfa_cpp-Explode.obj: Tuples/Explode.cc
    2587 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-Explode.obj -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-Explode.Tpo -c -o Tuples/driver_cfa_cpp-Explode.obj `if test -f 'Tuples/Explode.cc'; then $(CYGPATH_W) 'Tuples/Explode.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/Explode.cc'; fi`
    2588 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-Explode.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-Explode.Po
    2589 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/Explode.cc' object='Tuples/driver_cfa_cpp-Explode.obj' libtool=no @AMDEPBACKSLASH@
    2590 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2591 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-Explode.obj `if test -f 'Tuples/Explode.cc'; then $(CYGPATH_W) 'Tuples/Explode.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/Explode.cc'; fi`
    2592 
    2593 Virtual/driver_cfa_cpp-ExpandCasts.o: Virtual/ExpandCasts.cc
    2594 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Virtual/driver_cfa_cpp-ExpandCasts.o -MD -MP -MF Virtual/$(DEPDIR)/driver_cfa_cpp-ExpandCasts.Tpo -c -o Virtual/driver_cfa_cpp-ExpandCasts.o `test -f 'Virtual/ExpandCasts.cc' || echo '$(srcdir)/'`Virtual/ExpandCasts.cc
    2595 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Virtual/$(DEPDIR)/driver_cfa_cpp-ExpandCasts.Tpo Virtual/$(DEPDIR)/driver_cfa_cpp-ExpandCasts.Po
    2596 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Virtual/ExpandCasts.cc' object='Virtual/driver_cfa_cpp-ExpandCasts.o' libtool=no @AMDEPBACKSLASH@
    2597 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2598 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Virtual/driver_cfa_cpp-ExpandCasts.o `test -f 'Virtual/ExpandCasts.cc' || echo '$(srcdir)/'`Virtual/ExpandCasts.cc
    2599 
    2600 Virtual/driver_cfa_cpp-ExpandCasts.obj: Virtual/ExpandCasts.cc
    2601 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Virtual/driver_cfa_cpp-ExpandCasts.obj -MD -MP -MF Virtual/$(DEPDIR)/driver_cfa_cpp-ExpandCasts.Tpo -c -o Virtual/driver_cfa_cpp-ExpandCasts.obj `if test -f 'Virtual/ExpandCasts.cc'; then $(CYGPATH_W) 'Virtual/ExpandCasts.cc'; else $(CYGPATH_W) '$(srcdir)/Virtual/ExpandCasts.cc'; fi`
    2602 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Virtual/$(DEPDIR)/driver_cfa_cpp-ExpandCasts.Tpo Virtual/$(DEPDIR)/driver_cfa_cpp-ExpandCasts.Po
    2603 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Virtual/ExpandCasts.cc' object='Virtual/driver_cfa_cpp-ExpandCasts.obj' libtool=no @AMDEPBACKSLASH@
    2604 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2605 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Virtual/driver_cfa_cpp-ExpandCasts.obj `if test -f 'Virtual/ExpandCasts.cc'; then $(CYGPATH_W) 'Virtual/ExpandCasts.cc'; else $(CYGPATH_W) '$(srcdir)/Virtual/ExpandCasts.cc'; fi`
    26061222
    26071223.ll.cc:
     
    26961312check: $(BUILT_SOURCES)
    26971313        $(MAKE) $(AM_MAKEFLAGS) check-am
    2698 all-am: Makefile $(PROGRAMS)
     1314all-am: Makefile $(LIBRARIES) $(PROGRAMS)
    26991315installdirs:
    27001316        for dir in "$(DESTDIR)$(cfa_cpplibdir)"; do \
     
    27221338        fi
    27231339mostlyclean-generic:
     1340        -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
    27241341
    27251342clean-generic:
     
    27281345        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
    27291346        -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
     1347        -rm -f ../driver/$(am__dirstamp)
    27301348        -rm -f CodeGen/$(DEPDIR)/$(am__dirstamp)
    27311349        -rm -f CodeGen/$(am__dirstamp)
     
    27521370        -rm -f Tuples/$(DEPDIR)/$(am__dirstamp)
    27531371        -rm -f Tuples/$(am__dirstamp)
     1372        -rm -f Validate/$(DEPDIR)/$(am__dirstamp)
     1373        -rm -f Validate/$(am__dirstamp)
    27541374        -rm -f Virtual/$(DEPDIR)/$(am__dirstamp)
    27551375        -rm -f Virtual/$(am__dirstamp)
    2756         -rm -f driver/$(am__dirstamp)
    27571376
    27581377maintainer-clean-generic:
     
    27661385clean: clean-am
    27671386
    2768 clean-am: clean-cfa_cpplibPROGRAMS clean-generic mostlyclean-am
     1387clean-am: clean-cfa_cpplibPROGRAMS clean-generic clean-noinstLIBRARIES \
     1388        mostlyclean-am
    27691389
    27701390distclean: distclean-am
    2771         -rm -rf ./$(DEPDIR) CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Virtual/$(DEPDIR)
     1391        -rm -rf ./$(DEPDIR) CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Validate/$(DEPDIR) Virtual/$(DEPDIR)
    27721392        -rm -f Makefile
    27731393distclean-am: clean-am distclean-compile distclean-generic \
     
    28151435
    28161436maintainer-clean: maintainer-clean-am
    2817         -rm -rf ./$(DEPDIR) CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Virtual/$(DEPDIR)
     1437        -rm -rf ./$(DEPDIR) CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Validate/$(DEPDIR) Virtual/$(DEPDIR)
    28181438        -rm -f Makefile
    28191439maintainer-clean-am: distclean-am maintainer-clean-generic
     
    28361456
    28371457.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
    2838         clean-cfa_cpplibPROGRAMS clean-generic cscopelist-am ctags \
    2839         ctags-am distclean distclean-compile distclean-generic \
    2840         distclean-tags distdir dvi dvi-am html html-am info info-am \
    2841         install install-am install-cfa_cpplibPROGRAMS install-data \
    2842         install-data-am install-dvi install-dvi-am install-exec \
    2843         install-exec-am install-html install-html-am install-info \
    2844         install-info-am install-man install-pdf install-pdf-am \
    2845         install-ps install-ps-am install-strip installcheck \
    2846         installcheck-am installdirs maintainer-clean \
    2847         maintainer-clean-generic mostlyclean mostlyclean-compile \
    2848         mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
    2849         uninstall-am uninstall-cfa_cpplibPROGRAMS
     1458        clean-cfa_cpplibPROGRAMS clean-generic clean-noinstLIBRARIES \
     1459        cscopelist-am ctags ctags-am distclean distclean-compile \
     1460        distclean-generic distclean-tags distdir dvi dvi-am html \
     1461        html-am info info-am install install-am \
     1462        install-cfa_cpplibPROGRAMS install-data install-data-am \
     1463        install-dvi install-dvi-am install-exec install-exec-am \
     1464        install-html install-html-am install-info install-info-am \
     1465        install-man install-pdf install-pdf-am install-ps \
     1466        install-ps-am install-strip installcheck installcheck-am \
     1467        installdirs maintainer-clean maintainer-clean-generic \
     1468        mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
     1469        ps ps-am tags tags-am uninstall uninstall-am \
     1470        uninstall-cfa_cpplibPROGRAMS
    28501471
    28511472.PRECIOUS: Makefile
  • src/Parser/DeclarationNode.cc

    rf9feab8 r90152a4  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Nov 20 09:21:52 2017
    13 // Update Count     : 1031
     12// Last Modified On : Fri Jul 20 14:56:54 2018
     13// Update Count     : 1107
    1414//
    1515
     
    3232#include "SynTree/Type.h"          // for Type, Type::StorageClasses, Type::...
    3333#include "TypeData.h"              // for TypeData, TypeData::Aggregate_t
    34 #include "TypedefTable.h"          // for TypedefTable, TypedefTable::kind_t...
     34#include "TypedefTable.h"          // for TypedefTable
    3535
    3636class Initializer;
     
    4747const char * DeclarationNode::aggregateNames[] = { "struct", "union", "trait", "coroutine", "monitor", "thread", "NoAggregateNames" };
    4848const char * DeclarationNode::typeClassNames[] = { "otype", "dtype", "ftype", "NoTypeClassNames" };
    49 const char * DeclarationNode::builtinTypeNames[] = { "__builtin_va_list", "NoBuiltinTypeNames" };
     49const char * DeclarationNode::builtinTypeNames[] = { "__builtin_va_list", "zero_t", "one_t", "NoBuiltinTypeNames" };
    5050
    5151UniqueName DeclarationNode::anonymous( "__anonymous" );
     
    5454
    5555DeclarationNode::DeclarationNode() :
    56                 type( nullptr ),
    57                 bitfieldWidth( nullptr ),
    58                 hasEllipsis( false ),
    59                 linkage( ::linkage ),
    60                 asmName( nullptr ),
    61                 initializer( nullptr ),
    62                 extension( false ),
    63                 asmStmt( nullptr ) {
     56        linkage( ::linkage ) {
    6457
    6558//      variable.name = nullptr;
     
    7164        attr.expr = nullptr;
    7265        attr.type = nullptr;
     66
     67        assert.condition = nullptr;
     68        assert.message = nullptr;
    7369}
    7470
     
    8884        // asmName, no delete, passed to next stage
    8985        delete initializer;
     86
     87        delete assert.condition;
     88        delete assert.message;
    9089}
    9190
     
    9594        newnode->name = name ? new string( *name ) : nullptr;
    9695
     96        newnode->builtin = NoBuiltinType;
    9797        newnode->type = maybeClone( type );
     98        newnode->inLine = inLine;
    9899        newnode->storageClasses = storageClasses;
    99100        newnode->funcSpecs = funcSpecs;
     
    117118        newnode->attr.expr = maybeClone( attr.expr );
    118119        newnode->attr.type = maybeClone( attr.type );
     120
     121        newnode->assert.condition = maybeClone( assert.condition );
     122        newnode->assert.message = maybeClone( assert.message );
    119123        return newnode;
    120124} // DeclarationNode::clone
    121125
    122 bool DeclarationNode::get_hasEllipsis() const {
    123         return hasEllipsis;
    124 }
    125 
    126 void DeclarationNode::print( std::ostream &os, int indent ) const {
     126void DeclarationNode::print( std::ostream & os, int indent ) const {
    127127        os << string( indent, ' ' );
    128128        if ( name ) {
     
    160160}
    161161
    162 void DeclarationNode::printList( std::ostream &os, int indent ) const {
     162void DeclarationNode::printList( std::ostream & os, int indent ) const {
    163163        ParseNode::printList( os, indent );
    164164        if ( hasEllipsis ) {
     
    167167}
    168168
    169 DeclarationNode * DeclarationNode::newFunction( string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body, bool newStyle ) {
     169DeclarationNode * DeclarationNode::newFunction( const string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body ) {
    170170        DeclarationNode * newnode = new DeclarationNode;
    171171        newnode->name = name;
    172172        newnode->type = new TypeData( TypeData::Function );
    173173        newnode->type->function.params = param;
    174         newnode->type->function.newStyle = newStyle;
    175174        newnode->type->function.body = body;
    176 
    177         // ignore unnamed routine declarations: void p( int (*)(int) );
    178         if ( newnode->name ) {
    179                 typedefTable.addToEnclosingScope( *newnode->name, TypedefTable::ID );
    180         } // if
    181175
    182176        if ( ret ) {
     
    244238} // DeclarationNode::newForall
    245239
    246 DeclarationNode * DeclarationNode::newFromTypedef( string * name ) {
     240DeclarationNode * DeclarationNode::newFromTypedef( const string * name ) {
    247241        DeclarationNode * newnode = new DeclarationNode;
    248242        newnode->type = new TypeData( TypeData::SymbolicInst );
     
    253247} // DeclarationNode::newFromTypedef
    254248
     249DeclarationNode * DeclarationNode::newFromGlobalScope() {
     250        DeclarationNode * newnode = new DeclarationNode;
     251        newnode->type = new TypeData( TypeData::GlobalScope );
     252        return newnode;
     253}
     254
     255DeclarationNode * DeclarationNode::newQualifiedType( DeclarationNode * parent, DeclarationNode * child) {
     256        DeclarationNode * newnode = new DeclarationNode;
     257        newnode->type = new TypeData( TypeData::Qualified );
     258        newnode->type->qualified.parent = parent->type;
     259        newnode->type->qualified.child = child->type;
     260        parent->type = nullptr;
     261        child->type = nullptr;
     262        delete parent;
     263        delete child;
     264        return newnode;
     265}
     266
    255267DeclarationNode * DeclarationNode::newAggregate( Aggregate kind, const string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body ) {
    256         assert( name );
    257268        DeclarationNode * newnode = new DeclarationNode;
    258269        newnode->type = new TypeData( TypeData::Aggregate );
    259270        newnode->type->aggregate.kind = kind;
    260         newnode->type->aggregate.name = name;
     271        newnode->type->aggregate.name =  name == nullptr ? new string( DeclarationNode::anonymous.newName() ) : name;
    261272        newnode->type->aggregate.actuals = actuals;
    262273        newnode->type->aggregate.fields = fields;
     
    264275        newnode->type->aggregate.tagged = false;
    265276        newnode->type->aggregate.parent = nullptr;
     277        newnode->type->aggregate.anon = name == nullptr;
    266278        return newnode;
    267279} // DeclarationNode::newAggregate
    268280
    269 DeclarationNode * DeclarationNode::newEnum( string * name, DeclarationNode * constants, bool body ) {
    270         assert( name );
     281DeclarationNode * DeclarationNode::newEnum( const string * name, DeclarationNode * constants, bool body ) {
    271282        DeclarationNode * newnode = new DeclarationNode;
    272283        newnode->type = new TypeData( TypeData::Enum );
    273         newnode->type->enumeration.name = name;
     284        newnode->type->enumeration.name = name == nullptr ? new string( DeclarationNode::anonymous.newName() ) : name;
    274285        newnode->type->enumeration.constants = constants;
    275286        newnode->type->enumeration.body = body;
     287        newnode->type->enumeration.anon = name == nullptr;
    276288        return newnode;
    277289} // DeclarationNode::newEnum
    278290
    279 DeclarationNode * DeclarationNode::newEnumConstant( string * name, ExpressionNode * constant ) {
     291DeclarationNode * DeclarationNode::newEnumConstant( const string * name, ExpressionNode * constant ) {
    280292        DeclarationNode * newnode = new DeclarationNode;
    281293        newnode->name = name;
    282294        newnode->enumeratorValue.reset( constant );
    283         typedefTable.addToEnclosingScope( *newnode->name, TypedefTable::ID );
    284295        return newnode;
    285296} // DeclarationNode::newEnumConstant
    286297
    287 DeclarationNode * DeclarationNode::newName( string * name ) {
     298DeclarationNode * DeclarationNode::newName( const string * name ) {
    288299        DeclarationNode * newnode = new DeclarationNode;
    289300        newnode->name = name;
     
    291302} // DeclarationNode::newName
    292303
    293 DeclarationNode * DeclarationNode::newFromTypeGen( string * name, ExpressionNode * params ) {
     304DeclarationNode * DeclarationNode::newFromTypeGen( const string * name, ExpressionNode * params ) {
    294305        DeclarationNode * newnode = new DeclarationNode;
    295306        newnode->type = new TypeData( TypeData::SymbolicInst );
     
    300311} // DeclarationNode::newFromTypeGen
    301312
    302 DeclarationNode * DeclarationNode::newTypeParam( TypeClass tc, string * name ) {
     313DeclarationNode * DeclarationNode::newTypeParam( TypeClass tc, const string * name ) {
    303314        DeclarationNode * newnode = new DeclarationNode;
    304315        newnode->type = nullptr;
     
    331342} // DeclarationNode::newTraitUse
    332343
    333 DeclarationNode * DeclarationNode::newTypeDecl( string * name, DeclarationNode * typeParams ) {
     344DeclarationNode * DeclarationNode::newTypeDecl( const string * name, DeclarationNode * typeParams ) {
    334345        DeclarationNode * newnode = new DeclarationNode;
    335346        newnode->name = name;
     
    343354        DeclarationNode * newnode = new DeclarationNode;
    344355        newnode->type = new TypeData( kind == OperKinds::PointTo ? TypeData::Pointer : TypeData::Reference );
     356        if ( kind == OperKinds::And ) {
     357                // T && is parsed as 'And' operator rather than two references => add a second reference type
     358                TypeData * td = new TypeData( TypeData::Reference );
     359                td->base = newnode->type;
     360                newnode->type = td;
     361        }
    345362        if ( qualifiers ) {
    346363                return newnode->addQualifiers( qualifiers );
     
    400417} // DeclarationNode::newBuiltinType
    401418
    402 DeclarationNode * DeclarationNode::newAttr( string * name, ExpressionNode * expr ) {
     419DeclarationNode * DeclarationNode::newAttr( const string * name, ExpressionNode * expr ) {
    403420        DeclarationNode * newnode = new DeclarationNode;
    404421        newnode->type = nullptr;
     
    409426}
    410427
    411 DeclarationNode * DeclarationNode::newAttr( string * name, DeclarationNode * type ) {
     428DeclarationNode * DeclarationNode::newAttr( const string * name, DeclarationNode * type ) {
    412429        DeclarationNode * newnode = new DeclarationNode;
    413430        newnode->type = nullptr;
     
    418435}
    419436
    420 DeclarationNode * DeclarationNode::newAttribute( string * name, ExpressionNode * expr ) {
     437DeclarationNode * DeclarationNode::newAttribute( const string * name, ExpressionNode * expr ) {
    421438        DeclarationNode * newnode = new DeclarationNode;
    422439        newnode->type = nullptr;
     
    433450        return newnode;
    434451}
     452
     453DeclarationNode * DeclarationNode::newStaticAssert( ExpressionNode * condition, Expression * message ) {
     454        DeclarationNode * newnode = new DeclarationNode;
     455        newnode->assert.condition = condition;
     456        newnode->assert.message = message;
     457        return newnode;
     458}
     459
    435460
    436461void appendError( string & dst, const string & src ) {
     
    489514} // DeclarationNode::copySpecifiers
    490515
    491 static void addQualifiersToType( TypeData *&src, TypeData * dst ) {
    492         if ( src->forall && dst->kind == TypeData::Function ) {
    493                 if ( dst->forall ) {
    494                         dst->forall->appendList( src->forall );
    495                 } else {
    496                         dst->forall = src->forall;
    497                 } // if
    498                 src->forall = nullptr;
    499         } // if
     516static void addQualifiersToType( TypeData *& src, TypeData * dst ) {
    500517        if ( dst->base ) {
    501518                addQualifiersToType( src, dst->base );
     
    509526
    510527DeclarationNode * DeclarationNode::addQualifiers( DeclarationNode * q ) {
    511         if ( ! q ) { delete q; return this; }                           // empty qualifier
     528        if ( ! q ) { return this; }                                                     // empty qualifier
    512529
    513530        checkSpecifiers( q );
     
    531548                                        type->aggregate.params->appendList( q->type->forall ); // augment forall qualifier
    532549                                } else {                                                                // not polymorphic
    533                                         type->aggregate.params = q->type->forall; // make polymorphic type
    534                                         // change implicit typedef from TYPEDEFname to TYPEGENname
    535                                         typedefTable.changeKind( *type->aggregate.name, TypedefTable::TG );
     550                                        type->aggregate.params = q->type->forall; // set forall qualifier
    536551                                } // if
    537552                        } else {                                                                        // not polymorphic
     
    543558
    544559        checkQualifiers( type, q->type );
     560        if ( (builtin == Zero || builtin == One) && q->type->qualifiers.val != 0 && error.length() == 0 ) {
     561                SemanticWarning( yylloc, Warning::BadQualifiersZeroOne, Type::QualifiersNames[ilog2( q->type->qualifiers.val )], builtinTypeNames[builtin] );
     562        } // if
    545563        addQualifiersToType( q->type, type );
    546564
     
    549567} // addQualifiers
    550568
    551 static void addTypeToType( TypeData *&src, TypeData *&dst ) {
     569static void addTypeToType( TypeData *& src, TypeData *& dst ) {
    552570        if ( src->forall && dst->kind == TypeData::Function ) {
    553571                if ( dst->forall ) {
     
    575593                                        dst->basictype = src->basictype;
    576594                                } else if ( src->basictype != DeclarationNode::NoBasicType )
    577                                         throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::basicTypeNames[ src->basictype ] + " in type: ", src );
     595                                        SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::basicTypeNames[ src->basictype ] + " in type: " );
    578596
    579597                                if ( dst->complextype == DeclarationNode::NoComplexType ) {
    580598                                        dst->complextype = src->complextype;
    581599                                } else if ( src->complextype != DeclarationNode::NoComplexType )
    582                                         throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::complexTypeNames[ src->complextype ] + " in type: ", src );
     600                                        SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::complexTypeNames[ src->complextype ] + " in type: " );
    583601
    584602                                if ( dst->signedness == DeclarationNode::NoSignedness ) {
    585603                                        dst->signedness = src->signedness;
    586604                                } else if ( src->signedness != DeclarationNode::NoSignedness )
    587                                         throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::signednessNames[ src->signedness ] + " in type: ", src );
     605                                        SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::signednessNames[ src->signedness ] + " in type: " );
    588606
    589607                                if ( dst->length == DeclarationNode::NoLength ) {
     
    592610                                        dst->length = DeclarationNode::LongLong;
    593611                                } else if ( src->length != DeclarationNode::NoLength )
    594                                         throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::lengthNames[ src->length ] + " in type: ", src );
     612                                        SemanticError( yylloc, src, string( "conflicting type specifier " ) + DeclarationNode::lengthNames[ src->length ] + " in type: " );
    595613                        } // if
    596614                        break;
     
    717735}
    718736
    719 DeclarationNode * DeclarationNode::addFunctionBody( StatementNode * body, StatementNode * with ) {
     737DeclarationNode * DeclarationNode::addFunctionBody( StatementNode * body, ExpressionNode * withExprs ) {
    720738        assert( type );
    721739        assert( type->kind == TypeData::Function );
    722740        assert( ! type->function.body );
    723         if ( with ) {
    724                 // convert
    725                 //  void f(S s) with (s) { x = 0; }
    726                 // to
    727                 //  void f(S s) { with(s) { x = 0; } }
    728                 WithStmt * withStmt = strict_dynamic_cast< WithStmt * >( with->build() );
    729                 withStmt->stmt = body->build();
    730                 delete body;
    731                 delete with;
    732                 body = new StatementNode( new CompoundStmt( { withStmt } ) );
    733         }
    734741        type->function.body = body;
     742        type->function.withExprs = withExprs;
    735743        return this;
    736744}
     
    771779DeclarationNode * DeclarationNode::addPointer( DeclarationNode * p ) {
    772780        if ( p ) {
    773                 assert( p->type->kind == TypeData::Pointer || TypeData::Reference );
     781                assert( p->type->kind == TypeData::Pointer || p->type->kind == TypeData::Reference );
    774782                setBase( p->type );
    775783                p->type = nullptr;
     
    916924                                delete newType->aggInst.aggregate->enumeration.constants;
    917925                                newType->aggInst.aggregate->enumeration.constants = nullptr;
     926                                newType->aggInst.aggregate->enumeration.body = false;
    918927                        } else {
    919928                                assert( newType->aggInst.aggregate->kind == TypeData::Aggregate );
    920929                                delete newType->aggInst.aggregate->aggregate.fields;
    921930                                newType->aggInst.aggregate->aggregate.fields = nullptr;
     931                                newType->aggInst.aggregate->aggregate.body = false;
    922932                        } // if
    923933                        // don't hoist twice
     
    948958}
    949959
    950 void buildList( const DeclarationNode * firstNode, std::list< Declaration * > &outputList ) {
    951         SemanticError errors;
     960void buildList( const DeclarationNode * firstNode, std::list< Declaration * > & outputList ) {
     961        SemanticErrorException errors;
    952962        std::back_insert_iterator< std::list< Declaration * > > out( outputList );
    953963
    954964        for ( const DeclarationNode * cur = firstNode; cur; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ) ) {
    955965                try {
     966                        bool extracted = false;
     967                        bool anon = false;
    956968                        if ( DeclarationNode * extr = cur->extractAggregate() ) {
    957969                                // handle the case where a structure declaration is contained within an object or type declaration
    958970                                Declaration * decl = extr->build();
    959971                                if ( decl ) {
     972                                        // hoist the structure declaration
    960973                                        decl->location = cur->location;
    961974                                        * out++ = decl;
     975
     976                                        // need to remember the cases where a declaration contains an anonymous aggregate definition
     977                                        extracted = true;
     978                                        assert( extr->type );
     979                                        if ( extr->type->kind == TypeData::Aggregate ) {
     980                                                anon = extr->type->aggregate.anon;
     981                                        } else if ( extr->type->kind == TypeData::Enum ) {
     982                                                // xxx - is it useful to have an implicit anonymous enum member?
     983                                                anon = extr->type->enumeration.anon;
     984                                        }
    962985                                } // if
    963986                                delete extr;
     
    966989                        Declaration * decl = cur->build();
    967990                        if ( decl ) {
    968                                 decl->location = cur->location;
    969                                 * out++ = decl;
     991                                // don't include anonymous declaration for named aggregates, but do include them for anonymous aggregates, e.g.:
     992                                // struct S {
     993                                //   struct T { int x; }; // no anonymous member
     994                                //   struct { int y; };   // anonymous member
     995                                //   struct T;            // anonymous member
     996                                // };
     997                                if ( ! (extracted && decl->name == "" && ! anon && ! cur->get_inLine()) ) {
     998                                        if ( decl->name == "" ) {
     999                                                if ( DeclarationWithType * dwt = dynamic_cast<DeclarationWithType *>( decl ) ) {
     1000                                                        if ( ReferenceToType * aggr = dynamic_cast<ReferenceToType *>( dwt->get_type() ) ) {
     1001                                                                if ( aggr->name.find("anonymous") == std::string::npos ) {
     1002                                                                        if ( ! cur->get_inLine() ) {
     1003                                                                                // temporary: warn about anonymous member declarations of named types, since
     1004                                                                                // this conflicts with the syntax for the forward declaration of an anonymous type
     1005                                                                                SemanticWarning( cur->location, Warning::AggrForwardDecl, aggr->name.c_str() );
     1006                                                                        } // if
     1007                                                                } // if
     1008                                                        } // if
     1009                                                } // if
     1010                                        } // if
     1011                                        decl->location = cur->location;
     1012                                        *out++ = decl;
     1013                                } // if
    9701014                        } // if
    971                 } catch( SemanticError &e ) {
    972                         e.set_location( cur->location );
     1015                } catch( SemanticErrorException & e ) {
    9731016                        errors.append( e );
    9741017                } // try
    975         } // while
     1018        } // for
    9761019
    9771020        if ( ! errors.isEmpty() ) {
     
    9801023} // buildList
    9811024
    982 void buildList( const DeclarationNode * firstNode, std::list< DeclarationWithType * > &outputList ) {
    983         SemanticError errors;
     1025// currently only builds assertions, function parameters, and return values
     1026void buildList( const DeclarationNode * firstNode, std::list< DeclarationWithType * > & outputList ) {
     1027        SemanticErrorException errors;
    9841028        std::back_insert_iterator< std::list< DeclarationWithType * > > out( outputList );
    9851029
     
    9871031                try {
    9881032                        Declaration * decl = cur->build();
    989                         if ( decl ) {
    990                                 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) {
    991                                         dwt->location = cur->location;
    992                                         * out++ = dwt;
    993                                 } else if ( StructDecl * agg = dynamic_cast< StructDecl * >( decl ) ) {
    994                                         StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->get_name() );
    995                                         auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr );
    996                                         obj->location = cur->location;
    997                                         * out++ = obj;
    998                                         delete agg;
    999                                 } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) {
    1000                                         UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->get_name() );
    1001                                         auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr );
    1002                                         obj->location = cur->location;
    1003                                         * out++ = obj;
    1004                                 } // if
     1033                        assert( decl );
     1034                        if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) {
     1035                                dwt->location = cur->location;
     1036                                * out++ = dwt;
     1037                        } else if ( StructDecl * agg = dynamic_cast< StructDecl * >( decl ) ) {
     1038                                // e.g., int foo(struct S) {}
     1039                                StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->name );
     1040                                auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr );
     1041                                obj->location = cur->location;
     1042                                * out++ = obj;
     1043                                delete agg;
     1044                        } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) {
     1045                                // e.g., int foo(union U) {}
     1046                                UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->name );
     1047                                auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr );
     1048                                obj->location = cur->location;
     1049                                * out++ = obj;
     1050                        } else if ( EnumDecl * agg = dynamic_cast< EnumDecl * >( decl ) ) {
     1051                                // e.g., int foo(enum E) {}
     1052                                EnumInstType * inst = new EnumInstType( Type::Qualifiers(), agg->name );
     1053                                auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr );
     1054                                obj->location = cur->location;
     1055                                * out++ = obj;
    10051056                        } // if
    1006                 } catch( SemanticError &e ) {
    1007                         e.set_location( cur->location );
     1057                } catch( SemanticErrorException & e ) {
    10081058                        errors.append( e );
    10091059                } // try
     
    10151065} // buildList
    10161066
    1017 void buildTypeList( const DeclarationNode * firstNode, std::list< Type * > &outputList ) {
    1018         SemanticError errors;
     1067void buildTypeList( const DeclarationNode * firstNode, std::list< Type * > & outputList ) {
     1068        SemanticErrorException errors;
    10191069        std::back_insert_iterator< std::list< Type * > > out( outputList );
    10201070        const DeclarationNode * cur = firstNode;
     
    10231073                try {
    10241074                        * out++ = cur->buildType();
    1025                 } catch( SemanticError &e ) {
    1026                         e.set_location( cur->location );
     1075                } catch( SemanticErrorException & e ) {
    10271076                        errors.append( e );
    10281077                } // try
     
    10361085
    10371086Declaration * DeclarationNode::build() const {
    1038         if ( ! error.empty() ) throw SemanticError( error + " in declaration of ", this );
     1087        if ( ! error.empty() ) SemanticError( this, error + " in declaration of " );
    10391088
    10401089        if ( asmStmt ) {
     
    10591108                //    inline _Noreturn int i;                   // disallowed
    10601109                if ( type->kind != TypeData::Function && funcSpecs.any() ) {
    1061                         throw SemanticError( "invalid function specifier for ", this );
    1062                 } // if
    1063                 return buildDecl( type, name ? *name : string( "" ), storageClasses, maybeBuild< Expression >( bitfieldWidth ), funcSpecs, linkage, asmName, maybeBuild< Initializer >(initializer), attributes )->set_extension( extension );
    1064         } // if
     1110                        SemanticError( this, "invalid function specifier for " );
     1111                } // if
     1112                // Forall qualifier can only appear on a function/aggregate definition/declaration.
     1113                //
     1114                //    forall int f();                                   // allowed
     1115                //    forall int g( int i );                    // allowed
     1116                //    forall int i;                                             // disallowed
     1117                if ( type->kind != TypeData::Function && type->forall ) {
     1118                        SemanticError( this, "invalid type qualifier for " );
     1119                } // if
     1120                bool isDelete = initializer && initializer->get_isDelete();
     1121                Declaration * decl = buildDecl( type, name ? *name : string( "" ), storageClasses, maybeBuild< Expression >( bitfieldWidth ), funcSpecs, linkage, asmName, isDelete ? nullptr : maybeBuild< Initializer >(initializer), attributes )->set_extension( extension );
     1122                if ( isDelete ) {
     1123                        DeclarationWithType * dwt = strict_dynamic_cast<DeclarationWithType *>( decl );
     1124                        dwt->isDeleted = true;
     1125                }
     1126                return decl;
     1127        } // if
     1128
     1129        if ( assert.condition ) {
     1130                return new StaticAssertDecl( maybeBuild< Expression >( assert.condition ), strict_dynamic_cast< ConstantExpr * >( maybeClone( assert.message ) ) );
     1131        }
    10651132
    10661133        // SUE's cannot have function specifiers, either
     
    10691136        //    inlne _Noreturn enum   E { ... };         // disallowed
    10701137        if ( funcSpecs.any() ) {
    1071                 throw SemanticError( "invalid function specifier for ", this );
     1138                SemanticError( this, "invalid function specifier for " );
    10721139        } // if
    10731140        assertf( name, "ObjectDecl must a have name\n" );
  • src/Parser/ExpressionNode.cc

    rf9feab8 r90152a4  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Sep 27 22:51:55 2017
    13 // Update Count     : 781
     12// Last Modified On : Mon Jun  4 21:24:45 2018
     13// Update Count     : 802
    1414//
    1515
     
    5858static inline bool checkD( char c ) { return c == 'd' || c == 'D'; }
    5959static inline bool checkI( char c ) { return c == 'i' || c == 'I'; }
     60static inline bool checkB( char c ) { return c == 'b' || c == 'B'; }
    6061static inline bool checkX( char c ) { return c == 'x' || c == 'X'; }
    6162
     
    9394} // checkLNInt
    9495
    95 static void sepNumeric( string & str, string & units ) {
    96         string::size_type posn = str.find_first_of( "`" );
    97         if ( posn != string::npos ) {
    98                 units = "?" + str.substr( posn );                               // extract units
    99                 str.erase( posn );                                                              // remove units
    100         } // if
    101 } // sepNumeric
    102 
    10396Expression * build_constantInteger( string & str ) {
    10497        static const BasicType::Kind kind[2][6] = {
     
    108101        };
    109102
    110         string units;
    111         sepNumeric( str, units );                                                       // separate constant from units
    112 
    113103        bool dec = true, Unsigned = false;                                      // decimal, unsigned constant
    114104        int size;                                                                                       // 0 => short, 1 => char, 2 => int, 3 => long int, 4 => long long int, 5 => int128
     
    116106
    117107        unsigned long long int v;                                                       // converted integral value
    118         size_t last = str.length() - 1;                                         // last character of constant
     108        size_t last = str.length() - 1;                                         // last subscript of constant
    119109        Expression * ret;
    120110
     
    129119        } // if
    130120
    131         if ( str[0] == '0' ) {                                                          // octal/hex constant ?
     121        // Cannot be "0"
     122
     123        if ( str[0] == '0' ) {                                                          // radix character ?
    132124                dec = false;
    133                 if ( last != 0 && checkX( str[1] ) ) {                  // hex constant ?
     125                if ( checkX( str[1] ) ) {                                               // hex constant ?
    134126                        sscanf( (char *)str.c_str(), "%llx", &v );
     127                        //printf( "%llx %llu\n", v, v );
     128                } else if ( checkB( str[1] ) ) {                                // binary constant ?
     129                        v = 0;
     130                        for ( unsigned int i = 2;; i += 1 ) {           // compute value
     131                                if ( str[i] == '1' ) v |= 1;
     132                          if ( i == last ) break;
     133                                v <<= 1;
     134                        } // for
    135135                        //printf( "%llx %llu\n", v, v );
    136136                } else {                                                                                // octal constant
     
    211211        if ( Unsigned && size < 2 ) {                                           // hh or h, less than int ?
    212212                // int i = -1uh => 65535 not -1, so cast is necessary for unsigned, which unfortunately eliminates warnings for large values.
    213                 ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ) );
     213                ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ), false );
    214214        } else if ( lnth != -1 ) {                                                      // explicit length ?
    215215                if ( lnth == 5 ) {                                                              // int128 ?
    216216                        size = 5;
    217                         ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ) );
     217                        ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ), false );
    218218                } else {
    219                         ret = new CastExpr( ret, new TypeInstType( Type::Qualifiers(), lnthsInt[Unsigned][lnth], false ) );
     219                        ret = new CastExpr( ret, new TypeInstType( Type::Qualifiers(), lnthsInt[Unsigned][lnth], false ), false );
    220220                } // if
    221221        } // if
    222222  CLEANUP:
    223         if ( units.length() != 0 ) {
    224                 ret = new UntypedExpr( new NameExpr( units ), { ret } );
    225         } // if
    226223
    227224        delete &str;                                                                            // created by lex
     
    257254        };
    258255
    259         string units;
    260         sepNumeric( str, units );                                                       // separate constant from units
    261 
    262256        bool complx = false;                                                            // real, complex
    263257        int size = 1;                                                                           // 0 => float, 1 => double, 2 => long double
     
    291285        Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][size] ), str, v ) );
    292286        if ( lnth != -1 ) {                                                                     // explicit length ?
    293                 ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[complx][size] ) );
    294         } // if
    295         if ( units.length() != 0 ) {
    296                 ret = new UntypedExpr( new NameExpr( units ), { ret } );
     287                ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[complx][size] ), false );
    297288        } // if
    298289
     
    323314
    324315Expression * build_constantStr( string & str ) {
     316        assert( str.length() > 0 );
    325317        string units;                                                                           // units
    326318        sepString( str, units, '"' );                                           // separate constant from units
     
    356348
    357349Expression * build_field_name_FLOATING_FRACTIONconstant( const string & str ) {
    358         if ( str.find_first_not_of( "0123456789", 1 ) != string::npos ) throw SemanticError( "invalid tuple index " + str );
     350        if ( str.find_first_not_of( "0123456789", 1 ) != string::npos ) SemanticError( yylloc, "invalid tuple index " + str );
    359351        Expression * ret = build_constantInteger( *new string( str.substr(1) ) );
    360352        delete &str;
     
    363355
    364356Expression * build_field_name_FLOATING_DECIMALconstant( const string & str ) {
    365         if ( str[str.size()-1] != '.' ) throw SemanticError( "invalid tuple index " + str );
     357        if ( str[str.size()-1] != '.' ) SemanticError( yylloc, "invalid tuple index " + str );
    366358        Expression * ret = build_constantInteger( *new string( str.substr( 0, str.size()-1 ) ) );
    367359        delete &str;
     
    417409        if ( dynamic_cast< VoidType * >( targetType ) ) {
    418410                delete targetType;
    419                 return new CastExpr( maybeMoveBuild< Expression >(expr_node) );
     411                return new CastExpr( maybeMoveBuild< Expression >(expr_node), false );
    420412        } else {
    421                 return new CastExpr( maybeMoveBuild< Expression >(expr_node), targetType );
     413                return new CastExpr( maybeMoveBuild< Expression >(expr_node), targetType, false );
    422414        } // if
    423415} // build_cast
     416
     417Expression * build_keyword_cast( KeywordCastExpr::Target target, ExpressionNode * expr_node ) {
     418        return new KeywordCastExpr( maybeMoveBuild< Expression >(expr_node), target );
     419}
    424420
    425421Expression * build_virtual_cast( DeclarationNode * decl_node, ExpressionNode * expr_node ) {
  • src/Parser/InitializerNode.cc

    rf9feab8 r90152a4  
    2727
    2828InitializerNode::InitializerNode( ExpressionNode * _expr, bool aggrp, ExpressionNode * des )
    29                 : expr( _expr ), aggregate( aggrp ), designator( des ), kids( nullptr ), maybeConstructed( true ) {
     29                : expr( _expr ), aggregate( aggrp ), designator( des ), kids( nullptr ), maybeConstructed( true ), isDelete( false ) {
    3030        if ( aggrp )
    3131                kids = dynamic_cast< InitializerNode * >( get_next() );
     
    3636
    3737InitializerNode::InitializerNode( InitializerNode * init, bool aggrp, ExpressionNode * des )
    38                 : expr( nullptr ), aggregate( aggrp ), designator( des ), kids( nullptr ), maybeConstructed( true ) {
     38                : expr( nullptr ), aggregate( aggrp ), designator( des ), kids( nullptr ), maybeConstructed( true ), isDelete( false ) {
    3939        if ( init )
    4040                set_last( init );
     
    4646                set_next( nullptr );
    4747} // InitializerNode::InitializerNode
     48
     49InitializerNode::InitializerNode( bool isDelete ) : expr( nullptr ), aggregate( false ), designator( nullptr ), kids( nullptr ), maybeConstructed( false ), isDelete( isDelete ) {}
    4850
    4951InitializerNode::~InitializerNode() {
     
    8486
    8587Initializer * InitializerNode::build() const {
     88        assertf( ! isDelete, "Should not build delete stmt InitializerNode" );
    8689        if ( aggregate ) {
    8790                // steal designators from children
  • src/Parser/LinkageSpec.cc

    rf9feab8 r90152a4  
    2424namespace LinkageSpec {
    2525
    26 Spec linkageCheck( const string * spec ) {
     26Spec linkageCheck( CodeLocation location, const string * spec ) {
    2727        assert( spec );
    2828        unique_ptr<const string> guard( spec ); // allocated by lexer
     
    3434                return BuiltinC;
    3535        } else {
    36                 throw SemanticError( "Invalid linkage specifier " + *spec );
     36                SemanticError( location, "Invalid linkage specifier " + *spec );
    3737        } // if
    3838}
    3939
    40 Spec linkageUpdate( Spec old_spec, const string * cmd ) {
     40Spec linkageUpdate( CodeLocation location, Spec old_spec, const string * cmd ) {
    4141        assert( cmd );
    4242        unique_ptr<const string> guard( cmd ); // allocated by lexer
     
    4848                return old_spec;
    4949        } else {
    50                 throw SemanticError( "Invalid linkage specifier " + *cmd );
     50                SemanticError( location, "Invalid linkage specifier " + *cmd );
    5151        } // if
    5252}
  • src/Parser/LinkageSpec.h

    rf9feab8 r90152a4  
    1010// Created On       : Sat May 16 13:24:28 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:32:16 2017
    13 // Update Count     : 14
     12// Last Modified On : Mon Jul  2 07:46:49 2018
     13// Update Count     : 16
    1414//
    1515
     
    1818#include <string>
    1919
     20#include "Common/CodeLocation.h"
     21
    2022namespace LinkageSpec {
    2123        // All linkage specs are some combination of these flags:
    22         enum {
    23                 Mangle = 1 << 0,
    24                 Generate = 1 << 1,
    25                 Overrideable = 1 << 2,
    26                 Builtin = 1 << 3,
    27 
    28                 NoOfSpecs = 1 << 4,
    29         };
     24        enum { Mangle = 1 << 0, Generate = 1 << 1, Overrideable = 1 << 2, Builtin = 1 << 3, GccBuiltin = 1 << 4, NoOfSpecs = 1 << 5, };
    3025
    3126        union Spec {
     
    3631                        bool is_overridable : 1;
    3732                        bool is_builtin : 1;
     33                        bool is_gcc_builtin : 1;
    3834                };
    3935                constexpr Spec( unsigned int val ) : val( val ) {}
    40                 constexpr Spec( Spec const &other ) : val( other.val ) {}
     36                constexpr Spec( Spec const & other ) : val( other.val ) {}
    4137                // Operators may go here.
    4238                // Supports == and !=
    43                 constexpr operator unsigned int () const { return val; }
     39                constexpr operator unsigned int() const { return val; }
    4440        };
    4541
    4642
    47         Spec linkageCheck( const std::string * );
     43        Spec linkageCheck( CodeLocation location, const std::string * );
    4844        // Returns the Spec with the given name (limited to C, Cforall & BuiltinC)
    49         Spec linkageUpdate( Spec old_spec, const std::string * cmd );
     45        Spec linkageUpdate( CodeLocation location, Spec old_spec, const std::string * cmd );
    5046        /* If cmd = "C" returns a Spec that is old_spec with is_mangled = false
    5147         * If cmd = "Cforall" returns old_spec Spec with is_mangled = true
     
    5955        inline bool isOverridable( Spec spec ) { return spec.is_overridable; }
    6056        inline bool isBuiltin( Spec spec ) { return spec.is_builtin; }
     57        inline bool isGccBuiltin( Spec spec ) { return spec.is_gcc_builtin; }
    6158
    6259        // Pre-defined flag combinations:
     
    7067        constexpr Spec const AutoGen = { Mangle | Generate | Overrideable };
    7168        // gcc internal
    72         constexpr Spec const Compiler = { Builtin };
     69        constexpr Spec const Compiler = { Mangle | Builtin | GccBuiltin };
    7370        // mangled builtins
    7471        constexpr Spec const BuiltinCFA = { Mangle | Generate | Builtin };
  • src/Parser/ParseNode.h

    rf9feab8 r90152a4  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Nov 27 17:33:35 2017
    13 // Update Count     : 824
     12// Last Modified On : Sat Aug  4 09:39:40 2018
     13// Update Count     : 853
    1414//
    1515
     
    6868        }
    6969
    70         virtual void print( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const {}
    71         virtual void printList( std::ostream &os, int indent = 0 ) const {
     70        virtual void print( __attribute__((unused)) std::ostream & os, __attribute__((unused)) int indent = 0 ) const {}
     71        virtual void printList( std::ostream & os, int indent = 0 ) const {
    7272                print( os, indent );
    7373                if ( next ) next->print( os, indent );
     
    7777
    7878        ParseNode * next = nullptr;
    79         std::string * name = nullptr;
     79        const std::string * name = nullptr;
    8080        CodeLocation location = yylloc;
    8181}; // ParseNode
     
    8787        InitializerNode( ExpressionNode *, bool aggrp = false,  ExpressionNode * des = nullptr );
    8888        InitializerNode( InitializerNode *, bool aggrp = false, ExpressionNode * des = nullptr );
     89        InitializerNode( bool isDelete );
    8990        ~InitializerNode();
    9091        virtual InitializerNode * clone() const { assert( false ); return nullptr; }
     
    9899        bool get_maybeConstructed() const { return maybeConstructed; }
    99100
     101        bool get_isDelete() const { return isDelete; }
     102
    100103        InitializerNode * next_init() const { return kids; }
    101104
    102         void print( std::ostream &os, int indent = 0 ) const;
     105        void print( std::ostream & os, int indent = 0 ) const;
    103106        void printOneLine( std::ostream & ) const;
    104107
     
    110113        InitializerNode * kids;
    111114        bool maybeConstructed;
     115        bool isDelete;
    112116}; // InitializerNode
    113117
     
    123127        ExpressionNode * set_extension( bool exten ) { extension = exten; return this; }
    124128
    125         virtual void print( std::ostream &os, __attribute__((unused)) int indent = 0 ) const override {
    126                 os << expr.get() << std::endl;
    127         }
    128         void printOneLine( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const {}
    129 
     129        virtual void print( std::ostream & os, __attribute__((unused)) int indent = 0 ) const override {
     130                os << expr.get();
     131        }
     132        void printOneLine( __attribute__((unused)) std::ostream & os, __attribute__((unused)) int indent = 0 ) const {}
     133
     134        Expression *get_expr() const { return expr.get(); }
    130135        template<typename T>
    131136        bool isExpressionType() const { return nullptr != dynamic_cast<T>(expr.get()); }
     
    167172};
    168173
    169 Expression * build_constantInteger( std::string &str );
    170 Expression * build_constantFloat( std::string &str );
    171 Expression * build_constantChar( std::string &str );
    172 Expression * build_constantStr( std::string &str );
     174Expression * build_constantInteger( std::string & str ); // these 4 routines modify the string
     175Expression * build_constantFloat( std::string & str );
     176Expression * build_constantChar( std::string & str );
     177Expression * build_constantStr( std::string & str );
    173178Expression * build_field_name_FLOATING_FRACTIONconstant( const std::string & str );
    174179Expression * build_field_name_FLOATING_DECIMALconstant( const std::string & str );
     
    179184
    180185Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node );
     186Expression * build_keyword_cast( KeywordCastExpr::Target target, ExpressionNode * expr_node );
    181187Expression * build_virtual_cast( DeclarationNode * decl_node, ExpressionNode * expr_node );
    182188Expression * build_fieldSel( ExpressionNode * expr_node, Expression * member );
     
    209215        enum Length { Short, Long, LongLong, NoLength };
    210216        static const char * lengthNames[];
    211         enum Aggregate { Struct, Union, Trait, Coroutine, Monitor, Thread, NoAggregate };
     217        enum Aggregate { Struct, Union, Exception, Trait, Coroutine, Monitor, Thread, NoAggregate };
    212218        static const char * aggregateNames[];
    213219        enum TypeClass { Otype, Dtype, Ftype, Ttype, NoTypeClass };
     
    225231        static DeclarationNode * newBuiltinType( BuiltinType );
    226232        static DeclarationNode * newForall( DeclarationNode * );
    227         static DeclarationNode * newFromTypedef( std::string * );
    228         static DeclarationNode * newFunction( std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body, bool newStyle = false );
     233        static DeclarationNode * newFromTypedef( const std::string * );
     234        static DeclarationNode * newFromGlobalScope();
     235        static DeclarationNode * newQualifiedType( DeclarationNode *, DeclarationNode * );
     236        static DeclarationNode * newFunction( const std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body );
    229237        static DeclarationNode * newAggregate( Aggregate kind, const std::string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body );
    230         static DeclarationNode * newEnum( std::string * name, DeclarationNode * constants, bool body );
    231         static DeclarationNode * newEnumConstant( std::string * name, ExpressionNode * constant );
    232         static DeclarationNode * newName( std::string * );
    233         static DeclarationNode * newFromTypeGen( std::string *, ExpressionNode * params );
    234         static DeclarationNode * newTypeParam( TypeClass, std::string * );
     238        static DeclarationNode * newEnum( const std::string * name, DeclarationNode * constants, bool body );
     239        static DeclarationNode * newEnumConstant( const std::string * name, ExpressionNode * constant );
     240        static DeclarationNode * newName( const std::string * );
     241        static DeclarationNode * newFromTypeGen( const std::string *, ExpressionNode * params );
     242        static DeclarationNode * newTypeParam( TypeClass, const std::string * );
    235243        static DeclarationNode * newTrait( const std::string * name, DeclarationNode * params, DeclarationNode * asserts );
    236244        static DeclarationNode * newTraitUse( const std::string * name, ExpressionNode * params );
    237         static DeclarationNode * newTypeDecl( std::string * name, DeclarationNode * typeParams );
     245        static DeclarationNode * newTypeDecl( const std::string * name, DeclarationNode * typeParams );
    238246        static DeclarationNode * newPointer( DeclarationNode * qualifiers, OperKinds kind );
    239247        static DeclarationNode * newArray( ExpressionNode * size, DeclarationNode * qualifiers, bool isStatic );
     
    242250        static DeclarationNode * newTuple( DeclarationNode * members );
    243251        static DeclarationNode * newTypeof( ExpressionNode * expr );
    244         static DeclarationNode * newAttr( std::string *, ExpressionNode * expr ); // @ attributes
    245         static DeclarationNode * newAttr( std::string *, DeclarationNode * type ); // @ attributes
    246         static DeclarationNode * newAttribute( std::string *, ExpressionNode * expr = nullptr ); // gcc attributes
     252        static DeclarationNode * newAttr( const std::string *, ExpressionNode * expr ); // @ attributes
     253        static DeclarationNode * newAttr( const std::string *, DeclarationNode * type ); // @ attributes
     254        static DeclarationNode * newAttribute( const std::string *, ExpressionNode * expr = nullptr ); // gcc attributes
    247255        static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement
     256        static DeclarationNode * newStaticAssert( ExpressionNode * condition, Expression * message );
    248257
    249258        DeclarationNode();
     
    262271        DeclarationNode * addBitfield( ExpressionNode * size );
    263272        DeclarationNode * addVarArgs();
    264         DeclarationNode * addFunctionBody( StatementNode * body, StatementNode * with = nullptr );
     273        DeclarationNode * addFunctionBody( StatementNode * body, ExpressionNode * with = nullptr );
    265274        DeclarationNode * addOldDeclList( DeclarationNode * list );
    266275        DeclarationNode * setBase( TypeData * newType );
     
    282291        }
    283292
    284         virtual void print( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const override;
    285         virtual void printList( __attribute__((unused)) std::ostream &os, __attribute__((unused)) int indent = 0 ) const override;
     293        virtual void print( __attribute__((unused)) std::ostream & os, __attribute__((unused)) int indent = 0 ) const override;
     294        virtual void printList( __attribute__((unused)) std::ostream & os, __attribute__((unused)) int indent = 0 ) const override;
    286295
    287296        Declaration * build() const;
    288297        Type * buildType() const;
    289298
    290         bool get_hasEllipsis() const;
    291299        LinkageSpec::Spec get_linkage() const { return linkage; }
    292300        DeclarationNode * extractAggregate() const;
     
    296304        bool get_extension() const { return extension; }
    297305        DeclarationNode * set_extension( bool exten ) { extension = exten; return this; }
     306
     307        bool get_inLine() const { return inLine; }
     308        DeclarationNode * set_inLine( bool inL ) { inLine = inL; return this; }
    298309  public:
    299310        DeclarationNode * get_last() { return (DeclarationNode *)ParseNode::get_last(); }
     
    314325        Attr_t attr;
    315326
    316         BuiltinType builtin;
    317 
    318         TypeData * type;
    319 
     327        struct StaticAssert_t {
     328                ExpressionNode * condition;
     329                Expression * message;
     330        };
     331        StaticAssert_t assert;
     332
     333        BuiltinType builtin = NoBuiltinType;
     334
     335        TypeData * type = nullptr;
     336
     337        bool inLine = false;
    320338        Type::FuncSpecifiers funcSpecs;
    321339        Type::StorageClasses storageClasses;
    322340
    323         ExpressionNode * bitfieldWidth;
     341        ExpressionNode * bitfieldWidth = nullptr;
    324342        std::unique_ptr<ExpressionNode> enumeratorValue;
    325         bool hasEllipsis;
     343        bool hasEllipsis = false;
    326344        LinkageSpec::Spec linkage;
    327         Expression *asmName;
     345        Expression * asmName = nullptr;
    328346        std::list< Attribute * > attributes;
    329         InitializerNode * initializer;
     347        InitializerNode * initializer = nullptr;
    330348        bool extension = false;
    331349        std::string error;
    332         StatementNode * asmStmt;
     350        StatementNode * asmStmt = nullptr;
    333351
    334352        static UniqueName anonymous;
     
    364382        virtual StatementNode * append_last_case( StatementNode * );
    365383
    366         virtual void print( std::ostream &os, __attribute__((unused)) int indent = 0 ) const override {
     384        virtual void print( std::ostream & os, __attribute__((unused)) int indent = 0 ) const override {
    367385                os << stmt.get() << std::endl;
    368386        }
     
    373391Statement * build_expr( ExpressionNode * ctl );
    374392
    375 struct IfCtl {
    376         IfCtl( DeclarationNode * decl, ExpressionNode * condition ) :
     393struct IfCtrl {
     394        IfCtrl( DeclarationNode * decl, ExpressionNode * condition ) :
    377395                init( decl ? new StatementNode( decl ) : nullptr ), condition( condition ) {}
    378396
     
    381399};
    382400
    383 struct ForCtl {
    384         ForCtl( ExpressionNode * expr, ExpressionNode * condition, ExpressionNode * change ) :
     401struct ForCtrl {
     402        ForCtrl( ExpressionNode * expr, ExpressionNode * condition, ExpressionNode * change ) :
    385403                init( new StatementNode( build_expr( expr ) ) ), condition( condition ), change( change ) {}
    386         ForCtl( DeclarationNode * decl, ExpressionNode * condition, ExpressionNode * change ) :
     404        ForCtrl( DeclarationNode * decl, ExpressionNode * condition, ExpressionNode * change ) :
    387405                init( new StatementNode( decl ) ), condition( condition ), change( change ) {}
    388406
     
    392410};
    393411
    394 Statement * build_if( IfCtl * ctl, StatementNode * then_stmt, StatementNode * else_stmt );
    395 Statement * build_switch( ExpressionNode * ctl, StatementNode * stmt );
     412Expression * build_if_control( IfCtrl * ctl, std::list< Statement * > & init );
     413Statement * build_if( IfCtrl * ctl, StatementNode * then_stmt, StatementNode * else_stmt );
     414Statement * build_switch( bool isSwitch, ExpressionNode * ctl, StatementNode * stmt );
    396415Statement * build_case( ExpressionNode * ctl );
    397416Statement * build_default();
    398 Statement * build_while( ExpressionNode * ctl, StatementNode * stmt, bool kind = false );
    399 Statement * build_for( ForCtl * forctl, StatementNode * stmt );
     417Statement * build_while( IfCtrl * ctl, StatementNode * stmt );
     418Statement * build_do_while( ExpressionNode * ctl, StatementNode * stmt );
     419Statement * build_for( ForCtrl * forctl, StatementNode * stmt );
    400420Statement * build_branch( BranchStmt::Type kind );
    401421Statement * build_branch( std::string * identifier, BranchStmt::Type kind );
     
    409429Statement * build_finally( StatementNode * stmt );
    410430Statement * build_compound( StatementNode * first );
    411 Statement * build_asmstmt( bool voltile, Expression * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr );
     431Statement * build_asm( bool voltile, Expression * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr );
     432Statement * build_directive( std::string * directive );
    412433WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when );
    413434WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when, WaitForStmt * existing );
     
    419440
    420441template< typename SynTreeType, typename NodeType, template< typename, typename...> class Container, typename... Args >
    421 void buildList( const NodeType * firstNode, Container< SynTreeType *, Args... > &outputList ) {
    422         SemanticError errors;
     442void buildList( const NodeType * firstNode, Container< SynTreeType *, Args... > & outputList ) {
     443        SemanticErrorException errors;
    423444        std::back_insert_iterator< Container< SynTreeType *, Args... > > out( outputList );
    424445        const NodeType * cur = firstNode;
     
    433454                                assertf(false, "buildList unknown type");
    434455                        } // if
    435                 } catch( SemanticError &e ) {
    436                         e.set_location( cur->location );
     456                } catch( SemanticErrorException & e ) {
    437457                        errors.append( e );
    438458                } // try
     
    445465
    446466// in DeclarationNode.cc
    447 void buildList( const DeclarationNode * firstNode, std::list< Declaration * > &outputList );
    448 void buildList( const DeclarationNode * firstNode, std::list< DeclarationWithType * > &outputList );
    449 void buildTypeList( const DeclarationNode * firstNode, std::list< Type * > &outputList );
     467void buildList( const DeclarationNode * firstNode, std::list< Declaration * > & outputList );
     468void buildList( const DeclarationNode * firstNode, std::list< DeclarationWithType * > & outputList );
     469void buildTypeList( const DeclarationNode * firstNode, std::list< Type * > & outputList );
    450470
    451471template< typename SynTreeType, typename NodeType >
    452 void buildMoveList( const NodeType * firstNode, std::list< SynTreeType * > &outputList ) {
     472void buildMoveList( const NodeType * firstNode, std::list< SynTreeType * > & outputList ) {
    453473        buildList( firstNode, outputList );
    454474        delete firstNode;
  • src/Parser/StatementNode.cc

    rf9feab8 r90152a4  
    1010// Created On       : Sat May 16 14:59:41 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Sep  1 23:25:23 2017
    13 // Update Count     : 346
     12// Last Modified On : Sat Aug  4 09:39:25 2018
     13// Update Count     : 363
    1414//
    1515
     
    3333
    3434
    35 StatementNode::StatementNode( DeclarationNode *decl ) {
     35StatementNode::StatementNode( DeclarationNode * decl ) {
    3636        assert( decl );
    37         DeclarationNode *agg = decl->extractAggregate();
     37        DeclarationNode * agg = decl->extractAggregate();
    3838        if ( agg ) {
    39                 StatementNode *nextStmt = new StatementNode( new DeclStmt( maybeBuild< Declaration >( decl ) ) );
     39                StatementNode * nextStmt = new StatementNode( new DeclStmt( maybeBuild< Declaration >( decl ) ) );
    4040                set_next( nextStmt );
    4141                if ( decl->get_next() ) {
     
    5353} // StatementNode::StatementNode
    5454
    55 StatementNode *StatementNode::append_last_case( StatementNode *stmt ) {
    56         StatementNode *prev = this;
     55StatementNode * StatementNode::append_last_case( StatementNode * stmt ) {
     56        StatementNode * prev = this;
    5757        // find end of list and maintain previous pointer
    5858        for ( StatementNode * curr = prev; curr != nullptr; curr = (StatementNode *)curr->get_next() ) {
    59                 StatementNode *node = strict_dynamic_cast< StatementNode * >(curr);
     59                StatementNode * node = strict_dynamic_cast< StatementNode * >(curr);
    6060                assert( dynamic_cast< CaseStmt * >(node->stmt.get()) );
    6161                prev = curr;
    6262        } // for
    6363        // convert from StatementNode list to Statement list
    64         StatementNode *node = dynamic_cast< StatementNode * >(prev);
     64        StatementNode * node = dynamic_cast< StatementNode * >(prev);
    6565        std::list< Statement * > stmts;
    6666        buildMoveList( stmt, stmts );
     
    6969        caseStmt->get_statements().splice( caseStmt->get_statements().end(), stmts );
    7070        return this;
    71 }
    72 
    73 Statement *build_expr( ExpressionNode *ctl ) {
    74         Expression *e = maybeMoveBuild< Expression >( ctl );
    75 
    76         if ( e )
    77                 return new ExprStmt( e );
    78         else
    79                 return new NullStmt();
    80 }
    81 
    82 Statement *build_if( IfCtl * ctl, StatementNode *then_stmt, StatementNode *else_stmt ) {
    83         Statement *thenb, *elseb = 0;
    84         std::list< Statement * > branches;
    85         buildMoveList< Statement, StatementNode >( then_stmt, branches );
    86         assert( branches.size() == 1 );
    87         thenb = branches.front();
    88 
    89         if ( else_stmt ) {
    90                 std::list< Statement * > branches;
    91                 buildMoveList< Statement, StatementNode >( else_stmt, branches );
    92                 assert( branches.size() == 1 );
    93                 elseb = branches.front();
    94         } // if
    95 
    96         std::list< Statement * > init;
     71} // StatementNode::append_last_case
     72
     73Statement * build_expr( ExpressionNode * ctl ) {
     74        Expression * e = maybeMoveBuild< Expression >( ctl );
     75
     76        if ( e ) return new ExprStmt( e );
     77        else return new NullStmt();
     78} // build_expr
     79
     80Expression * build_if_control( IfCtrl * ctl, std::list< Statement * > & init ) {
    9781        if ( ctl->init != 0 ) {
    9882                buildMoveList( ctl->init, init );
     
    10286        if ( ctl->condition ) {
    10387                // compare the provided condition against 0
    104                 cond =  notZeroExpr( maybeMoveBuild< Expression >(ctl->condition) );
     88                cond = notZeroExpr( maybeMoveBuild< Expression >(ctl->condition) );
    10589        } else {
    10690                for ( Statement * stmt : init ) {
     
    11397        }
    11498        delete ctl;
     99        return cond;
     100} // build_if_control
     101
     102Statement * build_if( IfCtrl * ctl, StatementNode * then_stmt, StatementNode * else_stmt ) {
     103        Statement * thenb, * elseb = nullptr;
     104        std::list< Statement * > branches;
     105        buildMoveList< Statement, StatementNode >( then_stmt, branches );
     106        assert( branches.size() == 1 );
     107        thenb = branches.front();
     108
     109        if ( else_stmt ) {
     110                std::list< Statement * > branches;
     111                buildMoveList< Statement, StatementNode >( else_stmt, branches );
     112                assert( branches.size() == 1 );
     113                elseb = branches.front();
     114        } // if
     115
     116        std::list< Statement * > init;
     117        Expression * cond = build_if_control( ctl, init );
    115118        return new IfStmt( cond, thenb, elseb, init );
    116 }
    117 
    118 Statement *build_switch( ExpressionNode *ctl, StatementNode *stmt ) {
    119         std::list< Statement * > branches;
    120         buildMoveList< Statement, StatementNode >( stmt, branches );
     119} // build_if
     120
     121Statement * build_switch( bool isSwitch, ExpressionNode * ctl, StatementNode * stmt ) {
     122        std::list< Statement * > branches;
     123        buildMoveList< Statement, StatementNode >( stmt, branches );
     124        if ( ! isSwitch ) {                                                                             // choose statement
     125                for ( Statement * stmt : branches ) {
     126                        CaseStmt * caseStmt = strict_dynamic_cast< CaseStmt * >( stmt );
     127                        if ( ! caseStmt->stmts.empty() ) {                      // code after "case" => end of case list
     128                                CompoundStmt * block = strict_dynamic_cast< CompoundStmt * >( caseStmt->stmts.front() );
     129                                block->kids.push_back( new BranchStmt( "", BranchStmt::Break ) );
     130                        } // if
     131                } // for
     132        } // if
    121133        // branches.size() == 0 for switch (...) {}, i.e., no declaration or statements
    122134        return new SwitchStmt( maybeMoveBuild< Expression >(ctl), branches );
    123 }
    124 Statement *build_case( ExpressionNode *ctl ) {
     135} // build_switch
     136
     137Statement * build_case( ExpressionNode * ctl ) {
    125138        std::list< Statement * > branches;
    126139        return new CaseStmt( maybeMoveBuild< Expression >(ctl), branches );
    127 }
    128 Statement *build_default() {
     140} // build_case
     141
     142Statement * build_default() {
    129143        std::list< Statement * > branches;
    130144        return new CaseStmt( nullptr, branches, true );
    131 }
    132 
    133 Statement *build_while( ExpressionNode *ctl, StatementNode *stmt, bool kind ) {
    134         std::list< Statement * > branches;
    135         buildMoveList< Statement, StatementNode >( stmt, branches );
    136         assert( branches.size() == 1 );
    137         return new WhileStmt( notZeroExpr( maybeMoveBuild< Expression >(ctl) ), branches.front(), kind );
    138 }
    139 
    140 Statement *build_for( ForCtl *forctl, StatementNode *stmt ) {
     145} // build_default
     146
     147Statement * build_while( IfCtrl * ctl, StatementNode * stmt ) {
     148        std::list< Statement * > branches;
     149        buildMoveList< Statement, StatementNode >( stmt, branches );
     150        assert( branches.size() == 1 );
     151
     152        std::list< Statement * > init;
     153        Expression * cond = build_if_control( ctl, init );
     154        return new WhileStmt( cond, branches.front(), init, false );
     155} // build_while
     156
     157Statement * build_do_while( ExpressionNode * ctl, StatementNode * stmt ) {
     158        std::list< Statement * > branches;
     159        buildMoveList< Statement, StatementNode >( stmt, branches );
     160        assert( branches.size() == 1 );
     161
     162        std::list< Statement * > init;
     163        return new WhileStmt( notZeroExpr( maybeMoveBuild< Expression >(ctl) ), branches.front(), init, true );
     164} // build_do_while
     165
     166Statement * build_for( ForCtrl * forctl, StatementNode * stmt ) {
    141167        std::list< Statement * > branches;
    142168        buildMoveList< Statement, StatementNode >( stmt, branches );
     
    148174        } // if
    149175
    150         Expression *cond = 0;
     176        Expression * cond = 0;
    151177        if ( forctl->condition != 0 )
    152178                cond = notZeroExpr( maybeMoveBuild< Expression >(forctl->condition) );
    153179
    154         Expression *incr = 0;
     180        Expression * incr = 0;
    155181        if ( forctl->change != 0 )
    156182                incr = maybeMoveBuild< Expression >(forctl->change);
     
    158184        delete forctl;
    159185        return new ForStmt( init, cond, incr, branches.front() );
    160 }
    161 
    162 Statement *build_branch( BranchStmt::Type kind ) {
     186} // build_for
     187
     188Statement * build_branch( BranchStmt::Type kind ) {
    163189        Statement * ret = new BranchStmt( "", kind );
    164190        return ret;
    165 }
    166 Statement *build_branch( std::string *identifier, BranchStmt::Type kind ) {
    167         Statement * ret = new BranchStmt( *identifier, kind );
     191} // build_branch
     192
     193Statement * build_branch( std::string * identifier, BranchStmt::Type kind ) {
     194        Statement * ret = new BranchStmt( * identifier, kind );
    168195        delete identifier;                                                                      // allocated by lexer
    169196        return ret;
    170 }
    171 Statement *build_computedgoto( ExpressionNode *ctl ) {
     197} // build_branch
     198
     199Statement * build_computedgoto( ExpressionNode * ctl ) {
    172200        return new BranchStmt( maybeMoveBuild< Expression >(ctl), BranchStmt::Goto );
    173 }
    174 
    175 Statement *build_return( ExpressionNode *ctl ) {
     201} // build_computedgoto
     202
     203Statement * build_return( ExpressionNode * ctl ) {
    176204        std::list< Expression * > exps;
    177205        buildMoveList( ctl, exps );
    178206        return new ReturnStmt( exps.size() > 0 ? exps.back() : nullptr );
    179 }
    180 
    181 Statement *build_throw( ExpressionNode *ctl ) {
     207} // build_return
     208
     209Statement * build_throw( ExpressionNode * ctl ) {
    182210        std::list< Expression * > exps;
    183211        buildMoveList( ctl, exps );
    184212        assertf( exps.size() < 2, "This means we are leaking memory");
    185213        return new ThrowStmt( ThrowStmt::Terminate, !exps.empty() ? exps.back() : nullptr );
    186 }
    187 
    188 Statement *build_resume( ExpressionNode *ctl ) {
     214} // build_throw
     215
     216Statement * build_resume( ExpressionNode * ctl ) {
    189217        std::list< Expression * > exps;
    190218        buildMoveList( ctl, exps );
    191219        assertf( exps.size() < 2, "This means we are leaking memory");
    192220        return new ThrowStmt( ThrowStmt::Resume, !exps.empty() ? exps.back() : nullptr );
    193 }
    194 
    195 Statement *build_resume_at( ExpressionNode *ctl, ExpressionNode *target ) {
     221} // build_resume
     222
     223Statement * build_resume_at( ExpressionNode * ctl, ExpressionNode * target ) {
    196224        (void)ctl;
    197225        (void)target;
    198226        assertf( false, "resume at (non-local throw) is not yet supported," );
    199 }
    200 
    201 Statement *build_try( StatementNode *try_stmt, StatementNode *catch_stmt, StatementNode *finally_stmt ) {
     227} // build_resume_at
     228
     229Statement * build_try( StatementNode * try_stmt, StatementNode * catch_stmt, StatementNode * finally_stmt ) {
    202230        std::list< CatchStmt * > branches;
    203231        buildMoveList< CatchStmt, StatementNode >( catch_stmt, branches );
    204         CompoundStmt *tryBlock = strict_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
    205         FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) );
     232        CompoundStmt * tryBlock = strict_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
     233        FinallyStmt * finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) );
    206234        return new TryStmt( tryBlock, branches, finallyBlock );
    207 }
    208 Statement *build_catch( CatchStmt::Kind kind, DeclarationNode *decl, ExpressionNode *cond, StatementNode *body ) {
     235} // build_try
     236
     237Statement * build_catch( CatchStmt::Kind kind, DeclarationNode * decl, ExpressionNode * cond, StatementNode * body ) {
    209238        std::list< Statement * > branches;
    210239        buildMoveList< Statement, StatementNode >( body, branches );
    211240        assert( branches.size() == 1 );
    212241        return new CatchStmt( kind, maybeMoveBuild< Declaration >(decl), maybeMoveBuild< Expression >(cond), branches.front() );
    213 }
    214 Statement *build_finally( StatementNode *stmt ) {
     242} // build_catch
     243
     244Statement * build_finally( StatementNode * stmt ) {
    215245        std::list< Statement * > branches;
    216246        buildMoveList< Statement, StatementNode >( stmt, branches );
    217247        assert( branches.size() == 1 );
    218248        return new FinallyStmt( dynamic_cast< CompoundStmt * >( branches.front() ) );
    219 }
     249} // build_finally
    220250
    221251WaitForStmt * build_waitfor( ExpressionNode * targetExpr, StatementNode * stmt, ExpressionNode * when ) {
     
    238268
    239269        return node;
    240 }
     270} // build_waitfor
    241271
    242272WaitForStmt * build_waitfor( ExpressionNode * targetExpr, StatementNode * stmt, ExpressionNode * when, WaitForStmt * node ) {
     
    257287
    258288        return node;
    259 }
     289} // build_waitfor
    260290
    261291WaitForStmt * build_waitfor_timeout( ExpressionNode * timeout, StatementNode * stmt, ExpressionNode * when ) {
     
    266296                node->timeout.statement = maybeMoveBuild<Statement >( stmt    );
    267297                node->timeout.condition = notZeroExpr( maybeMoveBuild<Expression>( when ) );
    268         }
    269         else {
     298        } else {
    270299                node->orelse.statement  = maybeMoveBuild<Statement >( stmt );
    271300                node->orelse.condition  = notZeroExpr( maybeMoveBuild<Expression>( when ) );
    272         }
     301        } // if
    273302
    274303        return node;
    275 }
     304} // build_waitfor_timeout
    276305
    277306WaitForStmt * build_waitfor_timeout( ExpressionNode * timeout, StatementNode * stmt, ExpressionNode * when,  StatementNode * else_stmt, ExpressionNode * else_when ) {
     
    286315
    287316        return node;
    288 }
     317} // build_waitfor_timeout
    289318
    290319WithStmt * build_with( ExpressionNode * exprs, StatementNode * stmt ) {
     
    293322        Statement * s = maybeMoveBuild<Statement>( stmt );
    294323        return new WithStmt( e, s );
    295 }
    296 
    297 Statement *build_compound( StatementNode *first ) {
    298         CompoundStmt *cs = new CompoundStmt();
     324} // build_with
     325
     326Statement * build_compound( StatementNode * first ) {
     327        CompoundStmt * cs = new CompoundStmt();
    299328        buildMoveList( first, cs->get_kids() );
    300329        return cs;
    301 }
    302 
    303 Statement *build_asmstmt( bool voltile, Expression *instruction, ExpressionNode *output, ExpressionNode *input, ExpressionNode *clobber, LabelNode *gotolabels ) {
     330} // build_compound
     331
     332Statement * build_asm( bool voltile, Expression * instruction, ExpressionNode * output, ExpressionNode * input, ExpressionNode * clobber, LabelNode * gotolabels ) {
    304333        std::list< Expression * > out, in;
    305334        std::list< ConstantExpr * > clob;
     
    309338        buildMoveList( clobber, clob );
    310339        return new AsmStmt( voltile, instruction, out, in, clob, gotolabels ? gotolabels->labels : noLabels );
    311 }
     340} // build_asm
     341
     342Statement * build_directive( string * directive ) {
     343        return new DirectiveStmt( *directive );
     344} // build_directive
    312345
    313346// Local Variables: //
  • src/Parser/TypeData.cc

    rf9feab8 r90152a4  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 25 18:33:41 2017
    13 // Update Count     : 587
     12// Last Modified On : Fri Jul 20 14:39:31 2018
     13// Update Count     : 622
    1414//
    1515
     
    3131using namespace std;
    3232
    33 TypeData::TypeData( Kind k ) : kind( k ), base( nullptr ), forall( nullptr ) /*, PTR1( (void*)(0xdeadbeefdeadbeef)), PTR2( (void*)(0xdeadbeefdeadbeef) ) */ {
     33TypeData::TypeData( Kind k ) : location( yylloc ), kind( k ), base( nullptr ), forall( nullptr ) /*, PTR1( (void*)(0xdeadbeefdeadbeef)), PTR2( (void*)(0xdeadbeefdeadbeef) ) */ {
    3434        switch ( kind ) {
    3535          case Unknown:
     
    3737          case Reference:
    3838          case EnumConstant:
     39          case GlobalScope:
    3940                // nothing else to initialize
    4041                break;
     
    5455                function.oldDeclList = nullptr;
    5556                function.body = nullptr;
    56                 function.newStyle = false;
     57                function.withExprs = nullptr;
    5758                break;
    5859                // Enum is an Aggregate, so both structures are initialized together.
     
    6263                enumeration.constants = nullptr;
    6364                enumeration.body = false;
     65                enumeration.anon = false;
     66                break;
    6467          case Aggregate:
    6568                // aggregate = new Aggregate_t;
     69                aggregate.kind = DeclarationNode::NoAggregate;
    6670                aggregate.name = nullptr;
    6771                aggregate.params = nullptr;
     
    6973                aggregate.fields = nullptr;
    7074                aggregate.body = false;
     75                aggregate.tagged = false;
     76                aggregate.parent = nullptr;
     77                aggregate.anon = false;
    7178                break;
    7279          case AggregateInst:
     
    7481                aggInst.aggregate = nullptr;
    7582                aggInst.params = nullptr;
    76                 aggInst.hoistType = false;;
     83                aggInst.hoistType = false;
    7784                break;
    7885          case Symbolic:
     
    94101          case Builtin:
    95102                // builtin = new Builtin_t;
     103                case Qualified:
     104                qualified.parent = nullptr;
     105                qualified.child = nullptr;
    96106                break;
    97107        } // switch
     
    108118          case Reference:
    109119          case EnumConstant:
     120          case GlobalScope:
    110121                // nothing to destroy
    111122                break;
     
    122133                delete function.oldDeclList;
    123134                delete function.body;
     135                delete function.withExprs;
    124136                // delete function;
    125137                break;
     
    160172                // delete builtin;
    161173                break;
     174          case Qualified:
     175                delete qualified.parent;
     176                delete qualified.child;
    162177        } // switch
    163178} // TypeData::~TypeData
     
    175190          case Pointer:
    176191          case Reference:
     192          case GlobalScope:
    177193                // nothing else to copy
    178194                break;
     
    193209                newtype->function.oldDeclList = maybeClone( function.oldDeclList );
    194210                newtype->function.body = maybeClone( function.body );
    195                 newtype->function.newStyle = function.newStyle;
     211                newtype->function.withExprs = maybeClone( function.withExprs );
    196212                break;
    197213          case Aggregate:
     214                newtype->aggregate.kind = aggregate.kind;
    198215                newtype->aggregate.name = aggregate.name ? new string( *aggregate.name ) : nullptr;
    199216                newtype->aggregate.params = maybeClone( aggregate.params );
    200217                newtype->aggregate.actuals = maybeClone( aggregate.actuals );
    201218                newtype->aggregate.fields = maybeClone( aggregate.fields );
    202                 newtype->aggregate.kind = aggregate.kind;
    203219                newtype->aggregate.body = aggregate.body;
     220                newtype->aggregate.anon = aggregate.anon;
    204221                newtype->aggregate.tagged = aggregate.tagged;
    205222                newtype->aggregate.parent = aggregate.parent ? new string( *aggregate.parent ) : nullptr;
     
    214231                newtype->enumeration.constants = maybeClone( enumeration.constants );
    215232                newtype->enumeration.body = enumeration.body;
     233                newtype->enumeration.anon = enumeration.anon;
    216234                break;
    217235          case Symbolic:
     
    233251                newtype->builtintype = builtintype;
    234252                break;
     253                case Qualified:
     254                newtype->qualified.parent = maybeClone( qualified.parent );
     255                newtype->qualified.child = maybeClone( qualified.child );
     256                break;
    235257        } // switch
    236258        return newtype;
     
    249271
    250272        switch ( kind ) {
    251           case Unknown:
    252                 os << "entity of unknown type ";
     273          case Basic:
     274                if ( signedness != DeclarationNode::NoSignedness ) os << DeclarationNode::signednessNames[ signedness ] << " ";
     275                if ( length != DeclarationNode::NoLength ) os << DeclarationNode::lengthNames[ length ] << " ";
     276                if ( complextype == DeclarationNode::NoComplexType ) { // basic type
     277                        assert( basictype != DeclarationNode::NoBasicType );
     278                        os << DeclarationNode::basicTypeNames[ basictype ] << " ";
     279                } else {                                                                                // complex type
     280                        // handle double _Complex
     281                        if ( basictype != DeclarationNode::NoBasicType ) os << DeclarationNode::basicTypeNames[ basictype ] << " ";
     282                        os << DeclarationNode::complexTypeNames[ complextype ] << " ";
     283                } // if
    253284                break;
    254285          case Pointer:
     
    259290                } // if
    260291                break;
    261           case EnumConstant:
    262                 os << "enumeration constant ";
    263                 break;
    264           case Basic:
    265                 if ( signedness != DeclarationNode::NoSignedness ) os << DeclarationNode::signednessNames[ signedness ] << " ";
    266                 if ( length != DeclarationNode::NoLength ) os << DeclarationNode::lengthNames[ length ] << " ";
    267                 assert( basictype != DeclarationNode::NoBasicType );
    268                 os << DeclarationNode::basicTypeNames[ basictype ] << " ";
    269                 if ( complextype != DeclarationNode::NoComplexType ) os << DeclarationNode::complexTypeNames[ complextype ] << " ";
     292          case Reference:
     293                os << "reference ";
     294                if ( base ) {
     295                        os << "to ";
     296                        base->print( os, indent );
     297                } // if
    270298                break;
    271299          case Array:
     
    353381                } // if
    354382                break;
    355           case SymbolicInst:
    356                 os << "instance of type " << *symbolic.name;
    357                 if ( symbolic.actuals ) {
    358                         os << " with parameters" << endl;
    359                         symbolic.actuals->printList( os, indent + 2 );
    360                 } // if
     383          case EnumConstant:
     384                os << "enumeration constant ";
    361385                break;
    362386          case Symbolic:
     
    380404                } // if
    381405                break;
     406          case SymbolicInst:
     407                os << *symbolic.name;
     408                if ( symbolic.actuals ) {
     409                        os << "(";
     410                        symbolic.actuals->printList( os, indent + 2 );
     411                        os << ")";
     412                } // if
     413                break;
    382414          case Tuple:
    383415                os << "tuple ";
     
    394426                break;
    395427          case Builtin:
    396                 os << "gcc builtin type";
     428                os << DeclarationNode::builtinTypeNames[builtintype];
     429                break;
     430          case GlobalScope:
     431                break;
     432          case Qualified:
     433                qualified.parent->print( os );
     434                os << ".";
     435                qualified.child->print( os );
     436                break;
     437          case Unknown:
     438                os << "entity of unknown type ";
    397439                break;
    398440          default:
     
    401443        } // switch
    402444} // TypeData::print
     445
     446const std::string * TypeData::leafName() const {
     447        switch ( kind ) {
     448          case Unknown:
     449          case Pointer:
     450          case Reference:
     451          case EnumConstant:
     452          case GlobalScope:
     453          case Array:
     454          case Basic:
     455          case Function:
     456          case AggregateInst:
     457          case Tuple:
     458          case Typeof:
     459          case Builtin:
     460                assertf(false, "Tried to get leaf name from kind without a name: %d", kind);
     461                break;
     462          case Aggregate:
     463                return aggregate.name;
     464          case Enum:
     465                return enumeration.name;
     466          case Symbolic:
     467          case SymbolicInst:
     468                return symbolic.name;
     469          case Qualified:
     470                return qualified.child->leafName();
     471        } // switch
     472        assert(false);
     473}
    403474
    404475
     
    460531                return new EnumInstType( buildQualifiers( td ), "" );
    461532          case TypeData::SymbolicInst:
    462                 return buildSymbolicInst( td );;
     533                return buildSymbolicInst( td );
    463534          case TypeData::Tuple:
    464535                return buildTuple( td );
     
    475546                        return new VarArgsType( buildQualifiers( td ) );
    476547                }
     548          case TypeData::GlobalScope:
     549                return new GlobalScopeType();
     550                case TypeData::Qualified:
     551                return new QualifiedType( buildQualifiers( td ), typebuild( td->qualified.parent ), typebuild( td->qualified.child ) );
    477552          case TypeData::Symbolic:
    478553          case TypeData::Enum:
     
    480555                assert( false );
    481556        } // switch
     557
    482558        return nullptr;
    483559} // typebuild
     
    489565        switch ( td->kind ) {
    490566          case TypeData::Aggregate:
    491                 if ( ! toplevel && td->aggregate.fields ) {
     567                if ( ! toplevel && td->aggregate.body ) {
    492568                        ret = td->clone();
    493569                } // if
    494570                break;
    495571          case TypeData::Enum:
    496                 if ( ! toplevel && td->enumeration.constants ) {
     572                if ( ! toplevel && td->enumeration.body ) {
    497573                        ret = td->clone();
    498574                } // if
     
    518594
    519595static string genTSError( string msg, DeclarationNode::BasicType basictype ) {
    520         throw SemanticError( string( "invalid type specifier \"" ) + msg + "\" for type \"" + DeclarationNode::basicTypeNames[basictype] + "\"." );
     596        SemanticError( yylloc, string( "invalid type specifier \"" ) + msg + "\" for type \"" + DeclarationNode::basicTypeNames[basictype] + "\"." );
    521597} // genTSError
    522598
     
    573649
    574650          case DeclarationNode::Int128:
    575                 ret = td->signedness == 1 ? BasicType::UnsignedInt128 : BasicType::SignedInt128;
     651                ret = td->signedness == DeclarationNode::Unsigned ? BasicType::UnsignedInt128 : BasicType::SignedInt128;
    576652                if ( td->length != DeclarationNode::NoLength ) {
    577653                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
     
    597673                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
    598674                } // if
    599                 if ( td->basictype == DeclarationNode::Float && td->length == DeclarationNode::Long ) {
     675                if ( td->basictype != DeclarationNode::Double && td->length == DeclarationNode::Long ) {
    600676                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
    601677                } // if
     
    603679                        const_cast<TypeData *>(td)->basictype = DeclarationNode::LongDouble;
    604680                } // if
     681
     682                if ( td->basictype == DeclarationNode::Float80 || td->basictype == DeclarationNode::Float128 ) {
     683                        // if ( td->complextype != DeclarationNode::NoComplexType ) {
     684                        //      genTSError( DeclarationNode::complexTypeNames[ td->complextype ], td->basictype );
     685                        // }
     686                        if ( td->basictype == DeclarationNode::Float80 ) ret = BasicType::Float80;
     687                        else ret = BasicType::Float128;
     688                        break;
     689                }
    605690
    606691                ret = floattype[ td->complextype ][ td->basictype - DeclarationNode::Float ];
     
    797882        assert( td->base );
    798883        if ( td->symbolic.isTypedef ) {
    799                 ret = new TypedefDecl( name, scs, typebuild( td->base ), linkage );
     884                ret = new TypedefDecl( name, td->location, scs, typebuild( td->base ), linkage );
    800885        } else {
    801886                ret = new TypeDecl( name, scs, typebuild( td->base ), TypeDecl::Dtype, true );
     
    861946                CompoundStmt * body = dynamic_cast< CompoundStmt * >( stmt );
    862947                decl = new FunctionDecl( name, scs, linkage, buildFunction( td ), body, attributes, funcSpec );
     948                buildList( td->function.withExprs, decl->withExprs );
    863949                return decl->set_asmName( asmName );
    864950        } else if ( td->kind == TypeData::Aggregate ) {
     
    877963FunctionType * buildFunction( const TypeData * td ) {
    878964        assert( td->kind == TypeData::Function );
    879         bool hasEllipsis = td->function.params ? td->function.params->get_hasEllipsis() : true;
    880         if ( ! td->function.params ) hasEllipsis = ! td->function.newStyle;
    881         FunctionType * ft = new FunctionType( buildQualifiers( td ), hasEllipsis );
    882         buildList( td->function.params, ft->get_parameters() );
    883         buildForall( td->forall, ft->get_forall() );
     965        FunctionType * ft = new FunctionType( buildQualifiers( td ), ! td->function.params || td->function.params->hasEllipsis );
     966        buildList( td->function.params, ft->parameters );
     967        buildForall( td->forall, ft->forall );
    884968        if ( td->base ) {
    885969                switch ( td->base->kind ) {
    886970                  case TypeData::Tuple:
    887                         buildList( td->base->tuple, ft->get_returnVals() );
     971                        buildList( td->base->tuple, ft->returnVals );
    888972                        break;
    889973                  default:
     
    9191003                                // type set => parameter name already transformed by a declaration names so there is a duplicate
    9201004                                // declaration name attempting a second transformation
    921                                 if ( param->type ) throw SemanticError( string( "duplicate declaration name " ) + *param->name );
     1005                                if ( param->type ) SemanticError( param->location, string( "duplicate declaration name " ) + *param->name );
    9221006                                // declaration type reset => declaration already transformed by a parameter name so there is a duplicate
    9231007                                // parameter name attempting a second transformation
    924                                 if ( ! decl->type ) throw SemanticError( string( "duplicate parameter name " ) + *param->name );
     1008                                if ( ! decl->type ) SemanticError( param->location, string( "duplicate parameter name " ) + *param->name );
    9251009                                param->type = decl->type;                               // set copy declaration type to parameter type
    9261010                                decl->type = nullptr;                                   // reset declaration type
     
    9291013                } // for
    9301014                // declaration type still set => type not moved to a matching parameter so there is a missing parameter name
    931                 if ( decl->type ) throw SemanticError( string( "missing name in parameter list " ) + *decl->name );
     1015                if ( decl->type ) SemanticError( decl->location, string( "missing name in parameter list " ) + *decl->name );
    9321016        } // for
    9331017
  • src/Parser/TypeData.h

    rf9feab8 r90152a4  
    1010// Created On       : Sat May 16 15:18:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Sep  1 23:33:45 2017
    13 // Update Count     : 190
     12// Last Modified On : Fri Jul 20 13:56:40 2018
     13// Update Count     : 195
    1414//
    1515
     
    2626
    2727struct TypeData {
    28         enum Kind { Basic, Pointer, Array, Reference, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,
    29                                 SymbolicInst, Tuple, Typeof, Builtin, Unknown };
     28        enum Kind { Basic, Pointer, Reference, Array, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,
     29                                SymbolicInst, Tuple, Typeof, Builtin, GlobalScope, Qualified, Unknown };
    3030
    3131        struct Aggregate_t {
     
    3636                DeclarationNode * fields;
    3737                bool body;
     38                bool anon;
    3839
    3940                bool tagged;
     
    5758                DeclarationNode * constants;
    5859                bool body;
     60                bool anon;
    5961        };
    6062
     
    6466                mutable DeclarationNode * oldDeclList;
    6567                StatementNode * body;
    66                 bool newStyle;
     68                ExpressionNode * withExprs;                                             // expressions from function's with_clause
    6769        };
    6870
     
    7476                DeclarationNode * assertions;
    7577        };
     78
     79        struct Qualified_t {                                                            // qualified type S.T
     80                TypeData * parent;
     81                TypeData * child;
     82        };
     83
     84        CodeLocation location;
    7685
    7786        Kind kind;
     
    8695        DeclarationNode * forall;
    8796
    88         // Basic_t basic;
    8997        Aggregate_t aggregate;
    9098        AggInst_t aggInst;
    9199        Array_t array;
    92100        Enumeration_t enumeration;
    93         // Variable_t variable;
    94101        Function_t function;
    95102        Symbolic_t symbolic;
     103        Qualified_t qualified;
    96104        DeclarationNode * tuple;
    97105        ExpressionNode * typeexpr;
     
    101109        void print( std::ostream &, int indent = 0 ) const;
    102110        TypeData * clone() const;
     111
     112        const std::string * leafName() const;
    103113};
    104114
     
    118128TupleType * buildTuple( const TypeData * );
    119129TypeofType * buildTypeof( const TypeData * );
    120 Declaration * buildDecl( const TypeData *, const std::string &, Type::StorageClasses, Expression *, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec, Expression * asmName, Initializer * init = nullptr, std::list< class Attribute * > attributes = std::list< class Attribute * >() );
     130Declaration * buildDecl( const TypeData *, const std::string &, Type::StorageClasses, Expression *, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec, Expression * asmName,
     131                                                 Initializer * init = nullptr, std::list< class Attribute * > attributes = std::list< class Attribute * >() );
    121132FunctionType * buildFunction( const TypeData * );
    122133void buildKRFunction( const TypeData::Function_t & function );
  • src/Parser/TypedefTable.cc

    rf9feab8 r90152a4  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // TypedefTable.cc -- 
     7// TypedefTable.cc --
    88//
    9 // Author           : Rodolfo G. Esteves
     9// Author           : Peter A. Buhr
    1010// Created On       : Sat May 16 15:20:13 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Aug 15 18:24:42 2016
    13 // Update Count     : 25
     12// Last Modified On : Wed Jul 25 15:32:35 2018
     13// Update Count     : 258
    1414//
    1515
    16 #include <ext/alloc_traits.h>    // for __alloc_traits<>::value_type
    17 #include <cassert>               // for assert
    18 #include <list>                  // for list, _List_iterator, list<>::iterator
    19 #include <map>                   // for _Rb_tree_iterator, _Rb_tree_const_it...
    20 #include <memory>                // for allocator_traits<>::value_type
    21 #include <utility>               // for pair
    2216
    23 #include "Parser/ParserTypes.h"  // for typedefTable
    24 #include "Parser/parser.hh"      // for IDENTIFIER
    2517#include "TypedefTable.h"
    26 
    27 using namespace std;
     18#include <cassert>                                                                              // for assert
     19#include <iostream>
    2820
    2921#if 0
    30 #include <iostream>
    31 
    32 #define debugPrint( x ) cerr << x
     22#define debugPrint( code ) code
    3323#else
    34 #define debugPrint( x )
     24#define debugPrint( code )
    3525#endif
    3626
    37 TypedefTable::TypedefTable() : currentScope( 0 ) {}
     27using namespace std;                                                                    // string, iostream
    3828
    39 bool TypedefTable::exists( const string &identifier ) {
    40         return table.count( identifier ) > 0;
    41 }
     29debugPrint(
     30static const char *kindName( int kind ) {
     31        switch ( kind ) {
     32          case IDENTIFIER: return "identifier";
     33          case TYPEDEFname: return "typedef";
     34          case TYPEGENname: return "typegen";
     35          default:
     36                cerr << "Error: cfa-cpp internal error, invalid kind of identifier" << endl;
     37                abort();
     38        } // switch
     39} // kindName
     40)
    4241
    43 int TypedefTable::isKind( const string &identifier ) const {
    44         tableType::const_iterator id_pos = table.find( identifier );
     42TypedefTable::~TypedefTable() {
     43        if ( ! SemanticErrorThrow && kindTable.currentScope() != 0 ) {
     44                cerr << "Error: cfa-cpp internal error, scope failure " << kindTable.currentScope() << endl;
     45                abort();
     46        } // if
     47} // TypedefTable::~TypedefTable
     48
     49bool TypedefTable::exists( const string & identifier ) {
     50        return kindTable.find( identifier ) != kindTable.end();
     51} // TypedefTable::exists
     52
     53bool TypedefTable::existsCurr( const string & identifier ) {
     54        return kindTable.findAt( kindTable.currentScope() - 1, identifier ) != kindTable.end();
     55} // TypedefTable::exists
     56
     57int TypedefTable::isKind( const string & identifier ) const {
     58        KindTable::const_iterator posn = kindTable.find( identifier );
    4559        // Name lookup defaults to identifier, and then the identifier's kind is set by the parser.
    46         if ( id_pos == table.end() ) return IDENTIFIER;
    47         return id_pos->second.begin()->kind;
    48 }
    49 
    50 void TypedefTable::changeKind( const string &identifier, kind_t kind ) {
    51         tableType::iterator id_pos = table.find( identifier );
    52         if ( id_pos == table.end() ) return;
    53         id_pos->second.begin()->kind = kind;
    54 }
     60        if ( posn == kindTable.end() ) return IDENTIFIER;
     61        return posn->second;
     62} // TypedefTable::isKind
    5563
    5664// SKULLDUGGERY: Generate a typedef for the aggregate name so the aggregate does not have to be qualified by
    57 // "struct". Only generate the typedef, if the name is not in use. The typedef is implicitly (silently) removed
    58 // if the name is explicitly used.
    59 void TypedefTable::makeTypedef( const string &name ) {
     65// "struct". Only generate the typedef, if the name is not in use. The typedef is implicitly (silently) removed if the
     66// name is explicitly used.
     67void TypedefTable::makeTypedef( const string & name, int kind ) {
     68//    Check for existence is necessary to handle:
     69//        struct Fred {};
     70//        void Fred();
     71//        void fred() {
     72//           struct Fred act; // do not add as type in this scope
     73//           Fred();
     74//        }
    6075        if ( ! typedefTable.exists( name ) ) {
    61                 typedefTable.addToEnclosingScope( name, TypedefTable::TD );
     76                typedefTable.addToEnclosingScope( name, kind, "MTD" );
    6277        } // if
    63 }
     78} // TypedefTable::makeTypedef
    6479
    65 void TypedefTable::addToScope( const std::string &identifier, kind_t kind, int scope ) {
    66         if ( currentTrait != "" && scope == contextScope ) {
    67                 DeferredEntry entry = { identifier, kind };
    68                 contexts[currentTrait].push_back( entry );
    69         } else {
    70                 debugPrint( "Adding " << identifier << " as kind " << kind << " scope " << scope << " from scope " << currentScope << endl );
    71                 Entry newEntry = { scope, kind };
    72                 tableType::iterator curPos = table.find( identifier );
    73                 if ( curPos == table.end()) {
    74                         list< Entry > newList;
    75                         newList.push_front( newEntry );
    76                         table[identifier] = newList;
    77                 } else {
    78                         list< Entry >::iterator listPos = (*curPos ).second.begin();
    79                         while ( listPos != (*curPos ).second.end() && listPos->scope > scope ) {
    80                                 listPos++;
    81                         } // while
    82                         (*curPos ).second.insert( listPos, newEntry );
    83                 } // if
    84         } // if
    85 }
     80void TypedefTable::addToScope( const string & identifier, int kind, const char * locn __attribute__((unused)) ) {
     81        auto scope = kindTable.currentScope();
     82        debugPrint( cerr << "Adding current at " << locn << " " << identifier << " as " << kindName( kind ) << " scope " << scope << endl );
     83        kindTable.insertAt( scope, identifier, kind );
     84} // TypedefTable::addToScope
    8685
    87 void TypedefTable::addToCurrentScope( const std::string &identifier, kind_t kind ) {
    88         addToScope( identifier, kind, currentScope );
    89 }
    90 
    91 void TypedefTable::addToCurrentScope( kind_t kind ) {
    92         addToCurrentScope( nextIdentifiers.top(), kind );
    93 }
    94 
    95 void TypedefTable::addToEnclosingScope( const std::string &identifier, kind_t kind ) {
    96         assert( currentScope >= 1 );
    97         addToScope( identifier, kind, currentScope - 1 );
    98 }
    99 
    100 void TypedefTable::addToEnclosingScope( kind_t kind ) {
    101         addToEnclosingScope( nextIdentifiers.top(), kind );
    102 }
    103 
    104 void TypedefTable::addToEnclosingScope2( const std::string &identifier, kind_t kind ) {
    105         assert( currentScope >= 2 );
    106         addToScope( identifier, kind, currentScope - 2 );
    107 }
    108 
    109 void TypedefTable::addToEnclosingScope2( kind_t kind ) {
    110         addToEnclosingScope2( nextIdentifiers.top(), kind );
    111 }
    112 
    113 void TypedefTable::setNextIdentifier( const std::string &identifier ) {
    114         nextIdentifiers.top() = identifier;
    115 }
    116 
    117 void TypedefTable::openTrait( const std::string &contextName ) {
    118         map< string, deferListType >::iterator i = contexts.find( contextName );
    119         if ( i != contexts.end() ) {
    120                 deferListType &entries = i->second;
    121                 for ( deferListType::iterator i = entries.begin(); i != entries.end(); i++) {
    122                         addToEnclosingScope( i->identifier, i->kind );
    123                 } // for
    124         } // if
    125 }
     86void TypedefTable::addToEnclosingScope( const string & identifier, int kind, const char * locn __attribute__((unused)) ) {
     87        auto scope = kindTable.currentScope() - 1 - kindTable.getNote( kindTable.currentScope() - 1 ).level;
     88//      auto scope = level - kindTable.getNote( kindTable.currentScope() - 1 ).level;
     89        debugPrint( cerr << "Adding enclosing at " << locn << " " << identifier << " as " << kindName( kind ) << " scope " << scope << " level " << level << " note " << kindTable.getNote( kindTable.currentScope() - 1 ).level << endl );
     90        auto ret = kindTable.insertAt( scope, identifier, kind );
     91        if ( ! ret.second ) ret.first->second = kind;   // exists => update
     92} // TypedefTable::addToEnclosingScope
    12693
    12794void TypedefTable::enterScope() {
    128         currentScope += 1;
    129         deferListStack.push( deferListType() );
    130         nextIdentifiers.push( "" );
    131         debugPrint( "Entering scope " << currentScope << ", nextIdentifiers size is " << nextIdentifiers.size() << endl );
    132 }
     95        kindTable.beginScope( (Note){ 0, false } );
     96        debugPrint( cerr << "Entering scope " << kindTable.currentScope() << " level " << level << endl; print() );
     97} // TypedefTable::enterScope
    13398
    13499void TypedefTable::leaveScope() {
    135         debugPrint( "Leaving scope " << currentScope << endl );
    136         for ( tableType::iterator i = table.begin(); i != table.end(); ) {
    137                 list< Entry > &declList = (*i).second;
    138                 while ( ! declList.empty() && declList.front().scope == currentScope ) {
    139                         declList.pop_front();
    140                 }
    141                 if ( declList.empty() ) {                                               // standard idom for erasing during traversal
    142                         table.erase( i++ );
    143                 } else
    144                         ++i;
    145         } // for
    146         currentScope -= 1;
    147         for ( deferListType::iterator i = deferListStack.top().begin(); i != deferListStack.top().end(); i++ ) {
    148                 addToCurrentScope( i->identifier, i->kind );
    149         } // for
    150         deferListStack.pop();
    151         debugPrint( "nextIdentifiers size is " << nextIdentifiers.size() << " top is " << nextIdentifiers.top() << endl );
    152         nextIdentifiers.pop();
    153 }
     100        debugPrint( cerr << "Leaving scope " << kindTable.currentScope() << endl; print() );
     101        kindTable.endScope();
     102} // TypedefTable::leaveScope
    154103
    155 void TypedefTable::enterTrait( const std::string &contextName ) {
    156         currentTrait = contextName;
    157         contextScope = currentScope;
    158 }
     104void TypedefTable::up( bool forall ) {
     105        level += 1;
     106        kindTable.getNote( kindTable.currentScope() ) = (Note){ level, forall || getEnclForall() };
     107        debugPrint( cerr << "Up " << " level " << level << " note " << kindTable.getNote( level ).level << ", " << kindTable.getNote( level ).forall << endl; );
     108} // TypedefTable::up
    159109
    160 void TypedefTable::leaveTrait() {
    161         currentTrait = "";
    162 }
     110void TypedefTable::down() {
     111        level -= 1;
     112        debugPrint( cerr << "Down " << " level " << level << " note " << kindTable.getNote( level ).level << endl; );
     113} // TypedefTable::down
    163114
    164115void TypedefTable::print( void ) const {
    165         for ( tableType::const_iterator i = table.begin(); i != table.end(); i++) {
    166                 debugPrint( (*i ).first << ": " );
    167                 list< Entry > declList = (*i).second;
    168                 for ( list< Entry >::const_iterator j = declList.begin(); j != declList.end(); j++ ) {
    169                         debugPrint( "(" << (*j).scope << " " << (*j).kind << ") " );
    170                 }
    171                 debugPrint( endl );
     116        KindTable::size_type scope = kindTable.currentScope();
     117        debugPrint( cerr << "[" << scope << "] " << kindTable.getNote( scope ).level << ", " << kindTable.getNote( scope ).forall << ":" );
     118        for ( KindTable::const_iterator i = kindTable.begin(); i != kindTable.end(); i++ ) {
     119                while ( i.get_level() != scope ) {
     120                        --scope;
     121                        debugPrint( cerr << endl << "[" << scope << "] " << kindTable.getNote( scope ).level << ", " << kindTable.getNote( scope ).forall << ":" );
     122                } // while
     123                debugPrint( cerr << " " << (*i).first << ":" << kindName( (*i).second ) );
    172124        } // for
    173 }
     125        while ( scope > 0 ) {
     126                --scope;
     127                debugPrint( cerr << endl << "[" << scope << "] " << kindTable.getNote( scope ).level << ", " << kindTable.getNote( scope ).forall << ":" );
     128        } // while
     129        debugPrint( cerr << endl );
     130} // TypedefTable::print
    174131
    175132// Local Variables: //
  • src/Parser/TypedefTable.h

    rf9feab8 r90152a4  
    77// TypedefTable.h --
    88//
    9 // Author           : Rodolfo G. Esteves
     9// Author           : Peter A. Buhr
    1010// Created On       : Sat May 16 15:24:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:33:14 2017
    13 // Update Count     : 34
     12// Last Modified On : Wed Jul 25 15:33:55 2018
     13// Update Count     : 114
    1414//
    1515
    1616#pragma once
    1717
    18 #include <list>       // for list
    19 #include <map>        // for map, map<>::value_compare
    20 #include <stack>      // for stack
    21 #include <string>     // for string
     18#include <string>                                                                               // for string
    2219
     20#include "Common/ScopedMap.h"                                                   // for ScopedMap
    2321#include "ParserTypes.h"
    24 #include "parser.hh"  // for IDENTIFIER, TYPEDEFname, TYPEGENname
     22#include "parser.hh"                                                                    // for IDENTIFIER, TYPEDEFname, TYPEGENname
    2523
    2624class TypedefTable {
     25        struct Note { size_t level; bool forall; };
     26        typedef ScopedMap< std::string, int, Note > KindTable;
     27        KindTable kindTable;   
     28        unsigned int level = 0;
    2729  public:
    28         enum kind_t { ID = IDENTIFIER, TD = TYPEDEFname, TG = TYPEGENname };
    29   private:
    30         struct Entry {
    31                 int scope;
    32                 kind_t kind;
    33         };
     30        ~TypedefTable();
    3431
    35         struct DeferredEntry {
    36                 std::string identifier;
    37                 kind_t kind;
    38         };
    39 
    40         typedef std::map< std::string, std::list< Entry > > tableType;
    41         tableType table;
    42 
    43         int currentScope;
    44         std::string currentTrait;
    45         int contextScope;
    46 
    47         typedef std::list< DeferredEntry > deferListType;
    48         std::stack< deferListType > deferListStack;
    49         std::map< std::string, deferListType > contexts;
    50 
    51         std::stack< std::string > nextIdentifiers;
    52 
    53         void addToScope( const std::string &identifier, kind_t kind, int scope );
    54   public:
    55         TypedefTable();
    56 
    57         bool exists( const std::string &identifier );
    58         int isKind( const std::string &identifier ) const;
    59         void changeKind( const std::string &identifier, kind_t kind );
    60 
    61         void makeTypedef( const std::string &name );
    62 
    63         // "addToCurrentScope" adds the identifier/type pair to the current scope. This does less than you think it does,
    64         // since each declaration is within its own scope.  Mostly useful for type parameters.
    65         void addToCurrentScope( const std::string &identifier, kind_t kind );
    66         void addToCurrentScope( kind_t kind );                  // use nextIdentifiers.top()
    67 
    68         // "addToEnclosingScope" adds the identifier/type pair to the scope that encloses the current one.  This is the
    69         // right way to handle type and typedef names
    70         void addToEnclosingScope( const std::string &identifier, kind_t kind );
    71         void addToEnclosingScope( kind_t kind );                // use nextIdentifiers.top()
    72 
    73         // "addToEnclosingScope2" adds the identifier/type pair to the scope that encloses the scope enclosing the the
    74         // current one.  This is the right way to handle assertion names
    75         void addToEnclosingScope2( const std::string &identifier, kind_t kind );
    76         void addToEnclosingScope2( kind_t kind );               // use nextIdentifiers.top()
    77 
    78         // set the next identifier to be used by an "add" operation without an identifier parameter within the current scope
    79         void setNextIdentifier( const std::string &identifier );
    80 
    81         // dump the definitions from a pre-defined context into the current scope
    82         void openTrait( const std::string &contextName );
     32        bool exists( const std::string & identifier );
     33        bool existsCurr( const std::string & identifier );
     34        int isKind( const std::string & identifier ) const;
     35        void makeTypedef( const std::string & name, int kind = TYPEDEFname );
     36        void addToScope( const std::string & identifier, int kind, const char * );
     37        void addToEnclosingScope( const std::string & identifier, int kind, const char * );
     38        bool getEnclForall() { return kindTable.getNote( kindTable.currentScope() -  1 ).forall; }
    8339
    8440        void enterScope();
    8541        void leaveScope();
    86         void enterTrait( const std::string &contextName );
    87         void leaveTrait();
    8842
    89         void print() const;
    90 };
     43        void up( bool );
     44        void down();
     45
     46        void print( void ) const;
     47}; // TypedefTable
    9148
    9249// Local Variables: //
  • src/Parser/lex.ll

    rf9feab8 r90152a4  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Wed Oct 25 13:53:56 2017
    13  * Update Count     : 634
     12 * Last Modified On : Wed Aug  8 17:23:17 2018
     13 * Update Count     : 685
    1414 */
    1515
     
    2525//**************************** Includes and Defines ****************************
    2626
     27// trigger before each matching rule's action
     28#define YY_USER_ACTION \
     29        yylloc.first_line = yylineno; \
     30        yylloc.first_column = column; \
     31        column += yyleng; \
     32        yylloc.last_column = column; \
     33        yylloc.last_line = yylineno; \
     34        yylloc.filename = yyfilename ? yyfilename : "";
    2735unsigned int column = 0;                                                                // position of the end of the last token parsed
    28 #define YY_USER_ACTION yylloc.first_line = yylineno; yylloc.first_column = column; column += yyleng; yylloc.last_column = column; yylloc.last_line = yylineno; yylloc.filename = yyfilename ? yyfilename : "";                          // trigger before each matching rule's action
    2936
    3037#include <string>
     
    4956#define NUMERIC_RETURN(x)       rm_underscore(); RETURN_VAL( x ) // numeric constant
    5057#define KEYWORD_RETURN(x)       RETURN_CHAR( x )                        // keyword
    51 #define QKEYWORD_RETURN(x)      typedefTable.isKind( yytext ); RETURN_VAL(x); // quasi-keyword
     58#define QKEYWORD_RETURN(x)      RETURN_VAL(x);                          // quasi-keyword
    5259#define IDENTIFIER_RETURN()     RETURN_VAL( typedefTable.isKind( yytext ) )
    5360#define ATTRIBUTE_RETURN()      RETURN_VAL( ATTR_IDENTIFIER )
    5461
    5562void rm_underscore() {
    56         // Remove underscores in numeric constant by copying the non-underscore characters to the front of the string.
     63        // SKULLDUGGERY: remove underscores (ok to shorten?)
    5764        yyleng = 0;
    58         for ( int i = 0; yytext[i] != '\0'; i += 1 ) {
    59                 if ( yytext[i] == '`' ) {
    60                         // copy user suffix
    61                         for ( ; yytext[i] != '\0'; i += 1 ) {
    62                                 yytext[yyleng] = yytext[i];
    63                                 yyleng += 1;
    64                         } // for
    65                         break;
    66                 } // if
     65        for ( int i = 0; yytext[i] != '\0'; i += 1 ) {          // copying non-underscore characters to front of string
    6766                if ( yytext[i] != '_' ) {
    6867                        yytext[yyleng] = yytext[i];
     
    7170        } // for
    7271        yytext[yyleng] = '\0';
    73 }
     72} // rm_underscore
    7473
    7574// Stop warning due to incorrectly generated flex code.
     
    7776%}
    7877
     78binary [0-1]
    7979octal [0-7]
    8080nonzero [1-9]
     
    8989attr_identifier "@"{identifier}
    9090
    91 user_suffix_opt ("`"{identifier})?
    92 
    9391                                // numeric constants, CFA: '_' in constant
    9492hex_quad {hex}("_"?{hex}){3}
    9593size_opt (8|16|32|64|128)?
    9694length ("ll"|"LL"|[lL]{size_opt})|("hh"|"HH"|[hH])
    97 integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]))?{user_suffix_opt}
     95integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]))?
    9896
    9997octal_digits ({octal})|({octal}({octal}|"_")*{octal})
     
    103101nonzero_digits ({nonzero})|({nonzero}({decimal}|"_")*{decimal})
    104102decimal_constant {nonzero_digits}{integer_suffix_opt}
     103
     104binary_digits ({binary})|({binary}({binary}|"_")*{binary})
     105binary_prefix "0"[bB]"_"?
     106binary_constant {binary_prefix}{binary_digits}{integer_suffix_opt}
    105107
    106108hex_digits ({hex})|({hex}({hex}|"_")*{hex})
     
    113115floating_length ([fFdDlL]|[lL]{floating_size})
    114116floating_suffix ({floating_length}?[iI]?)|([iI]{floating_length})
    115 floating_suffix_opt ("_"?({floating_suffix}|"DL"))?{user_suffix_opt}
     117floating_suffix_opt ("_"?({floating_suffix}|"DL"))?
    116118decimal_digits ({decimal})|({decimal}({decimal}|"_")*{decimal})
    117119floating_decimal {decimal_digits}"."{exponent}?{floating_suffix_opt}
     
    120122
    121123binary_exponent "_"?[pP]"_"?[+-]?{decimal_digits}
    122 hex_floating_suffix_opt ("_"?({floating_suffix}))?{user_suffix_opt}
     124hex_floating_suffix_opt ("_"?({floating_suffix}))?
    123125hex_floating_fraction ({hex_digits}?"."{hex_digits})|({hex_digits}".")
    124126hex_floating_constant {hex_prefix}(({hex_floating_fraction}{binary_exponent})|({hex_digits}{binary_exponent})){hex_floating_suffix_opt}
     
    179181}
    180182
    181                                 /* ignore preprocessor directives (for now) */
    182 ^{h_white}*"#"[^\n]*"\n" ;
     183                                /* preprocessor-style directives */
     184^{h_white}*"#"[^\n]*"\n" { RETURN_VAL( DIRECTIVE ); }
    183185
    184186                                /* ignore C style comments (ALSO HANDLED BY CPP) */
     
    203205__asm                   { KEYWORD_RETURN(ASM); }                                // GCC
    204206__asm__                 { KEYWORD_RETURN(ASM); }                                // GCC
    205 _At                             { KEYWORD_RETURN(AT); }                                 // CFA
    206207_Atomic                 { KEYWORD_RETURN(ATOMIC); }                             // C11
    207208__attribute             { KEYWORD_RETURN(ATTRIBUTE); }                  // GCC
     
    232233enum                    { KEYWORD_RETURN(ENUM); }
    233234__extension__   { KEYWORD_RETURN(EXTENSION); }                  // GCC
     235exception               { KEYWORD_RETURN(EXCEPTION); }                  // CFA
    234236extern                  { KEYWORD_RETURN(EXTERN); }
     237fallthrough             { KEYWORD_RETURN(FALLTHROUGH); }                // CFA
    235238fallthru                { KEYWORD_RETURN(FALLTHRU); }                   // CFA
    236 fallthrough             { KEYWORD_RETURN(FALLTHROUGH); }                // CFA
    237239finally                 { KEYWORD_RETURN(FINALLY); }                    // CFA
    238240float                   { KEYWORD_RETURN(FLOAT); }
     241_Float32                { KEYWORD_RETURN(FLOAT); }                              // GCC
     242_Float32x               { KEYWORD_RETURN(FLOAT); }                              // GCC
     243_Float64                { KEYWORD_RETURN(DOUBLE); }                             // GCC
     244_Float64x               { KEYWORD_RETURN(DOUBLE); }                             // GCC
    239245__float80               { KEYWORD_RETURN(FLOAT80); }                    // GCC
    240246float80                 { KEYWORD_RETURN(FLOAT80); }                    // GCC
     247_Float128               { KEYWORD_RETURN(FLOAT128); }                   // GCC
     248_Float128x              { KEYWORD_RETURN(FLOAT128); }                   // GCC
    241249__float128              { KEYWORD_RETURN(FLOAT128); }                   // GCC
    242250float128                { KEYWORD_RETURN(FLOAT128); }                   // GCC
     
    264272__builtin_offsetof { KEYWORD_RETURN(OFFSETOF); }                // GCC
    265273one_t                   { NUMERIC_RETURN(ONE_T); }                              // CFA
     274or                              { QKEYWORD_RETURN(WOR); }                               // CFA
    266275otype                   { KEYWORD_RETURN(OTYPE); }                              // CFA
    267276register                { KEYWORD_RETURN(REGISTER); }
     
    300309__volatile__    { KEYWORD_RETURN(VOLATILE); }                   // GCC
    301310waitfor                 { KEYWORD_RETURN(WAITFOR); }
    302 or                              { QKEYWORD_RETURN(WOR); }                               // CFA
    303311when                    { KEYWORD_RETURN(WHEN); }
    304312while                   { KEYWORD_RETURN(WHILE); }
     
    308316                                /* identifier */
    309317{identifier}    { IDENTIFIER_RETURN(); }
     318"`"{identifier}"`" {                                                                    // CFA
     319        yytext[yyleng - 1] = '\0'; yytext += 1;                         // SKULLDUGGERY: remove backquotes (ok to shorten?)
     320        IDENTIFIER_RETURN();
     321}
    310322{attr_identifier} { ATTRIBUTE_RETURN(); }
    311 "`"                             { BEGIN BKQUOTE; }
    312 <BKQUOTE>{identifier} { IDENTIFIER_RETURN(); }
    313 <BKQUOTE>"`"    { BEGIN 0; }
    314323
    315324                                /* numeric constants */
     325{binary_constant} { NUMERIC_RETURN(INTEGERconstant); }
     326{octal_constant} { NUMERIC_RETURN(INTEGERconstant); }
    316327{decimal_constant} { NUMERIC_RETURN(INTEGERconstant); }
    317 {octal_constant} { NUMERIC_RETURN(INTEGERconstant); }
    318328{hex_constant}  { NUMERIC_RETURN(INTEGERconstant); }
    319329{floating_decimal}      { NUMERIC_RETURN(FLOATING_DECIMALconstant); } // must appear before floating_constant
     
    325335({cwide_prefix}[_]?)?['] { BEGIN QUOTE; rm_underscore(); strtext = new string( yytext, yyleng ); }
    326336<QUOTE>[^'\\\n]* { strtext->append( yytext, yyleng ); }
    327 <QUOTE>['\n]{user_suffix_opt}   { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(CHARACTERconstant); }
     337<QUOTE>['\n]    { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(CHARACTERconstant); }
    328338                                /* ' stop editor highlighting */
    329339
     
    331341({swide_prefix}[_]?)?["] { BEGIN STRING; rm_underscore(); strtext = new string( yytext, yyleng ); }
    332342<STRING>[^"\\\n]* { strtext->append( yytext, yyleng ); }
    333 <STRING>["\n]{user_suffix_opt}  { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(STRINGliteral); }
     343<STRING>["\n]   { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(STRINGliteral); }
    334344                                /* " stop editor highlighting */
    335345
     
    341351                                /* punctuation */
    342352"@"                             { ASCIIOP_RETURN(); }
     353"`"                             { ASCIIOP_RETURN(); }
    343354"["                             { ASCIIOP_RETURN(); }
    344355"]"                             { ASCIIOP_RETURN(); }
     
    399410">>="                   { NAMEDOP_RETURN(RSassign); }
    400411
     412"~="                    { NAMEDOP_RETURN(Erange); }                             // CFA
    401413"@="                    { NAMEDOP_RETURN(ATassign); }                   // CFA
    402414
     
    405417"?"({op_unary_pre_post}|"()"|"[?]"|"{}") { IDENTIFIER_RETURN(); }
    406418"^?{}"                  { IDENTIFIER_RETURN(); }
    407 "?`"{identifier} { IDENTIFIER_RETURN(); }                               // unit operator
     419"?`"{identifier} { IDENTIFIER_RETURN(); }                               // postfix operator
    408420"?"{op_binary_over}"?"  { IDENTIFIER_RETURN(); }                // binary
    409421        /*
     
    448460
    449461%%
     462
    450463// ----end of lexer----
    451464
    452465void yyerror( const char * errmsg ) {
    453         cout << (yyfilename ? yyfilename : "*unknown file*") << ':' << yylineno << ':' << column - yyleng + 1
    454                  << ": " << SemanticError::error_str() << errmsg << " at token \"" << (yytext[0] == '\0' ? "EOF" : yytext) << '"' << endl;
     466        SemanticErrorThrow = true;
     467        cerr << (yyfilename ? yyfilename : "*unknown file*") << ':' << yylineno << ':' << column - yyleng + 1
     468                 << ": " << ErrorHelpers::error_str() << errmsg << " at token \"" << (yytext[0] == '\0' ? "EOF" : yytext) << '"' << endl;
    455469}
    456470
  • src/Parser/module.mk

    rf9feab8 r90152a4  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk -- 
     8## module.mk --
    99##
    1010## Author           : Peter A. Buhr
     
    3131       Parser/parserutility.cc
    3232
    33 MAINTAINERCLEANFILES += Parser/parser.output
     33MOSTLYCLEANFILES += Parser/parser.hh Parser/parser.output
  • src/Parser/parser.yy

    rf9feab8 r90152a4  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Nov 27 17:23:35 2017
    13 // Update Count     : 2992
     12// Last Modified On : Wed Aug  8 17:50:07 2018
     13// Update Count     : 3998
    1414//
    1515
     
    115115} // distExt
    116116
     117void distInl( DeclarationNode * declaration ) {
     118        // distribute EXTENSION across all declarations
     119        for ( DeclarationNode *iter = declaration; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) {
     120                iter->set_inLine( true );
     121        } // for
     122} // distInl
     123
     124void distQual( DeclarationNode * declaration, DeclarationNode * qualifiers ) {
     125        // distribute qualifiers across all non-variable declarations in a distribution statemement
     126        for ( DeclarationNode * iter = declaration; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) {
     127                // SKULLDUGGERY: Distributions are parsed inside out, so qualifiers are added to declarations inside out. Since
     128                // addQualifiers appends to the back of the list, the forall clauses are in the wrong order (right to left). To
     129                // get the qualifiers in the correct order and still use addQualifiers (otherwise, 90% of addQualifiers has to
     130                // be copied to add to front), the appropriate forall pointers are interchanged before calling addQualifiers.
     131                DeclarationNode * clone = qualifiers->clone();
     132                if ( qualifiers->type ) {                                               // forall clause ? (handles SC)
     133                        if ( iter->type->kind == TypeData::Aggregate ) { // struct/union ?
     134                                swap( clone->type->forall, iter->type->aggregate.params );
     135                                iter->addQualifiers( clone );
     136                        } else if ( iter->type->kind == TypeData::AggregateInst && iter->type->aggInst.aggregate->aggregate.body ) { // struct/union ?
     137                                // Create temporary node to hold aggregate, call addQualifiers as above, then put nodes back together.
     138                                DeclarationNode newnode;
     139                                swap( newnode.type, iter->type->aggInst.aggregate );
     140                                swap( clone->type->forall, newnode.type->aggregate.params );
     141                                newnode.addQualifiers( clone );
     142                                swap( newnode.type, iter->type->aggInst.aggregate );
     143                        } else if ( iter->type->kind == TypeData::Function ) { // routines ?
     144                                swap( clone->type->forall, iter->type->forall );
     145                                iter->addQualifiers( clone );
     146                        } // if
     147                } else {                                                                                // just SC qualifiers
     148                        iter->addQualifiers( clone );
     149                } // if
     150        } // for
     151        delete qualifiers;
     152} // distQual
     153
    117154// There is an ambiguity for inline generic-routine return-types and generic routines.
    118155//   forall( otype T ) struct S { int i; } bar( T ) {}
    119156// Does the forall bind to the struct or the routine, and how would it be possible to explicitly specify the binding.
    120157//   forall( otype T ) struct S { int T; } forall( otype W ) bar( W ) {}
     158// Currently, the forall is associated with the routine, and the generic type has to be separately defined:
     159//   forall( otype T ) struct S { int T; };
     160//   forall( otype W ) bar( W ) {}
    121161
    122162void rebindForall( DeclarationNode * declSpec, DeclarationNode * funcDecl ) {
    123         if ( declSpec->type->kind == TypeData::Aggregate ) { // return is aggregate definition
     163        if ( declSpec->type->kind == TypeData::Aggregate ) { // ignore aggregate definition
    124164                funcDecl->type->forall = declSpec->type->aggregate.params; // move forall from aggregate to function type
    125165                declSpec->type->aggregate.params = nullptr;
     
    127167} // rebindForall
    128168
    129 bool forall = false;                                                                    // aggregate have one or more forall qualifiers ?
     169NameExpr * build_postfix_name( const string * name ) {
     170        NameExpr * new_name = build_varref( new string( "?`" + *name ) );
     171        delete name;
     172        return new_name;
     173} // build_postfix_name
     174
     175DeclarationNode * fieldDecl( DeclarationNode * typeSpec, DeclarationNode * fieldList ) {
     176        if ( ! fieldList ) {                                                            // field declarator ?
     177                if ( ! ( typeSpec->type && typeSpec->type->kind == TypeData::Aggregate ) ) {
     178                        stringstream ss;
     179                        typeSpec->type->print( ss );
     180                        SemanticWarning( yylloc, Warning::SuperfluousDecl, ss.str().c_str() );
     181                        return nullptr;
     182                } // if
     183                fieldList = DeclarationNode::newName( nullptr );
     184        } // if
     185        return distAttr( typeSpec, fieldList );                         // mark all fields in list
     186} // fieldDecl
     187
     188ForCtrl * forCtrl( ExpressionNode * type, string * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) {
     189        return new ForCtrl(
     190                distAttr( DeclarationNode::newTypeof( type ), DeclarationNode::newName( index )->addInitializer( new InitializerNode( start ) ) ),
     191                new ExpressionNode( build_binary_val( compop, new ExpressionNode( build_varref( new string( *index ) ) ), comp ) ),
     192                new ExpressionNode( build_binary_val( OperKinds::PlusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) );
     193} // forCtrl
     194
     195
     196bool forall = false, yyy = false;                                               // aggregate have one or more forall qualifiers ?
    130197
    131198// https://www.gnu.org/software/bison/manual/bison.html#Location-Type
     
    158225        WaitForStmt * wfs;
    159226        Expression * constant;
    160         IfCtl * ifctl;
    161         ForCtl * fctl;
     227        IfCtrl * ifctl;
     228        ForCtrl * fctl;
     229        enum OperKinds compop;
    162230        LabelNode * label;
    163231        InitializerNode * in;
     
    166234        bool flag;
    167235        CatchStmt::Kind catch_kind;
     236        GenericExpr * genexpr;
    168237}
    169238
     
    187256%token TYPEOF LABEL                                                                             // GCC
    188257%token ENUM STRUCT UNION
     258%token EXCEPTION                                                                                // CFA
    189259%token COROUTINE MONITOR THREAD                                                 // CFA
    190260%token OTYPE FTYPE DTYPE TTYPE TRAIT                                    // CFA
     
    201271%token<tok> ATTR_IDENTIFIER             ATTR_TYPEDEFname                ATTR_TYPEGENname
    202272%token<tok> INTEGERconstant             CHARACTERconstant               STRINGliteral
     273%token<tok> DIRECTIVE
    203274// Floating point constant is broken into three kinds of tokens because of the ambiguity with tuple indexing and
    204275// overloading constants 0/1, e.g., x.1 is lexed as (x)(.1), where (.1) is a factional constant, but is semantically
     
    219290%token ANDassign        ERassign        ORassign                                // &=   ^=      |=
    220291
     292%token Erange                                                                                   // ~=
    221293%token ATassign                                                                                 // @=
    222294
     
    241313%type<ifctl> if_control_expression
    242314%type<fctl> for_control_expression
     315%type<compop> inclexcl
    243316%type<en> subrange
    244317%type<decl> asm_name_opt
     
    248321%type<flag> asm_volatile_opt
    249322%type<en> handler_predicate_opt
     323%type<genexpr> generic_association generic_assoc_list
    250324
    251325// statements
    252326%type<sn> statement                                             labeled_statement                       compound_statement
    253327%type<sn> statement_decl                                statement_decl_list                     statement_list_nodecl
    254 %type<sn> selection_statement
    255 %type<sn> switch_clause_list_opt                switch_clause_list                      choose_clause_list_opt          choose_clause_list
     328%type<sn> selection_statement                   if_statement
     329%type<sn> switch_clause_list_opt                switch_clause_list
    256330%type<en> case_value
    257331%type<sn> case_clause                                   case_value_list                         case_label                                      case_label_list
    258 %type<sn> fall_through                                  fall_through_opt
    259332%type<sn> iteration_statement                   jump_statement
    260333%type<sn> expression_statement                  asm_statement
    261 %type<sn> with_statement                                with_clause_opt
     334%type<sn> with_statement
     335%type<en> with_clause_opt
    262336%type<sn> exception_statement                   handler_clause                          finally_clause
    263337%type<catch_kind> handler_key
     
    275349%type<decl> aggregate_type aggregate_type_nobody
    276350
    277 %type<decl> assertion assertion_list_opt
     351%type<decl> assertion assertion_list assertion_list_opt
    278352
    279353%type<en>   bit_subrange_size_opt bit_subrange_size
     
    291365%type<en> enumerator_value_opt
    292366
    293 %type<decl> exception_declaration external_definition external_definition_list external_definition_list_opt
    294 
    295 %type<decl> field_declaration field_declaration_list field_declarator field_declaring_list
    296 %type<en> field field_list field_name fraction_constants
     367%type<decl> external_definition external_definition_list external_definition_list_opt
     368
     369%type<decl> exception_declaration
     370
     371%type<decl> field_declaration_list_opt field_declaration field_declaring_list_opt field_declarator field_abstract_list_opt field_abstract
     372%type<en> field field_name_list field_name fraction_constants_opt
    297373
    298374%type<decl> external_function_definition function_definition function_array function_declarator function_no_ptr function_ptr
     
    307383%type<decl> cfa_array_parameter_1st_dimension
    308384
    309 %type<decl> cfa_trait_declaring_list cfa_declaration cfa_field_declaring_list
     385%type<decl> cfa_trait_declaring_list cfa_declaration cfa_field_declaring_list cfa_field_abstract_list
    310386%type<decl> cfa_function_declaration cfa_function_return cfa_function_specifier
    311387
     
    313389%type<decl> cfa_identifier_parameter_declarator_tuple cfa_identifier_parameter_ptr
    314390
    315 %type<decl> cfa_parameter_declaration cfa_parameter_list cfa_parameter_type_list cfa_parameter_type_list_opt
     391%type<decl> cfa_parameter_declaration cfa_parameter_list cfa_parameter_ellipsis_list_opt
    316392
    317393%type<decl> cfa_typedef_declaration cfa_variable_declaration cfa_variable_specifier
    318394
    319 %type<decl> c_declaration
     395%type<decl> c_declaration static_assert
    320396%type<decl> KR_function_declarator KR_function_no_ptr KR_function_ptr KR_function_array
    321 %type<decl> KR_declaration_list KR_declaration_list_opt
    322 
    323 %type<decl> parameter_declaration parameter_list parameter_type_list
    324 %type<decl> parameter_type_list_opt
     397%type<decl> KR_parameter_list KR_parameter_list_opt
     398
     399%type<decl> parameter_declaration parameter_list parameter_type_list_opt
    325400
    326401%type<decl> paren_identifier paren_type
     
    343418%type<decl> type_parameter type_parameter_list type_initializer_opt
    344419
    345 %type<en> type_list
     420%type<en> type_parameters_opt type_list
    346421
    347422%type<decl> type_qualifier type_qualifier_name forall type_qualifier_list_opt type_qualifier_list
     
    354429
    355430// initializers
    356 %type<in>  initializer initializer_list initializer_opt
     431%type<in>  initializer initializer_list_opt initializer_opt
    357432
    358433// designators
     
    378453//   Foo ( *fp )( int );
    379454//   `---'                                              matches start of TYPEGENname '('
    380 // Must be:
     455// must be:
    381456//   Foo( int ) ( *fp )( int );
     457// The same problem occurs here:
     458//   forall( otype T ) struct Foo { T v; } ( *fp )( int );
     459// must be:
     460//   forall( otype T ) struct Foo { T v; } ( int ) ( *fp )( int );
    382461
    383462// Order of these lines matters (low-to-high precedence).
    384463%precedence TYPEGENname
     464%precedence '}'
    385465%precedence '('
    386466
    387 %locations                      // support location tracking for error messages
     467%locations                                                                                              // support location tracking for error messages
    388468
    389469%start translation_unit                                                                 // parse-tree root
     
    392472//************************* Namespace Management ********************************
    393473
    394 // The grammar in the ANSI C standard is not strictly context-free, since it relies upon the distinct terminal symbols
    395 // "identifier", "TYPEDEFname", and "TYPEGENname" that are lexically identical.  While it is possible to write a purely
    396 // context-free grammar, such a grammar would obscure the relationship between syntactic and semantic constructs.
    397 // Hence, this grammar uses the ANSI style.
    398 //
    399 // Cforall compounds this problem by introducing type names local to the scope of a declaration (for instance, those
    400 // introduced through "forall" qualifiers), and by introducing "type generators" -- parameterized types.  This latter
    401 // type name creates a third class of identifiers that must be distinguished by the scanner.
    402 //
    403 // Since the scanner cannot distinguish among the different classes of identifiers without some context information, it
    404 // accesses a data structure (TypedefTable) to allow classification of an identifier that it has just read.  Semantic
    405 // actions during the parser update this data structure when the class of identifiers change.
    406 //
    407 // Because the Cforall language is block-scoped, there is the possibility that an identifier can change its class in a
    408 // local scope; it must revert to its original class at the end of the block.  Since type names can be local to a
    409 // particular declaration, each declaration is itself a scope.  This requires distinguishing between type names that are
    410 // local to the current declaration scope and those that persist past the end of the declaration (i.e., names defined in
    411 // "typedef" or "otype" declarations).
    412 //
    413 // The non-terminals "push" and "pop" derive the empty string; their only use is to denote the opening and closing of
    414 // scopes.  Every push must have a matching pop, although it is regrettable the matching pairs do not always occur
    415 // within the same rule.  These non-terminals may appear in more contexts than strictly necessary from a semantic point
    416 // of view.  Unfortunately, these extra rules are necessary to prevent parsing conflicts -- the parser may not have
    417 // enough context and look-ahead information to decide whether a new scope is necessary, so the effect of these extra
    418 // rules is to open a new scope unconditionally.  As the grammar evolves, it may be neccesary to add or move around
    419 // "push" and "pop" nonterminals to resolve conflicts of this sort.
     474// The C grammar is not context free because it relies on the distinct terminal symbols "identifier" and "TYPEDEFname",
     475// which are lexically identical.
     476//
     477//   typedef int foo; // identifier foo must now be scanned as TYPEDEFname
     478//   foo f;           // to allow it to appear in this context
     479//
     480// While it may be possible to write a purely context-free grammar, such a grammar would obscure the relationship
     481// between syntactic and semantic constructs.  Cforall compounds this problem by introducing type names local to the
     482// scope of a declaration (for instance, those introduced through "forall" qualifiers), and by introducing "type
     483// generators" -- parameterized types.  This latter type name creates a third class of identifiers, "TYPEGENname", which
     484// must be distinguished by the lexical scanner.
     485//
     486// Since the scanner cannot distinguish among the different classes of identifiers without some context information,
     487// there is a type table (typedefTable), which holds type names and identifiers that override type names, for each named
     488// scope. During parsing, semantic actions update the type table by adding new identifiers in the current scope. For
     489// each context that introduces a name scope, a new level is created in the type table and that level is popped on
     490// exiting the scope.  Since type names can be local to a particular declaration, each declaration is itself a scope.
     491// This requires distinguishing between type names that are local to the current declaration scope and those that
     492// persist past the end of the declaration (i.e., names defined in "typedef" or "otype" declarations).
     493//
     494// The non-terminals "push" and "pop" denote the opening and closing of named scopes. Every push has a matching pop in
     495// the production rule. There are multiple lists of declarations, where each declaration is a named scope, so pop/push
     496// around the list separator.
     497//
     498//  int f( forall(T) T (*f1) T , forall( S ) S (*f2)( S ) );
     499//      push               pop   push                   pop
    420500
    421501push:
     
    443523        ;
    444524
    445 identifier:
    446         IDENTIFIER
    447         | ATTR_IDENTIFIER                                                                       // CFA
    448         | quasi_keyword
    449         ;
    450 
    451525no_attr_identifier:
    452526        IDENTIFIER
    453527        | quasi_keyword
     528        | '@'                                                                                           // CFA
     529                { Token tok = { new string( DeclarationNode::anonymous.newName() ), yylval.tok.loc }; $$ = tok; }
     530        ;
     531
     532identifier:
     533        no_attr_identifier
     534        | ATTR_IDENTIFIER                                                                       // CFA
    454535        ;
    455536
     
    480561        | '(' compound_statement ')'                                            // GCC, lambda expression
    481562                { $$ = new ExpressionNode( new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >($2) ) ) ); }
     563        | constant '`' IDENTIFIER                                                       // CFA, postfix call
     564                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }
     565        | string_literal '`' IDENTIFIER                                         // CFA, postfix call
     566                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( $1 ) ) ); }
     567        | IDENTIFIER '`' IDENTIFIER                                                     // CFA, postfix call
     568                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( build_varref( $1 ) ) ) ); }
     569        | tuple '`' IDENTIFIER                                                          // CFA, postfix call
     570                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }
     571        | '(' comma_expression ')' '`' IDENTIFIER                       // CFA, postfix call
     572                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $5 ) ), $2 ) ); }
    482573        | type_name '.' no_attr_identifier                                      // CFA, nested type
    483                 { throw SemanticError("Qualified names are currently unimplemented."); $$ = nullptr; }                                                          // FIX ME
    484         | type_name '.' '[' push field_list pop ']'                     // CFA, nested type / tuple field selector
    485                 { throw SemanticError("Qualified names are currently unimplemented."); $$ = nullptr; }                                                          // FIX ME
     574                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     575        | type_name '.' '[' field_name_list ']'                         // CFA, nested type / tuple field selector
     576                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     577        | GENERIC '(' assignment_expression ',' generic_assoc_list ')' // C11
     578                {
     579                        // add the missing control expression to the GenericExpr and return it
     580                        $5->control = maybeMoveBuild<Expression>( $3 );
     581                        $$ = new ExpressionNode( $5 );
     582                }
     583        ;
     584
     585generic_assoc_list:                                                                             // C11
     586        generic_association
     587        | generic_assoc_list ',' generic_association
     588                {
     589                        // steal the association node from the singleton and delete the wrapper
     590                        $1->associations.splice($1->associations.end(), $3->associations);
     591                        delete $3;
     592                        $$ = $1;
     593                }
     594        ;
     595
     596generic_association:                                                                    // C11
     597        type_no_function ':' assignment_expression
     598                {
     599                        // create a GenericExpr wrapper with one association pair
     600                        $$ = new GenericExpr( nullptr, { { maybeMoveBuildType($1), maybeMoveBuild<Expression>($3) } } );
     601                }
     602        | DEFAULT ':' assignment_expression
     603                { $$ = new GenericExpr( nullptr, { { maybeMoveBuild<Expression>($3) } } ); }
    486604        ;
    487605
    488606postfix_expression:
    489607        primary_expression
    490         | postfix_expression '[' push assignment_expression pop ']'
     608        | postfix_expression '[' assignment_expression ']'
    491609                // CFA, comma_expression disallowed in this context because it results in a common user error: subscripting a
    492610                // matrix with x[i,j] instead of x[i][j]. While this change is not backwards compatible, there seems to be
    493611                // little advantage to this feature and many disadvantages. It is possible to write x[(i,j)] in CFA, which is
    494612                // equivalent to the old x[i,j].
    495                 { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, $4 ) ); }
     613                { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, $3 ) ); }
    496614        | postfix_expression '{' argument_expression_list '}' // CFA, constructor call
    497615                {
     
    504622        | postfix_expression '.' no_attr_identifier
    505623                { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); }
    506         | postfix_expression '.' '[' push field_list pop ']' // CFA, tuple field selector
    507                 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); }
     624        | postfix_expression '.' INTEGERconstant                        // CFA, tuple index
     625                { $$ = new ExpressionNode( build_fieldSel( $1, build_constantInteger( *$3 ) ) ); }
    508626        | postfix_expression FLOATING_FRACTIONconstant          // CFA, tuple index
    509627                { $$ = new ExpressionNode( build_fieldSel( $1, build_field_name_FLOATING_FRACTIONconstant( *$2 ) ) ); }
     628        | postfix_expression '.' '[' field_name_list ']'        // CFA, tuple field selector
     629                { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $4 ) ) ); }
    510630        | postfix_expression ARROW no_attr_identifier
    511631                {
    512632                        $$ = new ExpressionNode( build_pfieldSel( $1, *$3 == "0" || *$3 == "1" ? build_constantInteger( *$3 ) : build_varref( $3 ) ) );
    513633                }
    514         | postfix_expression ARROW '[' push field_list pop ']' // CFA, tuple field selector
    515                         { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }
    516634        | postfix_expression ARROW INTEGERconstant                      // CFA, tuple index
    517635                { $$ = new ExpressionNode( build_pfieldSel( $1, build_constantInteger( *$3 ) ) ); }
     636        | postfix_expression ARROW '[' field_name_list ']'      // CFA, tuple field selector
     637                { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $4 ) ) ); }
    518638        | postfix_expression ICR
    519639                { $$ = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, $1 ) ); }
    520640        | postfix_expression DECR
    521641                { $$ = new ExpressionNode( build_unary_ptr( OperKinds::DecrPost, $1 ) ); }
    522         | '(' type_no_function ')' '{' initializer_list comma_opt '}' // C99, compound-literal
     642        | '(' type_no_function ')' '{' initializer_list_opt comma_opt '}' // C99, compound-literal
    523643                { $$ = new ExpressionNode( build_compoundLiteral( $2, new InitializerNode( $5, true ) ) ); }
     644        | '(' type_no_function ')' '@' '{' initializer_list_opt comma_opt '}' // CFA, explicit C compound-literal
     645                { $$ = new ExpressionNode( build_compoundLiteral( $2, (new InitializerNode( $6, true ))->set_maybeConstructed( false ) ) ); }
    524646        | '^' primary_expression '{' argument_expression_list '}' // CFA
    525647                {
     
    539661        // empty
    540662                { $$ = nullptr; }
    541         // | '@'                                                                                                // use default argument
    542         //      { $$ = new ExpressionNode( build_constantInteger( *new string( "2" ) ) ); }
     663        | '?'                                                                                           // CFA, default parameter
     664                { SemanticError( yylloc, "Default parameter for argument is currently unimplemented." ); $$ = nullptr; }
     665                // { $$ = new ExpressionNode( build_constantInteger( *new string( "2" ) ) ); }
    543666        | assignment_expression
    544667        ;
    545668
    546 field_list:                                                                                             // CFA, tuple field selector
     669field_name_list:                                                                                // CFA, tuple field selector
    547670        field
    548         | field_list ',' field                                          { $$ = (ExpressionNode *)$1->set_last( $3 ); }
     671        | field_name_list ',' field                                     { $$ = (ExpressionNode *)$1->set_last( $3 ); }
    549672        ;
    550673
     
    553676        | FLOATING_DECIMALconstant field
    554677                { $$ = new ExpressionNode( build_fieldSel( new ExpressionNode( build_field_name_FLOATING_DECIMALconstant( *$1 ) ), maybeMoveBuild<Expression>( $2 ) ) ); }
    555         | FLOATING_DECIMALconstant '[' push field_list pop ']'
    556                 { $$ = new ExpressionNode( build_fieldSel( new ExpressionNode( build_field_name_FLOATING_DECIMALconstant( *$1 ) ), build_tuple( $4 ) ) ); }
     678        | FLOATING_DECIMALconstant '[' field_name_list ']'
     679                { $$ = new ExpressionNode( build_fieldSel( new ExpressionNode( build_field_name_FLOATING_DECIMALconstant( *$1 ) ), build_tuple( $3 ) ) ); }
    557680        | field_name '.' field
    558681                { $$ = new ExpressionNode( build_fieldSel( $1, maybeMoveBuild<Expression>( $3 ) ) ); }
    559         | field_name '.' '[' push field_list pop ']'
    560                 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); }
     682        | field_name '.' '[' field_name_list ']'
     683                { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $4 ) ) ); }
    561684        | field_name ARROW field
    562685                { $$ = new ExpressionNode( build_pfieldSel( $1, maybeMoveBuild<Expression>( $3 ) ) ); }
    563         | field_name ARROW '[' push field_list pop ']'
    564                 { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }
     686        | field_name ARROW '[' field_name_list ']'
     687                { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $4 ) ) ); }
    565688        ;
    566689
    567690field_name:
    568         INTEGERconstant fraction_constants
     691        INTEGERconstant fraction_constants_opt
    569692                { $$ = new ExpressionNode( build_field_name_fraction_constants( build_constantInteger( *$1 ), $2 ) ); }
    570         | FLOATINGconstant fraction_constants
     693        | FLOATINGconstant fraction_constants_opt
    571694                { $$ = new ExpressionNode( build_field_name_fraction_constants( build_field_name_FLOATINGconstant( *$1 ), $2 ) ); }
    572         | no_attr_identifier fraction_constants
     695        | no_attr_identifier fraction_constants_opt
    573696                {
    574697                        $$ = new ExpressionNode( build_field_name_fraction_constants( build_varref( $1 ), $2 ) );
     
    576699        ;
    577700
    578 fraction_constants:
     701fraction_constants_opt:
    579702        // empty
    580703                { $$ = nullptr; }
    581         | fraction_constants FLOATING_FRACTIONconstant
     704        | fraction_constants_opt FLOATING_FRACTIONconstant
    582705                {
    583706                        Expression * constant = build_field_name_FLOATING_FRACTIONconstant( *$2 );
     
    591714                // semantics checks, e.g., ++3, 3--, *3, &&3
    592715        | constant
    593                 { $$ = $1; }
    594716        | string_literal
    595717                { $$ = new ExpressionNode( $1 ); }
     
    657779        | '(' type_no_function ')' cast_expression
    658780                { $$ = new ExpressionNode( build_cast( $2, $4 ) ); }
     781        | '(' COROUTINE '&' ')' cast_expression                         // CFA
     782                { $$ = new ExpressionNode( build_keyword_cast( KeywordCastExpr::Coroutine, $5 ) ); }
     783        | '(' THREAD '&' ')' cast_expression                            // CFA
     784                { $$ = new ExpressionNode( build_keyword_cast( KeywordCastExpr::Thread, $5 ) ); }
     785        | '(' MONITOR '&' ')' cast_expression                           // CFA
     786                { $$ = new ExpressionNode( build_keyword_cast( KeywordCastExpr::Monitor, $5 ) ); }
    659787                // VIRTUAL cannot be opt because of look ahead issues
    660         | '(' VIRTUAL ')' cast_expression
     788        | '(' VIRTUAL ')' cast_expression                                       // CFA
    661789                { $$ = new ExpressionNode( new VirtualCastExpr( maybeMoveBuild< Expression >( $4 ), maybeMoveBuildType( nullptr ) ) ); }
    662         | '(' VIRTUAL type_no_function ')' cast_expression
     790        | '(' VIRTUAL type_no_function ')' cast_expression      // CFA
    663791                { $$ = new ExpressionNode( new VirtualCastExpr( maybeMoveBuild< Expression >( $5 ), maybeMoveBuildType( $3 ) ) ); }
    664792//      | '(' type_no_function ')' tuple
     
    752880        | logical_OR_expression '?' comma_expression ':' conditional_expression
    753881                { $$ = new ExpressionNode( build_cond( $1, $3, $5 ) ); }
    754                 // FIX ME: this hack computes $1 twice
     882                // FIX ME: computes $1 twice
    755883        | logical_OR_expression '?' /* empty */ ':' conditional_expression // GCC, omitted first operand
    756884                { $$ = new ExpressionNode( build_cond( $1, $1, $4 ) ); }
     
    766894        | unary_expression assignment_operator assignment_expression
    767895                { $$ = new ExpressionNode( build_binary_val( $2, $1, $3 ) ); }
     896        | unary_expression '=' '{' initializer_list_opt comma_opt '}'
     897                { SemanticError( yylloc, "Initializer assignment is currently unimplemented." ); $$ = nullptr; }
    768898        ;
    769899
     
    795925//      '[' ']'
    796926//              { $$ = new ExpressionNode( build_tuple() ); }
    797 //      '[' push assignment_expression pop ']'
     927//      | '[' push assignment_expression pop ']'
    798928//              { $$ = new ExpressionNode( build_tuple( $3 ) ); }
    799         '[' push ',' tuple_expression_list pop ']'
    800                 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $4 ) ) ); }
    801         | '[' push assignment_expression ',' tuple_expression_list pop ']'
    802                 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)$3->set_last( $5 ) ) ); }
     929        '[' ',' tuple_expression_list ']'
     930                { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $3 ) ) ); }
     931        | '[' push assignment_expression pop ',' tuple_expression_list ']'
     932                { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)$3->set_last( $6 ) ) ); }
    803933        ;
    804934
     
    826956        labeled_statement
    827957        | compound_statement
    828         | expression_statement                                          { $$ = $1; }
     958        | expression_statement
    829959        | selection_statement
    830960        | iteration_statement
     
    834964        | waitfor_statement
    835965        | exception_statement
     966        | enable_disable_statement
     967                { SemanticError( yylloc, "enable/disable statement is currently unimplemented." ); $$ = nullptr; }
    836968        | asm_statement
     969        | DIRECTIVE
     970                { $$ = new StatementNode( build_directive( $1 ) ); }
     971        ;
    837972
    838973labeled_statement:
     
    847982        '{' '}'
    848983                { $$ = new StatementNode( build_compound( (StatementNode *)0 ) ); }
    849         | '{'
    850                 // Two scopes are necessary because the block itself has a scope, but every declaration within the block also
    851                 // requires its own scope.
    852           push push
     984        | '{' push
    853985          local_label_declaration_opt                                           // GCC, local labels
    854986          statement_decl_list                                                           // C99, intermix declarations and statements
    855987          pop '}'
    856                 { $$ = new StatementNode( build_compound( $5 ) ); }
     988                { $$ = new StatementNode( build_compound( $4 ) ); }
    857989        ;
    858990
    859991statement_decl_list:                                                                    // C99
    860992        statement_decl
    861         | statement_decl_list push statement_decl
    862                 { if ( $1 != 0 ) { $1->set_last( $3 ); $$ = $1; } }
     993        | statement_decl_list statement_decl
     994                { if ( $1 != 0 ) { $1->set_last( $2 ); $$ = $1; } }
    863995        ;
    864996
     
    8781010                        $$ = new StatementNode( $2 );
    8791011                }
    880         | statement pop
     1012        | statement
    8811013        ;
    8821014
     
    8931025
    8941026selection_statement:
    895         IF '(' push if_control_expression ')' statement         %prec THEN
    896                 // explicitly deal with the shift/reduce conflict on if/else
    897                 { $$ = new StatementNode( build_if( $4, $6, nullptr ) ); }
    898         | IF '(' push if_control_expression ')' statement ELSE statement
    899                 { $$ = new StatementNode( build_if( $4, $6, $8 ) ); }
     1027                        // pop causes a S/R conflict without separating the IF statement into a non-terminal even after resolving
     1028                        // the inherent S/R conflict with THEN/ELSE.
     1029        push if_statement pop
     1030                { $$ = $2; }
    9001031        | SWITCH '(' comma_expression ')' case_clause
    901                 { $$ = new StatementNode( build_switch( $3, $5 ) ); }
    902         | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA
    903                 {
    904                         StatementNode *sw = new StatementNode( build_switch( $3, $8 ) );
     1032                { $$ = new StatementNode( build_switch( true, $3, $5 ) ); }
     1033        | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt pop '}' // CFA
     1034                {
     1035                        StatementNode *sw = new StatementNode( build_switch( true, $3, $8 ) );
    9051036                        // The semantics of the declaration list is changed to include associated initialization, which is performed
    9061037                        // *before* the transfer to the appropriate case clause by hoisting the declarations into a compound
     
    9111042                }
    9121043        | CHOOSE '(' comma_expression ')' case_clause           // CFA
    913                 { $$ = new StatementNode( build_switch( $3, $5 ) ); }
    914         | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt choose_clause_list_opt '}' // CFA
    915                 {
    916                         StatementNode *sw = new StatementNode( build_switch( $3, $8 ) );
     1044                { $$ = new StatementNode( build_switch( false, $3, $5 ) ); }
     1045        | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt pop '}' // CFA
     1046                {
     1047                        StatementNode *sw = new StatementNode( build_switch( false, $3, $8 ) );
    9171048                        $$ = $7 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
    9181049                }
    9191050        ;
    9201051
     1052if_statement:
     1053        IF '(' if_control_expression ')' statement                      %prec THEN
     1054                // explicitly deal with the shift/reduce conflict on if/else
     1055                { $$ = new StatementNode( build_if( $3, $5, nullptr ) ); }
     1056        | IF '(' if_control_expression ')' statement ELSE statement
     1057                { $$ = new StatementNode( build_if( $3, $5, $7 ) ); }
     1058        ;
     1059
    9211060if_control_expression:
    922         comma_expression pop
    923                 { $$ = new IfCtl( nullptr, $1 ); }
    924         | c_declaration pop                                                                     // no semi-colon
    925                 { $$ = new IfCtl( $1, nullptr ); }
    926         | cfa_declaration pop                                                           // no semi-colon
    927                 { $$ = new IfCtl( $1, nullptr ); }
     1061        comma_expression
     1062                { $$ = new IfCtrl( nullptr, $1 ); }
     1063        | c_declaration                                                                         // no semi-colon
     1064                { $$ = new IfCtrl( $1, nullptr ); }
     1065        | cfa_declaration                                                                       // no semi-colon
     1066                { $$ = new IfCtrl( $1, nullptr ); }
    9281067        | declaration comma_expression                                          // semi-colon separated
    929                 { $$ = new IfCtl( $1, $2 ); }
     1068                { $$ = new IfCtrl( $1, $2 ); }
    9301069        ;
    9311070
     
    9521091        ;
    9531092
     1093//label_list_opt:
     1094//      // empty
     1095//      | identifier_or_type_name ':'
     1096//      | label_list_opt identifier_or_type_name ':'
     1097//      ;
     1098
    9541099case_label_list:                                                                                // CFA
    9551100        case_label
     
    9741119        ;
    9751120
    976 choose_clause_list_opt:                                                                 // CFA
    977         // empty
    978                 { $$ = nullptr; }
    979         | choose_clause_list
    980         ;
    981 
    982 choose_clause_list:                                                                             // CFA
    983         case_label_list fall_through
    984                 { $$ = $1->append_last_case( $2 ); }
    985         | case_label_list statement_list_nodecl fall_through_opt
    986                 { $$ = $1->append_last_case( new StatementNode( build_compound( (StatementNode *)$2->set_last( $3 ) ) ) ); }
    987         | choose_clause_list case_label_list fall_through
    988                 { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( $3 ))); }
    989         | choose_clause_list case_label_list statement_list_nodecl fall_through_opt
    990                 { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( (StatementNode *)$3->set_last( $4 ) ) ) ) ) ); }
    991         ;
    992 
    993 fall_through_opt:                                                                               // CFA
    994         // empty
    995                 { $$ = new StatementNode( build_branch( BranchStmt::Break ) ); } // insert implicit break
    996         | fall_through
    997         ;
    998 
    999 fall_through_name:                                                                              // CFA
    1000         FALLTHRU
    1001         | FALLTHROUGH
    1002         ;
    1003 
    1004 fall_through:                                                                                   // CFA
    1005         fall_through_name
    1006                 { $$ = nullptr; }
    1007         | fall_through_name ';'
    1008                 { $$ = nullptr; }
    1009         ;
    1010 
    10111121iteration_statement:
    1012         WHILE '(' comma_expression ')' statement
    1013                 { $$ = new StatementNode( build_while( $3, $5 ) ); }
     1122        WHILE '(' push if_control_expression ')' statement pop
     1123                { $$ = new StatementNode( build_while( $4, $6 ) ); }
     1124        | WHILE '(' ')' statement                                                       // CFA => while ( 1 )
     1125                { $$ = new StatementNode( build_while( new IfCtrl( nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ), $4 ) ); }
    10141126        | DO statement WHILE '(' comma_expression ')' ';'
    1015                 { $$ = new StatementNode( build_while( $5, $2, true ) ); }
    1016         | FOR '(' push for_control_expression ')' statement
     1127                { $$ = new StatementNode( build_do_while( $5, $2 ) ); }
     1128        | DO statement WHILE '(' ')' ';'                                        // CFA => do while( 1 )
     1129                { $$ = new StatementNode( build_do_while( new ExpressionNode( build_constantInteger( *new string( "1" ) ) ), $2 ) ); }
     1130        | FOR '(' push for_control_expression ')' statement pop
    10171131                { $$ = new StatementNode( build_for( $4, $6 ) ); }
    10181132        ;
    10191133
    10201134for_control_expression:
    1021         comma_expression_opt pop ';' comma_expression_opt ';' comma_expression_opt
    1022                 { $$ = new ForCtl( $1, $4, $6 ); }
    1023         | declaration comma_expression_opt ';' comma_expression_opt // C99
    1024                 { $$ = new ForCtl( $1, $2, $4 ); }
     1135        comma_expression_opt                                                            // CFA
     1136                {
     1137                        if ( ! $1 ) {                                                           // => for ( ;; )
     1138                                $$ = new ForCtrl( (ExpressionNode * )nullptr, (ExpressionNode * )nullptr, (ExpressionNode * )nullptr );
     1139                        } else {
     1140                                $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), OperKinds::LThan, $1->clone(),
     1141                                                         new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) );
     1142                        } // if
     1143                }
     1144        | constant_expression inclexcl constant_expression      // CFA
     1145                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
     1146        | constant_expression inclexcl constant_expression '~' constant_expression // CFA
     1147                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, $5 ); }
     1148        | comma_expression_opt ';' comma_expression                     // CFA
     1149                {
     1150                        if ( ! $1 ) {
     1151                                SemanticError( yylloc, "Missing loop index." ); $$ = nullptr;
     1152                        } else if ( ! $3 ) {
     1153                                SemanticError( yylloc, "Missing loop range." ); $$ = nullptr;
     1154                        } else {
     1155                                if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) {
     1156                                        $$ = forCtrl( $3, new string( identifier->name ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), OperKinds::LThan, $3->clone(),
     1157                                                                 new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) );
     1158                                } else {
     1159                                        SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr;
     1160                                } // if
     1161                        } // if
     1162                }
     1163        | comma_expression_opt ';' constant_expression inclexcl constant_expression // CFA
     1164                {
     1165                        if ( ! $1 ) {
     1166                                SemanticError( yylloc, "Missing loop index." ); $$ = nullptr;
     1167                        } else {
     1168                                if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) {
     1169                                        $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) );
     1170                                } else {
     1171                                        SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr;
     1172                                } // if
     1173                        } // if
     1174                }
     1175        | comma_expression_opt ';' constant_expression inclexcl constant_expression '~' constant_expression // CFA
     1176                {
     1177                        if ( ! $1 ) {
     1178                                SemanticError( yylloc, "Missing loop index." ); $$ = nullptr;
     1179                        } else {
     1180                                if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) {
     1181                                        $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, $7 );
     1182                                } else {
     1183                                        SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr;
     1184                                } // if
     1185                        } // if
     1186                }
     1187        | comma_expression_opt ';' comma_expression_opt ';' comma_expression_opt
     1188                { $$ = new ForCtrl( $1, $3, $5 ); }
     1189        | declaration comma_expression_opt ';' comma_expression_opt // C99, declaration has ';'
     1190                { $$ = new ForCtrl( $1, $2, $4 ); }
     1191        ;
     1192
     1193inclexcl:
     1194        '~'
     1195                { $$ = OperKinds::LThan; }
     1196        | Erange
     1197                { $$ = OperKinds::LEThan; }
    10251198        ;
    10261199
     
    10321205                // whereas normal operator precedence yields goto (*i)+3;
    10331206                { $$ = new StatementNode( build_computedgoto( $3 ) ); }
     1207                // A semantic check is required to ensure fallthru appears only in the body of a choose statement.
     1208    | fall_through_name ';'                                                             // CFA
     1209                { $$ = new StatementNode( build_branch( BranchStmt::FallThrough ) ); }
     1210    | fall_through_name identifier_or_type_name ';'             // CFA
     1211                { $$ = new StatementNode( build_branch( $2, BranchStmt::FallThrough ) ); }
     1212        | fall_through_name DEFAULT ';'                                         // CFA
     1213                { $$ = new StatementNode( build_branch( BranchStmt::FallThroughDefault ) ); }
    10341214        | CONTINUE ';'
    10351215                // A semantic check is required to ensure this statement appears only in the body of an iteration statement.
     
    10481228        | RETURN comma_expression_opt ';'
    10491229                { $$ = new StatementNode( build_return( $2 ) ); }
     1230        | RETURN '{' initializer_list_opt comma_opt '}'
     1231                { SemanticError( yylloc, "Initializer return is currently unimplemented." ); $$ = nullptr; }
    10501232        | THROW assignment_expression_opt ';'                           // handles rethrow
    10511233                { $$ = new StatementNode( build_throw( $2 ) ); }
     
    10561238        ;
    10571239
     1240fall_through_name:                                                                              // CFA
     1241        FALLTHRU
     1242        | FALLTHROUGH
     1243        ;
     1244
    10581245with_statement:
    10591246        WITH '(' tuple_expression_list ')' statement
     
    10661253mutex_statement:
    10671254        MUTEX '(' argument_expression_list ')' statement
    1068                 { throw SemanticError("Mutex statement is currently unimplemented."); $$ = nullptr; } // FIX ME
     1255                { SemanticError( yylloc, "Mutex statement is currently unimplemented." ); $$ = nullptr; }
    10691256        ;
    10701257
    10711258when_clause:
    1072         WHEN '(' comma_expression ')'
    1073                 { $$ = $3; }
     1259        WHEN '(' comma_expression ')'                           { $$ = $3; }
    10741260        ;
    10751261
     
    10811267
    10821268waitfor:
    1083         WAITFOR '(' identifier ')'
    1084                 {
    1085                         $$ = new ExpressionNode( new NameExpr( *$3 ) );
    1086                         delete $3;
    1087                 }
    1088         | WAITFOR '(' identifier ',' argument_expression_list ')'
    1089                 {
    1090                         $$ = new ExpressionNode( new NameExpr( *$3 ) );
    1091                         $$->set_last( $5 );
    1092                         delete $3;
    1093                 }
     1269        WAITFOR '(' cast_expression ')'
     1270                { $$ = $3; }
     1271        | WAITFOR '(' cast_expression ',' argument_expression_list ')'
     1272                { $$ = (ExpressionNode *)$3->set_last( $5 ); }
    10941273        ;
    10951274
    10961275timeout:
    1097         TIMEOUT '(' comma_expression ')'
    1098                 { $$ = $3; }
     1276        TIMEOUT '(' comma_expression ')'                        { $$ = $3; }
    10991277        ;
    11001278
     
    11091287                { $$ = build_waitfor_timeout( nullptr, $3, $1 ); }
    11101288                // "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless)
     1289        | when_clause_opt timeout statement WOR ELSE statement
     1290                { SemanticError( yylloc, "else clause must be conditional after timeout or timeout never triggered." ); $$ = nullptr; }
    11111291        | when_clause_opt timeout statement WOR when_clause ELSE statement
    11121292                { $$ = build_waitfor_timeout( $2, $3, $1, $7, $5 ); }
     
    11301310
    11311311handler_clause:
    1132         handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop
    1133                 { $$ = new StatementNode( build_catch( $1, $5, $7, $9 ) ); }
    1134         | handler_clause handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop
    1135                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, $8, $10 ) ) ); }
     1312        handler_key '(' push exception_declaration pop handler_predicate_opt ')' compound_statement pop
     1313                { $$ = new StatementNode( build_catch( $1, $4, $6, $8 ) ); }
     1314        | handler_clause handler_key '(' push exception_declaration pop handler_predicate_opt ')' compound_statement pop
     1315                { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $5, $7, $9 ) ) ); }
    11361316        ;
    11371317
    11381318handler_predicate_opt:
    1139         //empty
     1319        // empty
    11401320                { $$ = nullptr; }
    1141         | ';' conditional_expression
    1142                 { $$ = $2; }
     1321        | ';' conditional_expression                            { $$ = $2; }
    11431322        ;
    11441323
    11451324handler_key:
    1146         CATCH
    1147                 { $$ = CatchStmt::Terminate; }
    1148         | CATCHRESUME
    1149                 { $$ = CatchStmt::Resume; }
     1325        CATCH                                                                           { $$ = CatchStmt::Terminate; }
     1326        | CATCHRESUME                                                           { $$ = CatchStmt::Resume; }
    11501327        ;
    11511328
    11521329finally_clause:
    1153         FINALLY compound_statement
    1154                 {
    1155                         $$ = new StatementNode( build_finally( $2 ) );
    1156                 }
     1330        FINALLY compound_statement                                      { $$ = new StatementNode( build_finally( $2 ) ); }
    11571331        ;
    11581332
     
    11611335        type_specifier_nobody
    11621336        | type_specifier_nobody declarator
    1163                 {
    1164                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    1165                         $$ = $2->addType( $1 );
    1166                 }
     1337                { $$ = $2->addType( $1 ); }
    11671338        | type_specifier_nobody variable_abstract_declarator
    11681339                { $$ = $2->addType( $1 ); }
    11691340        | cfa_abstract_declarator_tuple no_attr_identifier      // CFA
    1170                 {
    1171                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    1172                         $$ = $1->addName( $2 );
    1173                 }
     1341                { $$ = $1->addName( $2 ); }
    11741342        | cfa_abstract_declarator_tuple                                         // CFA
     1343        ;
     1344
     1345enable_disable_statement:
     1346        enable_disable_key identifier_list compound_statement
     1347        ;
     1348
     1349enable_disable_key:
     1350        ENABLE
     1351        | DISABLE
    11751352        ;
    11761353
    11771354asm_statement:
    11781355        ASM asm_volatile_opt '(' string_literal ')' ';'
    1179                 { $$ = new StatementNode( build_asmstmt( $2, $4, 0 ) ); }
     1356                { $$ = new StatementNode( build_asm( $2, $4, 0 ) ); }
    11801357        | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ')' ';' // remaining GCC
    1181                 { $$ = new StatementNode( build_asmstmt( $2, $4, $6 ) ); }
     1358                { $$ = new StatementNode( build_asm( $2, $4, $6 ) ); }
    11821359        | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ':' asm_operands_opt ')' ';'
    1183                 { $$ = new StatementNode( build_asmstmt( $2, $4, $6, $8 ) ); }
     1360                { $$ = new StatementNode( build_asm( $2, $4, $6, $8 ) ); }
    11841361        | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ':' asm_operands_opt ':' asm_clobbers_list_opt ')' ';'
    1185                 { $$ = new StatementNode( build_asmstmt( $2, $4, $6, $8, $10 ) ); }
     1362                { $$ = new StatementNode( build_asm( $2, $4, $6, $8, $10 ) ); }
    11861363        | ASM asm_volatile_opt GOTO '(' string_literal ':' ':' asm_operands_opt ':' asm_clobbers_list_opt ':' label_list ')' ';'
    1187                 { $$ = new StatementNode( build_asmstmt( $2, $5, 0, $8, $10, $12 ) ); }
     1364                { $$ = new StatementNode( build_asm( $2, $5, 0, $8, $10, $12 ) ); }
    11881365        ;
    11891366
     
    12401417
    12411418declaration_list_opt:                                                                   // used at beginning of switch statement
    1242         pop
     1419        // empty
    12431420                { $$ = nullptr; }
    12441421        | declaration_list
     
    12471424declaration_list:
    12481425        declaration
    1249         | declaration_list push declaration
    1250                 { $$ = $1->appendList( $3 ); }
    1251         ;
    1252 
    1253 KR_declaration_list_opt:                                                                // used to declare parameter types in K&R style functions
     1426        | declaration_list declaration
     1427                { $$ = $1->appendList( $2 ); }
     1428        ;
     1429
     1430KR_parameter_list_opt:                                                                  // used to declare parameter types in K&R style functions
    12541431        // empty
    12551432                { $$ = nullptr; }
    1256         | KR_declaration_list
    1257         ;
    1258 
    1259 KR_declaration_list:
     1433        | KR_parameter_list
     1434        ;
     1435
     1436KR_parameter_list:
    12601437        push c_declaration pop ';'
    12611438                { $$ = $2; }
    1262         | KR_declaration_list push c_declaration pop ';'
     1439        | KR_parameter_list push c_declaration pop ';'
    12631440                { $$ = $1->appendList( $3 ); }
    12641441        ;
     
    12751452
    12761453local_label_list:                                                                               // GCC, local label
    1277         no_attr_identifier_or_type_name                         {}
    1278         | local_label_list ',' no_attr_identifier_or_type_name {}
     1454        no_attr_identifier_or_type_name
     1455        | local_label_list ',' no_attr_identifier_or_type_name
    12791456        ;
    12801457
    12811458declaration:                                                                                    // old & new style declarations
    1282         c_declaration pop ';'
    1283         | cfa_declaration pop ';'                                                       // CFA
    1284         | STATICASSERT '(' constant_expression ',' string_literal ')' ';' // C11
    1285                 { throw SemanticError("Static assert is currently unimplemented."); $$ = nullptr; }     // FIX ME
    1286         ;
     1459        c_declaration ';'
     1460        | cfa_declaration ';'                                                           // CFA
     1461        | static_assert                                                                         // C11
     1462        ;
     1463
     1464static_assert:
     1465        STATICASSERT '(' constant_expression ',' string_literal ')' ';' // C11
     1466                { $$ = DeclarationNode::newStaticAssert( $3, $5 ); }
     1467        | STATICASSERT '(' constant_expression ')' ';'          // CFA
     1468                { $$ = DeclarationNode::newStaticAssert( $3, build_constantStr( *new string( "\"\"" ) ) ); }
    12871469
    12881470// C declaration syntax is notoriously confusing and error prone. Cforall provides its own type, variable and function
     
    13071489cfa_variable_declaration:                                                               // CFA
    13081490        cfa_variable_specifier initializer_opt
    1309                 {
    1310                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    1311                         $$ = $1->addInitializer( $2 );
    1312                 }
     1491                { $$ = $1->addInitializer( $2 ); }
    13131492        | declaration_qualifier_list cfa_variable_specifier initializer_opt
    13141493                // declaration_qualifier_list also includes type_qualifier_list, so a semantic check is necessary to preclude
    13151494                // them as a type_qualifier cannot appear in that context.
    1316                 {
    1317                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    1318                         $$ = $2->addQualifiers( $1 )->addInitializer( $3 );;
    1319                 }
     1495                { $$ = $2->addQualifiers( $1 )->addInitializer( $3 ); }
    13201496        | cfa_variable_declaration pop ',' push identifier_or_type_name initializer_opt
    1321                 {
    1322                         typedefTable.addToEnclosingScope( *$5, TypedefTable::ID );
    1323                         $$ = $1->appendList( $1->cloneType( $5 )->addInitializer( $6 ) );
    1324                 }
     1497                { $$ = $1->appendList( $1->cloneType( $5 )->addInitializer( $6 ) ); }
    13251498        ;
    13261499
     
    13291502                // storage-class
    13301503        cfa_abstract_declarator_no_tuple identifier_or_type_name asm_name_opt
    1331                 {
    1332                         typedefTable.setNextIdentifier( *$2 );
    1333                         $$ = $1->addName( $2 )->addAsmName( $3 );
    1334                 }
     1504                { $$ = $1->addName( $2 )->addAsmName( $3 ); }
    13351505        | cfa_abstract_tuple identifier_or_type_name asm_name_opt
    1336                 {
    1337                         typedefTable.setNextIdentifier( *$2 );
    1338                         $$ = $1->addName( $2 )->addAsmName( $3 );
    1339                 }
     1506                { $$ = $1->addName( $2 )->addAsmName( $3 ); }
    13401507        | type_qualifier_list cfa_abstract_tuple identifier_or_type_name asm_name_opt
    1341                 {
    1342                         typedefTable.setNextIdentifier( *$3 );
    1343                         $$ = $2->addQualifiers( $1 )->addName( $3 )->addAsmName( $4 );
    1344                 }
     1508                { $$ = $2->addQualifiers( $1 )->addName( $3 )->addAsmName( $4 ); }
    13451509        ;
    13461510
    13471511cfa_function_declaration:                                                               // CFA
    13481512        cfa_function_specifier
    1349                 {
    1350                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    1351                         $$ = $1;
    1352                 }
    13531513        | type_qualifier_list cfa_function_specifier
    1354                 {
    1355                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    1356                         $$ = $2->addQualifiers( $1 );
    1357                 }
     1514                { $$ = $2->addQualifiers( $1 ); }
    13581515        | declaration_qualifier_list cfa_function_specifier
    1359                 {
    1360                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    1361                         $$ = $2->addQualifiers( $1 );
    1362                 }
     1516                { $$ = $2->addQualifiers( $1 ); }
    13631517        | declaration_qualifier_list type_qualifier_list cfa_function_specifier
    1364                 {
    1365                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    1366                         $$ = $3->addQualifiers( $1 )->addQualifiers( $2 );
    1367                 }
    1368         | cfa_function_declaration pop ',' push identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')'
     1518                { $$ = $3->addQualifiers( $1 )->addQualifiers( $2 ); }
     1519        | cfa_function_declaration ',' identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')'
    13691520                {
    13701521                        // Append the return type at the start (left-hand-side) to each identifier in the list.
    13711522                        DeclarationNode * ret = new DeclarationNode;
    13721523                        ret->type = maybeClone( $1->type->base );
    1373                         $$ = $1->appendList( DeclarationNode::newFunction( $5, ret, $8, nullptr, true ) );
     1524                        $$ = $1->appendList( DeclarationNode::newFunction( $3, ret, $6, nullptr ) );
    13741525                }
    13751526        ;
    13761527
    13771528cfa_function_specifier:                                                                 // CFA
    1378 //      '[' ']' identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')' // S/R conflict
     1529//      '[' ']' identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' // S/R conflict
    13791530//              {
    13801531//                      $$ = DeclarationNode::newFunction( $3, DeclarationNode::newTuple( 0 ), $6, 0, true );
    13811532//              }
    1382 //      '[' ']' identifier '(' push cfa_parameter_type_list_opt pop ')'
     1533//      '[' ']' identifier '(' push cfa_parameter_ellipsis_list_opt pop ')'
    13831534//              {
    13841535//                      typedefTable.setNextIdentifier( *$5 );
    13851536//                      $$ = DeclarationNode::newFunction( $5, DeclarationNode::newTuple( 0 ), $8, 0, true );
    13861537//              }
    1387 //      | '[' ']' TYPEDEFname '(' push cfa_parameter_type_list_opt pop ')'
     1538//      | '[' ']' TYPEDEFname '(' push cfa_parameter_ellipsis_list_opt pop ')'
    13881539//              {
    13891540//                      typedefTable.setNextIdentifier( *$5 );
     
    13931544                // identifier_or_type_name must be broken apart because of the sequence:
    13941545                //
    1395                 //   '[' ']' identifier_or_type_name '(' cfa_parameter_type_list_opt ')'
     1546                //   '[' ']' identifier_or_type_name '(' cfa_parameter_ellipsis_list_opt ')'
    13961547                //   '[' ']' type_specifier
    13971548                //
    13981549                // type_specifier can resolve to just TYPEDEFname (e.g., typedef int T; int f( T );). Therefore this must be
    13991550                // flattened to allow lookahead to the '(' without having to reduce identifier_or_type_name.
    1400         cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')'
     1551        cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')'
    14011552                // To obtain LR(1 ), this rule must be factored out from function return type (see cfa_abstract_declarator).
    1402                 {
    1403                         $$ = DeclarationNode::newFunction( $2, $1, $5, 0, true );
    1404                 }
    1405         | cfa_function_return identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')'
    1406                 {
    1407                         $$ = DeclarationNode::newFunction( $2, $1, $5, 0, true );
    1408                 }
     1553                { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ); }
     1554        | cfa_function_return identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')'
     1555                { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ); }
    14091556        ;
    14101557
     
    14131560                { $$ = DeclarationNode::newTuple( $3 ); }
    14141561        | '[' push cfa_parameter_list pop ',' push cfa_abstract_parameter_list pop ']'
    1415                 // To obtain LR(1 ), the last cfa_abstract_parameter_list is added into this flattened rule to lookahead to the
    1416                 // ']'.
     1562                // To obtain LR(1 ), the last cfa_abstract_parameter_list is added into this flattened rule to lookahead to the ']'.
    14171563                { $$ = DeclarationNode::newTuple( $3->appendList( $7 ) ); }
    14181564        ;
     
    14211567        TYPEDEF cfa_variable_specifier
    14221568                {
    1423                         typedefTable.addToEnclosingScope( TypedefTable::TD );
     1569                        typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname, "1" );
    14241570                        $$ = $2->addTypedef();
    14251571                }
    14261572        | TYPEDEF cfa_function_specifier
    14271573                {
    1428                         typedefTable.addToEnclosingScope( TypedefTable::TD );
     1574                        typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname, "2" );
    14291575                        $$ = $2->addTypedef();
    14301576                }
    14311577        | cfa_typedef_declaration pop ',' push no_attr_identifier
    14321578                {
    1433                         typedefTable.addToEnclosingScope( *$5, TypedefTable::TD );
     1579                        typedefTable.addToEnclosingScope( *$5, TYPEDEFname, "3" );
    14341580                        $$ = $1->appendList( $1->cloneType( $5 ) );
    14351581                }
     
    14421588        TYPEDEF type_specifier declarator
    14431589                {
    1444                         typedefTable.addToEnclosingScope( TypedefTable::TD );
     1590                        typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname, "4" );
    14451591                        $$ = $3->addType( $2 )->addTypedef();
    14461592                }
    14471593        | typedef_declaration pop ',' push declarator
    14481594                {
    1449                         typedefTable.addToEnclosingScope( TypedefTable::TD );
     1595                        typedefTable.addToEnclosingScope( *$5->name, TYPEDEFname, "5" );
    14501596                        $$ = $1->appendList( $1->cloneBaseType( $5 )->addTypedef() );
    14511597                }
    14521598        | type_qualifier_list TYPEDEF type_specifier declarator // remaining OBSOLESCENT (see 2 )
    14531599                {
    1454                         typedefTable.addToEnclosingScope( TypedefTable::TD );
     1600                        typedefTable.addToEnclosingScope( *$4->name, TYPEDEFname, "6" );
    14551601                        $$ = $4->addType( $3 )->addQualifiers( $1 )->addTypedef();
    14561602                }
    14571603        | type_specifier TYPEDEF declarator
    14581604                {
    1459                         typedefTable.addToEnclosingScope( TypedefTable::TD );
     1605                        typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname, "7" );
    14601606                        $$ = $3->addType( $1 )->addTypedef();
    14611607                }
    14621608        | type_specifier TYPEDEF type_qualifier_list declarator
    14631609                {
    1464                         typedefTable.addToEnclosingScope( TypedefTable::TD );
     1610                        typedefTable.addToEnclosingScope( *$4->name, TYPEDEFname, "8" );
    14651611                        $$ = $4->addQualifiers( $1 )->addTypedef()->addType( $1 );
    14661612                }
     
    14711617        TYPEDEF no_attr_identifier '=' assignment_expression
    14721618                {
    1473                         typedefTable.addToEnclosingScope( *$2, TypedefTable::TD );
    1474                         $$ = DeclarationNode::newName( 0 );                     // unimplemented
     1619                        // $$ = DeclarationNode::newName( 0 );                  // unimplemented
     1620                        SemanticError( yylloc, "Typedef expression is currently unimplemented." ); $$ = nullptr;
    14751621                }
    14761622        | typedef_expression pop ',' push no_attr_identifier '=' assignment_expression
    14771623                {
    1478                         typedefTable.addToEnclosingScope( *$5, TypedefTable::TD );
    1479                         $$ = DeclarationNode::newName( 0 );                     // unimplemented
     1624                        // $$ = DeclarationNode::newName( 0 );                  // unimplemented
     1625                        SemanticError( yylloc, "Typedef expression is currently unimplemented." ); $$ = nullptr;
    14801626                }
    14811627        ;
     
    14931639//       declarator asm_name_opt initializer_opt
    14941640//              {
    1495 //                      typedefTable.addToEnclosingScope( TypedefTable::ID );
     1641//                      typedefTable.addToEnclosingScope( IDENTIFIER );
    14961642//                      $$ = ( $2->addType( $1 ))->addAsmName( $3 )->addInitializer( $4 );
    14971643//              }
    14981644//      | declaring_list ',' attribute_list_opt declarator asm_name_opt initializer_opt
    14991645//              {
    1500 //                      typedefTable.addToEnclosingScope( TypedefTable::ID );
     1646//                      typedefTable.addToEnclosingScope( IDENTIFIER );
    15011647//                      $$ = $1->appendList( $1->cloneBaseType( $4->addAsmName( $5 )->addInitializer( $6 ) ) );
    15021648//              }
     
    15051651c_declaration:
    15061652        declaration_specifier declaring_list
    1507                 {
    1508                         $$ = distAttr( $1, $2 );
    1509                 }
     1653                { $$ = distAttr( $1, $2 ); }
    15101654        | typedef_declaration
    15111655        | typedef_expression                                                            // GCC, naming expression type
     
    15171661                // storage-class
    15181662        declarator asm_name_opt initializer_opt
    1519                 {
    1520                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    1521                         $$ = $1->addAsmName( $2 )->addInitializer( $3 );
    1522                 }
     1663                { $$ = $1->addAsmName( $2 )->addInitializer( $3 ); }
    15231664        | declaring_list ',' attribute_list_opt declarator asm_name_opt initializer_opt
    1524                 {
    1525                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    1526                         $$ = $1->appendList( $4->addQualifiers( $3 )->addAsmName( $5 )->addInitializer( $6 ) );
    1527                 }
     1665                { $$ = $1->appendList( $4->addQualifiers( $3 )->addAsmName( $5 )->addInitializer( $6 ) ); }
    15281666        ;
    15291667
     
    15971735
    15981736forall:
    1599         FORALL '('
    1600                 {
    1601                         typedefTable.enterScope();
    1602                 }
    1603           type_parameter_list ')'                                                       // CFA
    1604                 {
    1605                         typedefTable.leaveScope();
    1606                         $$ = DeclarationNode::newForall( $4 );
    1607                 }
     1737        FORALL '(' type_parameter_list ')'                                      // CFA
     1738                { $$ = DeclarationNode::newForall( $3 ); }
    16081739        ;
    16091740
     
    16781809        | LONG
    16791810                { $$ = DeclarationNode::newLength( DeclarationNode::Long ); }
    1680         | ZERO_T
    1681                 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Zero ); }
    1682         | ONE_T
    1683                 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::One ); }
    16841811        | VALIST                                                                                        // GCC, __builtin_va_list
    16851812                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
     
    17011828basic_type_specifier:
    17021829        direct_type
     1830                // Cannot have type modifiers, e.g., short, long, etc.
    17031831        | type_qualifier_list_opt indirect_type type_qualifier_list_opt
    17041832                { $$ = $2->addQualifiers( $1 )->addQualifiers( $3 ); }
     
    17061834
    17071835direct_type:
    1708                 // A semantic check is necessary for conflicting type qualifiers.
    17091836        basic_type_name
    17101837        | type_qualifier_list basic_type_name
     
    17251852        | ATTR_TYPEGENname '(' comma_expression ')'                     // CFA: e.g., @type(a+b) y;
    17261853                { $$ = DeclarationNode::newAttr( $1, $3 ); }
     1854        | ZERO_T                                                                                        // CFA
     1855                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Zero ); }
     1856        | ONE_T                                                                                         // CFA
     1857                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::One ); }
    17271858        ;
    17281859
     
    17441875                { $$ = $3->addQualifiers( $1 ); }
    17451876        | sue_type_specifier type_qualifier
    1746                 { $$ = $1->addQualifiers( $2 ); }
     1877                {
     1878                        if ( $2->type != nullptr && $2->type->forall ) forall = true; // remember generic type
     1879                        $$ = $1->addQualifiers( $2 );
     1880                }
    17471881        ;
    17481882
     
    17871921                { $$ = DeclarationNode::newFromTypedef( $1 ); }
    17881922        | '.' TYPEDEFname
    1789                 { $$ = DeclarationNode::newFromTypedef( $2 ); } // FIX ME
     1923                { $$ = DeclarationNode::newQualifiedType( DeclarationNode::newFromGlobalScope(), DeclarationNode::newFromTypedef( $2 ) ); }
    17901924        | type_name '.' TYPEDEFname
    1791                 { $$ = DeclarationNode::newFromTypedef( $3 ); } // FIX ME
     1925                { $$ = DeclarationNode::newQualifiedType( $1, DeclarationNode::newFromTypedef( $3 ) ); }
    17921926        | typegen_name
    17931927        | '.' typegen_name
    1794                 { $$ = $2; }                                                                    // FIX ME
     1928                { $$ = DeclarationNode::newQualifiedType( DeclarationNode::newFromGlobalScope(), $2 ); }
    17951929        | type_name '.' typegen_name
    1796                 { $$ = $3; }                                                                    // FIX ME
     1930                { $$ = DeclarationNode::newQualifiedType( $1, $3 ); }
    17971931        ;
    17981932
     
    18161950        ;
    18171951
     1952fred:
     1953        // empty
     1954                { yyy = false; }
     1955        ;
     1956
    18181957aggregate_type:                                                                                 // struct, union
    1819         aggregate_key attribute_list_opt '{' field_declaration_list '}'
    1820                 { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), nullptr, $4, true )->addQualifiers( $2 ); }
    1821         | aggregate_key attribute_list_opt no_attr_identifier_or_type_name
    1822                 {
    1823                         typedefTable.makeTypedef( *$3 );                        // create typedef
    1824                         if ( forall ) typedefTable.changeKind( *$3, TypedefTable::TG ); // possibly update
     1958        aggregate_key attribute_list_opt
     1959                { forall = false; }                                                             // reset
     1960          '{' field_declaration_list_opt '}' type_parameters_opt
     1961                { $$ = DeclarationNode::newAggregate( $1, nullptr, $7, $5, true )->addQualifiers( $2 ); }
     1962        | aggregate_key attribute_list_opt no_attr_identifier fred
     1963                {
     1964                        typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef
    18251965                        forall = false;                                                         // reset
    18261966                }
    1827           '{' field_declaration_list '}'
    1828                 { $$ = DeclarationNode::newAggregate( $1, $3, nullptr, $6, true )->addQualifiers( $2 ); }
    1829         | aggregate_key attribute_list_opt '(' type_list ')' '{' field_declaration_list '}' // CFA
    1830                 { $$ = DeclarationNode::newAggregate( $1, new string( DeclarationNode::anonymous.newName() ), $4, $7, false )->addQualifiers( $2 ); }
     1967          '{' field_declaration_list_opt '}' type_parameters_opt
     1968                { $$ = DeclarationNode::newAggregate( $1, $3, $9, $7, true )->addQualifiers( $2 ); }
     1969        | aggregate_key attribute_list_opt type_name fred
     1970                {
     1971                        // for type_name can be a qualified type name S.T, in which case only the last name in the chain needs a typedef (other names in the chain should already have one)
     1972                        typedefTable.makeTypedef( *$3->type->leafName(), forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef
     1973                        forall = false;                                                         // reset
     1974                }
     1975          '{' field_declaration_list_opt '}' type_parameters_opt
     1976                { $$ = DeclarationNode::newAggregate( $1, $3->type->symbolic.name, $9, $7, true )->addQualifiers( $2 ); }
    18311977        | aggregate_type_nobody
    18321978        ;
    18331979
     1980type_parameters_opt:
     1981        // empty
     1982                { $$ = nullptr; }                                                               %prec '}'
     1983        | '(' type_list ')'
     1984                { $$ = $2; }
     1985        ;
     1986
    18341987aggregate_type_nobody:                                                                  // struct, union - {...}
    1835         aggregate_key attribute_list_opt no_attr_identifier
    1836                 {
    1837                         typedefTable.makeTypedef( *$3 );
     1988        aggregate_key attribute_list_opt no_attr_identifier fred
     1989                {
     1990                        typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname );
     1991                        forall = false;                                                         // reset
    18381992                        $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 );
    18391993                }
    1840         | aggregate_key attribute_list_opt TYPEDEFname
    1841                 {
    1842                         typedefTable.makeTypedef( *$3 );
    1843                         $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 );
    1844                 }
    1845         | aggregate_key attribute_list_opt typegen_name         // CFA
    1846                 {
     1994        | aggregate_key attribute_list_opt type_name fred
     1995                {
     1996                        forall = false;                                                         // reset
    18471997                        // Create new generic declaration with same name as previous forward declaration, where the IDENTIFIER is
    18481998                        // switched to a TYPEGENname. Link any generic arguments from typegen_name to new generic declaration and
     
    18572007aggregate_key:
    18582008        STRUCT
    1859                 { $$ = DeclarationNode::Struct; }
     2009                { yyy = true; $$ = DeclarationNode::Struct; }
    18602010        | UNION
    1861                 { $$ = DeclarationNode::Union; }
     2011                { yyy = true; $$ = DeclarationNode::Union; }
     2012        | EXCEPTION
     2013                { yyy = true; $$ = DeclarationNode::Exception; }
    18622014        | COROUTINE
    1863                 { $$ = DeclarationNode::Coroutine; }
     2015                { yyy = true; $$ = DeclarationNode::Coroutine; }
    18642016        | MONITOR
    1865                 { $$ = DeclarationNode::Monitor; }
     2017                { yyy = true; $$ = DeclarationNode::Monitor; }
    18662018        | THREAD
    1867                 { $$ = DeclarationNode::Thread; }
    1868         ;
    1869 
    1870 field_declaration_list:
     2019                { yyy = true; $$ = DeclarationNode::Thread; }
     2020        ;
     2021
     2022field_declaration_list_opt:
    18712023        // empty
    18722024                { $$ = nullptr; }
    1873         | field_declaration_list field_declaration
     2025        | field_declaration_list_opt field_declaration
    18742026                { $$ = $1 ? $1->appendList( $2 ) : $2; }
    18752027        ;
    18762028
    18772029field_declaration:
    1878         cfa_field_declaring_list ';'                                            // CFA, new style field declaration
     2030        type_specifier field_declaring_list_opt ';'
     2031                { $$ = fieldDecl( $1, $2 ); }
     2032        | EXTENSION type_specifier field_declaring_list_opt ';' // GCC
     2033                { $$ = fieldDecl( $2, $3 ); distExt( $$ ); }
     2034        | INLINE type_specifier field_abstract_list_opt ';'     // CFA
     2035                {
     2036                        if ( ! $3 ) {                                                           // field declarator ?
     2037                                $3 = DeclarationNode::newName( nullptr );
     2038                        } // if
     2039                        $3->inLine = true;
     2040                        $$ = distAttr( $2, $3 );                                        // mark all fields in list
     2041                        distInl( $3 );
     2042                }
     2043        | typedef_declaration ';'                                                       // CFA
     2044        | cfa_field_declaring_list ';'                                          // CFA, new style field declaration
    18792045        | EXTENSION cfa_field_declaring_list ';'                        // GCC
    1880                 {
    1881                         distExt( $2 );                                                          // mark all fields in list
    1882                         $$ = $2;
    1883                 }
    1884         | type_specifier field_declaring_list ';'
    1885                 {
    1886                         $$ = distAttr( $1, $2 ); }
    1887         | EXTENSION type_specifier field_declaring_list ';'     // GCC
    1888                 {
    1889                         distExt( $3 );                                                          // mark all fields in list
    1890                         $$ = distAttr( $2, $3 );
    1891                 }
     2046                { distExt( $2 ); $$ = $2; }                                             // mark all fields in list
     2047        | INLINE cfa_field_abstract_list ';'                            // CFA, new style field declaration
     2048                { $$ = $2; }                                                                    // mark all fields in list
     2049        | cfa_typedef_declaration ';'                                           // CFA
     2050        | static_assert                                                                         // C11
     2051        ;
     2052
     2053field_declaring_list_opt:
     2054        // empty
     2055                { $$ = nullptr; }
     2056        | field_declarator
     2057        | field_declaring_list_opt ',' attribute_list_opt field_declarator
     2058                { $$ = $1->appendList( $4->addQualifiers( $3 ) ); }
     2059        ;
     2060
     2061field_declarator:
     2062        bit_subrange_size                                                                       // C special case, no field name
     2063                { $$ = DeclarationNode::newBitfield( $1 ); }
     2064        | variable_declarator bit_subrange_size_opt
     2065                // A semantic check is required to ensure bit_subrange only appears on integral types.
     2066                { $$ = $1->addBitfield( $2 ); }
     2067        | variable_type_redeclarator bit_subrange_size_opt
     2068                // A semantic check is required to ensure bit_subrange only appears on integral types.
     2069                { $$ = $1->addBitfield( $2 ); }
     2070        ;
     2071
     2072field_abstract_list_opt:
     2073        // empty
     2074                { $$ = nullptr; }
     2075        | field_abstract
     2076        | field_abstract_list_opt ',' attribute_list_opt field_abstract
     2077                { $$ = $1->appendList( $4->addQualifiers( $3 ) ); }
     2078        ;
     2079
     2080field_abstract:
     2081                //      no bit fields
     2082        variable_abstract_declarator
    18922083        ;
    18932084
    18942085cfa_field_declaring_list:                                                               // CFA, new style field declaration
    1895         cfa_abstract_declarator_tuple                                           // CFA, no field name
    1896         | cfa_abstract_declarator_tuple no_attr_identifier_or_type_name
     2086        // bit-fields are handled by C declarations
     2087        cfa_abstract_declarator_tuple no_attr_identifier_or_type_name
    18972088                { $$ = $1->addName( $2 ); }
    18982089        | cfa_field_declaring_list ',' no_attr_identifier_or_type_name
    18992090                { $$ = $1->appendList( $1->cloneType( $3 ) ); }
    1900         | cfa_field_declaring_list ','                                          // CFA, no field name
     2091        ;
     2092
     2093cfa_field_abstract_list:                                                                // CFA, new style field declaration
     2094        // bit-fields are handled by C declarations
     2095        cfa_abstract_declarator_tuple
     2096        | cfa_field_abstract_list ','
    19012097                { $$ = $1->appendList( $1->cloneType( 0 ) ); }
    1902         ;
    1903 
    1904 field_declaring_list:
    1905         field_declarator
    1906         | field_declaring_list ',' attribute_list_opt field_declarator
    1907                 { $$ = $1->appendList( $4->addQualifiers( $3 ) ); }
    1908         ;
    1909 
    1910 field_declarator:
    1911         // empty
    1912                 { $$ = DeclarationNode::newName( 0 ); /* XXX */ } // CFA, no field name
    1913         // '@'
    1914         //      { $$ = DeclarationNode::newName( new string( DeclarationNode::anonymous.newName() ) ); } // CFA, no field name
    1915         | bit_subrange_size                                                                     // no field name
    1916                 { $$ = DeclarationNode::newBitfield( $1 ); }
    1917         | variable_declarator bit_subrange_size_opt
    1918                 // A semantic check is required to ensure bit_subrange only appears on base type int.
    1919                 { $$ = $1->addBitfield( $2 ); }
    1920         | variable_type_redeclarator bit_subrange_size_opt
    1921                 // A semantic check is required to ensure bit_subrange only appears on base type int.
    1922                 { $$ = $1->addBitfield( $2 ); }
    1923         | variable_abstract_declarator                                          // CFA, no field name
    19242098        ;
    19252099
     
    19282102                { $$ = nullptr; }
    19292103        | bit_subrange_size
    1930                 { $$ = $1; }
    19312104        ;
    19322105
     
    19382111enum_type:                                                                                              // enum
    19392112        ENUM attribute_list_opt '{' enumerator_list comma_opt '}'
    1940                 { $$ = DeclarationNode::newEnum( new string( DeclarationNode::anonymous.newName() ), $4, true )->addQualifiers( $2 ); }
    1941         | ENUM attribute_list_opt no_attr_identifier_or_type_name
     2113                { $$ = DeclarationNode::newEnum( nullptr, $4, true )->addQualifiers( $2 ); }
     2114        | ENUM attribute_list_opt no_attr_identifier
    19422115                { typedefTable.makeTypedef( *$3 ); }
    19432116          '{' enumerator_list comma_opt '}'
    19442117                { $$ = DeclarationNode::newEnum( $3, $6, true )->addQualifiers( $2 ); }
     2118        | ENUM attribute_list_opt type_name
     2119          '{' enumerator_list comma_opt '}'
     2120                { $$ = DeclarationNode::newEnum( $3->type->symbolic.name, $5, true )->addQualifiers( $2 ); }
    19452121        | enum_type_nobody
    19462122        ;
    19472123
    19482124enum_type_nobody:                                                                               // enum - {...}
    1949         ENUM attribute_list_opt no_attr_identifier_or_type_name
     2125        ENUM attribute_list_opt no_attr_identifier
    19502126                {
    19512127                        typedefTable.makeTypedef( *$3 );
    19522128                        $$ = DeclarationNode::newEnum( $3, 0, false )->addQualifiers( $2 );
     2129                }
     2130        | ENUM attribute_list_opt type_name
     2131                {
     2132                        typedefTable.makeTypedef( *$3->type->symbolic.name );
     2133                        $$ = DeclarationNode::newEnum( $3->type->symbolic.name, 0, false )->addQualifiers( $2 );
    19532134                }
    19542135        ;
     
    19682149        ;
    19692150
    1970 // Minimum of one parameter after which ellipsis is allowed only at the end.
    1971 
    1972 cfa_parameter_type_list_opt:                                                    // CFA
     2151cfa_parameter_ellipsis_list_opt:                                                        // CFA, abstract + real
    19732152        // empty
     2153                { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
     2154        | ELLIPSIS
    19742155                { $$ = nullptr; }
    1975         | cfa_parameter_type_list
    1976         ;
    1977 
    1978 cfa_parameter_type_list:                                                                // CFA, abstract + real
    1979         cfa_abstract_parameter_list
     2156        | cfa_abstract_parameter_list
    19802157        | cfa_parameter_list
    19812158        | cfa_parameter_list pop ',' push cfa_abstract_parameter_list
     
    20082185        // empty
    20092186                { $$ = nullptr; }
    2010         | parameter_type_list
    2011         ;
    2012 
    2013 parameter_type_list:
    2014         parameter_list
     2187        | ELLIPSIS
     2188                { $$ = nullptr; }
     2189        | parameter_list
    20152190        | parameter_list pop ',' push ELLIPSIS
    20162191                { $$ = $1->addVarArgs(); }
     
    20542229                // No SUE declaration in parameter list.
    20552230        declaration_specifier_nobody identifier_parameter_declarator default_initialize_opt
    2056                 {
    2057                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    2058                         $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr );
    2059                 }
     2231                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    20602232        | declaration_specifier_nobody type_parameter_redeclarator default_initialize_opt
    2061                 {
    2062                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    2063                         $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr );
    2064                 }
     2233                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    20652234        ;
    20662235
     
    21132282                { $$ = $2; }
    21142283        | '=' VOID
    2115                 { $$ = nullptr; }
     2284                { $$ = new InitializerNode( true ); }
    21162285        | ATassign initializer
    21172286                { $$ = $2->set_maybeConstructed( false ); }
     
    21202289initializer:
    21212290        assignment_expression                                           { $$ = new InitializerNode( $1 ); }
    2122         | '{' initializer_list comma_opt '}'            { $$ = new InitializerNode( $2, true ); }
    2123         ;
    2124 
    2125 initializer_list:
     2291        | '{' initializer_list_opt comma_opt '}'        { $$ = new InitializerNode( $2, true ); }
     2292        ;
     2293
     2294initializer_list_opt:
    21262295        // empty
    21272296                { $$ = nullptr; }
    21282297        | initializer
    21292298        | designation initializer                                       { $$ = $2->set_designators( $1 ); }
    2130         | initializer_list ',' initializer                      { $$ = (InitializerNode *)( $1->set_last( $3 ) ); }
    2131         | initializer_list ',' designation initializer
     2299        | initializer_list_opt ',' initializer          { $$ = (InitializerNode *)( $1->set_last( $3 ) ); }
     2300        | initializer_list_opt ',' designation initializer
    21322301                { $$ = (InitializerNode *)( $1->set_last( $4->set_designators( $3 ) ) ); }
    21332302        ;
     
    21662335        | '[' push constant_expression ELLIPSIS constant_expression pop ']' // GCC, multiple array elements
    21672336                { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $3 ), maybeMoveBuild< Expression >( $5 ) ) ); }
    2168         | '.' '[' push field_list pop ']'                                       // CFA, tuple field selector
     2337        | '.' '[' push field_name_list pop ']'                          // CFA, tuple field selector
    21692338                { $$ = $4; }
    21702339        ;
     
    21902359type_parameter_list:                                                                    // CFA
    21912360        type_parameter
    2192                 { $$ = $1; }
    21932361        | type_parameter_list ',' type_parameter
    21942362                { $$ = $1->appendList( $3 ); }
     
    22042372type_parameter:                                                                                 // CFA
    22052373        type_class no_attr_identifier_or_type_name
    2206                 { typedefTable.addToEnclosingScope( *$2, TypedefTable::TD ); }
     2374                { typedefTable.addToScope( *$2, TYPEDEFname, "9" ); }
    22072375          type_initializer_opt assertion_list_opt
    22082376                { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); }
    22092377        | type_specifier identifier_parameter_declarator
     2378        | assertion_list
     2379                { $$ = DeclarationNode::newTypeParam( DeclarationNode::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); }
    22102380        ;
    22112381
     
    22242394        // empty
    22252395                { $$ = nullptr; }
    2226         | assertion_list_opt assertion
     2396        | assertion_list
     2397        ;
     2398
     2399assertion_list:                                                                                 // CFA
     2400        assertion
     2401        | assertion_list assertion
    22272402                { $$ = $1 ? $1->appendList( $2 ) : $2; }
    22282403        ;
     
    22302405assertion:                                                                                              // CFA
    22312406        '|' no_attr_identifier_or_type_name '(' type_list ')'
    2232                 {
    2233                         typedefTable.openTrait( *$2 );
    2234                         $$ = DeclarationNode::newTraitUse( $2, $4 );
    2235                 }
    2236         | '|' '{' push trait_declaration_list '}'
     2407                { $$ = DeclarationNode::newTraitUse( $2, $4 ); }
     2408        | '|' '{' push trait_declaration_list pop '}'
    22372409                { $$ = $4; }
    2238         | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list '}' '(' type_list ')'
    2239                 { $$ = nullptr; }
     2410        // | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list pop '}' '(' type_list ')'
     2411        //      { SemanticError( yylloc, "Generic data-type assertion is currently unimplemented." ); $$ = nullptr; }
    22402412        ;
    22412413
     
    22442416                { $$ = new ExpressionNode( new TypeExpr( maybeMoveBuildType( $1 ) ) ); }
    22452417        | assignment_expression
     2418                { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $1->build()) ); $$ = nullptr; }
    22462419        | type_list ',' type
    22472420                { $$ = (ExpressionNode *)( $1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) ) ); }
    22482421        | type_list ',' assignment_expression
    2249                 { $$ = (ExpressionNode *)( $1->set_last( $3 )); }
     2422                { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $3->build()) ); $$ = nullptr; }
     2423                // { $$ = (ExpressionNode *)( $1->set_last( $3 )); }
    22502424        ;
    22512425
     
    22692443        no_attr_identifier_or_type_name
    22702444                {
    2271                         typedefTable.addToEnclosingScope( *$1, TypedefTable::TD );
     2445                        typedefTable.addToEnclosingScope( *$1, TYPEDEFname, "10" );
    22722446                        $$ = DeclarationNode::newTypeDecl( $1, 0 );
    22732447                }
    2274         | no_attr_identifier_or_type_name '(' push type_parameter_list pop ')'
    2275                 {
    2276                         typedefTable.addToEnclosingScope( *$1, TypedefTable::TG );
    2277                         $$ = DeclarationNode::newTypeDecl( $1, $4 );
     2448        | no_attr_identifier_or_type_name '(' type_parameter_list ')'
     2449                {
     2450                        typedefTable.addToEnclosingScope( *$1, TYPEGENname, "11" );
     2451                        $$ = DeclarationNode::newTypeDecl( $1, $3 );
    22782452                }
    22792453        ;
    22802454
    22812455trait_specifier:                                                                                // CFA
    2282         TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' '}'
    2283                 {
    2284                         typedefTable.addToEnclosingScope( *$2, TypedefTable::ID );
    2285                         $$ = DeclarationNode::newTrait( $2, $5, 0 );
    2286                 }
    2287         | TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{'
    2288                 {
    2289                         typedefTable.enterTrait( *$2 );
    2290                         typedefTable.enterScope();
    2291                 }
    2292           trait_declaration_list '}'
    2293                 {
    2294                         typedefTable.leaveTrait();
    2295                         typedefTable.addToEnclosingScope( *$2, TypedefTable::ID );
    2296                         $$ = DeclarationNode::newTrait( $2, $5, $10 );
    2297                 }
     2456        TRAIT no_attr_identifier_or_type_name '(' type_parameter_list ')' '{' '}'
     2457                { $$ = DeclarationNode::newTrait( $2, $4, 0 ); }
     2458        | TRAIT no_attr_identifier_or_type_name '(' type_parameter_list ')' '{' push trait_declaration_list pop '}'
     2459                { $$ = DeclarationNode::newTrait( $2, $4, $8 ); }
    22982460        ;
    22992461
    23002462trait_declaration_list:                                                                 // CFA
    23012463        trait_declaration
    2302         | trait_declaration_list push trait_declaration
    2303                 { $$ = $1->appendList( $3 ); }
     2464        | trait_declaration_list pop push trait_declaration
     2465                { $$ = $1->appendList( $4 ); }
    23042466        ;
    23052467
    23062468trait_declaration:                                                                              // CFA
    2307         cfa_trait_declaring_list pop ';'
    2308         | trait_declaring_list pop ';'
     2469        cfa_trait_declaring_list ';'
     2470        | trait_declaring_list ';'
    23092471        ;
    23102472
    23112473cfa_trait_declaring_list:                                                               // CFA
    23122474        cfa_variable_specifier
    2313                 {
    2314                         typedefTable.addToEnclosingScope2( TypedefTable::ID );
    2315                         $$ = $1;
    2316                 }
    23172475        | cfa_function_specifier
    2318                 {
    2319                         typedefTable.addToEnclosingScope2( TypedefTable::ID );
    2320                         $$ = $1;
    2321                 }
    23222476        | cfa_trait_declaring_list pop ',' push identifier_or_type_name
    2323                 {
    2324                         typedefTable.addToEnclosingScope2( *$5, TypedefTable::ID );
    2325                         $$ = $1->appendList( $1->cloneType( $5 ) );
    2326                 }
     2477                { $$ = $1->appendList( $1->cloneType( $5 ) ); }
    23272478        ;
    23282479
    23292480trait_declaring_list:                                                                   // CFA
    23302481        type_specifier declarator
    2331                 {
    2332                         typedefTable.addToEnclosingScope2( TypedefTable::ID );
    2333                         $$ = $2->addType( $1 );
    2334                 }
     2482                { $$ = $2->addType( $1 ); }
    23352483        | trait_declaring_list pop ',' push declarator
    2336                 {
    2337                         typedefTable.addToEnclosingScope2( TypedefTable::ID );
    2338                         $$ = $1->appendList( $1->cloneBaseType( $5 ) );
    2339                 }
     2484                { $$ = $1->appendList( $1->cloneBaseType( $5 ) ); }
    23402485        ;
    23412486
     
    23432488
    23442489translation_unit:
    2345         // empty
    2346                 {}                                                                                              // empty input file
     2490        // empty, input file
    23472491        | external_definition_list
    23482492                { parseTree = parseTree ? parseTree->appendList( $1 ) : $1;     }
     
    23502494
    23512495external_definition_list:
    2352         external_definition
    2353         | external_definition_list push external_definition
     2496        push external_definition pop
     2497                { $$ = $2; }
     2498        | external_definition_list push external_definition pop
    23542499                { $$ = $1 ? $1->appendList( $3 ) : $3; }
    23552500        ;
     
    23612506        ;
    23622507
     2508up:
     2509                { typedefTable.up( forall ); forall = false; }
     2510        ;
     2511
     2512down:
     2513                { typedefTable.down(); }
     2514        ;
     2515
    23632516external_definition:
    23642517        declaration
    23652518        | external_function_definition
     2519        | EXTENSION external_definition                                         // GCC, multiple __extension__ allowed, meaning unknown
     2520                {
     2521                        distExt( $2 );                                                          // mark all fields in list
     2522                        $$ = $2;
     2523                }
    23662524        | ASM '(' string_literal ')' ';'                                        // GCC, global assembler statement
    23672525                {
    2368                         $$ = DeclarationNode::newAsmStmt( new StatementNode( build_asmstmt( false, $3, 0 ) ) );
     2526                        $$ = DeclarationNode::newAsmStmt( new StatementNode( build_asm( false, $3, 0 ) ) );
    23692527                }
    23702528        | EXTERN STRINGliteral                                                          // C++-style linkage specifier
    23712529                {
    23722530                        linkageStack.push( linkage );                           // handle nested extern "C"/"Cforall"
    2373                         linkage = LinkageSpec::linkageUpdate( linkage, $2 );
    2374                 }
    2375           '{' external_definition_list_opt '}'
     2531                        linkage = LinkageSpec::linkageUpdate( yylloc, linkage, $2 );
     2532                }
     2533          '{' up external_definition_list_opt down '}'
    23762534                {
    23772535                        linkage = linkageStack.top();
    23782536                        linkageStack.pop();
     2537                        $$ = $6;
     2538                }
     2539        | type_qualifier_list
     2540                {
     2541                        if ( $1->type->qualifiers.val ) { SemanticError( yylloc, "CV qualifiers cannot be distributed; only storage-class and forall qualifiers." ); }
     2542                        if ( $1->type->forall ) forall = true;          // remember generic type
     2543                }
     2544          '{' up external_definition_list_opt down '}'          // CFA, namespace
     2545                {
     2546                        distQual( $5, $1 );
     2547                        forall = false;
    23792548                        $$ = $5;
    23802549                }
    2381         | EXTENSION external_definition                                         // GCC, multiple __extension__ allowed, meaning unknown
    2382                 {
    2383                         distExt( $2 );                                                          // mark all fields in list
    2384                         $$ = $2;
    2385                 }
    2386         | forall '{' external_definition_list '}'                       // CFA, namespace
     2550        | declaration_qualifier_list
     2551                {
     2552                        if ( $1->type && $1->type->qualifiers.val ) { SemanticError( yylloc, "CV qualifiers cannot be distributed; only storage-class and forall qualifiers." ); }
     2553                        if ( $1->type && $1->type->forall ) forall = true; // remember generic type
     2554                }
     2555          '{' up external_definition_list_opt down '}'          // CFA, namespace
     2556                {
     2557                        distQual( $5, $1 );
     2558                        forall = false;
     2559                        $$ = $5;
     2560                }
     2561        | declaration_qualifier_list type_qualifier_list
     2562                {
     2563                        if ( ($1->type && $1->type->qualifiers.val) || $2->type->qualifiers.val ) { SemanticError( yylloc, "CV qualifiers cannot be distributed; only storage-class and forall qualifiers." ); }
     2564                        if ( ($1->type && $1->type->forall) || $2->type->forall ) forall = true; // remember generic type
     2565                }
     2566          '{' up external_definition_list_opt down '}'          // CFA, namespace
     2567                {
     2568                        distQual( $6, $1->addQualifiers( $2 ) );
     2569                        forall = false;
     2570                        $$ = $6;
     2571                }
    23872572        ;
    23882573
     
    23952580                // declaration must still have a type_specifier.  OBSOLESCENT (see 1)
    23962581        | function_declarator compound_statement
    2397                 {
    2398                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    2399                         typedefTable.leaveScope();
    2400                         $$ = $1->addFunctionBody( $2 );
    2401                 }
    2402         | KR_function_declarator KR_declaration_list_opt compound_statement
    2403                 {
    2404                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    2405                         typedefTable.leaveScope();
    2406                         $$ = $1->addOldDeclList( $2 )->addFunctionBody( $3 );
    2407                 }
     2582                { $$ = $1->addFunctionBody( $2 ); }
     2583        | KR_function_declarator KR_parameter_list_opt compound_statement
     2584                { $$ = $1->addOldDeclList( $2 )->addFunctionBody( $3 ); }
    24082585        ;
    24092586
    24102587with_clause_opt:
    24112588        // empty
    2412                 { $$ = nullptr; }
     2589                { $$ = nullptr; forall = false; }
    24132590        | WITH '(' tuple_expression_list ')'
    2414                 { $$ = new StatementNode( build_with( $3, nullptr ) ); }
     2591                { $$ = $3; forall = false; }
    24152592        ;
    24162593
     
    24182595        cfa_function_declaration with_clause_opt compound_statement     // CFA
    24192596                {
    2420                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    2421                         typedefTable.leaveScope();
    24222597                        // Add the function body to the last identifier in the function definition list, i.e., foo3:
    24232598                        //   [const double] foo1(), foo2( int ), foo3( double ) { return 3.0; }
     
    24282603                {
    24292604                        rebindForall( $1, $2 );
    2430                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    2431                         typedefTable.leaveScope();
     2605                        $$ = $2->addFunctionBody( $4, $3 )->addType( $1 );
     2606                }
     2607        | declaration_specifier variable_type_redeclarator with_clause_opt compound_statement
     2608                {
     2609                        rebindForall( $1, $2 );
    24322610                        $$ = $2->addFunctionBody( $4, $3 )->addType( $1 );
    24332611                }
    24342612                // handles default int return type, OBSOLESCENT (see 1)
    24352613        | type_qualifier_list function_declarator with_clause_opt compound_statement
    2436                 {
    2437                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    2438                         typedefTable.leaveScope();
    2439                         $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 );
    2440                 }
     2614                { $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 ); }
    24412615                // handles default int return type, OBSOLESCENT (see 1)
    24422616        | declaration_qualifier_list function_declarator with_clause_opt compound_statement
    2443                 {
    2444                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    2445                         typedefTable.leaveScope();
    2446                         $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 );
    2447                 }
     2617                { $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 ); }
    24482618                // handles default int return type, OBSOLESCENT (see 1)
    24492619        | declaration_qualifier_list type_qualifier_list function_declarator with_clause_opt compound_statement
    2450                 {
    2451                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    2452                         typedefTable.leaveScope();
    2453                         $$ = $3->addFunctionBody( $5, $4 )->addQualifiers( $2 )->addQualifiers( $1 );
    2454                 }
     2620                { $$ = $3->addFunctionBody( $5, $4 )->addQualifiers( $2 )->addQualifiers( $1 ); }
    24552621
    24562622                // Old-style K&R function definition, OBSOLESCENT (see 4)
    2457         | declaration_specifier KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
     2623        | declaration_specifier KR_function_declarator KR_parameter_list_opt with_clause_opt compound_statement
    24582624                {
    24592625                        rebindForall( $1, $2 );
    2460                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    2461                         typedefTable.leaveScope();
    24622626                        $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addType( $1 );
    24632627                }
    24642628                // handles default int return type, OBSOLESCENT (see 1)
    2465         | type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    2466                 {
    2467                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    2468                         typedefTable.leaveScope();
    2469                         $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 );
    2470                 }
     2629        | type_qualifier_list KR_function_declarator KR_parameter_list_opt with_clause_opt compound_statement
     2630                { $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 ); }
    24712631                // handles default int return type, OBSOLESCENT (see 1)
    2472         | declaration_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    2473                 {
    2474                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    2475                         typedefTable.leaveScope();
    2476                         $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 );
    2477                 }
     2632        | declaration_qualifier_list KR_function_declarator KR_parameter_list_opt with_clause_opt compound_statement
     2633                { $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 ); }
    24782634                // handles default int return type, OBSOLESCENT (see 1)
    2479         | declaration_qualifier_list type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    2480                 {
    2481                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    2482                         typedefTable.leaveScope();
    2483                         $$ = $3->addOldDeclList( $4 )->addFunctionBody( $6, $5 )->addQualifiers( $2 )->addQualifiers( $1 );
    2484                 }
     2635        | declaration_qualifier_list type_qualifier_list KR_function_declarator KR_parameter_list_opt with_clause_opt compound_statement
     2636                { $$ = $3->addOldDeclList( $4 )->addFunctionBody( $6, $5 )->addQualifiers( $2 )->addQualifiers( $1 ); }
    24852637        ;
    24862638
     
    25922744paren_identifier:
    25932745        identifier
    2594                 {
    2595                         typedefTable.setNextIdentifier( *$1 );
    2596                         $$ = DeclarationNode::newName( $1 );
    2597                 }
     2746                { $$ = DeclarationNode::newName( $1 ); }
    25982747        | '(' paren_identifier ')'                                                      // redundant parenthesis
    25992748                { $$ = $2; }
     
    27282877paren_type:
    27292878        typedef
     2879                // hide type name in enclosing scope by variable name
     2880                {
     2881                        // if ( ! typedefTable.existsCurr( *$1->name ) ) {
     2882                                typedefTable.addToEnclosingScope( *$1->name, IDENTIFIER, "ID" );
     2883                        // } else {
     2884                        //      SemanticError( yylloc, string("'") + *$1->name + "' redeclared as different kind of symbol." ); $$ = nullptr;
     2885                        // } // if
     2886                }
    27302887        | '(' paren_type ')'
    27312888                { $$ = $2; }
     
    27382895                { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); }
    27392896        | '(' type_ptr ')' attribute_list_opt
    2740                 { $$ = $2->addQualifiers( $4 ); }
     2897                { $$ = $2->addQualifiers( $4 ); }                               // redundant parenthesis
    27412898        ;
    27422899
     
    28302987typedef:
    28312988        TYPEDEFname
    2832                 {
    2833                         typedefTable.setNextIdentifier( *$1 );
    2834                         $$ = DeclarationNode::newName( $1 );
    2835                 }
     2989                { $$ = DeclarationNode::newName( $1 ); }
    28362990        | TYPEGENname
    2837                 {
    2838                         typedefTable.setNextIdentifier( *$1 );
    2839                         $$ = DeclarationNode::newName( $1 );
    2840                 }
     2991                { $$ = DeclarationNode::newName( $1 ); }
    28412992        ;
    28422993
     
    30233174        '[' ']'
    30243175                { $$ = DeclarationNode::newArray( 0, 0, false ); }
    3025         // multi_array_dimension handles the '[' '*' ']' case
     3176                // multi_array_dimension handles the '[' '*' ']' case
    30263177        | '[' push type_qualifier_list '*' pop ']'                      // remaining C99
    30273178                { $$ = DeclarationNode::newVarArray( $3 ); }
    30283179        | '[' push type_qualifier_list pop ']'
    30293180                { $$ = DeclarationNode::newArray( 0, $3, false ); }
    3030         // multi_array_dimension handles the '[' assignment_expression ']' case
     3181                // multi_array_dimension handles the '[' assignment_expression ']' case
    30313182        | '[' push type_qualifier_list assignment_expression pop ']'
    30323183                { $$ = DeclarationNode::newArray( $4, $3, false ); }
     
    31643315//
    31653316//              cfa_abstract_tuple identifier_or_type_name
    3166 //              '[' cfa_parameter_list ']' identifier_or_type_name '(' cfa_parameter_type_list_opt ')'
     3317//              '[' cfa_parameter_list ']' identifier_or_type_name '(' cfa_parameter_ellipsis_list_opt ')'
    31673318//
    31683319// since a function return type can be syntactically identical to a tuple type:
     
    32233374        '[' push cfa_abstract_parameter_list pop ']'
    32243375                { $$ = DeclarationNode::newTuple( $3 ); }
     3376        | '[' push type_specifier_nobody ELLIPSIS pop ']'
     3377                { SemanticError( yylloc, "Tuple array currently unimplemented." ); $$ = nullptr; }
     3378        | '[' push type_specifier_nobody ELLIPSIS constant_expression pop ']'
     3379                { SemanticError( yylloc, "Tuple array currently unimplemented." ); $$ = nullptr; }
    32253380        ;
    32263381
    32273382cfa_abstract_function:                                                                  // CFA
    3228 //      '[' ']' '(' cfa_parameter_type_list_opt ')'
     3383//      '[' ']' '(' cfa_parameter_ellipsis_list_opt ')'
    32293384//              { $$ = DeclarationNode::newFunction( nullptr, DeclarationNode::newTuple( nullptr ), $4, nullptr ); }
    3230         cfa_abstract_tuple '(' push cfa_parameter_type_list_opt pop ')'
     3385        cfa_abstract_tuple '(' push cfa_parameter_ellipsis_list_opt pop ')'
    32313386                { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); }
    3232         | cfa_function_return '(' push cfa_parameter_type_list_opt pop ')'
     3387        | cfa_function_return '(' push cfa_parameter_ellipsis_list_opt pop ')'
    32333388                { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); }
    32343389        ;
     
    32613416
    32623417%%
     3418
    32633419// ----end of grammar----
    32643420
  • src/ResolvExpr/AdjustExprType.cc

    rf9feab8 r90152a4  
    2424        class AdjustExprType : public WithShortCircuiting {
    2525          public:
    26                 AdjustExprType( const TypeEnvironment &env, const SymTab::Indexer &indexer );
     26                AdjustExprType( const TypeEnvironment & env, const SymTab::Indexer & indexer );
    2727                void premutate( VoidType * ) { visit_children = false; }
    2828                void premutate( BasicType * ) { visit_children = false; }
     
    4545
    4646          private:
    47                 const TypeEnvironment &env;
    48                 const SymTab::Indexer &indexer;
     47                const TypeEnvironment & env;
     48                const SymTab::Indexer & indexer;
    4949        };
    5050
     
    5555        }
    5656
     57        void adjustExprType( Type *& type ) {
     58                TypeEnvironment env;
     59                SymTab::Indexer indexer;
     60                adjustExprType( type, env, indexer );
     61        }
     62
    5763        AdjustExprType::AdjustExprType( const TypeEnvironment &env, const SymTab::Indexer &indexer )
    5864                : env( env ), indexer( indexer ) {
     
    6066
    6167        Type * AdjustExprType::postmutate( ArrayType * arrayType ) {
    62                 PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), arrayType->base );
     68                PointerType *pointerType = new PointerType{ arrayType->get_qualifiers(), arrayType->base };
    6369                arrayType->base = nullptr;
    6470                delete arrayType;
     
    6773
    6874        Type * AdjustExprType::postmutate( FunctionType * functionType ) {
    69                 return new PointerType( Type::Qualifiers(), functionType );
     75                return new PointerType{ Type::Qualifiers(), functionType };
    7076        }
    7177
    7278        Type * AdjustExprType::postmutate( TypeInstType * typeInst ) {
    73                 EqvClass eqvClass;
    74                 if ( env.lookup( typeInst->get_name(), eqvClass ) ) {
    75                         if ( eqvClass.data.kind == TypeDecl::Ftype ) {
    76                                 PointerType *pointerType = new PointerType( Type::Qualifiers(), typeInst );
    77                                 return pointerType;
     79                if ( const EqvClass* eqvClass = env.lookup( typeInst->get_name() ) ) {
     80                        if ( eqvClass->data.kind == TypeDecl::Ftype ) {
     81                                return new PointerType{ Type::Qualifiers(), typeInst };
    7882                        }
    7983                } else if ( NamedTypeDecl *ntDecl = indexer.lookupType( typeInst->get_name() ) ) {
    8084                        if ( TypeDecl *tyDecl = dynamic_cast< TypeDecl* >( ntDecl ) ) {
    8185                                if ( tyDecl->get_kind() == TypeDecl::Ftype ) {
    82                                         PointerType *pointerType = new PointerType( Type::Qualifiers(), typeInst );
    83                                         return pointerType;
     86                                        return new PointerType{ Type::Qualifiers(), typeInst };
    8487                                } // if
    8588                        } // if
  • src/ResolvExpr/Alternative.cc

    rf9feab8 r90152a4  
    2727
    2828namespace ResolvExpr {
    29         Alternative::Alternative() : cost( Cost::zero ), cvtCost( Cost::zero ), expr( 0 ) {}
     29        Alternative::Alternative() : cost( Cost::zero ), cvtCost( Cost::zero ), expr( nullptr ) {}
    3030
    3131        Alternative::Alternative( Expression *expr, const TypeEnvironment &env, const Cost& cost )
     
    4848        }
    4949
    50         Alternative::Alternative( Alternative && other ) : cost( other.cost ), cvtCost( other.cvtCost ), expr( other.expr ), env( other.env ) {
     50        Alternative::Alternative( Alternative && other ) : cost( other.cost ), cvtCost( other.cvtCost ), expr( other.expr ), env( std::move( other.env ) ) {
    5151                other.expr = nullptr;
    5252        }
     
    5858                cvtCost = other.cvtCost;
    5959                expr = other.expr;
    60                 env = other.env;
     60                env = std::move( other.env );
    6161                other.expr = nullptr;
    6262                return *this;
  • src/ResolvExpr/Alternative.h

    rf9feab8 r90152a4  
    5757        /// Moves all elements from src to the beginning of dst
    5858        void spliceBegin( AltList& dst, AltList& src );
     59
     60        static inline std::ostream & operator<<(std::ostream & os, const ResolvExpr::Alternative & alt) {
     61                alt.print( os );
     62                return os;
     63        }
    5964} // namespace ResolvExpr
    6065
  • src/ResolvExpr/AlternativeFinder.cc

    rf9feab8 r90152a4  
    1010// Created On       : Sat May 16 23:52:08 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Aug 28 13:47:24 2017
    13 // Update Count     : 32
     12// Last Modified On : Sat Feb 17 11:19:39 2018
     13// Update Count     : 33
    1414//
    1515
     
    2525#include <vector>                  // for vector
    2626
     27#include "CompilationState.h"      // for resolvep
    2728#include "Alternative.h"           // for AltList, Alternative
    2829#include "AlternativeFinder.h"
     
    4950#include "typeops.h"               // for adjustExprType, polyCost, castCost
    5051
    51 extern bool resolvep;
    5252#define PRINT( text ) if ( resolvep ) { text }
    5353//#define DEBUG_COST
     
    6060
    6161namespace ResolvExpr {
    62         Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env ) {
    63                 CastExpr *castToVoid = new CastExpr( expr );
    64 
    65                 AlternativeFinder finder( indexer, env );
    66                 finder.findWithAdjustment( castToVoid );
    67 
    68                 // it's a property of the language that a cast expression has either 1 or 0 interpretations; if it has 0
    69                 // interpretations, an exception has already been thrown.
    70                 assert( finder.get_alternatives().size() == 1 );
    71                 CastExpr *newExpr = dynamic_cast< CastExpr* >( finder.get_alternatives().front().expr );
    72                 assert( newExpr );
    73                 env = finder.get_alternatives().front().env;
    74                 return newExpr->get_arg()->clone();
    75         }
     62        struct AlternativeFinder::Finder : public WithShortCircuiting {
     63                Finder( AlternativeFinder & altFinder ) : altFinder( altFinder ), indexer( altFinder.indexer ), alternatives( altFinder.alternatives ), env( altFinder.env ), targetType( altFinder.targetType )  {}
     64
     65                void previsit( BaseSyntaxNode * ) { visit_children = false; }
     66
     67                void postvisit( ApplicationExpr * applicationExpr );
     68                void postvisit( UntypedExpr * untypedExpr );
     69                void postvisit( AddressExpr * addressExpr );
     70                void postvisit( LabelAddressExpr * labelExpr );
     71                void postvisit( CastExpr * castExpr );
     72                void postvisit( VirtualCastExpr * castExpr );
     73                void postvisit( UntypedMemberExpr * memberExpr );
     74                void postvisit( MemberExpr * memberExpr );
     75                void postvisit( NameExpr * variableExpr );
     76                void postvisit( VariableExpr * variableExpr );
     77                void postvisit( ConstantExpr * constantExpr );
     78                void postvisit( SizeofExpr * sizeofExpr );
     79                void postvisit( AlignofExpr * alignofExpr );
     80                void postvisit( UntypedOffsetofExpr * offsetofExpr );
     81                void postvisit( OffsetofExpr * offsetofExpr );
     82                void postvisit( OffsetPackExpr * offsetPackExpr );
     83                void postvisit( AttrExpr * attrExpr );
     84                void postvisit( LogicalExpr * logicalExpr );
     85                void postvisit( ConditionalExpr * conditionalExpr );
     86                void postvisit( CommaExpr * commaExpr );
     87                void postvisit( ImplicitCopyCtorExpr  * impCpCtorExpr );
     88                void postvisit( ConstructorExpr  * ctorExpr );
     89                void postvisit( RangeExpr  * rangeExpr );
     90                void postvisit( UntypedTupleExpr * tupleExpr );
     91                void postvisit( TupleExpr * tupleExpr );
     92                void postvisit( TupleIndexExpr * tupleExpr );
     93                void postvisit( TupleAssignExpr * tupleExpr );
     94                void postvisit( UniqueExpr * unqExpr );
     95                void postvisit( StmtExpr * stmtExpr );
     96                void postvisit( UntypedInitExpr * initExpr );
     97                void postvisit( InitExpr * initExpr );
     98                void postvisit( DeletedExpr * delExpr );
     99                void postvisit( GenericExpr * genExpr );
     100
     101                /// Adds alternatives for anonymous members
     102                void addAnonConversions( const Alternative & alt );
     103                /// Adds alternatives for member expressions, given the aggregate, conversion cost for that aggregate, and name of the member
     104                template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, const std::string & name );
     105                /// Adds alternatives for member expressions where the left side has tuple type
     106                void addTupleMembers( TupleType * tupleType, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member );
     107                /// Adds alternatives for offsetof expressions, given the base type and name of the member
     108                template< typename StructOrUnionType > void addOffsetof( StructOrUnionType *aggInst, const std::string &name );
     109                /// Takes a final result and checks if its assertions can be satisfied
     110                template<typename OutputIterator>
     111                void validateFunctionAlternative( const Alternative &func, ArgPack& result, const std::vector<ArgPack>& results, OutputIterator out );
     112                /// Finds matching alternatives for a function, given a set of arguments
     113                template<typename OutputIterator>
     114                void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, const ExplodedArgs& args, OutputIterator out );
     115                /// Checks if assertion parameters match for a new alternative
     116                template< typename OutputIterator >
     117                void inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out );
     118        private:
     119                AlternativeFinder & altFinder;
     120                const SymTab::Indexer &indexer;
     121                AltList & alternatives;
     122                const TypeEnvironment &env;
     123                Type *& targetType;
     124        };
    76125
    77126        Cost sumCost( const AltList &in ) {
     
    127176                                                selected[ mangleName ] = current;
    128177                                        } else if ( candidate->cost == mapPlace->second.candidate->cost ) {
    129                                                 PRINT(
    130                                                         std::cerr << "marking ambiguous" << std::endl;
    131                                                 )
    132                                                 mapPlace->second.isAmbiguous = true;
     178                                                // if one of the candidates contains a deleted identifier, can pick the other, since
     179                                                // deleted expressions should not be ambiguous if there is another option that is at least as good
     180                                                if ( findDeletedExpr( candidate->expr ) ) {
     181                                                        // do nothing
     182                                                        PRINT( std::cerr << "candidate is deleted" << std::endl; )
     183                                                } else if ( findDeletedExpr( mapPlace->second.candidate->expr ) ) {
     184                                                        PRINT( std::cerr << "current is deleted" << std::endl; )
     185                                                        selected[ mangleName ] = current;
     186                                                } else {
     187                                                        PRINT(
     188                                                                std::cerr << "marking ambiguous" << std::endl;
     189                                                        )
     190                                                        mapPlace->second.isAmbiguous = true;
     191                                                }
    133192                                        } else {
    134193                                                PRINT(
     
    152211
    153212                void renameTypes( Expression *expr ) {
    154                         expr->get_result()->accept( global_renamer );
     213                        renameTyVars( expr->result );
    155214                }
    156215        } // namespace
    157216
    158         void referenceToRvalueConversion( Expression *& expr ) {
     217        void referenceToRvalueConversion( Expression *& expr, Cost & cost ) {
    159218                if ( dynamic_cast< ReferenceType * >( expr->get_result() ) ) {
    160219                        // cast away reference from expr
    161220                        expr = new CastExpr( expr, expr->get_result()->stripReferences()->clone() );
     221                        cost.incReference();
    162222                }
    163223        }
     
    185245
    186246        void AlternativeFinder::find( Expression *expr, bool adjust, bool prune, bool failFast ) {
    187                 expr->accept( *this );
     247                PassVisitor<Finder> finder( *this );
     248                expr->accept( finder );
    188249                if ( failFast && alternatives.empty() ) {
    189250                        PRINT(
    190251                                std::cerr << "No reasonable alternatives for expression " << expr << std::endl;
    191252                        )
    192                         throw SemanticError( "No reasonable alternatives for expression ", expr );
     253                        SemanticError( expr, "No reasonable alternatives for expression " );
    193254                }
    194255                if ( prune ) {
     
    206267                                stream << "Cannot choose between " << winners.size() << " alternatives for expression\n";
    207268                                expr->print( stream );
    208                                 stream << "Alternatives are:\n";
     269                                stream << " Alternatives are:\n";
    209270                                printAlts( winners, stream, 1 );
    210                                 throw SemanticError( stream.str() );
     271                                SemanticError( expr->location, stream.str() );
    211272                        }
    212273                        alternatives = move(pruned);
     
    244305        }
    245306
    246         void AlternativeFinder::addAnonConversions( const Alternative & alt ) {
     307        void AlternativeFinder::Finder::addAnonConversions( const Alternative & alt ) {
    247308                // adds anonymous member interpretations whenever an aggregate value type is seen.
    248309                // it's okay for the aggregate expression to have reference type -- cast it to the base type to treat the aggregate as the referenced value
    249310                std::unique_ptr<Expression> aggrExpr( alt.expr->clone() );
    250                 alt.env.apply( aggrExpr->get_result() );
    251                 Type * aggrType = aggrExpr->get_result();
     311                alt.env.apply( aggrExpr->result );
     312                Type * aggrType = aggrExpr->result;
    252313                if ( dynamic_cast< ReferenceType * >( aggrType ) ) {
    253314                        aggrType = aggrType->stripReferences();
     
    255316                }
    256317
    257                 if ( StructInstType *structInst = dynamic_cast< StructInstType* >( aggrExpr->get_result() ) ) {
    258                         NameExpr nameExpr( "" );
    259                         addAggMembers( structInst, aggrExpr.get(), alt.cost+Cost::safe, alt.env, &nameExpr );
    260                 } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( aggrExpr->get_result() ) ) {
    261                         NameExpr nameExpr( "" );
    262                         addAggMembers( unionInst, aggrExpr.get(), alt.cost+Cost::safe, alt.env, &nameExpr );
     318                if ( StructInstType *structInst = dynamic_cast< StructInstType* >( aggrExpr->result ) ) {
     319                        addAggMembers( structInst, aggrExpr.get(), alt.cost+Cost::safe, alt.env, "" );
     320                } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( aggrExpr->result ) ) {
     321                        addAggMembers( unionInst, aggrExpr.get(), alt.cost+Cost::safe, alt.env, "" );
    263322                } // if
    264323        }
    265324
    266325        template< typename StructOrUnionType >
    267         void AlternativeFinder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) {
    268                 // by this point, member must be a name expr
    269                 NameExpr * nameExpr = dynamic_cast< NameExpr * >( member );
    270                 if ( ! nameExpr ) return;
    271                 const std::string & name = nameExpr->get_name();
     326        void AlternativeFinder::Finder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, const std::string & name ) {
    272327                std::list< Declaration* > members;
    273328                aggInst->lookup( name, members );
    274329
    275                 for ( std::list< Declaration* >::const_iterator i = members.begin(); i != members.end(); ++i ) {
    276                         if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType* >( *i ) ) {
    277                                 alternatives.push_back( Alternative( new MemberExpr( dwt, expr->clone() ), env, newCost ) );
    278                                 renameTypes( alternatives.back().expr );
    279                                 addAnonConversions( alternatives.back() ); // add anonymous member interpretations whenever an aggregate value type is seen as a member expression.
     330                for ( Declaration * decl : members ) {
     331                        if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType* >( decl ) ) {
     332                                // addAnonAlternatives uses vector::push_back, which invalidates references to existing elements, so
     333                                // can't construct in place and use vector::back
     334                                Alternative newAlt( new MemberExpr( dwt, expr->clone() ), env, newCost );
     335                                renameTypes( newAlt.expr );
     336                                addAnonConversions( newAlt ); // add anonymous member interpretations whenever an aggregate value type is seen as a member expression.
     337                                alternatives.push_back( std::move(newAlt) );
    280338                        } else {
    281339                                assert( false );
     
    284342        }
    285343
    286         void AlternativeFinder::addTupleMembers( TupleType * tupleType, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) {
     344        void AlternativeFinder::Finder::addTupleMembers( TupleType * tupleType, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) {
    287345                if ( ConstantExpr * constantExpr = dynamic_cast< ConstantExpr * >( member ) ) {
    288346                        // get the value of the constant expression as an int, must be between 0 and the length of the tuple type to have meaning
    289                         // xxx - this should be improved by memoizing the value of constant exprs
    290                         // during parsing and reusing that information here.
    291                         std::stringstream ss( constantExpr->get_constant()->get_value() );
    292                         int val = 0;
     347                        auto val = constantExpr->intValue();
    293348                        std::string tmp;
    294                         if ( ss >> val && ! (ss >> tmp) ) {
    295                                 if ( val >= 0 && (unsigned int)val < tupleType->size() ) {
    296                                         alternatives.push_back( Alternative( new TupleIndexExpr( expr->clone(), val ), env, newCost ) );
    297                                 } // if
     349                        if ( val >= 0 && (unsigned long long)val < tupleType->size() ) {
     350                                alternatives.push_back( Alternative( new TupleIndexExpr( expr->clone(), val ), env, newCost ) );
    298351                        } // if
    299                 } else if ( NameExpr * nameExpr = dynamic_cast< NameExpr * >( member ) ) {
    300                         // xxx - temporary hack until 0/1 are int constants
    301                         if ( nameExpr->get_name() == "0" || nameExpr->get_name() == "1" ) {
    302                                 std::stringstream ss( nameExpr->get_name() );
    303                                 int val;
    304                                 ss >> val;
    305                                 alternatives.push_back( Alternative( new TupleIndexExpr( expr->clone(), val ), env, newCost ) );
    306                         }
    307352                } // if
    308353        }
    309354
    310         void AlternativeFinder::visit( ApplicationExpr *applicationExpr ) {
     355        void AlternativeFinder::Finder::postvisit( ApplicationExpr *applicationExpr ) {
    311356                alternatives.push_back( Alternative( applicationExpr->clone(), env, Cost::zero ) );
    312357        }
     
    386431                                        PRINT( std::cerr << "end of formals with varargs function: inc unsafe: " << convCost << std::endl; ; )
    387432                                        // convert reference-typed expressions to value-typed expressions
    388                                         referenceToRvalueConversion( *actualExpr );
     433                                        referenceToRvalueConversion( *actualExpr, convCost );
    389434                                        continue;
    390435                                } else {
     
    392437                                }
    393438                        }
     439                        if ( DefaultArgExpr * def = dynamic_cast< DefaultArgExpr * >( *actualExpr ) ) {
     440                                // default arguments should be free - don't include conversion cost.
     441                                // Unwrap them here because they are not relevant to the rest of the system.
     442                                *actualExpr = def->expr;
     443                                ++formal;
     444                                continue;
     445                        }
    394446                        Type * formalType = (*formal)->get_type();
    395447                        convCost += computeExpressionConversionCost( *actualExpr, formalType, indexer, alt.env );
     
    409461        /// Adds type variables to the open variable set and marks their assertions
    410462        void makeUnifiableVars( Type *type, OpenVarSet &unifiableVars, AssertionSet &needAssertions ) {
    411                 for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
     463                for ( Type::ForallList::const_iterator tyvar = type->forall.begin(); tyvar != type->forall.end(); ++tyvar ) {
    412464                        unifiableVars[ (*tyvar)->get_name() ] = TypeDecl::Data{ *tyvar };
    413                         for ( std::list< DeclarationWithType* >::iterator assert = (*tyvar)->get_assertions().begin(); assert != (*tyvar)->get_assertions().end(); ++assert ) {
     465                        for ( std::list< DeclarationWithType* >::iterator assert = (*tyvar)->assertions.begin(); assert != (*tyvar)->assertions.end(); ++assert ) {
    414466                                needAssertions[ *assert ].isUsed = true;
    415467                        }
     
    418470        }
    419471
    420         // /// Map of declaration uniqueIds (intended to be the assertions in an AssertionSet) to their parents and the number of times they've been included
    421         //typedef std::unordered_map< UniqueId, std::unordered_map< UniqueId, unsigned > > AssertionParentSet;
    422 
    423472        static const int recursionLimit = /*10*/ 4;  ///< Limit to depth of recursion satisfaction
    424         //static const unsigned recursionParentLimit = 1;  ///< Limit to the number of times an assertion can recursively use itself
    425473
    426474        void addToIndexer( AssertionSet &assertSet, SymTab::Indexer &indexer ) {
     
    433481
    434482        template< typename ForwardIterator, typename OutputIterator >
    435         void inferRecursive( ForwardIterator begin, ForwardIterator end, const Alternative &newAlt, OpenVarSet &openVars, const SymTab::Indexer &decls, const AssertionSet &newNeed, /*const AssertionParentSet &needParents,*/
    436                                                  int level, const SymTab::Indexer &indexer, OutputIterator out ) {
     483        void inferRecursive( ForwardIterator begin, ForwardIterator end, const Alternative &newAlt, OpenVarSet &openVars, const SymTab::Indexer &decls, const AssertionSet &newNeed, int level, const SymTab::Indexer &indexer, OutputIterator out ) {
     484                if ( newAlt.cost == Cost::infinity ) return; // don't proceed down this dead end
    437485                if ( begin == end ) {
    438486                        if ( newNeed.empty() ) {
     
    445493                                return;
    446494                        } else if ( level >= recursionLimit ) {
    447                                 throw SemanticError( "Too many recursive assertions" );
     495                                SemanticError( newAlt.expr->location, "Too many recursive assertions" );
    448496                        } else {
    449497                                AssertionSet newerNeed;
     
    452500                                        printAssertionSet( newNeed, std::cerr, 8 );
    453501                                )
    454                                 inferRecursive( newNeed.begin(), newNeed.end(), newAlt, openVars, decls, newerNeed, /*needParents,*/ level+1, indexer, out );
     502                                inferRecursive( newNeed.begin(), newNeed.end(), newAlt, openVars, decls, newerNeed, level+1, indexer, out );
    455503                                return;
    456504                        }
     
    459507                ForwardIterator cur = begin++;
    460508                if ( ! cur->second.isUsed ) {
    461                         inferRecursive( begin, end, newAlt, openVars, decls, newNeed, /*needParents,*/ level, indexer, out );
     509                        inferRecursive( begin, end, newAlt, openVars, decls, newNeed, level, indexer, out );
    462510                        return; // xxx - should this continue? previously this wasn't here, and it looks like it should be
    463511                }
     
    485533                        Type *adjType = candidate->get_type()->clone();
    486534                        adjustExprType( adjType, newEnv, indexer );
    487                         adjType->accept( global_renamer );
     535                        renameTyVars( adjType );
    488536                        PRINT(
    489537                                std::cerr << "unifying ";
     
    512560                                }
    513561
    514                                 //AssertionParentSet newNeedParents( needParents );
    515                                 // skip repeatingly-self-recursive assertion satisfaction
    516                                 // DOESN'T WORK: grandchild nodes conflict with their cousins
    517                                 //if ( newNeedParents[ curDecl->get_uniqueId() ][ candDecl->get_uniqueId() ]++ > recursionParentLimit ) continue;
    518                                 Expression *varExpr = data.combine();
     562                                Expression *varExpr = data.combine( newerAlt.cvtCost );
    519563                                delete varExpr->get_result();
    520564                                varExpr->set_result( adjType->clone() );
     
    533577                                // XXX: this is a memory leak, but adjType can't be deleted because it might contain assertions
    534578                                (*inferParameters)[ curDecl->get_uniqueId() ] = ParamEntry( candidate->get_uniqueId(), adjType->clone(), curDecl->get_type()->clone(), varExpr );
    535                                 inferRecursive( begin, end, newerAlt, newOpenVars, newDecls, newerNeed, /*newNeedParents,*/ level, indexer, out );
     579                                inferRecursive( begin, end, newerAlt, newOpenVars, newDecls, newerNeed, level, indexer, out );
    536580                        } else {
    537581                                delete adjType;
     
    541585
    542586        template< typename OutputIterator >
    543         void AlternativeFinder::inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out ) {
     587        void AlternativeFinder::Finder::inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out ) {
    544588//      PRINT(
    545589//          std::cerr << "inferParameters: assertions needed are" << std::endl;
     
    555599                addToIndexer( have, decls );
    556600                AssertionSet newNeed;
    557                 //AssertionParentSet needParents;
    558601                PRINT(
    559602                        std::cerr << "env is: " << std::endl;
     
    562605                )
    563606
    564                 inferRecursive( need.begin(), need.end(), newAlt, openVars, decls, newNeed, /*needParents,*/ 0, indexer, out );
     607                inferRecursive( need.begin(), need.end(), newAlt, openVars, decls, newNeed, 0, indexer, out );
    565608//      PRINT(
    566609//          std::cerr << "declaration 14 is ";
     
    573616        ConstantExpr* getDefaultValue( Initializer* init ) {
    574617                if ( SingleInit* si = dynamic_cast<SingleInit*>( init ) ) {
    575                         if ( CastExpr* ce = dynamic_cast<CastExpr*>( si->get_value() ) ) {
    576                                 return dynamic_cast<ConstantExpr*>( ce->get_arg() );
     618                        if ( CastExpr* ce = dynamic_cast<CastExpr*>( si->value ) ) {
     619                                return dynamic_cast<ConstantExpr*>( ce->arg );
     620                        } else {
     621                                return dynamic_cast<ConstantExpr*>( si->value );
    577622                        }
    578623                }
     
    596641                ArgPack()
    597642                        : parent(0), expr(), cost(Cost::zero), env(), need(), have(), openVars(), nextArg(0),
    598 
    599643                          tupleStart(0), nextExpl(0), explAlt(0) {}
    600644
     
    648692                        const ExplodedArgs& args, std::vector<ArgPack>& results, std::size_t& genStart,
    649693                        const SymTab::Indexer& indexer, unsigned nTuples = 0 ) {
    650                 if ( TupleType* tupleType = dynamic_cast<TupleType*>( formalType ) ) {
     694                if ( TupleType * tupleType = dynamic_cast<TupleType*>( formalType ) ) {
    651695                        // formalType is a TupleType - group actuals into a TupleExpr
    652696                        ++nTuples;
    653697                        for ( Type* type : *tupleType ) {
    654698                                // xxx - dropping initializer changes behaviour from previous, but seems correct
     699                                // ^^^ need to handle the case where a tuple has a default argument
    655700                                if ( ! instantiateArgument(
    656701                                                type, nullptr, args, results, genStart, indexer, nTuples ) )
     
    663708                        }
    664709                        return true;
    665                 } else if ( TypeInstType* ttype = Tuples::isTtype( formalType ) ) {
     710                } else if ( TypeInstType * ttype = Tuples::isTtype( formalType ) ) {
    666711                        // formalType is a ttype, consumes all remaining arguments
    667712                        // xxx - mixing default arguments with variadic??
     
    706751                                                Type* argType;
    707752
    708                                                 if ( nTuples > 0 ) {
    709                                                         // first iteration, push empty tuple expression
     753                                                if ( nTuples > 0 || ! results[i].expr ) {
     754                                                        // first iteration or no expression to clone,
     755                                                        // push empty tuple expression
    710756                                                        newResult.parent = i;
    711757                                                        std::list<Expression*> emptyList;
     
    834880                                                                indexer ) ) {
    835881                                                        results.emplace_back(
    836                                                                 i, cnstExpr, move(env), move(need), move(have),
     882                                                                i, new DefaultArgExpr( cnstExpr ), move(env), move(need), move(have),
    837883                                                                move(openVars), nextArg, nTuples );
    838884                                                }
     
    865911                                // consider only first exploded actual
    866912                                Expression* expr = expl.exprs.front().get();
    867                                 Type* actualType = expr->get_result()->clone();
     913                                Type* actualType = expr->result->clone();
    868914
    869915                                PRINT(
     
    892938
    893939        template<typename OutputIterator>
    894         void AlternativeFinder::validateFunctionAlternative( const Alternative &func, ArgPack& result,
     940        void AlternativeFinder::Finder::validateFunctionAlternative( const Alternative &func, ArgPack& result,
    895941                        const std::vector<ArgPack>& results, OutputIterator out ) {
    896942                ApplicationExpr *appExpr = new ApplicationExpr( func.expr->clone() );
    897943                // sum cost and accumulate actuals
    898                 std::list<Expression*>& args = appExpr->get_args();
     944                std::list<Expression*>& args = appExpr->args;
    899945                Cost cost = func.cost;
    900946                const ArgPack* pack = &result;
     
    915961
    916962        template<typename OutputIterator>
    917         void AlternativeFinder::makeFunctionAlternatives( const Alternative &func,
     963        void AlternativeFinder::Finder::makeFunctionAlternatives( const Alternative &func,
    918964                        FunctionType *funcType, const ExplodedArgs &args, OutputIterator out ) {
    919965                OpenVarSet funcOpenVars;
     
    923969                // add all type variables as open variables now so that those not used in the parameter
    924970                // list are still considered open.
    925                 funcEnv.add( funcType->get_forall() );
    926 
    927                 if ( targetType && ! targetType->isVoid() && ! funcType->get_returnVals().empty() ) {
     971                funcEnv.add( funcType->forall );
     972
     973                if ( targetType && ! targetType->isVoid() && ! funcType->returnVals.empty() ) {
    928974                        // attempt to narrow based on expected target type
    929                         Type * returnType = funcType->get_returnVals().front()->get_type();
     975                        Type * returnType = funcType->returnVals.front()->get_type();
    930976                        if ( ! unify( returnType, targetType, funcEnv, funcNeed, funcHave, funcOpenVars,
    931977                                        indexer ) ) {
     
    940986                std::size_t genStart = 0;
    941987
    942                 for ( DeclarationWithType* formal : funcType->get_parameters() ) {
     988                for ( DeclarationWithType* formal : funcType->parameters ) {
    943989                        ObjectDecl* obj = strict_dynamic_cast< ObjectDecl* >( formal );
    944990                        if ( ! instantiateArgument(
    945                                         obj->get_type(), obj->get_init(), args, results, genStart, indexer ) )
     991                                        obj->type, obj->init, args, results, genStart, indexer ) )
    946992                                return;
    947993                }
     
    10221068        }
    10231069
    1024         void AlternativeFinder::visit( UntypedExpr *untypedExpr ) {
     1070        void AlternativeFinder::Finder::postvisit( UntypedExpr *untypedExpr ) {
    10251071                AlternativeFinder funcFinder( indexer, env );
    1026                 funcFinder.findWithAdjustment( untypedExpr->get_function() );
     1072                funcFinder.findWithAdjustment( untypedExpr->function );
    10271073                // if there are no function alternatives, then proceeding is a waste of time.
     1074                // xxx - findWithAdjustment throws, so this check and others like it shouldn't be necessary.
    10281075                if ( funcFinder.alternatives.empty() ) return;
    10291076
    10301077                std::vector< AlternativeFinder > argAlternatives;
    1031                 findSubExprs( untypedExpr->begin_args(), untypedExpr->end_args(),
     1078                altFinder.findSubExprs( untypedExpr->begin_args(), untypedExpr->end_args(),
    10321079                        back_inserter( argAlternatives ) );
    10331080
    10341081                // take care of possible tuple assignments
    10351082                // if not tuple assignment, assignment is taken care of as a normal function call
    1036                 Tuples::handleTupleAssignment( *this, untypedExpr, argAlternatives );
     1083                Tuples::handleTupleAssignment( altFinder, untypedExpr, argAlternatives );
    10371084
    10381085                // find function operators
     
    10401087                AlternativeFinder funcOpFinder( indexer, env );
    10411088                // it's ok if there aren't any defined function ops
    1042                 funcOpFinder.maybeFind( opExpr);
     1089                funcOpFinder.maybeFind( opExpr );
    10431090                PRINT(
    10441091                        std::cerr << "known function ops:" << std::endl;
     
    10531100                        argExpansions.emplace_back();
    10541101                        auto& argE = argExpansions.back();
    1055                         argE.reserve( arg.alternatives.size() );
     1102                        // argE.reserve( arg.alternatives.size() );
    10561103
    10571104                        for ( const Alternative& actual : arg ) {
     
    10611108
    10621109                AltList candidates;
    1063                 SemanticError errors;
     1110                SemanticErrorException errors;
    10641111                for ( AltList::iterator func = funcFinder.alternatives.begin(); func != funcFinder.alternatives.end(); ++func ) {
    10651112                        try {
     
    10691116                                )
    10701117                                // check if the type is pointer to function
    1071                                 if ( PointerType *pointer = dynamic_cast< PointerType* >( func->expr->get_result()->stripReferences() ) ) {
    1072                                         if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) {
     1118                                if ( PointerType *pointer = dynamic_cast< PointerType* >( func->expr->result->stripReferences() ) ) {
     1119                                        if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->base ) ) {
    10731120                                                Alternative newFunc( *func );
    1074                                                 referenceToRvalueConversion( newFunc.expr );
     1121                                                referenceToRvalueConversion( newFunc.expr, newFunc.cost );
    10751122                                                makeFunctionAlternatives( newFunc, function, argExpansions,
    10761123                                                        std::back_inserter( candidates ) );
    10771124                                        }
    1078                                 } else if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( func->expr->get_result()->stripReferences() ) ) { // handle ftype (e.g. *? on function pointer)
    1079                                         EqvClass eqvClass;
    1080                                         if ( func->env.lookup( typeInst->get_name(), eqvClass ) && eqvClass.type ) {
    1081                                                 if ( FunctionType *function = dynamic_cast< FunctionType* >( eqvClass.type ) ) {
     1125                                } else if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( func->expr->result->stripReferences() ) ) { // handle ftype (e.g. *? on function pointer)
     1126                                        if ( const EqvClass *eqvClass = func->env.lookup( typeInst->name ) ) {
     1127                                                if ( FunctionType *function = dynamic_cast< FunctionType* >( eqvClass->type ) ) {
    10821128                                                        Alternative newFunc( *func );
    1083                                                         referenceToRvalueConversion( newFunc.expr );
     1129                                                        referenceToRvalueConversion( newFunc.expr, newFunc.cost );
    10841130                                                        makeFunctionAlternatives( newFunc, function, argExpansions,
    10851131                                                                std::back_inserter( candidates ) );
     
    10871133                                        } // if
    10881134                                }
    1089                         } catch ( SemanticError &e ) {
     1135                        } catch ( SemanticErrorException &e ) {
    10901136                                errors.append( e );
    10911137                        }
     
    11071153                                        // check if type is a pointer to function
    11081154                                        if ( PointerType* pointer = dynamic_cast<PointerType*>(
    1109                                                         funcOp->expr->get_result()->stripReferences() ) ) {
     1155                                                        funcOp->expr->result->stripReferences() ) ) {
    11101156                                                if ( FunctionType* function =
    1111                                                                 dynamic_cast<FunctionType*>( pointer->get_base() ) ) {
     1157                                                                dynamic_cast<FunctionType*>( pointer->base ) ) {
    11121158                                                        Alternative newFunc( *funcOp );
    1113                                                         referenceToRvalueConversion( newFunc.expr );
     1159                                                        referenceToRvalueConversion( newFunc.expr, newFunc.cost );
    11141160                                                        makeFunctionAlternatives( newFunc, function, argExpansions,
    11151161                                                                std::back_inserter( candidates ) );
    11161162                                                }
    11171163                                        }
    1118                                 } catch ( SemanticError &e ) {
     1164                                } catch ( SemanticErrorException &e ) {
    11191165                                        errors.append( e );
    11201166                                }
     
    11311177                        PRINT(
    11321178                                ApplicationExpr *appExpr = strict_dynamic_cast< ApplicationExpr* >( withFunc.expr );
    1133                                 PointerType *pointer = strict_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
    1134                                 FunctionType *function = strict_dynamic_cast< FunctionType* >( pointer->get_base() );
    1135                                 std::cerr << "Case +++++++++++++ " << appExpr->get_function() << std::endl;
     1179                                PointerType *pointer = strict_dynamic_cast< PointerType* >( appExpr->function->result );
     1180                                FunctionType *function = strict_dynamic_cast< FunctionType* >( pointer->base );
     1181                                std::cerr << "Case +++++++++++++ " << appExpr->function << std::endl;
    11361182                                std::cerr << "formals are:" << std::endl;
    1137                                 printAll( function->get_parameters(), std::cerr, 8 );
     1183                                printAll( function->parameters, std::cerr, 8 );
    11381184                                std::cerr << "actuals are:" << std::endl;
    1139                                 printAll( appExpr->get_args(), std::cerr, 8 );
     1185                                printAll( appExpr->args, std::cerr, 8 );
    11401186                                std::cerr << "bindings are:" << std::endl;
    11411187                                withFunc.env.print( std::cerr, 8 );
     1188                                std::cerr << "cost is: " << withFunc.cost << std::endl;
    11421189                                std::cerr << "cost of conversion is:" << cvtCost << std::endl;
    11431190                        )
     
    11721219                        // fix this issue in a more robust way.
    11731220                        targetType = nullptr;
    1174                         visit( untypedExpr );
     1221                        postvisit( untypedExpr );
    11751222                }
    11761223        }
     
    11781225        bool isLvalue( Expression *expr ) {
    11791226                // xxx - recurse into tuples?
    1180                 return expr->result && ( expr->get_result()->get_lvalue() || dynamic_cast< ReferenceType * >( expr->get_result() ) );
    1181         }
    1182 
    1183         void AlternativeFinder::visit( AddressExpr *addressExpr ) {
     1227                return expr->result && ( expr->result->get_lvalue() || dynamic_cast< ReferenceType * >( expr->result ) );
     1228        }
     1229
     1230        void AlternativeFinder::Finder::postvisit( AddressExpr *addressExpr ) {
    11841231                AlternativeFinder finder( indexer, env );
    11851232                finder.find( addressExpr->get_arg() );
     
    11921239        }
    11931240
    1194         void AlternativeFinder::visit( LabelAddressExpr * expr ) {
     1241        void AlternativeFinder::Finder::postvisit( LabelAddressExpr * expr ) {
    11951242                alternatives.push_back( Alternative{ expr->clone(), env, Cost::zero } );
    11961243        }
    11971244
    1198         Expression * restructureCast( Expression * argExpr, Type * toType ) {
     1245        Expression * restructureCast( Expression * argExpr, Type * toType, bool isGenerated ) {
    11991246                if ( argExpr->get_result()->size() > 1 && ! toType->isVoid() && ! dynamic_cast<ReferenceType *>( toType ) ) {
    12001247                        // Argument expression is a tuple and the target type is not void and not a reference type.
     
    12111258                                // cast each component
    12121259                                TupleIndexExpr * idx = new TupleIndexExpr( argExpr->clone(), i );
    1213                                 componentExprs.push_back( restructureCast( idx, toType->getComponent( i ) ) );
     1260                                componentExprs.push_back( restructureCast( idx, toType->getComponent( i ), isGenerated ) );
    12141261                        }
    12151262                        delete argExpr;
     
    12191266                } else {
    12201267                        // handle normally
    1221                         return new CastExpr( argExpr, toType->clone() );
    1222                 }
    1223         }
    1224 
    1225         void AlternativeFinder::visit( CastExpr *castExpr ) {
     1268                        CastExpr * ret = new CastExpr( argExpr, toType->clone() );
     1269                        ret->isGenerated = isGenerated;
     1270                        return ret;
     1271                }
     1272        }
     1273
     1274        void AlternativeFinder::Finder::postvisit( CastExpr *castExpr ) {
    12261275                Type *& toType = castExpr->get_result();
    12271276                assert( toType );
     
    12321281                AlternativeFinder finder( indexer, env );
    12331282                finder.targetType = toType;
    1234                 finder.findWithAdjustment( castExpr->get_arg() );
     1283                finder.findWithAdjustment( castExpr->arg );
    12351284
    12361285                AltList candidates;
     
    12391288                        OpenVarSet openVars;
    12401289
     1290                        alt.env.extractOpenVars( openVars );
     1291
    12411292                        // It's possible that a cast can throw away some values in a multiply-valued expression.  (An example is a
    12421293                        // cast-to-void, which casts from one value to zero.)  Figure out the prefix of the subexpression results
    12431294                        // that are cast directly.  The candidate is invalid if it has fewer results than there are types to cast
    12441295                        // to.
    1245                         int discardedValues = alt.expr->get_result()->size() - castExpr->get_result()->size();
     1296                        int discardedValues = alt.expr->result->size() - castExpr->result->size();
    12461297                        if ( discardedValues < 0 ) continue;
    12471298                        // xxx - may need to go into tuple types and extract relevant types and use unifyList. Note that currently, this does not
    12481299                        // allow casting a tuple to an atomic type (e.g. (int)([1, 2, 3]))
    12491300                        // unification run for side-effects
    1250                         unify( castExpr->get_result(), alt.expr->get_result(), alt.env, needAssertions,
     1301                        unify( castExpr->result, alt.expr->result, alt.env, needAssertions,
    12511302                                haveAssertions, openVars, indexer );
    1252                         Cost thisCost = castCost( alt.expr->get_result(), castExpr->get_result(), indexer,
     1303                        Cost thisCost = castCost( alt.expr->result, castExpr->result, indexer,
    12531304                                alt.env );
    12541305                        PRINT(
     
    12631314                                // count one safe conversion for each value that is thrown away
    12641315                                thisCost.incSafe( discardedValues );
    1265                                 Alternative newAlt( restructureCast( alt.expr->clone(), toType ), alt.env,
     1316                                Alternative newAlt( restructureCast( alt.expr->clone(), toType, castExpr->isGenerated ), alt.env,
    12661317                                        alt.cost, thisCost );
    12671318                                inferParameters( needAssertions, haveAssertions, newAlt, openVars,
     
    12781329        }
    12791330
    1280         void AlternativeFinder::visit( VirtualCastExpr * castExpr ) {
     1331        void AlternativeFinder::Finder::postvisit( VirtualCastExpr * castExpr ) {
    12811332                assertf( castExpr->get_result(), "Implicate virtual cast targets not yet supported." );
    12821333                AlternativeFinder finder( indexer, env );
     
    12901341        }
    12911342
    1292         void AlternativeFinder::visit( UntypedMemberExpr *memberExpr ) {
     1343        namespace {
     1344                /// Gets name from untyped member expression (member must be NameExpr)
     1345                const std::string& get_member_name( UntypedMemberExpr *memberExpr ) {
     1346                        NameExpr * nameExpr = dynamic_cast< NameExpr * >( memberExpr->get_member() );
     1347                        assert( nameExpr );
     1348                        return nameExpr->get_name();
     1349                }
     1350        }
     1351
     1352        void AlternativeFinder::Finder::postvisit( UntypedMemberExpr *memberExpr ) {
    12931353                AlternativeFinder funcFinder( indexer, env );
    12941354                funcFinder.findWithAdjustment( memberExpr->get_aggregate() );
    12951355                for ( AltList::const_iterator agg = funcFinder.alternatives.begin(); agg != funcFinder.alternatives.end(); ++agg ) {
    12961356                        // it's okay for the aggregate expression to have reference type -- cast it to the base type to treat the aggregate as the referenced value
    1297                         std::unique_ptr<Expression> aggrExpr( agg->expr->clone() );
    1298                         Type * aggrType = aggrExpr->get_result();
    1299                         if ( dynamic_cast< ReferenceType * >( aggrType ) ) {
    1300                                 aggrType = aggrType->stripReferences();
    1301                                 aggrExpr.reset( new CastExpr( aggrExpr.release(), aggrType->clone() ) );
    1302                         }
     1357                        Cost cost = agg->cost;
     1358                        Expression * aggrExpr = agg->expr->clone();
     1359                        referenceToRvalueConversion( aggrExpr, cost );
     1360                        std::unique_ptr<Expression> guard( aggrExpr );
     1361
    13031362                        // find member of the given type
    13041363                        if ( StructInstType *structInst = dynamic_cast< StructInstType* >( aggrExpr->get_result() ) ) {
    1305                                 addAggMembers( structInst, aggrExpr.get(), agg->cost, agg->env, memberExpr->get_member() );
     1364                                addAggMembers( structInst, aggrExpr, cost, agg->env, get_member_name(memberExpr) );
    13061365                        } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( aggrExpr->get_result() ) ) {
    1307                                 addAggMembers( unionInst, aggrExpr.get(), agg->cost, agg->env, memberExpr->get_member() );
     1366                                addAggMembers( unionInst, aggrExpr, cost, agg->env, get_member_name(memberExpr) );
    13081367                        } else if ( TupleType * tupleType = dynamic_cast< TupleType * >( aggrExpr->get_result() ) ) {
    1309                                 addTupleMembers( tupleType, aggrExpr.get(), agg->cost, agg->env, memberExpr->get_member() );
     1368                                addTupleMembers( tupleType, aggrExpr, cost, agg->env, memberExpr->get_member() );
    13101369                        } // if
    13111370                } // for
    13121371        }
    13131372
    1314         void AlternativeFinder::visit( MemberExpr *memberExpr ) {
     1373        void AlternativeFinder::Finder::postvisit( MemberExpr *memberExpr ) {
    13151374                alternatives.push_back( Alternative( memberExpr->clone(), env, Cost::zero ) );
    13161375        }
    13171376
    1318         void AlternativeFinder::visit( NameExpr *nameExpr ) {
     1377        void AlternativeFinder::Finder::postvisit( NameExpr *nameExpr ) {
    13191378                std::list< SymTab::Indexer::IdData > declList;
    1320                 indexer.lookupId( nameExpr->get_name(), declList );
    1321                 PRINT( std::cerr << "nameExpr is " << nameExpr->get_name() << std::endl; )
     1379                indexer.lookupId( nameExpr->name, declList );
     1380                PRINT( std::cerr << "nameExpr is " << nameExpr->name << std::endl; )
    13221381                for ( auto & data : declList ) {
    1323                         Expression * newExpr = data.combine();
    1324                         // xxx - add in extra cost for with-statement exprs?
    1325                         alternatives.push_back( Alternative( newExpr, env, Cost::zero ) );
     1382                        Cost cost = Cost::zero;
     1383                        Expression * newExpr = data.combine( cost );
     1384
     1385                        // addAnonAlternatives uses vector::push_back, which invalidates references to existing elements, so
     1386                        // can't construct in place and use vector::back
     1387                        Alternative newAlt( newExpr, env, Cost::zero, cost );
    13261388                        PRINT(
    13271389                                std::cerr << "decl is ";
     
    13321394                                std::cerr << std::endl;
    13331395                        )
    1334                         renameTypes( alternatives.back().expr );
    1335                         addAnonConversions( alternatives.back() ); // add anonymous member interpretations whenever an aggregate value type is seen as a name expression.
     1396                        renameTypes( newAlt.expr );
     1397                        addAnonConversions( newAlt ); // add anonymous member interpretations whenever an aggregate value type is seen as a name expression.
     1398                        alternatives.push_back( std::move(newAlt) );
    13361399                } // for
    13371400        }
    13381401
    1339         void AlternativeFinder::visit( VariableExpr *variableExpr ) {
     1402        void AlternativeFinder::Finder::postvisit( VariableExpr *variableExpr ) {
    13401403                // not sufficient to clone here, because variable's type may have changed
    13411404                // since the VariableExpr was originally created.
    1342                 alternatives.push_back( Alternative( new VariableExpr( variableExpr->get_var() ), env, Cost::zero ) );
    1343         }
    1344 
    1345         void AlternativeFinder::visit( ConstantExpr *constantExpr ) {
     1405                alternatives.push_back( Alternative( new VariableExpr( variableExpr->var ), env, Cost::zero ) );
     1406        }
     1407
     1408        void AlternativeFinder::Finder::postvisit( ConstantExpr *constantExpr ) {
    13461409                alternatives.push_back( Alternative( constantExpr->clone(), env, Cost::zero ) );
    13471410        }
    13481411
    1349         void AlternativeFinder::visit( SizeofExpr *sizeofExpr ) {
     1412        void AlternativeFinder::Finder::postvisit( SizeofExpr *sizeofExpr ) {
    13501413                if ( sizeofExpr->get_isType() ) {
    13511414                        Type * newType = sizeofExpr->get_type()->clone();
     
    13591422                        findMinCost( finder.alternatives.begin(), finder.alternatives.end(), back_inserter( winners ) );
    13601423                        if ( winners.size() != 1 ) {
    1361                                 throw SemanticError( "Ambiguous expression in sizeof operand: ", sizeofExpr->get_expr() );
     1424                                SemanticError( sizeofExpr->get_expr(), "Ambiguous expression in sizeof operand: " );
    13621425                        } // if
    13631426                        // return the lowest cost alternative for the argument
    13641427                        Alternative &choice = winners.front();
    1365                         referenceToRvalueConversion( choice.expr );
     1428                        referenceToRvalueConversion( choice.expr, choice.cost );
    13661429                        alternatives.push_back( Alternative( new SizeofExpr( choice.expr->clone() ), choice.env, Cost::zero ) );
    13671430                } // if
    13681431        }
    13691432
    1370         void AlternativeFinder::visit( AlignofExpr *alignofExpr ) {
     1433        void AlternativeFinder::Finder::postvisit( AlignofExpr *alignofExpr ) {
    13711434                if ( alignofExpr->get_isType() ) {
    13721435                        Type * newType = alignofExpr->get_type()->clone();
     
    13801443                        findMinCost( finder.alternatives.begin(), finder.alternatives.end(), back_inserter( winners ) );
    13811444                        if ( winners.size() != 1 ) {
    1382                                 throw SemanticError( "Ambiguous expression in alignof operand: ", alignofExpr->get_expr() );
     1445                                SemanticError( alignofExpr->get_expr(), "Ambiguous expression in alignof operand: " );
    13831446                        } // if
    13841447                        // return the lowest cost alternative for the argument
    13851448                        Alternative &choice = winners.front();
    1386                         referenceToRvalueConversion( choice.expr );
     1449                        referenceToRvalueConversion( choice.expr, choice.cost );
    13871450                        alternatives.push_back( Alternative( new AlignofExpr( choice.expr->clone() ), choice.env, Cost::zero ) );
    13881451                } // if
     
    13901453
    13911454        template< typename StructOrUnionType >
    1392         void AlternativeFinder::addOffsetof( StructOrUnionType *aggInst, const std::string &name ) {
     1455        void AlternativeFinder::Finder::addOffsetof( StructOrUnionType *aggInst, const std::string &name ) {
    13931456                std::list< Declaration* > members;
    13941457                aggInst->lookup( name, members );
     
    14031466        }
    14041467
    1405         void AlternativeFinder::visit( UntypedOffsetofExpr *offsetofExpr ) {
     1468        void AlternativeFinder::Finder::postvisit( UntypedOffsetofExpr *offsetofExpr ) {
    14061469                AlternativeFinder funcFinder( indexer, env );
    14071470                // xxx - resolveTypeof?
    14081471                if ( StructInstType *structInst = dynamic_cast< StructInstType* >( offsetofExpr->get_type() ) ) {
    1409                         addOffsetof( structInst, offsetofExpr->get_member() );
     1472                        addOffsetof( structInst, offsetofExpr->member );
    14101473                } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( offsetofExpr->get_type() ) ) {
    1411                         addOffsetof( unionInst, offsetofExpr->get_member() );
    1412                 }
    1413         }
    1414 
    1415         void AlternativeFinder::visit( OffsetofExpr *offsetofExpr ) {
     1474                        addOffsetof( unionInst, offsetofExpr->member );
     1475                }
     1476        }
     1477
     1478        void AlternativeFinder::Finder::postvisit( OffsetofExpr *offsetofExpr ) {
    14161479                alternatives.push_back( Alternative( offsetofExpr->clone(), env, Cost::zero ) );
    14171480        }
    14181481
    1419         void AlternativeFinder::visit( OffsetPackExpr *offsetPackExpr ) {
     1482        void AlternativeFinder::Finder::postvisit( OffsetPackExpr *offsetPackExpr ) {
    14201483                alternatives.push_back( Alternative( offsetPackExpr->clone(), env, Cost::zero ) );
    14211484        }
     
    14361499                        AltList & alternatives = finder.get_alternatives();
    14371500                        if ( typesCompatibleIgnoreQualifiers( argType, function->get_parameters().front()->get_type(), indexer, env ) ) {
    1438                                 alternatives.push_back( Alternative( new AttrExpr( data.combine(), argType->clone() ), env, Cost::zero ) );
     1501                                Cost cost = Cost::zero;
     1502                                Expression * newExpr = data.combine( cost );
     1503                                alternatives.push_back( Alternative( new AttrExpr( newExpr, argType->clone() ), env, Cost::zero, cost ) );
    14391504                                for ( DeclarationWithType * retVal : function->returnVals ) {
    14401505                                        alternatives.back().expr->result = retVal->get_type()->clone();
     
    14441509        }
    14451510
    1446         void AlternativeFinder::visit( AttrExpr *attrExpr ) {
     1511        void AlternativeFinder::Finder::postvisit( AttrExpr *attrExpr ) {
    14471512                // assume no 'pointer-to-attribute'
    14481513                NameExpr *nameExpr = dynamic_cast< NameExpr* >( attrExpr->get_attr() );
     
    14581523                                        if ( function->get_parameters().size() == 1 ) {
    14591524                                                if ( attrExpr->get_isType() ) {
    1460                                                         resolveAttr( data, function, attrExpr->get_type(), env, *this );
     1525                                                        resolveAttr( data, function, attrExpr->get_type(), env, altFinder);
    14611526                                                } else {
    14621527                                                        AlternativeFinder finder( indexer, env );
     
    14641529                                                        for ( AltList::iterator choice = finder.alternatives.begin(); choice != finder.alternatives.end(); ++choice ) {
    14651530                                                                if ( choice->expr->get_result()->size() == 1 ) {
    1466                                                                         resolveAttr(data, function, choice->expr->get_result(), choice->env, *this );
     1531                                                                        resolveAttr(data, function, choice->expr->get_result(), choice->env, altFinder );
    14671532                                                                } // fi
    14681533                                                        } // for
     
    14731538                } else {
    14741539                        for ( auto & data : attrList ) {
    1475                                 alternatives.push_back( Alternative( data.combine(), env, Cost::zero ) );
     1540                                Cost cost = Cost::zero;
     1541                                Expression * newExpr = data.combine( cost );
     1542                                alternatives.push_back( Alternative( newExpr, env, Cost::zero, cost ) );
    14761543                                renameTypes( alternatives.back().expr );
    14771544                        } // for
     
    14791546        }
    14801547
    1481         void AlternativeFinder::visit( LogicalExpr *logicalExpr ) {
     1548        void AlternativeFinder::Finder::postvisit( LogicalExpr *logicalExpr ) {
    14821549                AlternativeFinder firstFinder( indexer, env );
    14831550                firstFinder.findWithAdjustment( logicalExpr->get_arg1() );
    1484                 for ( AltList::const_iterator first = firstFinder.alternatives.begin(); first != firstFinder.alternatives.end(); ++first ) {
    1485                         AlternativeFinder secondFinder( indexer, first->env );
    1486                         secondFinder.findWithAdjustment( logicalExpr->get_arg2() );
    1487                         for ( AltList::const_iterator second = secondFinder.alternatives.begin(); second != secondFinder.alternatives.end(); ++second ) {
    1488                                 LogicalExpr *newExpr = new LogicalExpr( first->expr->clone(), second->expr->clone(), logicalExpr->get_isAnd() );
    1489                                 alternatives.push_back( Alternative( newExpr, second->env, first->cost + second->cost ) );
    1490                         }
    1491                 }
    1492         }
    1493 
    1494         void AlternativeFinder::visit( ConditionalExpr *conditionalExpr ) {
     1551                if ( firstFinder.alternatives.empty() ) return;
     1552                AlternativeFinder secondFinder( indexer, env );
     1553                secondFinder.findWithAdjustment( logicalExpr->get_arg2() );
     1554                if ( secondFinder.alternatives.empty() ) return;
     1555                for ( const Alternative & first : firstFinder.alternatives ) {
     1556                        for ( const Alternative & second : secondFinder.alternatives ) {
     1557                                TypeEnvironment compositeEnv;
     1558                                compositeEnv.simpleCombine( first.env );
     1559                                compositeEnv.simpleCombine( second.env );
     1560
     1561                                LogicalExpr *newExpr = new LogicalExpr( first.expr->clone(), second.expr->clone(), logicalExpr->get_isAnd() );
     1562                                alternatives.push_back( Alternative( newExpr, compositeEnv, first.cost + second.cost ) );
     1563                        }
     1564                }
     1565        }
     1566
     1567        void AlternativeFinder::Finder::postvisit( ConditionalExpr *conditionalExpr ) {
    14951568                // find alternatives for condition
    14961569                AlternativeFinder firstFinder( indexer, env );
    1497                 firstFinder.findWithAdjustment( conditionalExpr->get_arg1() );
    1498                 for ( AltList::const_iterator first = firstFinder.alternatives.begin(); first != firstFinder.alternatives.end(); ++first ) {
    1499                         // find alternatives for true expression
    1500                         AlternativeFinder secondFinder( indexer, first->env );
    1501                         secondFinder.findWithAdjustment( conditionalExpr->get_arg2() );
    1502                         for ( AltList::const_iterator second = secondFinder.alternatives.begin(); second != secondFinder.alternatives.end(); ++second ) {
    1503                                 // find alterantives for false expression
    1504                                 AlternativeFinder thirdFinder( indexer, second->env );
    1505                                 thirdFinder.findWithAdjustment( conditionalExpr->get_arg3() );
    1506                                 for ( AltList::const_iterator third = thirdFinder.alternatives.begin(); third != thirdFinder.alternatives.end(); ++third ) {
     1570                firstFinder.findWithAdjustment( conditionalExpr->arg1 );
     1571                if ( firstFinder.alternatives.empty() ) return;
     1572                // find alternatives for true expression
     1573                AlternativeFinder secondFinder( indexer, env );
     1574                secondFinder.findWithAdjustment( conditionalExpr->arg2 );
     1575                if ( secondFinder.alternatives.empty() ) return;
     1576                // find alterantives for false expression
     1577                AlternativeFinder thirdFinder( indexer, env );
     1578                thirdFinder.findWithAdjustment( conditionalExpr->arg3 );
     1579                if ( thirdFinder.alternatives.empty() ) return;
     1580                for ( const Alternative & first : firstFinder.alternatives ) {
     1581                        for ( const Alternative & second : secondFinder.alternatives ) {
     1582                                for ( const Alternative & third : thirdFinder.alternatives ) {
     1583                                        TypeEnvironment compositeEnv;
     1584                                        compositeEnv.simpleCombine( first.env );
     1585                                        compositeEnv.simpleCombine( second.env );
     1586                                        compositeEnv.simpleCombine( third.env );
     1587
    15071588                                        // unify true and false types, then infer parameters to produce new alternatives
    15081589                                        OpenVarSet openVars;
    15091590                                        AssertionSet needAssertions, haveAssertions;
    1510                                         Alternative newAlt( 0, third->env, first->cost + second->cost + third->cost );
     1591                                        Alternative newAlt( 0, compositeEnv, first.cost + second.cost + third.cost );
    15111592                                        Type* commonType = nullptr;
    1512                                         if ( unify( second->expr->get_result(), third->expr->get_result(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
    1513                                                 ConditionalExpr *newExpr = new ConditionalExpr( first->expr->clone(), second->expr->clone(), third->expr->clone() );
    1514                                                 newExpr->set_result( commonType ? commonType : second->expr->get_result()->clone() );
     1593                                        if ( unify( second.expr->result, third.expr->result, newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
     1594                                                ConditionalExpr *newExpr = new ConditionalExpr( first.expr->clone(), second.expr->clone(), third.expr->clone() );
     1595                                                newExpr->result = commonType ? commonType : second.expr->result->clone();
    15151596                                                // convert both options to the conditional result type
    15161597                                                newAlt.cost += computeExpressionConversionCost( newExpr->arg2, newExpr->result, indexer, newAlt.env );
     
    15241605        }
    15251606
    1526         void AlternativeFinder::visit( CommaExpr *commaExpr ) {
     1607        void AlternativeFinder::Finder::postvisit( CommaExpr *commaExpr ) {
    15271608                TypeEnvironment newEnv( env );
    15281609                Expression *newFirstArg = resolveInVoidContext( commaExpr->get_arg1(), indexer, newEnv );
    15291610                AlternativeFinder secondFinder( indexer, newEnv );
    15301611                secondFinder.findWithAdjustment( commaExpr->get_arg2() );
    1531                 for ( AltList::const_iterator alt = secondFinder.alternatives.begin(); alt != secondFinder.alternatives.end(); ++alt ) {
    1532                         alternatives.push_back( Alternative( new CommaExpr( newFirstArg->clone(), alt->expr->clone() ), alt->env, alt->cost ) );
     1612                for ( const Alternative & alt : secondFinder.alternatives ) {
     1613                        alternatives.push_back( Alternative( new CommaExpr( newFirstArg->clone(), alt.expr->clone() ), alt.env, alt.cost ) );
    15331614                } // for
    15341615                delete newFirstArg;
    15351616        }
    15361617
    1537         void AlternativeFinder::visit( RangeExpr * rangeExpr ) {
     1618        void AlternativeFinder::Finder::postvisit( RangeExpr * rangeExpr ) {
    15381619                // resolve low and high, accept alternatives whose low and high types unify
    15391620                AlternativeFinder firstFinder( indexer, env );
    1540                 firstFinder.findWithAdjustment( rangeExpr->get_low() );
    1541                 for ( AltList::const_iterator first = firstFinder.alternatives.begin(); first != firstFinder.alternatives.end(); ++first ) {
    1542                         AlternativeFinder secondFinder( indexer, first->env );
    1543                         secondFinder.findWithAdjustment( rangeExpr->get_high() );
    1544                         for ( AltList::const_iterator second = secondFinder.alternatives.begin(); second != secondFinder.alternatives.end(); ++second ) {
     1621                firstFinder.findWithAdjustment( rangeExpr->low );
     1622                if ( firstFinder.alternatives.empty() ) return;
     1623                AlternativeFinder secondFinder( indexer, env );
     1624                secondFinder.findWithAdjustment( rangeExpr->high );
     1625                if ( secondFinder.alternatives.empty() ) return;
     1626                for ( const Alternative & first : firstFinder.alternatives ) {
     1627                        for ( const Alternative & second : secondFinder.alternatives ) {
     1628                                TypeEnvironment compositeEnv;
     1629                                compositeEnv.simpleCombine( first.env );
     1630                                compositeEnv.simpleCombine( second.env );
    15451631                                OpenVarSet openVars;
    15461632                                AssertionSet needAssertions, haveAssertions;
    1547                                 Alternative newAlt( 0, second->env, first->cost + second->cost );
     1633                                Alternative newAlt( 0, compositeEnv, first.cost + second.cost );
    15481634                                Type* commonType = nullptr;
    1549                                 if ( unify( first->expr->get_result(), second->expr->get_result(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
    1550                                         RangeExpr *newExpr = new RangeExpr( first->expr->clone(), second->expr->clone() );
    1551                                         newExpr->set_result( commonType ? commonType : first->expr->get_result()->clone() );
     1635                                if ( unify( first.expr->result, second.expr->result, newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
     1636                                        RangeExpr * newExpr = new RangeExpr( first.expr->clone(), second.expr->clone() );
     1637                                        newExpr->result = commonType ? commonType : first.expr->result->clone();
    15521638                                        newAlt.expr = newExpr;
    15531639                                        inferParameters( needAssertions, haveAssertions, newAlt, openVars, back_inserter( alternatives ) );
     
    15571643        }
    15581644
    1559         void AlternativeFinder::visit( UntypedTupleExpr *tupleExpr ) {
     1645        void AlternativeFinder::Finder::postvisit( UntypedTupleExpr *tupleExpr ) {
    15601646                std::vector< AlternativeFinder > subExprAlternatives;
    1561                 findSubExprs( tupleExpr->get_exprs().begin(), tupleExpr->get_exprs().end(),
     1647                altFinder.findSubExprs( tupleExpr->get_exprs().begin(), tupleExpr->get_exprs().end(),
    15621648                        back_inserter( subExprAlternatives ) );
    15631649                std::vector< AltList > possibilities;
     
    15751661        }
    15761662
    1577         void AlternativeFinder::visit( TupleExpr *tupleExpr ) {
     1663        void AlternativeFinder::Finder::postvisit( TupleExpr *tupleExpr ) {
    15781664                alternatives.push_back( Alternative( tupleExpr->clone(), env, Cost::zero ) );
    15791665        }
    15801666
    1581         void AlternativeFinder::visit( ImplicitCopyCtorExpr * impCpCtorExpr ) {
     1667        void AlternativeFinder::Finder::postvisit( ImplicitCopyCtorExpr * impCpCtorExpr ) {
    15821668                alternatives.push_back( Alternative( impCpCtorExpr->clone(), env, Cost::zero ) );
    15831669        }
    15841670
    1585         void AlternativeFinder::visit( ConstructorExpr * ctorExpr ) {
     1671        void AlternativeFinder::Finder::postvisit( ConstructorExpr * ctorExpr ) {
    15861672                AlternativeFinder finder( indexer, env );
    15871673                // don't prune here, since it's guaranteed all alternatives will have the same type
     
    15931679        }
    15941680
    1595         void AlternativeFinder::visit( TupleIndexExpr *tupleExpr ) {
     1681        void AlternativeFinder::Finder::postvisit( TupleIndexExpr *tupleExpr ) {
    15961682                alternatives.push_back( Alternative( tupleExpr->clone(), env, Cost::zero ) );
    15971683        }
    15981684
    1599         void AlternativeFinder::visit( TupleAssignExpr *tupleAssignExpr ) {
     1685        void AlternativeFinder::Finder::postvisit( TupleAssignExpr *tupleAssignExpr ) {
    16001686                alternatives.push_back( Alternative( tupleAssignExpr->clone(), env, Cost::zero ) );
    16011687        }
    16021688
    1603         void AlternativeFinder::visit( UniqueExpr *unqExpr ) {
     1689        void AlternativeFinder::Finder::postvisit( UniqueExpr *unqExpr ) {
    16041690                AlternativeFinder finder( indexer, env );
    16051691                finder.findWithAdjustment( unqExpr->get_expr() );
     
    16111697        }
    16121698
    1613         void AlternativeFinder::visit( StmtExpr *stmtExpr ) {
     1699        void AlternativeFinder::Finder::postvisit( StmtExpr *stmtExpr ) {
    16141700                StmtExpr * newStmtExpr = stmtExpr->clone();
    16151701                ResolvExpr::resolveStmtExpr( newStmtExpr, indexer );
     
    16181704        }
    16191705
    1620         void AlternativeFinder::visit( UntypedInitExpr *initExpr ) {
     1706        void AlternativeFinder::Finder::postvisit( UntypedInitExpr *initExpr ) {
    16211707                // handle each option like a cast
    16221708                AltList candidates;
    1623                 PRINT( std::cerr << "untyped init expr: " << initExpr << std::endl; )
     1709                PRINT(
     1710                        std::cerr << "untyped init expr: " << initExpr << std::endl;
     1711                )
    16241712                // O(N^2) checks of d-types with e-types
    16251713                for ( InitAlternative & initAlt : initExpr->get_initAlts() ) {
     
    16321720                        AlternativeFinder finder( indexer, env );
    16331721                        finder.targetType = toType;
    1634                         finder.findWithAdjustment( initExpr->get_expr() );
     1722                        finder.findWithAdjustment( initExpr->expr );
    16351723                        for ( Alternative & alt : finder.get_alternatives() ) {
    16361724                                TypeEnvironment newEnv( alt.env );
    16371725                                AssertionSet needAssertions, haveAssertions;
    16381726                                OpenVarSet openVars;  // find things in env that don't have a "representative type" and claim those are open vars?
    1639                                 PRINT( std::cerr << "  @ " << toType << " " << initAlt.designation << std::endl; )
     1727                                PRINT(
     1728                                        std::cerr << "  @ " << toType << " " << initAlt.designation << std::endl;
     1729                                )
    16401730                                // It's possible that a cast can throw away some values in a multiply-valued expression.  (An example is a
    16411731                                // cast-to-void, which casts from one value to zero.)  Figure out the prefix of the subexpression results
    16421732                                // that are cast directly.  The candidate is invalid if it has fewer results than there are types to cast
    16431733                                // to.
    1644                                 int discardedValues = alt.expr->get_result()->size() - toType->size();
     1734                                int discardedValues = alt.expr->result->size() - toType->size();
    16451735                                if ( discardedValues < 0 ) continue;
    16461736                                // xxx - may need to go into tuple types and extract relevant types and use unifyList. Note that currently, this does not
    16471737                                // allow casting a tuple to an atomic type (e.g. (int)([1, 2, 3]))
    16481738                                // unification run for side-effects
    1649                                 unify( toType, alt.expr->get_result(), newEnv, needAssertions, haveAssertions, openVars, indexer ); // xxx - do some inspecting on this line... why isn't result bound to initAlt.type??
    1650 
    1651                                 Cost thisCost = castCost( alt.expr->get_result(), toType, indexer, newEnv );
     1739                                unify( toType, alt.expr->result, newEnv, needAssertions, haveAssertions, openVars, indexer ); // xxx - do some inspecting on this line... why isn't result bound to initAlt.type??
     1740
     1741                                Cost thisCost = castCost( alt.expr->result, toType, indexer, newEnv );
    16521742                                if ( thisCost != Cost::infinity ) {
    16531743                                        // count one safe conversion for each value that is thrown away
    16541744                                        thisCost.incSafe( discardedValues );
    1655                                         Alternative newAlt( new InitExpr( restructureCast( alt.expr->clone(), toType ), initAlt.designation->clone() ), newEnv, alt.cost, thisCost );
     1745                                        Alternative newAlt( new InitExpr( restructureCast( alt.expr->clone(), toType, true ), initAlt.designation->clone() ), newEnv, alt.cost, thisCost );
    16561746                                        inferParameters( needAssertions, haveAssertions, newAlt, openVars, back_inserter( candidates ) );
    16571747                                }
     
    16661756                findMinCost( minArgCost.begin(), minArgCost.end(), std::back_inserter( alternatives ) );
    16671757        }
     1758
     1759        void AlternativeFinder::Finder::postvisit( InitExpr * ) {
     1760                assertf( false, "AlternativeFinder should never see a resolved InitExpr." );
     1761        }
     1762
     1763        void AlternativeFinder::Finder::postvisit( DeletedExpr * ) {
     1764                assertf( false, "AlternativeFinder should never see a DeletedExpr." );
     1765        }
     1766
     1767        void AlternativeFinder::Finder::postvisit( GenericExpr * ) {
     1768                assertf( false, "_Generic is not yet supported." );
     1769        }
    16681770} // namespace ResolvExpr
    16691771
  • src/ResolvExpr/AlternativeFinder.h

    rf9feab8 r90152a4  
    3838        using ExplodedArgs = std::vector< std::vector< ExplodedActual > >;
    3939
    40         class AlternativeFinder : public Visitor {
     40        class AlternativeFinder {
    4141          public:
    4242                AlternativeFinder( const SymTab::Indexer &indexer, const TypeEnvironment &env );
     
    9494                void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out );
    9595          private:
    96                 virtual void visit( ApplicationExpr *applicationExpr );
    97                 virtual void visit( UntypedExpr *untypedExpr );
    98                 virtual void visit( AddressExpr *addressExpr );
    99                 virtual void visit( LabelAddressExpr *labelExpr );
    100                 virtual void visit( CastExpr *castExpr );
    101                 virtual void visit( VirtualCastExpr *castExpr );
    102                 virtual void visit( UntypedMemberExpr *memberExpr );
    103                 virtual void visit( MemberExpr *memberExpr );
    104                 virtual void visit( NameExpr *variableExpr );
    105                 virtual void visit( VariableExpr *variableExpr );
    106                 virtual void visit( ConstantExpr *constantExpr );
    107                 virtual void visit( SizeofExpr *sizeofExpr );
    108                 virtual void visit( AlignofExpr *alignofExpr );
    109                 virtual void visit( UntypedOffsetofExpr *offsetofExpr );
    110                 virtual void visit( OffsetofExpr *offsetofExpr );
    111                 virtual void visit( OffsetPackExpr *offsetPackExpr );
    112                 virtual void visit( AttrExpr *attrExpr );
    113                 virtual void visit( LogicalExpr *logicalExpr );
    114                 virtual void visit( ConditionalExpr *conditionalExpr );
    115                 virtual void visit( CommaExpr *commaExpr );
    116                 virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr );
    117                 virtual void visit( ConstructorExpr * ctorExpr );
    118                 virtual void visit( RangeExpr * rangeExpr );
    119                 virtual void visit( UntypedTupleExpr *tupleExpr );
    120                 virtual void visit( TupleExpr *tupleExpr );
    121                 virtual void visit( TupleIndexExpr *tupleExpr );
    122                 virtual void visit( TupleAssignExpr *tupleExpr );
    123                 virtual void visit( UniqueExpr *unqExpr );
    124                 virtual void visit( StmtExpr *stmtExpr );
    125                 virtual void visit( UntypedInitExpr *initExpr );
    126 
    127                 /// Adds alternatives for anonymous members
    128                 void addAnonConversions( const Alternative & alt );
    129                 /// Adds alternatives for member expressions, given the aggregate, conversion cost for that aggregate, and name of the member
    130                 template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member );
    131                 /// Adds alternatives for member expressions where the left side has tuple type
    132                 void addTupleMembers( TupleType * tupleType, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member );
    133                 /// Adds alternatives for offsetof expressions, given the base type and name of the member
    134                 template< typename StructOrUnionType > void addOffsetof( StructOrUnionType *aggInst, const std::string &name );
    135                 /// Takes a final result and checks if its assertions can be satisfied
    136                 template<typename OutputIterator>
    137                 void validateFunctionAlternative( const Alternative &func, ArgPack& result, const std::vector<ArgPack>& results, OutputIterator out );
    138                 /// Finds matching alternatives for a function, given a set of arguments
    139                 template<typename OutputIterator>
    140                 void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, const ExplodedArgs& args, OutputIterator out );
    141                 /// Checks if assertion parameters match for a new alternative
    142                 template< typename OutputIterator >
    143                 void inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out );
    144 
     96                struct Finder;
    14597                const SymTab::Indexer &indexer;
    14698                AltList alternatives;
     
    174126        void printAlts( const AltList &list, std::ostream &os, unsigned int indentAmt = 0 );
    175127
     128        /// Adds type variables to the open variable set and marks their assertions
     129        void makeUnifiableVars( Type *type, OpenVarSet &unifiableVars, AssertionSet &needAssertions );
     130
    176131        template< typename InputIterator >
    177132        void simpleCombineEnvironments( InputIterator begin, InputIterator end, TypeEnvironment &result ) {
  • src/ResolvExpr/CastCost.cc

    rf9feab8 r90152a4  
    3131
    3232namespace ResolvExpr {
    33         class CastCost : public ConversionCost {
     33        struct CastCost : public ConversionCost {
    3434          public:
    35                 CastCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env );
     35                CastCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction costFunc );
    3636
    37                 virtual void visit( BasicType *basicType );
    38                 virtual void visit( PointerType *pointerType );
     37                using ConversionCost::previsit;
     38                using ConversionCost::postvisit;
     39                void postvisit( BasicType * basicType );
     40                void postvisit( PointerType * pointerType );
    3941        };
    4042
    4143        Cost castCost( Type *src, Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {
    4244                if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
    43                         EqvClass eqvClass;
    44                         NamedTypeDecl *namedType;
    45                         if ( env.lookup( destAsTypeInst->get_name(), eqvClass ) ) {
    46                                 if ( eqvClass.type ) {
    47                                         return castCost( src, eqvClass.type, indexer, env );
     45                        if ( const EqvClass* eqvClass = env.lookup( destAsTypeInst->get_name() ) ) {
     46                                if ( eqvClass->type ) {
     47                                        return castCost( src, eqvClass->type, indexer, env );
    4848                                } else {
    4949                                        return Cost::infinity;
    5050                                }
    51                         } else if ( ( namedType = indexer.lookupType( destAsTypeInst->get_name() ) ) ) {
     51                        } else if ( NamedTypeDecl *namedType = indexer.lookupType( destAsTypeInst->get_name() ) ) {
    5252                                // all typedefs should be gone by this point
    5353                                TypeDecl *type = strict_dynamic_cast< TypeDecl* >( namedType );
    54                                 if ( type->get_base() ) {
    55                                         return castCost( src, type->get_base(), indexer, env ) + Cost::safe;
     54                                if ( type->base ) {
     55                                        return castCost( src, type->base, indexer, env ) + Cost::safe;
    5656                                } // if
    5757                        } // if
     
    7474                } else if ( ReferenceType * refType = dynamic_cast< ReferenceType * > ( dest ) ) {
    7575                        PRINT( std::cerr << "conversionCost: dest is reference" << std::endl; )
    76                         return convertToReferenceCost( src, refType, indexer, env, [](Type * t1, Type * t2, const TypeEnvironment & env, const SymTab::Indexer & indexer) {
     76                        return convertToReferenceCost( src, refType, indexer, env, [](Type * t1, Type * t2, const SymTab::Indexer & indexer, const TypeEnvironment & env ) {
    7777                                return ptrsCastable( t1, t2, env, indexer );
    7878                        });
    7979                } else {
    80                         CastCost converter( dest, indexer, env );
     80                        PassVisitor<CastCost> converter( dest, indexer, env, castCost );
    8181                        src->accept( converter );
    82                         if ( converter.get_cost() == Cost::infinity ) {
     82                        if ( converter.pass.get_cost() == Cost::infinity ) {
    8383                                return Cost::infinity;
    8484                        } else {
    8585                                // xxx - why are we adding cost 0 here?
    86                                 return converter.get_cost() + Cost::zero;
     86                                return converter.pass.get_cost() + Cost::zero;
    8787                        } // if
    8888                } // if
    8989        }
    9090
    91         CastCost::CastCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env )
    92                 : ConversionCost( dest, indexer, env ) {
     91        CastCost::CastCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction costFunc )
     92                : ConversionCost( dest, indexer, env, costFunc ) {
    9393        }
    9494
    95         void CastCost::visit( BasicType *basicType ) {
     95        void CastCost::postvisit( BasicType *basicType ) {
    9696                PointerType *destAsPointer = dynamic_cast< PointerType* >( dest );
    9797                if ( destAsPointer && basicType->isInteger() ) {
     
    103103        }
    104104
    105         void CastCost::visit( PointerType *pointerType ) {
     105        void CastCost::postvisit( PointerType *pointerType ) {
    106106                if ( PointerType *destAsPtr = dynamic_cast< PointerType* >( dest ) ) {
    107                         if ( pointerType->get_qualifiers() <= destAsPtr->get_qualifiers() && typesCompatibleIgnoreQualifiers( pointerType->get_base(), destAsPtr->get_base(), indexer, env ) ) {
     107                        if ( pointerType->get_qualifiers() <= destAsPtr->get_qualifiers() && typesCompatibleIgnoreQualifiers( pointerType->base, destAsPtr->base, indexer, env ) ) {
    108108                                cost = Cost::safe;
    109109                        } else {
    110110                                TypeEnvironment newEnv( env );
    111                                 newEnv.add( pointerType->get_forall() );
    112                                 newEnv.add( pointerType->get_base()->get_forall() );
    113                                 int castResult = ptrsCastable( pointerType->get_base(), destAsPtr->get_base(), newEnv, indexer );
     111                                newEnv.add( pointerType->forall );
     112                                newEnv.add( pointerType->base->forall );
     113                                int castResult = ptrsCastable( pointerType->base, destAsPtr->base, newEnv, indexer );
    114114                                if ( castResult > 0 ) {
    115115                                        cost = Cost::safe;
  • src/ResolvExpr/CommonType.cc

    rf9feab8 r90152a4  
    1818#include <utility>                       // for pair
    1919
     20#include "Common/PassVisitor.h"
    2021#include "ResolvExpr/TypeEnvironment.h"  // for OpenVarSet, AssertionSet
    2122#include "SymTab/Indexer.h"              // for Indexer
     
    2324#include "SynTree/Type.h"                // for BasicType, BasicType::Kind::...
    2425#include "SynTree/Visitor.h"             // for Visitor
    25 #include "Unify.h"                       // for unifyExact, bindVar, WidenMode
     26#include "Unify.h"                       // for unifyExact, WidenMode
    2627#include "typeops.h"                     // for isFtype
    2728
    2829// #define DEBUG
     30#ifdef DEBUG
     31#define PRINT(x) x
     32#else
     33#define PRINT(x)
     34#endif
    2935
    3036namespace ResolvExpr {
    31         class CommonType : public Visitor {
    32           public:
     37        struct CommonType : public WithShortCircuiting {
    3338                CommonType( Type *type2, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment &env, const OpenVarSet &openVars );
    3439                Type *get_result() const { return result; }
     40
     41                void previsit( BaseSyntaxNode * ) { visit_children = false; }
     42
     43                void postvisit( VoidType * voidType );
     44                void postvisit( BasicType * basicType );
     45                void postvisit( PointerType * pointerType );
     46                void postvisit( ArrayType * arrayType );
     47                void postvisit( ReferenceType * refType );
     48                void postvisit( FunctionType * functionType );
     49                void postvisit( StructInstType * aggregateUseType );
     50                void postvisit( UnionInstType * aggregateUseType );
     51                void postvisit( EnumInstType * aggregateUseType );
     52                void postvisit( TraitInstType * aggregateUseType );
     53                void postvisit( TypeInstType * aggregateUseType );
     54                void postvisit( TupleType * tupleType );
     55                void postvisit( VarArgsType * varArgsType );
     56                void postvisit( ZeroType * zeroType );
     57                void postvisit( OneType * oneType );
     58
    3559          private:
    36                 virtual void visit( VoidType *voidType );
    37                 virtual void visit( BasicType *basicType );
    38                 virtual void visit( PointerType *pointerType );
    39                 virtual void visit( ArrayType *arrayType );
    40                 virtual void visit( ReferenceType *refType );
    41                 virtual void visit( FunctionType *functionType );
    42                 virtual void visit( StructInstType *aggregateUseType );
    43                 virtual void visit( UnionInstType *aggregateUseType );
    44                 virtual void visit( EnumInstType *aggregateUseType );
    45                 virtual void visit( TraitInstType *aggregateUseType );
    46                 virtual void visit( TypeInstType *aggregateUseType );
    47                 virtual void visit( TupleType *tupleType );
    48                 virtual void visit( VarArgsType *varArgsType );
    49                 virtual void visit( ZeroType *zeroType );
    50                 virtual void visit( OneType *oneType );
    51 
    5260                template< typename Pointer > void getCommonWithVoidPointer( Pointer* voidPointer, Pointer* otherPointer );
    5361                template< typename RefType > void handleRefType( RefType *inst, Type *other );
     
    6775                // need unify to bind type variables
    6876                if ( unify( t1, t2, env, have, need, newOpen, indexer, common ) ) {
    69                         // std::cerr << "unify success: " << widenFirst << " " << widenSecond << std::endl;
     77                        PRINT(
     78                                std::cerr << "unify success: " << widenFirst << " " << widenSecond << std::endl;
     79                        )
    7080                        if ( (widenFirst || t2->get_qualifiers() <= t1->get_qualifiers()) && (widenSecond || t1->get_qualifiers() <= t2->get_qualifiers()) ) {
    71                                 // std::cerr << "widen okay" << std::endl;
     81                                PRINT(
     82                                        std::cerr << "widen okay" << std::endl;
     83                                )
    7284                                common->get_qualifiers() |= t1->get_qualifiers();
    7385                                common->get_qualifiers() |= t2->get_qualifiers();
     
    7587                        }
    7688                }
    77                 // std::cerr << "exact unify failed: " << t1 << " " << t2 << std::endl;
     89                PRINT(
     90                        std::cerr << "exact unify failed: " << t1 << " " << t2 << std::endl;
     91                )
    7892                return nullptr;
    7993        }
    8094
    8195        Type *commonType( Type *type1, Type *type2, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment &env, const OpenVarSet &openVars ) {
    82                 CommonType visitor( type2, widenFirst, widenSecond, indexer, env, openVars );
     96                PassVisitor<CommonType> visitor( type2, widenFirst, widenSecond, indexer, env, openVars );
    8397
    8498                int depth1 = type1->referenceDepth();
     
    87101                        int diff = depth1-depth2;
    88102                        // TODO: should it be possible for commonType to generate complicated conversions? I would argue no, only conversions that involve types of the same reference level or a difference of 1 should be allowed.
    89                         if ( diff > 1 || diff < -1 ) return nullptr;
     103                        // if ( diff > 1 || diff < -1 ) return nullptr;
    90104
    91105                        // special case where one type has a reference depth of 1 larger than the other
    92106                        if ( diff > 0 || diff < 0 ) {
     107                                PRINT(
     108                                        std::cerr << "reference depth diff: " << diff << std::endl;
     109                                )
    93110                                Type * result = nullptr;
    94                                 if ( ReferenceType * ref1 = dynamic_cast< ReferenceType * >( type1 ) ) {
    95                                         // formal is reference, so result should be reference
     111                                ReferenceType * ref1 = dynamic_cast< ReferenceType * >( type1 );
     112                                ReferenceType * ref2 = dynamic_cast< ReferenceType * >( type2 );
     113                                if ( diff > 0 ) {
     114                                        // deeper on the left
     115                                        assert( ref1 );
    96116                                        result = handleReference( ref1->base, type2, widenFirst, widenSecond, indexer, env, openVars );
    97                                         if ( result ) result = new ReferenceType( ref1->get_qualifiers(), result );
    98117                                } else {
    99                                         // formal is value, so result should be value
    100                                         ReferenceType * ref2 = strict_dynamic_cast< ReferenceType * > ( type2 );
     118                                        // deeper on the right
     119                                        assert( ref2 );
    101120                                        result = handleReference( type1, ref2->base, widenFirst, widenSecond, indexer, env, openVars );
    102121                                }
    103                                 // std::cerr << "common type of reference [" << type1 << "] and [" << type2 << "] is [" << result << "]" << std::endl;
     122                                if ( result && ref1 ) {
     123                                        // formal is reference, so result should be reference
     124                                        PRINT(
     125                                                std::cerr << "formal is reference; result should be reference" << std::endl;
     126                                        )
     127                                        result = new ReferenceType( ref1->get_qualifiers(), result );
     128                                }
     129                                PRINT(
     130                                        std::cerr << "common type of reference [" << type1 << "] and [" << type2 << "] is [" << result << "]" << std::endl;
     131                                )
    104132                                return result;
    105133                        }
     
    108136
    109137                type1->accept( visitor );
    110                 Type *result = visitor.get_result();
     138                Type *result = visitor.pass.get_result();
    111139                if ( ! result ) {
    112140                        // this appears to be handling for opaque type declarations
     
    148176        }
    149177
    150         static const BasicType::Kind combinedType[ BasicType::NUMBER_OF_BASIC_TYPES ][ BasicType::NUMBER_OF_BASIC_TYPES ] =
     178        static const BasicType::Kind combinedType[][ BasicType::NUMBER_OF_BASIC_TYPES ] =
    151179        {
    152 /*              Bool            Char    SignedChar      UnsignedChar    ShortSignedInt  ShortUnsignedInt        SignedInt       UnsignedInt     LongSignedInt   LongUnsignedInt LongLongSignedInt       LongLongUnsignedInt     Float   Double  LongDouble      FloatComplex    DoubleComplex   LongDoubleComplex       FloatImaginary  DoubleImaginary LongDoubleImaginary   SignedInt128   UnsignedInt128 */
    153                 /* Bool */      { BasicType::Bool,              BasicType::Char,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
    154                 /* Char */      { BasicType::Char,              BasicType::Char,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
    155                 /* SignedChar */        { BasicType::SignedChar,        BasicType::UnsignedChar,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
    156                 /* UnsignedChar */      { BasicType::UnsignedChar,      BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
    157                 /* ShortSignedInt */    { BasicType::ShortSignedInt,    BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
    158                 /* ShortUnsignedInt */  { BasicType::ShortUnsignedInt,  BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
    159                 /* SignedInt */         { BasicType::SignedInt,         BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
    160                 /* UnsignedInt */       { BasicType::UnsignedInt,               BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
    161                 /* LongSignedInt */     { BasicType::LongSignedInt,             BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
    162                 /* LongUnsignedInt */   { BasicType::LongUnsignedInt,   BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
    163                 /* LongLongSignedInt */         { BasicType::LongLongSignedInt, BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
    164                 /* LongLongUnsignedInt */       { BasicType::LongLongUnsignedInt,       BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
    165                 /* Float */     { BasicType::Float,     BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::Float,       BasicType::Float, },
    166                 /* Double */    { BasicType::Double,    BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::LongDouble,  BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::Double,      BasicType::Double, },
    167                 /* LongDouble */        { BasicType::LongDouble,                BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDouble,  BasicType::LongDouble, },
    168                 /* FloatComplex */      { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::FloatComplex, },
    169                 /* DoubleComplex */     { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex, },
    170                 /* LongDoubleComplex */         { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex, },
    171                 /* FloatImaginary */    { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatImaginary,      BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary, BasicType::FloatImaginary,      BasicType::FloatImaginary, },
    172                 /* DoubleImaginary */   { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleImaginary,     BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary, BasicType::DoubleImaginary,     BasicType::DoubleImaginary, },
    173                 /* LongDoubleImaginary */       { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary },
    174                 /* SignedInt128 */      { BasicType::SignedInt128,      BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, },
    175                 /* UnsignedInt128 */    { BasicType::UnsignedInt128,    BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::UnsignedInt128,      BasicType::UnsignedInt128, },
     180/*              Bool            Char    SignedChar      UnsignedChar    ShortSignedInt  ShortUnsignedInt        SignedInt       UnsignedInt     LongSignedInt   LongUnsignedInt LongLongSignedInt       LongLongUnsignedInt     Float   Double  LongDouble      FloatComplex    DoubleComplex   LongDoubleComplex       FloatImaginary  DoubleImaginary LongDoubleImaginary   SignedInt128   UnsignedInt128   Float80   Float128 */
     181                /* Bool */      { BasicType::Bool,              BasicType::Char,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     182                /* Char */      { BasicType::Char,              BasicType::Char,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     183                /* SignedChar */        { BasicType::SignedChar,        BasicType::UnsignedChar,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     184                /* UnsignedChar */      { BasicType::UnsignedChar,      BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     185                /* ShortSignedInt */    { BasicType::ShortSignedInt,    BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     186                /* ShortUnsignedInt */  { BasicType::ShortUnsignedInt,  BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     187                /* SignedInt */         { BasicType::SignedInt,         BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     188                /* UnsignedInt */       { BasicType::UnsignedInt,               BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     189                /* LongSignedInt */     { BasicType::LongSignedInt,             BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     190                /* LongUnsignedInt */   { BasicType::LongUnsignedInt,   BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     191                /* LongLongSignedInt */         { BasicType::LongLongSignedInt, BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     192                /* LongLongUnsignedInt */       { BasicType::LongLongUnsignedInt,       BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
     193                /* Float */     { BasicType::Float,     BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::Float,       BasicType::Float, BasicType::Float80, BasicType::Float128 },
     194                /* Double */    { BasicType::Double,    BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::LongDouble,  BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::Double,      BasicType::Double, BasicType::Float80, BasicType::Float128 },
     195                /* LongDouble */        { BasicType::LongDouble,                BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDouble,  BasicType::LongDouble, BasicType::BasicType::LongDouble, BasicType::Float128 },
     196                /* FloatComplex */      { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::FloatComplex, BasicType::LongDoubleComplex, BasicType::LongDoubleComplex, },
     197                /* DoubleComplex */     { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex, BasicType::LongDoubleComplex, BasicType::LongDoubleComplex },
     198                /* LongDoubleComplex */         { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex, BasicType::LongDoubleComplex, BasicType::LongDoubleComplex, },
     199                /* FloatImaginary */    { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatImaginary,      BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary, BasicType::FloatImaginary,      BasicType::FloatImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, },
     200                /* DoubleImaginary */   { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleImaginary,     BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary, BasicType::DoubleImaginary,     BasicType::DoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, },
     201                /* LongDoubleImaginary */       { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, },
     202                /* SignedInt128 */      { BasicType::SignedInt128,      BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128, },
     203                /* UnsignedInt128 */    { BasicType::UnsignedInt128,    BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::UnsignedInt128,      BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128, },
     204                /* Float80 */   { BasicType::Float80,   BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::LongDouble,  BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::Float80,     BasicType::Float80, BasicType::Float80, BasicType::Float128 },
     205                /* Float128 */  { BasicType::Float128,  BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::Float128,    BasicType::Float128, BasicType::Float128, BasicType::Float128 },
    176206        };
     207        static_assert(
     208                sizeof(combinedType)/sizeof(combinedType[0][0]) == BasicType::NUMBER_OF_BASIC_TYPES*BasicType::NUMBER_OF_BASIC_TYPES,
     209                "Each basic type kind should have a corresponding row in the combined type matrix"
     210        );
    177211
    178212        CommonType::CommonType( Type *type2, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment &env, const OpenVarSet &openVars )
     
    180214        }
    181215
    182         void CommonType::visit( __attribute((unused)) VoidType *voidType ) {}
    183 
    184         void CommonType::visit( BasicType *basicType ) {
     216        void CommonType::postvisit( VoidType * ) {}
     217
     218        void CommonType::postvisit( BasicType *basicType ) {
    185219                if ( BasicType *otherBasic = dynamic_cast< BasicType* >( type2 ) ) {
    186220                        BasicType::Kind newType = combinedType[ basicType->get_kind() ][ otherBasic->get_kind() ];
     
    204238                                AssertionSet need, have;
    205239                                WidenMode widen( widenFirst, widenSecond );
    206                                 if ( entry != openVars.end() && ! bindVar(var, voidPointer->get_base(), entry->second, env, need, have, openVars, widen, indexer ) ) return;
     240                                if ( entry != openVars.end() && ! env.bindVar(var, voidPointer->get_base(), entry->second, need, have, openVars, widen, indexer ) ) return;
    207241                        }
    208242                }
     
    211245        }
    212246
    213         void CommonType::visit( PointerType *pointerType ) {
     247        void CommonType::postvisit( PointerType *pointerType ) {
    214248                if ( PointerType *otherPointer = dynamic_cast< PointerType* >( type2 ) ) {
    215249                        // std::cerr << "commonType: two pointers: " << pointerType << " / " << otherPointer << std::endl;
     
    233267                                                result = otherPointer->clone();
    234268                                        } // if
    235                                         result->get_qualifiers() = tq1 | tq2;
     269                                        strict_dynamic_cast<PointerType*>(result)->base->get_qualifiers() = tq1 | tq2;
    236270                                } else {
    237271                                        /// std::cerr << "place for ptr-to-type" << std::endl;
     
    246280        }
    247281
    248         void CommonType::visit( __attribute((unused)) ArrayType *arrayType ) {}
    249 
    250         void CommonType::visit( ReferenceType *refType ) {
     282        void CommonType::postvisit( ArrayType * ) {}
     283
     284        void CommonType::postvisit( ReferenceType *refType ) {
    251285                if ( ReferenceType *otherRef = dynamic_cast< ReferenceType* >( type2 ) ) {
    252286                        // std::cerr << "commonType: both references: " << refType << " / " << otherRef << std::endl;
     
    270304                                                result = otherRef->clone();
    271305                                        } // if
    272                                         result->get_qualifiers() = tq1 | tq2;
     306                                        strict_dynamic_cast<ReferenceType*>(result)->base->get_qualifiers() = tq1 | tq2;
    273307                                } else {
    274308                                        /// std::cerr << "place for ptr-to-type" << std::endl;
     
    283317        }
    284318
    285         void CommonType::visit( __attribute((unused)) FunctionType *functionType ) {}
    286         void CommonType::visit( __attribute((unused)) StructInstType *aggregateUseType ) {}
    287         void CommonType::visit( __attribute((unused)) UnionInstType *aggregateUseType ) {}
    288 
    289         void CommonType::visit( EnumInstType *enumInstType ) {
     319        void CommonType::postvisit( FunctionType * ) {}
     320        void CommonType::postvisit( StructInstType * ) {}
     321        void CommonType::postvisit( UnionInstType * ) {}
     322
     323        void CommonType::postvisit( EnumInstType *enumInstType ) {
    290324                if ( dynamic_cast< BasicType * >( type2 ) || dynamic_cast< ZeroType* >( type2 ) || dynamic_cast< OneType* >( type2 ) ) {
    291325                        // reuse BasicType, EnumInstType code by swapping type2 with enumInstType
    292                         ValueGuard< Type * > temp( type2 );
    293                         type2 = enumInstType;
    294                         temp.old->accept( *this );
    295                 } // if
    296         }
    297 
    298         void CommonType::visit( __attribute((unused)) TraitInstType *aggregateUseType ) {
    299         }
    300 
    301         void CommonType::visit( TypeInstType *inst ) {
     326                        result = commonType( type2, enumInstType, widenSecond, widenFirst, indexer, env, openVars );
     327                } // if
     328        }
     329
     330        void CommonType::postvisit( TraitInstType * ) {
     331        }
     332
     333        void CommonType::postvisit( TypeInstType *inst ) {
    302334                if ( widenFirst ) {
    303335                        NamedTypeDecl *nt = indexer.lookupType( inst->get_name() );
     
    321353        }
    322354
    323         void CommonType::visit( __attribute((unused)) TupleType *tupleType ) {}
    324         void CommonType::visit( __attribute((unused)) VarArgsType *varArgsType ) {}
    325 
    326         void CommonType::visit( ZeroType *zeroType ) {
     355        void CommonType::postvisit( TupleType * ) {}
     356        void CommonType::postvisit( VarArgsType * ) {}
     357
     358        void CommonType::postvisit( ZeroType *zeroType ) {
    327359                if ( widenFirst ) {
    328360                        if ( dynamic_cast< BasicType* >( type2 ) || dynamic_cast< PointerType* >( type2 ) || dynamic_cast< EnumInstType* >( type2 ) ) {
     
    338370        }
    339371
    340         void CommonType::visit( OneType *oneType ) {
     372        void CommonType::postvisit( OneType *oneType ) {
    341373                if ( widenFirst ) {
    342374                        if ( dynamic_cast< BasicType* >( type2 ) || dynamic_cast< EnumInstType* >( type2 ) ) {
  • src/ResolvExpr/ConversionCost.cc

    rf9feab8 r90152a4  
    4242        Cost conversionCost( Type *src, Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {
    4343                if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
    44                         EqvClass eqvClass;
    45                         NamedTypeDecl *namedType;
    46                         PRINT( std::cerr << "type inst " << destAsTypeInst->get_name(); )
    47                         if ( env.lookup( destAsTypeInst->get_name(), eqvClass ) ) {
    48                                 if ( eqvClass.type ) {
    49                                         return conversionCost( src, eqvClass.type, indexer, env );
     44                        PRINT( std::cerr << "type inst " << destAsTypeInst->name; )
     45                        if ( const EqvClass* eqvClass = env.lookup( destAsTypeInst->name ) ) {
     46                                if ( eqvClass->type ) {
     47                                        return conversionCost( src, eqvClass->type, indexer, env );
    5048                                } else {
    5149                                        return Cost::infinity;
    5250                                }
    53                         } else if ( ( namedType = indexer.lookupType( destAsTypeInst->get_name() ) ) ) {
     51                        } else if ( NamedTypeDecl *namedType = indexer.lookupType( destAsTypeInst->name ) ) {
    5452                                PRINT( std::cerr << " found" << std::endl; )
    5553                                TypeDecl *type = dynamic_cast< TypeDecl* >( namedType );
    5654                                // all typedefs should be gone by this point
    5755                                assert( type );
    58                                 if ( type->get_base() ) {
    59                                         return conversionCost( src, type->get_base(), indexer, env ) + Cost::safe;
     56                                if ( type->base ) {
     57                                        return conversionCost( src, type->base, indexer, env ) + Cost::safe;
    6058                                } // if
    6159                        } // if
     
    7775                } else if ( ReferenceType * refType = dynamic_cast< ReferenceType * > ( dest ) ) {
    7876                        PRINT( std::cerr << "conversionCost: dest is reference" << std::endl; )
    79                         return convertToReferenceCost( src, refType, indexer, env, [](Type * t1, Type * t2, const TypeEnvironment & env, const SymTab::Indexer &){
     77                        return convertToReferenceCost( src, refType, indexer, env, [](Type * t1, Type * t2, const SymTab::Indexer &, const TypeEnvironment & env ){
    8078                                return ptrsAssignable( t1, t2, env );
    8179                        });
    8280                } else {
    83                         ConversionCost converter( dest, indexer, env );
     81                        PassVisitor<ConversionCost> converter( dest, indexer, env, conversionCost );
    8482                        src->accept( converter );
    85                         if ( converter.get_cost() == Cost::infinity ) {
     83                        if ( converter.pass.get_cost() == Cost::infinity ) {
    8684                                return Cost::infinity;
    8785                        } else {
    88                                 return converter.get_cost() + Cost::zero;
     86                                return converter.pass.get_cost() + Cost::zero;
    8987                        } // if
    9088                } // if
     
    9290
    9391        Cost convertToReferenceCost( Type * src, Type * dest, int diff, const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func ) {
    94                 PRINT( std::cerr << "convert to reference cost... diff " << diff << std::endl; )
     92                PRINT( std::cerr << "convert to reference cost... diff " << diff << " " << src << " / " << dest << std::endl; )
    9593                if ( diff > 0 ) {
    9694                        // TODO: document this
    97                         Cost cost = convertToReferenceCost( strict_dynamic_cast< ReferenceType * >( src )->get_base(), dest, diff-1, indexer, env, func );
     95                        Cost cost = convertToReferenceCost( strict_dynamic_cast< ReferenceType * >( src )->base, dest, diff-1, indexer, env, func );
    9896                        cost.incReference();
    9997                        return cost;
    10098                } else if ( diff < -1 ) {
    10199                        // TODO: document this
    102                         Cost cost = convertToReferenceCost( src, strict_dynamic_cast< ReferenceType * >( dest )->get_base(), diff+1, indexer, env, func );
     100                        Cost cost = convertToReferenceCost( src, strict_dynamic_cast< ReferenceType * >( dest )->base, diff+1, indexer, env, func );
    103101                        cost.incReference();
    104102                        return cost;
     
    108106                        if ( srcAsRef && destAsRef ) { // pointer-like conversions between references
    109107                                PRINT( std::cerr << "converting between references" << std::endl; )
    110                                 if ( srcAsRef->get_base()->get_qualifiers() <= destAsRef->get_base()->get_qualifiers() && typesCompatibleIgnoreQualifiers( srcAsRef->get_base(), destAsRef->get_base(), indexer, env ) ) {
    111                                         return Cost::safe;
     108                                Type::Qualifiers tq1 = srcAsRef->base->get_qualifiers();
     109                                Type::Qualifiers tq2 = destAsRef->base->get_qualifiers();
     110                                if ( tq1 <= tq2 && typesCompatibleIgnoreQualifiers( srcAsRef->base, destAsRef->base, indexer, env ) ) {
     111                                        PRINT( std::cerr << " :: compatible and good qualifiers" << std::endl; )
     112                                        if ( tq1 == tq2 ) {
     113                                                // types are the same
     114                                                return Cost::zero;
     115                                        } else {
     116                                                // types are the same, except otherPointer has more qualifiers
     117                                                return Cost::safe;
     118                                        }
    112119                                } else {  // xxx - this discards reference qualifiers from consideration -- reducing qualifiers is a safe conversion; is this right?
    113                                         int assignResult = func( srcAsRef->get_base(), destAsRef->get_base(), env, indexer );
     120                                        int assignResult = func( srcAsRef->base, destAsRef->base, indexer, env );
    114121                                        PRINT( std::cerr << "comparing references: " << assignResult << " " << srcAsRef << " " << destAsRef << std::endl; )
    115122                                        if ( assignResult > 0 ) {
     
    121128                        } else {
    122129                                PRINT( std::cerr << "reference to rvalue conversion" << std::endl; )
    123                                 ConversionCost converter( dest, indexer, env );
     130                                PassVisitor<ConversionCost> converter( dest, indexer, env, conversionCost );
    124131                                src->accept( converter );
    125                                 return converter.get_cost();
     132                                return converter.pass.get_cost();
    126133                        } // if
    127134                } else {
     
    129136                        assert( diff == -1 && destAsRef );
    130137                        PRINT( std::cerr << "dest is: " << dest << " / src is: " << src << std::endl; )
    131                         if ( typesCompatibleIgnoreQualifiers( src, destAsRef->get_base(), indexer, env ) ) {
     138                        if ( typesCompatibleIgnoreQualifiers( src, destAsRef->base, indexer, env ) ) {
    132139                                PRINT( std::cerr << "converting compatible base type" << std::endl; )
    133140                                if ( src->get_lvalue() ) {
     
    137144                                        )
    138145                                        // lvalue-to-reference conversion:  cv lvalue T => cv T &
    139                                         if ( src->get_qualifiers() == destAsRef->get_base()->get_qualifiers() ) {
     146                                        if ( src->get_qualifiers() == destAsRef->base->get_qualifiers() ) {
    140147                                                return Cost::reference; // cost needs to be non-zero to add cast
    141                                         } if ( src->get_qualifiers() < destAsRef->get_base()->get_qualifiers() ) {
     148                                        } if ( src->get_qualifiers() < destAsRef->base->get_qualifiers() ) {
    142149                                                return Cost::safe; // cost needs to be higher than previous cast to differentiate adding qualifiers vs. keeping same
    143150                                        } else {
    144151                                                return Cost::unsafe;
    145152                                        } // if
    146                                 } else if ( destAsRef->get_base()->get_const() ) {
     153                                } else if ( destAsRef->base->get_const() ) {
    147154                                        PRINT( std::cerr << "rvalue to const ref conversion" << std::endl; )
    148155                                        // rvalue-to-const-reference conversion: T => const T &
     
    161168        Cost convertToReferenceCost( Type * src, ReferenceType * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func ) {
    162169                int sdepth = src->referenceDepth(), ddepth = dest->referenceDepth();
    163                 return convertToReferenceCost( src, dest, sdepth-ddepth, indexer, env, func );
    164         }
    165 
    166         ConversionCost::ConversionCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env )
    167                 : dest( dest ), indexer( indexer ), cost( Cost::infinity ), env( env ) {
     170                Cost cost = convertToReferenceCost( src, dest, sdepth-ddepth, indexer, env, func );
     171                PRINT( std::cerr << "convertToReferenceCost result: " << cost << std::endl; )
     172                return cost;
     173        }
     174
     175        ConversionCost::ConversionCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction costFunc )
     176                : dest( dest ), indexer( indexer ), cost( Cost::infinity ), env( env ), costFunc( costFunc ) {
    168177        }
    169178
     
    219228*/
    220229
    221         static const int costMatrix[ BasicType::NUMBER_OF_BASIC_TYPES ][ BasicType::NUMBER_OF_BASIC_TYPES ] = {
    222         /* Src \ Dest:  Bool    Char    SChar   UChar   Short   UShort  Int     UInt    Long    ULong   LLong   ULLong  Float   Double  LDbl    FCplex  DCplex  LDCplex FImag   DImag   LDImag  I128,   U128 */
    223                 /* Bool */      { 0,    1,              1,              2,              3,              4,              5,              6,              6,              7,              8,              9,              12,             13,             14,             12,             13,             14,             -1,             -1,             -1,             10,             11,     },
    224                 /* Char */      { -1,   0,              -1,             1,              2,              3,              4,              5,              5,              6,              7,              8,              11,             12,             13,             11,             12,             13,             -1,             -1,             -1,             9,              10,     },
    225                 /* SChar */ { -1,       -1,             0,              1,              2,              3,              4,              5,              5,              6,              7,              8,              11,             12,             13,             11,             12,             13,             -1,             -1,             -1,             9,              10,     },
    226                 /* UChar */ { -1,       -1,             -1,             0,              1,              2,              3,              4,              4,              5,              6,              7,              10,             11,             12,             10,             11,             12,             -1,             -1,             -1,             8,              9,      },
    227                 /* Short */ { -1,       -1,             -1,             -1,             0,              1,              2,              3,              3,              4,              5,              6,              9,              10,             11,             9,              10,             11,             -1,             -1,             -1,             7,              8,      },
    228                 /* UShort */{ -1,       -1,             -1,             -1,             -1,             0,              1,              2,              2,              3,              4,              5,              8,              9,              10,             8,              9,              10,             -1,             -1,             -1,             6,              7,      },
    229                 /* Int */       { -1,   -1,             -1,             -1,             -1,             -1,             0,              1,              1,              2,              3,              4,              7,              8,              9,              7,              8,              9,              -1,             -1,             -1,             5,              6,      },
    230                 /* UInt */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             1,              2,              3,              6,              7,              8,              6,              7,              8,              -1,             -1,             -1,             4,              5,      },
    231                 /* Long */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              3,              6,              7,              8,              6,              7,              8,              -1,             -1,             -1,             4,              5,      },
    232                 /* ULong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              5,              6,              7,              5,              6,              7,              -1,             -1,             -1,             3,              4,      },
    233                 /* LLong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              4,              5,              6,              4,              5,              6,              -1,             -1,             -1,             2,              3,      },
    234                 /* ULLong */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              3,              4,              5,              3,              4,              5,              -1,             -1,             -1,             1,              2,      },
    235 
    236                 /* Float */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              1,              2,              3,              -1,             -1,             -1,             -1,             -1,     },
    237                 /* Double */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             1,              2,              -1,             -1,             -1,             -1,             -1,     },
    238                 /* LDbl */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             1,              -1,             -1,             -1,             -1,             -1,     },
    239                 /* FCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              -1,             -1,             -1,             -1,             -1,     },
    240                 /* DCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             -1,             -1,             -1,             -1,     },
    241                 /* LDCplex */{ -1,      -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             -1,             -1,             -1,     },
    242                 /* FImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              3,              0,              1,              2,              -1,             -1,     },
    243                 /* DImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              -1,             0,              1,              -1,             -1,     },
    244                 /* LDImag */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              -1,             -1,             0,              -1,             -1,     },
    245 
    246                 /* I128 */  { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             2,              3,              4,              3,              4,              5,              -1,             -1,             -1,             0,              1,      },
    247                 /* U128 */  { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              3,              2,              3,              4,              -1,             -1,             -1,             -1,             0,      },
     230        static const int costMatrix[][ BasicType::NUMBER_OF_BASIC_TYPES ] = {
     231        /* Src \ Dest:  Bool    Char    SChar   UChar   Short   UShort  Int     UInt    Long    ULong   LLong   ULLong  Float   Double  LDbl    FCplex  DCplex  LDCplex FImag   DImag   LDImag  I128,   U128, F80, F128 */
     232                /* Bool */      { 0,    1,              1,              2,              3,              4,              5,              6,              6,              7,              8,              9,              12,             13,             14,             12,             13,             14,             -1,             -1,             -1,             10,             11,       14,   15},
     233                /* Char */      { -1,   0,              -1,             1,              2,              3,              4,              5,              5,              6,              7,              8,              11,             12,             13,             11,             12,             13,             -1,             -1,             -1,             9,              10,       13,   14},
     234                /* SChar */ { -1,       -1,             0,              1,              2,              3,              4,              5,              5,              6,              7,              8,              11,             12,             13,             11,             12,             13,             -1,             -1,             -1,             9,              10,       13,   14},
     235                /* UChar */ { -1,       -1,             -1,             0,              1,              2,              3,              4,              4,              5,              6,              7,              10,             11,             12,             10,             11,             12,             -1,             -1,             -1,             8,              9,        12,   13},
     236                /* Short */ { -1,       -1,             -1,             -1,             0,              1,              2,              3,              3,              4,              5,              6,              9,              10,             11,             9,              10,             11,             -1,             -1,             -1,             7,              8,        11,   12},
     237                /* UShort */{ -1,       -1,             -1,             -1,             -1,             0,              1,              2,              2,              3,              4,              5,              8,              9,              10,             8,              9,              10,             -1,             -1,             -1,             6,              7,        10,   11},
     238                /* Int */       { -1,   -1,             -1,             -1,             -1,             -1,             0,              1,              1,              2,              3,              4,              7,              8,              9,              7,              8,              9,              -1,             -1,             -1,             5,              6,        9,    10},
     239                /* UInt */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             1,              2,              3,              6,              7,              8,              6,              7,              8,              -1,             -1,             -1,             4,              5,        8,    9},
     240                /* Long */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              3,              6,              7,              8,              6,              7,              8,              -1,             -1,             -1,             4,              5,        8,    9},
     241                /* ULong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              5,              6,              7,              5,              6,              7,              -1,             -1,             -1,             3,              4,        7,    8},
     242                /* LLong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              4,              5,              6,              4,              5,              6,              -1,             -1,             -1,             2,              3,        6,    7},
     243                /* ULLong */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              3,              4,              5,              3,              4,              5,              -1,             -1,             -1,             1,              2,        5,    6},
     244
     245                /* Float */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              1,              2,              3,              -1,             -1,             -1,             -1,             -1,       2,    3},
     246                /* Double */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             1,              2,              -1,             -1,             -1,             -1,             -1,       1,    2},
     247                /* LDbl */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             1,              -1,             -1,             -1,             -1,             -1,       -1,   1},
     248                /* FCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              -1,             -1,             -1,             -1,             -1,       -1,   -1},
     249                /* DCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             -1,             -1,             -1,             -1,       -1,   -1},
     250                /* LDCplex */{ -1,      -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             -1,             -1,             -1,       -1,   -1},
     251                /* FImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              3,              0,              1,              2,              -1,             -1,       -1,   -1},
     252                /* DImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              -1,             0,              1,              -1,             -1,       -1,   -1},
     253                /* LDImag */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              -1,             -1,             0,              -1,             -1,       -1,   -1},
     254
     255                /* I128 */  { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             2,              3,              4,              3,              4,              5,              -1,             -1,             -1,             0,              1,        4,    4},
     256                /* U128 */  { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              3,              2,              3,              4,              -1,             -1,             -1,             -1,             0,        3,    3},
     257
     258                /* F80 */       { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              -1,             -1,             1,              -1,             -1,             -1,             -1,             -1,       0,    1},
     259                /* F128 */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              -1,             -1,             -1,             -1,             -1,       -1,   0},
    248260        };
    249 
    250         void ConversionCost::visit( __attribute((unused)) VoidType *voidType ) {
     261        static_assert(
     262                sizeof(costMatrix)/sizeof(costMatrix[0][0]) == BasicType::NUMBER_OF_BASIC_TYPES*BasicType::NUMBER_OF_BASIC_TYPES,
     263                "Each basic type kind should have a corresponding row in the cost matrix"
     264        );
     265
     266
     267        void ConversionCost::postvisit( VoidType * ) {
    251268                cost = Cost::infinity;
    252269        }
    253270
    254         void ConversionCost::visit(BasicType *basicType) {
     271        void ConversionCost::postvisit(BasicType *basicType) {
    255272                if ( BasicType *destAsBasic = dynamic_cast< BasicType* >( dest ) ) {
    256273                        int tableResult = costMatrix[ basicType->get_kind() ][ destAsBasic->get_kind() ];
     
    264281                        // xxx - not positive this is correct, but appears to allow casting int => enum
    265282                        cost = Cost::unsafe;
    266                 } else if ( dynamic_cast< ZeroType* >( dest ) != nullptr || dynamic_cast< OneType* >( dest ) != nullptr ) {
    267                         cost = Cost::unsafe;
    268                 } // if
    269         }
    270 
    271         void ConversionCost::visit( PointerType * pointerType ) {
     283                } // if
     284                // no cases for zero_t/one_t because it should not be possible to convert int, etc. to zero_t/one_t.
     285        }
     286
     287        void ConversionCost::postvisit( PointerType * pointerType ) {
    272288                if ( PointerType *destAsPtr = dynamic_cast< PointerType* >( dest ) ) {
    273                         PRINT( std::cerr << pointerType << " ===> " << destAsPtr; )
    274                         Type::Qualifiers tq1 = pointerType->get_base()->get_qualifiers();
    275                         Type::Qualifiers tq2 = destAsPtr->get_base()->get_qualifiers();
    276                         if ( tq1 <= tq2 && typesCompatibleIgnoreQualifiers( pointerType->get_base(), destAsPtr->get_base(), indexer, env ) ) {
     289                        PRINT( std::cerr << pointerType << " ===> " << destAsPtr << std::endl; )
     290                        Type::Qualifiers tq1 = pointerType->base->get_qualifiers();
     291                        Type::Qualifiers tq2 = destAsPtr->base->get_qualifiers();
     292                        if ( tq1 <= tq2 && typesCompatibleIgnoreQualifiers( pointerType->base, destAsPtr->base, indexer, env ) ) {
     293                                PRINT( std::cerr << " :: compatible and good qualifiers" << std::endl; )
    277294                                if ( tq1 == tq2 ) {
    278295                                        // types are the same
     
    280297                                } else {
    281298                                        // types are the same, except otherPointer has more qualifiers
    282                                         PRINT( std::cerr << " :: compatible and good qualifiers" << std::endl; )
    283299                                        cost = Cost::safe;
    284300                                }
    285                         } else {  // xxx - this discards qualifiers from consideration -- reducing qualifiers is a safe conversion; is this right?
     301                        } else {
    286302                                int assignResult = ptrsAssignable( pointerType->base, destAsPtr->base, env );
    287303                                PRINT( std::cerr << " :: " << assignResult << std::endl; )
    288                                 if ( assignResult > 0 && pointerType->get_base()->get_qualifiers() <= destAsPtr->get_qualifiers() ) {
    289                                         cost = Cost::safe;
     304                                if ( assignResult > 0 && tq1 <= tq2 ) {
     305                                        // xxx - want the case where qualifiers are added to be more expensive than the case where qualifiers are the same. Is 1 safe vs. 2 safe correct?
     306                                        if ( tq1 == tq2 ) {
     307                                                cost = Cost::safe;
     308                                        } else if ( tq1 < tq2 ) {
     309                                                cost = Cost::safe+Cost::safe;
     310                                        }
    290311                                } else if ( assignResult < 0 ) {
    291312                                        cost = Cost::unsafe;
     
    293314                                // assignResult == 0 means Cost::Infinity
    294315                        } // if
    295                 } else if ( dynamic_cast< ZeroType * >( dest ) ) {
    296                         cost = Cost::unsafe;
    297                 } // if
    298         }
    299 
    300         void ConversionCost::visit( ArrayType * ) {}
    301 
    302         void ConversionCost::visit( ReferenceType * refType ) {
     316                        // case case for zero_t because it should not be possible to convert pointers to zero_t.
     317                } // if
     318        }
     319
     320        void ConversionCost::postvisit( ArrayType * ) {}
     321
     322        void ConversionCost::postvisit( ReferenceType * refType ) {
    303323                // Note: dest can never be a reference, since it would have been caught in an earlier check
    304324                assert( ! dynamic_cast< ReferenceType * >( dest ) );
     
    306326                // recursively compute conversion cost from T1 to T2.
    307327                // cv can be safely dropped because of 'implicit dereference' behavior.
    308                 refType->base->accept( *this );
     328                cost = costFunc( refType->base, dest, indexer, env );
    309329                if ( refType->base->get_qualifiers() == dest->get_qualifiers() ) {
    310330                        cost.incReference();  // prefer exact qualifiers
     
    317337        }
    318338
    319         void ConversionCost::visit( FunctionType * ) {}
    320 
    321         void ConversionCost::visit( StructInstType * inst ) {
     339        void ConversionCost::postvisit( FunctionType * ) {}
     340
     341        void ConversionCost::postvisit( StructInstType * inst ) {
    322342                if ( StructInstType *destAsInst = dynamic_cast< StructInstType* >( dest ) ) {
    323343                        if ( inst->name == destAsInst->name ) {
     
    327347        }
    328348
    329         void ConversionCost::visit( UnionInstType * inst ) {
     349        void ConversionCost::postvisit( UnionInstType * inst ) {
    330350                if ( UnionInstType *destAsInst = dynamic_cast< UnionInstType* >( dest ) ) {
    331351                        if ( inst->name == destAsInst->name ) {
     
    335355        }
    336356
    337         void ConversionCost::visit( EnumInstType * ) {
     357        void ConversionCost::postvisit( EnumInstType * ) {
    338358                static Type::Qualifiers q;
    339359                static BasicType integer( q, BasicType::SignedInt );
    340                 integer.accept( *this );  // safe if dest >= int
     360                cost = costFunc( &integer, dest, indexer, env );  // safe if dest >= int
    341361                if ( cost < Cost::unsafe ) {
    342362                        cost.incSafe();
     
    344364        }
    345365
    346         void ConversionCost::visit( TraitInstType * ) {}
    347 
    348         void ConversionCost::visit( TypeInstType *inst ) {
    349                 EqvClass eqvClass;
    350                 NamedTypeDecl *namedType;
    351                 if ( env.lookup( inst->get_name(), eqvClass ) ) {
    352                         cost = conversionCost( eqvClass.type, dest, indexer, env );
     366        void ConversionCost::postvisit( TraitInstType * ) {}
     367
     368        void ConversionCost::postvisit( TypeInstType *inst ) {
     369                if ( const EqvClass *eqvClass = env.lookup( inst->name ) ) {
     370                        cost = costFunc( eqvClass->type, dest, indexer, env );
    353371                } else if ( TypeInstType *destAsInst = dynamic_cast< TypeInstType* >( dest ) ) {
    354                         if ( inst->get_name() == destAsInst->get_name() ) {
     372                        if ( inst->name == destAsInst->name ) {
    355373                                cost = Cost::zero;
    356374                        }
    357                 } else if ( ( namedType = indexer.lookupType( inst->get_name() ) ) ) {
     375                } else if ( NamedTypeDecl *namedType = indexer.lookupType( inst->name ) ) {
    358376                        TypeDecl *type = dynamic_cast< TypeDecl* >( namedType );
    359377                        // all typedefs should be gone by this point
    360378                        assert( type );
    361                         if ( type->get_base() ) {
    362                                 cost = conversionCost( type->get_base(), dest, indexer, env ) + Cost::safe;
    363                         } // if
    364                 } // if
    365         }
    366 
    367         void ConversionCost::visit( TupleType * tupleType ) {
     379                        if ( type->base ) {
     380                                cost = costFunc( type->base, dest, indexer, env ) + Cost::safe;
     381                        } // if
     382                } // if
     383        }
     384
     385        void ConversionCost::postvisit( TupleType * tupleType ) {
    368386                Cost c = Cost::zero;
    369387                if ( TupleType * destAsTuple = dynamic_cast< TupleType * >( dest ) ) {
    370                         std::list< Type * >::const_iterator srcIt = tupleType->get_types().begin();
    371                         std::list< Type * >::const_iterator destIt = destAsTuple->get_types().begin();
    372                         while ( srcIt != tupleType->get_types().end() && destIt != destAsTuple->get_types().end() ) {
    373                                 Cost newCost = conversionCost( *srcIt++, *destIt++, indexer, env );
     388                        std::list< Type * >::const_iterator srcIt = tupleType->types.begin();
     389                        std::list< Type * >::const_iterator destIt = destAsTuple->types.begin();
     390                        while ( srcIt != tupleType->types.end() && destIt != destAsTuple->types.end() ) {
     391                                Cost newCost = costFunc( *srcIt++, *destIt++, indexer, env );
    374392                                if ( newCost == Cost::infinity ) {
    375393                                        return;
     
    377395                                c += newCost;
    378396                        } // while
    379                         if ( destIt != destAsTuple->get_types().end() ) {
     397                        if ( destIt != destAsTuple->types.end() ) {
    380398                                cost = Cost::infinity;
    381399                        } else {
     
    385403        }
    386404
    387         void ConversionCost::visit( VarArgsType * ) {
     405        void ConversionCost::postvisit( VarArgsType * ) {
    388406                if ( dynamic_cast< VarArgsType* >( dest ) ) {
    389407                        cost = Cost::zero;
     
    391409        }
    392410
    393         void ConversionCost::visit( ZeroType * ) {
     411        void ConversionCost::postvisit( ZeroType * ) {
    394412                if ( dynamic_cast< ZeroType * >( dest ) ) {
    395413                        cost = Cost::zero;
     
    408426        }
    409427
    410         void ConversionCost::visit( OneType * ) {
     428        void ConversionCost::postvisit( OneType * ) {
    411429                if ( dynamic_cast< OneType * >( dest ) ) {
    412430                        cost = Cost::zero;
  • src/ResolvExpr/ConversionCost.h

    rf9feab8 r90152a4  
    1919
    2020#include "Cost.h"             // for Cost
     21
     22#include "Common/PassVisitor.h"
    2123#include "SynTree/Visitor.h"  // for Visitor
    2224#include "SynTree/SynTree.h"  // for Visitor Nodes
     
    2931        class TypeEnvironment;
    3032
    31         class ConversionCost : public Visitor {
     33        typedef std::function<Cost(Type *, Type *, const SymTab::Indexer &, const TypeEnvironment &)> CostFunction;
     34        struct ConversionCost : public WithShortCircuiting {
    3235          public:
    33                 ConversionCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env );
     36                ConversionCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction );
    3437
    3538                Cost get_cost() const { return cost; }
    3639
    37                 virtual void visit(VoidType *voidType);
    38                 virtual void visit(BasicType *basicType);
    39                 virtual void visit(PointerType *pointerType);
    40                 virtual void visit(ArrayType *arrayType);
    41                 virtual void visit(ReferenceType *refType);
    42                 virtual void visit(FunctionType *functionType);
    43                 virtual void visit(StructInstType *aggregateUseType);
    44                 virtual void visit(UnionInstType *aggregateUseType);
    45                 virtual void visit(EnumInstType *aggregateUseType);
    46                 virtual void visit(TraitInstType *aggregateUseType);
    47                 virtual void visit(TypeInstType *aggregateUseType);
    48                 virtual void visit(TupleType *tupleType);
    49                 virtual void visit(VarArgsType *varArgsType);
    50                 virtual void visit(ZeroType *zeroType);
    51                 virtual void visit(OneType *oneType);
     40                void previsit( BaseSyntaxNode * ) { visit_children = false; }
     41
     42                void postvisit( VoidType * voidType );
     43                void postvisit( BasicType * basicType );
     44                void postvisit( PointerType * pointerType );
     45                void postvisit( ArrayType * arrayType );
     46                void postvisit( ReferenceType * refType );
     47                void postvisit( FunctionType * functionType );
     48                void postvisit( StructInstType * aggregateUseType );
     49                void postvisit( UnionInstType * aggregateUseType );
     50                void postvisit( EnumInstType * aggregateUseType );
     51                void postvisit( TraitInstType * aggregateUseType );
     52                void postvisit( TypeInstType * aggregateUseType );
     53                void postvisit( TupleType * tupleType );
     54                void postvisit( VarArgsType * varArgsType );
     55                void postvisit( ZeroType * zeroType );
     56                void postvisit( OneType * oneType );
    5257          protected:
    5358                Type *dest;
     
    5560                Cost cost;
    5661                const TypeEnvironment &env;
     62                CostFunction costFunc;
    5763        };
    5864
    59         typedef std::function<int(Type *, Type *, const TypeEnvironment &, const SymTab::Indexer &)> PtrsFunction;
     65        typedef std::function<int(Type *, Type *, const SymTab::Indexer &, const TypeEnvironment &)> PtrsFunction;
    6066        Cost convertToReferenceCost( Type * src, ReferenceType * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func );
    6167} // namespace ResolvExpr
  • src/ResolvExpr/CurrentObject.cc

    rf9feab8 r90152a4  
    3838
    3939namespace ResolvExpr {
    40         long long int getConstValue( ConstantExpr * constExpr ) {
    41                 if ( BasicType * basicType = dynamic_cast< BasicType * >( constExpr->get_result() ) ) {
    42                         if ( basicType->isInteger() ) {
    43                                 return constExpr->get_constant()->get_ival();
    44                         } else {
    45                                 assertf( false, "Non-integer constant expression in getConstValue %s", toString( constExpr ).c_str() ); // xxx - might be semantic error
    46                         }
    47                 } else if ( dynamic_cast< OneType * >( constExpr->get_result() ) ) {
    48                         return 1;
    49                 } else if ( dynamic_cast< ZeroType * >( constExpr->get_result() ) ) {
    50                         return 0;
    51                 } else {
    52                         assertf( false, "unhandled type on getConstValue %s", toString( constExpr->get_result() ).c_str() ); // xxx - might be semantic error
    53                 }
    54         }
    55 
    5640        template< typename AggrInst >
    5741        TypeSubstitution makeGenericSubstitution( AggrInst * inst ) {
     
    7862                virtual ~MemberIterator() {}
    7963
     64                /// walks the current object using the given designators as a guide
    8065                virtual void setPosition( std::list< Expression * > & designators ) = 0;
     66
     67                /// retrieve the list of possible Type/Designaton pairs for the current position in the currect object
    8168                virtual std::list<InitAlternative> operator*() const = 0;
     69
     70                /// true if the iterator is not currently at the end
    8271                virtual operator bool() const = 0;
     72
     73                /// moves the iterator by one member in the current object
    8374                virtual MemberIterator & bigStep() = 0;
     75
     76                /// moves the iterator by one member in the current subobject
    8477                virtual MemberIterator & smallStep() = 0;
     78
     79                /// the type of the current object
    8580                virtual Type * getType() = 0;
     81
     82                /// the type of the current subobject
    8683                virtual Type * getNext() = 0;
    8784
     85                /// printing for debug
    8886                virtual void print( std::ostream & out, Indenter indent ) const = 0;
    8987
     88                /// helper for operator*; aggregates must add designator to each init alternative, but
     89                /// adding designators in operator* creates duplicates.
    9090                virtual std::list<InitAlternative> first() const = 0; // should be protected
    9191        };
     
    139139                ArrayIterator( ArrayType * at ) : array( at ) {
    140140                        PRINT( std::cerr << "Creating array iterator: " << at << std::endl; )
    141                         base = at->get_base();
     141                        base = at->base;
    142142                        memberIter = createMemberIterator( base );
    143                         setSize( at->get_dimension() );
     143                        if ( at->isVarLen ) SemanticError( at, "VLA initialization does not support @=: " );
     144                        setSize( at->dimension );
    144145                }
    145146
     
    149150
    150151        private:
    151                 void setSize( Expression * expr ) {
    152                         if ( ConstantExpr * constExpr = dynamic_cast< ConstantExpr * >( expr ) ) {
    153                                 size = getConstValue( constExpr );
    154                                 PRINT( std::cerr << "array type with size: " << size << std::endl; )
    155                         }       else if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( expr ) ) {
    156                                 setSize( castExpr->get_arg() ); // xxx - need to perform the conversion specified by the cast
     152                void setSize( Expression * expr ) { // replace this logic with an eval call
     153                        auto res = eval(expr);
     154                        if (res.second) {
     155                                size = res.first;
    157156                        } else {
    158                                 assertf( false, "unhandled expression in setSize: %s", toString( expr ).c_str() ); // xxx - if not a constant expression, it's not simple to determine how long the array actually is, which is necessary for initialization to be done correctly -- fix this
     157                                SemanticError( expr->location, toString("Array designator must be a constant expression: ", expr) );
    159158                        }
    160159                }
     
    164163                        // need to permit integer-constant-expressions, including: integer constants, enumeration constants, character constants, sizeof expressions, _Alignof expressions, cast expressions
    165164                        if ( ConstantExpr * constExpr = dynamic_cast< ConstantExpr * >( expr ) ) {
    166                                 index = getConstValue( constExpr );
     165                                try {
     166                                        index = constExpr->intValue();
     167                                } catch( SemanticErrorException & ) {
     168                                        SemanticError( expr, "Constant expression of non-integral type in array designator: " );
     169                                }
    167170                        } else if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( expr ) ) {
    168171                                setPosition( castExpr->get_arg() );
    169172                        } else if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( expr ) ) {
    170                                 assertf( dynamic_cast<EnumInstType *> ( varExpr->get_result() ), "ArrayIterator given variable that isn't an enum constant : %s", toString( expr ).c_str() );
    171                                 index = 0; // xxx - get actual value of enum constant
     173                                EnumInstType * inst = dynamic_cast<EnumInstType *>( varExpr->get_result() );
     174                                assertf( inst, "ArrayIterator given variable that isn't an enum constant : %s", toString( expr ).c_str() );
     175                                long long int value;
     176                                if ( inst->baseEnum->valueOf( varExpr->var, value ) ) {
     177                                        index = value;
     178                                }
    172179                        } else if ( dynamic_cast< SizeofExpr * >( expr ) || dynamic_cast< AlignofExpr * >( expr ) ) {
    173180                                index = 0; // xxx - get actual sizeof/alignof value?
     
    350357                                }
    351358                        }
    352                         // if ( curMember == std::next( decl->get_members().begin(), 1 ) ) { // xxx - this never triggers because curMember is incremented immediately on construction
    353                         if ( atbegin ) { // xxx - this never triggers because curMember is incremented immediately on construction
     359                        if ( atbegin ) {
    354360                                // xxx - what about case of empty struct??
    355361                                // only add self if at the very beginning of the structure
     
    385391                        return *this;
    386392                }
    387                 virtual std::list<InitAlternative> first() const { return std::list<InitAlternative>{}; }
    388393        };
    389394
     
    439444                                return new UnionIterator( uit );
    440445                        } else {
    441                                 assertf( dynamic_cast< TypeInstType * >( type ), "some other reftotype" );
     446                                assertf( dynamic_cast< EnumInstType * >( type ) || dynamic_cast< TypeInstType * >( type ), "Encountered unhandled ReferenceToType in createMemberIterator: %s", toString( type ).c_str() );
    442447                                return new SimpleIterator( type );
    443448                        }
     
    514519                } // for
    515520                if ( desigAlts.size() > 1 ) {
    516                         throw SemanticError( toString("Too many alternatives (", desigAlts.size(), ") for designation: "), designation );
     521                        SemanticError( designation, toString("Too many alternatives (", desigAlts.size(), ") for designation: ") );
    517522                } else if ( desigAlts.size() == 0 ) {
    518                         throw SemanticError( "No reasonable alternatives for designation: ", designation );
     523                        SemanticError( designation, "No reasonable alternatives for designation: " );
    519524                }
    520525                DesignatorChain & d = desigAlts.back();
  • src/ResolvExpr/ExplodedActual.h

    rf9feab8 r90152a4  
    3232
    3333                ExplodedActual() : env(), cost(Cost::zero), exprs() {}
    34 
    3534                ExplodedActual( const Alternative& actual, const SymTab::Indexer& indexer );
     35                ExplodedActual(ExplodedActual&&) = default;
     36                ExplodedActual& operator= (ExplodedActual&&) = default;
    3637        };
    3738}
  • src/ResolvExpr/FindOpenVars.cc

    rf9feab8 r90152a4  
    1919#include <map>                    // for map<>::mapped_type
    2020
     21#include "Common/PassVisitor.h"
    2122#include "SynTree/Declaration.h"  // for TypeDecl, DeclarationWithType (ptr ...
    2223#include "SynTree/Type.h"         // for Type, Type::ForallList, ArrayType
    23 #include "SynTree/Visitor.h"      // for Visitor
    2424
    2525namespace ResolvExpr {
    26         class FindOpenVars : public Visitor {
    27           public:
     26        struct FindOpenVars : public WithGuards {
    2827                FindOpenVars( OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen );
    2928
    30           private:
    31                 virtual void visit(PointerType *pointerType);
    32                 virtual void visit(ArrayType *arrayType);
    33                 virtual void visit(FunctionType *functionType);
    34                 virtual void visit(TupleType *tupleType);
     29                void previsit( PointerType * pointerType );
     30                void previsit( ArrayType * arrayType );
     31                void previsit( FunctionType * functionType );
     32                void previsit( TupleType * tupleType );
    3533
    3634                void common_action( Type *type );
     
    4240
    4341        void findOpenVars( Type *type, OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen ) {
    44                 FindOpenVars finder( openVars, closedVars, needAssertions, haveAssertions, firstIsOpen );
     42                PassVisitor<FindOpenVars> finder( openVars, closedVars, needAssertions, haveAssertions, firstIsOpen );
    4543                type->accept( finder );
    4644        }
     
    7068                        } // for
    7169                } // if
    72 ///   std::cout << "type is ";
    73 ///   type->print( std::cout );
    74 ///   std::cout << std::endl << "need is" << std::endl;
    75 ///   printAssertionSet( needAssertions, std::cout );
    76 ///   std::cout << std::endl << "have is" << std::endl;
    77 ///   printAssertionSet( haveAssertions, std::cout );
     70///   std::cerr << "type is ";
     71///   type->print( std::cerr );
     72///   std::cerr << std::endl << "need is" << std::endl;
     73///   printAssertionSet( needAssertions, std::cerr );
     74///   std::cerr << std::endl << "have is" << std::endl;
     75///   printAssertionSet( haveAssertions, std::cerr );
    7876        }
    7977
    80         void FindOpenVars::visit(PointerType *pointerType) {
     78        void FindOpenVars::previsit(PointerType *pointerType) {
    8179                common_action( pointerType );
    82                 Visitor::visit( pointerType );
    8380        }
    8481
    85         void FindOpenVars::visit(ArrayType *arrayType) {
     82        void FindOpenVars::previsit(ArrayType *arrayType) {
    8683                common_action( arrayType );
    87                 Visitor::visit( arrayType );
    8884        }
    8985
    90         void FindOpenVars::visit(FunctionType *functionType) {
     86        void FindOpenVars::previsit(FunctionType *functionType) {
    9187                common_action( functionType );
    9288                nextIsOpen = ! nextIsOpen;
    93                 Visitor::visit( functionType );
    94                 nextIsOpen = ! nextIsOpen;
     89                GuardAction( [this](){ nextIsOpen = ! nextIsOpen; } );
    9590        }
    9691
    97         void FindOpenVars::visit(TupleType *tupleType) {
     92        void FindOpenVars::previsit(TupleType *tupleType) {
    9893                common_action( tupleType );
    99                 Visitor::visit( tupleType );
    10094        }
    10195} // namespace ResolvExpr
  • src/ResolvExpr/Occurs.cc

    rf9feab8 r90152a4  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Occurs.cc -- 
     7// Occurs.cc --
    88//
    99// Author           : Richard C. Bilson
     
    1717#include <string>             // for string
    1818
     19#include "Common/PassVisitor.h"
    1920#include "SynTree/Type.h"     // for TypeInstType, Type
    20 #include "SynTree/Visitor.h"  // for Visitor
    2121#include "TypeEnvironment.h"  // for EqvClass, TypeEnvironment
    2222
    2323namespace ResolvExpr {
    24         class Occurs : public Visitor {
    25           public:
     24        struct Occurs : public WithVisitorRef<Occurs> {
    2625                Occurs( std::string varName, const TypeEnvironment &env );
    27                 bool get_result() const { return result; }
    28                 virtual void visit( TypeInstType *typeInst );
    29           private:
     26                void previsit( TypeInstType * typeInst );
     27
    3028                bool result;
    3129                std::set< std::string > eqvVars;
    32                 const TypeEnvironment &env;
     30                const TypeEnvironment &tenv;
    3331        };
    3432
    3533        bool occurs( Type *type, std::string varName, const TypeEnvironment &env ) {
    36                 Occurs occur( varName, env );
     34                PassVisitor<Occurs> occur( varName, env );
    3735                type->accept( occur );
    38                 return occur.get_result();
     36                return occur.pass.result;
    3937        }
    4038
    41         Occurs::Occurs( std::string varName, const TypeEnvironment &env ) : result( false ), env( env ) {
    42                 EqvClass eqvClass;
    43                 if ( env.lookup( varName, eqvClass ) ) {
    44                         eqvVars = eqvClass.vars;
     39        Occurs::Occurs( std::string varName, const TypeEnvironment & env ) : result( false ), tenv( env ) {
     40                if ( const EqvClass *eqvClass = tenv.lookup( varName ) ) {
     41                        eqvVars = eqvClass->vars;
    4542                } else {
    4643                        eqvVars.insert( varName );
     
    4845        }
    4946
    50         void Occurs::visit( TypeInstType *typeInst ) {
    51                 EqvClass eqvClass;
    52 ///   std::cout << "searching for vars: ";
    53 ///   std::copy( eqvVars.begin(), eqvVars.end(), std::ostream_iterator< std::string >( std::cout, " " ) );
    54 ///   std::cout << std::endl;
     47        void Occurs::previsit( TypeInstType * typeInst ) {
     48                ///   std::cerr << "searching for vars: ";
     49///   std::copy( eqvVars.begin(), eqvVars.end(), std::ostream_iterator< std::string >( std::cerr, " " ) );
     50///   std::cerr << std::endl;
    5551                if ( eqvVars.find( typeInst->get_name() ) != eqvVars.end() ) {
    5652                        result = true;
    57                 } else if ( env.lookup( typeInst->get_name(), eqvClass ) ) {
    58                         if ( eqvClass.type ) {
    59 ///       std::cout << typeInst->get_name() << " is bound to";
    60 ///       eqvClass.type->print( std::cout );
    61 ///       std::cout << std::endl;
    62                                 eqvClass.type->accept( *this );
     53                } else if ( const EqvClass *eqvClass = tenv.lookup( typeInst->get_name() ) ) {
     54                        if ( eqvClass->type ) {
     55///       std::cerr << typeInst->get_name() << " is bound to";
     56///       eqvClass.type->print( std::cerr );
     57///       std::cerr << std::endl;
     58                                eqvClass->type->accept( *visitor );
    6359                        } // if
    6460                } // if
  • src/ResolvExpr/PolyCost.cc

    rf9feab8 r90152a4  
    1414//
    1515
     16#include "Common/PassVisitor.h"
    1617#include "SymTab/Indexer.h"   // for Indexer
    1718#include "SynTree/Type.h"     // for TypeInstType, Type
    18 #include "SynTree/Visitor.h"  // for Visitor
    1919#include "TypeEnvironment.h"  // for EqvClass, TypeEnvironment
    2020
    2121namespace ResolvExpr {
    22         class PolyCost : public Visitor {
    23           public:
     22        struct PolyCost {
    2423                PolyCost( const TypeEnvironment &env, const SymTab::Indexer &indexer );
    25                 int get_result() const { return result; }
    26           private:
    27                 virtual void visit(TypeInstType *aggregateUseType);
     24
     25                void previsit( TypeInstType * aggregateUseType );
    2826                int result;
    29                 const TypeEnvironment &env;
     27                const TypeEnvironment &tenv;
    3028                const SymTab::Indexer &indexer;
    3129        };
    3230
    3331        int polyCost( Type *type, const TypeEnvironment & env, const SymTab::Indexer &indexer ) {
    34                 PolyCost coster( env, indexer );
     32                PassVisitor<PolyCost> coster( env, indexer );
    3533                type->accept( coster );
    36                 return coster.get_result();
     34                return coster.pass.result;
    3735        }
    3836
    39         PolyCost::PolyCost( const TypeEnvironment & env, const SymTab::Indexer & indexer ) : result( 0 ), env( env ), indexer( indexer ) {
     37        PolyCost::PolyCost( const TypeEnvironment & env, const SymTab::Indexer & indexer ) : result( 0 ), tenv( env ), indexer( indexer ) {
    4038        }
    4139
    42         void PolyCost::visit(TypeInstType * typeInst) {
    43                 EqvClass eqvClass;
    44                 if ( env.lookup( typeInst->name, eqvClass ) ) {
    45                         if ( eqvClass.type ) {
    46                                 if ( TypeInstType * otherTypeInst = dynamic_cast< TypeInstType* >( eqvClass.type ) ) {
     40        void PolyCost::previsit(TypeInstType * typeInst) {
     41                if ( const EqvClass *eqvClass = tenv.lookup( typeInst->name ) ) {
     42                        if ( eqvClass->type ) {
     43                                if ( TypeInstType * otherTypeInst = dynamic_cast< TypeInstType* >( eqvClass->type ) ) {
    4744                                        if ( indexer.lookupType( otherTypeInst->name ) ) {
    4845                                                // bound to opaque type
  • src/ResolvExpr/PtrsAssignable.cc

    rf9feab8 r90152a4  
    1414//
    1515
     16#include "Common/PassVisitor.h"
    1617#include "ResolvExpr/TypeEnvironment.h"  // for EqvClass, TypeEnvironment
    1718#include "SynTree/Type.h"                // for TypeInstType, Type, BasicType
     
    2021
    2122namespace ResolvExpr {
    22         class PtrsAssignable : public Visitor {
    23           public:
     23        struct PtrsAssignable : public WithShortCircuiting {
    2424                PtrsAssignable( Type *dest, const TypeEnvironment &env );
    2525
    2626                int get_result() const { return result; }
    2727
    28                 virtual void visit( VoidType *voidType );
    29                 virtual void visit( BasicType *basicType );
    30                 virtual void visit( PointerType *pointerType );
    31                 virtual void visit( ArrayType *arrayType );
    32                 virtual void visit( FunctionType *functionType );
    33                 virtual void visit( StructInstType *inst );
    34                 virtual void visit( UnionInstType *inst );
    35                 virtual void visit( EnumInstType *inst );
    36                 virtual void visit( TraitInstType *inst );
    37                 virtual void visit( TypeInstType *inst );
    38                 virtual void visit( TupleType *tupleType );
    39                 virtual void visit( VarArgsType *varArgsType );
    40                 virtual void visit( ZeroType *zeroType );
    41                 virtual void visit( OneType *oneType );
     28                void previsit( Type * ) { visit_children = false; }
     29
     30                void postvisit( VoidType * voidType );
     31                void postvisit( BasicType * basicType );
     32                void postvisit( PointerType * pointerType );
     33                void postvisit( ArrayType * arrayType );
     34                void postvisit( FunctionType * functionType );
     35                void postvisit( StructInstType * inst );
     36                void postvisit( UnionInstType * inst );
     37                void postvisit( EnumInstType * inst );
     38                void postvisit( TraitInstType * inst );
     39                void postvisit( TypeInstType * inst );
     40                void postvisit( TupleType * tupleType );
     41                void postvisit( VarArgsType * varArgsType );
     42                void postvisit( ZeroType * zeroType );
     43                void postvisit( OneType * oneType );
    4244          private:
    4345                Type *dest;
     
    4951                // std::cerr << "assignable: " << src << " | " << dest << std::endl;
    5052                if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
    51                         EqvClass eqvClass;
    52                         if ( env.lookup( destAsTypeInst->get_name(), eqvClass ) ) {
    53                                 return ptrsAssignable( src, eqvClass.type, env );
     53                        if ( const EqvClass *eqvClass = env.lookup( destAsTypeInst->get_name() ) ) {
     54                                return ptrsAssignable( src, eqvClass->type, env );
    5455                        } // if
    5556                } // if
     
    5960                        return -1;
    6061                } else {
    61                         PtrsAssignable ptrs( dest, env );
     62                        PassVisitor<PtrsAssignable> ptrs( dest, env );
    6263                        src->accept( ptrs );
    63                         return ptrs.get_result();
     64                        return ptrs.pass.get_result();
    6465                } // if
    6566        }
     
    6768        PtrsAssignable::PtrsAssignable( Type *dest, const TypeEnvironment &env ) : dest( dest ), result( 0 ), env( env ) {}
    6869
    69         void PtrsAssignable::visit( __attribute((unused)) VoidType *voidType ) {
     70        void PtrsAssignable::postvisit( VoidType * ) {
    7071                // T * = void * is disallowed - this is a change from C, where any
    7172                // void * can be assigned or passed to a non-void pointer without a cast.
    7273        }
    7374
    74         void PtrsAssignable::visit( __attribute__((unused)) BasicType *basicType ) {}
    75         void PtrsAssignable::visit( __attribute__((unused)) PointerType *pointerType ) {}
    76         void PtrsAssignable::visit( __attribute__((unused)) ArrayType *arrayType ) {}
    77         void PtrsAssignable::visit( __attribute__((unused)) FunctionType *functionType ) {}
     75        void PtrsAssignable::postvisit( __attribute__((unused)) BasicType *basicType ) {}
     76        void PtrsAssignable::postvisit( __attribute__((unused)) PointerType *pointerType ) {}
     77        void PtrsAssignable::postvisit( __attribute__((unused)) ArrayType *arrayType ) {}
     78        void PtrsAssignable::postvisit( __attribute__((unused)) FunctionType *functionType ) {}
    7879
    79         void PtrsAssignable::visit(  __attribute__((unused)) StructInstType *inst ) {}
    80         void PtrsAssignable::visit(  __attribute__((unused)) UnionInstType *inst ) {}
     80        void PtrsAssignable::postvisit(  __attribute__((unused)) StructInstType *inst ) {}
     81        void PtrsAssignable::postvisit(  __attribute__((unused)) UnionInstType *inst ) {}
    8182
    82         void PtrsAssignable::visit( EnumInstType * ) {
     83        void PtrsAssignable::postvisit( EnumInstType * ) {
    8384                if ( dynamic_cast< BasicType* >( dest ) ) {
    8485                        // int * = E *, etc. is safe. This isn't technically correct, as each
     
    9192        }
    9293
    93         void PtrsAssignable::visit(  __attribute__((unused)) TraitInstType *inst ) {}
    94         void PtrsAssignable::visit( TypeInstType *inst ) {
    95                 EqvClass eqvClass;
    96                 if ( env.lookup( inst->get_name(), eqvClass ) && eqvClass.type ) {
    97                         // T * = S * for any S depends on the type bound to T
    98                         result = ptrsAssignable( eqvClass.type, dest, env );
     94        void PtrsAssignable::postvisit(  __attribute__((unused)) TraitInstType *inst ) {}
     95        void PtrsAssignable::postvisit( TypeInstType *inst ) {
     96                if ( const EqvClass *eqvClass = env.lookup( inst->get_name() ) ) {
     97                        if ( eqvClass->type ) {
     98                                // T * = S * for any S depends on the type bound to T
     99                                result = ptrsAssignable( eqvClass->type, dest, env );
     100                        }
    99101                } // if
    100102        }
    101103
    102         void PtrsAssignable::visit(  __attribute__((unused)) TupleType *tupleType ) {}
    103         void PtrsAssignable::visit(  __attribute__((unused)) VarArgsType *varArgsType ) {}
    104         void PtrsAssignable::visit(  __attribute__((unused)) ZeroType *zeroType ) {}
    105         void PtrsAssignable::visit(  __attribute__((unused)) OneType *oneType ) {}
     104        void PtrsAssignable::postvisit(  __attribute__((unused)) TupleType *tupleType ) {}
     105        void PtrsAssignable::postvisit(  __attribute__((unused)) VarArgsType *varArgsType ) {}
     106        void PtrsAssignable::postvisit(  __attribute__((unused)) ZeroType *zeroType ) {}
     107        void PtrsAssignable::postvisit(  __attribute__((unused)) OneType *oneType ) {}
    106108
    107109} // namespace ResolvExpr
  • src/ResolvExpr/PtrsCastable.cc

    rf9feab8 r90152a4  
    1414//
    1515
     16#include "Common/PassVisitor.h"
    1617#include "ResolvExpr/TypeEnvironment.h"  // for EqvClass, TypeEnvironment
    1718#include "SymTab/Indexer.h"              // for Indexer
     
    2122#include "typeops.h"                     // for ptrsAssignable
    2223
    23 
    2424namespace ResolvExpr {
    25         class PtrsCastable : public Visitor {
     25        struct PtrsCastable : public WithShortCircuiting {
    2626          public:
    2727                PtrsCastable( Type *dest, const TypeEnvironment &env, const SymTab::Indexer &indexer );
     
    2929                int get_result() const { return result; }
    3030
    31                 virtual void visit(VoidType *voidType);
    32                 virtual void visit(BasicType *basicType);
    33                 virtual void visit(PointerType *pointerType);
    34                 virtual void visit(ArrayType *arrayType);
    35                 virtual void visit(FunctionType *functionType);
    36                 virtual void visit(StructInstType *inst);
    37                 virtual void visit(UnionInstType *inst);
    38                 virtual void visit(EnumInstType *inst);
    39                 virtual void visit(TraitInstType *inst);
    40                 virtual void visit(TypeInstType *inst);
    41                 virtual void visit(TupleType *tupleType);
    42                 virtual void visit(VarArgsType *varArgsType);
    43                 virtual void visit(ZeroType *zeroType);
    44                 virtual void visit(OneType *oneType);
     31                void previsit( Type * ) { visit_children = false; }
     32
     33                void postvisit( VoidType * voidType );
     34                void postvisit( BasicType * basicType );
     35                void postvisit( PointerType * pointerType );
     36                void postvisit( ArrayType * arrayType );
     37                void postvisit( FunctionType * functionType );
     38                void postvisit( StructInstType * inst );
     39                void postvisit( UnionInstType * inst );
     40                void postvisit( EnumInstType * inst );
     41                void postvisit( TraitInstType * inst );
     42                void postvisit( TypeInstType * inst );
     43                void postvisit( TupleType * tupleType );
     44                void postvisit( VarArgsType * varArgsType );
     45                void postvisit( ZeroType * zeroType );
     46                void postvisit( OneType * oneType );
    4547          private:
    4648                Type *dest;
     
    5557                                return -1;
    5658                        } else if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( src ) ) {
    57                                 EqvClass eqvClass;
    5859                                if ( NamedTypeDecl *ntDecl = indexer.lookupType( typeInst->get_name() ) ) {
    5960                                        if ( TypeDecl *tyDecl = dynamic_cast< TypeDecl* >( ntDecl ) ) {
     
    6263                                                } // if
    6364                                        } //if
    64                                 } else if ( env.lookup( typeInst->get_name(), eqvClass ) ) {
    65                                         if ( eqvClass.data.kind == TypeDecl::Ftype ) {
     65                                } else if ( const EqvClass *eqvClass = env.lookup( typeInst->get_name() ) ) {
     66                                        if ( eqvClass->data.kind == TypeDecl::Ftype ) {
    6667                                                return -1;
    6768                                        } // if
     
    7778        int ptrsCastable( Type *src, Type *dest, const TypeEnvironment &env, const SymTab::Indexer &indexer ) {
    7879                if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
    79                         EqvClass eqvClass;
    80                         if ( env.lookup( destAsTypeInst->get_name(), eqvClass ) ) {
    81                                 return ptrsAssignable( src, eqvClass.type, env );
     80                        if ( const EqvClass *eqvClass = env.lookup( destAsTypeInst->get_name() ) ) {
     81                                // xxx - should this be ptrsCastable?
     82                                return ptrsAssignable( src, eqvClass->type, env );
    8283                        } // if
    8384                } // if
     
    8586                        return objectCast( src, env, indexer );
    8687                } else {
    87                         PtrsCastable ptrs( dest, env, indexer );
     88                        PassVisitor<PtrsCastable> ptrs( dest, env, indexer );
    8889                        src->accept( ptrs );
    89                         return ptrs.get_result();
     90                        return ptrs.pass.get_result();
    9091                } // if
    9192        }
     
    9596        }
    9697
    97         void PtrsCastable::visit( VoidType * ) {
     98        void PtrsCastable::postvisit( VoidType * ) {
    9899                result = objectCast( dest, env, indexer );
    99100        }
    100101
    101         void PtrsCastable::visit( BasicType * ) {
     102        void PtrsCastable::postvisit( BasicType * ) {
    102103                result = objectCast( dest, env, indexer );
    103104        }
    104105
    105         void PtrsCastable::visit( PointerType * ) {
     106        void PtrsCastable::postvisit( PointerType * ) {
    106107                result = objectCast( dest, env, indexer );
    107108        }
    108109
    109         void PtrsCastable::visit( ArrayType * ) {
     110        void PtrsCastable::postvisit( ArrayType * ) {
    110111                result = objectCast( dest, env, indexer );
    111112        }
    112113
    113         void PtrsCastable::visit( FunctionType * ) {
     114        void PtrsCastable::postvisit( FunctionType * ) {
    114115                // result = -1;
    115116                result = functionCast( dest, env, indexer );
    116117        }
    117118
    118         void PtrsCastable::visit( StructInstType * ) {
     119        void PtrsCastable::postvisit( StructInstType * ) {
    119120                result = objectCast( dest, env, indexer );
    120121        }
    121122
    122         void PtrsCastable::visit( UnionInstType * ) {
     123        void PtrsCastable::postvisit( UnionInstType * ) {
    123124                result = objectCast( dest, env, indexer );
    124125        }
    125126
    126         void PtrsCastable::visit( EnumInstType * ) {
     127        void PtrsCastable::postvisit( EnumInstType * ) {
    127128                if ( dynamic_cast< EnumInstType* >( dest ) ) {
    128129                        result = 1;
     
    138139        }
    139140
    140         void PtrsCastable::visit( TraitInstType * ) {}
     141        void PtrsCastable::postvisit( TraitInstType * ) {}
    141142
    142         void PtrsCastable::visit(TypeInstType *inst) {
     143        void PtrsCastable::postvisit(TypeInstType *inst) {
    143144                //result = objectCast( inst, env, indexer ) > 0 && objectCast( dest, env, indexer ) > 0 ? 1 : -1;
    144145                result = objectCast( inst, env, indexer ) == objectCast( dest, env, indexer ) ? 1 : -1;
    145146        }
    146147
    147         void PtrsCastable::visit( TupleType * ) {
     148        void PtrsCastable::postvisit( TupleType * ) {
    148149                result = objectCast( dest, env, indexer );
    149150        }
    150151
    151         void PtrsCastable::visit( VarArgsType * ) {
     152        void PtrsCastable::postvisit( VarArgsType * ) {
    152153                result = objectCast( dest, env, indexer );
    153154        }
    154155
    155         void PtrsCastable::visit( ZeroType * ) {
     156        void PtrsCastable::postvisit( ZeroType * ) {
    156157                result = objectCast( dest, env, indexer );
    157158        }
    158159
    159         void PtrsCastable::visit( OneType * ) {
     160        void PtrsCastable::postvisit( OneType * ) {
    160161                result = objectCast( dest, env, indexer );
    161162        }
  • src/ResolvExpr/RenameVars.cc

    rf9feab8 r90152a4  
    1919#include <utility>                 // for pair
    2020
     21#include "Common/PassVisitor.h"
    2122#include "Common/SemanticError.h"  // for SemanticError
    2223#include "RenameVars.h"
     
    2728
    2829namespace ResolvExpr {
    29         RenameVars global_renamer;
     30        namespace {
     31                struct RenameVars {
     32                        RenameVars();
     33                        void reset();
    3034
    31         RenameVars::RenameVars() : level( 0 ), resetCount( 0 ) {
    32                 mapStack.push_front( std::map< std::string, std::string >() );
     35                        void previsit( TypeInstType * instType );
     36                        void previsit( Type * );
     37                        void postvisit( Type * );
     38
     39                  private:
     40                        int level, resetCount;
     41                        std::list< std::map< std::string, std::string > > mapStack;
     42                };
     43
     44                PassVisitor<RenameVars> global_renamer;
     45        } // namespace
     46
     47        void renameTyVars( Type * t ) {
     48                t->accept( global_renamer );
    3349        }
    3450
    35         void RenameVars::reset() {
    36                 level = 0;
    37                 resetCount++;
     51        void resetTyVarRenaming() {
     52                global_renamer.pass.reset();
    3853        }
    3954
    40         void RenameVars::visit( VoidType *voidType ) {
    41                 typeBefore( voidType );
    42                 typeAfter( voidType );
    43         }
     55        namespace {
     56                RenameVars::RenameVars() : level( 0 ), resetCount( 0 ) {
     57                        mapStack.push_front( std::map< std::string, std::string >() );
     58                }
    4459
    45         void RenameVars::visit( BasicType *basicType ) {
    46                 typeBefore( basicType );
    47                 typeAfter( basicType );
    48         }
     60                void RenameVars::reset() {
     61                        level = 0;
     62                        resetCount++;
     63                }
    4964
    50         void RenameVars::visit( PointerType *pointerType ) {
    51                 typeBefore( pointerType );
    52                 maybeAccept( pointerType->get_base(), *this );
    53                 typeAfter( pointerType );
    54         }
     65                void RenameVars::previsit( TypeInstType * instType ) {
     66                        previsit( (Type *)instType );
     67                        std::map< std::string, std::string >::const_iterator i = mapStack.front().find( instType->name );
     68                        if ( i != mapStack.front().end() ) {
     69                                instType->name = i->second;
     70                        } // if
     71                }
    5572
    56         void RenameVars::visit( ArrayType *arrayType ) {
    57                 typeBefore( arrayType );
    58                 maybeAccept( arrayType->get_dimension(), *this );
    59                 maybeAccept( arrayType->get_base(), *this );
    60                 typeAfter( arrayType );
    61         }
     73                void RenameVars::previsit( Type * type ) {
     74                        if ( ! type->forall.empty() ) {
     75                                // copies current name mapping into new mapping
     76                                mapStack.push_front( mapStack.front() );
     77                                // renames all "forall" type names to `_${level}_${name}'
     78                                for ( auto td : type->forall ) {
     79                                        std::ostringstream output;
     80                                        output << "_" << resetCount << "_" << level << "_" << td->name;
     81                                        std::string newname( output.str() );
     82                                        mapStack.front()[ td->get_name() ] = newname;
     83                                        td->name = newname;
     84                                        // ditto for assertion names, the next level in
     85                                        level++;
     86                                        // acceptAll( td->assertions, *this );
     87                                } // for
     88                        } // if
     89                }
    6290
    63         void RenameVars::visit( FunctionType *functionType ) {
    64                 typeBefore( functionType );
    65                 acceptAll( functionType->get_returnVals(), *this );
    66                 acceptAll( functionType->get_parameters(), *this );
    67                 typeAfter( functionType );
    68         }
    69 
    70         void RenameVars::visit( StructInstType *aggregateUseType ) {
    71                 typeBefore( aggregateUseType );
    72                 acceptAll( aggregateUseType->get_parameters(), *this );
    73                 typeAfter( aggregateUseType );
    74         }
    75 
    76         void RenameVars::visit( UnionInstType *aggregateUseType ) {
    77                 typeBefore( aggregateUseType );
    78                 acceptAll( aggregateUseType->get_parameters(), *this );
    79                 typeAfter( aggregateUseType );
    80         }
    81 
    82         void RenameVars::visit( EnumInstType *aggregateUseType ) {
    83                 typeBefore( aggregateUseType );
    84                 acceptAll( aggregateUseType->get_parameters(), *this );
    85                 typeAfter( aggregateUseType );
    86         }
    87 
    88         void RenameVars::visit( TraitInstType *aggregateUseType ) {
    89                 typeBefore( aggregateUseType );
    90                 acceptAll( aggregateUseType->get_parameters(), *this );
    91                 typeAfter( aggregateUseType );
    92         }
    93 
    94         void RenameVars::visit( TypeInstType *instType ) {
    95                 typeBefore( instType );
    96                 std::map< std::string, std::string >::const_iterator i = mapStack.front().find( instType->get_name() );
    97                 if ( i != mapStack.front().end() ) {
    98                         instType->set_name( i->second );
    99                 } else {
    100                 } // if
    101                 acceptAll( instType->get_parameters(), *this );
    102                 typeAfter( instType );
    103         }
    104 
    105         void RenameVars::visit( TupleType *tupleType ) {
    106                 typeBefore( tupleType );
    107                 acceptAll( tupleType->get_types(), *this );
    108                 typeAfter( tupleType );
    109         }
    110 
    111         void RenameVars::visit( VarArgsType *varArgsType ) {
    112                 typeBefore( varArgsType );
    113                 typeAfter( varArgsType );
    114         }
    115 
    116         void RenameVars::visit( ZeroType *zeroType ) {
    117                 typeBefore( zeroType );
    118                 typeAfter( zeroType );
    119         }
    120 
    121         void RenameVars::visit( OneType *oneType ) {
    122                 typeBefore( oneType );
    123                 typeAfter( oneType );
    124         }
    125 
    126         void RenameVars::typeBefore( Type *type ) {
    127                 if ( ! type->get_forall().empty() ) {
    128                         // copies current name mapping into new mapping
    129                         mapStack.push_front( mapStack.front() );
    130                         // renames all "forall" type names to `_${level}_${name}'
    131                         for ( Type::ForallList::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
    132                                 std::ostringstream output;
    133                                 output << "_" << resetCount << "_" << level << "_" << (*i)->get_name();
    134                                 std::string newname( output.str() );
    135                                 mapStack.front()[ (*i)->get_name() ] = newname;
    136                                 (*i)->set_name( newname );
    137                                 // ditto for assertion names, the next level in
    138                                 level++;
    139                                 acceptAll( (*i)->get_assertions(), *this );
    140                         } // for
    141                 } // if
    142         }
    143 
    144         void RenameVars::typeAfter( Type *type ) {
    145                 // clears name mapping added by typeBefore()
    146                 if ( ! type->get_forall().empty() ) {
    147                         mapStack.pop_front();
    148                 } // if
    149         }
    150 
     91                void RenameVars::postvisit( Type * type ) {
     92                        // clears name mapping added by typeBefore()
     93                        if ( ! type->forall.empty() ) {
     94                                mapStack.pop_front();
     95                        } // if
     96                }
     97        } // namespace
    15198} // namespace ResolvExpr
    15299
  • src/ResolvExpr/RenameVars.h

    rf9feab8 r90152a4  
    2424
    2525namespace ResolvExpr {
     26        /// Provides a consistent renaming of forall type names in a hierarchy by prefixing them with a unique "level" ID
     27        void renameTyVars( Type * );
    2628
    27         /// Provides a consistent renaming of forall type names in a hierarchy by prefixing them with a unique "level" ID
    28         class RenameVars : public Visitor {
    29           public:
    30                 RenameVars();
    31                 void reset();
    32           private:
    33                 virtual void visit( VoidType *basicType );
    34                 virtual void visit( BasicType *basicType );
    35                 virtual void visit( PointerType *pointerType );
    36                 virtual void visit( ArrayType *arrayType );
    37                 virtual void visit( FunctionType *functionType );
    38                 virtual void visit( StructInstType *aggregateUseType );
    39                 virtual void visit( UnionInstType *aggregateUseType );
    40                 virtual void visit( EnumInstType *aggregateUseType );
    41                 virtual void visit( TraitInstType *aggregateUseType );
    42                 virtual void visit( TypeInstType *aggregateUseType );
    43                 virtual void visit( TupleType *tupleType );
    44                 virtual void visit( VarArgsType *varArgsType );
    45                 virtual void visit( ZeroType *zeroType );
    46                 virtual void visit( OneType *oneType );
    47 
    48                 void typeBefore( Type *type );
    49                 void typeAfter( Type *type );
    50                 int level, resetCount;
    51                 std::list< std::map< std::string, std::string > > mapStack;
    52         };
    53 
    54         extern RenameVars global_renamer;
     29        /// resets internal state of renamer to avoid overflow
     30        void resetTyVarRenaming();
    5531} // namespace ResolvExpr
    5632
  • src/ResolvExpr/Resolver.cc

    rf9feab8 r90152a4  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 12:17:01 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Aug  8 16:06:00 2017
    13 // Update Count     : 212
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Feb 17 11:19:40 2018
     13// Update Count     : 213
    1414//
    1515
     
    3030#include "RenameVars.h"                  // for RenameVars, global_renamer
    3131#include "ResolvExpr/TypeEnvironment.h"  // for TypeEnvironment
    32 #include "ResolveTypeof.h"               // for resolveTypeof
    3332#include "Resolver.h"
    3433#include "SymTab/Autogen.h"              // for SizeType
     
    5756                void postvisit( FunctionDecl *functionDecl );
    5857                void previsit( ObjectDecl *objectDecll );
    59                 void previsit( TypeDecl *typeDecl );
    6058                void previsit( EnumDecl * enumDecl );
     59                void previsit( StaticAssertDecl * assertDecl );
    6160
    6261                void previsit( ArrayType * at );
     
    7675                void previsit( CatchStmt *catchStmt );
    7776                void previsit( WaitForStmt * stmt );
    78                 void previsit( WithStmt * withStmt );
    7977
    8078                void previsit( SingleInit *singleInit );
     
    8280                void previsit( ConstructorInit *ctorInit );
    8381          private:
    84         typedef std::list< Initializer * >::iterator InitIterator;
     82                typedef std::list< Initializer * >::iterator InitIterator;
    8583
    8684                template< typename PtrType >
    8785                void handlePtrType( PtrType * type );
    8886
    89           void resolveAggrInit( ReferenceToType *, InitIterator &, InitIterator & );
    90           void resolveSingleAggrInit( Declaration *, InitIterator &, InitIterator &, TypeSubstitution sub );
    91           void fallbackInit( ConstructorInit * ctorInit );
     87                void fallbackInit( ConstructorInit * ctorInit );
    9288
    9389                Type * functionReturn = nullptr;
     
    9692        };
    9793
     94        struct ResolveWithExprs : public WithIndexer, public WithGuards, public WithVisitorRef<ResolveWithExprs>, public WithShortCircuiting, public WithStmtsToAdd {
     95                void previsit( FunctionDecl * );
     96                void previsit( WithStmt * );
     97
     98                void resolveWithExprs( std::list< Expression * > & withExprs, std::list< Statement * > & newStmts );
     99        };
     100
    98101        void resolve( std::list< Declaration * > translationUnit ) {
    99102                PassVisitor<Resolver> resolver;
     
    106109        }
    107110
    108         // used in resolveTypeof
    109         Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer ) {
    110                 TypeEnvironment env;
    111                 return resolveInVoidContext( expr, indexer, env );
    112         }
    113 
    114111        namespace {
    115                 void finishExpr( Expression *expr, const TypeEnvironment &env, TypeSubstitution * oldenv = nullptr ) {
     112                struct DeleteFinder : public WithShortCircuiting        {
     113                        DeletedExpr * delExpr = nullptr;
     114                        void previsit( DeletedExpr * expr ) {
     115                                if ( delExpr ) visit_children = false;
     116                                else delExpr = expr;
     117                        }
     118
     119                        void previsit( Expression * ) {
     120                                if ( delExpr ) visit_children = false;
     121                        }
     122                };
     123        }
     124
     125        DeletedExpr * findDeletedExpr( Expression * expr ) {
     126                PassVisitor<DeleteFinder> finder;
     127                expr->accept( finder );
     128                return finder.pass.delExpr;
     129        }
     130
     131        namespace {
     132                struct StripCasts {
     133                        Expression * postmutate( CastExpr * castExpr ) {
     134                                if ( castExpr->isGenerated && ResolvExpr::typesCompatible( castExpr->arg->result, castExpr->result, SymTab::Indexer() ) ) {
     135                                        // generated cast is to the same type as its argument, so it's unnecessary -- remove it
     136                                        Expression * expr = castExpr->arg;
     137                                        castExpr->arg = nullptr;
     138                                        std::swap( expr->env, castExpr->env );
     139                                        return expr;
     140                                }
     141                                return castExpr;
     142                        }
     143
     144                        static void strip( Expression *& expr ) {
     145                                PassVisitor<StripCasts> stripper;
     146                                expr = expr->acceptMutator( stripper );
     147                        }
     148                };
     149
     150                void finishExpr( Expression *&expr, const TypeEnvironment &env, TypeSubstitution * oldenv = nullptr ) {
    116151                        expr->env = oldenv ? oldenv->clone() : new TypeSubstitution;
    117                         env.makeSubstitution( *expr->get_env() );
     152                        env.makeSubstitution( *expr->env );
     153                        StripCasts::strip( expr ); // remove unnecessary casts that may be buried in an expression
    118154                }
    119155
     
    131167        } // namespace
    132168
     169        namespace {
     170                void findUnfinishedKindExpression(Expression * untyped, Alternative & alt, const SymTab::Indexer & indexer, const std::string & kindStr, std::function<bool(const Alternative &)> pred, bool adjust = false, bool prune = true, bool failFast = true) {
     171                        assertf( untyped, "expected a non-null expression." );
     172                        TypeEnvironment env;
     173                        AlternativeFinder finder( indexer, env );
     174                        finder.find( untyped, adjust, prune, failFast );
     175
     176                        #if 0
     177                        if ( finder.get_alternatives().size() != 1 ) {
     178                                std::cerr << "untyped expr is ";
     179                                untyped->print( std::cerr );
     180                                std::cerr << std::endl << "alternatives are:";
     181                                for ( const Alternative & alt : finder.get_alternatives() ) {
     182                                        alt.print( std::cerr );
     183                                } // for
     184                        } // if
     185                        #endif
     186
     187                        AltList candidates;
     188                        for ( Alternative & alt : finder.get_alternatives() ) {
     189                                if ( pred( alt ) ) {
     190                                        candidates.push_back( std::move( alt ) );
     191                                }
     192                        }
     193
     194                        // xxx - if > 1 alternative with same cost, ignore deleted and pick from remaining
     195                        // choose the lowest cost expression among the candidates
     196                        AltList winners;
     197                        findMinCost( candidates.begin(), candidates.end(), back_inserter( winners ) );
     198                        if ( winners.size() == 0 ) {
     199                                SemanticError( untyped, toString( "No reasonable alternatives for ", kindStr, (kindStr != "" ? " " : ""), "expression: ") );
     200                        } else if ( winners.size() != 1 ) {
     201                                std::ostringstream stream;
     202                                stream << "Cannot choose between " << winners.size() << " alternatives for " << kindStr << (kindStr != "" ? " " : "") << "expression\n";
     203                                untyped->print( stream );
     204                                stream << " Alternatives are:\n";
     205                                printAlts( winners, stream, 1 );
     206                                SemanticError( untyped->location, stream.str() );
     207                        }
     208
     209                        // there is one unambiguous interpretation - move the expression into the with statement
     210                        Alternative & choice = winners.front();
     211                        if ( findDeletedExpr( choice.expr ) ) {
     212                                SemanticError( untyped->location, choice.expr, "Unique best alternative includes deleted identifier in " );
     213                        }
     214                        alt = std::move( choice );
     215                }
     216
     217                /// resolve `untyped` to the expression whose alternative satisfies `pred` with the lowest cost; kindStr is used for providing better error messages
     218                void findKindExpression(Expression *& untyped, const SymTab::Indexer & indexer, const std::string & kindStr, std::function<bool(const Alternative &)> pred, bool adjust = false, bool prune = true, bool failFast = true) {
     219                        if ( ! untyped ) return;
     220                        Alternative choice;
     221                        findUnfinishedKindExpression( untyped, choice, indexer, kindStr, pred, adjust, prune, failFast );
     222                        finishExpr( choice.expr, choice.env, untyped->env );
     223                        delete untyped;
     224                        untyped = choice.expr;
     225                        choice.expr = nullptr;
     226                }
     227
     228                bool standardAlternativeFilter( const Alternative & ) {
     229                        // currently don't need to filter, under normal circumstances.
     230                        // in the future, this may be useful for removing deleted expressions
     231                        return true;
     232                }
     233        } // namespace
     234
     235        // used in resolveTypeof
     236        Expression * resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer ) {
     237                TypeEnvironment env;
     238                return resolveInVoidContext( expr, indexer, env );
     239        }
     240
     241        Expression * resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env ) {
     242                // it's a property of the language that a cast expression has either 1 or 0 interpretations; if it has 0
     243                // interpretations, an exception has already been thrown.
     244                assertf( expr, "expected a non-null expression." );
     245
     246                static CastExpr untyped( nullptr ); // cast to void
     247                untyped.location = expr->location;
     248
     249                // set up and resolve expression cast to void
     250                untyped.arg = expr;
     251                Alternative choice;
     252                findUnfinishedKindExpression( &untyped, choice, indexer, "", standardAlternativeFilter, true );
     253                CastExpr * castExpr = strict_dynamic_cast< CastExpr * >( choice.expr );
     254                env = std::move( choice.env );
     255
     256                // clean up resolved expression
     257                Expression * ret = castExpr->arg;
     258                castExpr->arg = nullptr;
     259
     260                // unlink the arg so that it isn't deleted twice at the end of the program
     261                untyped.arg = nullptr;
     262                return ret;
     263        }
     264
    133265        void findVoidExpression( Expression *& untyped, const SymTab::Indexer &indexer ) {
    134                 global_renamer.reset();
     266                resetTyVarRenaming();
    135267                TypeEnvironment env;
    136                 Expression *newExpr = resolveInVoidContext( untyped, indexer, env );
     268                Expression * newExpr = resolveInVoidContext( untyped, indexer, env );
    137269                finishExpr( newExpr, env, untyped->env );
    138270                delete untyped;
     
    141273
    142274        void findSingleExpression( Expression *&untyped, const SymTab::Indexer &indexer ) {
    143                 if ( ! untyped ) return;
    144                 TypeEnvironment env;
    145                 AlternativeFinder finder( indexer, env );
    146                 finder.find( untyped );
    147                 #if 0
    148                 if ( finder.get_alternatives().size() != 1 ) {
    149                         std::cerr << "untyped expr is ";
    150                         untyped->print( std::cerr );
    151                         std::cerr << std::endl << "alternatives are:";
    152                         for ( const Alternative & alt : finder.get_alternatives() ) {
    153                                 alt.print( std::cerr );
    154                         } // for
    155                 } // if
    156                 #endif
    157                 assertf( finder.get_alternatives().size() == 1, "findSingleExpression: must have exactly one alternative at the end." );
    158                 Alternative &choice = finder.get_alternatives().front();
    159                 Expression *newExpr = choice.expr->clone();
    160                 finishExpr( newExpr, choice.env, untyped->env );
    161                 delete untyped;
    162                 untyped = newExpr;
     275                findKindExpression( untyped, indexer, "", standardAlternativeFilter );
    163276        }
    164277
    165278        void findSingleExpression( Expression *& untyped, Type * type, const SymTab::Indexer & indexer ) {
    166279                assert( untyped && type );
     280                // transfer location to generated cast for error purposes
     281                CodeLocation location = untyped->location;
    167282                untyped = new CastExpr( untyped, type );
     283                untyped->location = location;
    168284                findSingleExpression( untyped, indexer );
    169285                removeExtraneousCast( untyped, indexer );
     
    171287
    172288        namespace {
    173                 bool isIntegralType( Type *type ) {
     289                bool isIntegralType( const Alternative & alt ) {
     290                        Type * type = alt.expr->result;
    174291                        if ( dynamic_cast< EnumInstType * >( type ) ) {
    175292                                return true;
     
    184301
    185302                void findIntegralExpression( Expression *& untyped, const SymTab::Indexer &indexer ) {
    186                         TypeEnvironment env;
    187                         AlternativeFinder finder( indexer, env );
    188                         finder.find( untyped );
    189 #if 0
    190                         if ( finder.get_alternatives().size() != 1 ) {
    191                                 std::cout << "untyped expr is ";
    192                                 untyped->print( std::cout );
    193                                 std::cout << std::endl << "alternatives are:";
    194                                 for ( std::list< Alternative >::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) {
    195                                         i->print( std::cout );
    196                                 } // for
    197                         } // if
    198 #endif
    199                         Expression *newExpr = 0;
    200                         const TypeEnvironment *newEnv = 0;
    201                         for ( AltList::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) {
    202                                 if ( i->expr->get_result()->size() == 1 && isIntegralType( i->expr->get_result() ) ) {
    203                                         if ( newExpr ) {
    204                                                 throw SemanticError( "Too many interpretations for case control expression", untyped );
    205                                         } else {
    206                                                 newExpr = i->expr->clone();
    207                                                 newEnv = &i->env;
    208                                         } // if
    209                                 } // if
    210                         } // for
    211                         if ( ! newExpr ) {
    212                                 throw SemanticError( "No interpretations for case control expression", untyped );
    213                         } // if
    214                         finishExpr( newExpr, *newEnv, untyped->env );
    215                         delete untyped;
    216                         untyped = newExpr;
    217                 }
    218 
     303                        findKindExpression( untyped, indexer, "condition", isIntegralType );
     304                }
     305        }
     306
     307
     308        bool isStructOrUnion( const Alternative & alt ) {
     309                Type * t = alt.expr->result->stripReferences();
     310                return dynamic_cast< StructInstType * >( t ) || dynamic_cast< UnionInstType * >( t );
     311        }
     312
     313        void resolveWithExprs( std::list< Declaration * > & translationUnit ) {
     314                PassVisitor<ResolveWithExprs> resolver;
     315                acceptAll( translationUnit, resolver );
     316        }
     317
     318        void ResolveWithExprs::resolveWithExprs( std::list< Expression * > & withExprs, std::list< Statement * > & newStmts ) {
     319                for ( Expression *& expr : withExprs )  {
     320                        // only struct- and union-typed expressions are viable candidates
     321                        findKindExpression( expr, indexer, "with statement", isStructOrUnion );
     322
     323                        // if with expression might be impure, create a temporary so that it is evaluated once
     324                        if ( Tuples::maybeImpure( expr ) ) {
     325                                static UniqueName tmpNamer( "_with_tmp_" );
     326                                ObjectDecl * tmp = ObjectDecl::newObject( tmpNamer.newName(), expr->result->clone(), new SingleInit( expr ) );
     327                                expr = new VariableExpr( tmp );
     328                                newStmts.push_back( new DeclStmt( tmp ) );
     329                                if ( InitTweak::isConstructable( tmp->type ) ) {
     330                                        // generate ctor/dtor and resolve them
     331                                        tmp->init = InitTweak::genCtorInit( tmp );
     332                                        tmp->accept( *visitor );
     333                                }
     334                        }
     335                }
     336        }
     337
     338        void ResolveWithExprs::previsit( WithStmt * withStmt ) {
     339                resolveWithExprs( withStmt->exprs, stmtsToAddBefore );
     340        }
     341
     342        void ResolveWithExprs::previsit( FunctionDecl * functionDecl ) {
     343                {
     344                        // resolve with-exprs with parameters in scope and add any newly generated declarations to the
     345                        // front of the function body.
     346                        auto guard = makeFuncGuard( [this]() { indexer.enterScope(); }, [this](){ indexer.leaveScope(); } );
     347                        indexer.addFunctionType( functionDecl->type );
     348                        std::list< Statement * > newStmts;
     349                        resolveWithExprs( functionDecl->withExprs, newStmts );
     350                        if ( functionDecl->statements ) {
     351                                functionDecl->statements->kids.splice( functionDecl->statements->kids.begin(), newStmts );
     352                        } else {
     353                                assertf( functionDecl->withExprs.empty() && newStmts.empty(), "Function %s without a body has with-clause and/or generated with declarations.", functionDecl->name.c_str() );
     354                        }
     355                }
    219356        }
    220357
    221358        void Resolver::previsit( ObjectDecl *objectDecl ) {
    222                 Type *new_type = resolveTypeof( objectDecl->get_type(), indexer );
    223                 objectDecl->set_type( new_type );
    224359                // To handle initialization of routine pointers, e.g., int (*fp)(int) = foo(), means that class-variable
    225360                // initContext is changed multiple time because the LHS is analysed twice. The second analysis changes
     
    251386        }
    252387
    253         void Resolver::previsit( TypeDecl *typeDecl ) {
    254                 if ( typeDecl->get_base() ) {
    255                         Type *new_type = resolveTypeof( typeDecl->get_base(), indexer );
    256                         typeDecl->set_base( new_type );
    257                 } // if
    258         }
    259 
    260388        void Resolver::previsit( FunctionDecl *functionDecl ) {
    261389#if 0
     
    264392                std::cerr << std::endl;
    265393#endif
    266                 Type *new_type = resolveTypeof( functionDecl->get_type(), indexer );
    267                 functionDecl->set_type( new_type );
    268394                GuardValue( functionReturn );
    269                 functionReturn = ResolvExpr::extractResultType( functionDecl->get_functionType() );
     395                functionReturn = ResolvExpr::extractResultType( functionDecl->type );
    270396        }
    271397
     
    274400                // xxx - it might be necessary to somehow keep the information from this environment, but I can't currently
    275401                // see how it's useful.
    276                 for ( Declaration * d : functionDecl->get_functionType()->get_parameters() ) {
     402                for ( Declaration * d : functionDecl->type->parameters ) {
    277403                        if ( ObjectDecl * obj = dynamic_cast< ObjectDecl * >( d ) ) {
    278                                 if ( SingleInit * init = dynamic_cast< SingleInit * >( obj->get_init() ) ) {
    279                                         delete init->get_value()->get_env();
    280                                         init->get_value()->set_env( nullptr );
     404                                if ( SingleInit * init = dynamic_cast< SingleInit * >( obj->init ) ) {
     405                                        delete init->value->env;
     406                                        init->value->env = nullptr;
    281407                                }
    282408                        }
     
    290416        }
    291417
     418        void Resolver::previsit( StaticAssertDecl * assertDecl ) {
     419                findIntegralExpression( assertDecl->condition, indexer );
     420        }
     421
    292422        void Resolver::previsit( ExprStmt *exprStmt ) {
    293423                visit_children = false;
     
    311441
    312442        void Resolver::previsit( IfStmt *ifStmt ) {
    313                 findSingleExpression( ifStmt->condition, indexer );
     443                findIntegralExpression( ifStmt->condition, indexer );
    314444        }
    315445
    316446        void Resolver::previsit( WhileStmt *whileStmt ) {
    317                 findSingleExpression( whileStmt->condition, indexer );
     447                findIntegralExpression( whileStmt->condition, indexer );
    318448        }
    319449
    320450        void Resolver::previsit( ForStmt *forStmt ) {
    321451                if ( forStmt->condition ) {
    322                         findSingleExpression( forStmt->condition, indexer );
     452                        findIntegralExpression( forStmt->condition, indexer );
    323453                } // if
    324454
     
    336466
    337467        void Resolver::previsit( CaseStmt *caseStmt ) {
    338                 if ( caseStmt->get_condition() ) {
     468                if ( caseStmt->condition ) {
    339469                        std::list< InitAlternative > initAlts = currentObject.getOptions();
    340470                        assertf( initAlts.size() == 1, "SwitchStmt did not correctly resolve an integral expression." );
     
    342472                        Expression * newExpr = new CastExpr( caseStmt->condition, initAlts.front().type->clone() );
    343473                        findSingleExpression( newExpr, indexer );
    344                         CastExpr * castExpr = strict_dynamic_cast< CastExpr * >( newExpr );
    345                         caseStmt->condition = castExpr->arg;
    346                         castExpr->arg = nullptr;
    347                         delete castExpr;
     474                        // case condition cannot have a cast in C, so it must be removed, regardless of whether it performs a conversion.
     475                        // Ideally we would perform the conversion internally here.
     476                        if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( newExpr ) ) {
     477                                newExpr = castExpr->arg;
     478                                castExpr->arg = nullptr;
     479                                std::swap( newExpr->env, castExpr->env );
     480                                delete castExpr;
     481                        }
     482                        caseStmt->condition = newExpr;
    348483                }
    349484        }
     
    411546                                ss << strict_dynamic_cast<NameExpr*>( clause.target.function )->name;
    412547                                ss << "' in call to waitfor";
    413                                 throw SemanticError( ss.str() );
     548                                SemanticError( stmt->location, ss.str() );
     549                        }
     550
     551                        if(clause.target.arguments.empty()) {
     552                                SemanticError( stmt->location, "Waitfor clause must have at least one mutex parameter");
    414553                        }
    415554
     
    428567                        //      try matching the arguments to the parameters
    429568                        //      not the other way around because we have more arguments than parameters
    430                         SemanticError errors;
     569                        SemanticErrorException errors;
    431570                        for ( Alternative & func : funcFinder.get_alternatives() ) {
    432571                                try {
    433572                                        PointerType * pointer = dynamic_cast< PointerType* >( func.expr->get_result()->stripReferences() );
    434573                                        if( !pointer ) {
    435                                                 throw SemanticError( "candidate not viable: not a pointer type\n", func.expr->get_result() );
     574                                                SemanticError( func.expr->get_result(), "candidate not viable: not a pointer type\n" );
    436575                                        }
    437576
    438577                                        FunctionType * function = dynamic_cast< FunctionType* >( pointer->get_base() );
    439578                                        if( !function ) {
    440                                                 throw SemanticError( "candidate not viable: not a function type\n", pointer->get_base() );
     579                                                SemanticError( pointer->get_base(), "candidate not viable: not a function type\n" );
    441580                                        }
    442581
     
    447586
    448587                                                if( !advance_to_mutex( param, param_end ) ) {
    449                                                         throw SemanticError("candidate function not viable: no mutex parameters\n", function);
     588                                                        SemanticError(function, "candidate function not viable: no mutex parameters\n");
    450589                                                }
    451590                                        }
     
    453592                                        Alternative newFunc( func );
    454593                                        // Strip reference from function
    455                                         referenceToRvalueConversion( newFunc.expr );
     594                                        referenceToRvalueConversion( newFunc.expr, newFunc.cost );
    456595
    457596                                        // For all the set of arguments we have try to match it with the parameter of the current function alternative
     
    462601                                                        OpenVarSet openVars;
    463602                                                        AssertionSet resultNeed, resultHave;
    464                                                         TypeEnvironment resultEnv;
     603                                                        TypeEnvironment resultEnv( func.env );
     604                                                        makeUnifiableVars( function, openVars, resultNeed );
     605                                                        // add all type variables as open variables now so that those not used in the parameter
     606                                                        // list are still considered open.
     607                                                        resultEnv.add( function->forall );
    465608
    466609                                                        // Load type variables from arguemnts into one shared space
     
    468611
    469612                                                        // Make sure we don't widen any existing bindings
    470                                                         for ( auto & i : resultEnv ) {
    471                                                                 i.allowWidening = false;
    472                                                         }
     613                                                        resultEnv.forbidWidening();
    473614
    474615                                                        // Find any unbound type variables
     
    477618                                                        auto param     = function->parameters.begin();
    478619                                                        auto param_end = function->parameters.end();
     620
     621                                                        int n_mutex_param = 0;
    479622
    480623                                                        // For every arguments of its set, check if it matches one of the parameter
     
    486629                                                                        // We ran out of parameters but still have arguments
    487630                                                                        // this function doesn't match
    488                                                                         throw SemanticError("candidate function not viable: too many mutex arguments\n", function);
     631                                                                        SemanticError( function, toString("candidate function not viable: too many mutex arguments, expected ", n_mutex_param, "\n" ));
    489632                                                                }
    490633
     634                                                                n_mutex_param++;
     635
    491636                                                                // Check if the argument matches the parameter type in the current scope
    492                                                                 if( ! unify( (*param)->get_type(), arg.expr->get_result(), resultEnv, resultNeed, resultHave, openVars, this->indexer ) ) {
     637                                                                if( ! unify( arg.expr->get_result(), (*param)->get_type(), resultEnv, resultNeed, resultHave, openVars, this->indexer ) ) {
    493638                                                                        // Type doesn't match
    494639                                                                        stringstream ss;
    495640                                                                        ss << "candidate function not viable: no known convertion from '";
     641                                                                        (*param)->get_type()->print( ss );
     642                                                                        ss << "' to '";
    496643                                                                        arg.expr->get_result()->print( ss );
    497                                                                         ss << "' to '";
    498                                                                         (*param)->get_type()->print( ss );
     644                                                                        ss << "' with env '";
     645                                                                        resultEnv.print(ss);
    499646                                                                        ss << "'\n";
    500                                                                         throw SemanticError(ss.str(), function);
     647                                                                        SemanticError( function, ss.str() );
    501648                                                                }
    502649
     
    508655                                                        // Check if parameters are missing
    509656                                                        if( advance_to_mutex( param, param_end ) ) {
     657                                                                do {
     658                                                                        n_mutex_param++;
     659                                                                        param++;
     660                                                                } while( advance_to_mutex( param, param_end ) );
     661
    510662                                                                // We ran out of arguments but still have parameters left
    511663                                                                // this function doesn't match
    512                                                                 throw SemanticError("candidate function not viable: too few mutex arguments\n", function);
     664                                                                SemanticError( function, toString("candidate function not viable: too few mutex arguments, expected ", n_mutex_param, "\n" ));
    513665                                                        }
    514666
     
    526678
    527679                                                }
    528                                                 catch( SemanticError &e ) {
     680                                                catch( SemanticErrorException &e ) {
    529681                                                        errors.append( e );
    530682                                                }
    531683                                        }
    532684                                }
    533                                 catch( SemanticError &e ) {
     685                                catch( SemanticErrorException &e ) {
    534686                                        errors.append( e );
    535687                                }
     
    537689
    538690                        // Make sure we got the right number of arguments
    539                         if( func_candidates.empty() )    { SemanticError top( "No alternatives for function in call to waitfor"  ); top.append( errors ); throw top; }
    540                         if( args_candidates.empty() )    { SemanticError top( "No alternatives for arguments in call to waitfor" ); top.append( errors ); throw top; }
    541                         if( func_candidates.size() > 1 ) { SemanticError top( "Ambiguous function in call to waitfor"            ); top.append( errors ); throw top; }
    542                         if( args_candidates.size() > 1 ) { SemanticError top( "Ambiguous arguments in call to waitfor"           ); top.append( errors ); throw top; }
    543 
     691                        if( func_candidates.empty() )    { SemanticErrorException top( stmt->location, "No alternatives for function in call to waitfor"  ); top.append( errors ); throw top; }
     692                        if( args_candidates.empty() )    { SemanticErrorException top( stmt->location, "No alternatives for arguments in call to waitfor" ); top.append( errors ); throw top; }
     693                        if( func_candidates.size() > 1 ) { SemanticErrorException top( stmt->location, "Ambiguous function in call to waitfor"            ); top.append( errors ); throw top; }
     694                        if( args_candidates.size() > 1 ) { SemanticErrorException top( stmt->location, "Ambiguous arguments in call to waitfor"           ); top.append( errors ); throw top; }
     695                        // TODO: need to use findDeletedExpr to ensure no deleted identifiers are used.
    544696
    545697                        // Swap the results from the alternative with the unresolved values.
     
    574726        }
    575727
    576         bool isStructOrUnion( Type * t ) {
    577                 t = t->stripReferences();
    578                 return dynamic_cast< StructInstType * >( t ) || dynamic_cast< UnionInstType * >( t );
    579         }
    580 
    581         void Resolver::previsit( WithStmt * withStmt ) {
    582                 for ( Expression *& expr : withStmt->exprs )  {
    583                         TypeEnvironment env;
    584                         AlternativeFinder finder( indexer, env );
    585                         finder.findWithAdjustment( expr );
    586 
    587                         // only struct- and union-typed expressions are viable candidates
    588                         AltList candidates;
    589                         for ( Alternative & alt : finder.get_alternatives() ) {
    590                                 if ( isStructOrUnion( alt.expr->result ) ) {
    591                                         candidates.push_back( std::move( alt ) );
    592                                 }
    593                         }
    594 
    595                         // choose the lowest cost expression among the candidates
    596                         AltList winners;
    597                         findMinCost( candidates.begin(), candidates.end(), back_inserter( winners ) );
    598                         if ( winners.size() == 0 ) {
    599                                 throw SemanticError( "No reasonable alternatives for with statement expression: ", expr );
    600                         } else if ( winners.size() != 1 ) {
    601                                 std::ostringstream stream;
    602                                 stream << "Cannot choose between " << winners.size() << " alternatives for with statement expression\n";
    603                                 expr->print( stream );
    604                                 stream << "Alternatives are:\n";
    605                                 printAlts( winners, stream, 1 );
    606                                 throw SemanticError( stream.str() );
    607                         }
    608 
    609                         // there is one unambiguous interpretation - move the expression into the with statement
    610                         Alternative & alt = winners.front();
    611                         finishExpr( alt.expr, alt.env, expr->env );
    612                         delete expr;
    613                         expr = alt.expr;
    614                         alt.expr = nullptr;
    615 
    616                         // if with expression might be impure, create a temporary so that it is evaluated once
    617                         if ( Tuples::maybeImpure( expr ) ) {
    618                                 static UniqueName tmpNamer( "_with_tmp_" );
    619                                 ObjectDecl * tmp = ObjectDecl::newObject( tmpNamer.newName(), expr->result->clone(), new SingleInit( expr ) );
    620                                 expr = new VariableExpr( tmp );
    621                                 stmtsToAddBefore.push_back( new DeclStmt( tmp ) );
    622                                 if ( InitTweak::isConstructable( tmp->type ) ) {
    623                                         // generate ctor/dtor and resolve them
    624                                         tmp->init = InitTweak::genCtorInit( tmp );
    625                                         tmp->accept( *visitor );
    626                                 }
    627                         }
    628                 }
    629         }
    630 
    631728        template< typename T >
    632729        bool isCharType( T t ) {
     
    652749                initExpr->expr = nullptr;
    653750                std::swap( initExpr->env, newExpr->env );
    654                 std::swap( initExpr->inferParams, newExpr->inferParams ) ;
     751                // InitExpr may have inferParams in the case where the expression specializes a function pointer,
     752                // and newExpr may already have inferParams of its own, so a simple swap is not sufficient.
     753                newExpr->spliceInferParams( initExpr );
    655754                delete initExpr;
    656755
     
    740839                PassVisitor<Resolver> resolver( indexer );
    741840                stmtExpr->accept( resolver );
     841                stmtExpr->computeResult();
     842                // xxx - aggregate the environments from all statements? Possibly in AlternativeFinder instead?
    742843        }
    743844
     
    745846                visit_children = false;
    746847                // xxx - fallback init has been removed => remove fallbackInit function and remove complexity from FixInit and remove C-init from ConstructorInit
    747                 maybeAccept( ctorInit->get_ctor(), *visitor );
    748                 maybeAccept( ctorInit->get_dtor(), *visitor );
     848                maybeAccept( ctorInit->ctor, *visitor );
     849                maybeAccept( ctorInit->dtor, *visitor );
    749850
    750851                // found a constructor - can get rid of C-style initializer
    751                 delete ctorInit->get_init();
    752                 ctorInit->set_init( NULL );
     852                delete ctorInit->init;
     853                ctorInit->init = nullptr;
    753854
    754855                // intrinsic single parameter constructors and destructors do nothing. Since this was
    755856                // implicitly generated, there's no way for it to have side effects, so get rid of it
    756857                // to clean up generated code.
    757                 if ( InitTweak::isIntrinsicSingleArgCallStmt( ctorInit->get_ctor() ) ) {
    758                         delete ctorInit->get_ctor();
    759                         ctorInit->set_ctor( NULL );
    760                 }
    761 
    762                 if ( InitTweak::isIntrinsicSingleArgCallStmt( ctorInit->get_dtor() ) ) {
    763                         delete ctorInit->get_dtor();
    764                         ctorInit->set_dtor( NULL );
     858                if ( InitTweak::isIntrinsicSingleArgCallStmt( ctorInit->ctor ) ) {
     859                        delete ctorInit->ctor;
     860                        ctorInit->ctor = nullptr;
     861                }
     862
     863                if ( InitTweak::isIntrinsicSingleArgCallStmt( ctorInit->dtor ) ) {
     864                        delete ctorInit->dtor;
     865                        ctorInit->dtor = nullptr;
    765866                }
    766867
  • src/ResolvExpr/Resolver.h

    rf9feab8 r90152a4  
    3333        void findVoidExpression( Expression *& untyped, const SymTab::Indexer &indexer );
    3434        void findSingleExpression( Expression *& untyped, const SymTab::Indexer &indexer );
     35        void findSingleExpression( Expression *& untyped, Type * type, const SymTab::Indexer &indexer );
    3536        void resolveCtorInit( ConstructorInit * ctorInit, const SymTab::Indexer & indexer );
    3637        void resolveStmtExpr( StmtExpr * stmtExpr, const SymTab::Indexer & indexer );
     38        /// Searches expr and returns the first DeletedExpr found, otherwise nullptr
     39        DeletedExpr * findDeletedExpr( Expression * expr );
     40        /// Resolves with-stmts and with-clauses on functions
     41        void resolveWithExprs( std::list< Declaration * > & translationUnit );
    3742} // namespace ResolvExpr
    3843
  • src/ResolvExpr/TypeEnvironment.cc

    rf9feab8 r90152a4  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 12:19:47 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun May 17 12:23:36 2015
    13 // Update Count     : 3
     11// Last Modified By : Aaron B. Moss
     12// Last Modified On : Mon Jun 18 11:58:00 2018
     13// Update Count     : 4
    1414//
    1515
     
    1717#include <algorithm>                   // for copy, set_intersection
    1818#include <iterator>                    // for ostream_iterator, insert_iterator
    19 #include <utility>                     // for pair
     19#include <memory>                      // for unique_ptr
     20#include <utility>                     // for pair, move
    2021
    2122#include "Common/utility.h"            // for maybeClone
    2223#include "SynTree/Type.h"              // for Type, FunctionType, Type::Fora...
    2324#include "SynTree/TypeSubstitution.h"  // for TypeSubstitution
     25#include "Tuples/Tuples.h"             // for isTtype
    2426#include "TypeEnvironment.h"
     27#include "typeops.h"                   // for occurs
     28#include "Unify.h"                     // for unifyInexact
    2529
    2630namespace ResolvExpr {
     
    4448
    4549        void EqvClass::initialize( const EqvClass &src, EqvClass &dest ) {
     50                initialize( src, dest, src.type );
     51        }
     52
     53        void EqvClass::initialize( const EqvClass &src, EqvClass &dest, const Type *ty ) {
    4654                dest.vars = src.vars;
    47                 dest.type = maybeClone( src.type );
     55                dest.type = maybeClone( ty );
    4856                dest.allowWidening = src.allowWidening;
    4957                dest.data = src.data;
    5058        }
    5159
    52         EqvClass::EqvClass() : type( 0 ), allowWidening( true ) {
     60        EqvClass::EqvClass() : type( nullptr ), allowWidening( true ) {
    5361        }
    5462
    5563        EqvClass::EqvClass( const EqvClass &other ) {
    5664                initialize( other, *this );
     65        }
     66
     67        EqvClass::EqvClass( const EqvClass &other, const Type *ty ) {
     68                initialize( other, *this, ty );
     69        }
     70
     71        EqvClass::EqvClass( EqvClass &&other )
     72        : vars{std::move(other.vars)}, type{other.type},
     73          allowWidening{std::move(other.allowWidening)}, data{std::move(other.data)} {
     74                  other.type = nullptr;
    5775        }
    5876
     
    6482        }
    6583
     84        EqvClass &EqvClass::operator=( EqvClass &&other ) {
     85                if ( this == &other ) return *this;
     86                delete type;
     87
     88                vars = std::move(other.vars);
     89                type = other.type;
     90                other.type = nullptr;
     91                allowWidening = std::move(other.allowWidening);
     92                data = std::move(other.data);
     93
     94                return *this;
     95        }
     96
    6697        EqvClass::~EqvClass() {
    6798                delete type;
     99        }
     100
     101        void EqvClass::set_type( Type* ty ) {
     102                if ( ty == type ) return;
     103                delete type;
     104                type = ty;
    68105        }
    69106
     
    82119        }
    83120
    84         bool TypeEnvironment::lookup( const std::string &var, EqvClass &eqvClass ) const {
     121        const EqvClass* TypeEnvironment::lookup( const std::string &var ) const {
    85122                for ( std::list< EqvClass >::const_iterator i = env.begin(); i != env.end(); ++i ) {
    86                         if ( i->vars.find( var ) != i->vars.end() ) {
    87 ///       std::cout << var << " is in class ";
    88 ///       i->print( std::cout );
    89                                 eqvClass = *i;
    90                                 return true;
    91                         }
    92 ///     std::cout << var << " is not in class ";
    93 ///     i->print( std::cout );
    94                 } // for
    95                 return false;
    96         }
    97 
    98         void TypeEnvironment::add( const EqvClass &eqvClass ) {
    99                 std::list< EqvClass >::iterator i = env.begin();
    100                 while ( i != env.end() ) {
    101                         std::list< EqvClass >::iterator next = i;
    102                         next++;
    103                         std::set< std::string > intersection;
    104                         std::set_intersection( i->vars.begin(), i->vars.end(), eqvClass.vars.begin(), eqvClass.vars.end(), std::inserter( intersection, intersection.begin() ) );
    105                         if ( ! intersection.empty() ) {
    106                                 env.erase( i );
    107                         } // if
     123                        if ( i->vars.find( var ) != i->vars.end() ) return &*i;
     124                } // for
     125                return nullptr;
     126        }
     127
     128        /// Removes any class from env that intersects eqvClass
     129        void filterOverlappingClasses( std::list<EqvClass> &env, const EqvClass &eqvClass ) {
     130                for ( auto i = env.begin(); i != env.end(); ) {
     131                        auto next = i;
     132                        ++next;
     133                        std::set<std::string> intersection;
     134                        std::set_intersection( i->vars.begin(), i->vars.end(), eqvClass.vars.begin(), eqvClass.vars.end(),
     135                                std::inserter( intersection, intersection.begin() ) );
     136                        if ( ! intersection.empty() ) { env.erase( i ); }
    108137                        i = next;
    109                 } // while
    110                 env.insert( env.end(), eqvClass );
     138                }
     139        }
     140
     141        void TypeEnvironment::add( EqvClass &&eqvClass ) {
     142                filterOverlappingClasses( env, eqvClass );
     143                env.push_back( std::move(eqvClass) );
    111144        }
    112145
     
    116149                        newClass.vars.insert( (*i)->get_name() );
    117150                        newClass.data = TypeDecl::Data{ (*i) };
    118                         env.push_back( newClass );
    119                 } // for
     151                        env.push_back( std::move(newClass) );
     152                } // for
     153        }
     154
     155        void TypeEnvironment::add( const TypeSubstitution & sub ) {
     156                EqvClass newClass;
     157                for ( auto p : sub ) {
     158                        newClass.vars.insert( p.first );
     159                        newClass.type = p.second->clone();
     160                        newClass.allowWidening = false;
     161                        // Minimal assumptions. Not technically correct, but might be good enough, and
     162                        // is the best we can do at the moment since information is lost in the
     163                        // transition to TypeSubstitution
     164                        newClass.data = TypeDecl::Data{ TypeDecl::Dtype, false };
     165                        add( std::move(newClass) );
     166                }
    120167        }
    121168
     
    123170                for ( std::list< EqvClass >::const_iterator theClass = env.begin(); theClass != env.end(); ++theClass ) {
    124171                        for ( std::set< std::string >::const_iterator theVar = theClass->vars.begin(); theVar != theClass->vars.end(); ++theVar ) {
    125 ///       std::cerr << "adding " << *theVar;
    126172                                if ( theClass->type ) {
    127 ///         std::cerr << " bound to ";
    128 ///         theClass->type->print( std::cerr );
    129 ///         std::cerr << std::endl;
    130173                                        sub.add( *theVar, theClass->type );
    131174                                } else if ( theVar != theClass->vars.begin() ) {
    132175                                        TypeInstType *newTypeInst = new TypeInstType( Type::Qualifiers(), *theClass->vars.begin(), theClass->data.kind == TypeDecl::Ftype );
    133 ///         std::cerr << " bound to variable " << *theClass->vars.begin() << std::endl;
    134176                                        sub.add( *theVar, newTypeInst );
    135177                                        delete newTypeInst;
     
    137179                        } // for
    138180                } // for
    139 ///   std::cerr << "input env is:" << std::endl;
    140 ///   print( std::cerr, 8 );
    141 ///   std::cerr << "sub is:" << std::endl;
    142 ///   sub.print( std::cerr, 8 );
    143181                sub.normalize();
    144182        }
    145183
    146184        void TypeEnvironment::print( std::ostream &os, Indenter indent ) const {
    147                 for ( std::list< EqvClass >::const_iterator i = env.begin(); i != env.end(); ++i ) {
    148                         i->print( os, indent );
     185                for ( const EqvClass & theClass : env ) {
     186                        theClass.print( os, indent );
    149187                } // for
    150188        }
     
    152190        std::list< EqvClass >::iterator TypeEnvironment::internal_lookup( const std::string &var ) {
    153191                for ( std::list< EqvClass >::iterator i = env.begin(); i != env.end(); ++i ) {
    154                         if ( i->vars.find( var ) == i->vars.end() ) {
    155                                 return i;
    156                         } // if
     192                        if ( i->vars.count( var ) ) return i;
    157193                } // for
    158194                return env.end();
     
    161197        void TypeEnvironment::simpleCombine( const TypeEnvironment &second ) {
    162198                env.insert( env.end(), second.env.begin(), second.env.end() );
    163         }
    164 
    165         void TypeEnvironment::combine( const TypeEnvironment &second, Type *(*combineFunc)( Type*, Type* ) ) {
    166                 TypeEnvironment secondCopy( second );
    167                 for ( std::list< EqvClass >::iterator firstClass = env.begin(); firstClass != env.end(); ++firstClass ) {
    168                         EqvClass &newClass = *firstClass;
    169                         std::set< std::string > newVars;
    170                         for ( std::set< std::string >::const_iterator var = firstClass->vars.begin(); var != firstClass->vars.end(); ++var ) {
    171                                 std::list< EqvClass >::iterator secondClass = secondCopy.internal_lookup( *var );
    172                                 if ( secondClass != secondCopy.env.end() ) {
    173                                         newVars.insert( secondClass->vars.begin(), secondClass->vars.end() );
    174                                         if ( secondClass->type ) {
    175                                                 if ( newClass.type ) {
    176                                                         Type *newType = combineFunc( newClass.type, secondClass->type );
    177                                                         delete newClass.type;
    178                                                         newClass.type = newType;
    179                                                         newClass.allowWidening = newClass.allowWidening && secondClass->allowWidening;
    180                                                 } else {
    181                                                         newClass.type = secondClass->type->clone();
    182                                                         newClass.allowWidening = secondClass->allowWidening;
    183                                                 } // if
    184                                         } // if
    185                                         secondCopy.env.erase( secondClass );
    186                                 } // if
    187                         } // for
    188                         newClass.vars.insert( newVars.begin(), newVars.end() );
    189                 } // for
    190                 for ( std::list< EqvClass >::iterator secondClass = secondCopy.env.begin(); secondClass != secondCopy.env.end(); ++secondClass ) {
    191                         env.push_back( *secondClass );
    192                 } // for
    193199        }
    194200
     
    212218        }
    213219
     220        bool isFtype( Type *type ) {
     221                if ( dynamic_cast< FunctionType* >( type ) ) {
     222                        return true;
     223                } else if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( type ) ) {
     224                        return typeInst->get_isFtype();
     225                } // if
     226                return false;
     227        }
     228
     229        bool tyVarCompatible( const TypeDecl::Data & data, Type *type ) {
     230                switch ( data.kind ) {
     231                  case TypeDecl::Dtype:
     232                        // to bind to an object type variable, the type must not be a function type.
     233                        // if the type variable is specified to be a complete type then the incoming
     234                        // type must also be complete
     235                        // xxx - should this also check that type is not a tuple type and that it's not a ttype?
     236                        return ! isFtype( type ) && (! data.isComplete || type->isComplete() );
     237                  case TypeDecl::Ftype:
     238                        return isFtype( type );
     239                  case TypeDecl::Ttype:
     240                        // ttype unifies with any tuple type
     241                        return dynamic_cast< TupleType * >( type ) || Tuples::isTtype( type );
     242                  default:
     243                        assertf(false, "Unhandled tyvar kind: %d", data.kind);
     244                } // switch
     245                return false;
     246        }
     247
     248        bool TypeEnvironment::bindVar( TypeInstType *typeInst, Type *bindTo, const TypeDecl::Data & data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ) {
     249
     250                // remove references from other, so that type variables can only bind to value types
     251                bindTo = bindTo->stripReferences();
     252                OpenVarSet::const_iterator tyvar = openVars.find( typeInst->get_name() );
     253                assert( tyvar != openVars.end() );
     254                if ( ! tyVarCompatible( tyvar->second, bindTo ) ) {
     255                        return false;
     256                } // if
     257                if ( occurs( bindTo, typeInst->get_name(), *this ) ) {
     258                        return false;
     259                } // if
     260                auto curClass = internal_lookup( typeInst->get_name() );
     261                if ( curClass != env.end() ) {
     262                        if ( curClass->type ) {
     263                                Type *common = 0;
     264                                // attempt to unify equivalence class type (which has qualifiers stripped, so they must be restored) with the type to bind to
     265                                std::unique_ptr< Type > newType( curClass->type->clone() );
     266                                newType->get_qualifiers() = typeInst->get_qualifiers();
     267                                if ( unifyInexact( newType.get(), bindTo, *this, need, have, openVars, widenMode & WidenMode( curClass->allowWidening, true ), indexer, common ) ) {
     268                                        if ( common ) {
     269                                                common->get_qualifiers() = Type::Qualifiers{};
     270                                                curClass->set_type( common );
     271                                        } // if
     272                                } else return false;
     273                        } else {
     274                                Type* newType = bindTo->clone();
     275                                newType->get_qualifiers() = Type::Qualifiers{};
     276                                curClass->set_type( newType );
     277                                curClass->allowWidening = widenMode.widenFirst && widenMode.widenSecond;
     278                        } // if
     279                } else {
     280                        EqvClass newClass;
     281                        newClass.vars.insert( typeInst->get_name() );
     282                        newClass.type = bindTo->clone();
     283                        newClass.type->get_qualifiers() = Type::Qualifiers();
     284                        newClass.allowWidening = widenMode.widenFirst && widenMode.widenSecond;
     285                        newClass.data = data;
     286                        env.push_back( std::move(newClass) );
     287                } // if
     288                return true;
     289        }
     290
     291        bool TypeEnvironment::bindVarToVar( TypeInstType *var1, TypeInstType *var2, const TypeDecl::Data & data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ) {
     292
     293                auto class1 = internal_lookup( var1->get_name() );
     294                auto class2 = internal_lookup( var2->get_name() );
     295
     296                // exit early if variables already bound together
     297                if ( class1 != env.end() && class1 == class2 ) {
     298                        class1->allowWidening &= widenMode;
     299                        return true;
     300                }
     301
     302                bool widen1 = false, widen2 = false;
     303                const Type *type1 = nullptr, *type2 = nullptr;
     304
     305                // check for existing bindings, perform occurs check
     306                if ( class1 != env.end() ) {
     307                        if ( class1->type ) {
     308                                if ( occurs( class1->type, var2->get_name(), *this ) ) return false;
     309                                type1 = class1->type;
     310                        } // if
     311                        widen1 = widenMode.widenFirst && class1->allowWidening;
     312                } // if
     313                if ( class2 != env.end() ) {
     314                        if ( class2->type ) {
     315                                if ( occurs( class2->type, var1->get_name(), *this ) ) return false;
     316                                type2 = class2->type;
     317                        } // if
     318                        widen2 = widenMode.widenSecond && class2->allowWidening;
     319                } // if
     320
     321                if ( type1 && type2 ) {
     322                        // both classes bound, merge if bound types can be unified
     323                        std::unique_ptr<Type> newType1{ type1->clone() }, newType2{ type2->clone() };
     324                        WidenMode newWidenMode{ widen1, widen2 };
     325                        Type *common = 0;
     326                        if ( unifyInexact( newType1.get(), newType2.get(), *this, need, have, openVars, newWidenMode, indexer, common ) ) {
     327                                class1->vars.insert( class2->vars.begin(), class2->vars.end() );
     328                                class1->allowWidening = widen1 && widen2;
     329                                if ( common ) {
     330                                        common->get_qualifiers() = Type::Qualifiers{};
     331                                        class1->set_type( common );
     332                                }
     333                                env.erase( class2 );
     334                        } else return false;
     335                } else if ( class1 != env.end() && class2 != env.end() ) {
     336                        // both classes exist, at least one unbound, merge unconditionally
     337                        if ( type1 ) {
     338                                class1->vars.insert( class2->vars.begin(), class2->vars.end() );
     339                                class1->allowWidening = widen1;
     340                                env.erase( class2 );
     341                        } else {
     342                                class2->vars.insert( class1->vars.begin(), class1->vars.end() );
     343                                class2->allowWidening = widen2;
     344                                env.erase( class1 );
     345                        } // if
     346                } else if ( class1 != env.end() ) {
     347                        // var2 unbound, add to class1
     348                        class1->vars.insert( var2->get_name() );
     349                        class1->allowWidening = widen1;
     350                } else if ( class2 != env.end() ) {
     351                        // var1 unbound, add to class2
     352                        class2->vars.insert( var1->get_name() );
     353                        class2->allowWidening = widen2;
     354                } else {
     355                        // neither var bound, create new class
     356                        EqvClass newClass;
     357                        newClass.vars.insert( var1->get_name() );
     358                        newClass.vars.insert( var2->get_name() );
     359                        newClass.allowWidening = widen1 && widen2;
     360                        newClass.data = data;
     361                        env.push_back( std::move(newClass) );
     362                } // if
     363                return true;
     364        }
     365
     366        void TypeEnvironment::forbidWidening() {
     367                for ( EqvClass& c : env ) c.allowWidening = false;
     368        }
     369
    214370        std::ostream & operator<<( std::ostream & out, const TypeEnvironment & env ) {
    215371                env.print( out );
  • src/ResolvExpr/TypeEnvironment.h

    rf9feab8 r90152a4  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 12:24:58 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:35:45 2017
    13 // Update Count     : 3
     11// Last Modified By : Aaron B. Moss
     12// Last Modified On : Mon Jun 18 11:58:00 2018
     13// Update Count     : 4
    1414//
    1515
     
    2121#include <set>                         // for set
    2222#include <string>                      // for string
     23#include <utility>                     // for move, swap
     24
     25#include "WidenMode.h"                 // for WidenMode
    2326
    2427#include "SynTree/Declaration.h"       // for TypeDecl::Data, DeclarationWit...
     
    3740        //
    3841        // I've seen a TU go from 54 minutes to 1 minute 34 seconds with the addition of this comparator.
     42        //
     43        // Note: since this compares pointers for position, minor changes in the source file that affect
     44        // memory layout can alter compilation time in unpredictable ways. For example, the placement
     45        // of a line directive can reorder type pointers with respect to each other so that assertions
     46        // are seen in different orders, causing a potentially different number of unification calls when
     47        // resolving assertions. I've seen a TU go from 36 seconds to 27 seconds by reordering line directives
     48        // alone, so it would be nice to fix this comparison so that assertions compare more consistently.
     49        // I've tried to modify this to compare on mangle name instead of type as the second comparator, but
     50        // this causes some assertions to never be recorded. More investigation is needed.
    3951        struct AssertCompare {
    4052                bool operator()( DeclarationWithType * d1, DeclarationWithType * d2 ) const {
     
    6476
    6577                void initialize( const EqvClass &src, EqvClass &dest );
     78                void initialize( const EqvClass &src, EqvClass &dest, const Type *ty );
    6679                EqvClass();
    6780                EqvClass( const EqvClass &other );
     81                EqvClass( const EqvClass &other, const Type *ty );
     82                EqvClass( EqvClass &&other );
    6883                EqvClass &operator=( const EqvClass &other );
     84                EqvClass &operator=( EqvClass &&other );
    6985                ~EqvClass();
    7086                void print( std::ostream &os, Indenter indent = {} ) const;
     87
     88                /// Takes ownership of `ty`, freeing old `type`
     89                void set_type(Type* ty);
    7190        };
    7291
    7392        class TypeEnvironment {
    7493          public:
    75                 bool lookup( const std::string &var, EqvClass &eqvClass ) const;
    76                 void add( const EqvClass &eqvClass );
     94                const EqvClass* lookup( const std::string &var ) const;
     95          private:
     96                void add( EqvClass &&eqvClass  );
     97          public:
    7798                void add( const Type::ForallList &tyDecls );
     99                void add( const TypeSubstitution & sub );
    78100                template< typename SynTreeClass > int apply( SynTreeClass *&type ) const;
    79101                template< typename SynTreeClass > int applyFree( SynTreeClass *&type ) const;
     
    81103                bool isEmpty() const { return env.empty(); }
    82104                void print( std::ostream &os, Indenter indent = {} ) const;
    83                 void combine( const TypeEnvironment &second, Type *(*combineFunc)( Type*, Type* ) );
     105                // void combine( const TypeEnvironment &second, Type *(*combineFunc)( Type*, Type* ) );
    84106                void simpleCombine( const TypeEnvironment &second );
    85107                void extractOpenVars( OpenVarSet &openVars ) const;
     
    90112                void addActual( const TypeEnvironment& actualEnv, OpenVarSet& openVars );
    91113
    92                 typedef std::list< EqvClass >::iterator iterator;
    93                 iterator begin() { return env.begin(); }
    94                 iterator end() { return env.end(); }
    95                 typedef std::list< EqvClass >::const_iterator const_iterator;
    96                 const_iterator begin() const { return env.begin(); }
    97                 const_iterator end() const { return env.end(); }
     114                /// Binds the type class represented by `typeInst` to the type `bindTo`; will add
     115                /// the class if needed. Returns false on failure.
     116                bool bindVar( TypeInstType *typeInst, Type *bindTo, const TypeDecl::Data & data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer );
     117               
     118                /// Binds the type classes represented by `var1` and `var2` together; will add
     119                /// one or both classes if needed. Returns false on failure.
     120                bool bindVarToVar( TypeInstType *var1, TypeInstType *var2, const TypeDecl::Data & data, AssertionSet &need, AssertionSet &have, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer );
     121
     122                /// Disallows widening for all bindings in the environment
     123                void forbidWidening();
     124
     125                using iterator = std::list< EqvClass >::const_iterator;
     126                iterator begin() const { return env.begin(); }
     127                iterator end() const { return env.end(); }
     128
    98129          private:
    99130                std::list< EqvClass > env;
     131               
    100132                std::list< EqvClass >::iterator internal_lookup( const std::string &var );
    101133        };
  • src/ResolvExpr/Unify.cc

    rf9feab8 r90152a4  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 12:27:10 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 16:22:54 2017
    13 // Update Count     : 42
     11// Last Modified By : Aaron B. Moss
     12// Last Modified On : Mon Jun 18 11:58:00 2018
     13// Update Count     : 43
    1414//
    1515
     
    2020#include <set>                    // for set
    2121#include <string>                 // for string, operator==, operator!=, bas...
    22 #include <utility>                // for pair
     22#include <utility>                // for pair, move
    2323
    2424#include "Common/PassVisitor.h"   // for PassVisitor
     
    4444namespace ResolvExpr {
    4545
    46         class Unify : public Visitor {
    47           public:
     46        struct Unify : public WithShortCircuiting {
    4847                Unify( Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer );
    4948
    5049                bool get_result() const { return result; }
     50
     51                void previsit( BaseSyntaxNode * ) { visit_children = false; }
     52
     53                void postvisit( VoidType * voidType );
     54                void postvisit( BasicType * basicType );
     55                void postvisit( PointerType * pointerType );
     56                void postvisit( ArrayType * arrayType );
     57                void postvisit( ReferenceType * refType );
     58                void postvisit( FunctionType * functionType );
     59                void postvisit( StructInstType * aggregateUseType );
     60                void postvisit( UnionInstType * aggregateUseType );
     61                void postvisit( EnumInstType * aggregateUseType );
     62                void postvisit( TraitInstType * aggregateUseType );
     63                void postvisit( TypeInstType * aggregateUseType );
     64                void postvisit( TupleType * tupleType );
     65                void postvisit( VarArgsType * varArgsType );
     66                void postvisit( ZeroType * zeroType );
     67                void postvisit( OneType * oneType );
     68
    5169          private:
    52                 virtual void visit(VoidType *voidType);
    53                 virtual void visit(BasicType *basicType);
    54                 virtual void visit(PointerType *pointerType);
    55                 virtual void visit(ArrayType *arrayType);
    56                 virtual void visit(ReferenceType *refType);
    57                 virtual void visit(FunctionType *functionType);
    58                 virtual void visit(StructInstType *aggregateUseType);
    59                 virtual void visit(UnionInstType *aggregateUseType);
    60                 virtual void visit(EnumInstType *aggregateUseType);
    61                 virtual void visit(TraitInstType *aggregateUseType);
    62                 virtual void visit(TypeInstType *aggregateUseType);
    63                 virtual void visit(TupleType *tupleType);
    64                 virtual void visit(VarArgsType *varArgsType);
    65                 virtual void visit(ZeroType *zeroType);
    66                 virtual void visit(OneType *oneType);
    67 
    6870                template< typename RefType > void handleRefType( RefType *inst, Type *other );
    6971                template< typename RefType > void handleGenericRefType( RefType *inst, Type *other );
     
    127129        }
    128130
    129         bool isFtype( Type *type ) {
    130                 if ( dynamic_cast< FunctionType* >( type ) ) {
    131                         return true;
    132                 } else if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( type ) ) {
    133                         return typeInst->get_isFtype();
    134                 } // if
    135                 return false;
    136         }
    137 
    138         bool tyVarCompatible( const TypeDecl::Data & data, Type *type ) {
    139                 switch ( data.kind ) {
    140                   case TypeDecl::Dtype:
    141                         // to bind to an object type variable, the type must not be a function type.
    142                         // if the type variable is specified to be a complete type then the incoming
    143                         // type must also be complete
    144                         // xxx - should this also check that type is not a tuple type and that it's not a ttype?
    145                         return ! isFtype( type ) && (! data.isComplete || type->isComplete() );
    146                   case TypeDecl::Ftype:
    147                         return isFtype( type );
    148                   case TypeDecl::Ttype:
    149                         // ttype unifies with any tuple type
    150                         return dynamic_cast< TupleType * >( type ) || Tuples::isTtype( type );
    151                 } // switch
    152                 return false;
    153         }
    154 
    155         bool bindVar( TypeInstType *typeInst, Type *other, const TypeDecl::Data & data, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ) {
    156                 // remove references from other, so that type variables can only bind to value types
    157                 other = other->stripReferences();
    158                 OpenVarSet::const_iterator tyvar = openVars.find( typeInst->get_name() );
    159                 assert( tyvar != openVars.end() );
    160                 if ( ! tyVarCompatible( tyvar->second, other ) ) {
    161                         return false;
    162                 } // if
    163                 if ( occurs( other, typeInst->get_name(), env ) ) {
    164                         return false;
    165                 } // if
    166                 EqvClass curClass;
    167                 if ( env.lookup( typeInst->get_name(), curClass ) ) {
    168                         if ( curClass.type ) {
    169                                 Type *common = 0;
    170                                 // attempt to unify equivalence class type (which has qualifiers stripped, so they must be restored) with the type to bind to
    171                                 std::unique_ptr< Type > newType( curClass.type->clone() );
    172                                 newType->get_qualifiers() = typeInst->get_qualifiers();
    173                                 if ( unifyInexact( newType.get(), other, env, needAssertions, haveAssertions, openVars, widenMode & WidenMode( curClass.allowWidening, true ), indexer, common ) ) {
    174                                         if ( common ) {
    175                                                 common->get_qualifiers() = Type::Qualifiers();
    176                                                 delete curClass.type;
    177                                                 curClass.type = common;
    178                                                 env.add( curClass );
    179                                         } // if
    180                                         return true;
    181                                 } else {
    182                                         return false;
    183                                 } // if
    184                         } else {
    185                                 curClass.type = other->clone();
    186                                 curClass.type->get_qualifiers() = Type::Qualifiers();
    187                                 curClass.allowWidening = widenMode.widenFirst && widenMode.widenSecond;
    188                                 env.add( curClass );
    189                         } // if
    190                 } else {
    191                         EqvClass newClass;
    192                         newClass.vars.insert( typeInst->get_name() );
    193                         newClass.type = other->clone();
    194                         newClass.type->get_qualifiers() = Type::Qualifiers();
    195                         newClass.allowWidening = widenMode.widenFirst && widenMode.widenSecond;
    196                         newClass.data = data;
    197                         env.add( newClass );
    198                 } // if
    199                 return true;
    200         }
    201 
    202         bool bindVarToVar( TypeInstType *var1, TypeInstType *var2, const TypeDecl::Data & data, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer ) {
    203                 bool result = true;
    204                 EqvClass class1, class2;
    205                 bool hasClass1 = false, hasClass2 = false;
    206                 bool widen1 = false, widen2 = false;
    207                 Type *type1 = 0, *type2 = 0;
    208 
    209                 if ( env.lookup( var1->get_name(), class1 ) ) {
    210                         hasClass1 = true;
    211                         if ( class1.type ) {
    212                                 if ( occurs( class1.type, var2->get_name(), env ) ) {
    213                                         return false;
    214                                 } // if
    215                                 type1 = class1.type->clone();
    216                         } // if
    217                         widen1 = widenMode.widenFirst && class1.allowWidening;
    218                 } // if
    219                 if ( env.lookup( var2->get_name(), class2 ) ) {
    220                         hasClass2 = true;
    221                         if ( class2.type ) {
    222                                 if ( occurs( class2.type, var1->get_name(), env ) ) {
    223                                         return false;
    224                                 } // if
    225                                 type2 = class2.type->clone();
    226                         } // if
    227                         widen2 = widenMode.widenSecond && class2.allowWidening;
    228                 } // if
    229 
    230                 if ( type1 && type2 ) {
    231 //    std::cerr << "has type1 && type2" << std::endl;
    232                         WidenMode newWidenMode ( widen1, widen2 );
    233                         Type *common = 0;
    234                         if ( unifyInexact( type1, type2, env, needAssertions, haveAssertions, openVars, newWidenMode, indexer, common ) ) {
    235                                 class1.vars.insert( class2.vars.begin(), class2.vars.end() );
    236                                 class1.allowWidening = widen1 && widen2;
    237                                 if ( common ) {
    238                                         common->get_qualifiers() = Type::Qualifiers();
    239                                         delete class1.type;
    240                                         class1.type = common;
    241                                 } // if
    242                                 env.add( class1 );
    243                         } else {
    244                                 result = false;
    245                         } // if
    246                 } else if ( hasClass1 && hasClass2 ) {
    247                         if ( type1 ) {
    248                                 class1.vars.insert( class2.vars.begin(), class2.vars.end() );
    249                                 class1.allowWidening = widen1;
    250                                 env.add( class1 );
    251                         } else {
    252                                 class2.vars.insert( class1.vars.begin(), class1.vars.end() );
    253                                 class2.allowWidening = widen2;
    254                                 env.add( class2 );
    255                         } // if
    256                 } else if ( hasClass1 ) {
    257                         class1.vars.insert( var2->get_name() );
    258                         class1.allowWidening = widen1;
    259                         env.add( class1 );
    260                 } else if ( hasClass2 ) {
    261                         class2.vars.insert( var1->get_name() );
    262                         class2.allowWidening = widen2;
    263                         env.add( class2 );
    264                 } else {
    265                         EqvClass newClass;
    266                         newClass.vars.insert( var1->get_name() );
    267                         newClass.vars.insert( var2->get_name() );
    268                         newClass.allowWidening = widen1 && widen2;
    269                         newClass.data = data;
    270                         env.add( newClass );
    271                 } // if
    272                 delete type1;
    273                 delete type2;
    274                 return result;
    275         }
    276 
    277131        bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer ) {
    278132                OpenVarSet closedVars;
     
    319173
    320174                if ( isopen1 && isopen2 && entry1->second == entry2->second ) {
    321                         result = bindVarToVar( var1, var2, entry1->second, env, needAssertions, haveAssertions, openVars, widenMode, indexer );
     175                        result = env.bindVarToVar( var1, var2, entry1->second, needAssertions, haveAssertions, openVars, widenMode, indexer );
    322176                } else if ( isopen1 ) {
    323                         result = bindVar( var1, type2, entry1->second, env, needAssertions, haveAssertions, openVars, widenMode, indexer );
    324                 } else if ( isopen2 ) {
    325                         result = bindVar( var2, type1, entry2->second, env, needAssertions, haveAssertions, openVars, widenMode, indexer );
     177                        result = env.bindVar( var1, type2, entry1->second, needAssertions, haveAssertions, openVars, widenMode, indexer );
     178                } else if ( isopen2 ) { // TODO: swap widenMode values in call, since type positions are flipped?
     179                        result = env.bindVar( var2, type1, entry2->second, needAssertions, haveAssertions, openVars, widenMode, indexer );
    326180                } else {
    327                         Unify comparator( type2, env, needAssertions, haveAssertions, openVars, widenMode, indexer );
     181                        PassVisitor<Unify> comparator( type2, env, needAssertions, haveAssertions, openVars, widenMode, indexer );
    328182                        type1->accept( comparator );
    329                         result = comparator.get_result();
     183                        result = comparator.pass.get_result();
    330184                } // if
    331185#ifdef DEBUG
     
    404258        }
    405259
    406         void Unify::visit( __attribute__((unused)) VoidType *voidType) {
     260        void Unify::postvisit( __attribute__((unused)) VoidType *voidType) {
    407261                result = dynamic_cast< VoidType* >( type2 );
    408262        }
    409263
    410         void Unify::visit(BasicType *basicType) {
     264        void Unify::postvisit(BasicType *basicType) {
    411265                if ( BasicType *otherBasic = dynamic_cast< BasicType* >( type2 ) ) {
    412266                        result = basicType->get_kind() == otherBasic->get_kind();
     
    436290        }
    437291
    438         void Unify::visit(PointerType *pointerType) {
     292        void Unify::postvisit(PointerType *pointerType) {
    439293                if ( PointerType *otherPointer = dynamic_cast< PointerType* >( type2 ) ) {
    440294                        result = unifyExact( pointerType->get_base(), otherPointer->get_base(), env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
     
    444298        }
    445299
    446         void Unify::visit(ReferenceType *refType) {
     300        void Unify::postvisit(ReferenceType *refType) {
    447301                if ( ReferenceType *otherRef = dynamic_cast< ReferenceType* >( type2 ) ) {
    448302                        result = unifyExact( refType->get_base(), otherRef->get_base(), env, needAssertions, haveAssertions, openVars, WidenMode( false, false ), indexer );
     
    452306        }
    453307
    454         void Unify::visit(ArrayType *arrayType) {
     308        void Unify::postvisit(ArrayType *arrayType) {
    455309                ArrayType *otherArray = dynamic_cast< ArrayType* >( type2 );
    456310                // to unify, array types must both be VLA or both not VLA
     
    537391                void premutate( TypeInstType * ) { visit_children = false; }
    538392                Type * postmutate( TypeInstType * typeInst ) {
    539                         EqvClass eqvClass;
    540                         if ( tenv.lookup( typeInst->get_name(), eqvClass ) ) {
    541                                 if ( eqvClass.data.kind == TypeDecl::Ttype ) {
    542                                         // expand ttype parameter into its actual type
    543                                         if ( eqvClass.type ) {
    544                                                 delete typeInst;
    545                                                 return eqvClass.type->clone();
    546                                         }
     393                        if ( const EqvClass *eqvClass = tenv.lookup( typeInst->get_name() ) ) {
     394                                // expand ttype parameter into its actual type
     395                                if ( eqvClass->data.kind == TypeDecl::Ttype && eqvClass->type ) {
     396                                        delete typeInst;
     397                                        return eqvClass->type->clone();
    547398                                }
    548399                        }
     
    561412                        flatten( dcl->get_type(), back_inserter( types ) );
    562413                        for ( Type * t : types ) {
     414                                // outermost const, volatile, _Atomic qualifiers in parameters should not play a role in the unification of function types, since they do not determine whether a function is callable.
     415                                // Note: MUST consider at least mutex qualifier, since functions can be overloaded on outermost mutex and a mutex function has different requirements than a non-mutex function.
     416                                t->get_qualifiers() -= Type::Qualifiers(Type::Const | Type::Volatile | Type::Atomic);
     417
    563418                                dst.push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::C, nullptr, t, nullptr ) );
    564419                        }
     
    567422        }
    568423
    569         void Unify::visit(FunctionType *functionType) {
     424        void Unify::postvisit(FunctionType *functionType) {
    570425                FunctionType *otherFunction = dynamic_cast< FunctionType* >( type2 );
    571426                if ( otherFunction && functionType->get_isVarArgs() == otherFunction->get_isVarArgs() ) {
     
    578433
    579434                        // sizes don't have to match if ttypes are involved; need to be more precise wrt where the ttype is to prevent errors
    580                         if ( (flatFunc->get_parameters().size() == flatOther->get_parameters().size() && flatFunc->get_returnVals().size() == flatOther->get_returnVals().size()) || flatFunc->isTtype() || flatOther->isTtype() ) {
    581                                 if ( unifyDeclList( flatFunc->get_parameters().begin(), flatFunc->get_parameters().end(), flatOther->get_parameters().begin(), flatOther->get_parameters().end(), env, needAssertions, haveAssertions, openVars, indexer ) ) {
    582                                         if ( unifyDeclList( flatFunc->get_returnVals().begin(), flatFunc->get_returnVals().end(), flatOther->get_returnVals().begin(), flatOther->get_returnVals().end(), env, needAssertions, haveAssertions, openVars, indexer ) ) {
     435                        if ( (flatFunc->parameters.size() == flatOther->parameters.size() && flatFunc->returnVals.size() == flatOther->returnVals.size()) || flatFunc->isTtype() || flatOther->isTtype() ) {
     436                                if ( unifyDeclList( flatFunc->parameters.begin(), flatFunc->parameters.end(), flatOther->parameters.begin(), flatOther->parameters.end(), env, needAssertions, haveAssertions, openVars, indexer ) ) {
     437                                        if ( unifyDeclList( flatFunc->returnVals.begin(), flatFunc->returnVals.end(), flatOther->returnVals.begin(), flatOther->returnVals.end(), env, needAssertions, haveAssertions, openVars, indexer ) ) {
    583438
    584439                                                // the original types must be used in mark assertions, since pointer comparisons are used
     
    597452                // check that other type is compatible and named the same
    598453                RefType *otherStruct = dynamic_cast< RefType* >( other );
    599                 result = otherStruct && inst->get_name() == otherStruct->get_name();
     454                result = otherStruct && inst->name == otherStruct->name;
    600455        }
    601456
     
    606461                if ( ! result ) return;
    607462                // Check that parameters of types unify, if any
    608                 std::list< Expression* > params = inst->get_parameters();
    609                 std::list< Expression* > otherParams = ((RefType*)other)->get_parameters();
     463                std::list< Expression* > params = inst->parameters;
     464                std::list< Expression* > otherParams = ((RefType*)other)->parameters;
    610465
    611466                std::list< Expression* >::const_iterator it = params.begin(), jt = otherParams.begin();
     
    669524        }
    670525
    671         void Unify::visit(StructInstType *structInst) {
     526        void Unify::postvisit(StructInstType *structInst) {
    672527                handleGenericRefType( structInst, type2 );
    673528        }
    674529
    675         void Unify::visit(UnionInstType *unionInst) {
     530        void Unify::postvisit(UnionInstType *unionInst) {
    676531                handleGenericRefType( unionInst, type2 );
    677532        }
    678533
    679         void Unify::visit(EnumInstType *enumInst) {
     534        void Unify::postvisit(EnumInstType *enumInst) {
    680535                handleRefType( enumInst, type2 );
    681536        }
    682537
    683         void Unify::visit(TraitInstType *contextInst) {
     538        void Unify::postvisit(TraitInstType *contextInst) {
    684539                handleRefType( contextInst, type2 );
    685540        }
    686541
    687         void Unify::visit(TypeInstType *typeInst) {
     542        void Unify::postvisit(TypeInstType *typeInst) {
    688543                assert( openVars.find( typeInst->get_name() ) == openVars.end() );
    689544                TypeInstType *otherInst = dynamic_cast< TypeInstType* >( type2 );
     
    740595        }
    741596
    742         void Unify::visit(TupleType *tupleType) {
     597        void Unify::postvisit(TupleType *tupleType) {
    743598                if ( TupleType *otherTuple = dynamic_cast< TupleType* >( type2 ) ) {
    744599                        std::unique_ptr<TupleType> flat1( tupleType->clone() );
     
    757612        }
    758613
    759         void Unify::visit( __attribute__((unused)) VarArgsType *varArgsType ) {
     614        void Unify::postvisit( __attribute__((unused)) VarArgsType *varArgsType ) {
    760615                result = dynamic_cast< VarArgsType* >( type2 );
    761616        }
    762617
    763         void Unify::visit( __attribute__((unused)) ZeroType *zeroType ) {
     618        void Unify::postvisit( __attribute__((unused)) ZeroType *zeroType ) {
    764619                result = dynamic_cast< ZeroType* >( type2 );
    765620        }
    766621
    767         void Unify::visit( __attribute__((unused)) OneType *oneType ) {
     622        void Unify::postvisit( __attribute__((unused)) OneType *oneType ) {
    768623                result = dynamic_cast< OneType* >( type2 );
    769624        }
  • src/ResolvExpr/Unify.h

    rf9feab8 r90152a4  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 13:09:04 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 21 23:09:34 2017
    13 // Update Count     : 3
     11// Last Modified By : Aaron B. Moss
     12// Last Modified On : Mon Jun 18 11:58:00 2018
     13// Update Count     : 4
    1414//
    1515
     
    2121#include "SynTree/Declaration.h"  // for TypeDecl, TypeDecl::Data
    2222#include "TypeEnvironment.h"      // for AssertionSet, OpenVarSet
     23#include "WidenMode.h"            // for WidenMode
    2324
    2425class Type;
     
    2930
    3031namespace ResolvExpr {
    31         struct WidenMode {
    32                 WidenMode( bool widenFirst, bool widenSecond ): widenFirst( widenFirst ), widenSecond( widenSecond ) {}
    33                 WidenMode &operator|=( const WidenMode &other ) { widenFirst |= other.widenFirst; widenSecond |= other.widenSecond; return *this; }
    34                 WidenMode &operator&=( const WidenMode &other ) { widenFirst &= other.widenFirst; widenSecond &= other.widenSecond; return *this; }
    35                 WidenMode operator|( const WidenMode &other ) { WidenMode newWM( *this ); newWM |= other; return newWM; }
    36                 WidenMode operator&( const WidenMode &other ) { WidenMode newWM( *this ); newWM &= other; return newWM; }
    37                 operator bool() { return widenFirst && widenSecond; }
    38 
    39                 bool widenFirst : 1, widenSecond : 1;
    40         };
    41 
    42         bool bindVar( TypeInstType *typeInst, Type *other, const TypeDecl::Data & data, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer );
    4332        bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer );
    4433        bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer, Type *&commonType );
    4534        bool unifyExact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer );
     35        bool unifyInexact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer, Type *&common );
    4636
    4737        template< typename Iterator1, typename Iterator2 >
  • src/ResolvExpr/typeops.h

    rf9feab8 r90152a4  
    5656        void adjustExprType( Type *&type, const TypeEnvironment &env, const SymTab::Indexer &indexer );
    5757
     58        /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function using empty TypeEnvironment and Indexer
     59        void adjustExprType( Type *& type );
     60
    5861        template< typename ForwardIterator >
    5962        void adjustExprTypeList( ForwardIterator begin, ForwardIterator end, const TypeEnvironment &env, const SymTab::Indexer &indexer ) {
     
    103106
    104107        // in AlternativeFinder.cc
    105         void referenceToRvalueConversion( Expression *& expr );
     108        void referenceToRvalueConversion( Expression *& expr, Cost & cost );
    106109
    107110        // flatten tuple type into list of types
  • src/SymTab/Autogen.cc

    rf9feab8 r90152a4  
    99// Author           : Rob Schluntz
    1010// Created On       : Thu Mar 03 15:45:56 2016
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jul 14 16:41:00 2017
    13 // Update Count     : 62
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Apr 27 14:39:06 2018
     13// Update Count     : 63
    1414//
    1515
     
    2424#include <vector>                  // for vector
    2525
    26 #include "AddVisit.h"              // for addVisit
    2726#include "CodeGen/OperatorTable.h" // for isCtorDtor, isCtorDtorAssign
    2827#include "Common/PassVisitor.h"    // for PassVisitor
     
    335334                        definitions.push_back( dcl );
    336335                        indexer.addId( dcl );
    337                 } catch ( SemanticError err ) {
     336                } catch ( SemanticErrorException & ) {
    338337                        // okay if decl does not resolve - that means the function should not be generated
    339338                        delete dcl;
     
    380379                        paramType->attributes.clear();
    381380                        // add a parameter corresponding to this field
    382                         memCtorType->parameters.push_back( new ObjectDecl( field->name, Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType, nullptr ) );
     381                        ObjectDecl * param = new ObjectDecl( field->name, Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType, nullptr );
     382                        cloneAll_if( field->attributes, param->attributes, [](Attribute * attr) { return attr->isValidOnFuncParam(); } );
     383                        memCtorType->parameters.push_back( param );
    383384                        FunctionDecl * ctor = genFunc( "?{}", memCtorType->clone(), functionNesting );
    384385                        makeFieldCtorBody( aggregateDecl->members.begin(), aggregateDecl->members.end(), ctor );
  • src/SymTab/FixFunction.cc

    rf9feab8 r90152a4  
    3030                // can't delete function type because it may contain assertions, so transfer ownership to new object
    3131                ObjectDecl *pointer = new ObjectDecl( functionDecl->name, functionDecl->get_storageClasses(), functionDecl->linkage, nullptr, new PointerType( Type::Qualifiers(), functionDecl->type ), nullptr, functionDecl->attributes );
     32                pointer->location = functionDecl->location;
    3233                functionDecl->attributes.clear();
    3334                functionDecl->type = nullptr;
     
    3637        }
    3738
     39        // xxx - this passes on void[], e.g.
     40        //   void foo(void [10]);
     41        // does not cause an error
     42
    3843        Type * FixFunction::postmutate(ArrayType *arrayType) {
    3944                // need to recursively mutate the base type in order for multi-dimensional arrays to work.
    4045                PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), arrayType->base, arrayType->dimension, arrayType->isVarLen, arrayType->isStatic );
     46                pointerType->location = arrayType->location;
    4147                arrayType->base = nullptr;
    4248                arrayType->dimension = nullptr;
     
    6268        void FixFunction::premutate(ZeroType *) { visit_children = false; }
    6369        void FixFunction::premutate(OneType *) { visit_children = false; }
     70
     71        bool fixFunction( DeclarationWithType *& dwt ) {
     72                PassVisitor<FixFunction> fixer;
     73                dwt = dwt->acceptMutator( fixer );
     74                return fixer.pass.isVoid;
     75        }
    6476} // namespace SymTab
    6577
  • src/SymTab/FixFunction.h

    rf9feab8 r90152a4  
    4747                bool isVoid;
    4848        };
     49
     50        bool fixFunction( DeclarationWithType *& );
    4951} // namespace SymTab
    5052
  • src/SymTab/Indexer.cc

    rf9feab8 r90152a4  
    2626#include "Common/SemanticError.h"  // for SemanticError
    2727#include "Common/utility.h"        // for cloneAll
     28#include "GenPoly/GenPoly.h"
    2829#include "InitTweak/InitTweak.h"   // for isConstructor, isCopyFunction, isC...
    2930#include "Mangler.h"               // for Mangler
     
    105106                if ( ! CodeGen::isCtorDtorAssign( id ) ) return;
    106107
    107                 // helpful data structure
     108                // helpful data structure to organize properties for a type
    108109                struct ValueType {
    109                         struct DeclBall {
     110                        struct DeclBall { // properties for this particular decl
    110111                                IdData decl;
    111                                 bool isUserDefinedFunc; // properties for this particular decl
    112                                 bool isDefaultCtor;
    113                                 bool isDtor;
     112                                bool isUserDefinedFunc;
    114113                                bool isCopyFunc;
    115114                        };
    116115                        // properties for this type
    117                         bool existsUserDefinedFunc = false;    // any user-defined function found
    118                         bool existsUserDefinedCtor = false;    // any user-defined constructor found
    119                         bool existsUserDefinedDtor = false;    // any user-defined destructor found
    120116                        bool existsUserDefinedCopyFunc = false;    // user-defined copy ctor found
    121                         bool existsUserDefinedDefaultCtor = false; // user-defined default ctor found
     117                        BaseSyntaxNode * deleteStmt = nullptr;     // non-null if a user-defined function is found
    122118                        std::list< DeclBall > decls;
    123119
     
    126122                        ValueType & operator+=( IdData data ) {
    127123                                DeclarationWithType * function = data.id;
    128                                 bool isUserDefinedFunc = ! LinkageSpec::isOverridable( function->get_linkage() );
    129                                 bool isDefaultCtor = InitTweak::isDefaultConstructor( function );
    130                                 bool isDtor = InitTweak::isDestructor( function );
    131                                 bool isCopyFunc = InitTweak::isCopyFunction( function, function->get_name() );
    132                                 decls.push_back( DeclBall{ data, isUserDefinedFunc, isDefaultCtor, isDtor, isCopyFunc } );
    133                                 existsUserDefinedFunc = existsUserDefinedFunc || isUserDefinedFunc;
    134                                 existsUserDefinedCtor = existsUserDefinedCtor || (isUserDefinedFunc && CodeGen::isConstructor( function->get_name() ) );
    135                                 existsUserDefinedDtor = existsUserDefinedDtor || (isUserDefinedFunc && isDtor);
     124                                bool isUserDefinedFunc = ! LinkageSpec::isOverridable( function->linkage );
     125                                bool isCopyFunc = InitTweak::isCopyFunction( function, function->name );
     126                                decls.push_back( DeclBall{ data, isUserDefinedFunc, isCopyFunc } );
    136127                                existsUserDefinedCopyFunc = existsUserDefinedCopyFunc || (isUserDefinedFunc && isCopyFunc);
    137                                 existsUserDefinedDefaultCtor = existsUserDefinedDefaultCtor || (isUserDefinedFunc && isDefaultCtor);
     128                                if ( isUserDefinedFunc && ! deleteStmt ) {
     129                                        // any user-defined function can act as an implicit delete statement for generated constructors.
     130                                        // a delete stmt should not act as an implicit delete statement.
     131                                        deleteStmt = data.id;
     132                                }
    138133                                return *this;
    139134                        }
     
    147142                for ( auto decl : copy ) {
    148143                        if ( FunctionDecl * function = dynamic_cast< FunctionDecl * >( decl.id ) ) {
    149                                 std::list< DeclarationWithType * > & params = function->get_functionType()->get_parameters();
     144                                std::list< DeclarationWithType * > & params = function->type->parameters;
    150145                                assert( ! params.empty() );
    151146                                // use base type of pointer, so that qualifiers on the pointer type aren't considered.
     
    159154
    160155                // if a type contains user defined ctor/dtor/assign, then special rules trigger, which determine
    161                 // the set of ctor/dtor/assign that are seen by the requester. In particular, if the user defines
    162                 // a default ctor, then the generated default ctor should never be seen, likewise for copy ctor
    163                 // and dtor. If the user defines any ctor/dtor, then no generated field ctors should be seen.
    164                 // If the user defines any ctor then the generated default ctor should not be seen (intrinsic default
    165                 // ctor must be overridden exactly).
     156                // the set of ctor/dtor/assign that can be used  by the requester. In particular, if the user defines
     157                // a default ctor, then the generated default ctor is unavailable, likewise for copy ctor
     158                // and dtor. If the user defines any ctor/dtor, then no generated field ctors are available.
     159                // If the user defines any ctor then the generated default ctor is unavailable (intrinsic default
     160                // ctor must be overridden exactly). If the user defines anything that looks like a copy constructor,
     161                // then the generated copy constructor is unavailable, and likewise for the assignment operator.
    166162                for ( std::pair< const std::string, ValueType > & pair : funcMap ) {
    167163                        ValueType & val = pair.second;
    168164                        for ( ValueType::DeclBall ball : val.decls ) {
    169                                 bool noUserDefinedFunc = ! val.existsUserDefinedFunc;
    170                                 bool isUserDefinedFunc = ball.isUserDefinedFunc;
    171                                 bool isAcceptableDefaultCtor = (! val.existsUserDefinedCtor || (! val.existsUserDefinedDefaultCtor && ball.decl.id->get_linkage() == LinkageSpec::Intrinsic)) && ball.isDefaultCtor; // allow default constructors only when no user-defined constructors exist, except in the case of intrinsics, which require exact overrides
    172                                 bool isAcceptableCopyFunc = ! val.existsUserDefinedCopyFunc && ball.isCopyFunc; // handles copy ctor and assignment operator
    173                                 bool isAcceptableDtor = ! val.existsUserDefinedDtor && ball.isDtor;
    174                                 if ( noUserDefinedFunc || isUserDefinedFunc || isAcceptableDefaultCtor || isAcceptableCopyFunc || isAcceptableDtor ) {
    175                                         // decl conforms to the rules described above, so it should be seen by the requester
    176                                         out.push_back( ball.decl );
     165                                bool isNotUserDefinedFunc = ! ball.isUserDefinedFunc && ball.decl.id->linkage != LinkageSpec::Intrinsic;
     166                                bool isCopyFunc = ball.isCopyFunc;
     167                                bool existsUserDefinedCopyFunc = val.existsUserDefinedCopyFunc;
     168
     169                                // only implicitly delete non-user defined functions that are not intrinsic, and are
     170                                // not copy functions (assignment or copy constructor). If a  user-defined copy function exists,
     171                                // do not pass along the non-user-defined copy functions since signatures do not have to match,
     172                                // and the generated functions will often be cheaper.
     173                                if ( isNotUserDefinedFunc ) {
     174                                        if ( isCopyFunc ) {
     175                                                // Skip over non-user-defined copy functions when there is a user-defined copy function.
     176                                                // Since their signatures do not have to be exact, deleting them is the wrong choice.
     177                                                if ( existsUserDefinedCopyFunc ) continue;
     178                                        } else {
     179                                                // delete non-user-defined non-copy functions if applicable.
     180                                                // deleteStmt will be non-null only if a user-defined function is found.
     181                                                ball.decl.deleteStmt = val.deleteStmt;
     182                                        }
    177183                                }
     184                                out.push_back( ball.decl );
    178185                        }
    179186                }
     
    265272        }
    266273
     274        NamedTypeDecl *Indexer::globalLookupType( const std::string &id ) const {
     275                return lookupTypeAtScope( id, 0 );
     276        }
     277
     278        StructDecl *Indexer::globalLookupStruct( const std::string &id ) const {
     279                return lookupStructAtScope( id, 0 );
     280        }
     281
     282        UnionDecl *Indexer::globalLookupUnion( const std::string &id ) const {
     283                return lookupUnionAtScope( id, 0 );
     284        }
     285
     286        EnumDecl *Indexer::globalLookupEnum( const std::string &id ) const {
     287                return lookupEnumAtScope( id, 0 );
     288        }
     289
    267290        EnumDecl *Indexer::lookupEnum( const std::string &id ) const {
    268291                if ( ! tables ) return 0;
     
    286309        }
    287310
    288         DeclarationWithType *Indexer::lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) const {
    289                 if ( ! tables ) return 0;
    290                 if ( tables->scope < scope ) return 0;
     311        const Indexer::IdData * Indexer::lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) const {
     312                if ( ! tables ) return nullptr;
     313                if ( tables->scope < scope ) return nullptr;
    291314
    292315                IdTable::const_iterator decls = tables->idTable.find( id );
     
    294317                        const MangleTable &mangleTable = decls->second;
    295318                        MangleTable::const_iterator decl = mangleTable.find( mangleName );
    296                         if ( decl != mangleTable.end() ) return decl->second.id;
     319                        if ( decl != mangleTable.end() ) return &decl->second;
    297320                }
    298321
    299322                return tables->base.lookupIdAtScope( id, mangleName, scope );
     323        }
     324
     325        Indexer::IdData * Indexer::lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) {
     326                return const_cast<IdData *>(const_cast<const Indexer *>(this)->lookupIdAtScope( id, mangleName, scope ));
    300327        }
    301328
     
    336363                if ( ! tables ) return 0;
    337364                if ( tables->scope < scope ) return 0;
     365                if ( tables->scope > scope ) return tables->base.lookupTypeAtScope( id, scope );
    338366
    339367                TypeTable::const_iterator ret = tables->typeTable.find( id );
     
    344372                if ( ! tables ) return 0;
    345373                if ( tables->scope < scope ) return 0;
     374                if ( tables->scope > scope ) return tables->base.lookupStructAtScope( id, scope );
    346375
    347376                StructTable::const_iterator ret = tables->structTable.find( id );
     
    352381                if ( ! tables ) return 0;
    353382                if ( tables->scope < scope ) return 0;
     383                if ( tables->scope > scope ) return tables->base.lookupEnumAtScope( id, scope );
    354384
    355385                EnumTable::const_iterator ret = tables->enumTable.find( id );
     
    360390                if ( ! tables ) return 0;
    361391                if ( tables->scope < scope ) return 0;
     392                if ( tables->scope > scope ) return tables->base.lookupUnionAtScope( id, scope );
    362393
    363394                UnionTable::const_iterator ret = tables->unionTable.find( id );
     
    368399                if ( ! tables ) return 0;
    369400                if ( tables->scope < scope ) return 0;
     401                if ( tables->scope > scope ) return tables->base.lookupTraitAtScope( id, scope );
    370402
    371403                TraitTable::const_iterator ret = tables->traitTable.find( id );
     
    373405        }
    374406
    375         bool addedIdConflicts( DeclarationWithType *existing, DeclarationWithType *added ) {
     407        bool isFunction( DeclarationWithType * decl ) {
     408                return GenPoly::getFunctionType( decl->get_type() );
     409        }
     410
     411        bool isObject( DeclarationWithType * decl ) {
     412                return ! isFunction( decl );
     413        }
     414
     415        bool isDefinition( DeclarationWithType * decl ) {
     416                if ( FunctionDecl * func = dynamic_cast< FunctionDecl * >( decl ) ) {
     417                        // a function is a definition if it has a body
     418                        return func->statements;
     419                } else {
     420                        // an object is a definition if it is not marked extern.
     421                        // both objects must be marked extern
     422                        return ! decl->get_storageClasses().is_extern;
     423                }
     424        }
     425
     426        bool addedIdConflicts( Indexer::IdData & existing, DeclarationWithType *added, BaseSyntaxNode * deleteStmt, Indexer::ConflictFunction handleConflicts ) {
    376427                // if we're giving the same name mangling to things of different types then there is something wrong
    377                 assert( (dynamic_cast<ObjectDecl*>( added ) && dynamic_cast<ObjectDecl*>( existing ) )
    378                         || (dynamic_cast<FunctionDecl*>( added ) && dynamic_cast<FunctionDecl*>( existing ) ) );
    379 
    380                 if ( LinkageSpec::isOverridable( existing->get_linkage() ) ) {
     428                assert( (isObject( added ) && isObject( existing.id ) )
     429                        || ( isFunction( added ) && isFunction( existing.id ) ) );
     430
     431                if ( LinkageSpec::isOverridable( existing.id->get_linkage() ) ) {
    381432                        // new definition shadows the autogenerated one, even at the same scope
    382433                        return false;
    383                 } else if ( LinkageSpec::isMangled( added->get_linkage() ) || ResolvExpr::typesCompatible( added->get_type(), existing->get_type(), Indexer() ) ) {
    384                         // typesCompatible doesn't really do the right thing here. When checking compatibility of function types,
    385                         // we should ignore outermost pointer qualifiers, except _Atomic?
    386                         FunctionDecl *newentry = dynamic_cast< FunctionDecl* >( added );
    387                         FunctionDecl *oldentry = dynamic_cast< FunctionDecl* >( existing );
    388                         if ( newentry && oldentry ) {
    389                                 if ( newentry->get_statements() && oldentry->get_statements() ) {
    390                                         throw SemanticError( "duplicate function definition for ", added );
    391                                 } // if
    392                         } else {
    393                                 // two objects with the same mangled name defined in the same scope.
    394                                 // both objects must be marked extern or both must be intrinsic for this to be okay
    395                                 // xxx - perhaps it's actually if either is intrinsic then this is okay?
    396                                 //       might also need to be same storage class?
    397                                 ObjectDecl *newobj = dynamic_cast< ObjectDecl* >( added );
    398                                 ObjectDecl *oldobj = dynamic_cast< ObjectDecl* >( existing );
    399                                 if ( ! newobj->get_storageClasses().is_extern && ! oldobj->get_storageClasses().is_extern ) {
    400                                         throw SemanticError( "duplicate object definition for ", added );
     434                } else if ( LinkageSpec::isMangled( added->get_linkage() ) || ResolvExpr::typesCompatible( added->get_type(), existing.id->get_type(), Indexer() ) ) {
     435
     436                        // it is a conflict if one declaration is deleted and the other is not
     437                        if ( deleteStmt && ! existing.deleteStmt ) {
     438                                return handleConflicts( existing, "deletion of defined identifier " );
     439                        } else if ( ! deleteStmt && existing.deleteStmt ) {
     440                                return handleConflicts( existing, "definition of deleted identifier " );
     441                        }
     442
     443                        if ( isDefinition( added ) && isDefinition( existing.id ) ) {
     444                                if ( isFunction( added ) ) {
     445                                        return handleConflicts( existing, "duplicate function definition for " );
     446                                } else {
     447                                        return handleConflicts( existing, "duplicate object definition for " );
    401448                                } // if
    402449                        } // if
    403450                } else {
    404                         throw SemanticError( "duplicate definition for ", added );
     451                        return handleConflicts( existing, "duplicate definition for " );
    405452                } // if
    406453
     
    408455        }
    409456
    410         void Indexer::addId( DeclarationWithType *decl, Expression * baseExpr ) {
     457        void Indexer::addId( DeclarationWithType *decl, ConflictFunction handleConflicts, Expression * baseExpr, BaseSyntaxNode * deleteStmt ) {
     458                if ( decl->name == "" ) return;
    411459                debugPrint( "Adding Id " << decl->name << std::endl );
    412460                makeWritable();
     
    430478                        // isomorphic to C type-compatibility, which it may not be.
    431479                        if ( hasIncompatibleCDecl( name, mangleName, scope ) ) {
    432                                 throw SemanticError( "conflicting overload of C function ", decl );
    433                         }
    434                 } else {
    435                         // Check that a Cforall declaration doesn't overload any C declaration
     480                                SemanticError( decl, "conflicting overload of C function " );
     481                        }
     482                } else {
     483                        // Check that a Cforall declaration doesn't override any C declaration
    436484                        if ( hasCompatibleCDecl( name, mangleName, scope ) ) {
    437                                 throw SemanticError( "Cforall declaration hides C function ", decl );
     485                                SemanticError( decl, "Cforall declaration hides C function " );
    438486                        }
    439487                }
    440488
    441489                // Skip repeat declarations of the same identifier
    442                 DeclarationWithType *existing = lookupIdAtScope( name, mangleName, scope );
    443                 if ( existing && addedIdConflicts( existing, decl ) ) return;
     490                IdData * existing = lookupIdAtScope( name, mangleName, scope );
     491                if ( existing && existing->id && addedIdConflicts( *existing, decl, deleteStmt, handleConflicts ) ) return;
    444492
    445493                // add to indexer
    446                 tables->idTable[ name ][ mangleName ] = { decl, baseExpr };
     494                tables->idTable[ name ][ mangleName ] = IdData{ decl, baseExpr, deleteStmt };
    447495                ++tables->size;
    448496        }
    449497
     498        void Indexer::addId( DeclarationWithType * decl, Expression * baseExpr ) {
     499                // default handling of conflicts is to raise an error
     500                addId( decl, [decl](IdData &, const std::string & msg) { SemanticError( decl, msg ); return true; }, baseExpr, decl->isDeleted ? decl : nullptr );
     501        }
     502
     503        void Indexer::addDeletedId( DeclarationWithType * decl, BaseSyntaxNode * deleteStmt ) {
     504                // default handling of conflicts is to raise an error
     505                addId( decl, [decl](IdData &, const std::string & msg) { SemanticError( decl, msg ); return true; }, nullptr, deleteStmt );
     506        }
     507
    450508        bool addedTypeConflicts( NamedTypeDecl *existing, NamedTypeDecl *added ) {
    451                 if ( existing->get_base() == 0 ) {
     509                if ( existing->base == nullptr ) {
    452510                        return false;
    453                 } else if ( added->get_base() == 0 ) {
     511                } else if ( added->base == nullptr ) {
    454512                        return true;
    455513                } else {
    456                         throw SemanticError( "redeclaration of ", added );
    457                 }
     514                        assert( existing->base && added->base );
     515                        // typedef redeclarations are errors only if types are different
     516                        if ( ! ResolvExpr::typesCompatible( existing->base, added->base, Indexer() ) ) {
     517                                SemanticError( added->location, "redeclaration of " + added->name );
     518                        }
     519                }
     520                // does not need to be added to the table if both existing and added have a base that are the same
     521                return true;
    458522        }
    459523
     
    462526                makeWritable();
    463527
    464                 const std::string &id = decl->get_name();
     528                const std::string &id = decl->name;
    465529                TypeTable::iterator existing = tables->typeTable.find( id );
    466530                if ( existing == tables->typeTable.end() ) {
     
    478542
    479543        bool addedDeclConflicts( AggregateDecl *existing, AggregateDecl *added ) {
    480                 if ( existing->get_members().empty() ) {
     544                if ( ! existing->body ) {
    481545                        return false;
    482                 } else if ( ! added->get_members().empty() ) {
    483                         throw SemanticError( "redeclaration of ", added );
     546                } else if ( added->body ) {
     547                        SemanticError( added, "redeclaration of " );
    484548                } // if
    485549                return true;
     
    495559                makeWritable();
    496560
    497                 const std::string &id = decl->get_name();
     561                const std::string &id = decl->name;
    498562                StructTable::iterator existing = tables->structTable.find( id );
    499563                if ( existing == tables->structTable.end() ) {
     
    514578                makeWritable();
    515579
    516                 const std::string &id = decl->get_name();
     580                const std::string &id = decl->name;
    517581                EnumTable::iterator existing = tables->enumTable.find( id );
    518582                if ( existing == tables->enumTable.end() ) {
     
    538602                makeWritable();
    539603
    540                 const std::string &id = decl->get_name();
     604                const std::string &id = decl->name;
    541605                UnionTable::iterator existing = tables->unionTable.find( id );
    542606                if ( existing == tables->unionTable.end() ) {
     
    557621                makeWritable();
    558622
    559                 const std::string &id = decl->get_name();
     623                const std::string &id = decl->name;
    560624                TraitTable::iterator existing = tables->traitTable.find( id );
    561625                if ( existing == tables->traitTable.end() ) {
     
    572636        }
    573637
    574         void Indexer::addWith( WithStmt * stmt ) {
    575                 for ( Expression * expr : stmt->exprs ) {
     638        void Indexer::addMembers( AggregateDecl * aggr, Expression * expr, ConflictFunction handleConflicts ) {
     639                for ( Declaration * decl : aggr->members ) {
     640                        if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) {
     641                                addId( dwt, handleConflicts, expr );
     642                                if ( dwt->name == "" ) {
     643                                        Type * t = dwt->get_type()->stripReferences();
     644                                        if ( dynamic_cast< StructInstType * >( t ) || dynamic_cast< UnionInstType * >( t ) ) {
     645                                                Expression * base = expr->clone();
     646                                                ResolvExpr::Cost cost = ResolvExpr::Cost::zero; // xxx - carry this cost into the indexer as a base cost?
     647                                                ResolvExpr::referenceToRvalueConversion( base, cost );
     648                                                addMembers( t->getAggr(), new MemberExpr( dwt, base ), handleConflicts );
     649                                        }
     650                                }
     651                        }
     652                }
     653        }
     654
     655        void Indexer::addWith( std::list< Expression * > & withExprs, BaseSyntaxNode * withStmt ) {
     656                for ( Expression * expr : withExprs ) {
    576657                        if ( expr->result ) {
    577658                                AggregateDecl * aggr = expr->result->stripReferences()->getAggr();
    578659                                assertf( aggr, "WithStmt expr has non-aggregate type: %s", toString( expr->result ).c_str() );
    579660
    580                                 for ( Declaration * decl : aggr->members ) {
    581                                         if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) {
    582                                                 addId( dwt, expr );
    583                                         }
    584                                 }
     661                                addMembers( aggr, expr, [withStmt](IdData & existing, const std::string &) {
     662                                        // on conflict, delete the identifier
     663                                        existing.deleteStmt = withStmt;
     664                                        return true;
     665                                });
    585666                        }
    586667                }
     
    641722
    642723        void Indexer::print( std::ostream &os, int indent ) const {
    643             using std::cerr;
     724                using std::cerr;
    644725
    645726                if ( tables ) {
     
    666747        }
    667748
    668         Expression * Indexer::IdData::combine() const {
     749        Expression * Indexer::IdData::combine( ResolvExpr::Cost & cost ) const {
     750                Expression * ret = nullptr;
    669751                if ( baseExpr ) {
    670752                        Expression * base = baseExpr->clone();
    671                         ResolvExpr::referenceToRvalueConversion( base );
    672                         Expression * ret = new MemberExpr( id, base );
     753                        ResolvExpr::referenceToRvalueConversion( base, cost );
     754                        ret = new MemberExpr( id, base );
    673755                        // xxx - this introduces hidden environments, for now remove them.
    674756                        // std::swap( base->env, ret->env );
    675757                        delete base->env;
    676758                        base->env = nullptr;
    677                         return ret;
    678                 } else {
    679                         return new VariableExpr( id );
    680                 }
     759                } else {
     760                        ret = new VariableExpr( id );
     761                }
     762                if ( deleteStmt ) ret = new DeletedExpr( ret, deleteStmt );
     763                return ret;
    681764        }
    682765} // namespace SymTab
  • src/SymTab/Indexer.h

    rf9feab8 r90152a4  
    1919#include <list>               // for list
    2020#include <string>             // for string
     21#include <functional>         // for function
    2122
    2223#include "SynTree/Visitor.h"  // for Visitor
    2324#include "SynTree/SynTree.h"  // for AST nodes
     25
     26namespace ResolvExpr {
     27class Cost;
     28}
    2429
    2530namespace SymTab {
     
    4045
    4146                struct IdData {
    42                         DeclarationWithType * id;
    43                         Expression * baseExpr; // WithExpr
     47                        DeclarationWithType * id = nullptr;
     48                        Expression * baseExpr = nullptr; // WithExpr
    4449
    45                         Expression * combine() const;
     50                        /// non-null if this declaration is deleted
     51                        BaseSyntaxNode * deleteStmt = nullptr;
     52
     53                        // NOTE: shouldn't need either of these constructors, but gcc-4 does not properly support initializer lists with default members.
     54                        IdData() = default;
     55                        IdData( DeclarationWithType * id, Expression * baseExpr, BaseSyntaxNode * deleteStmt ) : id( id ), baseExpr( baseExpr ), deleteStmt( deleteStmt ) {}
     56
     57                        Expression * combine( ResolvExpr::Cost & cost ) const;
    4658                };
    4759
     
    5971                TraitDecl *lookupTrait( const std::string &id ) const;
    6072
     73                /// Gets the type declaration with the given ID at global scope
     74                NamedTypeDecl *globalLookupType( const std::string &id ) const;
     75                /// Gets the struct declaration with the given ID at global scope
     76                StructDecl *globalLookupStruct( const std::string &id ) const;
     77                /// Gets the union declaration with the given ID at global scope
     78                UnionDecl *globalLookupUnion( const std::string &id ) const;
     79                /// Gets the enum declaration with the given ID at global scope
     80                EnumDecl *globalLookupEnum( const std::string &id ) const;
     81
    6182                void print( std::ostream &os, int indent = 0 ) const;
    6283
    6384                /// looks up a specific mangled ID at the given scope
    64                 DeclarationWithType *lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) const;
     85                IdData * lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope );
     86                const IdData * lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) const;
    6587                /// returns true if there exists a declaration with C linkage and the given name with a different mangled name
    6688                bool hasIncompatibleCDecl( const std::string &id, const std::string &mangleName, unsigned long scope ) const;
     
    7496                TraitDecl *lookupTraitAtScope( const std::string &id, unsigned long scope ) const;
    7597
    76                 void addId( DeclarationWithType *decl, Expression * baseExpr = nullptr );
     98                typedef std::function<bool(IdData &, const std::string &)> ConflictFunction;
     99
     100                void addId( DeclarationWithType * decl, Expression * baseExpr = nullptr );
     101                void addDeletedId( DeclarationWithType * decl, BaseSyntaxNode * deleteStmt );
     102
    77103                void addType( NamedTypeDecl *decl );
    78104                void addStruct( const std::string &id );
     
    84110
    85111                /// adds all of the IDs from WithStmt exprs
    86                 void addWith( WithStmt * );
     112                void addWith( std::list< Expression * > & withExprs, BaseSyntaxNode * withStmt );
     113
     114                /// adds all of the members of the Aggregate (addWith helper)
     115                void addMembers( AggregateDecl * aggr, Expression * expr, ConflictFunction );
    87116
    88117                /// convenience function for adding a list of Ids to the indexer
     
    114143                /// Ensures that tables variable is writable (i.e. allocated, uniquely owned by this Indexer, and at the current scope)
    115144                void makeWritable();
     145
     146                /// common code for addId, addDeletedId, etc.
     147                void addId( DeclarationWithType * decl, ConflictFunction, Expression * baseExpr = nullptr, BaseSyntaxNode * deleteStmt = nullptr );
    116148        };
    117149} // namespace SymTab
  • src/SymTab/Mangler.cc

    rf9feab8 r90152a4  
    2323
    2424#include "CodeGen/OperatorTable.h"  // for OperatorInfo, operatorLookup
     25#include "Common/PassVisitor.h"
    2526#include "Common/SemanticError.h"   // for SemanticError
    2627#include "Common/utility.h"         // for toString
     
    3132
    3233namespace SymTab {
    33         std::string Mangler::mangleType( Type * ty ) {
    34                 Mangler mangler( false, true, true );
    35                 maybeAccept( ty, mangler );
    36                 return mangler.get_mangleName();
    37         }
    38 
    39         std::string Mangler::mangleConcrete( Type* ty ) {
    40                 Mangler mangler( false, false, false );
    41                 maybeAccept( ty, mangler );
    42                 return mangler.get_mangleName();
    43         }
    44 
    45         Mangler::Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams )
    46                 : nextVarNum( 0 ), isTopLevel( true ), mangleOverridable( mangleOverridable ), typeMode( typeMode ), mangleGenericParams( mangleGenericParams ) {}
    47 
    48         Mangler::Mangler( const Mangler &rhs ) : mangleName() {
    49                 varNums = rhs.varNums;
    50                 nextVarNum = rhs.nextVarNum;
    51                 isTopLevel = rhs.isTopLevel;
    52                 mangleOverridable = rhs.mangleOverridable;
    53                 typeMode = rhs.typeMode;
    54         }
    55 
    56         void Mangler::mangleDecl( DeclarationWithType * declaration ) {
    57                 bool wasTopLevel = isTopLevel;
    58                 if ( isTopLevel ) {
    59                         varNums.clear();
    60                         nextVarNum = 0;
    61                         isTopLevel = false;
    62                 } // if
    63                 mangleName << "__";
    64                 CodeGen::OperatorInfo opInfo;
    65                 if ( operatorLookup( declaration->get_name(), opInfo ) ) {
    66                         mangleName << opInfo.outputName;
    67                 } else {
    68                         mangleName << declaration->get_name();
    69                 } // if
    70                 mangleName << "__";
    71                 maybeAccept( declaration->get_type(), *this );
    72                 if ( mangleOverridable && LinkageSpec::isOverridable( declaration->get_linkage() ) ) {
    73                         // want to be able to override autogenerated and intrinsic routines,
    74                         // so they need a different name mangling
    75                         if ( declaration->get_linkage() == LinkageSpec::AutoGen ) {
    76                                 mangleName << "autogen__";
    77                         } else if ( declaration->get_linkage() == LinkageSpec::Intrinsic ) {
    78                                 mangleName << "intrinsic__";
    79                         } else {
    80                                 // if we add another kind of overridable function, this has to change
    81                                 assert( false && "unknown overrideable linkage" );
    82                         } // if
     34        namespace Mangler {
     35                namespace {
     36                        /// Mangles names to a unique C identifier
     37                        struct Mangler : public WithShortCircuiting, public WithVisitorRef<Mangler>, public WithGuards {
     38                                Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams );
     39                                Mangler( const Mangler & ) = delete;
     40
     41                                void previsit( BaseSyntaxNode * ) { visit_children = false; }
     42
     43                                void postvisit( ObjectDecl * declaration );
     44                                void postvisit( FunctionDecl * declaration );
     45                                void postvisit( TypeDecl * declaration );
     46
     47                                void postvisit( VoidType * voidType );
     48                                void postvisit( BasicType * basicType );
     49                                void postvisit( PointerType * pointerType );
     50                                void postvisit( ArrayType * arrayType );
     51                                void postvisit( ReferenceType * refType );
     52                                void postvisit( FunctionType * functionType );
     53                                void postvisit( StructInstType * aggregateUseType );
     54                                void postvisit( UnionInstType * aggregateUseType );
     55                                void postvisit( EnumInstType * aggregateUseType );
     56                                void postvisit( TypeInstType * aggregateUseType );
     57                                void postvisit( TraitInstType * inst );
     58                                void postvisit( TupleType * tupleType );
     59                                void postvisit( VarArgsType * varArgsType );
     60                                void postvisit( ZeroType * zeroType );
     61                                void postvisit( OneType * oneType );
     62                                void postvisit( QualifiedType * qualType );
     63
     64                                std::string get_mangleName() { return mangleName.str(); }
     65                          private:
     66                                std::ostringstream mangleName;  ///< Mangled name being constructed
     67                                typedef std::map< std::string, std::pair< int, int > > VarMapType;
     68                                VarMapType varNums;             ///< Map of type variables to indices
     69                                int nextVarNum;                 ///< Next type variable index
     70                                bool isTopLevel;                ///< Is the Mangler at the top level
     71                                bool mangleOverridable;         ///< Specially mangle overridable built-in methods
     72                                bool typeMode;                  ///< Produce a unique mangled name for a type
     73                                bool mangleGenericParams;       ///< Include generic parameters in name mangling if true
     74                                bool inFunctionType = false;    ///< Include type qualifiers if false.
     75                                bool inQualifiedType = false;   ///< Add start/end delimiters around qualified type
     76
     77                                void mangleDecl( DeclarationWithType *declaration );
     78                                void mangleRef( ReferenceToType *refType, std::string prefix );
     79
     80                                void printQualifiers( Type *type );
     81                        }; // Mangler
     82                } // namespace
     83
     84                std::string mangle( BaseSyntaxNode * decl, bool mangleOverridable, bool typeMode, bool mangleGenericParams ) {
     85                        PassVisitor<Mangler> mangler( mangleOverridable, typeMode, mangleGenericParams );
     86                        maybeAccept( decl, mangler );
     87                        return mangler.pass.get_mangleName();
    8388                }
    84                 isTopLevel = wasTopLevel;
    85         }
    86 
    87         void Mangler::visit( ObjectDecl * declaration ) {
    88                 mangleDecl( declaration );
    89         }
    90 
    91         void Mangler::visit( FunctionDecl * declaration ) {
    92                 mangleDecl( declaration );
    93         }
    94 
    95         void Mangler::visit( VoidType * voidType ) {
    96                 printQualifiers( voidType );
    97                 mangleName << "v";
    98         }
    99 
    100         void Mangler::visit( BasicType * basicType ) {
    101                 static const char *btLetter[] = {
    102                         "b",    // Bool
    103                         "c",    // Char
    104                         "Sc",   // SignedChar
    105                         "Uc",   // UnsignedChar
    106                         "s",    // ShortSignedInt
    107                         "Us",   // ShortUnsignedInt
    108                         "i",    // SignedInt
    109                         "Ui",   // UnsignedInt
    110                         "l",    // LongSignedInt
    111                         "Ul",   // LongUnsignedInt
    112                         "q",    // LongLongSignedInt
    113                         "Uq",   // LongLongUnsignedInt
    114                         "f",    // Float
    115                         "d",    // Double
    116                         "r",    // LongDouble
    117                         "Xf",   // FloatComplex
    118                         "Xd",   // DoubleComplex
    119                         "Xr",   // LongDoubleComplex
    120                         "If",   // FloatImaginary
    121                         "Id",   // DoubleImaginary
    122                         "Ir",   // LongDoubleImaginary
    123                         "w",    // SignedInt128
    124                         "Uw",   // UnsignedInt128
    125                 };
    126 
    127                 printQualifiers( basicType );
    128                 mangleName << btLetter[ basicType->get_kind() ];
    129         }
    130 
    131         void Mangler::visit( PointerType * pointerType ) {
    132                 printQualifiers( pointerType );
    133                 mangleName << "P";
    134                 maybeAccept( pointerType->get_base(), *this );
    135         }
    136 
    137         void Mangler::visit( ArrayType * arrayType ) {
    138                 // TODO: encode dimension
    139                 printQualifiers( arrayType );
    140                 mangleName << "A0";
    141                 maybeAccept( arrayType->get_base(), *this );
    142         }
    143 
    144         void Mangler::visit( ReferenceType * refType ) {
    145                 printQualifiers( refType );
    146                 mangleName << "R";
    147                 maybeAccept( refType->get_base(), *this );
    148         }
    149 
    150         namespace {
    151                 inline std::list< Type* > getTypes( const std::list< DeclarationWithType* > decls ) {
    152                         std::list< Type* > ret;
    153                         std::transform( decls.begin(), decls.end(), std::back_inserter( ret ),
    154                                                         std::mem_fun( &DeclarationWithType::get_type ) );
    155                         return ret;
     89
     90                std::string mangleType( Type * ty ) {
     91                        PassVisitor<Mangler> mangler( false, true, true );
     92                        maybeAccept( ty, mangler );
     93                        return mangler.pass.get_mangleName();
    15694                }
    157         }
    158 
    159         void Mangler::visit( FunctionType * functionType ) {
    160                 printQualifiers( functionType );
    161                 mangleName << "F";
    162                 std::list< Type* > returnTypes = getTypes( functionType->get_returnVals() );
    163                 acceptAll( returnTypes, *this );
    164                 mangleName << "_";
    165                 std::list< Type* > paramTypes = getTypes( functionType->get_parameters() );
    166                 acceptAll( paramTypes, *this );
    167                 mangleName << "_";
    168         }
    169 
    170         void Mangler::mangleRef( ReferenceToType * refType, std::string prefix ) {
    171                 printQualifiers( refType );
    172 
    173                 mangleName << ( refType->get_name().length() + prefix.length() ) << prefix << refType->get_name();
    174 
    175                 if ( mangleGenericParams ) {
    176                         std::list< Expression* >& params = refType->get_parameters();
    177                         if ( ! params.empty() ) {
     95
     96                std::string mangleConcrete( Type * ty ) {
     97                        PassVisitor<Mangler> mangler( false, false, false );
     98                        maybeAccept( ty, mangler );
     99                        return mangler.pass.get_mangleName();
     100                }
     101
     102                namespace {
     103                        Mangler::Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams )
     104                                : nextVarNum( 0 ), isTopLevel( true ), mangleOverridable( mangleOverridable ), typeMode( typeMode ), mangleGenericParams( mangleGenericParams ) {}
     105
     106                        void Mangler::mangleDecl( DeclarationWithType * declaration ) {
     107                                bool wasTopLevel = isTopLevel;
     108                                if ( isTopLevel ) {
     109                                        varNums.clear();
     110                                        nextVarNum = 0;
     111                                        isTopLevel = false;
     112                                } // if
     113                                mangleName << Encoding::manglePrefix;
     114                                CodeGen::OperatorInfo opInfo;
     115                                if ( operatorLookup( declaration->get_name(), opInfo ) ) {
     116                                        mangleName << opInfo.outputName.size() << opInfo.outputName;
     117                                } else {
     118                                        mangleName << declaration->name.size() << declaration->name;
     119                                } // if
     120                                maybeAccept( declaration->get_type(), *visitor );
     121                                if ( mangleOverridable && LinkageSpec::isOverridable( declaration->get_linkage() ) ) {
     122                                        // want to be able to override autogenerated and intrinsic routines,
     123                                        // so they need a different name mangling
     124                                        if ( declaration->get_linkage() == LinkageSpec::AutoGen ) {
     125                                                mangleName << Encoding::autogen;
     126                                        } else if ( declaration->get_linkage() == LinkageSpec::Intrinsic ) {
     127                                                mangleName << Encoding::intrinsic;
     128                                        } else {
     129                                                // if we add another kind of overridable function, this has to change
     130                                                assert( false && "unknown overrideable linkage" );
     131                                        } // if
     132                                }
     133                                isTopLevel = wasTopLevel;
     134                        }
     135
     136                        void Mangler::postvisit( ObjectDecl * declaration ) {
     137                                mangleDecl( declaration );
     138                        }
     139
     140                        void Mangler::postvisit( FunctionDecl * declaration ) {
     141                                mangleDecl( declaration );
     142                        }
     143
     144                        void Mangler::postvisit( VoidType * voidType ) {
     145                                printQualifiers( voidType );
     146                                mangleName << Encoding::void_t;
     147                        }
     148
     149                        void Mangler::postvisit( BasicType * basicType ) {
     150                                printQualifiers( basicType );
     151                                assertf( basicType->get_kind() < BasicType::NUMBER_OF_BASIC_TYPES, "Unhandled basic type: %d", basicType->get_kind() );
     152                                mangleName << Encoding::basicTypes[ basicType->get_kind() ];
     153                        }
     154
     155                        void Mangler::postvisit( PointerType * pointerType ) {
     156                                printQualifiers( pointerType );
     157                                // mangle void (*f)() and void f() to the same name to prevent overloading on functions and function pointers
     158                                if ( ! dynamic_cast<FunctionType *>( pointerType->base ) ) mangleName << Encoding::pointer;
     159                                maybeAccept( pointerType->base, *visitor );
     160                        }
     161
     162                        void Mangler::postvisit( ArrayType * arrayType ) {
     163                                // TODO: encode dimension
     164                                printQualifiers( arrayType );
     165                                mangleName << Encoding::array << "0";
     166                                maybeAccept( arrayType->base, *visitor );
     167                        }
     168
     169                        void Mangler::postvisit( ReferenceType * refType ) {
     170                                // don't print prefix (e.g. 'R') for reference types so that references and non-references do not overload.
     171                                // Further, do not print the qualifiers for a reference type (but do run printQualifers because of TypeDecls, etc.),
     172                                // by pretending every reference type is a function parameter.
     173                                GuardValue( inFunctionType );
     174                                inFunctionType = true;
     175                                printQualifiers( refType );
     176                                maybeAccept( refType->base, *visitor );
     177                        }
     178
     179                        namespace {
     180                                inline std::list< Type* > getTypes( const std::list< DeclarationWithType* > decls ) {
     181                                        std::list< Type* > ret;
     182                                        std::transform( decls.begin(), decls.end(), std::back_inserter( ret ),
     183                                                                        std::mem_fun( &DeclarationWithType::get_type ) );
     184                                        return ret;
     185                                }
     186                        }
     187
     188                        void Mangler::postvisit( FunctionType * functionType ) {
     189                                printQualifiers( functionType );
     190                                mangleName << Encoding::function;
     191                                // turn on inFunctionType so that printQualifiers does not print most qualifiers for function parameters,
     192                                // since qualifiers on outermost parameter type do not differentiate function types, e.g.,
     193                                // void (*)(const int) and void (*)(int) are the same type, but void (*)(const int *) and void (*)(int *) are different
     194                                GuardValue( inFunctionType );
     195                                inFunctionType = true;
     196                                std::list< Type* > returnTypes = getTypes( functionType->returnVals );
     197                                if (returnTypes.empty()) mangleName << Encoding::void_t;
     198                                else acceptAll( returnTypes, *visitor );
    178199                                mangleName << "_";
    179                                 for ( std::list< Expression* >::const_iterator param = params.begin(); param != params.end(); ++param ) {
    180                                         TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param );
    181                                         assertf(paramType, "Aggregate parameters should be type expressions: %s", toString(*param).c_str());
    182                                         maybeAccept( paramType->get_type(), *this );
    183                                 }
     200                                std::list< Type* > paramTypes = getTypes( functionType->parameters );
     201                                acceptAll( paramTypes, *visitor );
    184202                                mangleName << "_";
    185203                        }
    186                 }
    187         }
    188 
    189         void Mangler::visit( StructInstType * aggregateUseType ) {
    190                 mangleRef( aggregateUseType, "s" );
    191         }
    192 
    193         void Mangler::visit( UnionInstType * aggregateUseType ) {
    194                 mangleRef( aggregateUseType, "u" );
    195         }
    196 
    197         void Mangler::visit( EnumInstType * aggregateUseType ) {
    198                 mangleRef( aggregateUseType, "e" );
    199         }
    200 
    201         void Mangler::visit( TypeInstType * typeInst ) {
    202                 VarMapType::iterator varNum = varNums.find( typeInst->get_name() );
    203                 if ( varNum == varNums.end() ) {
    204                         mangleRef( typeInst, "t" );
    205                 } else {
    206                         printQualifiers( typeInst );
    207                         std::ostringstream numStream;
    208                         numStream << varNum->second.first;
    209                         switch ( (TypeDecl::Kind )varNum->second.second ) {
    210                           case TypeDecl::Dtype:
    211                                 mangleName << "d";
    212                                 break;
    213                           case TypeDecl::Ftype:
    214                                 mangleName << "f";
    215                                 break;
    216                                 case TypeDecl::Ttype:
    217                                 mangleName << "tVARGS";
    218                                 break;
    219                                 default:
    220                                 assert( false );
    221                         } // switch
    222                         mangleName << numStream.str();
    223                 } // if
    224         }
    225 
    226         void Mangler::visit( TupleType * tupleType ) {
    227                 printQualifiers( tupleType );
    228                 mangleName << "T";
    229                 acceptAll( tupleType->types, *this );
    230                 mangleName << "_";
    231         }
    232 
    233         void Mangler::visit( VarArgsType * varArgsType ) {
    234                 printQualifiers( varArgsType );
    235                 mangleName << "VARGS";
    236         }
    237 
    238         void Mangler::visit( ZeroType * ) {
    239                 mangleName << "Z";
    240         }
    241 
    242         void Mangler::visit( OneType * ) {
    243                 mangleName << "O";
    244         }
    245 
    246         void Mangler::visit( TypeDecl * decl ) {
    247                 static const char *typePrefix[] = { "BT", "BD", "BF" };
    248                 mangleName << typePrefix[ decl->get_kind() ] << ( decl->name.length() + 1 ) << decl->name;
    249         }
    250 
    251         void printVarMap( const std::map< std::string, std::pair< int, int > > &varMap, std::ostream &os ) {
    252                 for ( std::map< std::string, std::pair< int, int > >::const_iterator i = varMap.begin(); i != varMap.end(); ++i ) {
    253                         os << i->first << "(" << i->second.first << "/" << i->second.second << ")" << std::endl;
    254                 } // for
    255         }
    256 
    257         void Mangler::printQualifiers( Type * type ) {
    258                 // skip if not including qualifiers
    259                 if ( typeMode ) return;
    260 
    261                 if ( ! type->get_forall().empty() ) {
    262                         std::list< std::string > assertionNames;
    263                         int tcount = 0, dcount = 0, fcount = 0, vcount = 0;
    264                         mangleName << "A";
    265                         for ( Type::ForallList::iterator i = type->forall.begin(); i != type->forall.end(); ++i ) {
    266                                 switch ( (*i)->get_kind() ) {
    267                                   case TypeDecl::Dtype:
    268                                         dcount++;
    269                                         break;
    270                                   case TypeDecl::Ftype:
    271                                         fcount++;
    272                                         break;
    273                                   case TypeDecl::Ttype:
    274                                         vcount++;
    275                                         break;
    276                                   default:
    277                                         assert( false );
    278                                 } // switch
    279                                 varNums[ (*i)->name ] = std::pair< int, int >( nextVarNum++, (int)(*i)->get_kind() );
    280                                 for ( std::list< DeclarationWithType* >::iterator assert = (*i)->assertions.begin(); assert != (*i)->assertions.end(); ++assert ) {
    281                                         Mangler sub_mangler( mangleOverridable, typeMode, mangleGenericParams );
    282                                         sub_mangler.nextVarNum = nextVarNum;
    283                                         sub_mangler.isTopLevel = false;
    284                                         sub_mangler.varNums = varNums;
    285                                         (*assert)->accept( sub_mangler );
    286                                         assertionNames.push_back( sub_mangler.mangleName.str() );
     204
     205                        void Mangler::mangleRef( ReferenceToType * refType, std::string prefix ) {
     206                                printQualifiers( refType );
     207
     208                                mangleName << prefix << refType->name.length() << refType->name;
     209
     210                                if ( mangleGenericParams ) {
     211                                        std::list< Expression* >& params = refType->parameters;
     212                                        if ( ! params.empty() ) {
     213                                                mangleName << "_";
     214                                                for ( std::list< Expression* >::const_iterator param = params.begin(); param != params.end(); ++param ) {
     215                                                        TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param );
     216                                                        assertf(paramType, "Aggregate parameters should be type expressions: %s", toCString(*param));
     217                                                        maybeAccept( paramType->type, *visitor );
     218                                                }
     219                                                mangleName << "_";
     220                                        }
     221                                }
     222                        }
     223
     224                        void Mangler::postvisit( StructInstType * aggregateUseType ) {
     225                                mangleRef( aggregateUseType, Encoding::struct_t );
     226                        }
     227
     228                        void Mangler::postvisit( UnionInstType * aggregateUseType ) {
     229                                mangleRef( aggregateUseType, Encoding::union_t );
     230                        }
     231
     232                        void Mangler::postvisit( EnumInstType * aggregateUseType ) {
     233                                mangleRef( aggregateUseType, Encoding::enum_t );
     234                        }
     235
     236                        void Mangler::postvisit( TypeInstType * typeInst ) {
     237                                VarMapType::iterator varNum = varNums.find( typeInst->get_name() );
     238                                if ( varNum == varNums.end() ) {
     239                                        mangleRef( typeInst, Encoding::type );
     240                                } else {
     241                                        printQualifiers( typeInst );
     242                                        // Note: Can't use name here, since type variable names do not actually disambiguate a function, e.g.
     243                                        //   forall(dtype T) void f(T);
     244                                        //   forall(dtype S) void f(S);
     245                                        // are equivalent and should mangle the same way. This is accomplished by numbering the type variables when they
     246                                        // are first found and prefixing with the appropriate encoding for the type class.
     247                                        assertf( varNum->second.second < TypeDecl::NUMBER_OF_KINDS, "Unhandled type variable kind: %d", varNum->second.second );
     248                                        mangleName << Encoding::typeVariables[varNum->second.second] << varNum->second.first;
     249                                } // if
     250                        }
     251
     252                        void Mangler::postvisit( TraitInstType * inst ) {
     253                                printQualifiers( inst );
     254                                mangleName << inst->name.size() << inst->name;
     255                        }
     256
     257                        void Mangler::postvisit( TupleType * tupleType ) {
     258                                printQualifiers( tupleType );
     259                                mangleName << Encoding::tuple << tupleType->types.size();
     260                                acceptAll( tupleType->types, *visitor );
     261                        }
     262
     263                        void Mangler::postvisit( VarArgsType * varArgsType ) {
     264                                printQualifiers( varArgsType );
     265                                static const std::string vargs = "__builtin_va_list";
     266                                mangleName << Encoding::type << vargs.size() << vargs;
     267                        }
     268
     269                        void Mangler::postvisit( ZeroType * ) {
     270                                mangleName << Encoding::zero;
     271                        }
     272
     273                        void Mangler::postvisit( OneType * ) {
     274                                mangleName << Encoding::one;
     275                        }
     276
     277                        void Mangler::postvisit( QualifiedType * qualType ) {
     278                                bool inqual = inQualifiedType;
     279                                if (! inqual ) {
     280                                        // N marks the start of a qualified type
     281                                        inQualifiedType = true;
     282                                        mangleName << Encoding::qualifiedTypeStart;
     283                                }
     284                                maybeAccept( qualType->parent, *visitor );
     285                                maybeAccept( qualType->child, *visitor );
     286                                if ( ! inqual ) {
     287                                        // E marks the end of a qualified type
     288                                        inQualifiedType = false;
     289                                        mangleName << Encoding::qualifiedTypeEnd;
     290                                }
     291                        }
     292
     293                        void Mangler::postvisit( TypeDecl * decl ) {
     294                                // TODO: is there any case where mangling a TypeDecl makes sense? If so, this code needs to be
     295                                // fixed to ensure that two TypeDecls mangle to the same name when they are the same type and vice versa.
     296                                // Note: The current scheme may already work correctly for this case, I have not thought about this deeply
     297                                // and the case has not yet come up in practice. Alternatively, if not then this code can be removed
     298                                // aside from the assert false.
     299                                assertf(false, "Mangler should not visit typedecl: %s", toCString(decl));
     300                                assertf( decl->get_kind() < TypeDecl::NUMBER_OF_KINDS, "Unhandled type variable kind: %d", decl->get_kind() );
     301                                mangleName << Encoding::typeVariables[ decl->get_kind() ] << ( decl->name.length() ) << decl->name;
     302                        }
     303
     304                        __attribute__((unused)) void printVarMap( const std::map< std::string, std::pair< int, int > > &varMap, std::ostream &os ) {
     305                                for ( std::map< std::string, std::pair< int, int > >::const_iterator i = varMap.begin(); i != varMap.end(); ++i ) {
     306                                        os << i->first << "(" << i->second.first << "/" << i->second.second << ")" << std::endl;
    287307                                } // for
    288                         } // for
    289                         mangleName << tcount << "_" << dcount << "_" << fcount << "_" << vcount << "_";
    290                         std::copy( assertionNames.begin(), assertionNames.end(), std::ostream_iterator< std::string >( mangleName, "" ) );
    291                         mangleName << "_";
    292                 } // if
    293                 if ( type->get_const() ) {
    294                         mangleName << "C";
    295                 } // if
    296                 if ( type->get_volatile() ) {
    297                         mangleName << "V";
    298                 } // if
    299                 if ( type->get_mutex() ) {
    300                         mangleName << "M";
    301                 } // if
    302                 // Removed due to restrict not affecting function compatibility in GCC
    303 //              if ( type->get_isRestrict() ) {
    304 //                      mangleName << "E";
    305 //              } // if
    306                 if ( type->get_lvalue() ) {
    307                         // mangle based on whether the type is lvalue, so that the resolver can differentiate lvalues and rvalues
    308                         mangleName << "L";
    309                 }
    310                 if ( type->get_atomic() ) {
    311                         mangleName << "A";
    312                 } // if
    313         }
     308                        }
     309
     310                        void Mangler::printQualifiers( Type * type ) {
     311                                // skip if not including qualifiers
     312                                if ( typeMode ) return;
     313                                if ( ! type->get_forall().empty() ) {
     314                                        std::list< std::string > assertionNames;
     315                                        int dcount = 0, fcount = 0, vcount = 0, acount = 0;
     316                                        mangleName << Encoding::forall;
     317                                        for ( Type::ForallList::iterator i = type->forall.begin(); i != type->forall.end(); ++i ) {
     318                                                switch ( (*i)->get_kind() ) {
     319                                                  case TypeDecl::Dtype:
     320                                                        dcount++;
     321                                                        break;
     322                                                  case TypeDecl::Ftype:
     323                                                        fcount++;
     324                                                        break;
     325                                                  case TypeDecl::Ttype:
     326                                                        vcount++;
     327                                                        break;
     328                                                  default:
     329                                                        assert( false );
     330                                                } // switch
     331                                                varNums[ (*i)->name ] = std::pair< int, int >( nextVarNum++, (int)(*i)->get_kind() );
     332                                                for ( std::list< DeclarationWithType* >::iterator assert = (*i)->assertions.begin(); assert != (*i)->assertions.end(); ++assert ) {
     333                                                        PassVisitor<Mangler> sub_mangler( mangleOverridable, typeMode, mangleGenericParams );
     334                                                        sub_mangler.pass.nextVarNum = nextVarNum;
     335                                                        sub_mangler.pass.isTopLevel = false;
     336                                                        sub_mangler.pass.varNums = varNums;
     337                                                        (*assert)->accept( sub_mangler );
     338                                                        assertionNames.push_back( sub_mangler.pass.mangleName.str() );
     339                                                        acount++;
     340                                                } // for
     341                                        } // for
     342                                        mangleName << dcount << "_" << fcount << "_" << vcount << "_" << acount << "_";
     343                                        std::copy( assertionNames.begin(), assertionNames.end(), std::ostream_iterator< std::string >( mangleName, "" ) );
     344                                        mangleName << "_";
     345                                } // if
     346                                if ( ! inFunctionType ) {
     347                                        // these qualifiers do not distinguish the outermost type of a function parameter
     348                                        if ( type->get_const() ) {
     349                                                mangleName << Encoding::qualifiers.at(Type::Const);
     350                                        } // if
     351                                        if ( type->get_volatile() ) {
     352                                                mangleName << Encoding::qualifiers.at(Type::Volatile);
     353                                        } // if
     354                                        // Removed due to restrict not affecting function compatibility in GCC
     355                                        // if ( type->get_isRestrict() ) {
     356                                        //      mangleName << "E";
     357                                        // } // if
     358                                        if ( type->get_atomic() ) {
     359                                                mangleName << Encoding::qualifiers.at(Type::Atomic);
     360                                        } // if
     361                                }
     362                                if ( type->get_mutex() ) {
     363                                        mangleName << Encoding::qualifiers.at(Type::Mutex);
     364                                } // if
     365                                if ( type->get_lvalue() ) {
     366                                        // mangle based on whether the type is lvalue, so that the resolver can differentiate lvalues and rvalues
     367                                        mangleName << Encoding::qualifiers.at(Type::Lvalue);
     368                                }
     369
     370                                if ( inFunctionType ) {
     371                                        // turn off inFunctionType so that types can be differentiated for nested qualifiers
     372                                        GuardValue( inFunctionType );
     373                                        inFunctionType = false;
     374                                }
     375                        }
     376                }       // namespace
     377        } // namespace Mangler
    314378} // namespace SymTab
    315379
  • src/SymTab/Mangler.h

    rf9feab8 r90152a4  
    2424#include "SynTree/Visitor.h"  // for Visitor, maybeAccept
    2525
     26// https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling
     27// The CFA name mangling scheme is based closely on the itanium C++ name mangling scheme, with the following key differences:
     28// * Variable names are also mangled to include type information, not just functions
     29// * CFA does not have template expansion, so the rules for function specialization do not apply.
     30// * CFA instead has to handle type parameters and assertion parameters.
     31// * Currently name compression is not implemented.
     32
    2633namespace SymTab {
    27         /// Mangles names to a unique C identifier
    28         class Mangler : public Visitor {
    29           public:
     34        namespace Mangler {
    3035                /// Mangle syntax tree object; primary interface to clients
    31                 template< typename SynTreeClass >
    32             static std::string mangle( SynTreeClass *decl, bool mangleOverridable = true, bool typeMode = false, bool mangleGenericParams = true );
     36                std::string mangle( BaseSyntaxNode * decl, bool mangleOverridable = true, bool typeMode = false, bool mangleGenericParams = true );
     37
    3338                /// Mangle a type name; secondary interface
    34                 static std::string mangleType( Type* ty );
     39                std::string mangleType( Type* ty );
    3540                /// Mangle ignoring generic type parameters
    36                 static std::string mangleConcrete( Type* ty );
     41                std::string mangleConcrete( Type* ty );
    3742
     43                namespace Encoding {
     44                        extern const std::string manglePrefix;
     45                        extern const std::string basicTypes[];
     46                        extern const std::map<int, std::string> qualifiers;
    3847
    39                 virtual void visit( ObjectDecl *declaration );
    40                 virtual void visit( FunctionDecl *declaration );
    41                 virtual void visit( TypeDecl *declaration );
     48                        extern const std::string void_t;
     49                        extern const std::string zero;
     50                        extern const std::string one;
    4251
    43                 virtual void visit( VoidType *voidType );
    44                 virtual void visit( BasicType *basicType );
    45                 virtual void visit( PointerType *pointerType );
    46                 virtual void visit( ArrayType *arrayType );
    47                 virtual void visit( ReferenceType *refType );
    48                 virtual void visit( FunctionType *functionType );
    49                 virtual void visit( StructInstType *aggregateUseType );
    50                 virtual void visit( UnionInstType *aggregateUseType );
    51                 virtual void visit( EnumInstType *aggregateUseType );
    52                 virtual void visit( TypeInstType *aggregateUseType );
    53                 virtual void visit( TupleType *tupleType );
    54                 virtual void visit( VarArgsType *varArgsType );
    55                 virtual void visit( ZeroType *zeroType );
    56                 virtual void visit( OneType *oneType );
     52                        extern const std::string function;
     53                        extern const std::string tuple;
     54                        extern const std::string pointer;
     55                        extern const std::string array;
     56                        extern const std::string qualifiedTypeStart;
     57                        extern const std::string qualifiedTypeEnd;
    5758
    58                 std::string get_mangleName() { return mangleName.str(); }
    59           private:
    60                 std::ostringstream mangleName;  ///< Mangled name being constructed
    61                 typedef std::map< std::string, std::pair< int, int > > VarMapType;
    62                 VarMapType varNums;             ///< Map of type variables to indices
    63                 int nextVarNum;                 ///< Next type variable index
    64                 bool isTopLevel;                ///< Is the Mangler at the top level
    65                 bool mangleOverridable;         ///< Specially mangle overridable built-in methods
    66                 bool typeMode;                  ///< Produce a unique mangled name for a type
    67                 bool mangleGenericParams;       ///< Include generic parameters in name mangling if true
     59                        extern const std::string forall;
     60                        extern const std::string typeVariables[];
    6861
    69                 Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams );
    70                 Mangler( const Mangler & );
     62                        extern const std::string struct_t;
     63                        extern const std::string union_t;
     64                        extern const std::string enum_t;
     65                        extern const std::string type;
    7166
    72                 void mangleDecl( DeclarationWithType *declaration );
    73                 void mangleRef( ReferenceToType *refType, std::string prefix );
     67                        extern const std::string autogen;
     68                        extern const std::string intrinsic;
     69                };
     70        } // Mangler
     71} // SymTab
    7472
    75                 void printQualifiers( Type *type );
    76         }; // Mangler
    77 
    78         template< typename SynTreeClass >
    79         std::string Mangler::mangle( SynTreeClass *decl, bool mangleOverridable, bool typeMode, bool mangleGenericParams ) {
    80                 Mangler mangler( mangleOverridable, typeMode, mangleGenericParams );
    81                 maybeAccept( decl, mangler );
    82                 return mangler.get_mangleName();
    83         }
    84 } // SymTab
     73extern "C" {
     74        char * cforall_demangle(const char *, int);
     75}
    8576
    8677// Local Variables: //
  • src/SymTab/Validate.cc

    rf9feab8 r90152a4  
    4848#include "CodeGen/CodeGenerator.h"     // for genName
    4949#include "CodeGen/OperatorTable.h"     // for isCtorDtor, isCtorDtorAssign
     50#include "ControlStruct/Mutate.h"      // for ForExprMutator
    5051#include "Common/PassVisitor.h"        // for PassVisitor, WithDeclsToAdd
    5152#include "Common/ScopedMap.h"          // for ScopedMap
     
    6061#include "Parser/LinkageSpec.h"        // for C
    6162#include "ResolvExpr/typeops.h"        // for typesCompatible
    62 #include "SymTab/AddVisit.h"           // for addVisit
     63#include "ResolvExpr/Resolver.h"       // for findSingleExpression
     64#include "ResolvExpr/ResolveTypeof.h"  // for resolveTypeof
    6365#include "SymTab/Autogen.h"            // for SizeType
    6466#include "SynTree/Attribute.h"         // for noAttributes, Attribute
     
    7274#include "SynTree/TypeSubstitution.h"  // for TypeSubstitution
    7375#include "SynTree/Visitor.h"           // for Visitor
     76#include "Validate/HandleAttributes.h" // for handleAttributes
    7477
    7578class CompoundStmt;
     
    7780class SwitchStmt;
    7881
    79 
    80 #define debugPrint( x ) if ( doDebug ) { std::cout << x; }
     82#define debugPrint( x ) if ( doDebug ) x
    8183
    8284namespace SymTab {
     85        /// hoists declarations that are difficult to hoist while parsing
     86        struct HoistTypeDecls final : public WithDeclsToAdd {
     87                void previsit( SizeofExpr * );
     88                void previsit( AlignofExpr * );
     89                void previsit( UntypedOffsetofExpr * );
     90                void previsit( CompoundLiteralExpr * );
     91                void handleType( Type * );
     92        };
     93
     94        struct FixQualifiedTypes final : public WithIndexer {
     95                Type * postmutate( QualifiedType * );
     96        };
     97
    8398        struct HoistStruct final : public WithDeclsToAdd, public WithGuards {
    8499                /// Flattens nested struct types
    85100                static void hoistStruct( std::list< Declaration * > &translationUnit );
    86101
    87                 void previsit( EnumInstType * enumInstType );
    88                 void previsit( StructInstType * structInstType );
    89                 void previsit( UnionInstType * unionInstType );
    90102                void previsit( StructDecl * aggregateDecl );
    91103                void previsit( UnionDecl * aggregateDecl );
     104                void previsit( StaticAssertDecl * assertDecl );
     105                void previsit( StructInstType * type );
     106                void previsit( UnionInstType * type );
     107                void previsit( EnumInstType * type );
    92108
    93109          private:
    94110                template< typename AggDecl > void handleAggregate( AggDecl *aggregateDecl );
    95111
    96                 bool inStruct = false;
     112                AggregateDecl * parentAggr = nullptr;
    97113        };
    98114
     
    112128
    113129        /// Associates forward declarations of aggregates with their definitions
    114         struct LinkReferenceToTypes final : public WithIndexer, public WithGuards {
     130        struct LinkReferenceToTypes final : public WithIndexer, public WithGuards, public WithVisitorRef<LinkReferenceToTypes>, public WithShortCircuiting {
    115131                LinkReferenceToTypes( const Indexer *indexer );
    116132                void postvisit( TypeInstType *typeInst );
     
    120136                void postvisit( UnionInstType *unionInst );
    121137                void postvisit( TraitInstType *traitInst );
     138                void previsit( QualifiedType * qualType );
     139                void postvisit( QualifiedType * qualType );
    122140
    123141                void postvisit( EnumDecl *enumDecl );
     
    148166                void previsit( ObjectDecl * object );
    149167                void previsit( FunctionDecl * func );
     168                void previsit( FunctionType * ftype );
    150169                void previsit( StructDecl * aggrDecl );
    151170                void previsit( UnionDecl * aggrDecl );
     
    164183        };
    165184
    166         struct EliminateTypedef final : public WithVisitorRef<EliminateTypedef>, public WithGuards {
    167                 EliminateTypedef() : scopeLevel( 0 ) {}
     185        struct ReplaceTypedef final : public WithVisitorRef<ReplaceTypedef>, public WithGuards, public WithShortCircuiting, public WithDeclsToAdd {
     186                ReplaceTypedef() : scopeLevel( 0 ) {}
    168187                /// Replaces typedefs by forward declarations
    169                 static void eliminateTypedef( std::list< Declaration * > &translationUnit );
    170 
     188                static void replaceTypedef( std::list< Declaration * > &translationUnit );
     189
     190                void premutate( QualifiedType * );
     191                Type * postmutate( QualifiedType * qualType );
    171192                Type * postmutate( TypeInstType * aggregateUseType );
    172193                Declaration * postmutate( TypedefDecl * typeDecl );
     
    179200
    180201                void premutate( CompoundStmt * compoundStmt );
    181                 CompoundStmt * postmutate( CompoundStmt * compoundStmt );
    182202
    183203                void premutate( StructDecl * structDecl );
    184                 Declaration * postmutate( StructDecl * structDecl );
    185204                void premutate( UnionDecl * unionDecl );
    186                 Declaration * postmutate( UnionDecl * unionDecl );
    187205                void premutate( EnumDecl * enumDecl );
    188                 Declaration * postmutate( EnumDecl * enumDecl );
    189                 Declaration * postmutate( TraitDecl * contextDecl );
     206                void premutate( TraitDecl * );
    190207
    191208                void premutate( FunctionType * ftype );
     
    193210          private:
    194211                template<typename AggDecl>
    195                 AggDecl *handleAggregate( AggDecl * aggDecl );
    196 
    197                 template<typename AggDecl>
    198212                void addImplicitTypedef( AggDecl * aggDecl );
     213                template< typename AggDecl >
     214                void handleAggregate( AggDecl * aggr );
    199215
    200216                typedef std::unique_ptr<TypedefDecl> TypedefDeclPtr;
    201217                typedef ScopedMap< std::string, std::pair< TypedefDeclPtr, int > > TypedefMap;
    202                 typedef std::map< std::string, TypeDecl * > TypeDeclMap;
     218                typedef ScopedMap< std::string, TypeDecl * > TypeDeclMap;
    203219                TypedefMap typedefNames;
    204220                TypeDeclMap typedeclNames;
    205221                int scopeLevel;
    206222                bool inFunctionType = false;
     223        };
     224
     225        struct EliminateTypedef {
     226                /// removes TypedefDecls from the AST
     227                static void eliminateTypedef( std::list< Declaration * > &translationUnit );
     228
     229                template<typename AggDecl>
     230                void handleAggregate( AggDecl *aggregateDecl );
     231
     232                void previsit( StructDecl * aggregateDecl );
     233                void previsit( UnionDecl * aggregateDecl );
     234                void previsit( CompoundStmt * compoundStmt );
    207235        };
    208236
     
    222250        };
    223251
    224         struct ArrayLength {
     252        struct FixObjectType : public WithIndexer {
     253                /// resolves typeof type in object, function, and type declarations
     254                static void fix( std::list< Declaration * > & translationUnit );
     255
     256                void previsit( ObjectDecl * );
     257                void previsit( FunctionDecl * );
     258                void previsit( TypeDecl * );
     259        };
     260
     261        struct ArrayLength : public WithIndexer {
    225262                /// for array types without an explicit length, compute the length and store it so that it
    226263                /// is known to the rest of the phases. For example,
     
    233270
    234271                void previsit( ObjectDecl * objDecl );
     272                void previsit( ArrayType * arrayType );
    235273        };
    236274
     
    262300                PassVisitor<FindSpecialDeclarations> finder;
    263301                PassVisitor<LabelAddressFixer> labelAddrFixer;
    264 
    265                 EliminateTypedef::eliminateTypedef( translationUnit );
    266                 HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
     302                PassVisitor<HoistTypeDecls> hoistDecls;
     303                PassVisitor<FixQualifiedTypes> fixQual;
     304
     305                acceptAll( translationUnit, hoistDecls );
     306                ReplaceTypedef::replaceTypedef( translationUnit );
    267307                ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
    268308                acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes because it is an indexer and needs correct types for mangling
    269309                acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
     310                mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes, because aggregate members are accessed
     311                HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
     312                EliminateTypedef::eliminateTypedef( translationUnit ); //
    270313                acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes
    271314                VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
     
    274317                Concurrency::applyKeywords( translationUnit );
    275318                acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
     319                ControlStruct::hoistControlDecls( translationUnit );  // hoist initialization out of for statements; must happen before autogenerateRoutines
    276320                autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay
    277321                Concurrency::implementMutexFuncs( translationUnit );
    278322                Concurrency::implementThreadStarter( translationUnit );
    279323                mutateAll( translationUnit, compoundliteral );
     324                ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables
     325                FixObjectType::fix( translationUnit );
    280326                ArrayLength::computeLength( translationUnit );
    281327                acceptAll( translationUnit, finder ); // xxx - remove this pass soon
    282328                mutateAll( translationUnit, labelAddrFixer );
     329                Validate::handleAttributes( translationUnit );
    283330        }
    284331
     
    292339        }
    293340
     341
     342        void HoistTypeDecls::handleType( Type * type ) {
     343                // some type declarations are buried in expressions and not easy to hoist during parsing; hoist them here
     344                AggregateDecl * aggr = nullptr;
     345                if ( StructInstType * inst = dynamic_cast< StructInstType * >( type ) ) {
     346                        aggr = inst->baseStruct;
     347                } else if ( UnionInstType * inst = dynamic_cast< UnionInstType * >( type ) ) {
     348                        aggr = inst->baseUnion;
     349                } else if ( EnumInstType * inst = dynamic_cast< EnumInstType * >( type ) ) {
     350                        aggr = inst->baseEnum;
     351                }
     352                if ( aggr && aggr->body ) {
     353                        declsToAddBefore.push_front( aggr );
     354                }
     355        }
     356
     357        void HoistTypeDecls::previsit( SizeofExpr * expr ) {
     358                handleType( expr->type );
     359        }
     360
     361        void HoistTypeDecls::previsit( AlignofExpr * expr ) {
     362                handleType( expr->type );
     363        }
     364
     365        void HoistTypeDecls::previsit( UntypedOffsetofExpr * expr ) {
     366                handleType( expr->type );
     367        }
     368
     369        void HoistTypeDecls::previsit( CompoundLiteralExpr * expr ) {
     370                handleType( expr->result );
     371        }
     372
     373
     374        Type * FixQualifiedTypes::postmutate( QualifiedType * qualType ) {
     375                Type * parent = qualType->parent;
     376                Type * child = qualType->child;
     377                if ( dynamic_cast< GlobalScopeType * >( qualType->parent ) ) {
     378                        // .T => lookup T at global scope
     379                        if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( child ) ) {
     380                                auto td = indexer.globalLookupType( inst->name );
     381                                if ( ! td ) {
     382                                        SemanticError( qualType->location, toString("Use of undefined global type ", inst->name) );
     383                                }
     384                                auto base = td->base;
     385                                assert( base );
     386                                Type * ret = base->clone();
     387                                ret->get_qualifiers() = qualType->get_qualifiers();
     388                                return ret;
     389                        } else {
     390                                // .T => T is not a type name
     391                                assertf( false, "unhandled global qualified child type: %s", toCString(child) );
     392                        }
     393                } else {
     394                        // S.T => S must be an aggregate type, find the declaration for T in S.
     395                        AggregateDecl * aggr = nullptr;
     396                        if ( StructInstType * inst = dynamic_cast< StructInstType * >( parent ) ) {
     397                                aggr = inst->baseStruct;
     398                        } else if ( UnionInstType * inst = dynamic_cast< UnionInstType * > ( parent ) ) {
     399                                aggr = inst->baseUnion;
     400                        } else {
     401                                SemanticError( qualType->location, toString("Qualified type requires an aggregate on the left, but has: ", parent) );
     402                        }
     403                        assert( aggr ); // TODO: need to handle forward declarations
     404                        for ( Declaration * member : aggr->members ) {
     405                                if ( StructInstType * inst = dynamic_cast< StructInstType * >( child ) ) {
     406                                        if ( StructDecl * aggr = dynamic_cast< StructDecl * >( member ) ) {
     407                                                if ( aggr->name == inst->name ) {
     408                                                        // TODO: is this case, and other non-TypeInstType cases, necessary?
     409                                                        return new StructInstType( qualType->get_qualifiers(), aggr );
     410                                                }
     411                                        }
     412                                } else if ( UnionInstType * inst = dynamic_cast< UnionInstType * >( child ) ) {
     413                                        if ( UnionDecl * aggr = dynamic_cast< UnionDecl * > ( member ) ) {
     414                                                if ( aggr->name == inst->name ) {
     415                                                        return new UnionInstType( qualType->get_qualifiers(), aggr );
     416                                                }
     417                                        }
     418                                } else if ( EnumInstType * inst = dynamic_cast< EnumInstType * >( child ) ) {
     419                                        if ( EnumDecl * aggr = dynamic_cast< EnumDecl * > ( member ) ) {
     420                                                if ( aggr->name == inst->name ) {
     421                                                        return new EnumInstType( qualType->get_qualifiers(), aggr );
     422                                                }
     423                                        }
     424                                } else if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( child ) ) {
     425                                        // name on the right is a typedef
     426                                        if ( NamedTypeDecl * aggr = dynamic_cast< NamedTypeDecl * > ( member ) ) {
     427                                                if ( aggr->name == inst->name ) {
     428                                                        assert( aggr->base );
     429                                                        Type * ret = aggr->base->clone();
     430                                                        ret->get_qualifiers() = qualType->get_qualifiers();
     431                                                        return ret;
     432                                                }
     433                                        }
     434                                } else {
     435                                        // S.T - S is not an aggregate => error
     436                                        assertf( false, "unhandled qualified child type: %s", toCString(qualType) );
     437                                }
     438                        }
     439                        // failed to find a satisfying definition of type
     440                        SemanticError( qualType->location, toString("Undefined type in qualified type: ", qualType) );
     441                }
     442
     443                // ... may want to link canonical SUE definition to each forward decl so that it becomes easier to lookup?
     444        }
     445
     446
    294447        void HoistStruct::hoistStruct( std::list< Declaration * > &translationUnit ) {
    295448                PassVisitor<HoistStruct> hoister;
     
    297450        }
    298451
    299         bool isStructOrUnion( Declaration *decl ) {
    300                 return dynamic_cast< StructDecl * >( decl ) || dynamic_cast< UnionDecl * >( decl );
     452        bool shouldHoist( Declaration *decl ) {
     453                return dynamic_cast< StructDecl * >( decl ) || dynamic_cast< UnionDecl * >( decl ) || dynamic_cast< StaticAssertDecl * >( decl );
     454        }
     455
     456        namespace {
     457                void qualifiedName( AggregateDecl * aggr, std::ostringstream & ss ) {
     458                        if ( aggr->parent ) qualifiedName( aggr->parent, ss );
     459                        ss << "__" << aggr->name;
     460                }
     461
     462                // mangle nested type names using entire parent chain
     463                std::string qualifiedName( AggregateDecl * aggr ) {
     464                        std::ostringstream ss;
     465                        qualifiedName( aggr, ss );
     466                        return ss.str();
     467                }
    301468        }
    302469
    303470        template< typename AggDecl >
    304471        void HoistStruct::handleAggregate( AggDecl *aggregateDecl ) {
    305                 if ( inStruct ) {
     472                if ( parentAggr ) {
     473                        aggregateDecl->parent = parentAggr;
     474                        aggregateDecl->name = qualifiedName( aggregateDecl );
    306475                        // Add elements in stack order corresponding to nesting structure.
    307476                        declsToAddBefore.push_front( aggregateDecl );
    308477                } else {
    309                         GuardValue( inStruct );
    310                         inStruct = true;
     478                        GuardValue( parentAggr );
     479                        parentAggr = aggregateDecl;
    311480                } // if
    312481                // Always remove the hoisted aggregate from the inner structure.
    313                 GuardAction( [aggregateDecl]() { filter( aggregateDecl->members, isStructOrUnion, false ); } );
    314         }
    315 
    316         void HoistStruct::previsit( EnumInstType * inst ) {
    317                 if ( inst->baseEnum ) {
    318                         declsToAddBefore.push_front( inst->baseEnum );
    319                 }
    320         }
    321 
    322         void HoistStruct::previsit( StructInstType * inst ) {
    323                 if ( inst->baseStruct ) {
    324                         declsToAddBefore.push_front( inst->baseStruct );
    325                 }
    326         }
    327 
    328         void HoistStruct::previsit( UnionInstType * inst ) {
    329                 if ( inst->baseUnion ) {
    330                         declsToAddBefore.push_front( inst->baseUnion );
     482                GuardAction( [aggregateDecl]() { filter( aggregateDecl->members, shouldHoist, false ); } );
     483        }
     484
     485        void HoistStruct::previsit( StaticAssertDecl * assertDecl ) {
     486                if ( parentAggr ) {
     487                        declsToAddBefore.push_back( assertDecl );
    331488                }
    332489        }
     
    340497        }
    341498
     499        void HoistStruct::previsit( StructInstType * type ) {
     500                // need to reset type name after expanding to qualified name
     501                assert( type->baseStruct );
     502                type->name = type->baseStruct->name;
     503        }
     504
     505        void HoistStruct::previsit( UnionInstType * type ) {
     506                assert( type->baseUnion );
     507                type->name = type->baseUnion->name;
     508        }
     509
     510        void HoistStruct::previsit( EnumInstType * type ) {
     511                assert( type->baseEnum );
     512                type->name = type->baseEnum->name;
     513        }
     514
     515
     516        bool isTypedef( Declaration *decl ) {
     517                return dynamic_cast< TypedefDecl * >( decl );
     518        }
     519
     520        void EliminateTypedef::eliminateTypedef( std::list< Declaration * > &translationUnit ) {
     521                PassVisitor<EliminateTypedef> eliminator;
     522                acceptAll( translationUnit, eliminator );
     523                filter( translationUnit, isTypedef, true );
     524        }
     525
     526        template< typename AggDecl >
     527        void EliminateTypedef::handleAggregate( AggDecl *aggregateDecl ) {
     528                filter( aggregateDecl->members, isTypedef, true );
     529        }
     530
     531        void EliminateTypedef::previsit( StructDecl * aggregateDecl ) {
     532                handleAggregate( aggregateDecl );
     533        }
     534
     535        void EliminateTypedef::previsit( UnionDecl * aggregateDecl ) {
     536                handleAggregate( aggregateDecl );
     537        }
     538
     539        void EliminateTypedef::previsit( CompoundStmt * compoundStmt ) {
     540                // remove and delete decl stmts
     541                filter( compoundStmt->kids, [](Statement * stmt) {
     542                        if ( DeclStmt *declStmt = dynamic_cast< DeclStmt * >( stmt ) ) {
     543                                if ( dynamic_cast< TypedefDecl * >( declStmt->decl ) ) {
     544                                        return true;
     545                                } // if
     546                        } // if
     547                        return false;
     548                }, true);
     549        }
     550
    342551        void EnumAndPointerDecay::previsit( EnumDecl *enumDecl ) {
    343552                // Set the type of each member of the enumeration to be EnumConstant
    344                 for ( std::list< Declaration * >::iterator i = enumDecl->get_members().begin(); i != enumDecl->get_members().end(); ++i ) {
     553                for ( std::list< Declaration * >::iterator i = enumDecl->members.begin(); i != enumDecl->members.end(); ++i ) {
    345554                        ObjectDecl * obj = dynamic_cast< ObjectDecl * >( *i );
    346555                        assert( obj );
    347                         obj->set_type( new EnumInstType( Type::Qualifiers( Type::Const ), enumDecl->get_name() ) );
     556                        obj->set_type( new EnumInstType( Type::Qualifiers( Type::Const ), enumDecl->name ) );
    348557                } // for
    349558        }
     
    351560        namespace {
    352561                template< typename DWTList >
    353                 void fixFunctionList( DWTList & dwts, FunctionType * func ) {
    354                         // the only case in which "void" is valid is where it is the only one in the list; then it should be removed
    355                         // entirely. other fix ups are handled by the FixFunction class
    356                         typedef typename DWTList::iterator DWTIterator;
    357                         DWTIterator begin( dwts.begin() ), end( dwts.end() );
    358                         if ( begin == end ) return;
    359                         PassVisitor<FixFunction> fixer;
    360                         DWTIterator i = begin;
    361                         *i = (*i)->acceptMutator( fixer );
    362                         if ( fixer.pass.isVoid ) {
    363                                 DWTIterator j = i;
    364                                 ++i;
    365                                 delete *j;
    366                                 dwts.erase( j );
    367                                 if ( i != end ) {
    368                                         throw SemanticError( "invalid type void in function type ", func );
    369                                 } // if
    370                         } else {
    371                                 ++i;
    372                                 for ( ; i != end; ++i ) {
    373                                         PassVisitor<FixFunction> fixer;
    374                                         *i = (*i)->acceptMutator( fixer );
    375                                         if ( fixer.pass.isVoid ) {
    376                                                 throw SemanticError( "invalid type void in function type ", func );
    377                                         } // if
    378                                 } // for
    379                         } // if
     562                void fixFunctionList( DWTList & dwts, bool isVarArgs, FunctionType * func ) {
     563                        auto nvals = dwts.size();
     564                        bool containsVoid = false;
     565                        for ( auto & dwt : dwts ) {
     566                                // fix each DWT and record whether a void was found
     567                                containsVoid |= fixFunction( dwt );
     568                        }
     569
     570                        // the only case in which "void" is valid is where it is the only one in the list
     571                        if ( containsVoid && ( nvals > 1 || isVarArgs ) ) {
     572                                SemanticError( func, "invalid type void in function type " );
     573                        }
     574
     575                        // one void is the only thing in the list; remove it.
     576                        if ( containsVoid ) {
     577                                delete dwts.front();
     578                                dwts.clear();
     579                        }
    380580                }
    381581        }
     
    383583        void EnumAndPointerDecay::previsit( FunctionType *func ) {
    384584                // Fix up parameters and return types
    385                 fixFunctionList( func->get_parameters(), func );
    386                 fixFunctionList( func->get_returnVals(), func );
     585                fixFunctionList( func->parameters, func->isVarArgs, func );
     586                fixFunctionList( func->returnVals, false, func );
    387587        }
    388588
     
    396596
    397597        void LinkReferenceToTypes::postvisit( EnumInstType *enumInst ) {
    398                 EnumDecl *st = local_indexer->lookupEnum( enumInst->get_name() );
     598                EnumDecl *st = local_indexer->lookupEnum( enumInst->name );
    399599                // it's not a semantic error if the enum is not found, just an implicit forward declaration
    400600                if ( st ) {
    401                         //assert( ! enumInst->get_baseEnum() || enumInst->get_baseEnum()->get_members().empty() || ! st->get_members().empty() );
    402                         enumInst->set_baseEnum( st );
    403                 } // if
    404                 if ( ! st || st->get_members().empty() ) {
     601                        enumInst->baseEnum = st;
     602                } // if
     603                if ( ! st || ! st->body ) {
    405604                        // use of forward declaration
    406                         forwardEnums[ enumInst->get_name() ].push_back( enumInst );
     605                        forwardEnums[ enumInst->name ].push_back( enumInst );
    407606                } // if
    408607        }
     
    411610                for ( Expression * param : inst->parameters ) {
    412611                        if ( ! dynamic_cast< TypeExpr * >( param ) ) {
    413                                 throw SemanticError( "Expression parameters for generic types are currently unsupported: ", inst );
     612                                SemanticError( inst, "Expression parameters for generic types are currently unsupported: " );
    414613                        }
    415614                }
     
    417616
    418617        void LinkReferenceToTypes::postvisit( StructInstType *structInst ) {
    419                 StructDecl *st = local_indexer->lookupStruct( structInst->get_name() );
     618                StructDecl *st = local_indexer->lookupStruct( structInst->name );
    420619                // it's not a semantic error if the struct is not found, just an implicit forward declaration
    421620                if ( st ) {
    422                         //assert( ! structInst->get_baseStruct() || structInst->get_baseStruct()->get_members().empty() || ! st->get_members().empty() );
    423                         structInst->set_baseStruct( st );
    424                 } // if
    425                 if ( ! st || st->get_members().empty() ) {
     621                        structInst->baseStruct = st;
     622                } // if
     623                if ( ! st || ! st->body ) {
    426624                        // use of forward declaration
    427                         forwardStructs[ structInst->get_name() ].push_back( structInst );
     625                        forwardStructs[ structInst->name ].push_back( structInst );
    428626                } // if
    429627                checkGenericParameters( structInst );
     
    431629
    432630        void LinkReferenceToTypes::postvisit( UnionInstType *unionInst ) {
    433                 UnionDecl *un = local_indexer->lookupUnion( unionInst->get_name() );
     631                UnionDecl *un = local_indexer->lookupUnion( unionInst->name );
    434632                // it's not a semantic error if the union is not found, just an implicit forward declaration
    435633                if ( un ) {
    436                         unionInst->set_baseUnion( un );
    437                 } // if
    438                 if ( ! un || un->get_members().empty() ) {
     634                        unionInst->baseUnion = un;
     635                } // if
     636                if ( ! un || ! un->body ) {
    439637                        // use of forward declaration
    440                         forwardUnions[ unionInst->get_name() ].push_back( unionInst );
     638                        forwardUnions[ unionInst->name ].push_back( unionInst );
    441639                } // if
    442640                checkGenericParameters( unionInst );
     641        }
     642
     643        void LinkReferenceToTypes::previsit( QualifiedType * ) {
     644                visit_children = false;
     645        }
     646
     647        void LinkReferenceToTypes::postvisit( QualifiedType * qualType ) {
     648                // linking only makes sense for the 'oldest ancestor' of the qualified type
     649                qualType->parent->accept( *visitor );
    443650        }
    444651
     
    451658                        DeclarationWithType * dwt2 = dynamic_cast<DeclarationWithType *>( d2 );
    452659                        if ( dwt1 && dwt2 ) {
    453                                 if ( dwt1->get_name() == dwt2->get_name() && ResolvExpr::typesCompatible( dwt1->get_type(), dwt2->get_type(), SymTab::Indexer() ) ) {
     660                                if ( dwt1->name == dwt2->name && ResolvExpr::typesCompatible( dwt1->get_type(), dwt2->get_type(), SymTab::Indexer() ) ) {
    454661                                        // std::cerr << "=========== equal:" << std::endl;
    455662                                        // std::cerr << "d1: " << d1 << std::endl;
     
    476683        template< typename Iterator >
    477684        void expandAssertions( TraitInstType * inst, Iterator out ) {
    478                 assertf( inst->baseTrait, "Trait instance not linked to base trait: %s", toString( inst ).c_str() );
     685                assertf( inst->baseTrait, "Trait instance not linked to base trait: %s", toCString( inst ) );
    479686                std::list< DeclarationWithType * > asserts;
    480687                for ( Declaration * decl : inst->baseTrait->members ) {
     
    511718                TraitDecl *traitDecl = local_indexer->lookupTrait( traitInst->name );
    512719                if ( ! traitDecl ) {
    513                         throw SemanticError( "use of undeclared trait " + traitInst->name );
    514                 } // if
    515                 if ( traitDecl->get_parameters().size() != traitInst->get_parameters().size() ) {
    516                         throw SemanticError( "incorrect number of trait parameters: ", traitInst );
     720                        SemanticError( traitInst->location, "use of undeclared trait " + traitInst->name );
     721                } // if
     722                if ( traitDecl->parameters.size() != traitInst->parameters.size() ) {
     723                        SemanticError( traitInst, "incorrect number of trait parameters: " );
    517724                } // if
    518725                traitInst->baseTrait = traitDecl;
    519726
    520727                // need to carry over the 'sized' status of each decl in the instance
    521                 for ( auto p : group_iterate( traitDecl->get_parameters(), traitInst->get_parameters() ) ) {
     728                for ( auto p : group_iterate( traitDecl->parameters, traitInst->parameters ) ) {
    522729                        TypeExpr * expr = dynamic_cast< TypeExpr * >( std::get<1>(p) );
    523730                        if ( ! expr ) {
    524                                 throw SemanticError( "Expression parameters for trait instances are currently unsupported: ", std::get<1>(p) );
     731                                SemanticError( std::get<1>(p), "Expression parameters for trait instances are currently unsupported: " );
    525732                        }
    526733                        if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( expr->get_type() ) ) {
    527734                                TypeDecl * formalDecl = std::get<0>(p);
    528                                 TypeDecl * instDecl = inst->get_baseType();
     735                                TypeDecl * instDecl = inst->baseType;
    529736                                if ( formalDecl->get_sized() ) instDecl->set_sized( true );
    530737                        }
     
    535742        void LinkReferenceToTypes::postvisit( EnumDecl *enumDecl ) {
    536743                // visit enum members first so that the types of self-referencing members are updated properly
    537                 if ( ! enumDecl->get_members().empty() ) {
    538                         ForwardEnumsType::iterator fwds = forwardEnums.find( enumDecl->get_name() );
     744                if ( enumDecl->body ) {
     745                        ForwardEnumsType::iterator fwds = forwardEnums.find( enumDecl->name );
    539746                        if ( fwds != forwardEnums.end() ) {
    540747                                for ( std::list< EnumInstType * >::iterator inst = fwds->second.begin(); inst != fwds->second.end(); ++inst ) {
    541                                         (*inst )->set_baseEnum( enumDecl );
     748                                        (*inst)->baseEnum = enumDecl;
    542749                                } // for
    543750                                forwardEnums.erase( fwds );
    544751                        } // if
     752
     753                        for ( Declaration * member : enumDecl->members ) {
     754                                ObjectDecl * field = strict_dynamic_cast<ObjectDecl *>( member );
     755                                if ( field->init ) {
     756                                        // need to resolve enumerator initializers early so that other passes that determine if an expression is constexpr have the appropriate information.
     757                                        SingleInit * init = strict_dynamic_cast<SingleInit *>( field->init );
     758                                        ResolvExpr::findSingleExpression( init->value, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), indexer );
     759                                }
     760                        }
    545761                } // if
    546762        }
     
    575791                // visit struct members first so that the types of self-referencing members are updated properly
    576792                // xxx - need to ensure that type parameters match up between forward declarations and definition (most importantly, number of type parameters and their defaults)
    577                 if ( ! structDecl->get_members().empty() ) {
    578                         ForwardStructsType::iterator fwds = forwardStructs.find( structDecl->get_name() );
     793                if ( structDecl->body ) {
     794                        ForwardStructsType::iterator fwds = forwardStructs.find( structDecl->name );
    579795                        if ( fwds != forwardStructs.end() ) {
    580796                                for ( std::list< StructInstType * >::iterator inst = fwds->second.begin(); inst != fwds->second.end(); ++inst ) {
    581                                         (*inst )->set_baseStruct( structDecl );
     797                                        (*inst)->baseStruct = structDecl;
    582798                                } // for
    583799                                forwardStructs.erase( fwds );
     
    587803
    588804        void LinkReferenceToTypes::postvisit( UnionDecl *unionDecl ) {
    589                 if ( ! unionDecl->get_members().empty() ) {
    590                         ForwardUnionsType::iterator fwds = forwardUnions.find( unionDecl->get_name() );
     805                if ( unionDecl->body ) {
     806                        ForwardUnionsType::iterator fwds = forwardUnions.find( unionDecl->name );
    591807                        if ( fwds != forwardUnions.end() ) {
    592808                                for ( std::list< UnionInstType * >::iterator inst = fwds->second.begin(); inst != fwds->second.end(); ++inst ) {
    593                                         (*inst )->set_baseUnion( unionDecl );
     809                                        (*inst)->baseUnion = unionDecl;
    594810                                } // for
    595811                                forwardUnions.erase( fwds );
     
    601817                // ensure generic parameter instances are renamed like the base type
    602818                if ( inGeneric && typeInst->baseType ) typeInst->name = typeInst->baseType->name;
    603                 if ( NamedTypeDecl *namedTypeDecl = local_indexer->lookupType( typeInst->get_name() ) ) {
     819                if ( NamedTypeDecl *namedTypeDecl = local_indexer->lookupType( typeInst->name ) ) {
    604820                        if ( TypeDecl *typeDecl = dynamic_cast< TypeDecl * >( namedTypeDecl ) ) {
    605821                                typeInst->set_isFtype( typeDecl->get_kind() == TypeDecl::Ftype );
     
    626842                        // apply FixFunction to every assertion to check for invalid void type
    627843                        for ( DeclarationWithType *& assertion : type->assertions ) {
    628                                 PassVisitor<FixFunction> fixer;
    629                                 assertion = assertion->acceptMutator( fixer );
    630                                 if ( fixer.pass.isVoid ) {
    631                                         throw SemanticError( "invalid type void in assertion of function ", node );
     844                                bool isVoid = fixFunction( assertion );
     845                                if ( isVoid ) {
     846                                        SemanticError( node, "invalid type void in assertion of function " );
    632847                                } // if
    633848                        } // for
     
    637852
    638853        void ForallPointerDecay::previsit( ObjectDecl *object ) {
    639                 forallFixer( object->type->forall, object );
    640                 if ( PointerType *pointer = dynamic_cast< PointerType * >( object->type ) ) {
    641                         forallFixer( pointer->base->forall, object );
    642                 } // if
     854                // ensure that operator names only apply to functions or function pointers
     855                if ( CodeGen::isOperator( object->name ) && ! dynamic_cast< FunctionType * >( object->type->stripDeclarator() ) ) {
     856                        SemanticError( object->location, toCString( "operator ", object->name.c_str(), " is not a function or function pointer." ) );
     857                }
    643858                object->fixUniqueId();
    644859        }
    645860
    646861        void ForallPointerDecay::previsit( FunctionDecl *func ) {
    647                 forallFixer( func->type->forall, func );
    648862                func->fixUniqueId();
     863        }
     864
     865        void ForallPointerDecay::previsit( FunctionType * ftype ) {
     866                forallFixer( ftype->forall, ftype );
    649867        }
    650868
     
    673891                // were cast to void.
    674892                if ( ! returnStmt->get_expr() && returnVals.size() != 0 ) {
    675                         throw SemanticError( "Non-void function returns no values: " , returnStmt );
    676                 }
    677         }
    678 
    679 
    680         bool isTypedef( Declaration *decl ) {
    681                 return dynamic_cast< TypedefDecl * >( decl );
    682         }
    683 
    684         void EliminateTypedef::eliminateTypedef( std::list< Declaration * > &translationUnit ) {
    685                 PassVisitor<EliminateTypedef> eliminator;
     893                        SemanticError( returnStmt, "Non-void function returns no values: " );
     894                }
     895        }
     896
     897
     898        void ReplaceTypedef::replaceTypedef( std::list< Declaration * > &translationUnit ) {
     899                PassVisitor<ReplaceTypedef> eliminator;
    686900                mutateAll( translationUnit, eliminator );
    687901                if ( eliminator.pass.typedefNames.count( "size_t" ) ) {
    688902                        // grab and remember declaration of size_t
    689                         SizeType = eliminator.pass.typedefNames["size_t"].first->get_base()->clone();
     903                        SizeType = eliminator.pass.typedefNames["size_t"].first->base->clone();
    690904                } else {
    691905                        // xxx - missing global typedef for size_t - default to long unsigned int, even though that may be wrong
     
    693907                        SizeType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );
    694908                }
    695                 filter( translationUnit, isTypedef, true );
    696         }
    697 
    698         Type * EliminateTypedef::postmutate( TypeInstType * typeInst ) {
     909        }
     910
     911        void ReplaceTypedef::premutate( QualifiedType * ) {
     912                visit_children = false;
     913        }
     914
     915        Type * ReplaceTypedef::postmutate( QualifiedType * qualType ) {
     916                // replacing typedefs only makes sense for the 'oldest ancestor' of the qualified type
     917                qualType->parent = qualType->parent->acceptMutator( *visitor );
     918                return qualType;
     919        }
     920
     921        Type * ReplaceTypedef::postmutate( TypeInstType * typeInst ) {
    699922                // instances of typedef types will come here. If it is an instance
    700923                // of a typdef type, link the instance to its actual type.
    701                 TypedefMap::const_iterator def = typedefNames.find( typeInst->get_name() );
     924                TypedefMap::const_iterator def = typedefNames.find( typeInst->name );
    702925                if ( def != typedefNames.end() ) {
    703926                        Type *ret = def->second.first->base->clone();
     927                        ret->location = typeInst->location;
    704928                        ret->get_qualifiers() |= typeInst->get_qualifiers();
    705929                        // attributes are not carried over from typedef to function parameters/return values
     
    714938                                ReferenceToType *rtt = dynamic_cast<ReferenceToType*>(ret);
    715939                                if ( ! rtt ) {
    716                                         throw SemanticError("Cannot apply type parameters to base type of " + typeInst->name);
     940                                        SemanticError( typeInst->location, "Cannot apply type parameters to base type of " + typeInst->name );
    717941                                }
    718                                 rtt->get_parameters().clear();
     942                                rtt->parameters.clear();
    719943                                cloneAll( typeInst->parameters, rtt->parameters );
    720944                                mutateAll( rtt->parameters, *visitor );  // recursively fix typedefs on parameters
     
    723947                        return ret;
    724948                } else {
    725                         TypeDeclMap::const_iterator base = typedeclNames.find( typeInst->get_name() );
    726                         assertf( base != typedeclNames.end(), "Cannot find typedecl name %s", typeInst->name.c_str() );
     949                        TypeDeclMap::const_iterator base = typedeclNames.find( typeInst->name );
     950                        if ( base == typedeclNames.end() ) {
     951                                SemanticError( typeInst->location, toString("Use of undefined type ", typeInst->name) );
     952                        }
    727953                        typeInst->set_baseType( base->second );
    728                 } // if
    729                 return typeInst;
     954                        return typeInst;
     955                } // if
     956                assert( false );
    730957        }
    731958
     
    744971        }
    745972
    746         Declaration *EliminateTypedef::postmutate( TypedefDecl * tyDecl ) {
    747                 if ( typedefNames.count( tyDecl->get_name() ) == 1 && typedefNames[ tyDecl->get_name() ].second == scopeLevel ) {
     973        Declaration * ReplaceTypedef::postmutate( TypedefDecl * tyDecl ) {
     974                if ( typedefNames.count( tyDecl->name ) == 1 && typedefNames[ tyDecl->name ].second == scopeLevel ) {
    748975                        // typedef to the same name from the same scope
    749976                        // must be from the same type
    750977
    751                         Type * t1 = tyDecl->get_base();
    752                         Type * t2 = typedefNames[ tyDecl->get_name() ].first->get_base();
     978                        Type * t1 = tyDecl->base;
     979                        Type * t2 = typedefNames[ tyDecl->name ].first->base;
    753980                        if ( ! ResolvExpr::typesCompatible( t1, t2, Indexer() ) ) {
    754                                 throw SemanticError( "Cannot redefine typedef: " + tyDecl->name );
    755                         }
    756                         // cannot redefine VLA typedefs
     981                                SemanticError( tyDecl->location, "Cannot redefine typedef: " + tyDecl->name );
     982                        }
     983                        // Cannot redefine VLA typedefs. Note: this is slightly incorrect, because our notion of VLAs
     984                        // at this point in the translator is imprecise. In particular, this will disallow redefining typedefs
     985                        // with arrays whose dimension is an enumerator or a cast of a constant/enumerator. The effort required
     986                        // to fix this corner case likely outweighs the utility of allowing it.
    757987                        if ( isVariableLength( t1 ) || isVariableLength( t2 ) ) {
    758                                 throw SemanticError( "Cannot redefine typedef: " + tyDecl->name );
     988                                SemanticError( tyDecl->location, "Cannot redefine typedef: " + tyDecl->name );
    759989                        }
    760990                } else {
    761                         typedefNames[ tyDecl->get_name() ] = std::make_pair( TypedefDeclPtr( tyDecl ), scopeLevel );
     991                        typedefNames[ tyDecl->name ] = std::make_pair( TypedefDeclPtr( tyDecl ), scopeLevel );
    762992                } // if
    763993
     
    7711001                // Note, qualifiers on the typedef are superfluous for the forward declaration.
    7721002
    773                 Type *designatorType = tyDecl->get_base()->stripDeclarator();
     1003                Type *designatorType = tyDecl->base->stripDeclarator();
    7741004                if ( StructInstType *aggDecl = dynamic_cast< StructInstType * >( designatorType ) ) {
    775                         return new StructDecl( aggDecl->get_name(), DeclarationNode::Struct, noAttributes, tyDecl->get_linkage() );
     1005                        declsToAddBefore.push_back( new StructDecl( aggDecl->name, DeclarationNode::Struct, noAttributes, tyDecl->linkage ) );
    7761006                } else if ( UnionInstType *aggDecl = dynamic_cast< UnionInstType * >( designatorType ) ) {
    777                         return new UnionDecl( aggDecl->get_name(), noAttributes, tyDecl->get_linkage() );
     1007                        declsToAddBefore.push_back( new UnionDecl( aggDecl->name, noAttributes, tyDecl->linkage ) );
    7781008                } else if ( EnumInstType *enumDecl = dynamic_cast< EnumInstType * >( designatorType ) ) {
    779                         return new EnumDecl( enumDecl->get_name(), noAttributes, tyDecl->get_linkage() );
    780                 } else {
    781                         return tyDecl->clone();
    782                 } // if
    783         }
    784 
    785         void EliminateTypedef::premutate( TypeDecl * typeDecl ) {
    786                 TypedefMap::iterator i = typedefNames.find( typeDecl->get_name() );
     1009                        declsToAddBefore.push_back( new EnumDecl( enumDecl->name, noAttributes, tyDecl->linkage ) );
     1010                } // if
     1011                return tyDecl->clone();
     1012        }
     1013
     1014        void ReplaceTypedef::premutate( TypeDecl * typeDecl ) {
     1015                TypedefMap::iterator i = typedefNames.find( typeDecl->name );
    7871016                if ( i != typedefNames.end() ) {
    7881017                        typedefNames.erase( i ) ;
    7891018                } // if
    7901019
    791                 typedeclNames[ typeDecl->get_name() ] = typeDecl;
    792         }
    793 
    794         void EliminateTypedef::premutate( FunctionDecl * ) {
     1020                typedeclNames.insert( typeDecl->name, typeDecl );
     1021        }
     1022
     1023        void ReplaceTypedef::premutate( FunctionDecl * ) {
    7951024                GuardScope( typedefNames );
    796         }
    797 
    798         void EliminateTypedef::premutate( ObjectDecl * ) {
     1025                GuardScope( typedeclNames );
     1026        }
     1027
     1028        void ReplaceTypedef::premutate( ObjectDecl * ) {
    7991029                GuardScope( typedefNames );
    800         }
    801 
    802         DeclarationWithType *EliminateTypedef::postmutate( ObjectDecl * objDecl ) {
    803                 if ( FunctionType *funtype = dynamic_cast<FunctionType *>( objDecl->get_type() ) ) { // function type?
     1030                GuardScope( typedeclNames );
     1031        }
     1032
     1033        DeclarationWithType * ReplaceTypedef::postmutate( ObjectDecl * objDecl ) {
     1034                if ( FunctionType *funtype = dynamic_cast<FunctionType *>( objDecl->type ) ) { // function type?
    8041035                        // replace the current object declaration with a function declaration
    805                         FunctionDecl * newDecl = new FunctionDecl( objDecl->get_name(), objDecl->get_storageClasses(), objDecl->get_linkage(), funtype, 0, objDecl->get_attributes(), objDecl->get_funcSpec() );
    806                         objDecl->get_attributes().clear();
     1036                        FunctionDecl * newDecl = new FunctionDecl( objDecl->name, objDecl->get_storageClasses(), objDecl->linkage, funtype, 0, objDecl->attributes, objDecl->get_funcSpec() );
     1037                        objDecl->attributes.clear();
    8071038                        objDecl->set_type( nullptr );
    8081039                        delete objDecl;
     
    8121043        }
    8131044
    814         void EliminateTypedef::premutate( CastExpr * ) {
     1045        void ReplaceTypedef::premutate( CastExpr * ) {
    8151046                GuardScope( typedefNames );
    816         }
    817 
    818         void EliminateTypedef::premutate( CompoundStmt * ) {
     1047                GuardScope( typedeclNames );
     1048        }
     1049
     1050        void ReplaceTypedef::premutate( CompoundStmt * ) {
    8191051                GuardScope( typedefNames );
     1052                GuardScope( typedeclNames );
    8201053                scopeLevel += 1;
    8211054                GuardAction( [this](){ scopeLevel -= 1; } );
    8221055        }
    8231056
    824         CompoundStmt *EliminateTypedef::postmutate( CompoundStmt * compoundStmt ) {
    825                 // remove and delete decl stmts
    826                 filter( compoundStmt->kids, [](Statement * stmt) {
    827                         if ( DeclStmt *declStmt = dynamic_cast< DeclStmt * >( stmt ) ) {
    828                                 if ( dynamic_cast< TypedefDecl * >( declStmt->get_decl() ) ) {
    829                                         return true;
    830                                 } // if
    831                         } // if
    832                         return false;
    833                 }, true);
    834                 return compoundStmt;
    835         }
    836 
    837         // there may be typedefs nested within aggregates. in order for everything to work properly, these should be removed
    838         // as well
    8391057        template<typename AggDecl>
    840         AggDecl *EliminateTypedef::handleAggregate( AggDecl * aggDecl ) {
    841                 filter( aggDecl->members, isTypedef, true );
    842                 return aggDecl;
    843         }
    844 
    845         template<typename AggDecl>
    846         void EliminateTypedef::addImplicitTypedef( AggDecl * aggDecl ) {
     1058        void ReplaceTypedef::addImplicitTypedef( AggDecl * aggDecl ) {
    8471059                if ( typedefNames.count( aggDecl->get_name() ) == 0 ) {
    8481060                        Type *type = nullptr;
     
    8541066                                type = new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() );
    8551067                        } // if
    856                         TypedefDeclPtr tyDecl( new TypedefDecl( aggDecl->get_name(), Type::StorageClasses(), type, aggDecl->get_linkage() ) );
     1068                        TypedefDeclPtr tyDecl( new TypedefDecl( aggDecl->get_name(), aggDecl->location, Type::StorageClasses(), type, aggDecl->get_linkage() ) );
    8571069                        typedefNames[ aggDecl->get_name() ] = std::make_pair( std::move( tyDecl ), scopeLevel );
    858                 } // if
    859         }
    860 
    861         void EliminateTypedef::premutate( StructDecl * structDecl ) {
     1070                        // add the implicit typedef to the AST
     1071                        declsToAddBefore.push_back( new TypedefDecl( aggDecl->get_name(), aggDecl->location, Type::StorageClasses(), type->clone(), aggDecl->get_linkage() ) );
     1072                } // if
     1073        }
     1074
     1075        template< typename AggDecl >
     1076        void ReplaceTypedef::handleAggregate( AggDecl * aggr ) {
     1077                SemanticErrorException errors;
     1078
     1079                ValueGuard< std::list<Declaration * > > oldBeforeDecls( declsToAddBefore );
     1080                ValueGuard< std::list<Declaration * > > oldAfterDecls ( declsToAddAfter  );
     1081                declsToAddBefore.clear();
     1082                declsToAddAfter.clear();
     1083
     1084                GuardScope( typedefNames );
     1085                GuardScope( typedeclNames );
     1086                mutateAll( aggr->parameters, *visitor );
     1087
     1088                // unroll mutateAll for aggr->members so that implicit typedefs for nested types are added to the aggregate body.
     1089                for ( std::list< Declaration * >::iterator i = aggr->members.begin(); i != aggr->members.end(); ++i ) {
     1090                        if ( !declsToAddAfter.empty() ) { aggr->members.splice( i, declsToAddAfter ); }
     1091
     1092                        try {
     1093                                *i = maybeMutate( *i, *visitor );
     1094                        } catch ( SemanticErrorException &e ) {
     1095                                errors.append( e );
     1096                        }
     1097
     1098                        if ( !declsToAddBefore.empty() ) { aggr->members.splice( i, declsToAddBefore ); }
     1099                }
     1100
     1101                if ( !declsToAddAfter.empty() ) { aggr->members.splice( aggr->members.end(), declsToAddAfter ); }
     1102                if ( !errors.isEmpty() ) { throw errors; }
     1103        }
     1104
     1105        void ReplaceTypedef::premutate( StructDecl * structDecl ) {
     1106                visit_children = false;
    8621107                addImplicitTypedef( structDecl );
    863         }
    864 
    865 
    866         Declaration *EliminateTypedef::postmutate( StructDecl * structDecl ) {
    867                 return handleAggregate( structDecl );
    868         }
    869 
    870         void EliminateTypedef::premutate( UnionDecl * unionDecl ) {
     1108                handleAggregate( structDecl );
     1109        }
     1110
     1111        void ReplaceTypedef::premutate( UnionDecl * unionDecl ) {
     1112                visit_children = false;
    8711113                addImplicitTypedef( unionDecl );
    872         }
    873 
    874         Declaration *EliminateTypedef::postmutate( UnionDecl * unionDecl ) {
    875                 return handleAggregate( unionDecl );
    876         }
    877 
    878         void EliminateTypedef::premutate( EnumDecl * enumDecl ) {
     1114                handleAggregate( unionDecl );
     1115        }
     1116
     1117        void ReplaceTypedef::premutate( EnumDecl * enumDecl ) {
    8791118                addImplicitTypedef( enumDecl );
    8801119        }
    8811120
    882         Declaration *EliminateTypedef::postmutate( EnumDecl * enumDecl ) {
    883                 return handleAggregate( enumDecl );
    884         }
    885 
    886         Declaration *EliminateTypedef::postmutate( TraitDecl * traitDecl ) {
    887                 return handleAggregate( traitDecl );
    888         }
    889 
    890         void EliminateTypedef::premutate( FunctionType * ) {
     1121        void ReplaceTypedef::premutate( FunctionType * ) {
    8911122                GuardValue( inFunctionType );
    8921123                inFunctionType = true;
     1124        }
     1125
     1126        void ReplaceTypedef::premutate( TraitDecl * ) {
     1127                GuardScope( typedefNames );
     1128                GuardScope( typedeclNames);
    8931129        }
    8941130
     
    9051141                if ( CodeGen::isCtorDtorAssign( funcDecl->get_name() ) ) { // TODO: also check /=, etc.
    9061142                        if ( params.size() == 0 ) {
    907                                 throw SemanticError( "Constructors, destructors, and assignment functions require at least one parameter ", funcDecl );
     1143                                SemanticError( funcDecl, "Constructors, destructors, and assignment functions require at least one parameter " );
    9081144                        }
    9091145                        ReferenceType * refType = dynamic_cast< ReferenceType * >( params.front()->get_type() );
    9101146                        if ( ! refType ) {
    911                                 throw SemanticError( "First parameter of a constructor, destructor, or assignment function must be a reference ", funcDecl );
     1147                                SemanticError( funcDecl, "First parameter of a constructor, destructor, or assignment function must be a reference " );
    9121148                        }
    9131149                        if ( CodeGen::isCtorDtor( funcDecl->get_name() ) && returnVals.size() != 0 ) {
    914                                 throw SemanticError( "Constructors and destructors cannot have explicit return values ", funcDecl );
     1150                                SemanticError( funcDecl, "Constructors and destructors cannot have explicit return values " );
    9151151                        }
    9161152                }
     
    9471183
    9481184                        sub.apply( inst );
    949                         if ( args.size() < params->size() ) throw SemanticError( "Too few type arguments in generic type ", inst );
    950                         if ( args.size() > params->size() ) throw SemanticError( "Too many type arguments in generic type ", inst );
     1185                        if ( args.size() < params->size() ) SemanticError( inst, "Too few type arguments in generic type " );
     1186                        if ( args.size() > params->size() ) SemanticError( inst, "Too many type arguments in generic type " );
    9511187                }
    9521188        }
     
    10141250        }
    10151251
     1252        void FixObjectType::fix( std::list< Declaration * > & translationUnit ) {
     1253                PassVisitor<FixObjectType> fixer;
     1254                acceptAll( translationUnit, fixer );
     1255        }
     1256
     1257        void FixObjectType::previsit( ObjectDecl * objDecl ) {
     1258                Type *new_type = ResolvExpr::resolveTypeof( objDecl->get_type(), indexer );
     1259                new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type
     1260                objDecl->set_type( new_type );
     1261        }
     1262
     1263        void FixObjectType::previsit( FunctionDecl * funcDecl ) {
     1264                Type *new_type = ResolvExpr::resolveTypeof( funcDecl->type, indexer );
     1265                new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type
     1266                funcDecl->set_type( new_type );
     1267        }
     1268
     1269        void FixObjectType::previsit( TypeDecl *typeDecl ) {
     1270                if ( typeDecl->get_base() ) {
     1271                        Type *new_type = ResolvExpr::resolveTypeof( typeDecl->get_base(), indexer );
     1272                        new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type
     1273                        typeDecl->set_base( new_type );
     1274                } // if
     1275        }
     1276
    10161277        void ArrayLength::computeLength( std::list< Declaration * > & translationUnit ) {
    10171278                PassVisitor<ArrayLength> len;
     
    10201281
    10211282        void ArrayLength::previsit( ObjectDecl * objDecl ) {
    1022                 if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->get_type() ) ) {
    1023                         if ( at->get_dimension() ) return;
    1024                         if ( ListInit * init = dynamic_cast< ListInit * >( objDecl->get_init() ) ) {
    1025                                 at->set_dimension( new ConstantExpr( Constant::from_ulong( init->get_initializers().size() ) ) );
    1026                         }
     1283                if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->type ) ) {
     1284                        if ( at->dimension ) return;
     1285                        if ( ListInit * init = dynamic_cast< ListInit * >( objDecl->init ) ) {
     1286                                at->dimension = new ConstantExpr( Constant::from_ulong( init->initializers.size() ) );
     1287                        }
     1288                }
     1289        }
     1290
     1291        void ArrayLength::previsit( ArrayType * type ) {
     1292                if ( type->dimension ) {
     1293                        // need to resolve array dimensions early so that constructor code can correctly determine
     1294                        // if a type is a VLA (and hence whether its elements need to be constructed)
     1295                        ResolvExpr::findSingleExpression( type->dimension, SymTab::SizeType->clone(), indexer );
     1296
     1297                        // must re-evaluate whether a type is a VLA, now that more information is available
     1298                        // (e.g. the dimension may have been an enumerator, which was unknown prior to this step)
     1299                        type->isVarLen = ! InitTweak::isConstExpr( type->dimension );
    10271300                }
    10281301        }
  • src/SymTab/module.mk

    rf9feab8 r90152a4  
    1717SRC += SymTab/Indexer.cc \
    1818       SymTab/Mangler.cc \
     19       SymTab/ManglerCommon.cc \
    1920       SymTab/Validate.cc \
    2021       SymTab/FixFunction.cc \
  • src/SynTree/AggregateDecl.cc

    rf9feab8 r90152a4  
    8686std::string TraitDecl::typeString() const { return "trait"; }
    8787
     88bool EnumDecl::valueOf( Declaration * enumerator, long long int & value ) {
     89        if ( enumValues.empty() ) {
     90                long long int currentValue = 0;
     91                for ( Declaration * member : members ) {
     92                        ObjectDecl * field = strict_dynamic_cast< ObjectDecl * >( member );
     93                        if ( field->init ) {
     94                                SingleInit * init = strict_dynamic_cast< SingleInit * >( field->init );
     95                                auto result = eval( init->value );
     96                                if ( ! result.second ) SemanticError( init->location, toString( "Non-constexpr in initialization of enumerator: ", field ) );
     97                                currentValue = result.first;
     98                        }
     99                        assertf( enumValues.count( field->name ) == 0, "Enum %s has multiple members with the name %s", name.c_str(), field->name.c_str() );
     100                        enumValues[ field->name ] = currentValue;
     101                        ++currentValue;
     102                }
     103        }
     104        if ( enumValues.count( enumerator->name ) ) {
     105                value = enumValues[ enumerator->name ];
     106                return true;
     107        }
     108        return false;
     109}
     110
    88111// Local Variables: //
    89112// tab-width: 4 //
  • src/SynTree/ApplicationExpr.cc

    rf9feab8 r90152a4  
    4949}
    5050
     51ParamEntry::ParamEntry( ParamEntry && other ) :
     52                decl( other.decl ), actualType( other.actualType ), formalType( other.formalType ), expr( other.expr ), inferParams( std::move( other.inferParams ) ) {
     53        other.actualType = nullptr;
     54        other.formalType = nullptr;
     55        other.expr = nullptr;
     56}
     57
     58ParamEntry & ParamEntry::operator=( ParamEntry && other ) {
     59        if ( &other == this ) return *this;
     60        delete actualType;
     61        delete formalType;
     62        delete expr;
     63        decl = other.decl;
     64        actualType = other.actualType;
     65        formalType = other.formalType;
     66        expr = other.expr;
     67        other.actualType = nullptr;
     68        other.formalType = nullptr;
     69        other.expr = nullptr;
     70        inferParams = std::move( other.inferParams );
     71        return *this;
     72}
     73
    5174ApplicationExpr::ApplicationExpr( Expression *funcExpr, const std::list<Expression *> & args ) : function( funcExpr ), args( args ) {
    5275        PointerType *pointer = strict_dynamic_cast< PointerType* >( funcExpr->get_result() );
  • src/SynTree/Attribute.cc

    rf9feab8 r90152a4  
    1515
    1616#include <ostream>           // for operator<<, ostream, basic_ostream, endl
     17#include <set>
    1718
    1819#include "Attribute.h"
     
    2122
    2223Attribute::Attribute( const Attribute &other ) : name( other.name ) {
    23   cloneAll( other.parameters, parameters );
     24        cloneAll( other.parameters, parameters );
    2425}
    2526
    2627Attribute::~Attribute() {
    27   deleteAll( parameters );
     28        deleteAll( parameters );
     29}
     30
     31bool Attribute::isValidOnFuncParam() const {
     32        // attributes such as aligned, cleanup, etc. produce GCC errors when they appear
     33        // on function parameters. Maintain here a whitelist of attribute names that are
     34        // allowed to appear on parameters.
     35        static std::set< std::string > valid = {
     36                "noreturn", "unused"
     37        };
     38        return valid.count( normalizedName() );
     39}
     40
     41std::string Attribute::normalizedName() const {
     42        // trim beginning/ending _, convert to lowercase
     43        auto begin = name.find_first_not_of('_');
     44        auto end = name.find_last_not_of('_');
     45        if (begin == std::string::npos || end == std::string::npos) return "";
     46        std::string ret;
     47        ret.reserve( end-begin+1 );
     48        std::transform( &name[begin], &name[end+1], back_inserter( ret ), tolower );
     49        return ret;
    2850}
    2951
    3052void Attribute::print( std::ostream &os, Indenter indent ) const {
    31   using std::endl;
    32   using std::string;
     53        using std::endl;
     54        using std::string;
    3355
    34   if ( ! empty() ) {
    35     os << "Attribute with name: " << name;
    36     if ( ! parameters.empty() ) {
    37       os << " with parameters: " << endl;
    38       printAll( parameters, os, indent+1 );
    39     }
    40   }
     56        if ( ! empty() ) {
     57                os << "Attribute with name: " << name;
     58                if ( ! parameters.empty() ) {
     59                        os << " with parameters: " << endl;
     60                        printAll( parameters, os, indent+1 );
     61                }
     62        }
    4163}
    4264
  • src/SynTree/Attribute.h

    rf9feab8 r90152a4  
    4343        bool empty() const { return name == ""; }
    4444
     45        std::string normalizedName() const;
     46
     47        /// true if this attribute is allowed to appear attached to a function parameter
     48        bool isValidOnFuncParam() const;
     49
    4550        Attribute * clone() const override { return new Attribute( *this ); }
    4651        virtual void accept( Visitor & v ) override { v.visit( this ); }
  • src/SynTree/BasicType.cc

    rf9feab8 r90152a4  
    5555          case DoubleImaginary:
    5656          case LongDoubleImaginary:
     57          case Float80:
     58          case Float128:
    5759                return false;
    5860          case NUMBER_OF_BASIC_TYPES:
  • src/SynTree/CompoundStmt.cc

    rf9feab8 r90152a4  
    2323#include "Statement.h"                // for CompoundStmt, Statement, DeclStmt
    2424#include "SynTree/Label.h"            // for Label
    25 #include "SynTree/VarExprReplacer.h"  // for VarExprReplacer, VarExprReplace...
     25#include "SynTree/DeclReplacer.h"     // for DeclReplacer
    2626
    2727using std::string;
     
    4949        // recursively execute this routine. There may be more efficient ways of doing
    5050        // this.
    51         VarExprReplacer::DeclMap declMap;
     51        DeclReplacer::DeclMap declMap;
    5252        std::list< Statement * >::const_iterator origit = other.kids.begin();
    5353        for ( Statement * s : kids ) {
     
    5959                                DeclarationWithType * origdwt = strict_dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() );
    6060                                assert( dwt->get_name() == origdwt->get_name() );
    61                                 declMap[ origdwt ] = new VariableExpr( dwt );
     61                                declMap[ origdwt ] = dwt;
    6262                        } else assert( ! dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() ) );
    6363                } else assert( ! dynamic_cast< DeclStmt * > ( s ) );
    6464        }
    6565        if ( ! declMap.empty() ) {
    66                 VarExprReplacer replacer( declMap );
    67                 acceptMutator( replacer );
     66                DeclReplacer::replace( this, declMap );
    6867        }
    6968}
  • src/SynTree/Declaration.cc

    rf9feab8 r90152a4  
    8181
    8282
     83StaticAssertDecl::StaticAssertDecl( Expression * condition, ConstantExpr * message ) : Declaration( "", Type::StorageClasses(), LinkageSpec::C ), condition( condition ), message( message )  {
     84}
     85
     86StaticAssertDecl::StaticAssertDecl( const StaticAssertDecl & other ) : Declaration( other ), condition( maybeClone( other.condition ) ), message( maybeClone( other.message ) )  {
     87}
     88
     89StaticAssertDecl::~StaticAssertDecl() {
     90        delete condition;
     91        delete message;
     92}
     93
     94void StaticAssertDecl::print( std::ostream &os, Indenter indent ) const {
     95        os << "Static Assert with condition: ";
     96        condition->print( os, indent+1 );
     97        os << std::endl << indent << "and message: ";
     98        message->print( os, indent+1 );
     99os << std::endl;
     100}
     101
     102void StaticAssertDecl::printShort( std::ostream &os, Indenter indent ) const {
     103        print( os, indent );
     104}
     105
     106
    83107// Local Variables: //
    84108// tab-width: 4 //
  • src/SynTree/Declaration.h

    rf9feab8 r90152a4  
    8484        Expression *asmName;
    8585        std::list< Attribute * > attributes;
     86        bool isDeleted = false;
    8687
    8788        DeclarationWithType( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, Type::FuncSpecifiers fs );
     
    151152        FunctionType *type;
    152153        CompoundStmt *statements;
     154        std::list< Expression * > withExprs;
    153155
    154156        FunctionDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements,
     
    200202        typedef NamedTypeDecl Parent;
    201203  public:
    202         enum Kind { Dtype, Ftype, Ttype };
     204        enum Kind { Dtype, Ftype, Ttype, NUMBER_OF_KINDS };
    203205
    204206        Type * init;
     
    244246        typedef NamedTypeDecl Parent;
    245247  public:
    246         TypedefDecl( const std::string &name, Type::StorageClasses scs, Type *type, LinkageSpec::Spec spec = LinkageSpec::Cforall ) : Parent( name, scs, type ) { set_linkage( spec ); }
     248        TypedefDecl( const std::string &name, CodeLocation location, Type::StorageClasses scs, Type *type, LinkageSpec::Spec spec = LinkageSpec::Cforall )
     249                : Parent( name, scs, type ) { set_linkage( spec ); this->location = location; }
     250
    247251        TypedefDecl( const TypedefDecl &other ) : Parent( other ) {}
    248252
     
    262266        bool body;
    263267        std::list< Attribute * > attributes;
     268        AggregateDecl * parent = nullptr;
    264269
    265270        AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall );
     
    319324        EnumDecl( const EnumDecl &other ) : Parent( other ) {}
    320325
     326        bool valueOf( Declaration * enumerator, long long int & value );
     327
    321328        virtual EnumDecl *clone() const override { return new EnumDecl( *this ); }
    322329        virtual void accept( Visitor &v ) override { v.visit( this ); }
    323330        virtual Declaration *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    324331  private:
     332        std::map< std::string, long long int > enumValues;
    325333        virtual std::string typeString() const override;
    326334};
     
    355363        virtual void accept( Visitor &v ) override { v.visit( this ); }
    356364        virtual AsmDecl *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
     365        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     366        virtual void printShort( std::ostream &os, Indenter indent = {} ) const override;
     367};
     368
     369class StaticAssertDecl : public Declaration {
     370public:
     371        Expression * condition;
     372        ConstantExpr * message;   // string literal
     373
     374        StaticAssertDecl( Expression * condition, ConstantExpr * message );
     375        StaticAssertDecl( const StaticAssertDecl & other );
     376        virtual ~StaticAssertDecl();
     377
     378        virtual StaticAssertDecl * clone() const override { return new StaticAssertDecl( *this ); }
     379        virtual void accept( Visitor &v ) override { v.visit( this ); }
     380        virtual StaticAssertDecl * acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    357381        virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    358382        virtual void printShort( std::ostream &os, Indenter indent = {} ) const override;
  • src/SynTree/Expression.cc

    rf9feab8 r90152a4  
    5050}
    5151
     52void Expression::spliceInferParams( Expression * other ) {
     53        if ( ! other ) return;
     54        for ( auto p : other->inferParams ) {
     55                inferParams[p.first] = std::move( p.second );
     56        }
     57}
     58
    5259Expression::~Expression() {
    5360        delete env;
     
    8188        constant.print( os );
    8289        Expression::print( os, indent );
     90}
     91
     92long long int ConstantExpr::intValue() const {
     93        if ( BasicType * basicType = dynamic_cast< BasicType * >( result ) ) {
     94                if ( basicType->isInteger() ) {
     95                        return get_constant()->get_ival();
     96                }
     97        } else if ( dynamic_cast< OneType * >( result ) ) {
     98                return 1;
     99        } else if ( dynamic_cast< ZeroType * >( result ) ) {
     100                return 0;
     101        }
     102        SemanticError( this, "Constant expression of non-integral type " );
    83103}
    84104
     
    95115        //      assert( inst->baseEnum );
    96116        //      EnumDecl * decl = inst->baseEnum;
    97         //      for ( Declaration * member : decl->members ) {
    98         //              if ( member == _var ) {
    99         //                      type->set_lvalue( false );
    100         //              }
     117        //      long long int value;
     118        //      if ( decl->valueOf( var, value ) ) {
     119        //              type->set_lvalue( false );
    101120        //      }
    102121        // }
     
    259278}
    260279
    261 CastExpr::CastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) {
     280CastExpr::CastExpr( Expression *arg, Type *toType, bool isGenerated ) : Expression(), arg(arg), isGenerated( isGenerated ) {
    262281        set_result(toType);
    263282}
    264283
    265 CastExpr::CastExpr( Expression *arg_ ) : Expression(), arg(arg_) {
     284CastExpr::CastExpr( Expression *arg, bool isGenerated ) : Expression(), arg(arg), isGenerated( isGenerated ) {
    266285        set_result( new VoidType( Type::Qualifiers() ) );
    267286}
    268287
    269 CastExpr::CastExpr( const CastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ) {
     288CastExpr::CastExpr( const CastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), isGenerated( other.isGenerated ) {
    270289}
    271290
     
    287306}
    288307
     308KeywordCastExpr::KeywordCastExpr( Expression *arg, Target target ) : Expression(), arg(arg), target( target ) {
     309}
     310
     311KeywordCastExpr::KeywordCastExpr( const KeywordCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), target( other.target ) {
     312}
     313
     314KeywordCastExpr::~KeywordCastExpr() {
     315        delete arg;
     316}
     317
     318const std::string & KeywordCastExpr::targetString() const {
     319        static const std::string targetStrs[] = {
     320                "coroutine", "thread", "monitor"
     321        };
     322        static_assert(
     323                (sizeof(targetStrs) / sizeof(targetStrs[0])) == ((unsigned long)NUMBER_OF_TARGETS),
     324                "Each KeywordCastExpr::Target should have a corresponding string representation"
     325        );
     326        return targetStrs[(unsigned long)target];
     327}
     328
     329void KeywordCastExpr::print( std::ostream &os, Indenter indent ) const {
     330        os << "Keyword Cast of:" << std::endl << indent+1;
     331        arg->print(os, indent+1);
     332        os << std::endl << indent << "... to: ";
     333        os << targetString();
     334        Expression::print( os, indent );
     335}
     336
    289337VirtualCastExpr::VirtualCastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) {
    290338        set_result(toType);
     
    333381}
    334382
    335 namespace {
    336         TypeSubstitution makeSub( Type * t ) {
    337                 if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( t ) ) {
    338                         return makeSub( refType->get_base() );
    339                 } else if ( StructInstType * aggInst = dynamic_cast< StructInstType * >( t ) ) {
    340                         return TypeSubstitution( aggInst->get_baseParameters()->begin(), aggInst->get_baseParameters()->end(), aggInst->parameters.begin() );
    341                 } else if ( UnionInstType * aggInst = dynamic_cast< UnionInstType * >( t ) ) {
    342                         return TypeSubstitution( aggInst->get_baseParameters()->begin(), aggInst->get_baseParameters()->end(), aggInst->parameters.begin() );
    343                 } else {
    344                         assertf( false, "makeSub expects struct or union type for aggregate, but got: %s", toString( t ).c_str() );
    345                 }
    346         }
    347 }
    348 
    349 
    350383MemberExpr::MemberExpr( DeclarationWithType *member, Expression *aggregate ) :
    351384                Expression(), member(member), aggregate(aggregate) {
    352385        assert( member );
    353386        assert( aggregate );
    354 
    355         TypeSubstitution sub( makeSub( aggregate->get_result() ) );
     387        assert( aggregate->result );
     388
     389        TypeSubstitution sub = aggregate->result->genericSubstitution();
    356390        Type * res = member->get_type()->clone();
    357391        sub.apply( res );
     
    403437                } else {
    404438                        // references have been removed, in which case dereference returns an lvalue of the base type.
    405                         ret->get_result()->set_lvalue( true );
     439                        ret->result->set_lvalue( true );
    406440                }
    407441        }
     
    585619
    586620StmtExpr::StmtExpr( CompoundStmt *statements ) : statements( statements ) {
    587         assert( statements );
    588         std::list< Statement * > & body = statements->get_kids();
    589         if ( ! body.empty() ) {
    590                 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( body.back() ) ) {
    591                         set_result( maybeClone( exprStmt->get_expr()->get_result() ) );
    592                 }
    593         }
    594         // ensure that StmtExpr has a result type
    595         if ( ! result ) {
    596                 set_result( new VoidType( Type::Qualifiers() ) );
    597         }
     621        computeResult();
    598622}
    599623StmtExpr::StmtExpr( const StmtExpr &other ) : Expression( other ), statements( other.statements->clone() ) {
     
    605629        deleteAll( dtors );
    606630        deleteAll( returnDecls );
     631}
     632void StmtExpr::computeResult() {
     633        assert( statements );
     634        std::list< Statement * > & body = statements->kids;
     635        delete result;
     636        result = nullptr;
     637        if ( ! returnDecls.empty() ) {
     638                // prioritize return decl for result type, since if a return decl exists, then
     639                // the StmtExpr is currently in an intermediate state where the body will always
     640                // give a void result type.
     641                result = returnDecls.front()->get_type()->clone();
     642        } else if ( ! body.empty() ) {
     643                if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( body.back() ) ) {
     644                        result = maybeClone( exprStmt->expr->result );
     645                }
     646        }
     647        // ensure that StmtExpr has a result type
     648        if ( ! result ) {
     649                result = new VoidType( Type::Qualifiers() );
     650        }
    607651}
    608652void StmtExpr::print( std::ostream &os, Indenter indent ) const {
     
    688732}
    689733
     734DeletedExpr::DeletedExpr( Expression * expr, BaseSyntaxNode * deleteStmt ) : expr( expr ), deleteStmt( deleteStmt ) {
     735        assert( expr->result );
     736        result = expr->result->clone();
     737}
     738DeletedExpr::DeletedExpr( const DeletedExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), deleteStmt( other.deleteStmt ) {}
     739DeletedExpr::~DeletedExpr() {
     740        delete expr;
     741}
     742
     743void DeletedExpr::print( std::ostream & os, Indenter indent ) const {
     744        os << "Deleted Expression" << std::endl << indent+1;
     745        expr->print( os, indent+1 );
     746        os << std::endl << indent+1 << "... deleted by: ";
     747        deleteStmt->print( os, indent+1 );
     748}
     749
     750
     751DefaultArgExpr::DefaultArgExpr( Expression * expr ) : expr( expr ) {
     752        assert( expr->result );
     753        result = expr->result->clone();
     754}
     755DefaultArgExpr::DefaultArgExpr( const DefaultArgExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ) {}
     756DefaultArgExpr::~DefaultArgExpr() {
     757        delete expr;
     758}
     759
     760void DefaultArgExpr::print( std::ostream & os, Indenter indent ) const {
     761        os << "Default Argument Expression" << std::endl << indent+1;
     762        expr->print( os, indent+1 );
     763}
     764
     765GenericExpr::Association::Association( Type * type, Expression * expr ) : type( type ), expr( expr ), isDefault( false ) {}
     766GenericExpr::Association::Association( Expression * expr ) : type( nullptr ), expr( expr ), isDefault( true ) {}
     767GenericExpr::Association::Association( const Association & other ) : type( maybeClone( other.type ) ), expr( maybeClone( other.expr ) ), isDefault( other.isDefault ) {}
     768GenericExpr::Association::~Association() {
     769        delete type;
     770        delete expr;
     771}
     772
     773GenericExpr::GenericExpr( Expression * control, const std::list<Association> & assoc ) : Expression(), control( control ), associations( assoc ) {}
     774GenericExpr::GenericExpr( const GenericExpr & other ) : Expression(other), control( maybeClone( other.control ) ), associations( other.associations ) {
     775}
     776GenericExpr::~GenericExpr() {
     777        delete control;
     778}
     779
     780void GenericExpr::print( std::ostream & os, Indenter indent ) const {
     781        os << "C11 _Generic Expression" << std::endl << indent+1;
     782        control->print( os, indent+1 );
     783        os << std::endl << indent+1 << "... with associations: " << std::endl;
     784        for ( const Association & assoc : associations ) {
     785                os << indent+1;
     786                if (assoc.isDefault) {
     787                        os << "... default: ";
     788                        assoc.expr->print( os, indent+1 );
     789                } else {
     790                        os << "... type: ";
     791                        assoc.type->print( os, indent+1 );
     792                        os << std::endl << indent+1 << "... expression: ";
     793                        assoc.expr->print( os, indent+1 );
     794                        os << std::endl;
     795                }
     796                os << std::endl;
     797        }
     798}
     799
    690800// Local Variables: //
    691801// tab-width: 4 //
  • src/SynTree/Expression.h

    rf9feab8 r90152a4  
    4141        ParamEntry( UniqueId decl, Type * actualType, Type * formalType, Expression* expr ): decl( decl ), actualType( actualType ), formalType( formalType ), expr( expr ), inferParams( new InferredParams ) {}
    4242        ParamEntry( const ParamEntry & other );
     43        ParamEntry( ParamEntry && other );
    4344        ~ParamEntry();
    4445        ParamEntry & operator=( const ParamEntry & other );
     46        ParamEntry & operator=( ParamEntry && other );
    4547
    4648        UniqueId decl;
     
    7476        InferredParams & get_inferParams() { return inferParams; }
    7577
     78        // move other's inferParams to this
     79        void spliceInferParams( Expression * other );
     80
    7681        virtual Expression * clone() const override = 0;
    7782        virtual void accept( Visitor & v ) override = 0;
     
    188193  public:
    189194        Expression * arg;
    190 
    191         CastExpr( Expression * arg );
    192         CastExpr( Expression * arg, Type * toType );
     195        bool isGenerated = true; // whether this cast appeared in the source program
     196
     197        CastExpr( Expression * arg, bool isGenerated = true );
     198        CastExpr( Expression * arg, Type * toType, bool isGenerated = true );
     199        CastExpr( Expression * arg, void * ) = delete; // prevent accidentally passing pointers for isGenerated in the first constructor
    193200        CastExpr( const CastExpr & other );
    194201        virtual ~CastExpr();
     
    198205
    199206        virtual CastExpr * clone() const { return new CastExpr( * this ); }
     207        virtual void accept( Visitor & v ) { v.visit( this ); }
     208        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     209        virtual void print( std::ostream & os, Indenter indent = {} ) const;
     210};
     211
     212/// KeywordCastExpr represents a cast to 'keyword types', e.g. (thread &)t
     213class KeywordCastExpr : public Expression {
     214public:
     215        Expression * arg;
     216        enum Target {
     217                Coroutine, Thread, Monitor, NUMBER_OF_TARGETS
     218        } target;
     219
     220        KeywordCastExpr( Expression * arg, Target target );
     221        KeywordCastExpr( const KeywordCastExpr & other );
     222        virtual ~KeywordCastExpr();
     223
     224        const std::string & targetString() const;
     225
     226        virtual KeywordCastExpr * clone() const { return new KeywordCastExpr( * this ); }
    200227        virtual void accept( Visitor & v ) { v.visit( this ); }
    201228        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     
    295322
    296323        Constant * get_constant() { return & constant; }
     324        const Constant * get_constant() const { return & constant; }
    297325        void set_constant( const Constant & newValue ) { constant = newValue; }
     326
     327        long long int intValue() const;
    298328
    299329        virtual ConstantExpr * clone() const { return new ConstantExpr( * this ); }
     
    725755        StmtExpr * set_statements( CompoundStmt * newValue ) { statements = newValue; return this; }
    726756
     757        // call to set the result type of this StmtExpr based on its body
     758        void computeResult();
     759
    727760        std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; }
    728761        std::list< Expression * > & get_dtors() { return dtors; }
     
    816849};
    817850
     851/// expression that contains a deleted identifier - should never make it past the resolver.
     852class DeletedExpr : public Expression {
     853public:
     854        Expression * expr;
     855        BaseSyntaxNode * deleteStmt;
     856
     857        DeletedExpr( Expression * expr, BaseSyntaxNode * deleteStmt );
     858        DeletedExpr( const DeletedExpr & other );
     859        ~DeletedExpr();
     860
     861        virtual DeletedExpr * clone() const { return new DeletedExpr( * this ); }
     862        virtual void accept( Visitor & v ) { v.visit( this ); }
     863        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     864        virtual void print( std::ostream & os, Indenter indent = {} ) const;
     865};
     866
     867/// expression wrapping the use of a default argument - should never make it past the resolver.
     868class DefaultArgExpr : public Expression {
     869public:
     870        Expression * expr;
     871
     872        DefaultArgExpr( Expression * expr );
     873        DefaultArgExpr( const DefaultArgExpr & other );
     874        ~DefaultArgExpr();
     875
     876        virtual DefaultArgExpr * clone() const { return new DefaultArgExpr( * this ); }
     877        virtual void accept( Visitor & v ) { v.visit( this ); }
     878        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     879        virtual void print( std::ostream & os, Indenter indent = {} ) const;
     880};
     881
     882/// C11 _Generic expression
     883class GenericExpr : public Expression {
     884public:
     885        struct Association {
     886                Type * type = nullptr;
     887                Expression * expr = nullptr;
     888                bool isDefault = false;
     889
     890                Association( Type * type, Expression * expr );
     891                Association( Expression * expr );
     892                Association( const Association & other );
     893                Association & operator=( const Association & other ) = delete; // at the moment this isn't used, and I don't want to implement it
     894                ~Association();
     895        };
     896
     897        Expression * control;
     898        std::list<Association> associations;
     899
     900        GenericExpr( Expression * control, const std::list<Association> & assoc );
     901        GenericExpr( const GenericExpr & other );
     902        virtual ~GenericExpr();
     903
     904        virtual GenericExpr * clone() const { return new GenericExpr( * this ); }
     905        virtual void accept( Visitor & v ) { v.visit( this ); }
     906        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     907        virtual void print( std::ostream & os, Indenter indent = {} ) const;
     908};
     909
    818910// Local Variables: //
    819911// tab-width: 4 //
  • src/SynTree/FunctionDecl.cc

    rf9feab8 r90152a4  
    2626#include "Statement.h"           // for CompoundStmt
    2727#include "Type.h"                // for Type, FunctionType, Type::FuncSpecif...
    28 #include "VarExprReplacer.h"
     28#include "DeclReplacer.h"
    2929
    3030extern bool translation_unit_nomain;
     
    4141                : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {
    4242
    43         VarExprReplacer::DeclMap declMap;
     43        DeclReplacer::DeclMap declMap;
    4444        for ( auto p : group_iterate( other.type->parameters, type->parameters ) ) {
    45                 declMap[ std::get<0>(p) ] = new VariableExpr( std::get<1>(p) );
     45                declMap[ std::get<0>(p) ] = std::get<1>(p);
    4646        }
    4747        for ( auto p : group_iterate( other.type->returnVals, type->returnVals ) ) {
    48                 declMap[ std::get<0>(p) ] = new VariableExpr( std::get<1>(p) );
     48                declMap[ std::get<0>(p) ] = std::get<1>(p);
    4949        }
    5050        if ( ! declMap.empty() ) {
    51                 VarExprReplacer replacer( declMap );
    52                 acceptMutator( replacer );
     51                DeclReplacer::replace( this, declMap );
    5352        }
     53        cloneAll( other.withExprs, withExprs );
    5454}
    5555
     
    5757        delete type;
    5858        delete statements;
     59        deleteAll( withExprs );
    5960}
    6061
  • src/SynTree/Label.h

    rf9feab8 r90152a4  
    3333        std::list< Attribute * >& get_attributes() { return attributes; }
    3434
    35         operator std::string() { return name; }
     35        operator std::string() const { return name; }
    3636        bool empty() { return name.empty(); }
    3737  private:
  • src/SynTree/Mutator.h

    rf9feab8 r90152a4  
    2222class Mutator {
    2323  protected:
    24         Mutator();
    25         virtual ~Mutator();
     24        Mutator() = default;
     25        virtual ~Mutator() = default;
    2626  public:
    27         virtual DeclarationWithType * mutate( ObjectDecl * objectDecl );
    28         virtual DeclarationWithType * mutate( FunctionDecl * functionDecl );
    29         virtual Declaration * mutate( StructDecl * aggregateDecl );
    30         virtual Declaration * mutate( UnionDecl * aggregateDecl );
    31         virtual Declaration * mutate( EnumDecl * aggregateDecl );
    32         virtual Declaration * mutate( TraitDecl * aggregateDecl );
    33         virtual Declaration * mutate( TypeDecl * typeDecl );
    34         virtual Declaration * mutate( TypedefDecl * typeDecl );
    35         virtual AsmDecl * mutate( AsmDecl * asmDecl );
     27        virtual DeclarationWithType * mutate( ObjectDecl * objectDecl ) = 0;
     28        virtual DeclarationWithType * mutate( FunctionDecl * functionDecl ) = 0;
     29        virtual Declaration * mutate( StructDecl * aggregateDecl ) = 0;
     30        virtual Declaration * mutate( UnionDecl * aggregateDecl ) = 0;
     31        virtual Declaration * mutate( EnumDecl * aggregateDecl ) = 0;
     32        virtual Declaration * mutate( TraitDecl * aggregateDecl ) = 0;
     33        virtual Declaration * mutate( TypeDecl * typeDecl ) = 0;
     34        virtual Declaration * mutate( TypedefDecl * typeDecl ) = 0;
     35        virtual AsmDecl * mutate( AsmDecl * asmDecl ) = 0;
     36        virtual StaticAssertDecl * mutate( StaticAssertDecl * assertDecl ) = 0;
    3637
    37         virtual CompoundStmt * mutate( CompoundStmt * compoundStmt );
    38         virtual Statement * mutate( ExprStmt * exprStmt );
    39         virtual Statement * mutate( AsmStmt * asmStmt );
    40         virtual Statement * mutate( IfStmt * ifStmt );
    41         virtual Statement * mutate( WhileStmt * whileStmt );
    42         virtual Statement * mutate( ForStmt * forStmt );
    43         virtual Statement * mutate( SwitchStmt * switchStmt );
    44         virtual Statement * mutate( CaseStmt * caseStmt );
    45         virtual Statement * mutate( BranchStmt * branchStmt );
    46         virtual Statement * mutate( ReturnStmt * returnStmt );
    47         virtual Statement * mutate( ThrowStmt * throwStmt );
    48         virtual Statement * mutate( TryStmt * tryStmt );
    49         virtual Statement * mutate( CatchStmt * catchStmt );
    50         virtual Statement * mutate( FinallyStmt * catchStmt );
    51         virtual Statement * mutate( WaitForStmt * waitforStmt );
    52         virtual Statement * mutate( WithStmt * withStmt );
    53         virtual NullStmt * mutate( NullStmt * nullStmt );
    54         virtual Statement * mutate( DeclStmt * declStmt );
    55         virtual Statement * mutate( ImplicitCtorDtorStmt * impCtorDtorStmt );
     38        virtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) = 0;
     39        virtual Statement * mutate( ExprStmt * exprStmt ) = 0;
     40        virtual Statement * mutate( AsmStmt * asmStmt ) = 0;
     41        virtual Statement * mutate( DirectiveStmt * dirStmt ) = 0;
     42        virtual Statement * mutate( IfStmt * ifStmt ) = 0;
     43        virtual Statement * mutate( WhileStmt * whileStmt ) = 0;
     44        virtual Statement * mutate( ForStmt * forStmt ) = 0;
     45        virtual Statement * mutate( SwitchStmt * switchStmt ) = 0;
     46        virtual Statement * mutate( CaseStmt * caseStmt ) = 0;
     47        virtual Statement * mutate( BranchStmt * branchStmt ) = 0;
     48        virtual Statement * mutate( ReturnStmt * returnStmt ) = 0;
     49        virtual Statement * mutate( ThrowStmt * throwStmt ) = 0;
     50        virtual Statement * mutate( TryStmt * tryStmt ) = 0;
     51        virtual Statement * mutate( CatchStmt * catchStmt ) = 0;
     52        virtual Statement * mutate( FinallyStmt * catchStmt ) = 0;
     53        virtual Statement * mutate( WaitForStmt * waitforStmt ) = 0;
     54        virtual Statement * mutate( WithStmt * withStmt ) = 0;
     55        virtual NullStmt * mutate( NullStmt * nullStmt ) = 0;
     56        virtual Statement * mutate( DeclStmt * declStmt ) = 0;
     57        virtual Statement * mutate( ImplicitCtorDtorStmt * impCtorDtorStmt ) = 0;
    5658
    57         virtual Expression* mutate( ApplicationExpr * applicationExpr );
    58         virtual Expression* mutate( UntypedExpr * untypedExpr );
    59         virtual Expression* mutate( NameExpr * nameExpr );
    60         virtual Expression* mutate( AddressExpr * castExpr );
    61         virtual Expression* mutate( LabelAddressExpr * labAddressExpr );
    62         virtual Expression* mutate( CastExpr * castExpr );
    63         virtual Expression* mutate( VirtualCastExpr * castExpr );
    64         virtual Expression* mutate( UntypedMemberExpr * memberExpr );
    65         virtual Expression* mutate( MemberExpr * memberExpr );
    66         virtual Expression* mutate( VariableExpr * variableExpr );
    67         virtual Expression* mutate( ConstantExpr * constantExpr );
    68         virtual Expression* mutate( SizeofExpr * sizeofExpr );
    69         virtual Expression* mutate( AlignofExpr * alignofExpr );
    70         virtual Expression* mutate( UntypedOffsetofExpr * offsetofExpr );
    71         virtual Expression* mutate( OffsetofExpr * offsetofExpr );
    72         virtual Expression* mutate( OffsetPackExpr * offsetPackExpr );
    73         virtual Expression* mutate( AttrExpr * attrExpr );
    74         virtual Expression* mutate( LogicalExpr * logicalExpr );
    75         virtual Expression* mutate( ConditionalExpr * conditionalExpr );
    76         virtual Expression* mutate( CommaExpr * commaExpr );
    77         virtual Expression* mutate( TypeExpr * typeExpr );
    78         virtual Expression* mutate( AsmExpr * asmExpr );
    79         virtual Expression* mutate( ImplicitCopyCtorExpr * impCpCtorExpr );
    80         virtual Expression* mutate( ConstructorExpr * ctorExpr );
    81         virtual Expression* mutate( CompoundLiteralExpr * compLitExpr );
    82         virtual Expression* mutate( RangeExpr * rangeExpr );
    83         virtual Expression* mutate( UntypedTupleExpr * tupleExpr );
    84         virtual Expression* mutate( TupleExpr * tupleExpr );
    85         virtual Expression* mutate( TupleIndexExpr * tupleExpr );
    86         virtual Expression* mutate( TupleAssignExpr * assignExpr );
    87         virtual Expression* mutate( StmtExpr  * stmtExpr );
    88         virtual Expression* mutate( UniqueExpr  * uniqueExpr );
    89         virtual Expression* mutate( UntypedInitExpr  * initExpr );
    90         virtual Expression* mutate( InitExpr  * initExpr );
     59        virtual Expression * mutate( ApplicationExpr * applicationExpr ) = 0;
     60        virtual Expression * mutate( UntypedExpr * untypedExpr ) = 0;
     61        virtual Expression * mutate( NameExpr * nameExpr ) = 0;
     62        virtual Expression * mutate( AddressExpr * addrExpr ) = 0;
     63        virtual Expression * mutate( LabelAddressExpr * labAddressExpr ) = 0;
     64        virtual Expression * mutate( CastExpr * castExpr ) = 0;
     65        virtual Expression * mutate( KeywordCastExpr * castExpr ) = 0;
     66        virtual Expression * mutate( VirtualCastExpr * castExpr ) = 0;
     67        virtual Expression * mutate( UntypedMemberExpr * memberExpr ) = 0;
     68        virtual Expression * mutate( MemberExpr * memberExpr ) = 0;
     69        virtual Expression * mutate( VariableExpr * variableExpr ) = 0;
     70        virtual Expression * mutate( ConstantExpr * constantExpr ) = 0;
     71        virtual Expression * mutate( SizeofExpr * sizeofExpr ) = 0;
     72        virtual Expression * mutate( AlignofExpr * alignofExpr ) = 0;
     73        virtual Expression * mutate( UntypedOffsetofExpr * offsetofExpr ) = 0;
     74        virtual Expression * mutate( OffsetofExpr * offsetofExpr ) = 0;
     75        virtual Expression * mutate( OffsetPackExpr * offsetPackExpr ) = 0;
     76        virtual Expression * mutate( AttrExpr * attrExpr ) = 0;
     77        virtual Expression * mutate( LogicalExpr * logicalExpr ) = 0;
     78        virtual Expression * mutate( ConditionalExpr * conditionalExpr ) = 0;
     79        virtual Expression * mutate( CommaExpr * commaExpr ) = 0;
     80        virtual Expression * mutate( TypeExpr * typeExpr ) = 0;
     81        virtual Expression * mutate( AsmExpr * asmExpr ) = 0;
     82        virtual Expression * mutate( ImplicitCopyCtorExpr * impCpCtorExpr ) = 0;
     83        virtual Expression * mutate( ConstructorExpr * ctorExpr ) = 0;
     84        virtual Expression * mutate( CompoundLiteralExpr * compLitExpr ) = 0;
     85        virtual Expression * mutate( RangeExpr * rangeExpr ) = 0;
     86        virtual Expression * mutate( UntypedTupleExpr * tupleExpr ) = 0;
     87        virtual Expression * mutate( TupleExpr * tupleExpr ) = 0;
     88        virtual Expression * mutate( TupleIndexExpr * tupleExpr ) = 0;
     89        virtual Expression * mutate( TupleAssignExpr * assignExpr ) = 0;
     90        virtual Expression * mutate( StmtExpr  * stmtExpr ) = 0;
     91        virtual Expression * mutate( UniqueExpr  * uniqueExpr ) = 0;
     92        virtual Expression * mutate( UntypedInitExpr  * initExpr ) = 0;
     93        virtual Expression * mutate( InitExpr  * initExpr ) = 0;
     94        virtual Expression * mutate( DeletedExpr * delExpr ) = 0;
     95        virtual Expression * mutate( DefaultArgExpr * argExpr ) = 0;
     96        virtual Expression * mutate( GenericExpr * genExpr ) = 0;
    9197
    92         virtual Type * mutate( VoidType * basicType );
    93         virtual Type * mutate( BasicType * basicType );
    94         virtual Type * mutate( PointerType * pointerType );
    95         virtual Type * mutate( ArrayType * arrayType );
    96         virtual Type * mutate( ReferenceType * refType );
    97         virtual Type * mutate( FunctionType * functionType );
    98         virtual Type * mutate( StructInstType * aggregateUseType );
    99         virtual Type * mutate( UnionInstType * aggregateUseType );
    100         virtual Type * mutate( EnumInstType * aggregateUseType );
    101         virtual Type * mutate( TraitInstType * aggregateUseType );
    102         virtual Type * mutate( TypeInstType * aggregateUseType );
    103         virtual Type * mutate( TupleType * tupleType );
    104         virtual Type * mutate( TypeofType * typeofType );
    105         virtual Type * mutate( AttrType * attrType );
    106         virtual Type * mutate( VarArgsType * varArgsType );
    107         virtual Type * mutate( ZeroType * zeroType );
    108         virtual Type * mutate( OneType * oneType );
     98        virtual Type * mutate( VoidType * basicType ) = 0;
     99        virtual Type * mutate( BasicType * basicType ) = 0;
     100        virtual Type * mutate( PointerType * pointerType ) = 0;
     101        virtual Type * mutate( ArrayType * arrayType ) = 0;
     102        virtual Type * mutate( ReferenceType * refType ) = 0;
     103        virtual Type * mutate( QualifiedType * qualType ) = 0;
     104        virtual Type * mutate( FunctionType * functionType ) = 0;
     105        virtual Type * mutate( StructInstType * aggregateUseType ) = 0;
     106        virtual Type * mutate( UnionInstType * aggregateUseType ) = 0;
     107        virtual Type * mutate( EnumInstType * aggregateUseType ) = 0;
     108        virtual Type * mutate( TraitInstType * aggregateUseType ) = 0;
     109        virtual Type * mutate( TypeInstType * aggregateUseType ) = 0;
     110        virtual Type * mutate( TupleType * tupleType ) = 0;
     111        virtual Type * mutate( TypeofType * typeofType ) = 0;
     112        virtual Type * mutate( AttrType * attrType ) = 0;
     113        virtual Type * mutate( VarArgsType * varArgsType ) = 0;
     114        virtual Type * mutate( ZeroType * zeroType ) = 0;
     115        virtual Type * mutate( OneType * oneType ) = 0;
     116        virtual Type * mutate( GlobalScopeType * globalType ) = 0;
    109117
    110         virtual Designation * mutate( Designation * designation );
    111         virtual Initializer * mutate( SingleInit * singleInit );
    112         virtual Initializer * mutate( ListInit * listInit );
    113         virtual Initializer * mutate( ConstructorInit * ctorInit );
     118        virtual Designation * mutate( Designation * designation ) = 0 ;
     119        virtual Initializer * mutate( SingleInit * singleInit ) = 0 ;
     120        virtual Initializer * mutate( ListInit * listInit ) = 0 ;
     121        virtual Initializer * mutate( ConstructorInit * ctorInit ) = 0 ;
    114122
    115         virtual Subrange * mutate( Subrange * subrange );
     123        virtual Subrange * mutate( Subrange * subrange ) = 0;
    116124
    117         virtual Constant * mutate( Constant * constant );
     125        virtual Constant * mutate( Constant * constant ) = 0;
    118126
    119         virtual Attribute * mutate( Attribute * attribute );
     127        virtual Attribute * mutate( Attribute * attribute ) = 0;
    120128
    121         virtual TypeSubstitution * mutate( TypeSubstitution * sub );
    122 
    123   private:
    124         virtual Declaration * handleAggregateDecl(AggregateDecl * aggregateDecl );
    125         virtual Declaration * handleNamedTypeDecl(NamedTypeDecl * typeDecl );
    126         virtual Type * handleReferenceToType(ReferenceToType * aggregateUseType );
     129        virtual TypeSubstitution * mutate( TypeSubstitution * sub ) = 0;
    127130};
    128131
     
    140143template< typename Container, typename MutatorType >
    141144inline void mutateAll( Container &container, MutatorType &mutator ) {
    142         SemanticError errors;
     145        SemanticErrorException errors;
    143146        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    144147                try {
     
    148151                                assert( *i );
    149152                        } // if
    150                 } catch( SemanticError &e ) {
    151                         e.set_location( (*i)->location );
     153                } catch( SemanticErrorException &e ) {
    152154                        errors.append( e );
    153155                } // try
  • src/SynTree/ReferenceToType.cc

    rf9feab8 r90152a4  
    1414//
    1515
    16 #include <cassert>           // for assert
    17 #include <list>              // for list, _List_const_iterator, list<>::cons...
    18 #include <ostream>           // for operator<<, basic_ostream, ostream, endl
    19 #include <string>            // for string, operator<<, char_traits, operator==
    20 
    21 #include "Common/utility.h"  // for printAll, cloneAll, deleteAll
    22 #include "Declaration.h"     // for StructDecl, UnionDecl, EnumDecl, Declara...
    23 #include "Expression.h"      // for Expression
    24 #include "Type.h"            // for TypeInstType, StructInstType, UnionInstType
     16#include <cassert>            // for assert
     17#include <list>               // for list, _List_const_iterator, list<>::cons...
     18#include <ostream>            // for operator<<, basic_ostream, ostream, endl
     19#include <string>             // for string, operator<<, char_traits, operator==
     20
     21#include "Common/utility.h"   // for printAll, cloneAll, deleteAll
     22#include "Declaration.h"      // for StructDecl, UnionDecl, EnumDecl, Declara...
     23#include "Expression.h"       // for Expression
     24#include "Type.h"             // for TypeInstType, StructInstType, UnionInstType
     25#include "TypeSubstitution.h" // for TypeSubstitution
    2526
    2627class Attribute;
     
    4950
    5051namespace {
    51         void doLookup( const std::list< Declaration* > &members, const std::string &name, std::list< Declaration* > &foundDecls ) {
    52                 for ( std::list< Declaration* >::const_iterator i = members.begin(); i != members.end(); ++i ) {
    53                         if ( (*i)->get_name() == name ) {
    54                                 foundDecls.push_back( *i );
     52        void doLookup( const std::list< Declaration * > & members, const std::string & name, std::list< Declaration* > & foundDecls ) {
     53                for ( Declaration * decl : members ) {
     54                        if ( decl->name == name ) {
     55                                foundDecls.push_back( decl );
    5556                        } // if
    5657                } // for
     
    5960
    6061StructInstType::StructInstType( const Type::Qualifiers & tq, StructDecl * baseStruct, const std::list< Attribute * > & attributes ) :
    61                 Parent( tq, baseStruct->get_name(), attributes ), baseStruct( baseStruct ) {}
     62                Parent( tq, baseStruct->name, attributes ), baseStruct( baseStruct ) {}
    6263
    6364std::string StructInstType::typeString() const { return "struct"; }
     65
     66const std::list<TypeDecl*>* StructInstType::get_baseParameters() const {
     67        if ( ! baseStruct ) return nullptr;
     68        return &baseStruct->get_parameters();
     69}
    6470
    6571std::list<TypeDecl*>* StructInstType::get_baseParameters() {
     
    7076bool StructInstType::isComplete() const { return baseStruct ? baseStruct->has_body() : false; }
    7177
    72 AggregateDecl * StructInstType::getAggr() { return baseStruct; }
     78AggregateDecl * StructInstType::getAggr() const { return baseStruct; }
     79
     80TypeSubstitution StructInstType::genericSubstitution() const {
     81        return TypeSubstitution( get_baseParameters()->begin(), get_baseParameters()->end(), parameters.begin() );
     82}
    7383
    7484void StructInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
    7585        assert( baseStruct );
    76         doLookup( baseStruct->get_members(), name, foundDecls );
     86        doLookup( baseStruct->members, name, foundDecls );
    7787}
    7888
     
    93103
    94104UnionInstType::UnionInstType( const Type::Qualifiers & tq, UnionDecl * baseUnion, const std::list< Attribute * > & attributes ) :
    95                 Parent( tq, baseUnion->get_name(), attributes ), baseUnion( baseUnion ) {}
     105                Parent( tq, baseUnion->name, attributes ), baseUnion( baseUnion ) {}
    96106
    97107std::string UnionInstType::typeString() const { return "union"; }
     
    102112}
    103113
     114const std::list< TypeDecl * > * UnionInstType::get_baseParameters() const {
     115        if ( ! baseUnion ) return nullptr;
     116        return &baseUnion->get_parameters();
     117}
     118
    104119bool UnionInstType::isComplete() const { return baseUnion ? baseUnion->has_body() : false; }
    105120
    106 AggregateDecl * UnionInstType::getAggr() { return baseUnion; }
     121AggregateDecl * UnionInstType::getAggr() const { return baseUnion; }
     122
     123TypeSubstitution UnionInstType::genericSubstitution() const {
     124        return TypeSubstitution( get_baseParameters()->begin(), get_baseParameters()->end(), parameters.begin() );
     125}
    107126
    108127void UnionInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
    109128        assert( baseUnion );
    110         doLookup( baseUnion->get_members(), name, foundDecls );
     129        doLookup( baseUnion->members, name, foundDecls );
    111130}
    112131
     
    133152bool EnumInstType::isComplete() const { return baseEnum ? baseEnum->has_body() : false; }
    134153
     154AggregateDecl * EnumInstType::getAggr() const { return baseEnum; }
     155
    135156void EnumInstType::print( std::ostream &os, Indenter indent ) const {
    136157        using std::endl;
  • src/SynTree/ReferenceType.cc

    rf9feab8 r90152a4  
    1616#include "Type.h"
    1717#include "Expression.h"
     18#include "TypeSubstitution.h"
    1819#include "Common/utility.h"
    1920
     
    3536}
    3637
     38TypeSubstitution ReferenceType::genericSubstitution() const { return base->genericSubstitution(); }
     39
    3740void ReferenceType::print( std::ostream &os, Indenter indent ) const {
    3841        Type::print( os, indent );
  • src/SynTree/Statement.cc

    rf9feab8 r90152a4  
    3434Statement::Statement( const std::list<Label> & labels ) : labels( labels ) {}
    3535
    36 void Statement::print( std::ostream & os, Indenter ) const {
     36void Statement::print( std::ostream & os, Indenter indent ) const {
    3737        if ( ! labels.empty() ) {
    38                 os << "Labels: {";
     38                os << indent << "... Labels: {";
    3939                for ( const Label & l : labels ) {
    4040                        os << l << ",";
     
    9494
    9595
     96DirectiveStmt::DirectiveStmt( const std::string & directive ) : Statement(), directive( directive ) {}
     97
     98void DirectiveStmt::print( std::ostream &os, Indenter ) const {
     99        os << "GCC Directive:" << directive << endl;
     100}
     101
     102
    96103const char *BranchStmt::brType[] = { "Goto", "Break", "Continue" };
    97104
    98 BranchStmt::BranchStmt( Label target, Type type ) throw ( SemanticError ) :
     105BranchStmt::BranchStmt( Label target, Type type ) throw ( SemanticErrorException ) :
    99106        Statement(), originalTarget( target ), target( target ), computedTarget( nullptr ), type( type ) {
    100107        //actually this is a syntactic error signaled by the parser
    101108        if ( type == BranchStmt::Goto && target.empty() ) {
    102                 throw SemanticError("goto without target");
    103         }
    104 }
    105 
    106 BranchStmt::BranchStmt( Expression *computedTarget, Type type ) throw ( SemanticError ) :
     109                SemanticError( target.get_statement()->location, "goto without target");
     110        }
     111}
     112
     113BranchStmt::BranchStmt( Expression *computedTarget, Type type ) throw ( SemanticErrorException ) :
    107114        Statement(), computedTarget( computedTarget ), type( type ) {
    108115        if ( type != BranchStmt::Goto || computedTarget == nullptr ) {
    109                 throw SemanticError("Computed target not valid in branch statement");
     116                SemanticError( computedTarget->location, "Computed target not valid in branch statement");
    110117        }
    111118}
     
    201208}
    202209
    203 CaseStmt::CaseStmt( Expression *condition, const std::list<Statement *> &statements, bool deflt ) throw ( SemanticError ) :
     210CaseStmt::CaseStmt( Expression *condition, const std::list<Statement *> &statements, bool deflt ) throw ( SemanticErrorException ) :
    204211        Statement(), condition( condition ), stmts( statements ), _isDefault( deflt ) {
    205         if ( isDefault() && condition != 0 ) throw SemanticError("default case with condition: ", condition);
     212        if ( isDefault() && condition != 0 ) SemanticError( condition, "default case with condition: " );
    206213}
    207214
     
    223230
    224231void CaseStmt::print( std::ostream &os, Indenter indent ) const {
    225         if ( isDefault() ) os << "Default ";
     232        if ( isDefault() ) os << indent << "Default ";
    226233        else {
    227                 os << "Case ";
     234                os << indent << "Case ";
    228235                condition->print( os, indent );
    229236        } // if
     
    231238
    232239        for ( Statement * stmt : stmts ) {
     240                os << indent+1;
    233241                stmt->print( os, indent+1 );
    234242        }
    235243}
    236244
    237 WhileStmt::WhileStmt( Expression *condition, Statement *body, bool isDoWhile ):
    238         Statement(), condition( condition), body( body), isDoWhile( isDoWhile) {
     245WhileStmt::WhileStmt( Expression *condition, Statement *body, std::list< Statement * > & initialization, bool isDoWhile ):
     246        Statement(), condition( condition), body( body), initialization( initialization ), isDoWhile( isDoWhile) {
    239247}
    240248
     
    452460void WaitForStmt::print( std::ostream &os, Indenter indent ) const {
    453461        os << "Waitfor Statement" << endl;
    454         os << indent << "... with block:" << endl << indent+1;
    455         // block->print( os, indent + 4 );
     462        indent += 1;
     463        for( auto & clause : clauses ) {
     464                os << indent << "target function :";
     465                if(clause.target.function) { clause.target.function->print(os, indent + 1); }
     466                os << endl << indent << "with arguments :" << endl;
     467                for( auto & thing : clause.target.arguments) {
     468                        if(thing) { thing->print(os, indent + 1); }
     469                }
     470                os << indent << " with statment :" << endl;
     471                if(clause.statement) { clause.statement->print(os, indent + 1); }
     472
     473                os << indent << " with condition :" << endl;
     474                if(clause.condition) { clause.condition->print(os, indent + 1); }
     475        }
     476
     477        os << indent << " timeout of :" << endl;
     478        if(timeout.time) { timeout.time->print(os, indent + 1); }
     479
     480        os << indent << " with statment :" << endl;
     481        if(timeout.statement) { timeout.statement->print(os, indent + 1); }
     482
     483        os << indent << " with condition :" << endl;
     484        if(timeout.condition) { timeout.condition->print(os, indent + 1); }
     485
     486
     487        os << indent << " else :" << endl;
     488        if(orelse.statement) { orelse.statement->print(os, indent + 1); }
     489
     490        os << indent << " with condition :" << endl;
     491        if(orelse.condition) { orelse.condition->print(os, indent + 1); }
    456492}
    457493
     
    468504void WithStmt::print( std::ostream & os, Indenter indent ) const {
    469505        os << "With statement" << endl;
     506        os << indent << "... with expressions: " << endl;
     507        printAll( exprs, os, indent+1 );
    470508        os << indent << "... with statement:" << endl << indent+1;
    471509        stmt->print( os, indent+1 );
     
    476514}
    477515
    478 void NullStmt::print( std::ostream &os, Indenter ) const {
     516void NullStmt::print( std::ostream &os, Indenter indent ) const {
    479517        os << "Null Statement" << endl;
     518        Statement::print( os, indent );
    480519}
    481520
  • src/SynTree/Statement.h

    rf9feab8 r90152a4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep  3 20:46:46 2017
    13 // Update Count     : 77
     12// Last Modified On : Thu Mar  8 14:53:02 2018
     13// Update Count     : 78
    1414//
    1515
     
    126126};
    127127
     128class DirectiveStmt : public Statement {
     129        public:
     130        std::string directive;
     131
     132        DirectiveStmt( const std::string & );
     133        virtual ~DirectiveStmt(){}
     134
     135        virtual DirectiveStmt * clone() const { return new DirectiveStmt( *this ); }
     136        virtual void accept( Visitor & v ) { v.visit( this ); }
     137        virtual Statement * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     138        virtual void print( std::ostream & os, Indenter indent = {} ) const;
     139};
     140
    128141class IfStmt : public Statement {
    129142  public:
     
    179192        std::list<Statement *> stmts;
    180193
    181         CaseStmt( Expression *conditions, const std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError);
     194        CaseStmt( Expression *conditions, const std::list<Statement *> &stmts, bool isdef = false ) throw (SemanticErrorException);
    182195        CaseStmt( const CaseStmt &other );
    183196        virtual ~CaseStmt();
     
    207220        Expression *condition;
    208221        Statement *body;
     222        std::list<Statement *> initialization;
    209223        bool isDoWhile;
    210224
    211225        WhileStmt( Expression *condition,
    212                Statement *body, bool isDoWhile = false );
     226               Statement *body, std::list<Statement *> & initialization, bool isDoWhile = false );
    213227        WhileStmt( const WhileStmt &other );
    214228        virtual ~WhileStmt();
     
    255269class BranchStmt : public Statement {
    256270  public:
    257         enum Type { Goto = 0, Break, Continue };
     271        enum Type { Goto = 0, Break, Continue, FallThrough, FallThroughDefault };
    258272
    259273        // originalTarget kept for error messages.
     
    263277        Type type;
    264278
    265         BranchStmt( Label target, Type ) throw (SemanticError);
    266         BranchStmt( Expression *computedTarget, Type ) throw (SemanticError);
     279        BranchStmt( Label target, Type ) throw (SemanticErrorException);
     280        BranchStmt( Expression *computedTarget, Type ) throw (SemanticErrorException);
    267281
    268282        Label get_originalTarget() { return originalTarget; }
  • src/SynTree/SynTree.h

    rf9feab8 r90152a4  
    3838class TypedefDecl;
    3939class AsmDecl;
     40class StaticAssertDecl;
    4041
    4142class Statement;
     
    4344class ExprStmt;
    4445class AsmStmt;
     46class DirectiveStmt;
    4547class IfStmt;
    4648class WhileStmt;
     
    6870class LabelAddressExpr;
    6971class CastExpr;
     72class KeywordCastExpr;
    7073class VirtualCastExpr;
    7174class MemberExpr;
     
    97100class UntypedInitExpr;
    98101class InitExpr;
     102class DeletedExpr;
     103class DefaultArgExpr;
     104class GenericExpr;
    99105
    100106class Type;
     
    104110class ArrayType;
    105111class ReferenceType;
     112class QualifiedType;
    106113class FunctionType;
    107114class ReferenceToType;
     
    117124class ZeroType;
    118125class OneType;
     126class GlobalScopeType;
    119127
    120128class Designation;
  • src/SynTree/Type.cc

    rf9feab8 r90152a4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 25 15:16:32 2017
    13 // Update Count     : 38
     12// Last Modified On : Fri Jun 22 10:17:19 2018
     13// Update Count     : 39
    1414//
    1515#include "Type.h"
    1616
    17 #include "Attribute.h"               // for Attribute
    18 #include "Common/utility.h"          // for cloneAll, deleteAll, printAll
    19 #include "InitTweak/InitTweak.h"     // for getPointerBase
    20 #include "SynTree/BaseSyntaxNode.h"  // for BaseSyntaxNode
    21 #include "SynTree/Declaration.h"     // for TypeDecl
     17#include "Attribute.h"                // for Attribute
     18#include "Common/utility.h"           // for cloneAll, deleteAll, printAll
     19#include "InitTweak/InitTweak.h"      // for getPointerBase
     20#include "SynTree/BaseSyntaxNode.h"   // for BaseSyntaxNode
     21#include "SynTree/Declaration.h"      // for TypeDecl
     22#include "SynTree/TypeSubstitution.h" // for TypeSubstitution
    2223
    2324using namespace std;
    2425
    25 const char *BasicType::typeNames[BasicType::NUMBER_OF_BASIC_TYPES] = {
     26const char *BasicType::typeNames[] = {
    2627        "_Bool",
    2728        "char",
     
    4748        "__int128",
    4849        "unsigned __int128",
     50        "__float80",
     51        "__float128"
    4952};
     53static_assert(
     54        sizeof(BasicType::typeNames)/sizeof(BasicType::typeNames[0]) == BasicType::NUMBER_OF_BASIC_TYPES,
     55        "Each basic type name should have a corresponding kind enum value"
     56);
    5057
    5158Type::Type( const Qualifiers &tq, const std::list< Attribute * > & attributes ) : tq( tq ), attributes( attributes ) {}
     
    6269
    6370// These must remain in the same order as the corresponding bit fields.
    64 const char * Type::FuncSpecifiersNames[] = { "inline", "fortran", "_Noreturn" };
     71const char * Type::FuncSpecifiersNames[] = { "inline", "_Noreturn", "fortran" };
    6572const char * Type::StorageClassesNames[] = { "extern", "static", "auto", "register", "_Thread_local" };
    6673const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", "lvalue", "mutex", "_Atomic" };
     
    8188int Type::referenceDepth() const { return 0; }
    8289
     90TypeSubstitution Type::genericSubstitution() const { assertf( false, "Non-aggregate type: %s", toCString( this ) ); }
     91
    8392void Type::print( std::ostream &os, Indenter indent ) const {
    8493        if ( ! forall.empty() ) {
     
    96105}
    97106
     107
     108QualifiedType::QualifiedType( const Type::Qualifiers & tq, Type * parent, Type * child ) : Type( tq, {} ), parent( parent ), child( child ) {
     109}
     110
     111QualifiedType::QualifiedType( const QualifiedType & other ) : Type( other ), parent( maybeClone( other.parent ) ), child( maybeClone( other.child ) ) {
     112}
     113
     114QualifiedType::~QualifiedType() {
     115        delete parent;
     116        delete child;
     117}
     118
     119void QualifiedType::print( std::ostream & os, Indenter indent ) const {
     120        os << "Qualified Type: " << endl;
     121        os << indent+1;
     122        parent->print( os, indent+1 );
     123        os << endl << indent+1;
     124        child->print( os, indent+1 );
     125        os << endl;
     126        Type::print( os, indent+1 );
     127}
     128
     129GlobalScopeType::GlobalScopeType() : Type( Type::Qualifiers(), {} ) {}
     130
     131void GlobalScopeType::print( std::ostream & os, Indenter ) const {
     132        os << "Global Scope Type" << endl;
     133}
     134
     135
    98136// Empty Variable declarations:
    99137const Type::FuncSpecifiers noFuncSpecifiers;
  • src/SynTree/Type.h

    rf9feab8 r90152a4  
    178178        virtual bool isComplete() const { return true; }
    179179
    180         virtual AggregateDecl * getAggr() {     assertf( false, "Non-aggregate type: %s", toString( this ).c_str() ); }
     180        virtual AggregateDecl * getAggr() const { assertf( false, "Non-aggregate type: %s", toCString( this ) ); }
     181
     182        virtual TypeSubstitution genericSubstitution() const;
    181183
    182184        virtual Type *clone() const = 0;
     
    229231                SignedInt128,
    230232                UnsignedInt128,
     233                Float80,
     234                Float128,
    231235                NUMBER_OF_BASIC_TYPES
    232236        } kind;
     
    311315};
    312316
     317class QualifiedType : public Type {
     318public:
     319        Type * parent;
     320        Type * child;
     321
     322        QualifiedType( const Type::Qualifiers & tq, Type * parent, Type * child );
     323        QualifiedType( const QualifiedType & tq );
     324        virtual ~QualifiedType();
     325
     326        virtual QualifiedType *clone() const override { return new QualifiedType( *this ); }
     327        virtual void accept( Visitor & v ) override { v.visit( this ); }
     328        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     329        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
     330};
     331
    313332class ReferenceType : public Type {
    314333public:
     
    328347        // the number of values are disallowed.
    329348        virtual unsigned size() const override { return base->size(); }
     349
     350        virtual TypeSubstitution genericSubstitution() const override;
    330351
    331352        virtual ReferenceType *clone() const override { return new ReferenceType( *this ); }
     
    356377        bool isTtype() const;
    357378
     379        bool isUnprototyped() const { return isVarArgs && parameters.size() == 0; }
     380
    358381        virtual FunctionType *clone() const override { return new FunctionType( *this ); }
    359382        virtual void accept( Visitor & v ) override { v.visit( this ); }
     
    404427        /// Accesses generic parameters of base struct (NULL if none such)
    405428        std::list<TypeDecl*> * get_baseParameters();
     429        const std::list<TypeDecl*> * get_baseParameters() const;
    406430
    407431        virtual bool isComplete() const override;
    408432
    409         virtual AggregateDecl * getAggr() override;
     433        virtual AggregateDecl * getAggr() const override;
     434
     435        virtual TypeSubstitution genericSubstitution() const override;
    410436
    411437        /// Looks up the members of this struct named "name" and places them into "foundDecls".
     
    437463
    438464        /// Accesses generic parameters of base union (NULL if none such)
    439         std::list< TypeDecl * > * get_baseParameters();
     465        std::list<TypeDecl*> * get_baseParameters();
     466        const std::list<TypeDecl*> * get_baseParameters() const;
    440467
    441468        virtual bool isComplete() const override;
    442469
    443         virtual AggregateDecl * getAggr() override;
     470        virtual AggregateDecl * getAggr() const override;
     471
     472        virtual TypeSubstitution genericSubstitution() const override;
    444473
    445474        /// looks up the members of this union named "name" and places them into "foundDecls"
     
    471500
    472501        virtual bool isComplete() const override;
     502
     503        virtual AggregateDecl * getAggr() const override;
    473504
    474505        virtual EnumInstType *clone() const override { return new EnumInstType( *this ); }
     
    651682};
    652683
     684class GlobalScopeType : public Type {
     685  public:
     686        GlobalScopeType();
     687
     688        virtual GlobalScopeType *clone() const override { return new GlobalScopeType( *this ); }
     689        virtual void accept( Visitor & v ) override { v.visit( this ); }
     690        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
     691        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
     692};
     693
    653694// Local Variables: //
    654695// tab-width: 4 //
  • src/SynTree/TypeSubstitution.cc

    rf9feab8 r90152a4  
    106106}
    107107
     108namespace {
     109        struct EnvTrimmer {
     110                TypeSubstitution * env, * newEnv;
     111                EnvTrimmer( TypeSubstitution * env, TypeSubstitution * newEnv ) : env( env ), newEnv( newEnv ){}
     112                void previsit( TypeDecl * tyDecl ) {
     113                        // transfer known bindings for seen type variables
     114                        if ( Type * t = env->lookup( tyDecl->name ) ) {
     115                                newEnv->add( tyDecl->name, t );
     116                        }
     117                }
     118        };
     119} // namespace
     120
     121/// reduce environment to just the parts that are referenced in a given expression
     122TypeSubstitution * TypeSubstitution::newFromExpr( Expression * expr, TypeSubstitution * env ) {
     123        if ( env ) {
     124                TypeSubstitution * newEnv = new TypeSubstitution();
     125                PassVisitor<EnvTrimmer> trimmer( env, newEnv );
     126                expr->accept( trimmer );
     127                return newEnv;
     128        }
     129        return nullptr;
     130}
     131
    108132void TypeSubstitution::normalize() {
     133        PassVisitor<Substituter> sub( *this, true );
    109134        do {
    110                 subCount = 0;
    111                 freeOnly = true;
     135                sub.pass.subCount = 0;
     136                sub.pass.freeOnly = true;
    112137                for ( TypeEnvType::iterator i = typeEnv.begin(); i != typeEnv.end(); ++i ) {
    113                         i->second = i->second->acceptMutator( *this );
     138                        i->second = i->second->acceptMutator( sub );
    114139                }
    115         } while ( subCount );
    116 }
    117 
    118 Type * TypeSubstitution::mutate( TypeInstType *inst ) {
    119         BoundVarsType::const_iterator bound = boundVars.find( inst->get_name() );
     140        } while ( sub.pass.subCount );
     141}
     142
     143Type * TypeSubstitution::Substituter::postmutate( TypeInstType *inst ) {
     144        BoundVarsType::const_iterator bound = boundVars.find( inst->name );
    120145        if ( bound != boundVars.end() ) return inst;
    121146
    122         TypeEnvType::const_iterator i = typeEnv.find( inst->get_name() );
    123         if ( i == typeEnv.end() ) {
     147        TypeEnvType::const_iterator i = sub.typeEnv.find( inst->get_name() );
     148        if ( i == sub.typeEnv.end() ) {
    124149                return inst;
    125150        } else {
    126 ///         std::cout << "found " << inst->get_name() << ", replacing with ";
    127 ///         i->second->print( std::cout );
    128 ///         std::cout << std::endl;
     151                // cut off infinite loop for the case where a type is bound to itself.
     152                // Note: this does not prevent cycles in the general case, so it may be necessary to do something more sophisticated here.
     153                // TODO: investigate preventing type variables from being bound to themselves in the first place.
     154                if ( TypeInstType * replacement = dynamic_cast< TypeInstType * >( i->second ) ) {
     155                        if ( inst->name == replacement->name ) {
     156                                return inst;
     157                        }
     158                }
     159                // std::cerr << "found " << inst->name << ", replacing with " << i->second << std::endl;
    129160                subCount++;
    130                 Type *newtype = i->second->clone();
     161                Type * newtype = i->second->clone();
    131162                newtype->get_qualifiers() |= inst->get_qualifiers();
    132163                delete inst;
    133                 return newtype;
    134         } // if
    135 }
    136 
    137 Expression * TypeSubstitution::mutate( NameExpr *nameExpr ) {
    138         VarEnvType::const_iterator i = varEnv.find( nameExpr->get_name() );
    139         if ( i == varEnv.end() ) {
     164                // Note: need to recursively apply substitution to the new type because normalize does not substitute bound vars, but bound vars must be substituted when not in freeOnly mode.
     165                return newtype->acceptMutator( *visitor );
     166        } // if
     167}
     168
     169Expression * TypeSubstitution::Substituter::postmutate( NameExpr * nameExpr ) {
     170        VarEnvType::const_iterator i = sub.varEnv.find( nameExpr->name );
     171        if ( i == sub.varEnv.end() ) {
    140172                return nameExpr;
    141173        } else {
     
    146178}
    147179
    148 template< typename TypeClass >
    149 Type *TypeSubstitution::handleType( TypeClass *type ) {
    150         ValueGuard<BoundVarsType> oldBoundVars( boundVars );
     180void TypeSubstitution::Substituter::premutate( Type * type ) {
     181        GuardValue( boundVars );
    151182        // bind type variables from forall-qualifiers
    152183        if ( freeOnly ) {
    153                 for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
    154                         boundVars.insert( (*tyvar )->get_name() );
     184                for ( Type::ForallList::const_iterator tyvar = type->forall.begin(); tyvar != type->forall.end(); ++tyvar ) {
     185                        boundVars.insert( (*tyvar)->name );
    155186                } // for
    156187        } // if
    157         Type *ret = Mutator::mutate( type );
    158         return ret;
    159188}
    160189
    161190template< typename TypeClass >
    162 Type *TypeSubstitution::handleAggregateType( TypeClass *type ) {
    163         ValueGuard<BoundVarsType> oldBoundVars( boundVars );
     191void TypeSubstitution::Substituter::handleAggregateType( TypeClass * type ) {
     192        GuardValue( boundVars );
    164193        // bind type variables from forall-qualifiers
    165194        if ( freeOnly ) {
    166                 for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
    167                         boundVars.insert( (*tyvar )->get_name() );
     195                for ( Type::ForallList::const_iterator tyvar = type->forall.begin(); tyvar != type->forall.end(); ++tyvar ) {
     196                        boundVars.insert( (*tyvar)->name );
    168197                } // for
    169198                // bind type variables from generic type instantiations
    170199                std::list< TypeDecl* > *baseParameters = type->get_baseParameters();
    171                 if ( baseParameters && ! type->get_parameters().empty() ) {
     200                if ( baseParameters && ! type->parameters.empty() ) {
    172201                        for ( std::list< TypeDecl* >::const_iterator tyvar = baseParameters->begin(); tyvar != baseParameters->end(); ++tyvar ) {
    173                                 boundVars.insert( (*tyvar)->get_name() );
     202                                boundVars.insert( (*tyvar)->name );
    174203                        } // for
    175204                } // if
    176205        } // if
    177         Type *ret = Mutator::mutate( type );
    178         return ret;
    179 }
    180 
    181 Type * TypeSubstitution::mutate( VoidType *voidType ) {
    182         return handleType( voidType );
    183 }
    184 
    185 Type * TypeSubstitution::mutate( BasicType *basicType ) {
    186         return handleType( basicType );
    187 }
    188 
    189 Type * TypeSubstitution::mutate( PointerType *pointerType ) {
    190         return handleType( pointerType );
    191 }
    192 
    193 Type * TypeSubstitution::mutate( ArrayType *arrayType ) {
    194         return handleType( arrayType );
    195 }
    196 
    197 Type * TypeSubstitution::mutate( FunctionType *functionType ) {
    198         return handleType( functionType );
    199 }
    200 
    201 Type * TypeSubstitution::mutate( StructInstType *aggregateUseType ) {
    202         return handleAggregateType( aggregateUseType );
    203 }
    204 
    205 Type * TypeSubstitution::mutate( UnionInstType *aggregateUseType ) {
    206         return handleAggregateType( aggregateUseType );
    207 }
    208 
    209 Type * TypeSubstitution::mutate( EnumInstType *aggregateUseType ) {
    210         return handleType( aggregateUseType );
    211 }
    212 
    213 Type * TypeSubstitution::mutate( TraitInstType *aggregateUseType ) {
    214         return handleType( aggregateUseType );
    215 }
    216 
    217 Type * TypeSubstitution::mutate( TupleType *tupleType ) {
    218         return handleType( tupleType );
    219 }
    220 
    221 Type * TypeSubstitution::mutate( VarArgsType *varArgsType ) {
    222         return handleType( varArgsType );
    223 }
    224 
    225 Type * TypeSubstitution::mutate( ZeroType *zeroType ) {
    226         return handleType( zeroType );
    227 }
    228 
    229 Type * TypeSubstitution::mutate( OneType *oneType ) {
    230         return handleType( oneType );
     206}
     207
     208void TypeSubstitution::Substituter::premutate( StructInstType * aggregateUseType ) {
     209        handleAggregateType( aggregateUseType );
     210}
     211
     212void TypeSubstitution::Substituter::premutate( UnionInstType *aggregateUseType ) {
     213        handleAggregateType( aggregateUseType );
    231214}
    232215
  • src/SynTree/TypeSubstitution.h

    rf9feab8 r90152a4  
    2727#include "SynTree/Declaration.h"   // for TypeDecl, Declaration (ptr only)
    2828#include "SynTree/Expression.h"    // for Expression (ptr only), NameExpr (p...
    29 #include "SynTree/Mutator.h"       // for Mutator
    3029#include "SynTree/Type.h"          // for Type, ArrayType (ptr only), BasicT...
    3130
    32 class TypeSubstitution : public Mutator {
    33         typedef Mutator Parent;
     31class TypeSubstitution {
    3432  public:
    3533        TypeSubstitution();
     
    5755        void extract( TypeInstListIterator begin, TypeInstListIterator end, TypeSubstitution &result );
    5856
     57        /// create a new TypeSubstitution using bindings from env containing all of the type variables in expr
     58        static TypeSubstitution * newFromExpr( Expression * expr, TypeSubstitution * env );
     59
    5960        void normalize();
    6061
     
    6465        TypeSubstitution *clone() const { return new TypeSubstitution( *this ); }
    6566  private:
    66         virtual Type* mutate(TypeInstType *aggregateUseType);
    67         virtual Expression* mutate(NameExpr *nameExpr);
    68 
    69         /// Records type variable bindings from forall-statements
    70         template< typename TypeClass > Type *handleType( TypeClass *type );
    71         /// Records type variable bindings from forall-statements and instantiations of generic types
    72         template< typename TypeClass > Type *handleAggregateType( TypeClass *type );
    73 
    74         virtual Type* mutate(VoidType *basicType);
    75         virtual Type* mutate(BasicType *basicType);
    76         virtual Type* mutate(PointerType *pointerType);
    77         virtual Type* mutate(ArrayType *arrayType);
    78         virtual Type* mutate(FunctionType *functionType);
    79         virtual Type* mutate(StructInstType *aggregateUseType);
    80         virtual Type* mutate(UnionInstType *aggregateUseType);
    81         virtual Type* mutate(EnumInstType *aggregateUseType);
    82         virtual Type* mutate(TraitInstType *aggregateUseType);
    83         virtual Type* mutate(TupleType *tupleType);
    84         virtual Type* mutate(VarArgsType *varArgsType);
    85         virtual Type* mutate(ZeroType *zeroType);
    86         virtual Type* mutate(OneType *oneType);
     67
     68        // Mutator that performs the substitution
     69        struct Substituter;
    8770
    8871        // TODO: worry about traversing into a forall-qualified function type or type decl with assertions
     
    9780        typedef std::map< std::string, Type* > TypeEnvType;
    9881        typedef std::map< std::string, Expression* > VarEnvType;
    99         typedef std::set< std::string > BoundVarsType;
    10082        TypeEnvType typeEnv;
    10183        VarEnvType varEnv;
    102         BoundVarsType boundVars;
    103         int subCount;
    104         bool freeOnly;
     84
     85  public:
     86        // has to come after declaration of typeEnv
     87        auto begin()       -> decltype( typeEnv.begin() ) { return typeEnv.begin(); }
     88        auto   end()       -> decltype( typeEnv.  end() ) { return typeEnv.  end(); }
     89        auto begin() const -> decltype( typeEnv.begin() ) { return typeEnv.begin(); }
     90        auto   end() const -> decltype( typeEnv.  end() ) { return typeEnv.  end(); }
    10591};
    10692
     
    122108                                } // if
    123109                        } else {
    124                                 throw SemanticError( toString( "Attempt to provide non-type parameter: ", toString( *actualIt ).c_str(), " for type parameter " ), formal );
     110                                SemanticError( formal, toString( "Attempt to provide non-type parameter: ", toString( *actualIt ).c_str(), " for type parameter " ) );
    125111                        } // if
    126112                } else {
     
    134120
    135121template< typename FormalIterator, typename ActualIterator >
    136 TypeSubstitution::TypeSubstitution( FormalIterator formalBegin, FormalIterator formalEnd, ActualIterator actualBegin )
    137 {
     122TypeSubstitution::TypeSubstitution( FormalIterator formalBegin, FormalIterator formalEnd, ActualIterator actualBegin ) {
    138123        add( formalBegin, formalEnd, actualBegin );
    139124}
     125
     126// include needs to happen after TypeSubstitution is defined so that both TypeSubstitution and
     127// PassVisitor are defined before PassVisitor implementation accesses TypeSubstitution internals.
     128#include "Common/PassVisitor.h"
     129
     130// definitition must happen after PassVisitor is included so that WithGuards can be used
     131struct TypeSubstitution::Substituter : public WithGuards, public WithVisitorRef<Substituter> {
     132                Substituter( TypeSubstitution & sub, bool freeOnly ) : sub( sub ), freeOnly( freeOnly ) {}
     133
     134                Type * postmutate( TypeInstType * aggregateUseType );
     135                Expression * postmutate( NameExpr * nameExpr );
     136
     137                /// Records type variable bindings from forall-statements
     138                void premutate( Type * type );
     139                /// Records type variable bindings from forall-statements and instantiations of generic types
     140                template< typename TypeClass > void handleAggregateType( TypeClass * type );
     141
     142                void premutate( StructInstType * aggregateUseType );
     143                void premutate( UnionInstType * aggregateUseType );
     144
     145                TypeSubstitution & sub;
     146                int subCount = 0;
     147                bool freeOnly;
     148                typedef std::set< std::string > BoundVarsType;
     149                BoundVarsType boundVars;
     150};
    140151
    141152template< typename SynTreeClass >
    142153int TypeSubstitution::apply( SynTreeClass *&input ) {
    143154        assert( input );
    144         subCount = 0;
    145         freeOnly = false;
    146         input = dynamic_cast< SynTreeClass *>( input->acceptMutator( *this ) );
    147         assert( input );
    148 ///     std::cout << "substitution result is: ";
    149 ///     newType->print( std::cout );
    150 ///     std::cout << std::endl;
    151         return subCount;
     155        PassVisitor<Substituter> sub( *this, false );
     156        input = dynamic_cast< SynTreeClass * >( input->acceptMutator( sub ) );
     157        assert( input );
     158///     std::cerr << "substitution result is: ";
     159///     newType->print( std::cerr );
     160///     std::cerr << std::endl;
     161        return sub.pass.subCount;
    152162}
    153163
     
    155165int TypeSubstitution::applyFree( SynTreeClass *&input ) {
    156166        assert( input );
    157         subCount = 0;
    158         freeOnly = true;
    159         input = dynamic_cast< SynTreeClass *>( input->acceptMutator( *this ) );
    160         assert( input );
    161 ///     std::cout << "substitution result is: ";
    162 ///     newType->print( std::cout );
    163 ///     std::cout << std::endl;
    164         return subCount;
     167        PassVisitor<Substituter> sub( *this, true );
     168        input = dynamic_cast< SynTreeClass * >( input->acceptMutator( sub ) );
     169        assert( input );
     170///     std::cerr << "substitution result is: ";
     171///     newType->print( std::cerr );
     172///     std::cerr << std::endl;
     173        return sub.pass.subCount;
    165174}
    166175
  • src/SynTree/Visitor.h

    rf9feab8 r90152a4  
    2121class Visitor {
    2222  protected:
    23         Visitor();
    24         virtual ~Visitor();
     23        Visitor() = default;
     24        virtual ~Visitor() = default;
    2525  public:
    2626        // visit: Default implementation of all functions visits the children
    2727        // of the given syntax node, but performs no other action.
    2828
    29         virtual void visit( ObjectDecl * objectDecl );
    30         virtual void visit( FunctionDecl * functionDecl );
    31         virtual void visit( StructDecl * aggregateDecl );
    32         virtual void visit( UnionDecl * aggregateDecl );
    33         virtual void visit( EnumDecl * aggregateDecl );
    34         virtual void visit( TraitDecl * aggregateDecl );
    35         virtual void visit( TypeDecl * typeDecl );
    36         virtual void visit( TypedefDecl * typeDecl );
    37         virtual void visit( AsmDecl * asmDecl );
     29        virtual void visit( ObjectDecl * objectDecl ) = 0;
     30        virtual void visit( FunctionDecl * functionDecl ) = 0;
     31        virtual void visit( StructDecl * aggregateDecl ) = 0;
     32        virtual void visit( UnionDecl * aggregateDecl ) = 0;
     33        virtual void visit( EnumDecl * aggregateDecl ) = 0;
     34        virtual void visit( TraitDecl * aggregateDecl ) = 0;
     35        virtual void visit( TypeDecl * typeDecl ) = 0;
     36        virtual void visit( TypedefDecl * typeDecl ) = 0;
     37        virtual void visit( AsmDecl * asmDecl ) = 0;
     38        virtual void visit( StaticAssertDecl * assertDecl ) = 0;
    3839
    39         virtual void visit( CompoundStmt * compoundStmt );
    40         virtual void visit( ExprStmt * exprStmt );
    41         virtual void visit( AsmStmt * asmStmt );
    42         virtual void visit( IfStmt * ifStmt );
    43         virtual void visit( WhileStmt * whileStmt );
    44         virtual void visit( ForStmt * forStmt );
    45         virtual void visit( SwitchStmt * switchStmt );
    46         virtual void visit( CaseStmt * caseStmt );
    47         virtual void visit( BranchStmt * branchStmt );
    48         virtual void visit( ReturnStmt * returnStmt );
    49         virtual void visit( ThrowStmt * throwStmt );
    50         virtual void visit( TryStmt * tryStmt );
    51         virtual void visit( CatchStmt * catchStmt );
    52         virtual void visit( FinallyStmt * finallyStmt );
    53         virtual void visit( WaitForStmt * waitforStmt );
    54         virtual void visit( WithStmt * withStmt );
    55         virtual void visit( NullStmt * nullStmt );
    56         virtual void visit( DeclStmt * declStmt );
    57         virtual void visit( ImplicitCtorDtorStmt * impCtorDtorStmt );
     40        virtual void visit( CompoundStmt * compoundStmt ) = 0;
     41        virtual void visit( ExprStmt * exprStmt ) = 0;
     42        virtual void visit( AsmStmt * asmStmt ) = 0;
     43        virtual void visit( DirectiveStmt * directiveStmt ) = 0;
     44        virtual void visit( IfStmt * ifStmt ) = 0;
     45        virtual void visit( WhileStmt * whileStmt ) = 0;
     46        virtual void visit( ForStmt * forStmt ) = 0;
     47        virtual void visit( SwitchStmt * switchStmt ) = 0;
     48        virtual void visit( CaseStmt * caseStmt ) = 0;
     49        virtual void visit( BranchStmt * branchStmt ) = 0;
     50        virtual void visit( ReturnStmt * returnStmt ) = 0;
     51        virtual void visit( ThrowStmt * throwStmt ) = 0;
     52        virtual void visit( TryStmt * tryStmt ) = 0;
     53        virtual void visit( CatchStmt * catchStmt ) = 0;
     54        virtual void visit( FinallyStmt * finallyStmt ) = 0;
     55        virtual void visit( WaitForStmt * waitforStmt ) = 0;
     56        virtual void visit( WithStmt * withStmt ) = 0;
     57        virtual void visit( NullStmt * nullStmt ) = 0;
     58        virtual void visit( DeclStmt * declStmt ) = 0;
     59        virtual void visit( ImplicitCtorDtorStmt * impCtorDtorStmt ) = 0;
    5860
    59         virtual void visit( ApplicationExpr * applicationExpr );
    60         virtual void visit( UntypedExpr * untypedExpr );
    61         virtual void visit( NameExpr * nameExpr );
    62         virtual void visit( CastExpr * castExpr );
    63         virtual void visit( VirtualCastExpr * castExpr );
    64         virtual void visit( AddressExpr * addressExpr );
    65         virtual void visit( LabelAddressExpr * labAddressExpr );
    66         virtual void visit( UntypedMemberExpr * memberExpr );
    67         virtual void visit( MemberExpr * memberExpr );
    68         virtual void visit( VariableExpr * variableExpr );
    69         virtual void visit( ConstantExpr * constantExpr );
    70         virtual void visit( SizeofExpr * sizeofExpr );
    71         virtual void visit( AlignofExpr * alignofExpr );
    72         virtual void visit( UntypedOffsetofExpr * offsetofExpr );
    73         virtual void visit( OffsetofExpr * offsetofExpr );
    74         virtual void visit( OffsetPackExpr * offsetPackExpr );
    75         virtual void visit( AttrExpr * attrExpr );
    76         virtual void visit( LogicalExpr * logicalExpr );
    77         virtual void visit( ConditionalExpr * conditionalExpr );
    78         virtual void visit( CommaExpr * commaExpr );
    79         virtual void visit( TypeExpr * typeExpr );
    80         virtual void visit( AsmExpr * asmExpr );
    81         virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr );
    82         virtual void visit( ConstructorExpr *  ctorExpr );
    83         virtual void visit( CompoundLiteralExpr * compLitExpr );
    84         virtual void visit( RangeExpr * rangeExpr );
    85         virtual void visit( UntypedTupleExpr * tupleExpr );
    86         virtual void visit( TupleExpr * tupleExpr );
    87         virtual void visit( TupleIndexExpr * tupleExpr );
    88         virtual void visit( TupleAssignExpr * assignExpr );
    89         virtual void visit( StmtExpr *  stmtExpr );
    90         virtual void visit( UniqueExpr *  uniqueExpr );
    91         virtual void visit( UntypedInitExpr *  initExpr );
    92         virtual void visit( InitExpr *  initExpr );
     61        virtual void visit( ApplicationExpr * applicationExpr ) = 0;
     62        virtual void visit( UntypedExpr * untypedExpr ) = 0;
     63        virtual void visit( NameExpr * nameExpr ) = 0;
     64        virtual void visit( CastExpr * castExpr ) = 0;
     65        virtual void visit( KeywordCastExpr * castExpr ) = 0;
     66        virtual void visit( VirtualCastExpr * castExpr ) = 0;
     67        virtual void visit( AddressExpr * addressExpr ) = 0;
     68        virtual void visit( LabelAddressExpr * labAddressExpr ) = 0;
     69        virtual void visit( UntypedMemberExpr * memberExpr ) = 0;
     70        virtual void visit( MemberExpr * memberExpr ) = 0;
     71        virtual void visit( VariableExpr * variableExpr ) = 0;
     72        virtual void visit( ConstantExpr * constantExpr ) = 0;
     73        virtual void visit( SizeofExpr * sizeofExpr ) = 0;
     74        virtual void visit( AlignofExpr * alignofExpr ) = 0;
     75        virtual void visit( UntypedOffsetofExpr * offsetofExpr ) = 0;
     76        virtual void visit( OffsetofExpr * offsetofExpr ) = 0;
     77        virtual void visit( OffsetPackExpr * offsetPackExpr ) = 0;
     78        virtual void visit( AttrExpr * attrExpr ) = 0;
     79        virtual void visit( LogicalExpr * logicalExpr ) = 0;
     80        virtual void visit( ConditionalExpr * conditionalExpr ) = 0;
     81        virtual void visit( CommaExpr * commaExpr ) = 0;
     82        virtual void visit( TypeExpr * typeExpr ) = 0;
     83        virtual void visit( AsmExpr * asmExpr ) = 0;
     84        virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr ) = 0;
     85        virtual void visit( ConstructorExpr *  ctorExpr ) = 0;
     86        virtual void visit( CompoundLiteralExpr * compLitExpr ) = 0;
     87        virtual void visit( RangeExpr * rangeExpr ) = 0;
     88        virtual void visit( UntypedTupleExpr * tupleExpr ) = 0;
     89        virtual void visit( TupleExpr * tupleExpr ) = 0;
     90        virtual void visit( TupleIndexExpr * tupleExpr ) = 0;
     91        virtual void visit( TupleAssignExpr * assignExpr ) = 0;
     92        virtual void visit( StmtExpr *  stmtExpr ) = 0;
     93        virtual void visit( UniqueExpr *  uniqueExpr ) = 0;
     94        virtual void visit( UntypedInitExpr *  initExpr ) = 0;
     95        virtual void visit( InitExpr *  initExpr ) = 0;
     96        virtual void visit( DeletedExpr * delExpr ) = 0;
     97        virtual void visit( DefaultArgExpr * argExpr ) = 0;
     98        virtual void visit( GenericExpr * genExpr ) = 0;
    9399
    94         virtual void visit( VoidType * basicType );
    95         virtual void visit( BasicType * basicType );
    96         virtual void visit( PointerType * pointerType );
    97         virtual void visit( ArrayType * arrayType );
    98         virtual void visit( ReferenceType * refType );
    99         virtual void visit( FunctionType * functionType );
    100         virtual void visit( StructInstType * aggregateUseType );
    101         virtual void visit( UnionInstType * aggregateUseType );
    102         virtual void visit( EnumInstType * aggregateUseType );
    103         virtual void visit( TraitInstType * aggregateUseType );
    104         virtual void visit( TypeInstType * aggregateUseType );
    105         virtual void visit( TupleType * tupleType );
    106         virtual void visit( TypeofType * typeofType );
    107         virtual void visit( AttrType * attrType );
    108         virtual void visit( VarArgsType * varArgsType );
    109         virtual void visit( ZeroType * zeroType );
    110         virtual void visit( OneType * oneType );
     100        virtual void visit( VoidType * basicType ) = 0;
     101        virtual void visit( BasicType * basicType ) = 0;
     102        virtual void visit( PointerType * pointerType ) = 0;
     103        virtual void visit( ArrayType * arrayType ) = 0;
     104        virtual void visit( ReferenceType * refType ) = 0;
     105        virtual void visit( QualifiedType * qualType ) = 0;
     106        virtual void visit( FunctionType * functionType ) = 0;
     107        virtual void visit( StructInstType * aggregateUseType ) = 0;
     108        virtual void visit( UnionInstType * aggregateUseType ) = 0;
     109        virtual void visit( EnumInstType * aggregateUseType ) = 0;
     110        virtual void visit( TraitInstType * aggregateUseType ) = 0;
     111        virtual void visit( TypeInstType * aggregateUseType ) = 0;
     112        virtual void visit( TupleType * tupleType ) = 0;
     113        virtual void visit( TypeofType * typeofType ) = 0;
     114        virtual void visit( AttrType * attrType ) = 0;
     115        virtual void visit( VarArgsType * varArgsType ) = 0;
     116        virtual void visit( ZeroType * zeroType ) = 0;
     117        virtual void visit( OneType * oneType ) = 0;
     118        virtual void visit( GlobalScopeType * globalType ) = 0;
    111119
    112         virtual void visit( Designation * designation );
    113         virtual void visit( SingleInit * singleInit );
    114         virtual void visit( ListInit * listInit );
    115         virtual void visit( ConstructorInit * ctorInit );
     120        virtual void visit( Designation * designation ) = 0;
     121        virtual void visit( SingleInit * singleInit ) = 0;
     122        virtual void visit( ListInit * listInit ) = 0;
     123        virtual void visit( ConstructorInit * ctorInit ) = 0;
    116124
    117         virtual void visit( Subrange * subrange );
     125        virtual void visit( Subrange * subrange ) = 0;
    118126
    119         virtual void visit( Constant * constant );
     127        virtual void visit( Constant * constant ) = 0;
    120128
    121         virtual void visit( Attribute * attribute );
    122   private:
    123         virtual void handleAggregateDecl( AggregateDecl *aggregateDecl );
    124         virtual void handleNamedTypeDecl( NamedTypeDecl *typeDecl );
    125         virtual void handleReferenceToType( ReferenceToType *aggregateUseType );
     129        virtual void visit( Attribute * attribute ) = 0;
    126130};
    127131
     
    135139template< typename Container, typename VisitorType >
    136140inline void acceptAll( Container &container, VisitorType &visitor ) {
    137         SemanticError errors;
     141        SemanticErrorException errors;
    138142        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    139143                try {
     
    141145                                (*i)->accept( visitor );
    142146                        }
    143                 } catch( SemanticError &e ) {
    144                         e.set_location( (*i)->location );
     147                } catch( SemanticErrorException &e ) {
    145148                        errors.append( e );
    146149                }
  • src/SynTree/module.mk

    rf9feab8 r90152a4  
    4646       SynTree/TypeDecl.cc \
    4747       SynTree/Initializer.cc \
    48        SynTree/Visitor.cc \
    49        SynTree/Mutator.cc \
    5048       SynTree/TypeSubstitution.cc \
    5149       SynTree/Attribute.cc \
    52        SynTree/VarExprReplacer.cc
     50       SynTree/DeclReplacer.cc
    5351
  • src/Tuples/Explode.h

    rf9feab8 r90152a4  
    4343        /// Append alternative to an OutputIterator of Alternatives
    4444        template<typename OutputIterator>
    45         void append( OutputIterator out, Expression* expr, const ResolvExpr::TypeEnvironment& env, 
     45        void append( OutputIterator out, Expression* expr, const ResolvExpr::TypeEnvironment& env,
    4646                        const ResolvExpr::Cost& cost, const ResolvExpr::Cost& cvtCost ) {
    4747                *out++ = ResolvExpr::Alternative{ expr, env, cost, cvtCost };
     
    4949
    5050        /// Append alternative to an ExplodedActual
    51         static inline void append( ResolvExpr::ExplodedActual& ea, Expression* expr, 
     51        static inline void append( ResolvExpr::ExplodedActual& ea, Expression* expr,
    5252                        const ResolvExpr::TypeEnvironment&, const ResolvExpr::Cost&, const ResolvExpr::Cost& ) {
    5353                ea.exprs.emplace_back( expr );
     
    5757        /// helper function used by explode
    5858        template< typename Output >
    59         void explodeUnique( Expression * expr, const ResolvExpr::Alternative & alt, 
     59        void explodeUnique( Expression * expr, const ResolvExpr::Alternative & alt,
    6060                        const SymTab::Indexer & indexer, Output&& out, bool isTupleAssign ) {
    6161                if ( isTupleAssign ) {
     
    6363                        if ( CastExpr * castExpr = isReferenceCast( expr ) ) {
    6464                                ResolvExpr::AltList alts;
    65                                 explodeUnique( 
     65                                explodeUnique(
    6666                                        castExpr->get_arg(), alt, indexer, back_inserter( alts ), isTupleAssign );
    6767                                for ( ResolvExpr::Alternative & alt : alts ) {
    6868                                        // distribute reference cast over all components
    69                                         append( std::forward<Output>(out), distributeReference( alt.release_expr() ), 
     69                                        append( std::forward<Output>(out), distributeReference( alt.release_expr() ),
    7070                                                alt.env, alt.cost, alt.cvtCost );
    7171                                }
     
    108108        /// expands a tuple-valued alternative into multiple alternatives, each with a non-tuple-type
    109109        template< typename Output >
    110         void explode( const ResolvExpr::Alternative &alt, const SymTab::Indexer & indexer, 
     110        void explode( const ResolvExpr::Alternative &alt, const SymTab::Indexer & indexer,
    111111                        Output&& out, bool isTupleAssign = false ) {
    112112                explodeUnique( alt.expr, alt, indexer, std::forward<Output>(out), isTupleAssign );
     
    115115        // explode list of alternatives
    116116        template< typename AltIterator, typename Output >
    117         void explode( AltIterator altBegin, AltIterator altEnd, const SymTab::Indexer & indexer, 
     117        void explode( AltIterator altBegin, AltIterator altEnd, const SymTab::Indexer & indexer,
    118118                        Output&& out, bool isTupleAssign = false ) {
    119119                for ( ; altBegin != altEnd; ++altBegin ) {
     
    123123
    124124        template< typename Output >
    125         void explode( const ResolvExpr::AltList & alts, const SymTab::Indexer & indexer, Output&& out, 
     125        void explode( const ResolvExpr::AltList & alts, const SymTab::Indexer & indexer, Output&& out,
    126126                        bool isTupleAssign = false ) {
    127127                explode( alts.begin(), alts.end(), indexer, std::forward<Output>(out), isTupleAssign );
  • src/Tuples/TupleAssignment.cc

    rf9feab8 r90152a4  
    154154                                                lhsAlt.expr = new CastExpr( lhsAlt.expr,
    155155                                                                new ReferenceType( Type::Qualifiers(),
    156                                                                         lhsAlt.expr->get_result()->clone() ) );
     156                                                                        lhsAlt.expr->result->clone() ) );
    157157                                        }
    158158
     
    231231
    232232                        ResolvExpr::AlternativeFinder finder{ currentFinder.get_indexer(),
    233                                 currentFinder.get_environ() };
     233                                matcher->compositeEnv };
     234
    234235                        try {
    235236                                finder.findWithAdjustment(*i);
     
    272273                // args.push_back( new AddressExpr( new VariableExpr( left ) ) );
    273274                if ( right ) args.push_back( new VariableExpr( right ) );
    274                 return new UntypedExpr( new NameExpr( fname ), args );
    275         }
    276 
    277         // removes environments from subexpressions within statement exprs, which could throw off later passes like those in Box which rely on PolyMutator.
     275                if ( left->type->referenceDepth() > 1 && CodeGen::isConstructor( fname ) ) {
     276                        args.front() = new AddressExpr( args.front() );
     277                        if ( right ) args.back() = new AddressExpr( args.back() );
     278                        return new UntypedExpr( new NameExpr( "?=?" ), args );
     279                } else {
     280                        return new UntypedExpr( new NameExpr( fname ), args );
     281                }
     282        }
     283
     284        // removes environments from subexpressions within statement exprs, which could throw off later passes like those in Box which rely on PolyMutator, and adds the bindings to the compositeEnv
    278285        // xxx - maybe this should happen in alternative finder for every StmtExpr?
    279         // xxx - it's possible that these environments could contain some useful information. Maybe the right thing to do is aggregate the environments and pass the aggregate back to be added into the compositeEnv
    280286        struct EnvRemover {
    281287                void previsit( ExprStmt * stmt ) {
    282                         delete stmt->expr->env;
    283                         stmt->expr->env = nullptr;
    284                 }
     288                        assert( compositeEnv );
     289                        if ( stmt->expr->env ) {
     290                                compositeEnv->add( *stmt->expr->env );
     291                                delete stmt->expr->env;
     292                                stmt->expr->env = nullptr;
     293                        }
     294                }
     295
     296                ResolvExpr::TypeEnvironment * compositeEnv = nullptr;
    285297        };
    286298
    287299        ObjectDecl * TupleAssignSpotter::Matcher::newObject( UniqueName & namer, Expression * expr ) {
    288300                assert( expr->result && ! expr->get_result()->isVoid() );
    289                 ObjectDecl * ret = new ObjectDecl( namer.newName(), Type::StorageClasses(), LinkageSpec::Cforall, nullptr, expr->get_result()->clone(), new SingleInit( expr->clone() ) );
     301                ObjectDecl * ret = new ObjectDecl( namer.newName(), Type::StorageClasses(), LinkageSpec::Cforall, nullptr, expr->result->clone(), new SingleInit( expr->clone() ) );
    290302                // if expression type is a reference, don't need to construct anything, a simple initializer is sufficient.
    291                 if ( ! dynamic_cast< ReferenceType * >( expr->get_result() ) ) {
     303                if ( ! dynamic_cast< ReferenceType * >( expr->result ) ) {
    292304                        ConstructorInit * ctorInit = InitTweak::genCtorInit( ret );
    293                         ret->set_init( ctorInit );
     305                        ret->init = ctorInit;
    294306                        ResolvExpr::resolveCtorInit( ctorInit, spotter.currentFinder.get_indexer() ); // resolve ctor/dtors for the new object
    295307                        PassVisitor<EnvRemover> rm; // remove environments from subexpressions of StmtExprs
     308                        rm.pass.compositeEnv = &compositeEnv;
    296309                        ctorInit->accept( rm );
    297310                }
     
    306319                assert( (! lhs.empty() && rhs.size() <= 1) || (lhs.empty() && rhs.empty()) );
    307320
     321                // xxx - may need to split this up into multiple declarations, because potential conversion to references
     322                //  probably should not reference local variable - see MultipleAssignMatcher::match
    308323                ObjectDecl * rtmp = rhs.size() == 1 ? newObject( rhsNamer, rhs.front().expr ) : nullptr;
    309324                for ( ResolvExpr::Alternative & lhsAlt : lhs ) {
     
    324339                        std::list< ObjectDecl * > ltmp;
    325340                        std::list< ObjectDecl * > rtmp;
    326                         std::transform( lhs.begin(), lhs.end(), back_inserter( ltmp ), [&]( ResolvExpr::Alternative & alt ){
    327                                 return newObject( lhsNamer, alt.expr );
    328                         });
    329                         std::transform( rhs.begin(), rhs.end(), back_inserter( rtmp ), [&]( ResolvExpr::Alternative & alt ){
    330                                 return newObject( rhsNamer, alt.expr );
    331                         });
    332                         zipWith( ltmp.begin(), ltmp.end(), rtmp.begin(), rtmp.end(), back_inserter(out), [&](ObjectDecl * obj1, ObjectDecl * obj2 ) { return createFunc(spotter.fname, obj1, obj2); } );
     341                        for ( auto p : group_iterate( lhs, rhs ) ) {
     342                                ResolvExpr::Alternative & lhsAlt = std::get<0>(p);
     343                                ResolvExpr::Alternative & rhsAlt = std::get<1>(p);
     344                                // convert RHS to LHS type minus one reference -- important for the case where LHS is && and RHS is lvalue, etc.
     345                                ReferenceType * lhsType = strict_dynamic_cast<ReferenceType *>( lhsAlt.expr->result );
     346                                rhsAlt.expr = new CastExpr( rhsAlt.expr, lhsType->base->clone() );
     347                                ObjectDecl * lobj = newObject( lhsNamer, lhsAlt.expr );
     348                                ObjectDecl * robj = newObject( rhsNamer, rhsAlt.expr );
     349                                out.push_back( createFunc(spotter.fname, lobj, robj) );
     350                                ltmp.push_back( lobj );
     351                                rtmp.push_back( robj );
     352
     353                                // resolve the cast expression so that rhsAlt return type is bound by the cast type as needed, and transfer the resulting environment
     354                                ResolvExpr::AlternativeFinder finder{ spotter.currentFinder.get_indexer(), compositeEnv };
     355                                finder.findWithAdjustment( rhsAlt.expr );
     356                                assert( finder.get_alternatives().size() == 1 );
     357                                compositeEnv = std::move( finder.get_alternatives().front().env );
     358                        }
    333359                        tmpDecls.splice( tmpDecls.end(), ltmp );
    334360                        tmpDecls.splice( tmpDecls.end(), rtmp );
  • src/Tuples/TupleExpansion.cc

    rf9feab8 r90152a4  
    3030#include "SynTree/Type.h"         // for Type, Type::Qualifiers, TupleType
    3131#include "SynTree/Visitor.h"      // for Visitor
     32#include "Tuples.h"
    3233
    3334class CompoundStmt;
     
    3637namespace Tuples {
    3738        namespace {
    38                 struct MemberTupleExpander final : public Mutator {
    39                         typedef Mutator Parent;
    40                         using Parent::mutate;
    41 
    42                         virtual Expression * mutate( UntypedMemberExpr * memberExpr ) override;
     39                struct MemberTupleExpander final : public WithShortCircuiting, public WithVisitorRef<MemberTupleExpander> {
     40                        void premutate( UntypedMemberExpr * ) { visit_children = false; }
     41                        Expression * postmutate( UntypedMemberExpr * memberExpr );
    4342                };
    4443
     
    7978
    8079        void expandMemberTuples( std::list< Declaration * > & translationUnit ) {
    81                 MemberTupleExpander expander;
     80                PassVisitor<MemberTupleExpander> expander;
    8281                mutateAll( translationUnit, expander );
    8382        }
     
    109108                                // construct a new UntypedMemberExpr with the correct structure , and recursively
    110109                                // expand that member expression.
    111                                 MemberTupleExpander expander;
    112                                 UntypedMemberExpr * inner = new UntypedMemberExpr( memberExpr->get_aggregate(), aggr->clone() );
    113                                 UntypedMemberExpr * newMemberExpr = new UntypedMemberExpr( memberExpr->get_member(), inner );
     110                                PassVisitor<MemberTupleExpander> expander;
     111                                UntypedMemberExpr * inner = new UntypedMemberExpr( memberExpr->aggregate, aggr->clone() );
     112                                UntypedMemberExpr * newMemberExpr = new UntypedMemberExpr( memberExpr->member, inner );
    114113                                inner->location = newMemberExpr->location = loc;
    115                                 memberExpr->set_member(nullptr);
    116                                 memberExpr->set_aggregate(nullptr);
     114                                memberExpr->member = nullptr;
     115                                memberExpr->aggregate = nullptr;
    117116                                delete memberExpr;
    118117                                return newMemberExpr->acceptMutator( expander );
     
    126125        }
    127126
    128         Expression * MemberTupleExpander::mutate( UntypedMemberExpr * memberExpr ) {
    129                 if ( UntypedTupleExpr * tupleExpr = dynamic_cast< UntypedTupleExpr * > ( memberExpr->get_member() ) ) {
    130                         Expression * aggr = memberExpr->get_aggregate()->clone()->acceptMutator( *this );
     127        Expression * MemberTupleExpander::postmutate( UntypedMemberExpr * memberExpr ) {
     128                if ( UntypedTupleExpr * tupleExpr = dynamic_cast< UntypedTupleExpr * > ( memberExpr->member ) ) {
     129                        Expression * aggr = memberExpr->aggregate->clone()->acceptMutator( *visitor );
    131130                        // aggregate expressions which might be impure must be wrapped in unique expressions
    132                         // xxx - if there's a member-tuple expression nested in the aggregate, this currently generates the wrong code if a UniqueExpr is not used, and it's purely an optimization to remove the UniqueExpr
    133                         // if ( Tuples::maybeImpureIgnoreUnique( memberExpr->get_aggregate() ) ) aggr = new UniqueExpr( aggr );
    134                         aggr = new UniqueExpr( aggr );
    135                         for ( Expression *& expr : tupleExpr->get_exprs() ) {
     131                        if ( Tuples::maybeImpureIgnoreUnique( memberExpr->aggregate ) ) aggr = new UniqueExpr( aggr );
     132                        for ( Expression *& expr : tupleExpr->exprs ) {
    136133                                expr = reconstructMemberExpr( expr, aggr, memberExpr->location );
    137134                                expr->location = memberExpr->location;
     
    143140                        // there may be a tuple expr buried in the aggregate
    144141                        // xxx - this is a memory leak
    145                         UntypedMemberExpr * newMemberExpr = new UntypedMemberExpr( memberExpr->get_member()->clone(), memberExpr->get_aggregate()->acceptMutator( *this ) );
     142                        UntypedMemberExpr * newMemberExpr = new UntypedMemberExpr( memberExpr->member->clone(), memberExpr->aggregate->acceptMutator( *visitor ) );
    146143                        newMemberExpr->location = memberExpr->location;
    147144                        return newMemberExpr;
     
    202199                        // generate struct type to replace tuple type based on the number of components in the tuple
    203200                        StructDecl * decl = new StructDecl( toString( "_tuple", tupleSize, "_" ) );
     201                        decl->location = tupleType->location;
    204202                        decl->set_body( true );
    205203                        for ( size_t i = 0; i < tupleSize; ++i ) {
     
    228226
    229227        Expression * TupleIndexExpander::postmutate( TupleIndexExpr * tupleExpr ) {
    230                 Expression * tuple = tupleExpr->get_tuple();
     228                Expression * tuple = tupleExpr->tuple;
    231229                assert( tuple );
    232                 tupleExpr->set_tuple( nullptr );
    233                 unsigned int idx = tupleExpr->get_index();
    234                 TypeSubstitution * env = tupleExpr->get_env();
    235                 tupleExpr->set_env( nullptr );
     230                tupleExpr->tuple = nullptr;
     231                unsigned int idx = tupleExpr->index;
     232                TypeSubstitution * env = tupleExpr->env;
     233                tupleExpr->env = nullptr;
    236234                delete tupleExpr;
    237235
    238                 StructInstType * type = strict_dynamic_cast< StructInstType * >( tuple->get_result() );
    239                 StructDecl * structDecl = type->get_baseStruct();
    240                 assert( structDecl->get_members().size() > idx );
    241                 Declaration * member = *std::next(structDecl->get_members().begin(), idx);
     236                if ( TupleExpr * tupleExpr = dynamic_cast< TupleExpr * > ( tuple ) ) {
     237                        if ( ! maybeImpureIgnoreUnique( tupleExpr ) ) {
     238                                // optimization: definitely pure tuple expr => can reduce to the only relevant component.
     239                                assert( tupleExpr->exprs.size() > idx );
     240                                Expression *& expr = *std::next(tupleExpr->exprs.begin(), idx);
     241                                Expression * ret = expr;
     242                                ret->env = env;
     243                                expr = nullptr; // remove from list so it can safely be deleted
     244                                delete tupleExpr;
     245                                return ret;
     246                        }
     247                }
     248
     249                StructInstType * type = strict_dynamic_cast< StructInstType * >( tuple->result );
     250                StructDecl * structDecl = type->baseStruct;
     251                assert( structDecl->members.size() > idx );
     252                Declaration * member = *std::next(structDecl->members.begin(), idx);
    242253                MemberExpr * memExpr = new MemberExpr( strict_dynamic_cast< DeclarationWithType * >( member ), tuple );
    243                 memExpr->set_env( env );
     254                memExpr->env = env;
    244255                return memExpr;
    245256        }
  • src/config.h.in

    rf9feab8 r90152a4  
    1 /* config.h.in.  Generated from configure.ac by autoheader.  */
     1/* src/config.h.in.  Generated from configure.ac by autoheader.  */
     2
     3/* CPU to use if the -m32 flags is given. */
     4#undef CFA_32_CPU
     5
     6/* CPU to use if the -m64 flags is given. */
     7#undef CFA_64_CPU
    28
    39/* Location of include files. */
     
    612/* Location of cfa command. */
    713#undef CFA_BINDIR
     14
     15/* Default cpu to use if neither -m32 or -m64 are defined. */
     16#undef CFA_DEFAULT_CPU
    817
    918/* compilation flags for cfa libraries and test programs. */
     
    152161/* Define to 1 if you have the ANSI C header files. */
    153162#undef STDC_HEADERS
     163
     164/* Top build directory */
     165#undef TOP_BUILDDIR
     166
     167/* Top src directory */
     168#undef TOP_SRCDIR
    154169
    155170/* Version number of package */
  • src/main.cc

    rf9feab8 r90152a4  
    1 
    21//
    32// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
     
    1110// Created On       : Fri May 15 23:12:02 2015
    1211// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Tue Oct 31 12:22:40 2017
    14 // Update Count     : 445
     12// Last Modified On : Wed Jun  6 15:51:47 2018
     13// Update Count     : 498
    1514//
    1615
     
    2928#include <string>                           // for char_traits, operator<<
    3029
     30#include "CompilationState.h"
    3131#include "../config.h"                      // for CFA_LIBDIR
    3232#include "CodeGen/FixMain.h"                // for FixMain
     
    3535#include "CodeTools/DeclStats.h"            // for printDeclStats
    3636#include "CodeTools/TrackLoc.h"             // for fillLocations
     37#include "Common/CompilerError.h"           // for CompilerError
     38#include "Common/Heap.h"
    3739#include "Common/PassVisitor.h"
    38 #include "Common/CompilerError.h"           // for CompilerError
    3940#include "Common/SemanticError.h"           // for SemanticError
    4041#include "Common/UnimplementedError.h"      // for UnimplementedError
     
    6364using namespace std;
    6465
    65 #define OPTPRINT(x) if ( errorp ) cerr << x << endl;
    66 
     66#define PASS(name, pass)                   \
     67        if ( errorp ) { cerr << name << endl; } \
     68        HeapStats::newPass(name);               \
     69        pass;
    6770
    6871LinkageSpec::Spec linkage = LinkageSpec::Cforall;
     
    7073DeclarationNode * parseTree = nullptr;                                  // program parse tree
    7174
    72 extern int yydebug;                                                                             // set for -g flag (Grammar)
    73 bool
    74         astp = false,
    75         bresolvep = false,
    76         bboxp = false,
    77         bcodegenp = false,
    78         ctorinitp = false,
    79         declstatsp = false,
    80         exprp = false,
    81         expraltp = false,
    82         libcfap = false,
    83         nopreludep = false,
    84         noprotop = false,
    85         nomainp = false,
    86         parsep = false,
    87         resolvep = false,                                                                       // used in AlternativeFinder
    88         symtabp = false,
    89         treep = false,
    90         tuplep = false,
    91         validp = false,
    92         errorp = false,
    93         codegenp = false,
    94         prettycodegenp = false,
    95         linemarks = false;
     75std::string PreludeDirector = "";
    9676
    9777static void parse_cmdline( int argc, char *argv[], const char *& filename );
     
    154134                 << "." << endl;
    155135        backtrace( 2 );                                                                         // skip first 2 stack frames
    156         exit( EXIT_FAILURE );
     136        //_exit( EXIT_FAILURE );
     137        abort();
    157138} // sigSegvBusHandler
    158139
     
    173154        signal( SIGBUS, sigSegvBusHandler );
    174155        signal( SIGABRT, sigAbortHandler );
     156
     157        // std::cout << "main" << std::endl;
     158        // for ( int i = 0; i < argc; i += 1 ) {
     159        //      std::cout << '\t' << argv[i] << std::endl;
     160        // } // for
    175161
    176162        parse_cmdline( argc, argv, filename );                          // process command-line arguments
     
    198184                        // -l is for initial build ONLY and builtins.cf is not in the lib directory so access it here.
    199185
     186                        assertf( !PreludeDirector.empty(), "Can't find prelude without option --prelude-dir must be used." );
     187
    200188                        // Read to gcc builtins, if not generating the cfa library
    201                         FILE * gcc_builtins = fopen( libcfap | treep ? "../prelude/gcc-builtins.cf" : CFA_LIBDIR "/gcc-builtins.cf", "r" );
     189                        FILE * gcc_builtins = fopen( (PreludeDirector + "/gcc-builtins.cf").c_str(), "r" );
    202190                        assertf( gcc_builtins, "cannot open gcc-builtins.cf\n" );
    203191                        parse( gcc_builtins, LinkageSpec::Compiler );
    204192
    205193                        // read the extra prelude in, if not generating the cfa library
    206                         FILE * extras = fopen( libcfap | treep ? "../prelude/extras.cf" : CFA_LIBDIR "/extras.cf", "r" );
     194                        FILE * extras = fopen( (PreludeDirector + "/extras.cf").c_str(), "r" );
    207195                        assertf( extras, "cannot open extras.cf\n" );
    208196                        parse( extras, LinkageSpec::BuiltinC );
     
    210198                        if ( ! libcfap ) {
    211199                                // read the prelude in, if not generating the cfa library
    212                                 FILE * prelude = fopen( treep ? "../prelude/prelude.cf" : CFA_LIBDIR "/prelude.cf", "r" );
     200                                FILE * prelude = fopen( (PreludeDirector + "/prelude.cf").c_str(), "r" );
    213201                                assertf( prelude, "cannot open prelude.cf\n" );
    214202                                parse( prelude, LinkageSpec::Intrinsic );
    215203
    216204                                // Read to cfa builtins, if not generating the cfa library
    217                                 FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" );
     205                                FILE * builtins = fopen( (PreludeDirector + "/builtins.cf").c_str(), "r" );
    218206                                assertf( builtins, "cannot open builtins.cf\n" );
    219207                                parse( builtins, LinkageSpec::BuiltinCFA );
     
    238226                } // if
    239227
     228                // Temporary: fill locations after parsing so that every node has a location, for early error messages.
     229                // Eventually we should pass the locations from the parser to every node, but this quick and dirty solution
     230                // works okay for now.
     231                CodeTools::fillLocations( translationUnit );
     232
    240233                // add the assignment statement after the initialization of a type parameter
    241                 OPTPRINT( "validate" )
    242                 SymTab::validate( translationUnit, symtabp );
     234                PASS( "validate", SymTab::validate( translationUnit, symtabp ) );
    243235                if ( symtabp ) {
    244236                        deleteAll( translationUnit );
     
    257249                } // if
    258250
    259                 OPTPRINT( "mutate" )
    260                 ControlStruct::mutate( translationUnit );
    261                 OPTPRINT( "fixNames" )
    262                 CodeGen::fixNames( translationUnit );
    263                 OPTPRINT( "genInit" )
    264                 InitTweak::genInit( translationUnit );
    265                 OPTPRINT( "expandMemberTuples" );
    266                 Tuples::expandMemberTuples( translationUnit );
     251                PASS( "fixLabels", ControlStruct::fixLabels( translationUnit ) );
     252                PASS( "fixNames", CodeGen::fixNames( translationUnit ) );
     253                PASS( "genInit", InitTweak::genInit( translationUnit ) );
     254                PASS( "expandMemberTuples" , Tuples::expandMemberTuples( translationUnit ) );
    267255                if ( libcfap ) {
    268256                        // generate the bodies of cfa library functions
     
    281269                } // if
    282270
    283                 OPTPRINT( "resolve" )
    284                 ResolvExpr::resolve( translationUnit );
     271                CodeTools::fillLocations( translationUnit );
     272
     273                PASS( "resolve", ResolvExpr::resolve( translationUnit ) );
    285274                if ( exprp ) {
    286275                        dump( translationUnit );
     
    289278
    290279                // fix ObjectDecl - replaces ConstructorInit nodes
    291                 OPTPRINT( "fixInit" )
    292                 InitTweak::fix( translationUnit, filename, libcfap || treep );
     280                PASS( "fixInit", InitTweak::fix( translationUnit, buildingLibrary() ) );
    293281                if ( ctorinitp ) {
    294282                        dump ( translationUnit );
     
    296284                } // if
    297285
    298                 OPTPRINT( "expandUniqueExpr" ); // xxx - is this the right place for this? want to expand ASAP so that subsequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
    299                 Tuples::expandUniqueExpr( translationUnit );
    300 
    301                 OPTPRINT( "translateEHM" );
    302                 ControlStruct::translateEHM( translationUnit );
    303 
    304                 OPTPRINT( "generateWaitfor" );
    305                 Concurrency::generateWaitFor( translationUnit );
    306 
    307                 OPTPRINT( "convertSpecializations" ) // needs to happen before tuple types are expanded
    308                 GenPoly::convertSpecializations( translationUnit );
    309 
    310                 OPTPRINT( "expandTuples" ); // xxx - is this the right place for this?
    311                 Tuples::expandTuples( translationUnit );
     286                PASS( "expandUniqueExpr", Tuples::expandUniqueExpr( translationUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
     287
     288                PASS( "translateEHM" , ControlStruct::translateEHM( translationUnit ) );
     289
     290                PASS( "generateWaitfor" , Concurrency::generateWaitFor( translationUnit ) );
     291
     292                PASS( "convertSpecializations",  GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded
     293
     294                PASS( "expandTuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this?
     295
    312296                if ( tuplep ) {
    313297                        dump( translationUnit );
     
    315299                }
    316300
    317                 OPTPRINT( "virtual expandCasts" ) // Must come after translateEHM
    318                 Virtual::expandCasts( translationUnit );
    319 
    320                 OPTPRINT("instantiateGenerics")
    321                 GenPoly::instantiateGeneric( translationUnit );
    322                 OPTPRINT( "convertLvalue" )
    323                 GenPoly::convertLvalue( translationUnit );
     301                PASS( "virtual expandCasts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM
     302
     303                PASS( "instantiateGenerics", GenPoly::instantiateGeneric( translationUnit ) );
     304                if ( genericsp ) {
     305                        dump( translationUnit );
     306                        return 0;
     307                }
     308                PASS( "convertLvalue", GenPoly::convertLvalue( translationUnit ) );
     309
    324310
    325311                if ( bboxp ) {
     
    327313                        return 0;
    328314                } // if
    329                 OPTPRINT( "box" )
    330                 GenPoly::box( translationUnit );
     315                PASS( "box", GenPoly::box( translationUnit ) );
    331316
    332317                if ( bcodegenp ) {
     
    340325
    341326                CodeTools::fillLocations( translationUnit );
    342                 CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks );
    343 
    344                 CodeGen::FixMain::fix( *output, treep ? "../prelude/bootloader.c" : CFA_LIBDIR "/bootloader.c" );
    345 
     327                PASS( "codegen", CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks ) );
     328
     329                CodeGen::FixMain::fix( *output, (PreludeDirector + "/bootloader.c").c_str() );
    346330                if ( output != &cout ) {
    347331                        delete output;
    348332                } // if
    349         } catch ( SemanticError &e ) {
     333        } catch ( SemanticErrorException &e ) {
    350334                if ( errorp ) {
    351335                        cerr << "---AST at error:---" << endl;
     
    353337                        cerr << endl << "---End of AST, begin error message:---\n" << endl;
    354338                } // if
    355                 e.print( cerr );
     339                e.print();
    356340                if ( output != &cout ) {
    357341                        delete output;
     
    371355                } // if
    372356                return 1;
    373         } // try
     357        } catch(...) {
     358                std::exception_ptr eptr = std::current_exception();
     359                try {
     360                        if (eptr) {
     361                                std::rethrow_exception(eptr);
     362                        }
     363                        else {
     364                                std::cerr << "Exception Uncaught and Unkown" << std::endl;
     365                        }
     366                } catch(const std::exception& e) {
     367                        std::cerr << "Unaught Exception \"" << e.what() << "\"\n";
     368                }
     369                return 1;
     370        }// try
    374371
    375372        deleteAll( translationUnit );
     373        if(!libcfap && !treep) HeapStats::printStats();
    376374        return 0;
    377375} // main
    378376
    379377void parse_cmdline( int argc, char * argv[], const char *& filename ) {
    380         enum { Ast, Bbox, Bresolver, CtorInitFix, DeclStats, Expr, ExprAlt, Grammar, LibCFA, Linemarks, Nolinemarks, Nopreamble, Parse, Prototypes, Resolver, Symbol, Tree, TupleExpansion, Validate, };
     378        enum { Ast, Bbox, Bresolver, CtorInitFix, DeclStats, Expr, ExprAlt, Grammar, LibCFA, Linemarks, Nolinemarks, Nopreamble, Parse, PreludeDir, Prototypes, Resolver, Symbol, Tree, TupleExpansion, Validate, };
    381379
    382380        static struct option long_opts[] = {
     
    394392                { "no-preamble", no_argument, 0, Nopreamble },
    395393                { "parse", no_argument, 0, Parse },
     394                { "prelude-dir", required_argument, 0, PreludeDir },
    396395                { "no-prototypes", no_argument, 0, Prototypes },
    397396                { "resolver", no_argument, 0, Resolver },
     
    406405        opterr = 0;                                                                                     // (global) prevent getopt from printing error messages
    407406
     407        bool Wsuppress = false, Werror = false;
    408408        int c;
    409         while ( (c = getopt_long( argc, argv, "abBcCdefglLmnNpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) {
     409        while ( (c = getopt_long( argc, argv, "abBcCdefgGlLmnNpqrstTvwW:yzZD:F:", long_opts, &long_index )) != -1 ) {
    410410                switch ( c ) {
    411411                  case Ast:
     
    443443                        yydebug = true;
    444444                        break;
     445                  case 'G':                                                                             // dump AST after instantiate generics
     446                        genericsp = true;
     447                        break;
    445448                  case LibCFA:
    446449                  case 'l':                                                                             // generate libcfa.c
     
    463466                        noprotop = true;
    464467                        break;
     468                  case PreludeDir:
     469                        PreludeDirector = optarg;
     470                        break;
    465471                  case 'm':                                                                             // don't replace the main
    466472                        nomainp = true;
     
    488494                  case 'v':                                                                             // dump AST after decl validation pass
    489495                        validp = true;
     496                        break;
     497                  case 'w':
     498                        Wsuppress = true;
     499                        break;
     500                  case 'W':
     501                        if ( strcmp( optarg, "all" ) == 0 ) {
     502                                SemanticWarning_EnableAll();
     503                        } else if ( strcmp( optarg, "error" ) == 0 ) {
     504                                Werror = true;
     505                        } else {
     506                                char * warning = optarg;
     507                                Severity s;
     508                                if ( strncmp( optarg, "no-", 3 ) == 0 ) {
     509                                        warning += 3;
     510                                        s = Severity::Suppress;
     511                                } else {
     512                                        s = Severity::Warn;
     513                                } // if
     514                                SemanticWarning_Set( warning, s );
     515                        } // if
    490516                        break;
    491517                  case 'y':                                                                             // dump AST on error
     
    509535                                assertf( false, "Unknown option: %s\n", argv[optind - 1] );
    510536                        } // if
    511                         #if __GNUC__ < 7
    512                         #else
     537                        #if defined(__GNUC__) && __GNUC__ >= 7
    513538                                __attribute__((fallthrough));
    514539                        #endif
     
    517542                } // switch
    518543        } // while
     544
     545        if ( Werror ) {
     546                SemanticWarning_WarningAsError();
     547        } // if
     548        if ( Wsuppress ) {
     549                SemanticWarning_SuppressAll();
     550        } // if
     551        // for ( const auto w : WarningFormats ) {
     552        //      cout << w.name << ' ' << (int)w.severity << endl;
     553        // } // for
    519554} // parse_cmdline
    520555
     
    527562        yyin = input;
    528563        yylineno = 1;
    529         typedefTable.enterScope();
    530564        int parseStatus = yyparse();
    531565
Note: See TracChangeset for help on using the changeset viewer.