[PATCH] D154963: [Format][Tooling] Fix HeaderIncludes::insert not respect the main-file header.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 12 04:19:47 PDT 2023


kadircet added inline comments.


================
Comment at: clang/lib/Tooling/Inclusions/HeaderIncludes.cpp:369-370
+      QuotedName, /*CheckMainHeader=*/!MainIncludeFound);
+  if (Priority == 0)
+    MainIncludeFound = true;
   auto CatOffset = CategoryEndOffsets.find(Priority);
----------------
sorry if I was unclear in the previous comment. but i was trying to say we should only consider includes we've encountered during the initial scan.

getting different results depending on the order of insertions being performed is likely gonna cause confusion elsewhere (e.g. depending on the first diagnostic you've in clangd, you'll get different order of includes). hence, let's keep this function stateless (which also gets rid of the concerns around mutable)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154963



More information about the cfe-commits mailing list