[PATCH] D114864: [clangd] IncludeClenaer: Don't mark forward declarations of a class if it's declared in the main file

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 2 01:03:55 PST 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:131
+      const auto *MostRecent = RD->getMostRecentDecl();
+      if (SM.isInMainFile(MostRecent->getBeginLoc())) {
+        if (const auto *Definition = RD->getDefinition())
----------------
nit: I'd just inline `RD->getMostRecentDecl()` here.


================
Comment at: clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp:42
       },
+      {
+          "class ^X {}; class ^X;",
----------------
might be worth having a fixme comment here (around we should ignore all re-decls when we can see a def)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114864



More information about the cfe-commits mailing list