Changeset 29207bf for src/ResolvExpr
- Timestamp:
- Dec 8, 2018, 4:06:32 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 5ebb1368, 90cfc16
- Parents:
- 47ed726 (diff), 3d99498 (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. - Location:
- src/ResolvExpr
- Files:
-
- 2 edited
-
AlternativeFinder.cc (modified) (2 diffs)
-
ResolveTypeof.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
r47ed726 r29207bf 10 10 // Created On : Sat May 16 23:52:08 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Feb 17 11:19:39201813 // Update Count : 3 312 // Last Modified On : Thu Nov 1 21:00:56 2018 13 // Update Count : 34 14 14 // 15 15 … … 1344 1344 /// Gets name from untyped member expression (member must be NameExpr) 1345 1345 const std::string& get_member_name( UntypedMemberExpr *memberExpr ) { 1346 if ( dynamic_cast< ConstantExpr * >( memberExpr->get_member() ) ) { 1347 SemanticError( memberExpr, "Indexed access to struct fields unsupported: " ); 1348 } // if 1346 1349 NameExpr * nameExpr = dynamic_cast< NameExpr * >( memberExpr->get_member() ); 1347 1350 assert( nameExpr ); -
src/ResolvExpr/ResolveTypeof.cc
r47ed726 r29207bf 67 67 std::cerr << std::endl; 68 68 #endif 69 if ( typeofType->expr ) { 69 // pass on null expression 70 if ( ! typeofType->expr ) return typeofType; 71 72 bool isBasetypeof = typeofType->is_basetypeof; 73 auto oldQuals = typeofType->get_qualifiers().val; 74 75 Type* newType; 76 if ( TypeExpr* tyExpr = dynamic_cast<TypeExpr*>(typeofType->expr) ) { 77 // typeof wrapping type 78 newType = tyExpr->type; 79 tyExpr->type = nullptr; 80 delete tyExpr; 81 } else { 82 // typeof wrapping expression 70 83 Expression * newExpr = resolveInVoidContext( typeofType->expr, indexer ); 71 84 assert( newExpr->result && ! newExpr->result->isVoid() ); 72 Type *newType = newExpr->result;85 newType = newExpr->result; 73 86 newExpr->result = nullptr; 74 87 delete typeofType; 75 88 delete newExpr; 76 return newType; 77 } // if 78 return typeofType; 89 } 90 91 // clear qualifiers for base, combine with typeoftype quals in any case 92 if ( isBasetypeof ) { 93 // replace basetypeof(<enum>) by int 94 if ( dynamic_cast<EnumInstType*>(newType) ) { 95 Type* newerType = 96 new BasicType{ newType->get_qualifiers(), BasicType::SignedInt, 97 newType->attributes }; 98 delete newType; 99 newType = newerType; 100 } 101 newType->get_qualifiers().val 102 = ( newType->get_qualifiers().val & ~Type::Qualifiers::Mask ) | oldQuals; 103 } else { 104 newType->get_qualifiers().val |= oldQuals; 105 } 106 107 return newType; 79 108 } 80 109 } // namespace ResolvExpr
Note:
See TracChangeset
for help on using the changeset viewer.