[Lldb-commits] [PATCH] D150485: [lldb] Add support for negative integer to {SB, }StructuredData

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon May 15 13:48:06 PDT 2023


JDevlieghere added inline comments.


================
Comment at: lldb/include/lldb/API/SBStructuredData.h:70
   /// Return the integer value if this data structure is an integer type.
-  uint64_t GetIntegerValue(uint64_t fail_value = 0) const;
+  template <typename T> T GetIntegerValue(T fail_value = {}) const {
+    if constexpr (!std::is_integral_v<T>)
----------------
bulbazord wrote:
> > All the SB API classes are non-virtual, single inheritance classes. They should only include SBDefines.h or other SB headers as needed. **There should be no inlined method implementations in the header files, they should all be in the implementation files**. And there should be no direct ivar access.
> 
> Emphasis mine, from: https://lldb.llvm.org/design/sbapi.html
> 
> We should be able to move this into the implementation file.
I'm open to the idea of adding templates to the SB API, but I think that will require careful considerations in terms of impact on the ABI, the bindings, etc. I'm not convinced this use case really warrants that: it looks like there's only really two meaningful instantiations. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150485/new/

https://reviews.llvm.org/D150485



More information about the lldb-commits mailing list