[PATCH] D157610: [include-cleaner][clangd][clang-tidy] Ignore resource dir during include-cleaner analysis.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 10:13:46 PDT 2023


kadircet added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp:122
   llvm::DenseSet<include_cleaner::Symbol> SeenSymbols;
+  std::string ResourceDir = HS->getHeaderSearchOpts().ResourceDir;
   // FIXME: Find a way to have less code duplication between include-cleaner
----------------
VitaNuo wrote:
> kadircet wrote:
> > let's use `HS->getModuleMap().getBuiltinDir()` then we can get away with just comparing that pointer to `H.physical()->getLastRef().getDir()` (same applies to all the other places as well)
> This only works in `clangd` code for me. I get `nullptr` for `HS->getModuleMap().getBuiltinDir()` in other places (Clang Tidy check and the library).
hmm that's probably because you're not setting up the include structure correctly. resource-dir isn't the `builtindir`, it's `resource-dir + "/include"` (the comments i had in the clangd unittests applies in a similar manner to other tests as well).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157610



More information about the cfe-commits mailing list