kadircet marked 3 inline comments as done.
kadircet added inline comments.

================
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
----------------
VitaNuo wrote:
> 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.
but this is not a special case, this is still part of "missing include 
information gathering", and is being applied to all of the findings (just like 
how all the used headers get accumulated in a `set`, the only problem is 
members of `MissingIncludeDiagInfo` is hard to order, hence we can't directly 
use a `set`)


================
Comment at: clang-tools-extra/clangd/IncludeCleaner.cpp:432
+  });
+  MissingIncludes.erase(llvm::unique(MissingIncludes), MissingIncludes.end());
   std::vector<const Inclusion *> UnusedIncludes =
----------------
VitaNuo wrote:
> 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.
yeah the language isn't really helpful in that regard but unfortunately `unique 
& erase` pattern is pretty much the idiomatic way of deduplicating a sorted 
container. I can add it here but we have some more mentions of it across the 
code that doesn't have any explanations. so I am not sure what kind of weight 
it would carry.


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

Reply via email to