[clang] [clang-tools-extra] [llvm] [clangd] introduce doxygen parser (PR #150790)

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 6 07:08:11 PDT 2025


================
@@ -100,7 +101,19 @@ std::string getDeclComment(const ASTContext &Ctx, const NamedDecl &Decl) {
     // the comments for namespaces.
     return "";
   }
-  const RawComment *RC = getCompletionComment(Ctx, &Decl);
+
+  const RawComment *RC = nullptr;
+  const Config &Cfg = Config::current();
+
+  if (Cfg.Documentation.CommentFormat == Config::CommentFormatPolicy::Doxygen &&
+      isa<ParmVarDecl>(Decl)) {
+    // Parameters are documented in the function comment.
+    if (const auto *FD = dyn_cast<FunctionDecl>(Decl.getDeclContext()))
----------------
tcottin wrote:

Instead of casting to `FunctionDecl` I use `NamedDecl` now.
This also works for function templates

https://github.com/llvm/llvm-project/pull/150790


More information about the llvm-commits mailing list