A prototype of using include-cleaner library in clangd:
- (re)implement clangd's "unused include" warnings with the library
- the new implementation is hidden under a flag Config::UnusedIncludesPolicy::Experiment
Differential D140875
[clangd] prototype: Implement unused include warnings with include-cleaner library. hokein on Jan 3 2023, 1:19 AM. Authored by
Details A prototype of using include-cleaner library in clangd:
Diff Detail
Event TimelineComment Actions regarding testing, i think updating all tests that we have in IncludeCleanerTests that call computeUnusedIncludes to also call the new function that'll use include-cleaner library should be enough.
Comment Actions address comments.
Comment Actions address comments:
Comment Actions thanks!
Comment Actions With this, I now get:
Comment Actions sorry, should be fixed in https://github.com/llvm/llvm-project/commit/e84d69f52d9a9fab9162128d8fe8ebec99ea60da. Comment Actions this seems to be not enough, I am also seeing clangd build failiures /mnt/b/yoe/master/build/tmp/hosttools/ld: lib/libclangDaemon.a(Preamble.cpp.o): in function `clang::clangd::(anonymous namespace)::CppFilePreambleCallbacks::BeforeExecute(clang::CompilerInstance&)': Preamble.cpp:(.text._ZN5clang6clangd12_GLOBAL__N_124CppFilePreambleCallbacks13BeforeExecuteERNS_16CompilerInstanceE+0x8b): undefined reference to `clang::include_cleaner::PragmaIncludes::record(clang::CompilerInsta nce const&)' /mnt/b/yoe/master/build/tmp/hosttools/ld: lib/libclangDaemon.a(IncludeCleaner.cpp.o): in function `clang::clangd::computeUnusedIncludesExperimental(clang::clangd::ParsedAST&) [clone .localalias]': IncludeCleaner.cpp:(.text._ZN5clang6clangd33computeUnusedIncludesExperimentalERNS0_9ParsedASTE+0x3a1): undefined reference to `clang::include_cleaner::walkUsed(llvm::ArrayRef<clang::Decl*>, llvm::ArrayRef<clang::in clude_cleaner::SymbolReference>, clang::include_cleaner::PragmaIncludes const*, clang::SourceManager const&, llvm::function_ref<void (clang::include_cleaner::SymbolReference const&, llvm::ArrayRef<clang::include_cl eaner::Header>)>)' collect2: error: ld returned 1 exit status [193/193] Linking CXX executable bin/clangd FAILED: bin/clangd Comment Actions I'm still seeing the build error on clangd-fuzzer on a commit that clearly has e84d69f52d9a9fab9162128d8fe8ebec99ea60da in its history. |
can you move this near the include_directories for clang-tidy below (near line 63)