[PATCH] D124170: [clangd] Include Cleaner: suppress unused warnings for IWYU pragma: export

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 21 07:16:22 PDT 2022


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/clangd/Headers.cpp:26
 const char IWYUPragmaKeep[] = "// IWYU pragma: keep";
+const char IWYUPragmaExport[] = "// IWYU pragma: export";
 
----------------
or just drop to IWYUPragma and hardcode "keep" and "export" at the sites? up to you


================
Comment at: clang-tools-extra/clangd/Headers.cpp:144
+      return false;
+    if (Text.startswith(IWYUPragmaKeep))
+      Text = Text.drop_front(std::strlen(IWYUPragmaKeep));
----------------
why not just `if (!Text.consume_front(IWYUPragmaKeep) && !Text.consume_front(IWYUPragmaExport))`?

strlen makes me wary and also seems more verbose


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124170



More information about the cfe-commits mailing list