You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[clang] Clang doesn't support parsing Doxygen group comments #151184
Clang currently doesn’t support Doxygen grouping in its comment parsing. Member groups allow for declarations to be specially grouped in documentation under the same heading or to share the same documentation. Grouping is fairly common in Clang and LLVM and Clang-Doc’s documentation would benefit from being able to display them. Grouping is fairly complex and there are a few variations, so an initial implementation should focus on member grouping first, and incorporate more functionality over time.
func1 and func2 will then be grouped under the heading “Group” in documentation while retaining their own documentation. See sys::path for examples in documentation ("Lexical Component Iterator", etc).
To implement this, Clang would need to recognize the special command’s start and ending (\{ and ‘}), the \name` command, and then be able to track the declarations within those braces. It would also need to keep track of the context when parsing other comments (i.e. know that we encountered an opening brace for some other declaration and now we found a closing one, then group or mark those declarations). At a glance, it seems like marking or grouping these declarations somewhere during comment parsing would be the most difficult part of this.
/// \{
/// This comment is associated with Foo in the AST.
class Foo;
/// \}
///This comment is associated with Bar in the AST.
class Bar;
cc @AaronBallman if you have any intuition on what direction the implementation should take, that would be helpful. When we talked in your office hours, I think we talked about adding extra comment AST nodes, but I'm not sure that would be sufficient for tracking the declarations.
Details
Clang currently doesn’t support Doxygen grouping in its comment parsing. Member groups allow for declarations to be specially grouped in documentation under the same heading or to share the same documentation. Grouping is fairly common in Clang and LLVM and Clang-Doc’s documentation would benefit from being able to display them. Grouping is fairly complex and there are a few variations, so an initial implementation should focus on member grouping first, and incorporate more functionality over time.
func1 and func2 will then be grouped under the heading “Group” in documentation while retaining their own documentation. See sys::path for examples in documentation ("Lexical Component Iterator", etc).
To implement this, Clang would need to recognize the special command’s start and ending (\{ and ‘}), the \name` command, and then be able to track the declarations within those braces. It would also need to keep track of the context when parsing other comments (i.e. know that we encountered an opening brace for some other declaration and now we found a closing one, then group or mark those declarations). At a glance, it seems like marking or grouping these declarations somewhere during comment parsing would be the most difficult part of this.
/// \{
/// This comment is associated with Foo in the AST.
class Foo;
/// \}
///This comment is associated with Bar in the AST.
class Bar;
cc @AaronBallman if you have any intuition on what direction the implementation should take, that would be helpful. When we talked in your office hours, I think we talked about adding extra comment AST nodes, but I'm not sure that would be sufficient for tracking the declarations.
Off the top of my head, I would imagine that the doxygen comment parser would need to recognize the /// \{, create a new AST node representing the group and push it on a stack (possibly on Sema or ASTContext?), then attach comments + declarations to whatever is on the top of that stack. When hitting the /// \}, we'd pop the top item of the stack and "finalize" the group if needed. We'd have to be careful of mismatched groups (close with no open, open with no close) and probably warn on those with some reasonable fallback behavior. But that's just a gut feeling, perhaps there's a better design approach.
Activity
evelez7 commentedon Jul 29, 2025
cc @AaronBallman if you have any intuition on what direction the implementation should take, that would be helpful. When we talked in your office hours, I think we talked about adding extra comment AST nodes, but I'm not sure that would be sufficient for tracking the declarations.
cc @ilovepi
llvmbot commentedon Jul 29, 2025
@llvm/issue-subscribers-clang-frontend
Author: Erick Velez (evelez7)
Details
Clang currently doesn’t support Doxygen grouping in its comment parsing. Member groups allow for declarations to be specially grouped in documentation under the same heading or to share the same documentation. Grouping is fairly common in Clang and LLVM and Clang-Doc’s documentation would benefit from being able to display them. Grouping is fairly complex and there are a few variations, so an initial implementation should focus on member grouping first, and incorporate more functionality over time.Doxygen grouping looks like the following:
func1 and func2 will then be grouped under the heading “Group” in documentation while retaining their own documentation. See sys::path for examples in documentation ("Lexical Component Iterator", etc).
To implement this, Clang would need to recognize the special command’s start and ending (
\{and ‘}), the\name` command, and then be able to track the declarations within those braces. It would also need to keep track of the context when parsing other comments (i.e. know that we encountered an opening brace for some other declaration and now we found a closing one, then group or mark those declarations). At a glance, it seems like marking or grouping these declarations somewhere during comment parsing would be the most difficult part of this.AaronBallman commentedon Jul 29, 2025
Off the top of my head, I would imagine that the doxygen comment parser would need to recognize the
/// \{, create a new AST node representing the group and push it on a stack (possibly onSemaorASTContext?), then attach comments + declarations to whatever is on the top of that stack. When hitting the/// \}, we'd pop the top item of the stack and "finalize" the group if needed. We'd have to be careful of mismatched groups (close with no open, open with no close) and probably warn on those with some reasonable fallback behavior. But that's just a gut feeling, perhaps there's a better design approach.