Commit 02e56189 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Use pretty_name in F14TableStats

Summary: [Folly] Use `pretty_name` in `F14TableStats`, which may not be exact in edge cases (e.g. function-local policy types) but which works without RTTI.

Reviewed By: nbronson

Differential Revision: D14129242

fbshipit-source-id: 6f7a8e0b3af4d6b16673770228e98cd989ab0c3f
parent d389009f
......@@ -41,6 +41,7 @@
#include <folly/lang/Assume.h>
#include <folly/lang/Exception.h>
#include <folly/lang/Launder.h>
#include <folly/lang/Pretty.h>
#include <folly/lang/SafeAssert.h>
#include <folly/portability/Builtins.h>
......@@ -2574,9 +2575,7 @@ class F14Table : public Policy {
FOLLY_SAFE_DCHECK(n1 == size(), "");
FOLLY_SAFE_DCHECK(n2 == size(), "");
#if FOLLY_HAS_RTTI
stats.policy = typeid(Policy).name();
#endif
stats.policy = pretty_name<Policy>();
stats.size = size();
stats.valueSize = sizeof(value_type);
stats.bucketCount = bucket_count();
......
......@@ -23,7 +23,6 @@
#include <ostream>
#include <vector>
#include <folly/Demangle.h>
#include <folly/Function.h>
#include <folly/container/detail/F14Policy.h>
#include <folly/container/detail/F14Table.h>
......@@ -442,13 +441,7 @@ std::ostream& operator<<(std::ostream& xo, F14TableStats const& stats) {
using f14::Histo;
xo << "{ " << std::endl;
xo << " policy: "
#if FOLLY_HAS_RTTI
<< folly::demangle(stats.policy)
#else
<< "unknown (RTTI not availabe)"
#endif
<< std::endl;
xo << " policy: " << stats.policy << std::endl;
xo << " size: " << stats.size << std::endl;
xo << " valueSize: " << stats.valueSize << std::endl;
xo << " bucketCount: " << stats.bucketCount << std::endl;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment