[Lldb-commits] [PATCH] D108090: [lldb/lua] Supplement Lua bindings for lldb module

Siger Young via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 9 10:58:55 PDT 2021

siger-young added inline comments.

Comment at: lldb/bindings/lua/lua-typemaps.swig:219-221
+%typecheck(SWIG_TYPECHECK_STRING_ARRAY) char ** {
+   $1 = (lua_istable(L, $input) || lua_isnil(L, $input));
tammela wrote:
> This is not being generated by SWIG for some reason.
> I think it's more readable to just have an else clause that raises an error on line 212.
I tried commenting and uncommenting these lines then diff, found that the typecheck is actually generated on those overloaded functions. `SBTarget::Launch` no longer works after commenting in my cases:
lua5.3: test.lua:27: Wrong arguments for overloaded function 'SBTarget_Launch'
  Possible C/C++ prototypes are:
    lldb::SBTarget::Launch(lldb::SBListener &,char const **,char const **,char const *,char const *,char const *,char const *,uint32_t,bool,lldb::SBError &)
    lldb::SBTarget::Launch(lldb::SBLaunchInfo &,lldb::SBError &)

It seems that SWIG uses "SWIG_isptrtype" to decide arg matches "char**", so this typecheck is necessary.

For those functions with just one definition (i.e. not overloaded), this typecheck does nothing on them, so it will be `typemap(in)`'s responsibility to check arg types.

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list