microsoft / microsoft/DirectXShaderCompiler

IDxcCursor does not support template parameter and template argument querying

Open
#5,175 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Upstream libclang provides CXCursor functionality to query template parameters and template arguments using clang_Cursor_getNumTemplateArguments, clang_Cursor_getTemplateArgumentKind, clang_Cursor_getTemplateArgumentUnsignedValue and clang_Cursor_getTemplateArgumentValue. (see for example, https://clang.llvm.org/doxygen/group__CINDEX__TYPES.html#ga08dac49044448c022457224e73223eb2).

Until Sept 2022, the functionality above was restricted in libclang to function templates but this was since extended to include class templates and partial specializations. This is the CR in question: https://reviews.llvm.org/D134416.

I made a modest attempt at porting these changes and extending the IDxcCursor interface, but I noticed that the cursor kinds itself doesn't match what I expect so I suspect that the synthesized AST node types have diverged somewhat from upstream LLVM.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the IDxcCursor interface and compare its cursor kinds and template-query behavior with the upstream libclang APIs named in the issue. Inspect how synthesized AST node types map to those cursor kinds; done when template parameter and argument queries work for class templates and partial specializations.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.