[all-commits] [llvm/llvm-project] 94ae3d: [clangd] Fix unknown doxygen command parsing in pa...
tcottin via All-commits
all-commits at lists.llvm.org
Thu Jun 25 05:22:06 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 94ae3dd241ad9f1d8cf11720fadd68b50236d4f9
https://github.com/llvm/llvm-project/commit/94ae3dd241ad9f1d8cf11720fadd68b50236d4f9
Author: tcottin <timcottin at gmx.de>
Date: 2026-06-25 (Thu, 25 Jun 2026)
Changed paths:
M clang-tools-extra/clangd/CodeCompletionStrings.cpp
M clang-tools-extra/clangd/SymbolDocumentation.cpp
M clang-tools-extra/clangd/SymbolDocumentation.h
M clang-tools-extra/clangd/support/Markup.cpp
M clang-tools-extra/clangd/unittests/CodeCompletionStringsTests.cpp
M clang-tools-extra/clangd/unittests/HoverTests.cpp
M clang-tools-extra/clangd/unittests/SymbolDocumentationTests.cpp
M clang/include/clang/AST/Comment.h
M clang/include/clang/AST/CommentLexer.h
M clang/include/clang/AST/CommentSema.h
M clang/lib/AST/CommentLexer.cpp
M clang/lib/AST/CommentParser.cpp
M clang/lib/AST/CommentSema.cpp
M clang/unittests/AST/CommentLexer.cpp
Log Message:
-----------
[clangd] Fix unknown doxygen command parsing in parameter documentation (#202121)
This patch mainly fixes a bug with parsing of unknown doxygen commands
in function parameter documentation.
To extract the parameter documentation from the function documentation,
the whole function documentation is parsed first.
Then the documentation paragraph for the requested parameter is
"converted" to a string and stored as the documentation for the
parameter. The string is converted by visiting and dumping all chunks of
the parsed paragraph.
When unknown doxygen commands are parsed (during the function
documentation parsing step), they are registered in a
`clang::comments::CommandTraits` object.
Visiting the unknown command requires to query the registered commands
through the `clang::comments::CommandTraits` object to get the command
name.
The bug was that the function documentation parsing and the visiting
step used 2 different `clang::comments::CommandTraits` objects. Hence
the visiting step fails (array access out of bounds) when trying to
retrieve the command names for unknown commands.
The patch moves the function documentation parsing step to the
construction of the `SymbolDocCommentVisitor` which is also responsible
for converting the parameter documentation paragraph to a string.
This way the same `clang::comments::CommandTraits` is used and the query
for unknown command names is correct.
Additional fixes:
- correct some whitespace behaviour for doxygen inline commands
- add a new token kind for the clang comment parser to distinguish
unknown "backslash" and "at" commands to correctly show them in the
clangd hover info
Related issue: clangd/clangd#2671
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list