Fabric: Making DebugStringConvertibleOptions a required parameter for all methods of static debug-printing infra
Summary: Having those arguments optional does not really make anything easier to use; on another side that makes it hard finding problems caused by missing that parameter. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D18797337 fbshipit-source-id: c119b8f6a03994072edb45e39337e33b0f8b602f
This commit is contained in:
Родитель
254ebab1d2
Коммит
0cdc3b7016
|
@ -81,7 +81,7 @@ using Touches = std::unordered_set<Touch, Touch::Hasher, Touch::Comparator>;
|
||||||
std::string getDebugName(Touch const &touch);
|
std::string getDebugName(Touch const &touch);
|
||||||
std::vector<DebugStringConvertibleObject> getDebugProps(
|
std::vector<DebugStringConvertibleObject> getDebugProps(
|
||||||
Touch const &object,
|
Touch const &object,
|
||||||
DebugStringConvertibleOptions options = {});
|
DebugStringConvertibleOptions options);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct TouchEvent {
|
||||||
std::string getDebugName(TouchEvent const &touchEvent);
|
std::string getDebugName(TouchEvent const &touchEvent);
|
||||||
std::vector<DebugStringConvertibleObject> getDebugProps(
|
std::vector<DebugStringConvertibleObject> getDebugProps(
|
||||||
TouchEvent const &touchEvent,
|
TouchEvent const &touchEvent,
|
||||||
DebugStringConvertibleOptions options = {});
|
DebugStringConvertibleOptions options);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -143,12 +143,16 @@ std::string getDebugValue(T const &object) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::vector<T> getDebugChildren(T const &object) {
|
std::vector<T> getDebugChildren(
|
||||||
|
T const &object,
|
||||||
|
DebugStringConvertibleOptions options) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::vector<T> getDebugProps(T const &object) {
|
std::vector<T> getDebugProps(
|
||||||
|
T const &object,
|
||||||
|
DebugStringConvertibleOptions options) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +168,7 @@ std::string getDebugPropsDescription(
|
||||||
|
|
||||||
options.depth++;
|
options.depth++;
|
||||||
|
|
||||||
for (auto prop : getDebugProps(object)) {
|
for (auto prop : getDebugProps(object, options)) {
|
||||||
auto name = getDebugName(prop);
|
auto name = getDebugName(prop);
|
||||||
auto value = getDebugValue(prop);
|
auto value = getDebugValue(prop);
|
||||||
auto children = getDebugPropsDescription(prop, options);
|
auto children = getDebugPropsDescription(prop, options);
|
||||||
|
@ -194,7 +198,7 @@ std::string getDebugChildrenDescription(
|
||||||
auto childrenString = std::string{""};
|
auto childrenString = std::string{""};
|
||||||
options.depth++;
|
options.depth++;
|
||||||
|
|
||||||
for (auto child : getDebugChildren(object)) {
|
for (auto child : getDebugChildren(object, options)) {
|
||||||
childrenString += getDebugDescription(child, options) + trailing;
|
childrenString += getDebugDescription(child, options) + trailing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +213,7 @@ std::string getDebugChildrenDescription(
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::string getDebugDescription(
|
std::string getDebugDescription(
|
||||||
T const &object,
|
T const &object,
|
||||||
DebugStringConvertibleOptions options = {}) {
|
DebugStringConvertibleOptions options) {
|
||||||
auto nameString = getDebugName(object);
|
auto nameString = getDebugName(object);
|
||||||
auto valueString = getDebugValue(object);
|
auto valueString = getDebugValue(object);
|
||||||
|
|
||||||
|
@ -246,42 +250,42 @@ std::string getDebugDescription(
|
||||||
// `int`
|
// `int`
|
||||||
inline std::string getDebugDescription(
|
inline std::string getDebugDescription(
|
||||||
int number,
|
int number,
|
||||||
DebugStringConvertibleOptions options = {}) {
|
DebugStringConvertibleOptions options) {
|
||||||
return toString(number);
|
return toString(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
// `float`
|
// `float`
|
||||||
inline std::string getDebugDescription(
|
inline std::string getDebugDescription(
|
||||||
float number,
|
float number,
|
||||||
DebugStringConvertibleOptions options = {}) {
|
DebugStringConvertibleOptions options) {
|
||||||
return toString(number);
|
return toString(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
// `double`
|
// `double`
|
||||||
inline std::string getDebugDescription(
|
inline std::string getDebugDescription(
|
||||||
double number,
|
double number,
|
||||||
DebugStringConvertibleOptions options = {}) {
|
DebugStringConvertibleOptions options) {
|
||||||
return toString(number);
|
return toString(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
// `bool`
|
// `bool`
|
||||||
inline std::string getDebugDescription(
|
inline std::string getDebugDescription(
|
||||||
bool boolean,
|
bool boolean,
|
||||||
DebugStringConvertibleOptions options = {}) {
|
DebugStringConvertibleOptions options) {
|
||||||
return toString(boolean);
|
return toString(boolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
// `void *`
|
// `void *`
|
||||||
inline std::string getDebugDescription(
|
inline std::string getDebugDescription(
|
||||||
void *pointer,
|
void *pointer,
|
||||||
DebugStringConvertibleOptions options = {}) {
|
DebugStringConvertibleOptions options) {
|
||||||
return toString(pointer);
|
return toString(pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// `std::string`
|
// `std::string`
|
||||||
inline std::string getDebugDescription(
|
inline std::string getDebugDescription(
|
||||||
std::string const &string,
|
std::string const &string,
|
||||||
DebugStringConvertibleOptions options = {}) {
|
DebugStringConvertibleOptions options) {
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +296,9 @@ std::string getDebugName(std::vector<T, Ts...> const &vector) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename... Ts>
|
template <typename T, typename... Ts>
|
||||||
std::vector<T, Ts...> getDebugChildren(std::vector<T, Ts...> const &vector) {
|
std::vector<T, Ts...> getDebugChildren(
|
||||||
|
std::vector<T, Ts...> const &vector,
|
||||||
|
DebugStringConvertibleOptions options) {
|
||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +309,9 @@ std::string getDebugName(std::unordered_set<T, Ts...> const &set) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename... Ts>
|
template <typename T, typename... Ts>
|
||||||
std::vector<T> getDebugChildren(std::unordered_set<T, Ts...> const &set) {
|
std::vector<T> getDebugChildren(
|
||||||
|
std::unordered_set<T, Ts...> const &set,
|
||||||
|
DebugStringConvertibleOptions options) {
|
||||||
auto vector = std::vector<T>{};
|
auto vector = std::vector<T>{};
|
||||||
vector.insert(vector.end(), set.begin(), set.end());
|
vector.insert(vector.end(), set.begin(), set.end());
|
||||||
return vector;
|
return vector;
|
||||||
|
@ -313,24 +321,24 @@ std::vector<T> getDebugChildren(std::unordered_set<T, Ts...> const &set) {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline std::string getDebugDescription(
|
inline std::string getDebugDescription(
|
||||||
std::shared_ptr<T> const &pointer,
|
std::shared_ptr<T> const &pointer,
|
||||||
DebugStringConvertibleOptions options = {}) {
|
DebugStringConvertibleOptions options) {
|
||||||
return getDebugDescription((void *)pointer.get()) + "(shared)";
|
return getDebugDescription((void *)pointer.get(), options) + "(shared)";
|
||||||
}
|
}
|
||||||
|
|
||||||
// `std::weak_ptr<T>`
|
// `std::weak_ptr<T>`
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline std::string getDebugDescription(
|
inline std::string getDebugDescription(
|
||||||
std::weak_ptr<T> const &pointer,
|
std::weak_ptr<T> const &pointer,
|
||||||
DebugStringConvertibleOptions options = {}) {
|
DebugStringConvertibleOptions options) {
|
||||||
return getDebugDescription((void *)pointer.lock().get()) + "(weak)";
|
return getDebugDescription((void *)pointer.lock().get(), options) + "(weak)";
|
||||||
}
|
}
|
||||||
|
|
||||||
// `std::unique_ptr<T>`
|
// `std::unique_ptr<T>`
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline std::string getDebugDescription(
|
inline std::string getDebugDescription(
|
||||||
std::unique_ptr<T const> const &pointer,
|
std::unique_ptr<T const> const &pointer,
|
||||||
DebugStringConvertibleOptions options = {}) {
|
DebugStringConvertibleOptions options) {
|
||||||
return getDebugDescription((void *)pointer.get()) + "(unique)";
|
return getDebugDescription((void *)pointer.get(), options) + "(unique)";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -100,7 +100,7 @@ better::optional<MountingTransaction> MountingCoordinator::pullTransaction()
|
||||||
<< "\n";
|
<< "\n";
|
||||||
LOG(ERROR) << "Mutations:"
|
LOG(ERROR) << "Mutations:"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< getDebugDescription(mutations);
|
<< getDebugDescription(mutations, {});
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -53,7 +53,7 @@ struct ShadowView final {
|
||||||
std::string getDebugName(ShadowView const &object);
|
std::string getDebugName(ShadowView const &object);
|
||||||
std::vector<DebugStringConvertibleObject> getDebugProps(
|
std::vector<DebugStringConvertibleObject> getDebugProps(
|
||||||
ShadowView const &object,
|
ShadowView const &object,
|
||||||
DebugStringConvertibleOptions options = {});
|
DebugStringConvertibleOptions options);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ using ShadowViewMutationList = std::vector<ShadowViewMutation>;
|
||||||
std::string getDebugName(ShadowViewMutation const &object);
|
std::string getDebugName(ShadowViewMutation const &object);
|
||||||
std::vector<DebugStringConvertibleObject> getDebugProps(
|
std::vector<DebugStringConvertibleObject> getDebugProps(
|
||||||
ShadowViewMutation const &object,
|
ShadowViewMutation const &object,
|
||||||
DebugStringConvertibleOptions options = {});
|
DebugStringConvertibleOptions options);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,10 @@ bool operator!=(StubView const &lhs, StubView const &rhs);
|
||||||
std::string getDebugName(StubView const &stubView);
|
std::string getDebugName(StubView const &stubView);
|
||||||
std::vector<DebugStringConvertibleObject> getDebugProps(
|
std::vector<DebugStringConvertibleObject> getDebugProps(
|
||||||
StubView const &stubView,
|
StubView const &stubView,
|
||||||
DebugStringConvertibleOptions options = {});
|
DebugStringConvertibleOptions options);
|
||||||
std::vector<StubView> getDebugChildren(
|
std::vector<StubView> getDebugChildren(
|
||||||
StubView const &stubView,
|
StubView const &stubView,
|
||||||
DebugStringConvertibleOptions options = {});
|
DebugStringConvertibleOptions options);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче