[PATCH] D128204: [clangd] Add fix-it for inserting IWYU pragma: keep

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 6 05:46:51 PDT 2022


kadircet added a comment.

> A specific example i encountered is clang/Tooling/DiagnosticsYaml.h Which defines template specializations for inputting/outputting yaml io. That file must be included if you ever want to emit diagnostics as YAML, but the typical use case is to just use the operator<< on a yaml stream. This function internally will use those specializations, but as clangd doesn't look into the function calls and expand all those instantiations, they are treated as being unused(There's many bugs already related to this) and as such the header is marked as being unused.

i see makes sense. this falls in the "adl through templates" bucket, which is annoying and doesn't seem to be as rare in the wild. so we probably need to figure something out here.
as mentioned above i've hesitations for having this automatically available but it's a state we want to get at eventually. i guess there's not much point in delaying that, so LGTM (after comments already raised are addressed), sorry for the late reply and thanks for the patch!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128204



More information about the cfe-commits mailing list