Skip to content

Commit

Permalink
absl qualify HasAbslStringify in log_message.h.
Browse files Browse the repository at this point in the history
This works around a Clang bug, llvm/llvm-project#25168

PiperOrigin-RevId: 588491254
Change-Id: Ia59afae4df45474d6025a2ab1ca487b381c9ee66
  • Loading branch information
Abseil Team authored and copybara-github committed Dec 6, 2023
1 parent a436472 commit d84f20a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions absl/log/internal/log_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,15 @@ class LogMessage {

// Types that support `AbslStringify()` are serialized that way.
template <typename T,
typename std::enable_if<HasAbslStringify<T>::value, int>::type = 0>
typename std::enable_if<absl::HasAbslStringify<T>::value,
int>::type = 0>
LogMessage& operator<<(const T& v) ABSL_ATTRIBUTE_NOINLINE;

// Types that don't support `AbslStringify()` but do support streaming into a
// `std::ostream&` are serialized that way.
template <typename T,
typename std::enable_if<!HasAbslStringify<T>::value, int>::type = 0>
typename std::enable_if<!absl::HasAbslStringify<T>::value,
int>::type = 0>
LogMessage& operator<<(const T& v) ABSL_ATTRIBUTE_NOINLINE;

// Note: We explicitly do not support `operator<<` for non-const references
Expand Down Expand Up @@ -281,7 +283,7 @@ class StringifySink final {

// Note: the following is declared `ABSL_ATTRIBUTE_NOINLINE`
template <typename T,
typename std::enable_if<HasAbslStringify<T>::value, int>::type>
typename std::enable_if<absl::HasAbslStringify<T>::value, int>::type>
LogMessage& LogMessage::operator<<(const T& v) {
StringifySink sink(*this);
// Replace with public API.
Expand All @@ -291,7 +293,7 @@ LogMessage& LogMessage::operator<<(const T& v) {

// Note: the following is declared `ABSL_ATTRIBUTE_NOINLINE`
template <typename T,
typename std::enable_if<!HasAbslStringify<T>::value, int>::type>
typename std::enable_if<!absl::HasAbslStringify<T>::value, int>::type>
LogMessage& LogMessage::operator<<(const T& v) {
OstreamView view(*data_);
view.stream() << log_internal::NullGuard<T>().Guard(v);
Expand Down

0 comments on commit d84f20a

Please sign in to comment.