Changeset 94fa946
- Timestamp:
- Mar 23, 2022, 3:09:52 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 8631c84
- Parents:
- 3caf5e3
- Location:
- src/ResolvExpr
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/RenameVars.h
r3caf5e3 r94fa946 36 36 }; 37 37 const ast::Type * renameTyVars( const ast::Type *, RenameMode mode = GEN_USAGE, bool reset = true ); 38 39 38 40 39 /// resets internal state of renamer to avoid overflow 41 40 void resetTyVarRenaming(); 42 43 44 41 } // namespace ResolvExpr 45 42 -
src/ResolvExpr/ResolveTypeof.cc
r3caf5e3 r94fa946 169 169 170 170 struct FixArrayDimension { 171 // should not require a mutable symbol table - prevent pass template instantiation172 171 const ResolveContext & context; 173 172 FixArrayDimension(const ResolveContext & context) : context( context ) {} … … 196 195 197 196 const 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 { 200 203 auto resolvedType = resolveTypeof(decl->type, context); 201 204 resolvedType = fixArrayType(resolvedType, context); 202 205 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; 229 216 } 230 217 -
src/ResolvExpr/ResolveTypeof.h
r3caf5e3 r94fa946 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ResolveTypeof.h -- 7 // ResolveTypeof.h -- 8 8 // 9 9 // Author : Richard C. Bilson
Note: See TracChangeset
for help on using the changeset viewer.