mgorny updated this revision to Diff 191124. mgorny added a comment. Does this look right? I've added temporary `*2` versions of the macros to make it build without having to port everything. If it looks fine, I'll go with other files.
CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59427/new/ https://reviews.llvm.org/D59427 Files: lldb/include/lldb/Utility/ReproducerInstrumentation.h lldb/source/API/SBAddress.cpp lldb/source/API/SBReproducer.cpp lldb/source/API/SBReproducerPrivate.h
Index: lldb/source/API/SBReproducerPrivate.h =================================================================== --- lldb/source/API/SBReproducerPrivate.h +++ lldb/source/API/SBReproducerPrivate.h @@ -69,6 +69,8 @@ return {}; } +template <typename T> void RegisterMethods(Registry &R); + } // namespace repro } // namespace lldb_private Index: lldb/source/API/SBReproducer.cpp =================================================================== --- lldb/source/API/SBReproducer.cpp +++ lldb/source/API/SBReproducer.cpp @@ -42,6 +42,7 @@ } SBRegistry::SBRegistry() { + Registry& R = *this; // Custom implementation. Register(&invoke<void (SBDebugger::*)( @@ -54,36 +55,7 @@ &SBDebugger::GetDefaultArchitecture), &GetDefaultArchitectureRedirect); - { - LLDB_REGISTER_CONSTRUCTOR(SBAddress, ()); - LLDB_REGISTER_CONSTRUCTOR(SBAddress, (const lldb::SBAddress &)); - LLDB_REGISTER_CONSTRUCTOR(SBAddress, (lldb::SBSection, lldb::addr_t)); - LLDB_REGISTER_CONSTRUCTOR(SBAddress, (lldb::addr_t, lldb::SBTarget &)); - LLDB_REGISTER_METHOD(const lldb::SBAddress &, - SBAddress, operator=,(const lldb::SBAddress &)); - LLDB_REGISTER_METHOD_CONST(bool, SBAddress, IsValid, ()); - LLDB_REGISTER_METHOD_CONST(bool, SBAddress, operator bool, ()); - LLDB_REGISTER_METHOD(void, SBAddress, Clear, ()); - LLDB_REGISTER_METHOD(void, SBAddress, SetAddress, - (lldb::SBSection, lldb::addr_t)); - LLDB_REGISTER_METHOD_CONST(lldb::addr_t, SBAddress, GetFileAddress, ()); - LLDB_REGISTER_METHOD_CONST(lldb::addr_t, SBAddress, GetLoadAddress, - (const lldb::SBTarget &)); - LLDB_REGISTER_METHOD(void, SBAddress, SetLoadAddress, - (lldb::addr_t, lldb::SBTarget &)); - LLDB_REGISTER_METHOD(bool, SBAddress, OffsetAddress, (lldb::addr_t)); - LLDB_REGISTER_METHOD(lldb::SBSection, SBAddress, GetSection, ()); - LLDB_REGISTER_METHOD(lldb::addr_t, SBAddress, GetOffset, ()); - LLDB_REGISTER_METHOD(bool, SBAddress, GetDescription, (lldb::SBStream &)); - LLDB_REGISTER_METHOD(lldb::SBModule, SBAddress, GetModule, ()); - LLDB_REGISTER_METHOD(lldb::SBSymbolContext, SBAddress, GetSymbolContext, - (uint32_t)); - LLDB_REGISTER_METHOD(lldb::SBCompileUnit, SBAddress, GetCompileUnit, ()); - LLDB_REGISTER_METHOD(lldb::SBFunction, SBAddress, GetFunction, ()); - LLDB_REGISTER_METHOD(lldb::SBBlock, SBAddress, GetBlock, ()); - LLDB_REGISTER_METHOD(lldb::SBSymbol, SBAddress, GetSymbol, ()); - LLDB_REGISTER_METHOD(lldb::SBLineEntry, SBAddress, GetLineEntry, ()); - } + RegisterMethods<SBAddress>(R); { LLDB_REGISTER_CONSTRUCTOR(SBAttachInfo, ()); LLDB_REGISTER_CONSTRUCTOR(SBAttachInfo, (lldb::pid_t)); Index: lldb/source/API/SBAddress.cpp =================================================================== --- lldb/source/API/SBAddress.cpp +++ lldb/source/API/SBAddress.cpp @@ -282,3 +282,41 @@ } return LLDB_RECORD_RESULT(sb_line_entry); } + +namespace lldb_private { +namespace repro { + +template <> +void RegisterMethods<SBAddress>(Registry &R) { + LLDB_REGISTER_CONSTRUCTOR2(SBAddress, ()); + LLDB_REGISTER_CONSTRUCTOR2(SBAddress, (const lldb::SBAddress &)); + LLDB_REGISTER_CONSTRUCTOR2(SBAddress, (lldb::SBSection, lldb::addr_t)); + LLDB_REGISTER_CONSTRUCTOR2(SBAddress, (lldb::addr_t, lldb::SBTarget &)); + LLDB_REGISTER_METHOD2(const lldb::SBAddress &, + SBAddress, operator=,(const lldb::SBAddress &)); + LLDB_REGISTER_METHOD_CONST2(bool, SBAddress, IsValid, ()); + LLDB_REGISTER_METHOD_CONST2(bool, SBAddress, operator bool, ()); + LLDB_REGISTER_METHOD2(void, SBAddress, Clear, ()); + LLDB_REGISTER_METHOD2(void, SBAddress, SetAddress, + (lldb::SBSection, lldb::addr_t)); + LLDB_REGISTER_METHOD_CONST2(lldb::addr_t, SBAddress, GetFileAddress, ()); + LLDB_REGISTER_METHOD_CONST2(lldb::addr_t, SBAddress, GetLoadAddress, + (const lldb::SBTarget &)); + LLDB_REGISTER_METHOD2(void, SBAddress, SetLoadAddress, + (lldb::addr_t, lldb::SBTarget &)); + LLDB_REGISTER_METHOD2(bool, SBAddress, OffsetAddress, (lldb::addr_t)); + LLDB_REGISTER_METHOD2(lldb::SBSection, SBAddress, GetSection, ()); + LLDB_REGISTER_METHOD2(lldb::addr_t, SBAddress, GetOffset, ()); + LLDB_REGISTER_METHOD2(bool, SBAddress, GetDescription, (lldb::SBStream &)); + LLDB_REGISTER_METHOD2(lldb::SBModule, SBAddress, GetModule, ()); + LLDB_REGISTER_METHOD2(lldb::SBSymbolContext, SBAddress, GetSymbolContext, + (uint32_t)); + LLDB_REGISTER_METHOD2(lldb::SBCompileUnit, SBAddress, GetCompileUnit, ()); + LLDB_REGISTER_METHOD2(lldb::SBFunction, SBAddress, GetFunction, ()); + LLDB_REGISTER_METHOD2(lldb::SBBlock, SBAddress, GetBlock, ()); + LLDB_REGISTER_METHOD2(lldb::SBSymbol, SBAddress, GetSymbol, ()); + LLDB_REGISTER_METHOD2(lldb::SBLineEntry, SBAddress, GetLineEntry, ()); +} + +} +} Index: lldb/include/lldb/Utility/ReproducerInstrumentation.h =================================================================== --- lldb/include/lldb/Utility/ReproducerInstrumentation.h +++ lldb/include/lldb/Utility/ReproducerInstrumentation.h @@ -82,6 +82,22 @@ Register<Result Signature>(static_cast<Result(*) Signature>(&Class::Method), \ #Result, #Class, #Method, #Signature) +// temporary transition macros +#define LLDB_REGISTER_CONSTRUCTOR2(Class, Signature) \ + R.Register<Class * Signature>(&construct<Class Signature>::doit, "", #Class, \ + #Class, #Signature) +#define LLDB_REGISTER_METHOD2(Result, Class, Method, Signature) \ + R.Register( \ + &invoke<Result(Class::*) Signature>::method<(&Class::Method)>::doit, \ + #Result, #Class, #Method, #Signature) +#define LLDB_REGISTER_METHOD_CONST2(Result, Class, Method, Signature) \ + R.Register(&invoke<Result(Class::*) \ + Signature const>::method_const<(&Class::Method)>::doit, \ + #Result, #Class, #Method, #Signature) +#define LLDB_REGISTER_STATIC_METHOD2(Result, Class, Method, Signature) \ + R.Register<Result Signature>(static_cast<Result(*) Signature>(&Class::Method), \ + #Result, #Class, #Method, #Signature) + #define LLDB_RECORD_CONSTRUCTOR(Class, Signature, ...) \ LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API), "{0} ({1})", \ LLVM_PRETTY_FUNCTION, log_args(__VA_ARGS__)); \
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits