[PATCH] D102488: [clang][deps] Prune unused header search paths

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 17 06:52:36 PDT 2021


jansvoboda11 planned changes to this revision.
jansvoboda11 added a comment.

In D102488#2760406 <https://reviews.llvm.org/D102488#2760406>, @dexonsmith wrote:

> I think it'd be useful to have direct tests for "detecting used search paths". That might be a nice thing to separate out and test independently. E.g., you could add a remark, `-Rused-search-path`, which printed a diagnostic the first time any given search path is used in a TU.

Good idea, I'll look into that.

> It'd also be really nice to be able to dump this info from the `.pcm` file. I guess it'd be outside the scope of this patch, but I really think there should be a clang-pcm-analyzer where we can put functionality like that. Somewhat useful for more fine-grained testing; super useful as a tool for debugging.

Agreed, it's in my todo list.



================
Comment at: clang/lib/Serialization/ASTReader.cpp:4798-4806
+    case USED_HEADER_SEARCH_PATHS:
+      if (F) {
+        unsigned Idx = 0;
+        unsigned Count = Record[Idx++];
+        for (unsigned I = 0; I < Count; ++I)
+          F->UsedHeaderSearchPathIdxs.insert(Record[Idx++]);
+      }
----------------
dexonsmith wrote:
> If this were stored as a blob it could be lazily parsed; WDYT?
> 
> Alternatively, it might be more compact if stored as a bit vector, storing 64-bits positions per element of the record.
I'll look into making this lazy.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102488



More information about the cfe-commits mailing list