The function in question is copy-pasted lots of times in DWARF-related classes. Thus it will make sense to place its implementation into the Support library.
Do you mean something like that the following?
logAllUnhandledErrors(createStringError("bar"), S, ""); EXPECT_EQ(S.str(), "bar\n") ;
I can add it but it will result in compiler warnings "warning: format string is not a string literal (potentially insecure) [-Wformat-security]" which is not looking good. We can temporary disable warnings for this test using compiler-specific pragmas but it will be very messy...
|1125–1133 ↗||(On Diff #157382)|
For now I think this needs to take the std::error_code for the StringError as an argument too, rather than using inconvertibleErrorCode().
The reason for this is that using inconvertibleErrorCode breaks Error / std::error_code interoperability: any attempt to convert an Error value constructed with an inconvertibleErrorCode triggers an immediate abort. It is meant to be used explicitly, and only for code that explicitly documents that it does not support interoperability. It should not be default behavior.
Given the increasingly wide adoption of Error we could talk about changing this policy, but that is a discussion we should have on the dev list where it will reach a wide audience.