[PATCH] D141670: [include-cleaner] FindHeaders respects IWYU export pragma for standard headers.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 13 04:22:06 PST 2023


kadircet added inline comments.


================
Comment at: clang-tools-extra/include-cleaner/lib/Record.cpp:203
+                      const FileEntry *IncludedHeader,
+                      std::optional<tooling::stdlib::Header> StandardHeader) {
     if (ExportStack.empty())
----------------
just saying `StandardHeader` here isn't really useful. what about changing signautre here to take a `include_cleaner::Header` instead, named `IncludedHeader` and switch over kind to add it to ExportBy map? I don't think there's any value in storing Exporters for `<vector>` both as a physical entry and a stdlib entry.


================
Comment at: clang-tools-extra/include-cleaner/unittests/FindHeadersTest.cpp:122
+  tooling::stdlib::Symbol StdString =
+      *tooling::stdlib::Symbol::named("std::", "string");
+  EXPECT_THAT(
----------------
nit: `tooling::stdlib::Header::named("<string>")`


================
Comment at: clang-tools-extra/include-cleaner/unittests/RecordTest.cpp:437
+TEST_F(PragmaIncludeTest, IWYUExportForStandardHeaders) {
+  Inputs.Code = R"cpp(// Line 1
+    #include "export.h"
----------------
drop the comment `Line 1`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141670



More information about the cfe-commits mailing list