@@ -1296,12 +1296,21 @@ macro_rules! define_vocabulary {
12961296///
12971297/// ```text
12981298/// <mangled-name> ::= _Z <encoding> [<clone-suffix>]*
1299+ /// ::= ___Z <encoding> <block_invoke>
1300+ /// ::= <type>
1301+ ///
1302+ /// <block_invoke> ::= _block_invoke
1303+ /// ::= _block_invoke<decimal-digit>+
1304+ /// ::= _block_invoke_<decimal-digit>+
12991305/// ```
13001306#[ derive( Clone , Debug , PartialEq , Eq ) ]
13011307pub enum MangledName {
13021308 /// The encoding of the mangled symbol name.
13031309 Encoding ( Encoding , Vec < CloneSuffix > ) ,
13041310
1311+ /// The encoding of the mangled symbol name.
1312+ BlockInvoke ( Encoding , Option < isize > ) ,
1313+
13051314 /// A top-level type. Technically not allowed by the standard, however in
13061315 /// practice this can happen, and is tested for by libiberty.
13071316 Type ( TypeHandle ) ,
@@ -1326,6 +1335,23 @@ impl Parse for MangledName {
13261335 return Ok ( ( MangledName :: Encoding ( encoding, clone_suffixes) , tail) ) ;
13271336 }
13281337
1338+ if let Ok ( tail) = consume ( b"___Z" , input) . or_else ( |_| consume ( b"____Z" , input) ) {
1339+ let ( encoding, tail) = Encoding :: parse ( ctx, subs, tail) ?;
1340+ let tail = consume ( b"_block_invoke" , tail) ?;
1341+
1342+ let tail_opt = match consume ( b"_" , tail) {
1343+ Ok ( tail) => Some ( parse_number ( 10 , false , tail) ?) ,
1344+ Err ( _) => parse_number ( 10 , false , tail) . ok ( ) ,
1345+ } ;
1346+
1347+ let ( digits, tail) = match tail_opt {
1348+ Some ( ( digits, tail) ) => ( Some ( digits) , tail) ,
1349+ None => ( None , tail) ,
1350+ } ;
1351+
1352+ return Ok ( ( MangledName :: BlockInvoke ( encoding, digits) , tail) ) ;
1353+ }
1354+
13291355 if let Ok ( tail) = consume ( b"_GLOBAL_" , input) {
13301356 let ( global_ctor_dtor, tail) = GlobalCtorDtor :: parse ( ctx, subs, tail) ?;
13311357 return Ok ( ( MangledName :: GlobalCtorDtor ( global_ctor_dtor) , tail) ) ;
@@ -1359,6 +1385,11 @@ where
13591385 }
13601386 Ok ( ( ) )
13611387 } ,
1388+ MangledName :: BlockInvoke ( ref enc, _) => {
1389+ write ! ( ctx, "invocation function for block in " ) ?;
1390+ enc. demangle ( ctx, scope) ?;
1391+ Ok ( ( ) )
1392+ }
13621393 MangledName :: Type ( ref ty) => ty. demangle ( ctx, scope) ,
13631394 MangledName :: GlobalCtorDtor ( ref gcd) => gcd. demangle ( ctx, scope) ,
13641395 }
0 commit comments