Changeset 7e003011 for src/ResolvExpr
- Timestamp:
- Jun 5, 2017, 1:59:11 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:
- 7b13aeb
- Parents:
- b3c36f4
- Location:
- src/ResolvExpr
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/CommonType.cc
rb3c36f4 r7e003011 43 43 44 44 void getCommonWithVoidPointer( PointerType* voidPointer, PointerType* otherPointer ); 45 template< typename RefType > void handleRefType( RefType *inst, Type *other );46 45 47 46 Type *result; … … 126 125 } 127 126 128 void CommonType::visit( VoidType *voidType ) { 129 } 127 void CommonType::visit( __attribute((unused)) VoidType *voidType ) {} 130 128 131 129 void CommonType::visit( BasicType *basicType ) { … … 189 187 } 190 188 191 void CommonType::visit( ArrayType *arrayType ) { 192 } 193 194 void CommonType::visit( FunctionType *functionType ) { 195 } 196 197 template< typename RefType > void CommonType::handleRefType( RefType *inst, Type *other ) { 198 } 199 200 void CommonType::visit( StructInstType *aggregateUseType ) { 201 } 202 203 void CommonType::visit( UnionInstType *aggregateUseType ) { 204 } 189 void CommonType::visit( __attribute((unused)) ArrayType *arrayType ) {} 190 void CommonType::visit( __attribute((unused)) FunctionType *functionType ) {} 191 void CommonType::visit( __attribute((unused)) StructInstType *aggregateUseType ) {} 192 void CommonType::visit( __attribute((unused)) UnionInstType *aggregateUseType ) {} 205 193 206 194 void CommonType::visit( EnumInstType *enumInstType ) { … … 214 202 } 215 203 216 void CommonType::visit( TraitInstType *aggregateUseType ) {204 void CommonType::visit( __attribute((unused)) TraitInstType *aggregateUseType ) { 217 205 } 218 206 … … 239 227 } 240 228 241 void CommonType::visit( TupleType *tupleType ) { 242 } 243 244 void CommonType::visit( VarArgsType *varArgsType ) { 245 } 229 void CommonType::visit( __attribute((unused)) TupleType *tupleType ) {} 230 void CommonType::visit( __attribute((unused)) VarArgsType *varArgsType ) {} 246 231 247 232 void CommonType::visit( ZeroType *zeroType ) { -
src/ResolvExpr/ConversionCost.cc
rb3c36f4 r7e003011 149 149 }; 150 150 151 void ConversionCost::visit( VoidType *voidType) {151 void ConversionCost::visit( __attribute((unused)) VoidType *voidType ) { 152 152 cost = Cost::infinity; 153 153 } … … 186 186 } 187 187 188 void ConversionCost::visit(ArrayType *arrayType) { 189 } 190 191 void ConversionCost::visit(FunctionType *functionType) { 192 } 188 void ConversionCost::visit(__attribute((unused)) ArrayType *arrayType) {} 189 void ConversionCost::visit(__attribute((unused)) FunctionType *functionType) {} 193 190 194 191 void ConversionCost::visit(StructInstType *inst) { … … 208 205 } 209 206 210 void ConversionCost::visit( EnumInstType *inst) {207 void ConversionCost::visit( __attribute((unused)) EnumInstType *inst ) { 211 208 static Type::Qualifiers q; 212 209 static BasicType integer( q, BasicType::SignedInt ); … … 217 214 } 218 215 219 void ConversionCost::visit( TraitInstType *inst) {216 void ConversionCost::visit( __attribute((unused)) TraitInstType *inst) { 220 217 } 221 218 … … 239 236 } 240 237 241 void ConversionCost::visit( TupleType *tupleType) {238 void ConversionCost::visit( __attribute((unused)) TupleType *tupleType) { 242 239 Cost c; 243 240 if ( TupleType *destAsTuple = dynamic_cast< TupleType* >( dest ) ) { … … 259 256 } 260 257 261 void ConversionCost::visit( VarArgsType *varArgsType) {258 void ConversionCost::visit( __attribute((unused)) VarArgsType *varArgsType) { 262 259 if ( dynamic_cast< VarArgsType* >( dest ) ) { 263 260 cost = Cost::zero; … … 265 262 } 266 263 267 void ConversionCost::visit( ZeroType *zeroType) {264 void ConversionCost::visit( __attribute((unused)) ZeroType *zeroType) { 268 265 if ( dynamic_cast< ZeroType* >( dest ) ) { 269 266 cost = Cost::zero; … … 281 278 } 282 279 283 void ConversionCost::visit( OneType *oneType) {280 void ConversionCost::visit( __attribute((unused)) OneType *oneType) { 284 281 if ( dynamic_cast< OneType* >( dest ) ) { 285 282 cost = Cost::zero; -
src/ResolvExpr/PtrsAssignable.cc
rb3c36f4 r7e003011 63 63 } 64 64 65 PtrsAssignable::PtrsAssignable( Type *dest, const TypeEnvironment &env ) : dest( dest ), result( 0 ), env( env ) { 66 } 65 PtrsAssignable::PtrsAssignable( Type *dest, const TypeEnvironment &env ) : dest( dest ), result( 0 ), env( env ) {} 67 66 68 void PtrsAssignable::visit( VoidType *voidType ) {67 void PtrsAssignable::visit( __attribute((unused)) VoidType *voidType ) { 69 68 if ( dynamic_cast< FunctionType* >( dest ) ) { 70 69 result = 0; … … 74 73 } 75 74 76 void PtrsAssignable::visit( BasicType *basicType ) { 77 } 78 79 void PtrsAssignable::visit( PointerType *pointerType ) { 80 } 81 82 void PtrsAssignable::visit( ArrayType *arrayType ) { 83 } 84 85 void PtrsAssignable::visit( FunctionType *functionType ) { 75 void PtrsAssignable::visit( __attribute__((unused)) BasicType *basicType ) {} 76 void PtrsAssignable::visit( __attribute__((unused)) PointerType *pointerType ) {} 77 void PtrsAssignable::visit( __attribute__((unused)) ArrayType *arrayType ) {} 78 void PtrsAssignable::visit( __attribute__((unused)) FunctionType *functionType ) { 86 79 result = -1; 87 80 } 88 81 89 void PtrsAssignable::visit( StructInstType *inst ) { 90 // I don't think we should be doing anything here, but I'm willing to admit that I might be wrong 91 } 92 93 void PtrsAssignable::visit( UnionInstType *inst ) { 94 // I don't think we should be doing anything here, but I'm willing to admit that I might be wrong 95 } 82 void PtrsAssignable::visit( __attribute__((unused)) StructInstType *inst ) {} 83 void PtrsAssignable::visit( __attribute__((unused)) UnionInstType *inst ) {} 96 84 97 85 void PtrsAssignable::visit( EnumInstType *inst ) { … … 103 91 } 104 92 105 void PtrsAssignable::visit( TraitInstType *inst ) { 106 // I definitely don't think we should be doing anything here 107 } 108 93 void PtrsAssignable::visit( __attribute__((unused)) TraitInstType *inst ) {} 109 94 void PtrsAssignable::visit( TypeInstType *inst ) { 110 95 EqvClass eqvClass; … … 116 101 } 117 102 118 void PtrsAssignable::visit( TupleType *tupleType ) { 119 /// // This code doesn't belong here, but it might be useful somewhere else 120 /// if ( TupleType *destAsTuple = dynamic_cast< TupleType* >( dest ) ) { 121 /// int ret = 0; 122 /// std::list< Type* >::const_iterator srcIt = tupleType->get_types().begin(); 123 /// std::list< Type* >::const_iterator destIt = destAsTuple->get_types().begin(); 124 /// while ( srcIt != tupleType->get_types().end() && destIt != destAsTuple->get_types().end() ) { 125 /// int assignResult = ptrsAssignable( *srcIt++, *destIt++ ); 126 /// if ( assignResult == 0 ) { 127 /// result = assignResult; 128 /// return; 129 /// } else if ( assignResult < 0 ) { 130 /// ret = -1; 131 /// } else if ( ret > 0 ) { 132 /// ret += assignResult; 133 /// } 134 /// } 135 /// if ( srcIt == tupleType->get_types().end() && destIt == destAsTuple->get_types().end() ) { 136 /// result = ret; 137 /// } else { 138 /// result = 0; 139 /// } 140 /// } 141 } 142 143 void PtrsAssignable::visit( VarArgsType *varArgsType ) { 144 } 145 146 void PtrsAssignable::visit( ZeroType *zeroType ) { 147 } 148 149 void PtrsAssignable::visit( OneType *oneType ) { 150 } 103 void PtrsAssignable::visit( __attribute__((unused)) TupleType *tupleType ) {} 104 void PtrsAssignable::visit( __attribute__((unused)) VarArgsType *varArgsType ) {} 105 void PtrsAssignable::visit( __attribute__((unused)) ZeroType *zeroType ) {} 106 void PtrsAssignable::visit( __attribute__((unused)) OneType *oneType ) {} 151 107 152 108 } // namespace ResolvExpr -
src/ResolvExpr/PtrsCastable.cc
rb3c36f4 r7e003011 92 92 } 93 93 94 void PtrsCastable::visit( VoidType *voidType) {94 void PtrsCastable::visit( __attribute__((unused)) VoidType *voidType) { 95 95 result = objectCast( dest, env, indexer ); 96 96 } 97 97 98 void PtrsCastable::visit( BasicType *basicType) {98 void PtrsCastable::visit( __attribute__((unused)) BasicType *basicType) { 99 99 result = objectCast( dest, env, indexer ); 100 100 } 101 101 102 void PtrsCastable::visit( PointerType *pointerType) {102 void PtrsCastable::visit( __attribute__((unused)) PointerType *pointerType) { 103 103 result = objectCast( dest, env, indexer ); 104 104 } 105 105 106 void PtrsCastable::visit( ArrayType *arrayType) {106 void PtrsCastable::visit( __attribute__((unused)) ArrayType *arrayType) { 107 107 result = objectCast( dest, env, indexer ); 108 108 } 109 109 110 void PtrsCastable::visit( FunctionType *functionType) {110 void PtrsCastable::visit( __attribute__((unused)) FunctionType *functionType) { 111 111 // result = -1; 112 112 result = functionCast( dest, env, indexer ); 113 113 } 114 114 115 void PtrsCastable::visit( StructInstType *inst) {115 void PtrsCastable::visit( __attribute__((unused)) StructInstType *inst) { 116 116 result = objectCast( dest, env, indexer ); 117 117 } 118 118 119 void PtrsCastable::visit( UnionInstType *inst) {119 void PtrsCastable::visit( __attribute__((unused)) UnionInstType *inst) { 120 120 result = objectCast( dest, env, indexer ); 121 121 } 122 122 123 void PtrsCastable::visit( EnumInstType *inst) {123 void PtrsCastable::visit( __attribute__((unused)) EnumInstType *inst) { 124 124 if ( dynamic_cast< EnumInstType* >( dest ) ) { 125 125 result = 1; … … 144 144 } 145 145 146 void PtrsCastable::visit( TupleType *tupleType) {146 void PtrsCastable::visit( __attribute__((unused)) TupleType *tupleType) { 147 147 result = objectCast( dest, env, indexer ); 148 148 } 149 149 150 void PtrsCastable::visit( VarArgsType *varArgsType) {150 void PtrsCastable::visit( __attribute__((unused)) VarArgsType *varArgsType) { 151 151 result = objectCast( dest, env, indexer ); 152 152 } 153 153 154 void PtrsCastable::visit( ZeroType *zeroType) {154 void PtrsCastable::visit( __attribute__((unused)) ZeroType *zeroType) { 155 155 result = objectCast( dest, env, indexer ); 156 156 } 157 157 158 void PtrsCastable::visit( OneType *oneType) {158 void PtrsCastable::visit( __attribute__((unused)) OneType *oneType) { 159 159 result = objectCast( dest, env, indexer ); 160 160 } -
src/ResolvExpr/TypeMap.h
rb3c36f4 r7e003011 110 110 } 111 111 112 virtual void visit( VoidType *voidType ) {112 virtual void visit( __attribute__((unused)) VoidType *voidType ) { 113 113 findAndReplace( typeMap.voidValue ); 114 114 } … … 138 138 } 139 139 140 virtual void visit( FunctionType *functionType ) {140 virtual void visit( __attribute__((unused)) FunctionType *functionType ) { 141 141 findAndReplace( typeMap.functionPointerValue ); 142 142 } -
src/ResolvExpr/typeops.h
rb3c36f4 r7e003011 132 132 } 133 133 134 template< typename Container1, typename Container2 >135 bool typesCompatibleList( Container1 &c1, Container2 &c2, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {136 typename Container1::iterator i1 = c1.begin();137 typename Container2::iterator i2 = c2.begin();138 for ( ; i1 != c1.end() && i2 != c2.end(); ++i1, ++i2 ) {139 if ( ! typesCompatible( *i1, *i2, indexer ) ) {140 return false;141 } // if142 }143 return ( i1 == c1.end() ) && ( i2 == c2.end() );144 }145 146 134 /// creates the type represented by the list of returnVals in a FunctionType. The caller owns the return value. 147 135 Type * extractResultType( FunctionType * functionType );
Note: See TracChangeset
for help on using the changeset viewer.