mgorny updated this revision to Diff 191125. mgorny added a comment. Hmm, actually with that local `R` declaration I don't have to have an additional set of macros ;-).
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_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, + (uint3_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, ()); +} + +} +} Index: lldb/include/lldb/Utility/ReproducerInstrumentation.h =================================================================== --- lldb/include/lldb/Utility/ReproducerInstrumentation.h +++ lldb/include/lldb/Utility/ReproducerInstrumentation.h @@ -68,18 +68,18 @@ // #define LLDB_REPRO_INSTR_TRACE #define LLDB_REGISTER_CONSTRUCTOR(Class, Signature) \ - Register<Class * Signature>(&construct<Class Signature>::doit, "", #Class, \ + R.Register<Class * Signature>(&construct<Class Signature>::doit, "", #Class, \ #Class, #Signature) #define LLDB_REGISTER_METHOD(Result, Class, Method, Signature) \ - Register( \ + R.Register( \ &invoke<Result(Class::*) Signature>::method<(&Class::Method)>::doit, \ #Result, #Class, #Method, #Signature) #define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature) \ - Register(&invoke<Result(Class::*) \ + R.Register(&invoke<Result(Class::*) \ Signature const>::method_const<(&Class::Method)>::doit, \ #Result, #Class, #Method, #Signature) #define LLDB_REGISTER_STATIC_METHOD(Result, Class, Method, Signature) \ - Register<Result Signature>(static_cast<Result(*) Signature>(&Class::Method), \ + R.Register<Result Signature>(static_cast<Result(*) Signature>(&Class::Method), \ #Result, #Class, #Method, #Signature) #define LLDB_RECORD_CONSTRUCTOR(Class, Signature, ...) \
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits