xo-indentlog: account for more-concise clang output when printing fn

This commit is contained in:
Roland Conybeare 2024-07-21 13:52:48 +10:00
commit 18feb2bfe7
2 changed files with 17 additions and 11 deletions

View file

@ -7,20 +7,20 @@
namespace xo {
enum class function_style : std::uint8_t {
/* literal: print supplied text, no alterations */
/** literal: print supplied text, no alterations **/
literal,
/* pretty: print name, surrounded by []
/** pretty: print name, surrounded by []
* [double Quadratic::operator()(double) const]
*/
**/
pretty,
/* streamlined: remove extraneous detail,
* try to print something like class::method
* Quadratic::operator()
*/
/** streamlined: remove extraneous detail,
* try to print something like class::method
* Quadratic::operator()
**/
streamlined,
/* simple: remove everything except function/method name
* operator()
*/
/** simple: remove everything except function/method name
* operator()
**/
simple
};
@ -99,7 +99,7 @@ namespace xo {
//std::cerr << "print_streamlined: s=[" << s << "]" << std::endl;
//std::cerr << "print_streamlined: s2=[" << s2 << "] (excluded [with ..] suffix)" << std::endl;
//std::cerr << "print_streamlined: s3=[" << s3 << "], p=" << p << " (excluded const suffix)" << std::endl;
//std::cerr << "print_streamlined: s3=[" << s3 << "] (excluded const suffix)" << std::endl;
//std::cerr << "print_streamlined: s4=[" << s4 << "], q=" << q << " (excluded return type)" << std::endl;
//std::cerr << "print_streamlined: s5=[" << s5 << "], r=" << r << " (excluded ns qualifier)" << std::endl;
@ -143,7 +143,12 @@ namespace xo {
* - left-to-right
* - exclude ' [with '... to end of string
*/
#if __clang__
/* clang footnote like [CharT = char] instead of [with CharT = char] */
std::size_t p = s.find(" [");
#else
std::size_t p = s.find(" [with ");
#endif
return s.substr(0, p);
} /*exclude_template_footnote_suffix*/

View file

@ -38,6 +38,7 @@ namespace ut {
function_tcase(function_style::pretty, color_spec_type::blue(), "void xo::class::foo() const", "[\033[31;34mvoid xo::class::foo() const\033[0m]"),
function_tcase(function_style::streamlined, color_spec_type::none(), "void xo::reactor::FifoQueue<T, EvTimeFn>::notify_ev(const T&) [with T = std::pair<std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >, long unsigned int>; EvTimeFn = xo::reactor::EventTimeFn<std::pair<std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >, long unsigned int> >]", "FifoQueue::notify_ev"),
function_tcase(function_style::streamlined, color_spec_type::none(), "token_type xo::tok::tokenizer<char>::assemble_token(const span_type &) const [CharT = char]", "tokenizer::assemble_token"),
});
TEST_CASE("function", "[function]") {