Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r1931bb01 r0bd46fd  
    277277                std::list< Declaration* > &memb = enumDecl->get_members();
    278278                if (enumDecl->base && ! memb.empty()) {
    279                         unsigned long long last_val = -1;
     279                        unsigned long long last_val = -1; // if the first enum value has no explicit initializer,
     280                        // as other
    280281                        for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end();  i++) {
    281282                                ObjectDecl * obj = dynamic_cast< ObjectDecl* >( *i );
    282283                                assert( obj );
    283                                 output << "static const ";
    284                                 output << genType(enumDecl->base, "", options) << " ";
     284                                output << "static ";
     285                                output << genType(enumDecl->base, "", options) << " const ";
    285286                                output << mangleName( obj ) << " ";
    286287                                output << " = ";
     
    493494                                        assert( false );
    494495                                } // switch
     496                        } else if( varExpr->get_var()->get_linkage() == LinkageSpec::BuiltinCFA && varExpr->get_var()->get_name() == "intptr" ) {
     497                                // THIS is a hack to make it a constant until a proper constexpr solution is created
     498                                output << "((void*)";
     499                                std::list< Expression* >::iterator arg = applicationExpr->get_args().begin();
     500                                (*arg++)->accept( *visitor );
     501                                output << ")";
    495502                        } else {
    496503                                varExpr->accept( *visitor );
     
    689696                        output << opInfo->symbol;
    690697                } else {
    691                         // if (dynamic_cast<EnumInstType *>(variableExpr->get_var()->get_type())
    692                         // && dynamic_cast<EnumInstType *>(variableExpr->get_var()->get_type())->baseEnum->base) {
    693                         //      output << '(' <<genType(dynamic_cast<EnumInstType *>(variableExpr->get_var()->get_type())->baseEnum->base, "", options) << ')';
    694                         // }
    695698                        output << mangleName( variableExpr->get_var() );
    696699                } // if
     
    911914        }
    912915
     916        // QualifiedNameExpr should not reach to CodeGen.
     917        // FixQualifiedName Convert QualifiedNameExpr to VariableExpr
     918        void CodeGenerator::postvisit( QualifiedNameExpr * expr ) {
     919                output << "/* label */" << mangleName(expr->var);
     920        }
    913921
    914922        // *** Statements
Note: See TracChangeset for help on using the changeset viewer.