VitaNuo added a comment. Thank you!
================ Comment at: clang-tools-extra/clangd/IncludeCleaner.cpp:419 }); + // Put possibly equal diagnostics together for deduplication. + // The duplicates might be from macro arguments that get expanded multiple ---------------- Could you move the below to a separate function with a descriptive name? IMO taking care of the special cases inline makes functions very long and distracts the reader from their main purpose. ================ Comment at: clang-tools-extra/clangd/IncludeCleaner.cpp:432 + }); + MissingIncludes.erase(llvm::unique(MissingIncludes), MissingIncludes.end()); std::vector<const Inclusion *> UnusedIncludes = ---------------- Nit: maybe add a comment explaining that `llvm::unique` returns a past-the-end iterator after deduplicating elements? I've spent a bit of time deciphering this line. ================ Comment at: clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp:417 + #include "all.h" + FOO([[Foo]]);)cpp"); + ---------------- Nit: move `)cpp");` to the next line please. ================ Comment at: clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp:421 + TU.AdditionalFiles["foo.h"] = guard("struct Foo {};"); + TU.AdditionalFiles["all.h"] = guard(R"( + #include "foo.h" ---------------- Nit: use the same style for multiline strings, i.e., `R"cpp(`. ================ Comment at: clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp:423 + #include "foo.h" + #define FOO(X) X y; X z)"); + ---------------- Nit: move closing tokens of the multiline string to next line. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D149165/new/ https://reviews.llvm.org/D149165 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits