| 7582 | |
| 7583 | namespace { |
| 7584 | static StringRef extractClassName( StringRef classOrMethodName ) { |
| 7585 | if ( !startsWith( classOrMethodName, '&' ) ) { |
| 7586 | return classOrMethodName; |
| 7587 | } |
| 7588 | |
| 7589 | // Remove the leading '&' to avoid having to special case it later |
| 7590 | const auto methodName = |
| 7591 | classOrMethodName.substr( 1, classOrMethodName.size() ); |
| 7592 | |
| 7593 | auto reverseStart = std::make_reverse_iterator( methodName.end() ); |
| 7594 | auto reverseEnd = std::make_reverse_iterator( methodName.begin() ); |
| 7595 | |
| 7596 | // We make a simplifying assumption that ":" is only present |
| 7597 | // in the input as part of "::" from C++ typenames (this is |
| 7598 | // relatively safe assumption because the input is generated |
| 7599 | // as stringification of type through preprocessor). |
| 7600 | auto lastColons = std::find( reverseStart, reverseEnd, ':' ) + 1; |
| 7601 | auto secondLastColons = |
| 7602 | std::find( lastColons + 1, reverseEnd, ':' ); |
| 7603 | |
| 7604 | auto const startIdx = reverseEnd - secondLastColons; |
| 7605 | auto const classNameSize = secondLastColons - lastColons - 1; |
| 7606 | |
| 7607 | return methodName.substr( |
| 7608 | static_cast<std::size_t>( startIdx ), |
| 7609 | static_cast<std::size_t>( classNameSize ) ); |
| 7610 | } |
| 7611 | |
| 7612 | class TestInvokerAsFunction final : public ITestInvoker { |
| 7613 | using TestType = void ( * )(); |