mib added a comment.
Very cool stuff!
================
Comment at: lldb/include/lldb/Interpreter/OptionValue.h:325-344
+ template <typename T,
+ std::enable_if_t<!std::is_pointer<T>::value, bool> = true>
+ std::optional<T> GetValueAs() const {
+ if constexpr (std::is_same_v<T, uint64_t>)
+ return GetUInt64Value();
+ if constexpr (std::is_same_v<T, int64_t>)
+ return GetSInt64Value();
----------------
nit: In the template argument, you use `std::is_pointer<T>::value` instead of
`std::is_pointer_v<T>` and the in the if statement you do the opposite
(`std::is_same_v<T>` vs `std::is_same<T>::value`). I personally not a fan of
the `_v` alias but what I'm saying here is it would be good to stay consistent.
================
Comment at: lldb/include/lldb/Interpreter/OptionValueProperties.h:162-173
+ template <typename T>
+ auto GetPropertyAtIndexAs(uint32_t idx,
+ const ExecutionContext *exe_ctx = nullptr) const {
+ if (const Property *property = GetPropertyAtIndex(idx, exe_ctx)) {
+ if (OptionValue *value = property->GetValue().get())
+ return value->GetValueAs<T>();
+ }
----------------
Very interesting!
================
Comment at: lldb/source/Interpreter/Property.cpp:229
}
+ assert(m_value_sp && "invalid property definition");
}
----------------
May be we should print a warning or error to the user ?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149774/new/
https://reviews.llvm.org/D149774
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits