Changeset 8bf784a
- Timestamp:
- Dec 21, 2016, 2:54:31 PM (8 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:
- e33f321
- Parents:
- 6d4d1a6
- Location:
- src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
r6d4d1a6 r8bf784a 686 686 for ( std::list< Expression* >::iterator param = params.begin(); param != params.end(); ++param ) { 687 687 TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param ); 688 assert (paramType &&"Aggregate parameters should be type expressions");688 assertf(paramType, "Aggregate parameters should be type expressions"); 689 689 paramType->set_type( replaceWithConcrete( appExpr, paramType->get_type(), false ) ); 690 690 } -
src/InitTweak/FixInit.cc
r6d4d1a6 r8bf784a 38 38 #include "SynTree/AddStmtVisitor.h" 39 39 #include "CodeGen/GenType.h" // for warning/error messages 40 #include "Tuples/Tuples.h" 40 41 41 42 bool ctordtorp = false; // print all debug … … 392 393 393 394 bool ResolveCopyCtors::skipCopyConstruct( Type * type ) { 394 return dynamic_cast< VarArgsType * >( type ) || GenPoly::getFunctionType( type ) ;395 return dynamic_cast< VarArgsType * >( type ) || GenPoly::getFunctionType( type ) || Tuples::isTtype( type ); 395 396 } 396 397 -
src/SymTab/Mangler.cc
r6d4d1a6 r8bf784a 214 214 mangleName << "f"; 215 215 break; 216 case TypeDecl::Ttype: 217 mangleName << "tVARGS"; 218 break; 219 default: 220 assert( false ); 216 221 } // switch 217 222 mangleName << numStream.str(); … … 256 261 if ( ! type->get_forall().empty() ) { 257 262 std::list< std::string > assertionNames; 258 int tcount = 0, dcount = 0, fcount = 0 ;263 int tcount = 0, dcount = 0, fcount = 0, vcount = 0; 259 264 mangleName << "A"; 260 265 for ( Type::ForallList::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) { … … 269 274 fcount++; 270 275 break; 276 case TypeDecl::Ttype: 277 vcount++; 278 break; 279 default: 280 assert( false ); 271 281 } // switch 272 282 varNums[ (*i )->get_name() ] = std::pair< int, int >( nextVarNum++, (int )(*i )->get_kind() ); … … 280 290 } // for 281 291 } // for 282 mangleName << tcount << "_" << dcount << "_" << fcount << "_" ;292 mangleName << tcount << "_" << dcount << "_" << fcount << "_" << vcount << "_"; 283 293 std::copy( assertionNames.begin(), assertionNames.end(), std::ostream_iterator< std::string >( mangleName, "" ) ); 284 294 mangleName << "_"; -
src/SynTree/Declaration.cc
r6d4d1a6 r8bf784a 57 57 58 58 std::ostream & operator<<( std::ostream & out, const Declaration * decl ) { 59 decl->print( out ); 59 if ( decl ){ 60 decl->print( out ); 61 } else { 62 out << "nullptr"; 63 } 60 64 return out; 61 65 } -
src/SynTree/Expression.cc
r6d4d1a6 r8bf784a 672 672 673 673 std::ostream & operator<<( std::ostream & out, const Expression * expr ) { 674 expr->print( out ); 674 if ( expr ) { 675 expr->print( out ); 676 } else { 677 out << "nullptr"; 678 } 675 679 return out; 676 680 } -
src/SynTree/FunctionType.cc
r6d4d1a6 r8bf784a 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // FunctionType.cc -- 7 // FunctionType.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 19 19 #include "Declaration.h" 20 20 #include "Common/utility.h" 21 #include "Tuples/Tuples.h" 21 22 22 23 FunctionType::FunctionType( const Type::Qualifiers &tq, bool isVarArgs ) : Type( tq ), isVarArgs( isVarArgs ) { … … 31 32 deleteAll( returnVals ); 32 33 deleteAll( parameters ); 34 } 35 36 namespace { 37 bool containsTtype( const std::list<DeclarationWithType * > & l ) { 38 if ( ! l.empty() ) { 39 return Tuples::isTtype( l.back()->get_type() ); 40 } 41 return false; 42 } 43 } 44 45 bool FunctionType::isTtype() const { 46 return containsTtype( returnVals ) || containsTtype( parameters ); 33 47 } 34 48 -
src/SynTree/Statement.cc
r6d4d1a6 r8bf784a 388 388 389 389 std::ostream & operator<<( std::ostream & out, const Statement * statement ) { 390 statement->print( out ); 390 if ( statement ) { 391 statement->print( out ); 392 } else { 393 out << "nullptr"; 394 } 391 395 return out; 392 396 } -
src/SynTree/Type.cc
r6d4d1a6 r8bf784a 85 85 86 86 std::ostream & operator<<( std::ostream & out, const Type * type ) { 87 type->print( out ); 87 if ( type ) { 88 type->print( out ); 89 } else { 90 out << "nullptr"; 91 } 88 92 return out; 89 93 } -
src/SynTree/Type.h
r6d4d1a6 r8bf784a 204 204 std::list<DeclarationWithType*> & get_returnVals() { return returnVals; } 205 205 std::list<DeclarationWithType*> & get_parameters() { return parameters; } 206 bool get_isVarArgs() { return isVarArgs; }206 bool get_isVarArgs() const { return isVarArgs; } 207 207 void set_isVarArgs( bool newValue ) { isVarArgs = newValue; } 208 209 bool isTtype() const; 208 210 209 211 virtual FunctionType *clone() const { return new FunctionType( *this ); } -
src/SynTree/TypeDecl.cc
r6d4d1a6 r8bf784a 18 18 #include "Common/utility.h" 19 19 20 TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ), sized( kind == Any ) {20 TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ), sized( kind == Any || kind == Ttype ) { 21 21 } 22 22 … … 25 25 26 26 std::string TypeDecl::typeString() const { 27 static const char *kindNames[] = { "type", "incomplete type", "function type" };27 static const char *kindNames[] = { "type", "incomplete type", "function type", "tuple type" }; 28 28 return kindNames[ kind ]; 29 29 } -
src/Tuples/TupleExpansion.cc
r6d4d1a6 r8bf784a 318 318 } 319 319 320 TypeInstType * isTtype( Type * type ) { 321 if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( type ) ) { 322 if ( inst->get_baseType()->get_kind() == TypeDecl::Ttype ) { 323 return inst; 324 } 325 } 326 return nullptr; 327 } 328 320 329 namespace { 321 330 /// determines if impurity (read: side-effects) may exist in a piece of code. Currently gives a very crude approximation, wherein any function call expression means the code may be impure -
src/Tuples/Tuples.h
r6d4d1a6 r8bf784a 42 42 Type * makeTupleType( const std::list< Expression * > & exprs ); 43 43 44 /// returns a TypeInstType if `type` is a ttype, nullptr otherwise 45 TypeInstType * isTtype( Type * type ); 46 44 47 /// returns true if the expression may contain side-effects. 45 48 bool maybeImpure( Expression * expr );
Note: See TracChangeset
for help on using the changeset viewer.