[PATCH] D148143: [clangd] Treat preamble patch as main file for include-cleaner analysis

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 12 09:53:00 PDT 2023


sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/IncludeCleaner.cpp:379
+              (H.physical() == MainFile ||
+               H.physical()->getName().endswith(PreamblePatch::HeaderName))) {
             Satisfied = true;
----------------
Comparing strings here every time seems odd & slow.

Is it too fragile to add a function somewhere (Preamble.h?) to get the preamble patch file ID from a source manager? (By reconstructing the path and then looking it up)

That way it can be done outside this loop, and without encoding such details here


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148143



More information about the cfe-commits mailing list