@@ -44,32 +44,6 @@ limitations under the License.
4444
4545namespace m3c {
4646
47- #ifdef __clang_analyzer__
48-
49- namespace internal {
50-
51- template <typename ... Args>
52- inline auto IwyuFormatWorkaround (const char * pattern, Args&&... args) {
53- return fmt::format (fmt::runtime (pattern), std::forward<Args>(args)...);
54- }
55-
56- template <typename T, typename ... Args>
57- inline auto IwyuFormatWorkaround (T&& pattern, Args&&... args) {
58- return fmt::format (std::forward<T>(pattern), std::forward<Args>(args)...);
59- }
60-
61- } // namespace internal
62-
63- // / @brief Replace literal format strings for fmt compile with runtime strings.
64- // / @details clang-tidy and include-what-you-use have problems parsing and diagnose false positives or hang/crash.
65- #define FMT_FORMAT (...) m3c::internal::IwyuFormatWorkaround(__VA_ARGS__)
66- #else
67- // / @brief Replace literal format strings for fmt compile with runtime strings.
68- // / @details clang-tidy and include-what-you-use have problems parsing and diagnose false positives or hang/crash.
69- #define FMT_FORMAT (...) fmt::format(__VA_ARGS__)
70- #endif
71-
72-
7347//
7448// String encoding
7549//
@@ -573,7 +547,7 @@ struct fmt::formatter<m3c::fmt_ptr<IUnknown>, CharT> {
573547 // AddRef to get the ref count
574548 const ULONG ref = ptr ? (ptr->AddRef (), ptr->Release ()) : 0 ;
575549 if (std::holds_alternative<fmt::formatter<std::basic_string<CharT>, CharT>>(m_formatter)) {
576- std::basic_string<CharT> value = FMT_FORMAT (
550+ const std::basic_string<CharT> value = fmt::format (
577551 m3c::SelectString<CharT>(M3C_SELECT_STRING (" (ptr={}, ref={})" )),
578552 fmt::ptr (ptr), ref);
579553 return std::get<fmt::formatter<std::basic_string<CharT>, CharT>>(m_formatter).format (value, ctx);
@@ -652,7 +626,7 @@ struct fmt::formatter<m3c::fmt_ptr<IStream>, CharT> : fmt::formatter<m3c::fmt_pt
652626
653627 // AddRef to get the ref count
654628 const ULONG ref = ptr ? (ptr->AddRef (), ptr->Release ()) : 0 ;
655- std::basic_string<CharT> value = FMT_FORMAT (
629+ const std::basic_string<CharT> value = fmt::format (
656630 m3c::SelectString<CharT>(M3C_SELECT_STRING (" ({}, ptr={}, ref={})" )),
657631 m3c::fmt_encode (name), fmt::ptr (ptr), ref);
658632 return std::get<fmt::formatter<std::basic_string<CharT>, CharT>>(m_formatter).format (value, ctx);
@@ -895,7 +869,8 @@ struct ConvertibleToCStrTraits {
895869 // / @brief Calculate the length for objects having a `length()` method.
896870 // / @param arg The object.
897871 // / @return The number of characters excluding the terminating null character.
898- static constexpr auto length (const T& arg) noexcept (noexcept (arg.length())) requires requires {
872+ static constexpr auto length (const T& arg) noexcept (noexcept (arg.length()))
873+ requires requires {
899874 { arg.length () } -> StringLength;
900875 }
901876 {
@@ -905,7 +880,8 @@ struct ConvertibleToCStrTraits {
905880 // / @brief Calculate the length for objects having no `length()` but a `size()` method.
906881 // / @param arg The object.
907882 // / @return The number of characters excluding the terminating null character.
908- static constexpr auto length (const T& arg) noexcept (noexcept (arg.size())) requires requires {
883+ static constexpr auto length (const T& arg) noexcept (noexcept (arg.size()))
884+ requires requires {
909885 { arg.size () } -> StringLength;
910886 requires !requires {
911887 { arg.length () } -> StringLength;
@@ -919,7 +895,8 @@ struct ConvertibleToCStrTraits {
919895 // / @details The string length is calculated using `std::char_traits`.
920896 // / @param arg The object.
921897 // / @return The number of characters excluding the terminating null character.
922- static constexpr auto length (const T& arg) noexcept (noexcept (std::char_traits<CharT>::length(arg))) requires requires {
898+ static constexpr auto length (const T& arg) noexcept (noexcept (std::char_traits<CharT>::length(arg)))
899+ requires requires {
923900 requires !requires {
924901 { arg.length () } -> StringLength;
925902 };
0 commit comments