Changeset 777ed2b
- Timestamp:
- Jul 11, 2018, 11:55:59 AM (5 years ago)
- Branches:
- aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 0fc52b6
- Parents:
- fc20514 (diff), 7de22b28 (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
- Files:
-
- 4 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
rfc20514 r777ed2b 164 164 previsit( (BaseSyntaxNode *)node ); 165 165 GuardAction( [this, node](){ 166 if ( printExprTypes ) {166 if ( printExprTypes && node->result ) { 167 167 output << " /* " << genType( node->result, "", pretty, genC ) << " */ "; 168 168 } … … 224 224 225 225 void CodeGenerator::handleAggregate( AggregateDecl * aggDecl, const std::string & kind ) { 226 if( ! aggDecl-> get_parameters().empty() && ! genC ) {226 if( ! aggDecl->parameters.empty() && ! genC ) { 227 227 // assertf( ! genC, "Aggregate type parameters should not reach code generation." ); 228 228 output << "forall("; 229 genCommaList( aggDecl-> get_parameters().begin(), aggDecl->get_parameters().end() );229 genCommaList( aggDecl->parameters.begin(), aggDecl->parameters.end() ); 230 230 output << ")" << endl; 231 231 output << indent; … … 233 233 234 234 output << kind; 235 genAttributes( aggDecl-> get_attributes());236 output << aggDecl-> get_name();235 genAttributes( aggDecl->attributes ); 236 output << aggDecl->name; 237 237 238 238 if ( aggDecl->has_body() ) { 239 std::list< Declaration * > & memb = aggDecl-> get_members();239 std::list< Declaration * > & memb = aggDecl->members; 240 240 output << " {" << endl; 241 241 -
src/CodeGen/GenType.cc
rfc20514 r777ed2b 48 48 void postvisit( ZeroType * zeroType ); 49 49 void postvisit( OneType * oneType ); 50 void postvisit( GlobalScopeType * globalType ); 50 51 void postvisit( TraitInstType * inst ); 51 52 void postvisit( TypeofType * typeof ); 53 void postvisit( QualifiedType * qualType ); 52 54 53 55 private: … … 291 293 } 292 294 295 void GenType::postvisit( GlobalScopeType * globalType ) { 296 assertf( ! genC, "Global scope type should not reach code generation." ); 297 handleQualifiers( globalType ); 298 } 299 293 300 void GenType::postvisit( TraitInstType * inst ) { 294 301 assertf( ! genC, "Trait types should not reach code generation." ); … … 307 314 } 308 315 316 void GenType::postvisit( QualifiedType * qualType ) { 317 assertf( ! genC, "Qualified types should not reach code generation." ); 318 std::ostringstream os; 319 os << genType( qualType->parent, "", pretty, genC, lineMarks ) << "." << genType( qualType->child, "", pretty, genC, lineMarks ) << typeString; 320 typeString = os.str(); 321 handleQualifiers( qualType ); 322 } 323 309 324 void GenType::handleQualifiers( Type * type ) { 310 325 if ( type->get_const() ) { -
src/Common/PassVisitor.h
rfc20514 r777ed2b 133 133 virtual void visit( ArrayType * arrayType ) override final; 134 134 virtual void visit( ReferenceType * referenceType ) override final; 135 virtual void visit( QualifiedType * qualType ) override final; 135 136 virtual void visit( FunctionType * functionType ) override final; 136 137 virtual void visit( StructInstType * aggregateUseType ) override final; … … 145 146 virtual void visit( ZeroType * zeroType ) override final; 146 147 virtual void visit( OneType * oneType ) override final; 148 virtual void visit( GlobalScopeType * globalType ) override final; 147 149 148 150 virtual void visit( Designation * designation ) override final; … … 233 235 virtual Type * mutate( ArrayType * arrayType ) override final; 234 236 virtual Type * mutate( ReferenceType * referenceType ) override final; 237 virtual Type * mutate( QualifiedType * qualType ) override final; 235 238 virtual Type * mutate( FunctionType * functionType ) override final; 236 239 virtual Type * mutate( StructInstType * aggregateUseType ) override final; … … 245 248 virtual Type * mutate( ZeroType * zeroType ) override final; 246 249 virtual Type * mutate( OneType * oneType ) override final; 250 virtual Type * mutate( GlobalScopeType * globalType ) override final; 247 251 248 252 virtual Designation * mutate( Designation * designation ) override final; -
src/Common/PassVisitor.impl.h
rfc20514 r777ed2b 2262 2262 2263 2263 //-------------------------------------------------------------------------- 2264 // QualifiedType 2265 template< typename pass_type > 2266 void PassVisitor< pass_type >::visit( QualifiedType * node ) { 2267 VISIT_START( node ); 2268 2269 maybeAccept_impl( node->forall, *this ); 2270 maybeAccept_impl( node->parent, *this ); 2271 maybeAccept_impl( node->child, *this ); 2272 2273 VISIT_END( node ); 2274 } 2275 2276 template< typename pass_type > 2277 Type * PassVisitor< pass_type >::mutate( QualifiedType * node ) { 2278 MUTATE_START( node ); 2279 2280 maybeMutate_impl( node->forall, *this ); 2281 maybeMutate_impl( node->parent, *this ); 2282 maybeMutate_impl( node->child, *this ); 2283 2284 MUTATE_END( Type, node ); 2285 } 2286 2287 //-------------------------------------------------------------------------- 2264 2288 // FunctionType 2265 2289 template< typename pass_type > … … 2554 2578 2555 2579 //-------------------------------------------------------------------------- 2580 // GlobalScopeType 2581 template< typename pass_type > 2582 void PassVisitor< pass_type >::visit( GlobalScopeType * node ) { 2583 VISIT_START( node ); 2584 2585 maybeAccept_impl( node->forall, *this ); 2586 2587 VISIT_END( node ); 2588 } 2589 2590 template< typename pass_type > 2591 Type * PassVisitor< pass_type >::mutate( GlobalScopeType * node ) { 2592 MUTATE_START( node ); 2593 2594 maybeMutate_impl( node->forall, *this ); 2595 2596 MUTATE_END( Type, node ); 2597 } 2598 2599 //-------------------------------------------------------------------------- 2556 2600 // Designation 2557 2601 template< typename pass_type > -
src/Concurrency/Keywords.cc
rfc20514 r777ed2b 501 501 void MutexKeyword::postvisit(StructDecl* decl) { 502 502 503 if( decl->name == "monitor_desc" ) {503 if( decl->name == "monitor_desc" && decl->body ) { 504 504 assert( !monitor_decl ); 505 505 monitor_decl = decl; 506 506 } 507 else if( decl->name == "monitor_guard_t" ) {507 else if( decl->name == "monitor_guard_t" && decl->body ) { 508 508 assert( !guard_decl ); 509 509 guard_decl = decl; 510 510 } 511 else if( decl->name == "monitor_dtor_guard_t" ) {511 else if( decl->name == "monitor_dtor_guard_t" && decl->body ) { 512 512 assert( !dtor_guard_decl ); 513 513 dtor_guard_decl = decl; -
src/InitTweak/FixInit.cc
rfc20514 r777ed2b 1163 1163 1164 1164 std::string fname = getFunctionName( appExpr ); 1165 if ( fname == function-> get_name()) {1165 if ( fname == function->name ) { 1166 1166 // call to same kind of function 1167 Expression * firstParam = appExpr-> get_args().front();1167 Expression * firstParam = appExpr->args.front(); 1168 1168 1169 1169 if ( isThisExpression( firstParam, thisParam ) ) { … … 1174 1174 // if first parameter is a member expression on the this parameter, 1175 1175 // then remove the member from unhandled set. 1176 if ( isThisExpression( memberExpr-> get_aggregate(), thisParam ) ) {1177 unhandled.erase( memberExpr-> get_member());1176 if ( isThisExpression( memberExpr->aggregate, thisParam ) ) { 1177 unhandled.erase( memberExpr->member ); 1178 1178 } 1179 1179 } -
src/Parser/DeclarationNode.cc
rfc20514 r777ed2b 254 254 } // DeclarationNode::newFromTypedef 255 255 256 DeclarationNode * DeclarationNode::newFromGlobalScope() { 257 DeclarationNode * newnode = new DeclarationNode; 258 newnode->type = new TypeData( TypeData::GlobalScope ); 259 return newnode; 260 } 261 262 DeclarationNode * DeclarationNode::newQualifiedType( DeclarationNode * parent, DeclarationNode * child) { 263 DeclarationNode * newnode = new DeclarationNode; 264 newnode->type = new TypeData( TypeData::Qualified ); 265 newnode->type->qualified.parent = parent->type; 266 newnode->type->qualified.child = child->type; 267 parent->type = nullptr; 268 child->type = nullptr; 269 delete parent; 270 delete child; 271 return newnode; 272 } 273 256 274 DeclarationNode * DeclarationNode::newAggregate( Aggregate kind, const string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body ) { 257 assert( name );258 275 DeclarationNode * newnode = new DeclarationNode; 259 276 newnode->type = new TypeData( TypeData::Aggregate ); 260 277 newnode->type->aggregate.kind = kind; 261 newnode->type->aggregate.name = name;278 newnode->type->aggregate.name = name == nullptr ? new string( DeclarationNode::anonymous.newName() ) : name; 262 279 newnode->type->aggregate.actuals = actuals; 263 280 newnode->type->aggregate.fields = fields; … … 265 282 newnode->type->aggregate.tagged = false; 266 283 newnode->type->aggregate.parent = nullptr; 284 newnode->type->aggregate.anon = name == nullptr; 267 285 return newnode; 268 286 } // DeclarationNode::newAggregate 269 287 270 288 DeclarationNode * DeclarationNode::newEnum( const string * name, DeclarationNode * constants, bool body ) { 271 assert( name );272 289 DeclarationNode * newnode = new DeclarationNode; 273 290 newnode->type = new TypeData( TypeData::Enum ); 274 newnode->type->enumeration.name = name ;291 newnode->type->enumeration.name = name == nullptr ? new string( DeclarationNode::anonymous.newName() ) : name; 275 292 newnode->type->enumeration.constants = constants; 276 293 newnode->type->enumeration.body = body; 294 newnode->type->enumeration.anon = name == nullptr; 277 295 return newnode; 278 296 } // DeclarationNode::newEnum … … 953 971 for ( const DeclarationNode * cur = firstNode; cur; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ) ) { 954 972 try { 973 bool extracted = false; 974 bool anon = false; 955 975 if ( DeclarationNode * extr = cur->extractAggregate() ) { 956 976 // handle the case where a structure declaration is contained within an object or type declaration 957 977 Declaration * decl = extr->build(); 958 978 if ( decl ) { 979 // hoist the structure declaration 959 980 decl->location = cur->location; 960 981 * out++ = decl; 982 983 // need to remember the cases where a declaration contains an anonymous aggregate definition 984 extracted = true; 985 assert( extr->type ); 986 if ( extr->type->kind == TypeData::Aggregate ) { 987 anon = extr->type->aggregate.anon; 988 } else if ( extr->type->kind == TypeData::Enum ) { 989 // xxx - is it useful to have an implicit anonymous enum member? 990 anon = extr->type->enumeration.anon; 991 } 961 992 } // if 962 993 delete extr; … … 965 996 Declaration * decl = cur->build(); 966 997 if ( decl ) { 967 decl->location = cur->location; 968 * out++ = decl; 998 // don't include anonymous declaration for named aggregates, but do include them for anonymous aggregates, e.g.: 999 // struct S { 1000 // struct T { int x; }; // no anonymous member 1001 // struct { int y; }; // anonymous member 1002 // struct T; // anonymous member 1003 // }; 1004 if ( ! (extracted && decl->name == "" && ! anon) ) { 1005 decl->location = cur->location; 1006 * out++ = decl; 1007 } 969 1008 } // if 970 1009 } catch( SemanticErrorException &e ) { … … 978 1017 } // buildList 979 1018 1019 // currently only builds assertions, function parameters, and return values 980 1020 void buildList( const DeclarationNode * firstNode, std::list< DeclarationWithType * > &outputList ) { 981 1021 SemanticErrorException errors; … … 985 1025 try { 986 1026 Declaration * decl = cur->build(); 987 if ( decl ) { 988 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) { 989 dwt->location = cur->location; 990 * out++ = dwt; 991 } else if ( StructDecl * agg = dynamic_cast< StructDecl * >( decl ) ) { 992 StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->get_name() ); 993 auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr ); 994 obj->location = cur->location; 995 * out++ = obj; 996 delete agg; 997 } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) { 998 UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->get_name() ); 999 auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr ); 1000 obj->location = cur->location; 1001 * out++ = obj; 1002 } // if 1027 assert( decl ); 1028 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) { 1029 dwt->location = cur->location; 1030 * out++ = dwt; 1031 } else if ( StructDecl * agg = dynamic_cast< StructDecl * >( decl ) ) { 1032 // e.g., int foo(struct S) {} 1033 StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->name ); 1034 auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr ); 1035 obj->location = cur->location; 1036 * out++ = obj; 1037 delete agg; 1038 } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) { 1039 // e.g., int foo(union U) {} 1040 UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->name ); 1041 auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr ); 1042 obj->location = cur->location; 1043 * out++ = obj; 1044 } else if ( EnumDecl * agg = dynamic_cast< EnumDecl * >( decl ) ) { 1045 // e.g., int foo(enum E) {} 1046 EnumInstType * inst = new EnumInstType( Type::Qualifiers(), agg->name ); 1047 auto obj = new ObjectDecl( "", Type::StorageClasses(), linkage, nullptr, inst, nullptr ); 1048 obj->location = cur->location; 1049 * out++ = obj; 1003 1050 } // if 1004 1051 } catch( SemanticErrorException &e ) { -
src/Parser/ParseNode.h
rfc20514 r777ed2b 231 231 static DeclarationNode * newForall( DeclarationNode * ); 232 232 static DeclarationNode * newFromTypedef( const std::string * ); 233 static DeclarationNode * newFromGlobalScope(); 234 static DeclarationNode * newQualifiedType( DeclarationNode *, DeclarationNode * ); 233 235 static DeclarationNode * newFunction( const std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body ); 234 236 static DeclarationNode * newAggregate( Aggregate kind, const std::string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body ); -
src/Parser/TypeData.cc
rfc20514 r777ed2b 37 37 case Reference: 38 38 case EnumConstant: 39 case GlobalScope: 39 40 // nothing else to initialize 40 41 break; … … 62 63 enumeration.constants = nullptr; 63 64 enumeration.body = false; 65 enumeration.anon = false; 64 66 break; 65 67 case Aggregate: … … 73 75 aggregate.tagged = false; 74 76 aggregate.parent = nullptr; 77 aggregate.anon = false; 75 78 break; 76 79 case AggregateInst: … … 98 101 case Builtin: 99 102 // builtin = new Builtin_t; 103 case Qualified: 104 qualified.parent = nullptr; 105 qualified.child = nullptr; 100 106 break; 101 107 } // switch … … 112 118 case Reference: 113 119 case EnumConstant: 120 case GlobalScope: 114 121 // nothing to destroy 115 122 break; … … 165 172 // delete builtin; 166 173 break; 174 case Qualified: 175 delete qualified.parent; 176 delete qualified.child; 167 177 } // switch 168 178 } // TypeData::~TypeData … … 180 190 case Pointer: 181 191 case Reference: 192 case GlobalScope: 182 193 // nothing else to copy 183 194 break; … … 207 218 newtype->aggregate.fields = maybeClone( aggregate.fields ); 208 219 newtype->aggregate.body = aggregate.body; 220 newtype->aggregate.anon = aggregate.anon; 209 221 newtype->aggregate.tagged = aggregate.tagged; 210 222 newtype->aggregate.parent = aggregate.parent ? new string( *aggregate.parent ) : nullptr; … … 219 231 newtype->enumeration.constants = maybeClone( enumeration.constants ); 220 232 newtype->enumeration.body = enumeration.body; 233 newtype->enumeration.anon = enumeration.anon; 221 234 break; 222 235 case Symbolic: … … 238 251 newtype->builtintype = builtintype; 239 252 break; 253 case Qualified: 254 newtype->qualified.parent = maybeClone( qualified.parent ); 255 newtype->qualified.child = maybeClone( qualified.child ); 256 break; 240 257 } // switch 241 258 return newtype; … … 406 423 } // switch 407 424 } // TypeData::print 425 426 const std::string * TypeData::leafName() const { 427 switch ( kind ) { 428 case Unknown: 429 case Pointer: 430 case Reference: 431 case EnumConstant: 432 case GlobalScope: 433 case Array: 434 case Basic: 435 case Function: 436 case AggregateInst: 437 case Tuple: 438 case Typeof: 439 case Builtin: 440 assertf(false, "Tried to get leaf name from kind without a name: %d", kind); 441 break; 442 case Aggregate: 443 return aggregate.name; 444 case Enum: 445 return enumeration.name; 446 case Symbolic: 447 case SymbolicInst: 448 return symbolic.name; 449 case Qualified: 450 return qualified.child->leafName(); 451 } // switch 452 assert(false); 453 } 408 454 409 455 … … 465 511 return new EnumInstType( buildQualifiers( td ), "" ); 466 512 case TypeData::SymbolicInst: 467 return buildSymbolicInst( td ); ;513 return buildSymbolicInst( td ); 468 514 case TypeData::Tuple: 469 515 return buildTuple( td ); … … 480 526 return new VarArgsType( buildQualifiers( td ) ); 481 527 } 528 case TypeData::GlobalScope: 529 return new GlobalScopeType(); 530 case TypeData::Qualified: 531 return new QualifiedType( buildQualifiers( td ), typebuild( td->qualified.parent ), typebuild( td->qualified.child ) ); 482 532 case TypeData::Symbolic: 483 533 case TypeData::Enum: … … 485 535 assert( false ); 486 536 } // switch 537 487 538 return nullptr; 488 539 } // typebuild … … 893 944 assert( td->kind == TypeData::Function ); 894 945 FunctionType * ft = new FunctionType( buildQualifiers( td ), ! td->function.params || td->function.params->hasEllipsis ); 895 buildList( td->function.params, ft-> get_parameters());896 buildForall( td->forall, ft-> get_forall());946 buildList( td->function.params, ft->parameters ); 947 buildForall( td->forall, ft->forall ); 897 948 if ( td->base ) { 898 949 switch ( td->base->kind ) { 899 950 case TypeData::Tuple: 900 buildList( td->base->tuple, ft-> get_returnVals());951 buildList( td->base->tuple, ft->returnVals ); 901 952 break; 902 953 default: -
src/Parser/TypeData.h
rfc20514 r777ed2b 27 27 struct TypeData { 28 28 enum Kind { Basic, Pointer, Array, Reference, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic, 29 SymbolicInst, Tuple, Typeof, Builtin, Unknown };29 SymbolicInst, Tuple, Typeof, Builtin, GlobalScope, Qualified, Unknown }; 30 30 31 31 struct Aggregate_t { … … 36 36 DeclarationNode * fields; 37 37 bool body; 38 bool anon; 38 39 39 40 bool tagged; … … 57 58 DeclarationNode * constants; 58 59 bool body; 60 bool anon; 59 61 }; 60 62 … … 75 77 }; 76 78 79 struct Qualified_t { // qualified type S.T 80 TypeData * parent; 81 TypeData * child; 82 }; 83 77 84 CodeLocation location; 78 85 … … 88 95 DeclarationNode * forall; 89 96 90 // Basic_t basic;91 97 Aggregate_t aggregate; 92 98 AggInst_t aggInst; 93 99 Array_t array; 94 100 Enumeration_t enumeration; 95 // Variable_t variable;96 101 Function_t function; 97 102 Symbolic_t symbolic; 103 Qualified_t qualified; 98 104 DeclarationNode * tuple; 99 105 ExpressionNode * typeexpr; … … 103 109 void print( std::ostream &, int indent = 0 ) const; 104 110 TypeData * clone() const; 111 112 const std::string * leafName() const; 105 113 }; 106 114 -
src/Parser/parser.yy
rfc20514 r777ed2b 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jul 11 11: 20:51201813 // Update Count : 373 812 // Last Modified On : Wed Jul 11 11:55:24 2018 13 // Update Count : 3739 14 14 // 15 15 … … 1825 1825 { $$ = DeclarationNode::newFromTypedef( $1 ); } 1826 1826 | '.' TYPEDEFname 1827 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }1827 { $$ = DeclarationNode::newQualifiedType( DeclarationNode::newFromGlobalScope(), DeclarationNode::newFromTypedef( $2 ) ); } 1828 1828 | type_name '.' TYPEDEFname 1829 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }1829 { $$ = DeclarationNode::newQualifiedType( $1, DeclarationNode::newFromTypedef( $3 ) ); } 1830 1830 | typegen_name 1831 1831 | '.' typegen_name 1832 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }1832 { $$ = DeclarationNode::newQualifiedType( DeclarationNode::newFromGlobalScope(), $2 ); } 1833 1833 | type_name '.' typegen_name 1834 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }1834 { $$ = DeclarationNode::newQualifiedType( $1, $3 ); } 1835 1835 ; 1836 1836 … … 1863 1863 { forall = false; } // reset 1864 1864 '{' field_declaration_list_opt '}' type_parameters_opt 1865 { $$ = DeclarationNode::newAggregate( $1, n ew string( DeclarationNode::anonymous.newName() ), $7, $5, true )->addQualifiers( $2 ); }1865 { $$ = DeclarationNode::newAggregate( $1, nullptr, $7, $5, true )->addQualifiers( $2 ); } 1866 1866 | aggregate_key attribute_list_opt no_attr_identifier fred 1867 1867 { … … 1873 1873 | aggregate_key attribute_list_opt type_name fred 1874 1874 { 1875 typedefTable.makeTypedef( *$3->type->symbolic.name, forall | typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef 1875 // for type_name can be a qualified type name S.T, in which case only the last name in the chain needs a typedef (other names in the chain should already have one) 1876 typedefTable.makeTypedef( *$3->type->leafName(), forall | typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef 1876 1877 forall = false; // reset 1877 1878 } … … 1936 1937 { distExt( $3 ); $$ = distAttr( $2, $3 ); } // mark all fields in list 1937 1938 | typedef_declaration ';' // CFA 1938 { SemanticError( yylloc, "Typedef in aggregate is currently unimplemented." ); $$ = nullptr; }1939 1939 | cfa_field_declaring_list ';' // CFA, new style field declaration 1940 1940 | EXTENSION cfa_field_declaring_list ';' // GCC 1941 1941 { distExt( $2 ); $$ = $2; } // mark all fields in list 1942 1942 | cfa_typedef_declaration ';' // CFA 1943 { SemanticError( yylloc, "Typedef in aggregate is currently unimplemented." ); $$ = nullptr; }1944 1943 | static_assert // C11 1945 1944 ; … … 1990 1989 enum_type: // enum 1991 1990 ENUM attribute_list_opt '{' enumerator_list comma_opt '}' 1992 { $$ = DeclarationNode::newEnum( n ew string( DeclarationNode::anonymous.newName() ), $4, true )->addQualifiers( $2 ); }1991 { $$ = DeclarationNode::newEnum( nullptr, $4, true )->addQualifiers( $2 ); } 1993 1992 | ENUM attribute_list_opt no_attr_identifier 1994 1993 { typedefTable.makeTypedef( *$3 ); } -
src/SymTab/Indexer.cc
rfc20514 r777ed2b 272 272 } 273 273 274 NamedTypeDecl *Indexer::globalLookupType( const std::string &id ) const { 275 return lookupTypeAtScope( id, 0 ); 276 } 277 278 StructDecl *Indexer::globalLookupStruct( const std::string &id ) const { 279 return lookupStructAtScope( id, 0 ); 280 } 281 282 UnionDecl *Indexer::globalLookupUnion( const std::string &id ) const { 283 return lookupUnionAtScope( id, 0 ); 284 } 285 286 EnumDecl *Indexer::globalLookupEnum( const std::string &id ) const { 287 return lookupEnumAtScope( id, 0 ); 288 } 289 274 290 EnumDecl *Indexer::lookupEnum( const std::string &id ) const { 275 291 if ( ! tables ) return 0; … … 347 363 if ( ! tables ) return 0; 348 364 if ( tables->scope < scope ) return 0; 365 if ( tables->scope > scope ) return tables->base.lookupTypeAtScope( id, scope ); 349 366 350 367 TypeTable::const_iterator ret = tables->typeTable.find( id ); … … 355 372 if ( ! tables ) return 0; 356 373 if ( tables->scope < scope ) return 0; 374 if ( tables->scope > scope ) return tables->base.lookupStructAtScope( id, scope ); 357 375 358 376 StructTable::const_iterator ret = tables->structTable.find( id ); … … 363 381 if ( ! tables ) return 0; 364 382 if ( tables->scope < scope ) return 0; 383 if ( tables->scope > scope ) return tables->base.lookupEnumAtScope( id, scope ); 365 384 366 385 EnumTable::const_iterator ret = tables->enumTable.find( id ); … … 371 390 if ( ! tables ) return 0; 372 391 if ( tables->scope < scope ) return 0; 392 if ( tables->scope > scope ) return tables->base.lookupUnionAtScope( id, scope ); 373 393 374 394 UnionTable::const_iterator ret = tables->unionTable.find( id ); … … 379 399 if ( ! tables ) return 0; 380 400 if ( tables->scope < scope ) return 0; 401 if ( tables->scope > scope ) return tables->base.lookupTraitAtScope( id, scope ); 381 402 382 403 TraitTable::const_iterator ret = tables->traitTable.find( id ); … … 486 507 487 508 bool addedTypeConflicts( NamedTypeDecl *existing, NamedTypeDecl *added ) { 488 if ( existing-> get_base() == 0) {509 if ( existing->base == nullptr ) { 489 510 return false; 490 } else if ( added-> get_base() == 0) {511 } else if ( added->base == nullptr ) { 491 512 return true; 492 513 } else { 493 SemanticError( added, "redeclaration of " ); 494 } 514 assert( existing->base && added->base ); 515 // typedef redeclarations are errors only if types are different 516 if ( ! ResolvExpr::typesCompatible( existing->base, added->base, Indexer() ) ) { 517 SemanticError( added->location, "redeclaration of " + added->name ); 518 } 519 } 520 // does not need to be added to the table if both existing and added have a base that are the same 521 return true; 495 522 } 496 523 … … 499 526 makeWritable(); 500 527 501 const std::string &id = decl-> get_name();528 const std::string &id = decl->name; 502 529 TypeTable::iterator existing = tables->typeTable.find( id ); 503 530 if ( existing == tables->typeTable.end() ) { … … 532 559 makeWritable(); 533 560 534 const std::string &id = decl-> get_name();561 const std::string &id = decl->name; 535 562 StructTable::iterator existing = tables->structTable.find( id ); 536 563 if ( existing == tables->structTable.end() ) { … … 551 578 makeWritable(); 552 579 553 const std::string &id = decl-> get_name();580 const std::string &id = decl->name; 554 581 EnumTable::iterator existing = tables->enumTable.find( id ); 555 582 if ( existing == tables->enumTable.end() ) { … … 575 602 makeWritable(); 576 603 577 const std::string &id = decl-> get_name();604 const std::string &id = decl->name; 578 605 UnionTable::iterator existing = tables->unionTable.find( id ); 579 606 if ( existing == tables->unionTable.end() ) { … … 594 621 makeWritable(); 595 622 596 const std::string &id = decl-> get_name();623 const std::string &id = decl->name; 597 624 TraitTable::iterator existing = tables->traitTable.find( id ); 598 625 if ( existing == tables->traitTable.end() ) { -
src/SymTab/Indexer.h
rfc20514 r777ed2b 70 70 /// Gets the top-most trait declaration with the given ID 71 71 TraitDecl *lookupTrait( const std::string &id ) const; 72 73 /// Gets the type declaration with the given ID at global scope 74 NamedTypeDecl *globalLookupType( const std::string &id ) const; 75 /// Gets the struct declaration with the given ID at global scope 76 StructDecl *globalLookupStruct( const std::string &id ) const; 77 /// Gets the union declaration with the given ID at global scope 78 UnionDecl *globalLookupUnion( const std::string &id ) const; 79 /// Gets the enum declaration with the given ID at global scope 80 EnumDecl *globalLookupEnum( const std::string &id ) const; 72 81 73 82 void print( std::ostream &os, int indent = 0 ) const; -
src/SymTab/Mangler.cc
rfc20514 r777ed2b 60 60 void postvisit( ZeroType * zeroType ); 61 61 void postvisit( OneType * oneType ); 62 void postvisit( QualifiedType * qualType ); 62 63 63 64 std::string get_mangleName() { return mangleName.str(); } … … 171 172 "w", // SignedInt128 172 173 "Uw", // UnsignedInt128 173 "x", 174 "y", 174 "x", // Float80 175 "y", // Float128 175 176 }; 176 177 static_assert( … … 312 313 void Mangler::postvisit( OneType * ) { 313 314 mangleName << "O"; 315 } 316 317 void Mangler::postvisit( QualifiedType * qualType ) { 318 maybeAccept( qualType->parent, *visitor ); 319 mangleName << "__"; 320 maybeAccept( qualType->child, *visitor ); 314 321 } 315 322 -
src/SymTab/Validate.cc
rfc20514 r777ed2b 77 77 class SwitchStmt; 78 78 79 #define debugPrint( x ) if ( doDebug ) { std::cout << x; }79 #define debugPrint( x ) if ( doDebug ) x 80 80 81 81 namespace SymTab { 82 /// hoists declarations that are difficult to hoist while parsing 83 struct HoistTypeDecls final : public WithDeclsToAdd { 84 void previsit( SizeofExpr * ); 85 void previsit( AlignofExpr * ); 86 void previsit( UntypedOffsetofExpr * ); 87 void handleType( Type * ); 88 }; 89 90 struct FixQualifiedTypes final : public WithIndexer { 91 Type * postmutate( QualifiedType * ); 92 }; 93 82 94 struct HoistStruct final : public WithDeclsToAdd, public WithGuards { 83 95 /// Flattens nested struct types 84 96 static void hoistStruct( std::list< Declaration * > &translationUnit ); 85 97 86 void previsit( EnumInstType * enumInstType );87 void previsit( StructInstType * structInstType );88 void previsit( UnionInstType * unionInstType );89 98 void previsit( StructDecl * aggregateDecl ); 90 99 void previsit( UnionDecl * aggregateDecl ); 91 100 void previsit( StaticAssertDecl * assertDecl ); 101 void previsit( StructInstType * type ); 102 void previsit( UnionInstType * type ); 103 void previsit( EnumInstType * type ); 92 104 93 105 private: … … 112 124 113 125 /// Associates forward declarations of aggregates with their definitions 114 struct LinkReferenceToTypes final : public WithIndexer, public WithGuards {126 struct LinkReferenceToTypes final : public WithIndexer, public WithGuards, public WithVisitorRef<LinkReferenceToTypes>, public WithShortCircuiting { 115 127 LinkReferenceToTypes( const Indexer *indexer ); 116 128 void postvisit( TypeInstType *typeInst ); … … 120 132 void postvisit( UnionInstType *unionInst ); 121 133 void postvisit( TraitInstType *traitInst ); 134 void previsit( QualifiedType * qualType ); 135 void postvisit( QualifiedType * qualType ); 122 136 123 137 void postvisit( EnumDecl *enumDecl ); … … 165 179 }; 166 180 167 struct EliminateTypedef final : public WithVisitorRef<EliminateTypedef>, public WithGuards{168 EliminateTypedef() : scopeLevel( 0 ) {}181 struct ReplaceTypedef final : public WithVisitorRef<ReplaceTypedef>, public WithGuards, public WithShortCircuiting, public WithDeclsToAdd { 182 ReplaceTypedef() : scopeLevel( 0 ) {} 169 183 /// Replaces typedefs by forward declarations 170 static void eliminateTypedef( std::list< Declaration * > &translationUnit ); 171 184 static void replaceTypedef( std::list< Declaration * > &translationUnit ); 185 186 void premutate( QualifiedType * ); 187 Type * postmutate( QualifiedType * qualType ); 172 188 Type * postmutate( TypeInstType * aggregateUseType ); 173 189 Declaration * postmutate( TypedefDecl * typeDecl ); … … 180 196 181 197 void premutate( CompoundStmt * compoundStmt ); 182 CompoundStmt * postmutate( CompoundStmt * compoundStmt );183 198 184 199 void premutate( StructDecl * structDecl ); 185 Declaration * postmutate( StructDecl * structDecl );186 200 void premutate( UnionDecl * unionDecl ); 187 Declaration * postmutate( UnionDecl * unionDecl );188 201 void premutate( EnumDecl * enumDecl ); 189 Declaration * postmutate( EnumDecl * enumDecl ); 190 Declaration * postmutate( TraitDecl * contextDecl ); 202 void premutate( TraitDecl * ); 191 203 192 204 void premutate( FunctionType * ftype ); … … 194 206 private: 195 207 template<typename AggDecl> 196 AggDecl *handleAggregate( AggDecl * aggDecl );197 198 template<typename AggDecl>199 208 void addImplicitTypedef( AggDecl * aggDecl ); 209 template< typename AggDecl > 210 void handleAggregate( AggDecl * aggr ); 200 211 201 212 typedef std::unique_ptr<TypedefDecl> TypedefDeclPtr; 202 213 typedef ScopedMap< std::string, std::pair< TypedefDeclPtr, int > > TypedefMap; 203 typedef std::map< std::string, TypeDecl * > TypeDeclMap;214 typedef ScopedMap< std::string, TypeDecl * > TypeDeclMap; 204 215 TypedefMap typedefNames; 205 216 TypeDeclMap typedeclNames; 206 217 int scopeLevel; 207 218 bool inFunctionType = false; 219 }; 220 221 struct EliminateTypedef { 222 /// removes TypedefDecls from the AST 223 static void eliminateTypedef( std::list< Declaration * > &translationUnit ); 224 225 template<typename AggDecl> 226 void handleAggregate( AggDecl *aggregateDecl ); 227 228 void previsit( StructDecl * aggregateDecl ); 229 void previsit( UnionDecl * aggregateDecl ); 230 void previsit( CompoundStmt * compoundStmt ); 208 231 }; 209 232 … … 263 286 PassVisitor<FindSpecialDeclarations> finder; 264 287 PassVisitor<LabelAddressFixer> labelAddrFixer; 265 266 EliminateTypedef::eliminateTypedef( translationUnit ); 267 HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order 288 PassVisitor<HoistTypeDecls> hoistDecls; 289 PassVisitor<FixQualifiedTypes> fixQual; 290 291 acceptAll( translationUnit, hoistDecls ); 292 ReplaceTypedef::replaceTypedef( translationUnit ); 268 293 ReturnTypeFixer::fix( translationUnit ); // must happen before autogen 269 294 acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes because it is an indexer and needs correct types for mangling 270 295 acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions 296 mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes, because aggregate members are accessed 297 HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order 298 EliminateTypedef::eliminateTypedef( translationUnit ); // 271 299 acceptAll( translationUnit, genericParams ); // check as early as possible - can't happen before LinkReferenceToTypes 272 300 VerifyCtorDtorAssign::verify( translationUnit ); // must happen before autogen, because autogen examines existing ctor/dtors … … 294 322 } 295 323 324 325 void HoistTypeDecls::handleType( Type * type ) { 326 // some type declarations are buried in expressions and not easy to hoist during parsing; hoist them here 327 AggregateDecl * aggr = nullptr; 328 if ( StructInstType * inst = dynamic_cast< StructInstType * >( type ) ) { 329 aggr = inst->baseStruct; 330 } else if ( UnionInstType * inst = dynamic_cast< UnionInstType * >( type ) ) { 331 aggr = inst->baseUnion; 332 } else if ( EnumInstType * inst = dynamic_cast< EnumInstType * >( type ) ) { 333 aggr = inst->baseEnum; 334 } 335 if ( aggr && aggr->body ) { 336 declsToAddBefore.push_front( aggr ); 337 } 338 } 339 340 void HoistTypeDecls::previsit( SizeofExpr * expr ) { 341 handleType( expr->type ); 342 } 343 344 void HoistTypeDecls::previsit( AlignofExpr * expr ) { 345 handleType( expr->type ); 346 } 347 348 void HoistTypeDecls::previsit( UntypedOffsetofExpr * expr ) { 349 handleType( expr->type ); 350 } 351 352 353 Type * FixQualifiedTypes::postmutate( QualifiedType * qualType ) { 354 Type * parent = qualType->parent; 355 Type * child = qualType->child; 356 if ( dynamic_cast< GlobalScopeType * >( qualType->parent ) ) { 357 // .T => lookup T at global scope 358 if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( child ) ) { 359 auto td = indexer.globalLookupType( inst->name ); 360 if ( ! td ) { 361 SemanticError( qualType->location, toString("Use of undefined global type ", inst->name) ); 362 } 363 auto base = td->base; 364 assert( base ); 365 return base->clone(); 366 } else { 367 // .T => T is not a type name 368 assertf( false, "unhandled global qualified child type: %s", toCString(child) ); 369 } 370 } else { 371 // S.T => S must be an aggregate type, find the declaration for T in S. 372 AggregateDecl * aggr = nullptr; 373 if ( StructInstType * inst = dynamic_cast< StructInstType * >( parent ) ) { 374 aggr = inst->baseStruct; 375 } else if ( UnionInstType * inst = dynamic_cast< UnionInstType * > ( parent ) ) { 376 aggr = inst->baseUnion; 377 } else { 378 SemanticError( qualType->location, toString("Qualified type requires an aggregate on the left, but has: ", parent) ); 379 } 380 assert( aggr ); // TODO: need to handle forward declarations 381 for ( Declaration * member : aggr->members ) { 382 if ( StructInstType * inst = dynamic_cast< StructInstType * >( child ) ) { 383 if ( StructDecl * aggr = dynamic_cast< StructDecl * >( member ) ) { 384 if ( aggr->name == inst->name ) { 385 return new StructInstType( qualType->get_qualifiers(), aggr ); 386 } 387 } 388 } else if ( UnionInstType * inst = dynamic_cast< UnionInstType * >( child ) ) { 389 if ( UnionDecl * aggr = dynamic_cast< UnionDecl * > ( member ) ) { 390 if ( aggr->name == inst->name ) { 391 return new UnionInstType( qualType->get_qualifiers(), aggr ); 392 } 393 } 394 } else if ( EnumInstType * inst = dynamic_cast< EnumInstType * >( child ) ) { 395 if ( EnumDecl * aggr = dynamic_cast< EnumDecl * > ( member ) ) { 396 if ( aggr->name == inst->name ) { 397 return new EnumInstType( qualType->get_qualifiers(), aggr ); 398 } 399 } 400 } else if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( child ) ) { 401 // struct typedefs are being replaced by forward decls too early; move it to hoist struct 402 if ( NamedTypeDecl * aggr = dynamic_cast< NamedTypeDecl * > ( member ) ) { 403 if ( aggr->name == inst->name ) { 404 assert( aggr->base ); 405 return aggr->base->clone(); 406 } 407 } 408 } else { 409 // S.T - S is not an aggregate => error 410 assertf( false, "unhandled qualified child type: %s", toCString(qualType) ); 411 } 412 } 413 // failed to find a satisfying definition of type 414 SemanticError( qualType->location, toString("Undefined type in qualified type: ", qualType) ); 415 } 416 417 // ... may want to link canonical SUE definition to each forward decl so that it becomes easier to lookup? 418 } 419 420 296 421 void HoistStruct::hoistStruct( std::list< Declaration * > &translationUnit ) { 297 422 PassVisitor<HoistStruct> hoister; … … 303 428 } 304 429 430 namespace { 431 void qualifiedName( AggregateDecl * aggr, std::ostringstream & ss ) { 432 if ( aggr->parent ) qualifiedName( aggr->parent, ss ); 433 ss << "__" << aggr->name; 434 } 435 436 // mangle nested type names using entire parent chain 437 std::string qualifiedName( AggregateDecl * aggr ) { 438 std::ostringstream ss; 439 qualifiedName( aggr, ss ); 440 return ss.str(); 441 } 442 } 443 305 444 template< typename AggDecl > 306 445 void HoistStruct::handleAggregate( AggDecl *aggregateDecl ) { 307 446 if ( parentAggr ) { 447 aggregateDecl->parent = parentAggr; 448 aggregateDecl->name = qualifiedName( aggregateDecl ); 308 449 // Add elements in stack order corresponding to nesting structure. 309 450 declsToAddBefore.push_front( aggregateDecl ); … … 316 457 } 317 458 318 void HoistStruct::previsit( EnumInstType * inst ) {319 if ( inst->baseEnum && inst->baseEnum->body ) {320 declsToAddBefore.push_front( inst->baseEnum );321 }322 }323 324 void HoistStruct::previsit( StructInstType * inst ) {325 if ( inst->baseStruct && inst->baseStruct->body ) {326 declsToAddBefore.push_front( inst->baseStruct );327 }328 }329 330 void HoistStruct::previsit( UnionInstType * inst ) {331 if ( inst->baseUnion && inst->baseUnion->body ) {332 declsToAddBefore.push_front( inst->baseUnion );333 }334 }335 336 459 void HoistStruct::previsit( StaticAssertDecl * assertDecl ) { 337 460 if ( parentAggr ) { … … 348 471 } 349 472 473 void HoistStruct::previsit( StructInstType * type ) { 474 // need to reset type name after expanding to qualified name 475 assert( type->baseStruct ); 476 type->name = type->baseStruct->name; 477 } 478 479 void HoistStruct::previsit( UnionInstType * type ) { 480 assert( type->baseUnion ); 481 type->name = type->baseUnion->name; 482 } 483 484 void HoistStruct::previsit( EnumInstType * type ) { 485 assert( type->baseEnum ); 486 type->name = type->baseEnum->name; 487 } 488 489 490 bool isTypedef( Declaration *decl ) { 491 return dynamic_cast< TypedefDecl * >( decl ); 492 } 493 494 void EliminateTypedef::eliminateTypedef( std::list< Declaration * > &translationUnit ) { 495 PassVisitor<EliminateTypedef> eliminator; 496 acceptAll( translationUnit, eliminator ); 497 filter( translationUnit, isTypedef, true ); 498 } 499 500 template< typename AggDecl > 501 void EliminateTypedef::handleAggregate( AggDecl *aggregateDecl ) { 502 filter( aggregateDecl->members, isTypedef, true ); 503 } 504 505 void EliminateTypedef::previsit( StructDecl * aggregateDecl ) { 506 handleAggregate( aggregateDecl ); 507 } 508 509 void EliminateTypedef::previsit( UnionDecl * aggregateDecl ) { 510 handleAggregate( aggregateDecl ); 511 } 512 513 void EliminateTypedef::previsit( CompoundStmt * compoundStmt ) { 514 // remove and delete decl stmts 515 filter( compoundStmt->kids, [](Statement * stmt) { 516 if ( DeclStmt *declStmt = dynamic_cast< DeclStmt * >( stmt ) ) { 517 if ( dynamic_cast< TypedefDecl * >( declStmt->decl ) ) { 518 return true; 519 } // if 520 } // if 521 return false; 522 }, true); 523 } 524 350 525 void EnumAndPointerDecay::previsit( EnumDecl *enumDecl ) { 351 526 // Set the type of each member of the enumeration to be EnumConstant 352 for ( std::list< Declaration * >::iterator i = enumDecl-> get_members().begin(); i != enumDecl->get_members().end(); ++i ) {527 for ( std::list< Declaration * >::iterator i = enumDecl->members.begin(); i != enumDecl->members.end(); ++i ) { 353 528 ObjectDecl * obj = dynamic_cast< ObjectDecl * >( *i ); 354 529 assert( obj ); 355 obj->set_type( new EnumInstType( Type::Qualifiers( Type::Const ), enumDecl-> get_name()) );530 obj->set_type( new EnumInstType( Type::Qualifiers( Type::Const ), enumDecl->name ) ); 356 531 } // for 357 532 } … … 395 570 396 571 void LinkReferenceToTypes::postvisit( EnumInstType *enumInst ) { 397 EnumDecl *st = local_indexer->lookupEnum( enumInst-> get_name());572 EnumDecl *st = local_indexer->lookupEnum( enumInst->name ); 398 573 // it's not a semantic error if the enum is not found, just an implicit forward declaration 399 574 if ( st ) { 400 //assert( ! enumInst->get_baseEnum() || enumInst->get_baseEnum()->get_members().empty() || ! st->get_members().empty() ); 401 enumInst->set_baseEnum( st ); 402 } // if 403 if ( ! st || st->get_members().empty() ) { 575 enumInst->baseEnum = st; 576 } // if 577 if ( ! st || ! st->body ) { 404 578 // use of forward declaration 405 forwardEnums[ enumInst-> get_name()].push_back( enumInst );579 forwardEnums[ enumInst->name ].push_back( enumInst ); 406 580 } // if 407 581 } … … 416 590 417 591 void LinkReferenceToTypes::postvisit( StructInstType *structInst ) { 418 StructDecl *st = local_indexer->lookupStruct( structInst-> get_name());592 StructDecl *st = local_indexer->lookupStruct( structInst->name ); 419 593 // it's not a semantic error if the struct is not found, just an implicit forward declaration 420 594 if ( st ) { 421 //assert( ! structInst->get_baseStruct() || structInst->get_baseStruct()->get_members().empty() || ! st->get_members().empty() ); 422 structInst->set_baseStruct( st ); 423 } // if 424 if ( ! st || st->get_members().empty() ) { 595 structInst->baseStruct = st; 596 } // if 597 if ( ! st || ! st->body ) { 425 598 // use of forward declaration 426 forwardStructs[ structInst-> get_name()].push_back( structInst );599 forwardStructs[ structInst->name ].push_back( structInst ); 427 600 } // if 428 601 checkGenericParameters( structInst ); … … 430 603 431 604 void LinkReferenceToTypes::postvisit( UnionInstType *unionInst ) { 432 UnionDecl *un = local_indexer->lookupUnion( unionInst-> get_name());605 UnionDecl *un = local_indexer->lookupUnion( unionInst->name ); 433 606 // it's not a semantic error if the union is not found, just an implicit forward declaration 434 607 if ( un ) { 435 unionInst-> set_baseUnion( un );436 } // if 437 if ( ! un || un->get_members().empty()) {608 unionInst->baseUnion = un; 609 } // if 610 if ( ! un || ! un->body ) { 438 611 // use of forward declaration 439 forwardUnions[ unionInst-> get_name()].push_back( unionInst );612 forwardUnions[ unionInst->name ].push_back( unionInst ); 440 613 } // if 441 614 checkGenericParameters( unionInst ); 615 } 616 617 void LinkReferenceToTypes::previsit( QualifiedType * ) { 618 visit_children = false; 619 } 620 621 void LinkReferenceToTypes::postvisit( QualifiedType * qualType ) { 622 // linking only makes sense for the 'oldest ancestor' of the qualified type 623 qualType->parent->accept( *visitor ); 442 624 } 443 625 … … 450 632 DeclarationWithType * dwt2 = dynamic_cast<DeclarationWithType *>( d2 ); 451 633 if ( dwt1 && dwt2 ) { 452 if ( dwt1-> get_name() == dwt2->get_name()&& ResolvExpr::typesCompatible( dwt1->get_type(), dwt2->get_type(), SymTab::Indexer() ) ) {634 if ( dwt1->name == dwt2->name && ResolvExpr::typesCompatible( dwt1->get_type(), dwt2->get_type(), SymTab::Indexer() ) ) { 453 635 // std::cerr << "=========== equal:" << std::endl; 454 636 // std::cerr << "d1: " << d1 << std::endl; … … 475 657 template< typename Iterator > 476 658 void expandAssertions( TraitInstType * inst, Iterator out ) { 477 assertf( inst->baseTrait, "Trait instance not linked to base trait: %s", to String( inst ).c_str() );659 assertf( inst->baseTrait, "Trait instance not linked to base trait: %s", toCString( inst ) ); 478 660 std::list< DeclarationWithType * > asserts; 479 661 for ( Declaration * decl : inst->baseTrait->members ) { … … 512 694 SemanticError( traitInst->location, "use of undeclared trait " + traitInst->name ); 513 695 } // if 514 if ( traitDecl-> get_parameters().size() != traitInst->get_parameters().size() ) {696 if ( traitDecl->parameters.size() != traitInst->parameters.size() ) { 515 697 SemanticError( traitInst, "incorrect number of trait parameters: " ); 516 698 } // if … … 518 700 519 701 // need to carry over the 'sized' status of each decl in the instance 520 for ( auto p : group_iterate( traitDecl-> get_parameters(), traitInst->get_parameters()) ) {702 for ( auto p : group_iterate( traitDecl->parameters, traitInst->parameters ) ) { 521 703 TypeExpr * expr = dynamic_cast< TypeExpr * >( std::get<1>(p) ); 522 704 if ( ! expr ) { … … 525 707 if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( expr->get_type() ) ) { 526 708 TypeDecl * formalDecl = std::get<0>(p); 527 TypeDecl * instDecl = inst-> get_baseType();709 TypeDecl * instDecl = inst->baseType; 528 710 if ( formalDecl->get_sized() ) instDecl->set_sized( true ); 529 711 } … … 534 716 void LinkReferenceToTypes::postvisit( EnumDecl *enumDecl ) { 535 717 // visit enum members first so that the types of self-referencing members are updated properly 536 if ( ! enumDecl->get_members().empty()) {537 ForwardEnumsType::iterator fwds = forwardEnums.find( enumDecl-> get_name());718 if ( enumDecl->body ) { 719 ForwardEnumsType::iterator fwds = forwardEnums.find( enumDecl->name ); 538 720 if ( fwds != forwardEnums.end() ) { 539 721 for ( std::list< EnumInstType * >::iterator inst = fwds->second.begin(); inst != fwds->second.end(); ++inst ) { 540 (*inst )->set_baseEnum( enumDecl );722 (*inst)->baseEnum = enumDecl; 541 723 } // for 542 724 forwardEnums.erase( fwds ); … … 574 756 // visit struct members first so that the types of self-referencing members are updated properly 575 757 // xxx - need to ensure that type parameters match up between forward declarations and definition (most importantly, number of type parameters and their defaults) 576 if ( ! structDecl->get_members().empty()) {577 ForwardStructsType::iterator fwds = forwardStructs.find( structDecl-> get_name());758 if ( structDecl->body ) { 759 ForwardStructsType::iterator fwds = forwardStructs.find( structDecl->name ); 578 760 if ( fwds != forwardStructs.end() ) { 579 761 for ( std::list< StructInstType * >::iterator inst = fwds->second.begin(); inst != fwds->second.end(); ++inst ) { 580 (*inst )->set_baseStruct( structDecl );762 (*inst)->baseStruct = structDecl; 581 763 } // for 582 764 forwardStructs.erase( fwds ); … … 586 768 587 769 void LinkReferenceToTypes::postvisit( UnionDecl *unionDecl ) { 588 if ( ! unionDecl->get_members().empty()) {589 ForwardUnionsType::iterator fwds = forwardUnions.find( unionDecl-> get_name());770 if ( unionDecl->body ) { 771 ForwardUnionsType::iterator fwds = forwardUnions.find( unionDecl->name ); 590 772 if ( fwds != forwardUnions.end() ) { 591 773 for ( std::list< UnionInstType * >::iterator inst = fwds->second.begin(); inst != fwds->second.end(); ++inst ) { 592 (*inst )->set_baseUnion( unionDecl );774 (*inst)->baseUnion = unionDecl; 593 775 } // for 594 776 forwardUnions.erase( fwds ); … … 600 782 // ensure generic parameter instances are renamed like the base type 601 783 if ( inGeneric && typeInst->baseType ) typeInst->name = typeInst->baseType->name; 602 if ( NamedTypeDecl *namedTypeDecl = local_indexer->lookupType( typeInst-> get_name()) ) {784 if ( NamedTypeDecl *namedTypeDecl = local_indexer->lookupType( typeInst->name ) ) { 603 785 if ( TypeDecl *typeDecl = dynamic_cast< TypeDecl * >( namedTypeDecl ) ) { 604 786 typeInst->set_isFtype( typeDecl->get_kind() == TypeDecl::Ftype ); … … 679 861 680 862 681 bool isTypedef( Declaration *decl ) { 682 return dynamic_cast< TypedefDecl * >( decl ); 683 } 684 685 void EliminateTypedef::eliminateTypedef( std::list< Declaration * > &translationUnit ) { 686 PassVisitor<EliminateTypedef> eliminator; 863 void ReplaceTypedef::replaceTypedef( std::list< Declaration * > &translationUnit ) { 864 PassVisitor<ReplaceTypedef> eliminator; 687 865 mutateAll( translationUnit, eliminator ); 688 866 if ( eliminator.pass.typedefNames.count( "size_t" ) ) { 689 867 // grab and remember declaration of size_t 690 SizeType = eliminator.pass.typedefNames["size_t"].first-> get_base()->clone();868 SizeType = eliminator.pass.typedefNames["size_t"].first->base->clone(); 691 869 } else { 692 870 // xxx - missing global typedef for size_t - default to long unsigned int, even though that may be wrong … … 694 872 SizeType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ); 695 873 } 696 filter( translationUnit, isTypedef, true ); 697 } 698 699 Type * EliminateTypedef::postmutate( TypeInstType * typeInst ) { 874 } 875 876 void ReplaceTypedef::premutate( QualifiedType * ) { 877 visit_children = false; 878 } 879 880 Type * ReplaceTypedef::postmutate( QualifiedType * qualType ) { 881 // replacing typedefs only makes sense for the 'oldest ancestor' of the qualified type 882 qualType->parent = qualType->parent->acceptMutator( *visitor ); 883 return qualType; 884 } 885 886 Type * ReplaceTypedef::postmutate( TypeInstType * typeInst ) { 700 887 // instances of typedef types will come here. If it is an instance 701 888 // of a typdef type, link the instance to its actual type. 702 TypedefMap::const_iterator def = typedefNames.find( typeInst-> get_name());889 TypedefMap::const_iterator def = typedefNames.find( typeInst->name ); 703 890 if ( def != typedefNames.end() ) { 704 891 Type *ret = def->second.first->base->clone(); 892 ret->location = typeInst->location; 705 893 ret->get_qualifiers() |= typeInst->get_qualifiers(); 706 894 // attributes are not carried over from typedef to function parameters/return values … … 717 905 SemanticError( typeInst->location, "Cannot apply type parameters to base type of " + typeInst->name ); 718 906 } 719 rtt-> get_parameters().clear();907 rtt->parameters.clear(); 720 908 cloneAll( typeInst->parameters, rtt->parameters ); 721 909 mutateAll( rtt->parameters, *visitor ); // recursively fix typedefs on parameters … … 724 912 return ret; 725 913 } else { 726 TypeDeclMap::const_iterator base = typedeclNames.find( typeInst->get_name() ); 727 assertf( base != typedeclNames.end(), "Cannot find typedecl name %s", typeInst->name.c_str() ); 914 TypeDeclMap::const_iterator base = typedeclNames.find( typeInst->name ); 915 if ( base == typedeclNames.end() ) { 916 SemanticError( typeInst->location, toString("Use of undefined type ", typeInst->name) ); 917 } 728 918 typeInst->set_baseType( base->second ); 729 } // if 730 return typeInst; 919 return typeInst; 920 } // if 921 assert( false ); 731 922 } 732 923 … … 745 936 } 746 937 747 Declaration * EliminateTypedef::postmutate( TypedefDecl * tyDecl ) {748 if ( typedefNames.count( tyDecl-> get_name() ) == 1 && typedefNames[ tyDecl->get_name()].second == scopeLevel ) {938 Declaration * ReplaceTypedef::postmutate( TypedefDecl * tyDecl ) { 939 if ( typedefNames.count( tyDecl->name ) == 1 && typedefNames[ tyDecl->name ].second == scopeLevel ) { 749 940 // typedef to the same name from the same scope 750 941 // must be from the same type 751 942 752 Type * t1 = tyDecl-> get_base();753 Type * t2 = typedefNames[ tyDecl-> get_name() ].first->get_base();943 Type * t1 = tyDecl->base; 944 Type * t2 = typedefNames[ tyDecl->name ].first->base; 754 945 if ( ! ResolvExpr::typesCompatible( t1, t2, Indexer() ) ) { 755 946 SemanticError( tyDecl->location, "Cannot redefine typedef: " + tyDecl->name ); … … 763 954 } 764 955 } else { 765 typedefNames[ tyDecl-> get_name()] = std::make_pair( TypedefDeclPtr( tyDecl ), scopeLevel );956 typedefNames[ tyDecl->name ] = std::make_pair( TypedefDeclPtr( tyDecl ), scopeLevel ); 766 957 } // if 767 958 … … 775 966 // Note, qualifiers on the typedef are superfluous for the forward declaration. 776 967 777 Type *designatorType = tyDecl-> get_base()->stripDeclarator();968 Type *designatorType = tyDecl->base->stripDeclarator(); 778 969 if ( StructInstType *aggDecl = dynamic_cast< StructInstType * >( designatorType ) ) { 779 return new StructDecl( aggDecl->get_name(), DeclarationNode::Struct, noAttributes, tyDecl->get_linkage() );970 declsToAddBefore.push_back( new StructDecl( aggDecl->name, DeclarationNode::Struct, noAttributes, tyDecl->linkage ) ); 780 971 } else if ( UnionInstType *aggDecl = dynamic_cast< UnionInstType * >( designatorType ) ) { 781 return new UnionDecl( aggDecl->get_name(), noAttributes, tyDecl->get_linkage() );972 declsToAddBefore.push_back( new UnionDecl( aggDecl->name, noAttributes, tyDecl->linkage ) ); 782 973 } else if ( EnumInstType *enumDecl = dynamic_cast< EnumInstType * >( designatorType ) ) { 783 return new EnumDecl( enumDecl->get_name(), noAttributes, tyDecl->get_linkage() ); 784 } else { 785 return tyDecl->clone(); 786 } // if 787 } 788 789 void EliminateTypedef::premutate( TypeDecl * typeDecl ) { 790 TypedefMap::iterator i = typedefNames.find( typeDecl->get_name() ); 974 declsToAddBefore.push_back( new EnumDecl( enumDecl->name, noAttributes, tyDecl->linkage ) ); 975 } // if 976 return tyDecl->clone(); 977 } 978 979 void ReplaceTypedef::premutate( TypeDecl * typeDecl ) { 980 TypedefMap::iterator i = typedefNames.find( typeDecl->name ); 791 981 if ( i != typedefNames.end() ) { 792 982 typedefNames.erase( i ) ; 793 983 } // if 794 984 795 typedeclNames [ typeDecl->get_name() ] = typeDecl;796 } 797 798 void EliminateTypedef::premutate( FunctionDecl * ) {985 typedeclNames.insert( typeDecl->name, typeDecl ); 986 } 987 988 void ReplaceTypedef::premutate( FunctionDecl * ) { 799 989 GuardScope( typedefNames ); 800 } 801 802 void EliminateTypedef::premutate( ObjectDecl * ) { 990 GuardScope( typedeclNames ); 991 } 992 993 void ReplaceTypedef::premutate( ObjectDecl * ) { 803 994 GuardScope( typedefNames ); 804 } 805 806 DeclarationWithType *EliminateTypedef::postmutate( ObjectDecl * objDecl ) { 807 if ( FunctionType *funtype = dynamic_cast<FunctionType *>( objDecl->get_type() ) ) { // function type? 995 GuardScope( typedeclNames ); 996 } 997 998 DeclarationWithType * ReplaceTypedef::postmutate( ObjectDecl * objDecl ) { 999 if ( FunctionType *funtype = dynamic_cast<FunctionType *>( objDecl->type ) ) { // function type? 808 1000 // replace the current object declaration with a function declaration 809 FunctionDecl * newDecl = new FunctionDecl( objDecl-> get_name(), objDecl->get_storageClasses(), objDecl->get_linkage(), funtype, 0, objDecl->get_attributes(), objDecl->get_funcSpec() );810 objDecl-> get_attributes().clear();1001 FunctionDecl * newDecl = new FunctionDecl( objDecl->name, objDecl->get_storageClasses(), objDecl->linkage, funtype, 0, objDecl->attributes, objDecl->get_funcSpec() ); 1002 objDecl->attributes.clear(); 811 1003 objDecl->set_type( nullptr ); 812 1004 delete objDecl; … … 816 1008 } 817 1009 818 void EliminateTypedef::premutate( CastExpr * ) {1010 void ReplaceTypedef::premutate( CastExpr * ) { 819 1011 GuardScope( typedefNames ); 820 } 821 822 void EliminateTypedef::premutate( CompoundStmt * ) { 1012 GuardScope( typedeclNames ); 1013 } 1014 1015 void ReplaceTypedef::premutate( CompoundStmt * ) { 823 1016 GuardScope( typedefNames ); 1017 GuardScope( typedeclNames ); 824 1018 scopeLevel += 1; 825 1019 GuardAction( [this](){ scopeLevel -= 1; } ); 826 1020 } 827 1021 828 CompoundStmt *EliminateTypedef::postmutate( CompoundStmt * compoundStmt ) {829 // remove and delete decl stmts830 filter( compoundStmt->kids, [](Statement * stmt) {831 if ( DeclStmt *declStmt = dynamic_cast< DeclStmt * >( stmt ) ) {832 if ( dynamic_cast< TypedefDecl * >( declStmt->get_decl() ) ) {833 return true;834 } // if835 } // if836 return false;837 }, true);838 return compoundStmt;839 }840 841 // there may be typedefs nested within aggregates. in order for everything to work properly, these should be removed842 // as well843 1022 template<typename AggDecl> 844 AggDecl *EliminateTypedef::handleAggregate( AggDecl * aggDecl ) { 845 filter( aggDecl->members, isTypedef, true ); 846 return aggDecl; 847 } 848 849 template<typename AggDecl> 850 void EliminateTypedef::addImplicitTypedef( AggDecl * aggDecl ) { 1023 void ReplaceTypedef::addImplicitTypedef( AggDecl * aggDecl ) { 851 1024 if ( typedefNames.count( aggDecl->get_name() ) == 0 ) { 852 1025 Type *type = nullptr; … … 860 1033 TypedefDeclPtr tyDecl( new TypedefDecl( aggDecl->get_name(), aggDecl->location, Type::StorageClasses(), type, aggDecl->get_linkage() ) ); 861 1034 typedefNames[ aggDecl->get_name() ] = std::make_pair( std::move( tyDecl ), scopeLevel ); 862 } // if 863 } 864 865 void EliminateTypedef::premutate( StructDecl * structDecl ) { 1035 // add the implicit typedef to the AST 1036 declsToAddBefore.push_back( new TypedefDecl( aggDecl->get_name(), aggDecl->location, Type::StorageClasses(), type->clone(), aggDecl->get_linkage() ) ); 1037 } // if 1038 } 1039 1040 template< typename AggDecl > 1041 void ReplaceTypedef::handleAggregate( AggDecl * aggr ) { 1042 SemanticErrorException errors; 1043 1044 ValueGuard< std::list<Declaration * > > oldBeforeDecls( declsToAddBefore ); 1045 ValueGuard< std::list<Declaration * > > oldAfterDecls ( declsToAddAfter ); 1046 declsToAddBefore.clear(); 1047 declsToAddAfter.clear(); 1048 1049 GuardScope( typedefNames ); 1050 GuardScope( typedeclNames ); 1051 mutateAll( aggr->parameters, *visitor ); 1052 1053 // unroll mutateAll for aggr->members so that implicit typedefs for nested types are added to the aggregate body. 1054 for ( std::list< Declaration * >::iterator i = aggr->members.begin(); i != aggr->members.end(); ++i ) { 1055 if ( !declsToAddAfter.empty() ) { aggr->members.splice( i, declsToAddAfter ); } 1056 1057 try { 1058 *i = maybeMutate( *i, *visitor ); 1059 } catch ( SemanticErrorException &e ) { 1060 errors.append( e ); 1061 } 1062 1063 if ( !declsToAddBefore.empty() ) { aggr->members.splice( i, declsToAddBefore ); } 1064 } 1065 1066 if ( !declsToAddAfter.empty() ) { aggr->members.splice( aggr->members.end(), declsToAddAfter ); } 1067 if ( !errors.isEmpty() ) { throw errors; } 1068 } 1069 1070 void ReplaceTypedef::premutate( StructDecl * structDecl ) { 1071 visit_children = false; 866 1072 addImplicitTypedef( structDecl ); 867 } 868 869 870 Declaration *EliminateTypedef::postmutate( StructDecl * structDecl ) { 871 return handleAggregate( structDecl ); 872 } 873 874 void EliminateTypedef::premutate( UnionDecl * unionDecl ) { 1073 handleAggregate( structDecl ); 1074 } 1075 1076 void ReplaceTypedef::premutate( UnionDecl * unionDecl ) { 1077 visit_children = false; 875 1078 addImplicitTypedef( unionDecl ); 876 } 877 878 Declaration *EliminateTypedef::postmutate( UnionDecl * unionDecl ) { 879 return handleAggregate( unionDecl ); 880 } 881 882 void EliminateTypedef::premutate( EnumDecl * enumDecl ) { 1079 handleAggregate( unionDecl ); 1080 } 1081 1082 void ReplaceTypedef::premutate( EnumDecl * enumDecl ) { 883 1083 addImplicitTypedef( enumDecl ); 884 1084 } 885 1085 886 Declaration *EliminateTypedef::postmutate( EnumDecl * enumDecl ) { 887 return handleAggregate( enumDecl ); 888 } 889 890 Declaration *EliminateTypedef::postmutate( TraitDecl * traitDecl ) { 891 return handleAggregate( traitDecl ); 892 } 893 894 void EliminateTypedef::premutate( FunctionType * ) { 1086 void ReplaceTypedef::premutate( FunctionType * ) { 895 1087 GuardValue( inFunctionType ); 896 1088 inFunctionType = true; 1089 } 1090 1091 void ReplaceTypedef::premutate( TraitDecl * ) { 1092 GuardScope( typedefNames ); 1093 GuardScope( typedeclNames); 897 1094 } 898 1095 … … 1024 1221 1025 1222 void ArrayLength::previsit( ObjectDecl * objDecl ) { 1026 if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl-> get_type()) ) {1223 if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->type ) ) { 1027 1224 if ( at->get_dimension() ) return; 1028 if ( ListInit * init = dynamic_cast< ListInit * >( objDecl-> get_init()) ) {1029 at->set_dimension( new ConstantExpr( Constant::from_ulong( init-> get_initializers().size() ) ) );1225 if ( ListInit * init = dynamic_cast< ListInit * >( objDecl->init ) ) { 1226 at->set_dimension( new ConstantExpr( Constant::from_ulong( init->initializers.size() ) ) ); 1030 1227 } 1031 1228 } -
src/SynTree/Declaration.h
rfc20514 r777ed2b 266 266 bool body; 267 267 std::list< Attribute * > attributes; 268 AggregateDecl * parent = nullptr; 268 269 269 270 AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ); -
src/SynTree/Mutator.h
rfc20514 r777ed2b 101 101 virtual Type * mutate( ArrayType * arrayType ) = 0; 102 102 virtual Type * mutate( ReferenceType * refType ) = 0; 103 virtual Type * mutate( QualifiedType * qualType ) = 0; 103 104 virtual Type * mutate( FunctionType * functionType ) = 0; 104 105 virtual Type * mutate( StructInstType * aggregateUseType ) = 0; … … 113 114 virtual Type * mutate( ZeroType * zeroType ) = 0; 114 115 virtual Type * mutate( OneType * oneType ) = 0; 116 virtual Type * mutate( GlobalScopeType * globalType ) = 0; 115 117 116 118 virtual Designation * mutate( Designation * designation ) = 0 ; -
src/SynTree/ReferenceToType.cc
rfc20514 r777ed2b 76 76 bool StructInstType::isComplete() const { return baseStruct ? baseStruct->has_body() : false; } 77 77 78 AggregateDecl * StructInstType::getAggr() { return baseStruct; }78 AggregateDecl * StructInstType::getAggr() const { return baseStruct; } 79 79 80 80 TypeSubstitution StructInstType::genericSubstitution() const { … … 119 119 bool UnionInstType::isComplete() const { return baseUnion ? baseUnion->has_body() : false; } 120 120 121 AggregateDecl * UnionInstType::getAggr() { return baseUnion; }121 AggregateDecl * UnionInstType::getAggr() const { return baseUnion; } 122 122 123 123 TypeSubstitution UnionInstType::genericSubstitution() const { … … 152 152 bool EnumInstType::isComplete() const { return baseEnum ? baseEnum->has_body() : false; } 153 153 154 AggregateDecl * EnumInstType::getAggr() const { return baseEnum; } 155 154 156 void EnumInstType::print( std::ostream &os, Indenter indent ) const { 155 157 using std::endl; -
src/SynTree/SynTree.h
rfc20514 r777ed2b 110 110 class ArrayType; 111 111 class ReferenceType; 112 class QualifiedType; 112 113 class FunctionType; 113 114 class ReferenceToType; … … 123 124 class ZeroType; 124 125 class OneType; 126 class GlobalScopeType; 125 127 126 128 class Designation; -
src/SynTree/Type.cc
rfc20514 r777ed2b 105 105 } 106 106 107 108 QualifiedType::QualifiedType( const Type::Qualifiers & tq, Type * parent, Type * child ) : Type( tq, {} ), parent( parent ), child( child ) { 109 } 110 111 QualifiedType::QualifiedType( const QualifiedType & other ) : Type( other ), parent( maybeClone( other.parent ) ), child( maybeClone( other.child ) ) { 112 } 113 114 QualifiedType::~QualifiedType() { 115 delete parent; 116 delete child; 117 } 118 119 void QualifiedType::print( std::ostream & os, Indenter indent ) const { 120 os << "Qualified Type: " << endl; 121 os << indent+1; 122 parent->print( os, indent+1 ); 123 os << endl << indent+1; 124 child->print( os, indent+1 ); 125 os << endl; 126 Type::print( os, indent+1 ); 127 } 128 129 GlobalScopeType::GlobalScopeType() : Type( Type::Qualifiers(), {} ) {} 130 131 void GlobalScopeType::print( std::ostream & os, Indenter ) const { 132 os << "Global Scope Type" << endl; 133 } 134 135 107 136 // Empty Variable declarations: 108 137 const Type::FuncSpecifiers noFuncSpecifiers; -
src/SynTree/Type.h
rfc20514 r777ed2b 178 178 virtual bool isComplete() const { return true; } 179 179 180 virtual AggregateDecl * getAggr() { assertf( false, "Non-aggregate type: %s", toCString( this ) ); }180 virtual AggregateDecl * getAggr() const { assertf( false, "Non-aggregate type: %s", toCString( this ) ); } 181 181 182 182 virtual TypeSubstitution genericSubstitution() const; … … 315 315 }; 316 316 317 class QualifiedType : public Type { 318 public: 319 Type * parent; 320 Type * child; 321 322 QualifiedType( const Type::Qualifiers & tq, Type * parent, Type * child ); 323 QualifiedType( const QualifiedType & tq ); 324 virtual ~QualifiedType(); 325 326 virtual QualifiedType *clone() const override { return new QualifiedType( *this ); } 327 virtual void accept( Visitor & v ) override { v.visit( this ); } 328 virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); } 329 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 330 }; 331 317 332 class ReferenceType : public Type { 318 333 public: … … 416 431 virtual bool isComplete() const override; 417 432 418 virtual AggregateDecl * getAggr() override;433 virtual AggregateDecl * getAggr() const override; 419 434 420 435 virtual TypeSubstitution genericSubstitution() const override; … … 453 468 virtual bool isComplete() const override; 454 469 455 virtual AggregateDecl * getAggr() override;470 virtual AggregateDecl * getAggr() const override; 456 471 457 472 virtual TypeSubstitution genericSubstitution() const override; … … 485 500 486 501 virtual bool isComplete() const override; 502 503 virtual AggregateDecl * getAggr() const override; 487 504 488 505 virtual EnumInstType *clone() const override { return new EnumInstType( *this ); } … … 665 682 }; 666 683 684 class GlobalScopeType : public Type { 685 public: 686 GlobalScopeType(); 687 688 virtual GlobalScopeType *clone() const override { return new GlobalScopeType( *this ); } 689 virtual void accept( Visitor & v ) override { v.visit( this ); } 690 virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); } 691 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 692 }; 693 667 694 // Local Variables: // 668 695 // tab-width: 4 // -
src/SynTree/Visitor.h
rfc20514 r777ed2b 103 103 virtual void visit( ArrayType * arrayType ) = 0; 104 104 virtual void visit( ReferenceType * refType ) = 0; 105 virtual void visit( QualifiedType * qualType ) = 0; 105 106 virtual void visit( FunctionType * functionType ) = 0; 106 107 virtual void visit( StructInstType * aggregateUseType ) = 0; … … 115 116 virtual void visit( ZeroType * zeroType ) = 0; 116 117 virtual void visit( OneType * oneType ) = 0; 118 virtual void visit( GlobalScopeType * globalType ) = 0; 117 119 118 120 virtual void visit( Designation * designation ) = 0; -
src/main.cc
rfc20514 r777ed2b 247 247 } // if 248 248 249 // Temporary: fill locations after parsing so that every node has a location, for early error messages. 250 // Eventually we should pass the locations from the parser to every node, but this quick and dirty solution 251 // works okay for now. 252 CodeTools::fillLocations( translationUnit ); 253 249 254 // add the assignment statement after the initialization of a type parameter 250 255 PASS( "validate", SymTab::validate( translationUnit, symtabp ) ); -
src/prelude/prelude.old.cf
rfc20514 r777ed2b 728 728 forall( dtype DT ) void ?{}( volatile DT * &, DT * ); 729 729 forall( dtype DT ) void ?{}( volatile DT * &, volatile DT * ); 730 731 730 forall( dtype DT ) void ?{}( const volatile DT * &, DT * ); 732 731 forall( dtype DT ) void ?{}( const volatile DT * &, const DT * ); -
src/tests/.expect/attributes.x86.txt
rfc20514 r777ed2b 1 signed int __la__Fi___1(){ 2 __attribute__ ((unused)) signed int ___retval_la__i_1; 3 L: __attribute__ ((unused)) ((void)1); 4 } 5 struct __attribute__ ((unused)) __anonymous0 { 6 }; 7 static inline void ___constructor__F_13s__anonymous0_autogen___1(struct __anonymous0 *___dst__13s__anonymous0_1); 8 static inline void ___constructor__F_13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1); 9 static inline void ___destructor__F_13s__anonymous0_autogen___1(struct __anonymous0 *___dst__13s__anonymous0_1); 10 static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1); 11 static inline void ___constructor__F_13s__anonymous0_autogen___1(struct __anonymous0 *___dst__13s__anonymous0_1){ 12 } 13 static inline void ___constructor__F_13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){ 14 } 15 static inline void ___destructor__F_13s__anonymous0_autogen___1(struct __anonymous0 *___dst__13s__anonymous0_1){ 16 } 17 static inline struct __anonymous0 ___operator_assign__F13s__anonymous0_13s__anonymous013s__anonymous0_autogen___1(struct __anonymous0 *___dst__13s__anonymous0_1, struct __anonymous0 ___src__13s__anonymous0_1){ 18 struct __anonymous0 ___ret__13s__anonymous0_1; 19 ((void)___constructor__F_13s__anonymous013s__anonymous0_autogen___1((&___ret__13s__anonymous0_1), (*___dst__13s__anonymous0_1))); 20 return ___ret__13s__anonymous0_1; 21 } 22 struct __attribute__ ((unused)) Agn1; 23 struct __attribute__ ((unused)) Agn2 { 24 }; 25 static inline void ___constructor__F_5sAgn2_autogen___1(struct Agn2 *___dst__5sAgn2_1); 26 static inline void ___constructor__F_5sAgn25sAgn2_autogen___1(struct Agn2 *___dst__5sAgn2_1, struct Agn2 ___src__5sAgn2_1); 27 static inline void ___destructor__F_5sAgn2_autogen___1(struct Agn2 *___dst__5sAgn2_1); 28 static inline struct Agn2 ___operator_assign__F5sAgn2_5sAgn25sAgn2_autogen___1(struct Agn2 *___dst__5sAgn2_1, struct Agn2 ___src__5sAgn2_1); 29 static inline void ___constructor__F_5sAgn2_autogen___1(struct Agn2 *___dst__5sAgn2_1){ 30 } 31 static inline void ___constructor__F_5sAgn25sAgn2_autogen___1(struct Agn2 *___dst__5sAgn2_1, struct Agn2 ___src__5sAgn2_1){ 32 } 33 static inline void ___destructor__F_5sAgn2_autogen___1(struct Agn2 *___dst__5sAgn2_1){ 34 } 35 static inline struct Agn2 ___operator_assign__F5sAgn2_5sAgn25sAgn2_autogen___1(struct Agn2 *___dst__5sAgn2_1, struct Agn2 ___src__5sAgn2_1){ 36 struct Agn2 ___ret__5sAgn2_1; 37 ((void)___constructor__F_5sAgn25sAgn2_autogen___1((&___ret__5sAgn2_1), (*___dst__5sAgn2_1))); 38 return ___ret__5sAgn2_1; 39 } 40 enum __attribute__ ((unused)) __anonymous1 { 41 __E1__C13e__anonymous1_1, 42 }; 43 enum __attribute__ ((unused)) Agn3; 44 enum __attribute__ ((packed)) Agn3 { 45 __E2__C5eAgn3_1, 46 }; 47 struct __attribute__ ((unused)) __anonymous2 { 48 }; 49 static inline void ___constructor__F_13s__anonymous2_autogen___1(struct __anonymous2 *___dst__13s__anonymous2_1); 50 static inline void ___constructor__F_13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1); 51 static inline void ___destructor__F_13s__anonymous2_autogen___1(struct __anonymous2 *___dst__13s__anonymous2_1); 52 static inline struct __anonymous2 ___operator_assign__F13s__anonymous2_13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1); 53 static inline void ___constructor__F_13s__anonymous2_autogen___1(struct __anonymous2 *___dst__13s__anonymous2_1){ 54 } 55 static inline void ___constructor__F_13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1){ 56 } 57 static inline void ___destructor__F_13s__anonymous2_autogen___1(struct __anonymous2 *___dst__13s__anonymous2_1){ 58 } 59 static inline struct __anonymous2 ___operator_assign__F13s__anonymous2_13s__anonymous213s__anonymous2_autogen___1(struct __anonymous2 *___dst__13s__anonymous2_1, struct __anonymous2 ___src__13s__anonymous2_1){ 60 struct __anonymous2 ___ret__13s__anonymous2_1; 61 ((void)___constructor__F_13s__anonymous213s__anonymous2_autogen___1((&___ret__13s__anonymous2_1), (*___dst__13s__anonymous2_1))); 62 return ___ret__13s__anonymous2_1; 63 } 64 struct __attribute__ ((unused)) Agn4 { 65 }; 66 static inline void ___constructor__F_5sAgn4_autogen___1(struct Agn4 *___dst__5sAgn4_1); 67 static inline void ___constructor__F_5sAgn45sAgn4_autogen___1(struct Agn4 *___dst__5sAgn4_1, struct Agn4 ___src__5sAgn4_1); 68 static inline void ___destructor__F_5sAgn4_autogen___1(struct Agn4 *___dst__5sAgn4_1); 69 static inline struct Agn4 ___operator_assign__F5sAgn4_5sAgn45sAgn4_autogen___1(struct Agn4 *___dst__5sAgn4_1, struct Agn4 ___src__5sAgn4_1); 70 static inline void ___constructor__F_5sAgn4_autogen___1(struct Agn4 *___dst__5sAgn4_1){ 71 } 72 static inline void ___constructor__F_5sAgn45sAgn4_autogen___1(struct Agn4 *___dst__5sAgn4_1, struct Agn4 ___src__5sAgn4_1){ 73 } 74 static inline void ___destructor__F_5sAgn4_autogen___1(struct Agn4 *___dst__5sAgn4_1){ 75 } 76 static inline struct Agn4 ___operator_assign__F5sAgn4_5sAgn45sAgn4_autogen___1(struct Agn4 *___dst__5sAgn4_1, struct Agn4 ___src__5sAgn4_1){ 77 struct Agn4 ___ret__5sAgn4_1; 78 ((void)___constructor__F_5sAgn45sAgn4_autogen___1((&___ret__5sAgn4_1), (*___dst__5sAgn4_1))); 79 return ___ret__5sAgn4_1; 80 } 81 struct Fdl { 82 __attribute__ ((unused)) signed int __f1__i_1; 83 __attribute__ ((unused)) signed int __f2__i_1; 84 __attribute__ ((unused,unused)) signed int __f3__i_1; 85 __attribute__ ((unused)) signed int __f4__i_1; 86 __attribute__ ((unused,unused)) signed int __f5__i_1; 87 __attribute__ ((used,packed)) signed int __f6__i_1; 88 __attribute__ ((used,unused,unused)) signed int __f7__i_1; 89 __attribute__ ((used,used,unused)) signed int __f8__i_1; 90 __attribute__ ((unused)) signed int __anonymous_object0; 91 __attribute__ ((unused,unused)) signed int *__f9__Pi_1; 92 }; 93 static inline void ___constructor__F_4sFdl_autogen___1(struct Fdl *___dst__4sFdl_1); 94 static inline void ___constructor__F_4sFdl4sFdl_autogen___1(struct Fdl *___dst__4sFdl_1, struct Fdl ___src__4sFdl_1); 95 static inline void ___destructor__F_4sFdl_autogen___1(struct Fdl *___dst__4sFdl_1); 96 static inline struct Fdl ___operator_assign__F4sFdl_4sFdl4sFdl_autogen___1(struct Fdl *___dst__4sFdl_1, struct Fdl ___src__4sFdl_1); 97 static inline void ___constructor__F_4sFdli_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1); 98 static inline void ___constructor__F_4sFdlii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1); 99 static inline void ___constructor__F_4sFdliii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1); 100 static inline void ___constructor__F_4sFdliiii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1); 101 static inline void ___constructor__F_4sFdliiiii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1); 102 static inline void ___constructor__F_4sFdliiiiii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1); 103 static inline void ___constructor__F_4sFdliiiiiii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused)) signed int __f7__i_1); 104 static inline void ___constructor__F_4sFdliiiiiiii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused)) signed int __f7__i_1, __attribute__ ((unused)) signed int __f8__i_1); 105 static inline void ___constructor__F_4sFdliiiiiiiii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused)) signed int __f7__i_1, __attribute__ ((unused)) signed int __f8__i_1, __attribute__ ((unused)) signed int __anonymous_object1); 106 static inline void ___constructor__F_4sFdliiiiiiiiiPi_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused)) signed int __f7__i_1, __attribute__ ((unused)) signed int __f8__i_1, __attribute__ ((unused)) signed int __anonymous_object2, __attribute__ ((unused,unused)) signed int *__f9__Pi_1); 107 static inline void ___constructor__F_4sFdl_autogen___1(struct Fdl *___dst__4sFdl_1){ 108 ((void)((*___dst__4sFdl_1).__f1__i_1) /* ?{} */); 109 ((void)((*___dst__4sFdl_1).__f2__i_1) /* ?{} */); 110 ((void)((*___dst__4sFdl_1).__f3__i_1) /* ?{} */); 111 ((void)((*___dst__4sFdl_1).__f4__i_1) /* ?{} */); 112 ((void)((*___dst__4sFdl_1).__f5__i_1) /* ?{} */); 113 ((void)((*___dst__4sFdl_1).__f6__i_1) /* ?{} */); 114 ((void)((*___dst__4sFdl_1).__f7__i_1) /* ?{} */); 115 ((void)((*___dst__4sFdl_1).__f8__i_1) /* ?{} */); 116 ((void)((*___dst__4sFdl_1).__anonymous_object0) /* ?{} */); 117 ((void)((*___dst__4sFdl_1).__f9__Pi_1) /* ?{} */); 118 } 119 static inline void ___constructor__F_4sFdl4sFdl_autogen___1(struct Fdl *___dst__4sFdl_1, struct Fdl ___src__4sFdl_1){ 120 ((void)((*___dst__4sFdl_1).__f1__i_1=___src__4sFdl_1.__f1__i_1) /* ?{} */); 121 ((void)((*___dst__4sFdl_1).__f2__i_1=___src__4sFdl_1.__f2__i_1) /* ?{} */); 122 ((void)((*___dst__4sFdl_1).__f3__i_1=___src__4sFdl_1.__f3__i_1) /* ?{} */); 123 ((void)((*___dst__4sFdl_1).__f4__i_1=___src__4sFdl_1.__f4__i_1) /* ?{} */); 124 ((void)((*___dst__4sFdl_1).__f5__i_1=___src__4sFdl_1.__f5__i_1) /* ?{} */); 125 ((void)((*___dst__4sFdl_1).__f6__i_1=___src__4sFdl_1.__f6__i_1) /* ?{} */); 126 ((void)((*___dst__4sFdl_1).__f7__i_1=___src__4sFdl_1.__f7__i_1) /* ?{} */); 127 ((void)((*___dst__4sFdl_1).__f8__i_1=___src__4sFdl_1.__f8__i_1) /* ?{} */); 128 ((void)((*___dst__4sFdl_1).__anonymous_object0=___src__4sFdl_1.__anonymous_object0) /* ?{} */); 129 ((void)((*___dst__4sFdl_1).__f9__Pi_1=___src__4sFdl_1.__f9__Pi_1) /* ?{} */); 130 } 131 static inline void ___destructor__F_4sFdl_autogen___1(struct Fdl *___dst__4sFdl_1){ 132 ((void)((*___dst__4sFdl_1).__f9__Pi_1) /* ^?{} */); 133 ((void)((*___dst__4sFdl_1).__anonymous_object0) /* ^?{} */); 134 ((void)((*___dst__4sFdl_1).__f8__i_1) /* ^?{} */); 135 ((void)((*___dst__4sFdl_1).__f7__i_1) /* ^?{} */); 136 ((void)((*___dst__4sFdl_1).__f6__i_1) /* ^?{} */); 137 ((void)((*___dst__4sFdl_1).__f5__i_1) /* ^?{} */); 138 ((void)((*___dst__4sFdl_1).__f4__i_1) /* ^?{} */); 139 ((void)((*___dst__4sFdl_1).__f3__i_1) /* ^?{} */); 140 ((void)((*___dst__4sFdl_1).__f2__i_1) /* ^?{} */); 141 ((void)((*___dst__4sFdl_1).__f1__i_1) /* ^?{} */); 142 } 143 static inline struct Fdl ___operator_assign__F4sFdl_4sFdl4sFdl_autogen___1(struct Fdl *___dst__4sFdl_1, struct Fdl ___src__4sFdl_1){ 144 struct Fdl ___ret__4sFdl_1; 145 ((void)((*___dst__4sFdl_1).__f1__i_1=___src__4sFdl_1.__f1__i_1)); 146 ((void)((*___dst__4sFdl_1).__f2__i_1=___src__4sFdl_1.__f2__i_1)); 147 ((void)((*___dst__4sFdl_1).__f3__i_1=___src__4sFdl_1.__f3__i_1)); 148 ((void)((*___dst__4sFdl_1).__f4__i_1=___src__4sFdl_1.__f4__i_1)); 149 ((void)((*___dst__4sFdl_1).__f5__i_1=___src__4sFdl_1.__f5__i_1)); 150 ((void)((*___dst__4sFdl_1).__f6__i_1=___src__4sFdl_1.__f6__i_1)); 151 ((void)((*___dst__4sFdl_1).__f7__i_1=___src__4sFdl_1.__f7__i_1)); 152 ((void)((*___dst__4sFdl_1).__f8__i_1=___src__4sFdl_1.__f8__i_1)); 153 ((void)((*___dst__4sFdl_1).__anonymous_object0=___src__4sFdl_1.__anonymous_object0)); 154 ((void)((*___dst__4sFdl_1).__f9__Pi_1=___src__4sFdl_1.__f9__Pi_1)); 155 ((void)___constructor__F_4sFdl4sFdl_autogen___1((&___ret__4sFdl_1), (*___dst__4sFdl_1))); 156 return ___ret__4sFdl_1; 157 } 158 static inline void ___constructor__F_4sFdli_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1){ 159 ((void)((*___dst__4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 160 ((void)((*___dst__4sFdl_1).__f2__i_1) /* ?{} */); 161 ((void)((*___dst__4sFdl_1).__f3__i_1) /* ?{} */); 162 ((void)((*___dst__4sFdl_1).__f4__i_1) /* ?{} */); 163 ((void)((*___dst__4sFdl_1).__f5__i_1) /* ?{} */); 164 ((void)((*___dst__4sFdl_1).__f6__i_1) /* ?{} */); 165 ((void)((*___dst__4sFdl_1).__f7__i_1) /* ?{} */); 166 ((void)((*___dst__4sFdl_1).__f8__i_1) /* ?{} */); 167 ((void)((*___dst__4sFdl_1).__anonymous_object0) /* ?{} */); 168 ((void)((*___dst__4sFdl_1).__f9__Pi_1) /* ?{} */); 169 } 170 static inline void ___constructor__F_4sFdlii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1){ 171 ((void)((*___dst__4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 172 ((void)((*___dst__4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); 173 ((void)((*___dst__4sFdl_1).__f3__i_1) /* ?{} */); 174 ((void)((*___dst__4sFdl_1).__f4__i_1) /* ?{} */); 175 ((void)((*___dst__4sFdl_1).__f5__i_1) /* ?{} */); 176 ((void)((*___dst__4sFdl_1).__f6__i_1) /* ?{} */); 177 ((void)((*___dst__4sFdl_1).__f7__i_1) /* ?{} */); 178 ((void)((*___dst__4sFdl_1).__f8__i_1) /* ?{} */); 179 ((void)((*___dst__4sFdl_1).__anonymous_object0) /* ?{} */); 180 ((void)((*___dst__4sFdl_1).__f9__Pi_1) /* ?{} */); 181 } 182 static inline void ___constructor__F_4sFdliii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1){ 183 ((void)((*___dst__4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 184 ((void)((*___dst__4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); 185 ((void)((*___dst__4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */); 186 ((void)((*___dst__4sFdl_1).__f4__i_1) /* ?{} */); 187 ((void)((*___dst__4sFdl_1).__f5__i_1) /* ?{} */); 188 ((void)((*___dst__4sFdl_1).__f6__i_1) /* ?{} */); 189 ((void)((*___dst__4sFdl_1).__f7__i_1) /* ?{} */); 190 ((void)((*___dst__4sFdl_1).__f8__i_1) /* ?{} */); 191 ((void)((*___dst__4sFdl_1).__anonymous_object0) /* ?{} */); 192 ((void)((*___dst__4sFdl_1).__f9__Pi_1) /* ?{} */); 193 } 194 static inline void ___constructor__F_4sFdliiii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1){ 195 ((void)((*___dst__4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 196 ((void)((*___dst__4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); 197 ((void)((*___dst__4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */); 198 ((void)((*___dst__4sFdl_1).__f4__i_1=__f4__i_1) /* ?{} */); 199 ((void)((*___dst__4sFdl_1).__f5__i_1) /* ?{} */); 200 ((void)((*___dst__4sFdl_1).__f6__i_1) /* ?{} */); 201 ((void)((*___dst__4sFdl_1).__f7__i_1) /* ?{} */); 202 ((void)((*___dst__4sFdl_1).__f8__i_1) /* ?{} */); 203 ((void)((*___dst__4sFdl_1).__anonymous_object0) /* ?{} */); 204 ((void)((*___dst__4sFdl_1).__f9__Pi_1) /* ?{} */); 205 } 206 static inline void ___constructor__F_4sFdliiiii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1){ 207 ((void)((*___dst__4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 208 ((void)((*___dst__4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); 209 ((void)((*___dst__4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */); 210 ((void)((*___dst__4sFdl_1).__f4__i_1=__f4__i_1) /* ?{} */); 211 ((void)((*___dst__4sFdl_1).__f5__i_1=__f5__i_1) /* ?{} */); 212 ((void)((*___dst__4sFdl_1).__f6__i_1) /* ?{} */); 213 ((void)((*___dst__4sFdl_1).__f7__i_1) /* ?{} */); 214 ((void)((*___dst__4sFdl_1).__f8__i_1) /* ?{} */); 215 ((void)((*___dst__4sFdl_1).__anonymous_object0) /* ?{} */); 216 ((void)((*___dst__4sFdl_1).__f9__Pi_1) /* ?{} */); 217 } 218 static inline void ___constructor__F_4sFdliiiiii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1){ 219 ((void)((*___dst__4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 220 ((void)((*___dst__4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); 221 ((void)((*___dst__4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */); 222 ((void)((*___dst__4sFdl_1).__f4__i_1=__f4__i_1) /* ?{} */); 223 ((void)((*___dst__4sFdl_1).__f5__i_1=__f5__i_1) /* ?{} */); 224 ((void)((*___dst__4sFdl_1).__f6__i_1=__f6__i_1) /* ?{} */); 225 ((void)((*___dst__4sFdl_1).__f7__i_1) /* ?{} */); 226 ((void)((*___dst__4sFdl_1).__f8__i_1) /* ?{} */); 227 ((void)((*___dst__4sFdl_1).__anonymous_object0) /* ?{} */); 228 ((void)((*___dst__4sFdl_1).__f9__Pi_1) /* ?{} */); 229 } 230 static inline void ___constructor__F_4sFdliiiiiii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused)) signed int __f7__i_1){ 231 ((void)((*___dst__4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 232 ((void)((*___dst__4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); 233 ((void)((*___dst__4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */); 234 ((void)((*___dst__4sFdl_1).__f4__i_1=__f4__i_1) /* ?{} */); 235 ((void)((*___dst__4sFdl_1).__f5__i_1=__f5__i_1) /* ?{} */); 236 ((void)((*___dst__4sFdl_1).__f6__i_1=__f6__i_1) /* ?{} */); 237 ((void)((*___dst__4sFdl_1).__f7__i_1=__f7__i_1) /* ?{} */); 238 ((void)((*___dst__4sFdl_1).__f8__i_1) /* ?{} */); 239 ((void)((*___dst__4sFdl_1).__anonymous_object0) /* ?{} */); 240 ((void)((*___dst__4sFdl_1).__f9__Pi_1) /* ?{} */); 241 } 242 static inline void ___constructor__F_4sFdliiiiiiii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused)) signed int __f7__i_1, __attribute__ ((unused)) signed int __f8__i_1){ 243 ((void)((*___dst__4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 244 ((void)((*___dst__4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); 245 ((void)((*___dst__4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */); 246 ((void)((*___dst__4sFdl_1).__f4__i_1=__f4__i_1) /* ?{} */); 247 ((void)((*___dst__4sFdl_1).__f5__i_1=__f5__i_1) /* ?{} */); 248 ((void)((*___dst__4sFdl_1).__f6__i_1=__f6__i_1) /* ?{} */); 249 ((void)((*___dst__4sFdl_1).__f7__i_1=__f7__i_1) /* ?{} */); 250 ((void)((*___dst__4sFdl_1).__f8__i_1=__f8__i_1) /* ?{} */); 251 ((void)((*___dst__4sFdl_1).__anonymous_object0) /* ?{} */); 252 ((void)((*___dst__4sFdl_1).__f9__Pi_1) /* ?{} */); 253 } 254 static inline void ___constructor__F_4sFdliiiiiiiii_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused)) signed int __f7__i_1, __attribute__ ((unused)) signed int __f8__i_1, __attribute__ ((unused)) signed int __anonymous_object3){ 255 ((void)((*___dst__4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 256 ((void)((*___dst__4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); 257 ((void)((*___dst__4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */); 258 ((void)((*___dst__4sFdl_1).__f4__i_1=__f4__i_1) /* ?{} */); 259 ((void)((*___dst__4sFdl_1).__f5__i_1=__f5__i_1) /* ?{} */); 260 ((void)((*___dst__4sFdl_1).__f6__i_1=__f6__i_1) /* ?{} */); 261 ((void)((*___dst__4sFdl_1).__f7__i_1=__f7__i_1) /* ?{} */); 262 ((void)((*___dst__4sFdl_1).__f8__i_1=__f8__i_1) /* ?{} */); 263 ((void)((*___dst__4sFdl_1).__anonymous_object0=__anonymous_object3) /* ?{} */); 264 ((void)((*___dst__4sFdl_1).__f9__Pi_1) /* ?{} */); 265 } 266 static inline void ___constructor__F_4sFdliiiiiiiiiPi_autogen___1(struct Fdl *___dst__4sFdl_1, __attribute__ ((unused)) signed int __f1__i_1, __attribute__ ((unused)) signed int __f2__i_1, __attribute__ ((unused,unused)) signed int __f3__i_1, __attribute__ ((unused)) signed int __f4__i_1, __attribute__ ((unused,unused)) signed int __f5__i_1, signed int __f6__i_1, __attribute__ ((unused,unused)) signed int __f7__i_1, __attribute__ ((unused)) signed int __f8__i_1, __attribute__ ((unused)) signed int __anonymous_object4, __attribute__ ((unused,unused)) signed int *__f9__Pi_1){ 267 ((void)((*___dst__4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */); 268 ((void)((*___dst__4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */); 269 ((void)((*___dst__4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */); 270 ((void)((*___dst__4sFdl_1).__f4__i_1=__f4__i_1) /* ?{} */); 271 ((void)((*___dst__4sFdl_1).__f5__i_1=__f5__i_1) /* ?{} */); 272 ((void)((*___dst__4sFdl_1).__f6__i_1=__f6__i_1) /* ?{} */); 273 ((void)((*___dst__4sFdl_1).__f7__i_1=__f7__i_1) /* ?{} */); 274 ((void)((*___dst__4sFdl_1).__f8__i_1=__f8__i_1) /* ?{} */); 275 ((void)((*___dst__4sFdl_1).__anonymous_object0=__anonymous_object4) /* ?{} */); 276 ((void)((*___dst__4sFdl_1).__f9__Pi_1=__f9__Pi_1) /* ?{} */); 277 } 278 __attribute__ ((unused)) signed int __f__Fi___1() asm ( "xyz" ); 279 __attribute__ ((used,used)) const signed int __vd1__Ci_1; 280 __attribute__ ((used,unused)) const signed int __vd2__Ci_1; 281 __attribute__ ((used,used,used,used)) const signed int *__vd3__PCi_1; 282 __attribute__ ((used,used,unused,used,unused)) const signed int *__vd4__PCi_1; 283 __attribute__ ((used,used,used)) const signed int __vd5__A0Ci_1[((unsigned int )5)]; 284 __attribute__ ((used,used,unused,used)) const signed int __vd6__A0Ci_1[((unsigned int )5)]; 285 __attribute__ ((used,used,used,used)) const signed int (*__vd7__Fi___1)(); 286 __attribute__ ((used,used,unused,used,used)) const signed int (*__vd8__Fi___1)(); 287 __attribute__ ((unused,used)) signed int __f1__Fi___1(); 288 __attribute__ ((unused)) signed int __f1__Fi___1(){ 289 __attribute__ ((unused)) signed int ___retval_f1__i_1; 290 } 291 __attribute__ ((unused,unused,unused,used)) signed int **const __f2__FPPi___1(); 292 __attribute__ ((unused,unused,unused)) signed int **const __f2__FPPi___1(){ 293 __attribute__ ((unused)) signed int **const ___retval_f2__CPPi_1; 294 } 295 __attribute__ ((unused,used,unused)) signed int (*__f3__FPA0i_i__1(signed int __anonymous_object5))[]; 296 __attribute__ ((unused,unused)) signed int (*__f3__FPA0i_i__1(signed int __p__i_1))[]{ 297 __attribute__ ((unused)) signed int (*___retval_f3__PA0i_1)[]; 298 } 299 __attribute__ ((unused,used,unused)) signed int (*__f4__FFi_i____1())(signed int __anonymous_object6); 300 __attribute__ ((unused,unused)) signed int (*__f4__FFi_i____1())(signed int __anonymous_object7){ 301 __attribute__ ((unused)) signed int (*___retval_f4__Fi_i__1)(signed int __anonymous_object8); 302 } 303 signed int __vtr__Fi___1(){ 304 __attribute__ ((unused)) signed int ___retval_vtr__i_1; 305 __attribute__ ((unused,unused,used)) signed int __t1__i_2; 306 __attribute__ ((unused,unused,unused,unused,unused)) signed int **__t2__PPi_2; 307 __attribute__ ((unused,unused,unused)) signed int __t3__A0i_2[((unsigned int )5)]; 308 __attribute__ ((unused,unused,unused,unused,unused)) signed int **__t4__A0PPi_2[((unsigned int )5)]; 309 __attribute__ ((unused,unused,unused)) signed int __t5__Fi___2(); 310 __attribute__ ((unused,unused,unused,unused)) signed int *__t6__FPi___2(); 311 } 312 signed int __ipd1__Fi_ii__1(__attribute__ ((unused,unused,unused)) signed int __p__i_1, __attribute__ ((unused,unused,unused)) signed int __q__i_1); 313 signed int __ipd1__Fi_ii__1(__attribute__ ((unused,unused,unused)) signed int __p__i_1, __attribute__ ((unused,unused,unused)) signed int __q__i_1){ 314 __attribute__ ((unused)) signed int ___retval_ipd1__i_1; 315 } 316 signed int __ipd2__Fi_PiPi__1(__attribute__ ((unused,unused,unused,unused)) signed int *__p__Pi_1, __attribute__ ((unused,unused,unused)) signed int *__q__Pi_1); 317 signed int __ipd2__Fi_PiPi__1(__attribute__ ((unused,unused,unused,unused)) signed int *__p__Pi_1, __attribute__ ((unused,unused,unused)) signed int *__q__Pi_1){ 318 __attribute__ ((unused)) signed int ___retval_ipd2__i_1; 319 } 320 signed int __ipd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__p__Pi_1, __attribute__ ((unused,unused,unused)) signed int *__q__Pi_1); 321 signed int __ipd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__p__Pi_1, __attribute__ ((unused,unused,unused)) signed int *__q__Pi_1){ 322 __attribute__ ((unused)) signed int ___retval_ipd3__i_1; 323 } 324 signed int __ipd4__Fi_Fi__Fi____1(__attribute__ ((unused,unused,unused)) signed int (*__p__Fi___1)(), __attribute__ ((unused,unused,unused)) signed int (*__q__Fi___1)()); 325 signed int __ipd4__Fi_Fi__Fi____1(__attribute__ ((unused,unused,unused)) signed int (*__p__Fi___1)(), __attribute__ ((unused,unused,unused)) signed int (*__q__Fi___1)()){ 326 __attribute__ ((unused)) signed int ___retval_ipd4__i_1; 327 } 328 signed int __tpr1__Fi_i__1(__attribute__ ((unused,unused,unused)) signed int __Foo__i_1); 329 signed int __tpr2__Fi_PPi__1(__attribute__ ((unused,unused,unused,unused,unused,unused)) signed int **__Foo__PPi_1); 330 signed int __tpr3__Fi_Pi__1(__attribute__ ((unused,unused,unused)) signed int *__Foo__Pi_1); 331 signed int __tpr4__Fi_Fi_Pi___1(__attribute__ ((unused,unused)) signed int (*__anonymous_object9)(__attribute__ ((unused,unused)) signed int __anonymous_object10[((unsigned int )5)])); 332 signed int __tpr5__Fi_Fi____1(__attribute__ ((unused,unused,unused)) signed int (*__Foo__Fi___1)()); 333 signed int __tpr6__Fi_Fi____1(__attribute__ ((unused,unused,unused)) signed int (*__Foo__Fi___1)()); 334 signed int __tpr7__Fi_Fi_Fi_i____1(__attribute__ ((unused,unused)) signed int (*__anonymous_object11)(__attribute__ ((unused)) signed int (*__anonymous_object12)(__attribute__ ((unused,unused)) signed int __anonymous_object13))); 335 signed int __ad__Fi___1(){ 336 __attribute__ ((unused)) signed int ___retval_ad__i_1; 337 __attribute__ ((used,unused)) signed int __ad1__i_2; 338 __attribute__ ((unused,unused,unused)) signed int *__ad2__Pi_2; 339 __attribute__ ((unused,unused,unused)) signed int __ad3__A0i_2[((unsigned int )5)]; 340 __attribute__ ((unused,unused,unused,unused,unused)) signed int (*__ad4__PA0i_2)[((unsigned int )10)]; 341 __attribute__ ((unused,unused,unused,unused,used)) signed int __ad5__i_2; 342 __attribute__ ((unused,unused,unused,unused,unused)) signed int __ad6__Fi___2(); 343 ((void)sizeof(__attribute__ ((unused,unused)) signed int )); 344 ((void)sizeof(__attribute__ ((unused,unused,unused,unused)) signed int **)); 345 ((void)sizeof(__attribute__ ((unused,unused,unused)) signed int [5])); 346 ((void)sizeof(__attribute__ ((unused,unused,unused)) signed int (*)[10])); 347 ((void)sizeof(__attribute__ ((unused,unused,unused)) signed int ())); 348 struct __attribute__ ((unused)) __anonymous3 { 349 signed int __i__i_2; 350 }; 351 inline void ___constructor__F_13s__anonymous3_autogen___2(struct __anonymous3 *___dst__13s__anonymous3_2){ 352 ((void)((*___dst__13s__anonymous3_2).__i__i_2) /* ?{} */); 353 } 354 inline void ___constructor__F_13s__anonymous313s__anonymous3_autogen___2(struct __anonymous3 *___dst__13s__anonymous3_2, struct __anonymous3 ___src__13s__anonymous3_2){ 355 ((void)((*___dst__13s__anonymous3_2).__i__i_2=___src__13s__anonymous3_2.__i__i_2) /* ?{} */); 356 } 357 inline void ___destructor__F_13s__anonymous3_autogen___2(struct __anonymous3 *___dst__13s__anonymous3_2){ 358 ((void)((*___dst__13s__anonymous3_2).__i__i_2) /* ^?{} */); 359 } 360 inline struct __anonymous3 ___operator_assign__F13s__anonymous3_13s__anonymous313s__anonymous3_autogen___2(struct __anonymous3 *___dst__13s__anonymous3_2, struct __anonymous3 ___src__13s__anonymous3_2){ 361 struct __anonymous3 ___ret__13s__anonymous3_2; 362 ((void)((*___dst__13s__anonymous3_2).__i__i_2=___src__13s__anonymous3_2.__i__i_2)); 363 ((void)___constructor__F_13s__anonymous313s__anonymous3_autogen___2((&___ret__13s__anonymous3_2), (*___dst__13s__anonymous3_2))); 364 return ___ret__13s__anonymous3_2; 365 } 366 inline void ___constructor__F_13s__anonymous3i_autogen___2(struct __anonymous3 *___dst__13s__anonymous3_2, signed int __i__i_2){ 367 ((void)((*___dst__13s__anonymous3_2).__i__i_2=__i__i_2) /* ?{} */); 368 } 369 ((void)sizeof(struct __anonymous3 )); 370 enum __attribute__ ((unused)) __anonymous4 { 371 __R__C13e__anonymous4_2, 372 }; 373 inline void ___constructor__F_13e__anonymous4_intrinsic___2(__attribute__ ((unused)) enum __anonymous4 *___dst__13e__anonymous4_2){ 374 } 375 inline void ___constructor__F_13e__anonymous413e__anonymous4_intrinsic___2(enum __anonymous4 *___dst__13e__anonymous4_2, enum __anonymous4 ___src__13e__anonymous4_2){ 376 ((void)((*___dst__13e__anonymous4_2)=___src__13e__anonymous4_2) /* ?{} */); 377 } 378 inline void ___destructor__F_13e__anonymous4_intrinsic___2(__attribute__ ((unused)) enum __anonymous4 *___dst__13e__anonymous4_2){ 379 } 380 inline enum __anonymous4 ___operator_assign__F13e__anonymous4_13e__anonymous413e__anonymous4_intrinsic___2(enum __anonymous4 *___dst__13e__anonymous4_2, enum __anonymous4 ___src__13e__anonymous4_2){ 381 enum __anonymous4 ___ret__13e__anonymous4_2; 382 ((void)((*___dst__13e__anonymous4_2)=___src__13e__anonymous4_2)); 383 ((void)(___ret__13e__anonymous4_2=(*___dst__13e__anonymous4_2)) /* ?{} */); 384 return ___ret__13e__anonymous4_2; 385 } 386 ((void)sizeof(enum __anonymous4 )); 387 } 388 signed int __apd1__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__anonymous_object14, __attribute__ ((unused,unused,unused)) signed int *__anonymous_object15); 389 signed int __apd2__Fi_PPiPPi__1(__attribute__ ((unused,unused,unused,unused)) signed int **__anonymous_object16, __attribute__ ((unused,unused,unused,unused)) signed int **__anonymous_object17); 390 signed int __apd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__anonymous_object18, __attribute__ ((unused,unused,unused)) signed int *__anonymous_object19); 391 signed int __apd4__Fi_Fi__Fi____1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object20)(), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object21)()); 392 signed int __apd5__Fi_Fi_i_Fi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object22)(__attribute__ ((unused)) signed int __anonymous_object23), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object24)(__attribute__ ((unused)) signed int __anonymous_object25)); 393 signed int __apd6__Fi_Fi__Fi____1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object26)(), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object27)()); 394 signed int __apd7__Fi_Fi_i_Fi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object28)(__attribute__ ((unused)) signed int __anonymous_object29), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object30)(__attribute__ ((unused)) signed int __anonymous_object31)); 395 struct Vad { 396 __attribute__ ((unused)) signed int __anonymous_object32; 397 __attribute__ ((unused,unused)) signed int *__anonymous_object33; 398 __attribute__ ((unused,unused)) signed int __anonymous_object34[((unsigned int )10)]; 399 __attribute__ ((unused,unused)) signed int (*__anonymous_object35)(); 400 }; 401 static inline void ___constructor__F_4sVad_autogen___1(struct Vad *___dst__4sVad_1); 402 static inline void ___constructor__F_4sVad4sVad_autogen___1(struct Vad *___dst__4sVad_1, struct Vad ___src__4sVad_1); 403 static inline void ___destructor__F_4sVad_autogen___1(struct Vad *___dst__4sVad_1); 404 static inline struct Vad ___operator_assign__F4sVad_4sVad4sVad_autogen___1(struct Vad *___dst__4sVad_1, struct Vad ___src__4sVad_1); 405 static inline void ___constructor__F_4sVadi_autogen___1(struct Vad *___dst__4sVad_1, __attribute__ ((unused)) signed int __anonymous_object36); 406 static inline void ___constructor__F_4sVadiPi_autogen___1(struct Vad *___dst__4sVad_1, __attribute__ ((unused)) signed int __anonymous_object37, __attribute__ ((unused,unused)) signed int *__anonymous_object38); 407 static inline void ___constructor__F_4sVadiPiA0i_autogen___1(struct Vad *___dst__4sVad_1, __attribute__ ((unused)) signed int __anonymous_object39, __attribute__ ((unused,unused)) signed int *__anonymous_object40, __attribute__ ((unused,unused)) signed int __anonymous_object41[((unsigned int )10)]); 408 static inline void ___constructor__F_4sVadiPiA0iFi___autogen___1(struct Vad *___dst__4sVad_1, __attribute__ ((unused)) signed int __anonymous_object42, __attribute__ ((unused,unused)) signed int *__anonymous_object43, __attribute__ ((unused,unused)) signed int __anonymous_object44[((unsigned int )10)], __attribute__ ((unused,unused)) signed int (*__anonymous_object45)()); 409 static inline void ___constructor__F_4sVad_autogen___1(struct Vad *___dst__4sVad_1){ 410 ((void)((*___dst__4sVad_1).__anonymous_object32) /* ?{} */); 411 ((void)((*___dst__4sVad_1).__anonymous_object33) /* ?{} */); 412 { 413 signed int _index0 = 0; 414 for (;(_index0<10);((void)(++_index0))) { 415 ((void)((*___dst__4sVad_1).__anonymous_object34[_index0]) /* ?{} */); 416 } 417 418 } 419 420 ((void)((*___dst__4sVad_1).__anonymous_object35) /* ?{} */); 421 } 422 static inline void ___constructor__F_4sVad4sVad_autogen___1(struct Vad *___dst__4sVad_1, struct Vad ___src__4sVad_1){ 423 ((void)((*___dst__4sVad_1).__anonymous_object32=___src__4sVad_1.__anonymous_object32) /* ?{} */); 424 ((void)((*___dst__4sVad_1).__anonymous_object33=___src__4sVad_1.__anonymous_object33) /* ?{} */); 425 { 426 signed int _index1 = 0; 427 for (;(_index1<10);((void)(++_index1))) { 428 ((void)((*___dst__4sVad_1).__anonymous_object34[_index1]=___src__4sVad_1.__anonymous_object34[_index1]) /* ?{} */); 429 } 430 431 } 432 433 ((void)((*___dst__4sVad_1).__anonymous_object35=___src__4sVad_1.__anonymous_object35) /* ?{} */); 434 } 435 static inline void ___destructor__F_4sVad_autogen___1(struct Vad *___dst__4sVad_1){ 436 ((void)((*___dst__4sVad_1).__anonymous_object35) /* ^?{} */); 437 { 438 signed int _index2 = (10-1); 439 for (;(_index2>=0);((void)(--_index2))) { 440 ((void)((*___dst__4sVad_1).__anonymous_object34[_index2]) /* ^?{} */); 441 } 442 443 } 444 445 ((void)((*___dst__4sVad_1).__anonymous_object33) /* ^?{} */); 446 ((void)((*___dst__4sVad_1).__anonymous_object32) /* ^?{} */); 447 } 448 static inline struct Vad ___operator_assign__F4sVad_4sVad4sVad_autogen___1(struct Vad *___dst__4sVad_1, struct Vad ___src__4sVad_1){ 449 struct Vad ___ret__4sVad_1; 450 ((void)((*___dst__4sVad_1).__anonymous_object32=___src__4sVad_1.__anonymous_object32)); 451 ((void)((*___dst__4sVad_1).__anonymous_object33=___src__4sVad_1.__anonymous_object33)); 452 { 453 signed int _index3 = 0; 454 for (;(_index3<10);((void)(++_index3))) { 455 ((void)((*___dst__4sVad_1).__anonymous_object34[_index3]=___src__4sVad_1.__anonymous_object34[_index3])); 456 } 457 458 } 459 460 ((void)((*___dst__4sVad_1).__anonymous_object35=___src__4sVad_1.__anonymous_object35)); 461 ((void)___constructor__F_4sVad4sVad_autogen___1((&___ret__4sVad_1), (*___dst__4sVad_1))); 462 return ___ret__4sVad_1; 463 } 464 static inline void ___constructor__F_4sVadi_autogen___1(struct Vad *___dst__4sVad_1, __attribute__ ((unused)) signed int __anonymous_object46){ 465 ((void)((*___dst__4sVad_1).__anonymous_object32=__anonymous_object46) /* ?{} */); 466 ((void)((*___dst__4sVad_1).__anonymous_object33) /* ?{} */); 467 { 468 signed int _index4 = 0; 469 for (;(_index4<10);((void)(++_index4))) { 470 ((void)((*___dst__4sVad_1).__anonymous_object34[_index4]) /* ?{} */); 471 } 472 473 } 474 475 ((void)((*___dst__4sVad_1).__anonymous_object35) /* ?{} */); 476 } 477 static inline void ___constructor__F_4sVadiPi_autogen___1(struct Vad *___dst__4sVad_1, __attribute__ ((unused)) signed int __anonymous_object47, __attribute__ ((unused,unused)) signed int *__anonymous_object48){ 478 ((void)((*___dst__4sVad_1).__anonymous_object32=__anonymous_object47) /* ?{} */); 479 ((void)((*___dst__4sVad_1).__anonymous_object33=__anonymous_object48) /* ?{} */); 480 { 481 signed int _index5 = 0; 482 for (;(_index5<10);((void)(++_index5))) { 483 ((void)((*___dst__4sVad_1).__anonymous_object34[_index5]) /* ?{} */); 484 } 485 486 } 487 488 ((void)((*___dst__4sVad_1).__anonymous_object35) /* ?{} */); 489 } 490 static inline void ___constructor__F_4sVadiPiA0i_autogen___1(struct Vad *___dst__4sVad_1, __attribute__ ((unused)) signed int __anonymous_object49, __attribute__ ((unused,unused)) signed int *__anonymous_object50, __attribute__ ((unused,unused)) signed int __anonymous_object51[((unsigned int )10)]){ 491 ((void)((*___dst__4sVad_1).__anonymous_object32=__anonymous_object49) /* ?{} */); 492 ((void)((*___dst__4sVad_1).__anonymous_object33=__anonymous_object50) /* ?{} */); 493 { 494 signed int _index6 = 0; 495 for (;(_index6<10);((void)(++_index6))) { 496 ((void)((*___dst__4sVad_1).__anonymous_object34[_index6]=__anonymous_object51[_index6]) /* ?{} */); 497 } 498 499 } 500 501 ((void)((*___dst__4sVad_1).__anonymous_object35) /* ?{} */); 502 } 503 static inline void ___constructor__F_4sVadiPiA0iFi___autogen___1(struct Vad *___dst__4sVad_1, __attribute__ ((unused)) signed int __anonymous_object52, __attribute__ ((unused,unused)) signed int *__anonymous_object53, __attribute__ ((unused,unused)) signed int __anonymous_object54[((unsigned int )10)], __attribute__ ((unused,unused)) signed int (*__anonymous_object55)()){ 504 ((void)((*___dst__4sVad_1).__anonymous_object32=__anonymous_object52) /* ?{} */); 505 ((void)((*___dst__4sVad_1).__anonymous_object33=__anonymous_object53) /* ?{} */); 506 { 507 signed int _index7 = 0; 508 for (;(_index7<10);((void)(++_index7))) { 509 ((void)((*___dst__4sVad_1).__anonymous_object34[_index7]=__anonymous_object54[_index7]) /* ?{} */); 510 } 511 512 } 513 514 ((void)((*___dst__4sVad_1).__anonymous_object35=__anonymous_object55) /* ?{} */); 515 } -
src/tests/Makefile.am
rfc20514 r777ed2b 17 17 debug=yes 18 18 19 quick_test=avl_test operators numericConstants expression enum array typeof cast attributes19 quick_test=avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes 20 20 21 21 if BUILD_CONCURRENCY … … 110 110 ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@} 111 111 112 nested-types-ERR1: nested-types.c @CFA_BINDIR@/@CFA_NAME@ 113 ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@} 114 115 nested-types-ERR2: nested-types.c @CFA_BINDIR@/@CFA_NAME@ 116 ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR2 ${<} -o ${@} 117 112 118 # Constructor/destructor tests 113 119 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@ -
src/tests/Makefile.in
rfc20514 r777ed2b 303 303 top_srcdir = @top_srcdir@ 304 304 debug = yes 305 quick_test = avl_test operators numericConstants expression enum array typeof cast dtor-early-exitinit_once attributes305 quick_test = avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes 306 306 @BUILD_CONCURRENCY_FALSE@concurrent = '-Econcurrent' 307 307 @BUILD_CONCURRENCY_TRUE@concurrent = … … 787 787 ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@} 788 788 789 nested-types-ERR1: nested-types.c @CFA_BINDIR@/@CFA_NAME@ 790 ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@} 791 792 nested-types-ERR2: nested-types.c @CFA_BINDIR@/@CFA_NAME@ 793 ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR2 ${<} -o ${@} 794 789 795 # Constructor/destructor tests 790 796 raii/dtor-early-exit-ERR1: raii/dtor-early-exit.c @CFA_BINDIR@/@CFA_NAME@
Note: See TracChangeset
for help on using the changeset viewer.