Changeset 9c90718
- Timestamp:
- Jun 22, 2017, 11:42:51 AM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 186b398, 5dd0704
- Parents:
- 969ee0df (diff), f1a10a7 (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. - Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/working/exception/translate.c
r969ee0df r9c90718 1 1 /* Translation rules for exception handling code, from Cforall to C. 2 2 * 3 * Note that these are not final. Names, syntax and the exact translation 4 * will be updated. The first section is the shared definitions, not generated 5 * by the local translations but used by the translated code. 3 * Reminder: This is not final. Besides names and things it is also going very 4 * much for correctness and simplisity over efficiency. 5 * 6 * The first section is the shared definitions, not generated by the local 7 * translations but used by the translated code. 6 8 * 7 9 * Most of these exist only after translation (in C code). The first (the … … 16 18 typedef int exception; 17 19 20 // Will have to be availibe to user. Consider new name. Requires tagged types. 21 forall(dtype parent | tagged(parent), dtype child | tagged(child)) 22 parent *dynamic_cast(child *); 23 18 24 void __throw_terminate(exception except) __attribute__((noreturn)); 19 25 void __rethrow_terminate() __attribute__((noreturn)); … … 116 122 } 117 123 int match1(exception except) { 118 OtherException inner_except; 119 if (dynamic_cast__SomeException(except)) { 120 return 1; 121 } 122 else if ( (inner_except = dynamic_cast__OtherException(except)) && 123 inner_except.priority > 3) { 124 return 2; 125 } 126 else return 0; 124 { 125 if (dynamic_cast__SomeException(except)) { 126 return 1; 127 } 128 } 129 { 130 OtherException err; 131 if ( (err = dynamic_cast__OtherException(except)) && 132 err.priority > 3) { 133 return 2; 134 } 135 } 136 return 0; 127 137 } 128 138 __try_terminate(try1, catch1, match1); … … 151 161 { 152 162 bool handle1(exception except) { 153 OtherException inner_except; 154 if (dynamic_cast__SomeException(except)) { 155 fiddleThing(); 156 return true; 157 } else if (dynamic_cast__OtherException(except) && 158 inner_except.priority > 3) { 159 twiddleWidget(); 160 return true; 161 } else { 162 return false; 163 } 163 { 164 if (dynamic_cast__SomeException(except)) { 165 fiddleThing(); 166 return true; 167 } 168 } 169 { 170 OtherException err; 171 if ( ( err = dynamic_cast__OtherException(except) ) && 172 err.priority > 3) { 173 twiddleWidget(); 174 return true; 175 } 176 } 177 return false; 164 178 } 165 179 struct __try_resume_node data = … … 230 244 } 231 245 bool handle1(exception except) { 232 if (dynamic_cast__SomeException(except)) { 233 fiddleThing(); 234 return true; 235 } else { 236 return false; 237 } 246 { 247 if (dynamic_cast__SomeException(except)) { 248 fiddleThing(); 249 return true; 250 } 251 } 252 return false; 238 253 } 239 254 struct __cleanup_hook generated_name … … 273 288 { 274 289 bool handle1() { 275 if (dynamic_cast__OtherException(except)) { 276 twiddleWidget(); 277 return true; 290 { 291 if (dynamic_cast__OtherException(except)) { 292 twiddleWidget(); 293 return true; 294 } 278 295 } 279 296 return false; … … 297 314 } 298 315 int match1(exception except) { 299 if (dynamic_cast__SomeException(except)) { 300 return 1; 316 { 317 if (dynamic_cast__SomeException(except)) { 318 return 1; 319 } 301 320 } 302 321 return 0; -
src/SynTree/Constant.cc
r969ee0df r9c90718 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed Jun 21 16:44:48201713 // Update Count : 2 711 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Jun 22 10:11:00 2017 13 // Update Count : 28 14 14 // 15 15 … … 29 29 30 30 Constant::~Constant() { delete type; } 31 32 Constant Constant::from_bool( bool b ) { 33 return Constant( new BasicType( Type::Qualifiers(), BasicType::Bool ), b ? "1" : "0" , (unsigned long long int)b ); 34 } 31 35 32 36 Constant Constant::from_int( int i ) { -
src/SynTree/Constant.h
r969ee0df r9c90718 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed Jun 21 16:44:48201713 // Update Count : 1 411 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Jun 22 10:13:00 2017 13 // Update Count : 15 14 14 // 15 15 … … 33 33 void set_value( std::string newValue ) { rep = newValue; } 34 34 35 /// generates a boolean constant of the given bool 36 static Constant from_bool( bool b ); 35 37 /// generates an integer constant of the given int 36 38 static Constant from_int( int i );
Note: See TracChangeset
for help on using the changeset viewer.