MochiLibraries / Biohazrd

A framework for automatically generating binding wrappers for C/C++ libraries
MIT License
60 stars 8 forks source link

Investigate extracting parameter names from comments #90

Open PathogenDavid opened 3 years ago

PathogenDavid commented 3 years ago

To avoid unused parameter warnings, C++ developers sometimes leave parameters unnamed and put the name in a comment, for example:

virtual void attachToContext(cudnnContext* /*cudnn*/, cublasContext* /*cublas*/, IGpuAllocator* /*allocator*/) TRTNOEXCEPT {}

It might be nice if we could find the commented name and surface it somehow. Unfortunately Clang's comment-to-declaration association logic does not attach these comments to the ParmVarDecl declarations, so we can't rely on that.

PathogenDavid commented 3 years ago

The newly added AutoNameUnnamedParametersTransformation makes this situation slightly less obnoxious. I do still want to investigate whether Clang automagically associates these comments with the parameter or not. (Maybe at the same time as https://github.com/InfectedLibraries/Biohazrd/issues/20)