[PATCH] D111711: [clangd] IncludeCleaner: Don't consider the definition as usage for function forward declarations

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 26 01:17:32 PDT 2021


kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

thanks, lgtm!



================
Comment at: clang-tools-extra/clangd/IncludeCleaner.cpp:42
 
+  bool VisitFunctionDecl(FunctionDecl *FD) {
+    // Function definition will require redeclarations to be included.
----------------
i've got a feeling that this might have nasty side effects in the presence of functions with defaulted-arguments, but they're pretty obscure (like declare a function with a default parameter in a header, then in the main file both include the header and have a forward declaration of the function, now that forward declaration can't have the default parameter because the one in the header has. but who does that really). so i suppose it won't result in any false positives in practice.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111711



More information about the cfe-commits mailing list