Ignore:
Timestamp:
Feb 8, 2023, 2:27:55 PM (3 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, master
Children:
b110bcc
Parents:
997185e (diff), ccb29b4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/ScrubTyVars.cc

    r997185e r2ed94a9  
    178178
    179179ast::Type const * ScrubTypeVars::postvisit( ast::TypeInstType const * type ) {
     180        ast::TypeDecl::Kind kind;
    180181        // This implies that mode == ScrubMode::All.
    181182        if ( !typeVars ) {
    182                 if ( ast::TypeDecl::Ftype == type->kind ) {
    183                         return new ast::PointerType(
    184                                 new ast::FunctionType( ast::FixedArgs ) );
    185                 } else {
    186                         return new ast::PointerType(
    187                                 new ast::VoidType( type->qualifiers ) );
    188                 }
    189         }
    190 
    191         auto typeVar = typeVars->find( *type );
    192         if ( typeVar == typeVars->end() ) {
    193                 return type;
    194         }
    195 
    196         switch ( typeVar->second.kind ) {
    197         case ::TypeDecl::Dtype:
    198         case ::TypeDecl::Ttype:
     183                kind = type->kind;
     184        } else {
     185                // Otherwise, only scrub the type var if it is in map.
     186                auto typeVar = typeVars->find( *type );
     187                if ( typeVar == typeVars->end() ) {
     188                        return type;
     189                }
     190                kind = typeVar->second.kind;
     191        }
     192
     193        switch ( kind ) {
     194        case ast::TypeDecl::Dtype:
     195        case ast::TypeDecl::Ttype:
    199196                return new ast::PointerType(
    200197                        new ast::VoidType( type->qualifiers ) );
    201         case ::TypeDecl::Ftype:
     198        case ast::TypeDecl::Ftype:
    202199                return new ast::PointerType(
    203200                        new ast::FunctionType( ast::VariableArgs ) );
    204201        default:
    205                 assertf( false,
    206                         "Unhandled type variable kind: %d", typeVar->second.kind );
     202                assertf( false, "Unhandled type variable kind: %d", kind );
    207203                throw; // Just in case the assert is removed, stop here.
    208204        }
Note: See TracChangeset for help on using the changeset viewer.