[PATCH] D140275: [clangd] Tweak to add doxygen comment to the function declaration

David Goldman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 12 17:23:24 PST 2023


dgoldman added inline comments.


================
Comment at: clang-tools-extra/clangd/refactor/tweaks/AddDoxygenComment.cpp:37
+//    * @param bar
+//    * @return
+//    */
----------------
sammccall wrote:
> I'm a bit concerned about people generating these `@param bar` and `@return` and leaving them there without filling them in - I've seen plenty of code like that and it's substantially worse than no comments at all.
> 
> I'm not sure we can do much though: could generate `@return TODO` or so to make it more visually obvious - WDYT?
VS Code itself has support for snippets - https://code.visualstudio.com/api/references/vscode-api#TextEditor - insertSnippet - but the LSP spec doesn't yet. Once it has it I think it would makes sense to use them here, but until then, TODO seems like the best we can do?


================
Comment at: clang-tools-extra/clangd/refactor/tweaks/AddDoxygenComment.cpp:74
+bool AddDoxygenComment::prepare(const Selection &Inputs) {
+  if (!Inputs.AST->getLangOpts().CPlusPlus) {
+    return false;
----------------
sammccall wrote:
> why? doxygen supports C AFAIK
Would also be nice to support ObjC too, we'll just need to add support for ObjCMethodDecl as well to expand support for ObjC methods.  (https://clang.llvm.org/doxygen/classclang_1_1ObjCMethodDecl.html vs https://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html) But even if that's not done in this diff, still seems fine to enable it generally?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140275/new/

https://reviews.llvm.org/D140275



More information about the cfe-commits mailing list