Skip to content

Location of templates should refer to templated declaration #1070

@alandefreitas

Description

@alandefreitas

When the function or record is a template, the location we extract refers to the template rather than the name in the templated declaration.

So, while for any other symbol the location points to the symbol name, as in this warning:

/__w/mrdocs/mrdocs/beman-optional/include/beman/optional/optional.hpp:105:22:
    1) beman::optional::nullopt_t::Tag::tag: Missing documentation for enum value
  105 |     enum class Tag { tag };
      |                      ^~~~~~

The location of templates refers to the template declaration, as in this warning:

    1) beman::optional::optional::or_else: Missing documentation for parameter 'f'
  1807 |     template <class F>
       |     ^~~~~~~~~~~~~~~~~~

To fix this, when the Decl is a template, we would need to use the Decl for the templated declaration instead of the Decl for the template declaration in:

ASTVisitor::populate(SourceInfo& I, DeclTy const* D)

before calling:

ASTVisitor::populate(SourceInfo& I, clang::SourceLocation const loc, bool const definition, bool const documented)

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