Changeset 94fa946 for src/ResolvExpr


Ignore:
Timestamp:
Mar 23, 2022, 3:09:52 PM (2 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
8631c84
Parents:
3caf5e3
Message:

Cleaned up some files I have been looking at a lot recently.

Location:
src/ResolvExpr
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/RenameVars.h

    r3caf5e3 r94fa946  
    3636        };
    3737        const ast::Type * renameTyVars( const ast::Type *, RenameMode mode = GEN_USAGE, bool reset = true );
    38        
    3938
    4039        /// resets internal state of renamer to avoid overflow
    4140        void resetTyVarRenaming();
    42 
    43        
    4441} // namespace ResolvExpr
    4542
  • src/ResolvExpr/ResolveTypeof.cc

    r3caf5e3 r94fa946  
    169169
    170170struct FixArrayDimension {
    171         // should not require a mutable symbol table - prevent pass template instantiation
    172171        const ResolveContext & context;
    173172        FixArrayDimension(const ResolveContext & context) : context( context ) {}
     
    196195
    197196const ast::ObjectDecl * fixObjectType( const ast::ObjectDecl * decl , const ResolveContext & context ) {
    198         if (!decl->isTypeFixed) {
    199                 auto mutDecl = mutate(decl);
     197        if (decl->isTypeFixed) {
     198                return decl;
     199        }
     200
     201        auto mutDecl = mutate(decl);
     202        {
    200203                auto resolvedType = resolveTypeof(decl->type, context);
    201204                resolvedType = fixArrayType(resolvedType, context);
    202205                mutDecl->type = resolvedType;
    203 
    204                 // check variable length if object is an array.
    205                 // xxx - should this be part of fixObjectType?
    206 
    207                 /*
    208                 if (auto arrayType = dynamic_cast<const ast::ArrayType *>(resolvedType)) {
    209                         auto dimExpr = findSingleExpression(arrayType->dimension, ast::sizeType, symtab);
    210                         if (auto varexpr = arrayType->dimension.as<ast::VariableExpr>()) {// hoisted previously
    211                                 if (InitTweak::isConstExpr(varexpr->var.strict_as<ast::ObjectDecl>()->init)) {
    212                                         auto mutType = mutate(arrayType);
    213                                         mutType->isVarLen = ast::LengthFlag::VariableLen;
    214                                         mutDecl->type = mutType;
    215                                 }
    216                         }
    217                 }
    218                 */
    219 
    220 
    221                 if (!mutDecl->name.empty())
    222                         mutDecl->mangleName = Mangle::mangle(mutDecl); // do not mangle unnamed variables
    223                
    224                 mutDecl->type = renameTyVars(mutDecl->type, RenameMode::GEN_EXPR_ID);
    225                 mutDecl->isTypeFixed = true;
    226                 return mutDecl;
    227         }
    228         return decl;
     206        }
     207
     208        // Do not mangle unnamed variables.
     209        if (!mutDecl->name.empty()) {
     210                mutDecl->mangleName = Mangle::mangle(mutDecl);
     211        }
     212
     213        mutDecl->type = renameTyVars(mutDecl->type, RenameMode::GEN_EXPR_ID);
     214        mutDecl->isTypeFixed = true;
     215        return mutDecl;
    229216}
    230217
  • src/ResolvExpr/ResolveTypeof.h

    r3caf5e3 r94fa946  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ResolveTypeof.h -- 
     7// ResolveTypeof.h --
    88//
    99// Author           : Richard C. Bilson
Note: See TracChangeset for help on using the changeset viewer.