Changeset c93bc28 for src/ResolvExpr
- Timestamp:
- Aug 15, 2017, 7:00:40 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- f6582243
- Parents:
- db67b11
- Location:
- src/ResolvExpr
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
rdb67b11 rc93bc28 241 241 void AlternativeFinder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) { 242 242 // by this point, member must be a name expr 243 NameExpr * nameExpr = safe_dynamic_cast< NameExpr * >( member ); 243 NameExpr * nameExpr = dynamic_cast< NameExpr * >( member ); 244 if ( ! nameExpr ) return; 244 245 const std::string & name = nameExpr->get_name(); 245 246 std::list< Declaration* > members; … … 263 264 // during parsing and reusing that information here. 264 265 std::stringstream ss( constantExpr->get_constant()->get_value() ); 265 int val ;266 int val = 0; 266 267 std::string tmp; 267 268 if ( ss >> val && ! (ss >> tmp) ) { -
src/ResolvExpr/CommonType.cc
rdb67b11 rc93bc28 61 61 // std::cerr << "unify success" << std::endl; 62 62 if ( widenSecond ) { 63 // std::cerr << "widen second" << std::endl; 63 64 if ( widenFirst || other->get_qualifiers() <= refType->get_qualifiers() ) { 64 65 result = new ReferenceType( refType->get_qualifiers(), common ); // refType->clone(); … … 66 67 } 67 68 } else if ( widenFirst ) { 69 // std::cerr << "widen first" << std::endl; 68 70 if ( widenSecond || refType->get_qualifiers() <= other->get_qualifiers() ) { 69 71 result = common; … … 123 125 } // if 124 126 #ifdef DEBUG 125 std::c out<< "============= commonType" << std::endl << "type1 is ";126 type1->print( std::c out);127 std::c out<< " type2 is ";128 type2->print( std::c out);127 std::cerr << "============= commonType" << std::endl << "type1 is "; 128 type1->print( std::cerr ); 129 std::cerr << " type2 is "; 130 type2->print( std::cerr ); 129 131 if ( result ) { 130 std::c out<< " common type is ";131 result->print( std::c out);132 std::cerr << " common type is "; 133 result->print( std::cerr ); 132 134 } else { 133 std::c out<< " no common type";134 } // if 135 std::c out<< std::endl;135 std::cerr << " no common type"; 136 } // if 137 std::cerr << std::endl; 136 138 #endif 137 139 return result; … … 201 203 void CommonType::visit( PointerType *pointerType ) { 202 204 if ( PointerType *otherPointer = dynamic_cast< PointerType* >( type2 ) ) { 205 // std::cerr << "commonType: two pointers: " << pointerType << " / " << otherPointer << std::endl; 203 206 if ( widenFirst && dynamic_cast< VoidType* >( otherPointer->get_base() ) && ! isFtype(pointerType->get_base()) ) { 204 207 getCommonWithVoidPointer( otherPointer, pointerType ); … … 207 210 } else if ( ( pointerType->get_base()->get_qualifiers() >= otherPointer->get_base()->get_qualifiers() || widenFirst ) 208 211 && ( pointerType->get_base()->get_qualifiers() <= otherPointer->get_base()->get_qualifiers() || widenSecond ) ) { 212 // std::cerr << "middle case" << std::endl; 209 213 Type::Qualifiers tq1 = pointerType->get_base()->get_qualifiers(), tq2 = otherPointer->get_base()->get_qualifiers(); 210 214 pointerType->get_base()->get_qualifiers() = Type::Qualifiers(); … … 213 217 OpenVarSet newOpen( openVars ); 214 218 if ( unifyExact( pointerType->get_base(), otherPointer->get_base(), env, have, need, newOpen, indexer ) ) { 219 // std::cerr << "unifyExact success" << std::endl; 215 220 if ( tq1 < tq2 ) { 216 221 result = pointerType->clone(); … … 220 225 result->get_qualifiers() = tq1 | tq2; 221 226 } else { 222 /// std::c out<< "place for ptr-to-type" << std::endl;227 /// std::cerr << "place for ptr-to-type" << std::endl; 223 228 } // if 224 229 pointerType->get_base()->get_qualifiers() = tq1; … … 235 240 void CommonType::visit( ReferenceType *refType ) { 236 241 if ( ReferenceType *otherRef = dynamic_cast< ReferenceType* >( type2 ) ) { 242 // std::cerr << "commonType: both references: " << refType << " / " << otherRef << std::endl; 243 // std::cerr << ( refType->get_base()->get_qualifiers() >= otherRef->get_base()->get_qualifiers() || widenFirst ) << (refType->get_base()->get_qualifiers() <= otherRef->get_base()->get_qualifiers() || widenSecond) << std::endl; 237 244 if ( widenFirst && dynamic_cast< VoidType* >( otherRef->get_base() ) && ! isFtype(refType->get_base()) ) { 238 245 getCommonWithVoidPointer( otherRef, refType ); … … 241 248 } else if ( ( refType->get_base()->get_qualifiers() >= otherRef->get_base()->get_qualifiers() || widenFirst ) 242 249 && ( refType->get_base()->get_qualifiers() <= otherRef->get_base()->get_qualifiers() || widenSecond ) ) { 250 // std::cerr << "middle case" << std::endl; 243 251 Type::Qualifiers tq1 = refType->get_base()->get_qualifiers(), tq2 = otherRef->get_base()->get_qualifiers(); 244 252 refType->get_base()->get_qualifiers() = Type::Qualifiers(); … … 254 262 result->get_qualifiers() = tq1 | tq2; 255 263 } else { 256 /// std::c out<< "place for ptr-to-type" << std::endl;264 /// std::cerr << "place for ptr-to-type" << std::endl; 257 265 } // if 258 266 refType->get_base()->get_qualifiers() = tq1; -
src/ResolvExpr/ResolveTypeof.cc
rdb67b11 rc93bc28 60 60 assert( newExpr->has_result() && ! newExpr->get_result()->isVoid() ); 61 61 Type *newType = newExpr->get_result(); 62 newExpr->set_result( nullptr ); 62 63 delete typeofType; 64 delete newExpr; 63 65 return newType; 64 66 } // if
Note: See TracChangeset
for help on using the changeset viewer.