VitaNuo added a comment.

Thanks for the 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
----------------
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).


================
Comment at: clang-tools-extra/clangd/IncludeCleaner.cpp:309
       continue;
+    auto Dir = llvm::StringRef{MFI.Resolved}.rsplit('/').first;
+    if (Dir == AST.getPreprocessor()
----------------
kadircet wrote:
> let's move this into `mayConsiderUnused`, we also convert this include into a 
> FileEntry in there, so we can directly compare the directory agian.
Ok moved to `mayConsiderUnused` and using the file entry now, but see above 
regarding comparing the directories.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157610

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to