Skip to content

Go to Definition in #included TableGen files #1

Open
@lenary

Description

@lenary

I am not sure if this is a bug or not, or whether I'm using the tablegen language server incorrectly.

I modified the LLVM CMake to generate an entry in tablegen_compile_commands.yml for every single tablegen'd file. This contains duplicates (as the one on main does if you build and include MLIR in the enabled projects), but all duplicates have the same include list.

I'm working on the AArch64 backend (in llvm-project/llvm/lib/Target/AArch64), and I don't think that "Go To Definition" works in some cases.

For instance:

  • In AArch64.td, trying "Go To Definition" on SubtargetFeature<... correctly takes me to the definition of SubtargetFeature in Target.td.
  • In AArch64InstrInfo.td, trying "Go To Definition" on anything doesn't work (I also get a problem on the first definition of not being able to find the class). The same applies in e.g. AArch64SystemOperands.td There are not filepath: entries for these files, because they are not passed to llvm-tblgen directly.

Is this because the extension doesn't cope well with how LLVM normally structures the tablegen in backends? For instance, in the AArch64 backend, AArch64.td contains a few definitions, and then a lot of #include for the other AArch64*.td files, and it is only AArch64.td which is run through llvm-tblgen. Some of the definitions in the AArch64*.td files rely on definitions in AArch64.td, but do not #include that file because the inclusions go in the other direction.

Presumably there are methods to solve this, as C/C++ plugins do cope with definitions/declarations in header files (which do not normally show up in a compile_commands.json), but I don't know how complex that would be to implement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions