Modifies clang_Cursor_getNumTemplateArguments() and friends to work on Struct, Class and ClassTemplatePartialSpecialization decls as well as functions
Hello again, this generalizes the template argument functionality to operate on cursor kinds other than functions.
I could use some help creating a test for this. On my previous patch I was able to just copy/paste and modify an existing test, but from a quick scan of the current tests I can't see how I'd modify one of them to test this functionality.
Mostly nits from me (FWIW, we use auto when the type is explicitly spelled out in the initialization and we don't usually use else after an unconditional return as a matter of coding style.) In terms of the test coverage, I would probably make a new test modeled after https://github.com/llvm/llvm-project/blob/main/clang/test/Index/cxx14-lambdas.cpp.
Since we're in the area already...
CXCursor_StructDecl is interesting -- does that only get used in C or will it also show up in C++? If it's C-only, we can drop that bit.
Same question here about struct decl as above.
I ended up modifying c-index-test to print out the template arguments in the same way it does for FunctionDecl, which ends up working all cases in the existing test suite. The only other thing I added was a specific case in index-templates.cpp to check whether it catches StructDecl too (it does).
It does. I added a case to index-templates.cpp that tests for this.
LGTM! I can fix up the minor nit with the release note formatting when I land on your behalf.