Changeset 16ba4a6 for src/ResolvExpr/ResolveTypeof.cc
- Timestamp:
- Nov 10, 2020, 12:20:37 AM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 18f0b70
- Parents:
- 3febb2d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/ResolveTypeof.cc
r3febb2d r16ba4a6 29 29 #include "SynTree/Mutator.h" // for Mutator 30 30 #include "SynTree/Type.h" // for TypeofType, Type 31 #include "SymTab/Mangler.h" 32 #include "InitTweak/InitTweak.h" // for isConstExpr 31 33 32 34 namespace SymTab { … … 163 165 } 164 166 167 const ast::ObjectDecl * fixObjectType( const ast::ObjectDecl * decl , const ast::SymbolTable & symtab ) { 168 if (!decl->isTypeFixed) { 169 auto mutDecl = mutate(decl); 170 auto resolvedType = resolveTypeof(decl->type, symtab); 171 mutDecl->type = resolvedType; 172 173 // check variable length if object is an array. 174 // xxx - should this be part of fixObjectType? 175 if (auto arrayType = dynamic_cast<const ast::ArrayType *>(resolvedType)) { 176 if (auto varexpr = arrayType->dimension.as<ast::VariableExpr>()) {// hoisted previously 177 if (InitTweak::isConstExpr(varexpr->var.strict_as<ast::ObjectDecl>()->init)) { 178 auto mutType = mutate(arrayType); 179 mutType->isVarLen = ast::LengthFlag::VariableLen; 180 mutDecl->type = mutType; 181 } 182 } 183 } 184 185 if (!mutDecl->name.empty()) 186 mutDecl->mangleName = Mangle::mangle(mutDecl); // do not mangle unnamed variables 187 188 mutDecl->isTypeFixed = true; 189 return mutDecl; 190 } 191 return decl; 192 } 193 165 194 } // namespace ResolvExpr 166 195
Note: See TracChangeset
for help on using the changeset viewer.