Changeset d958834b for src


Ignore:
Timestamp:
Jul 25, 2022, 12:29:40 PM (3 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
b729c01
Parents:
d4b37ab
Message:

Save a minimal compilable version. The enum pointer assignment/comparsion is fixed

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    rd4b37ab rd958834b  
    289289                                        if ( obj->get_init() ) {
    290290                                                obj->get_init()->accept( *visitor );
    291                                                 last_val = ((ConstantExpr *)(((SingleInit *)(obj->init))->value))->constant.get_ival();
     291                                                // last_val = ((ConstantExpr *)(((SingleInit *)(obj->init))->value))->constant.get_ival();
    292292                                        } else {
    293293                                                output << ++last_val;
  • src/ResolvExpr/CandidateFinder.cpp

    rd4b37ab rd958834b  
    897897                                                }
    898898
    899                                                 if (argType.as<ast::PointerType>()) funcFinder.otypeKeys.insert(Mangle::Encoding::pointer);
    900                                                 else if (const ast::EnumInstType * enumInst = argType.as<ast::EnumInstType>()) {
    901                                                         const ast::EnumDecl * enumDecl = enumInst->base;
    902                                                         if ( const ast::Type* enumType = enumDecl->base ) {
    903                                                                 // instance of enum (T) is a instance of type (T)
    904                                                                 funcFinder.otypeKeys.insert(Mangle::mangle(enumType, Mangle::NoGenericParams | Mangle::Type));
    905                                                         } else {
    906                                                                 // instance of an untyped enum is techically int
    907                                                                 funcFinder.otypeKeys.insert(Mangle::mangle(enumDecl, Mangle::NoGenericParams | Mangle::Type));
    908                                                         }
    909                                                 }
     899                                                if (argType.as<ast::PointerType>()) funcFinder.otypeKeys.insert(Mangle::Encoding::pointer);                                             
     900                                                // else if (const ast::EnumInstType * enumInst = argType.as<ast::EnumInstType>()) {
     901                                                //      const ast::EnumDecl * enumDecl = enumInst->base; // Here
     902                                                //      if ( const ast::Type* enumType = enumDecl->base ) {
     903                                                //              // instance of enum (T) is a instance of type (T)
     904                                                //              funcFinder.otypeKeys.insert(Mangle::mangle(enumType, Mangle::NoGenericParams | Mangle::Type));
     905                                                //      } else {
     906                                                //              // instance of an untyped enum is techically int
     907                                                //              funcFinder.otypeKeys.insert(Mangle::mangle(enumDecl, Mangle::NoGenericParams | Mangle::Type));
     908                                                //      }
     909                                                // }
    910910                                                else funcFinder.otypeKeys.insert(Mangle::mangle(argType, Mangle::NoGenericParams | Mangle::Type));
    911911                                        }
  • src/ResolvExpr/ConversionCost.cc

    rd4b37ab rd958834b  
    695695        if ( const ast::Type * baseType = baseEnum->base ) {
    696696                cost = costCalc( baseType, dst, srcIsLvalue, symtab, env );
     697                // cost = Cost::safe;
    697698        } else {
    698699                (void)enumInstType;
  • src/Validate/Autogen.cpp

    rd4b37ab rd958834b  
    235235        // Must visit children (enum constants) to add them to the symbol table.
    236236        if ( !enumDecl->body ) return;
     237
     238        // if ( auto enumBaseType = enumDecl->base ) {
     239        //      if ( auto enumBaseTypeAsStructInst = dynamic_cast<const ast::StructInstType *>(enumBaseType.get()) ) {
     240        //              const ast::StructDecl * structDecl = enumBaseTypeAsStructInst->base.get();
     241        //              this->previsit( structDecl );
     242        //      }
     243        // }
    237244
    238245        ast::EnumInstType enumInst( enumDecl->name );
Note: See TracChangeset for help on using the changeset viewer.