Changes in src/Concurrency/Keywords.cc [6cebfef:e84ab3d]
- File:
-
- 1 edited
-
src/Concurrency/Keywords.cc (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Keywords.cc
r6cebfef re84ab3d 302 302 void postvisit( FunctionDecl * decl ); 303 303 void postvisit( StructDecl * decl ); 304 Statement * postmutate( MutexStmt * stmt );305 304 306 305 std::list<DeclarationWithType*> findMutexArgs( FunctionDecl*, bool & first ); … … 308 307 void addDtorStatements( FunctionDecl* func, CompoundStmt *, const std::list<DeclarationWithType * > &); 309 308 void addStatements( FunctionDecl* func, CompoundStmt *, const std::list<DeclarationWithType * > &); 310 void addStatements( CompoundStmt * body, const std::list<Expression * > & args );311 309 void addThreadDtorStatements( FunctionDecl* func, CompoundStmt * body, const std::list<DeclarationWithType * > & args ); 312 310 … … 314 312 PassVisitor< MutexKeyword > impl; 315 313 acceptAll( translationUnit, impl ); 316 mutateAll( translationUnit, impl );317 314 } 318 315 … … 938 935 thread_guard_decl = decl; 939 936 } 940 }941 942 Statement * MutexKeyword::postmutate( MutexStmt * stmt ) {943 std::list<Statement *> stmtsForCtor;944 stmtsForCtor.push_back(stmt->stmt);945 CompoundStmt * body = new CompoundStmt( stmtsForCtor );946 addStatements( body, stmt->mutexObjs);947 return body;948 937 } 949 938 … … 1069 1058 )) 1070 1059 ); 1071 }1072 1073 void MutexKeyword::addStatements( CompoundStmt * body, const std::list<Expression * > & args ) {1074 ObjectDecl * monitors = new ObjectDecl(1075 "__monitors",1076 noStorageClasses,1077 LinkageSpec::Cforall,1078 nullptr,1079 new ArrayType(1080 noQualifiers,1081 new PointerType(1082 noQualifiers,1083 new StructInstType(1084 noQualifiers,1085 monitor_decl1086 )1087 ),1088 new ConstantExpr( Constant::from_ulong( args.size() ) ),1089 false,1090 false1091 ),1092 new ListInit(1093 map_range < std::list<Initializer*> > ( args, [](Expression * var ){1094 return new SingleInit( new UntypedExpr(1095 new NameExpr( "get_monitor" ),1096 { var }1097 ) );1098 })1099 )1100 );1101 1102 // in reverse order :1103 // monitor_guard_t __guard = { __monitors, # };1104 body->push_front(1105 new DeclStmt( new ObjectDecl(1106 "__guard",1107 noStorageClasses,1108 LinkageSpec::Cforall,1109 nullptr,1110 new StructInstType(1111 noQualifiers,1112 guard_decl1113 ),1114 new ListInit(1115 {1116 new SingleInit( new VariableExpr( monitors ) ),1117 new SingleInit( new ConstantExpr( Constant::from_ulong( args.size() ) ) )1118 },1119 noDesignators,1120 true1121 )1122 ))1123 );1124 1125 //monitor$ * __monitors[] = { get_monitor(a), get_monitor(b) };1126 body->push_front( new DeclStmt( monitors) );1127 1060 } 1128 1061
Note:
See TracChangeset
for help on using the changeset viewer.