Fix incorrect template argument kind - #578
Conversation
tannergooding
left a comment
There was a problem hiding this comment.
This is a good fix, but ideally we'd allow the devs a way to get TemplateArgument::StructuralValue returned as well.
There's many "gaps" like this that I've had to polyfill for libClang, often by defining some new enum and APIs for querying the information.
Indeed, I didn't want to add new enum to avoid breaking changes. The new test is failing on CI because |
The general issue is that building There's potentially some caching or similar that could be done, but the download would still be fairly large/expensive and its not something I've had time to investigate yet. I do need to update |
|
I've added |
This PR fixes wrong template argument kinds being returned from
MakeCXTemplateArgument().It turns out that
TemplateArgument::ArgKindandCXTemplateArgumentKindhave different values, withStructuralValuepresent in the former but not the latter.LLVM maps this explicitly: https://github.com/llvm/llvm-project/blob/00a1f1ab71302d190f8059d86a53ec62485fbce9/clang/tools/libclang/CXCursor.cpp#L1474-L1506. This PR now does the same.
I've found this issue while trying to read elements from a parameter pack (
std::tuple).TemplateArgument::Packin this case was mapped directly toCXTemplateArgumentKind::Invalid, making it impossible to retrieve the underlying elements.A unit test has been added for this case.