[clang] [WIP][C++20][Modules] Lazily, but fully load 'HeaderFileInfo' table into memory. (PR #140867)

via cfe-commits cfe-commits at lists.llvm.org
Wed May 21 01:49:29 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- clang/include/clang/Serialization/ASTReader.h clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTReaderInternals.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 15ea6b25d..f90f4b979 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -6864,14 +6864,15 @@ static void mergeHeaderFileInfo(HeaderFileInfo &HFI,
 HeaderFileInfo ASTReader::GetHeaderFileInfo(FileEntryRef FE) {
   for (auto Iter = ModuleMgr.begin() + HeaderFileInfoIdx, End = ModuleMgr.end();
        Iter != End; ++Iter) {
-    if (auto *Table =
-            static_cast<HeaderFileInfoLookupTable *>(Iter->HeaderFileInfoTable)) {
-      auto& Info = Table->getInfoObj();
+    if (auto *Table = static_cast<HeaderFileInfoLookupTable *>(
+            Iter->HeaderFileInfoTable)) {
+      auto &Info = Table->getInfoObj();
       for (auto Iter = Table->data_begin(), End = Table->data_end();
            Iter != End; ++Iter) {
         const auto *Item = Iter.getItem();
         // Determine the length of the key and the data.
-        const auto& [KeyLen, DataLen] = HeaderFileInfoTrait::ReadKeyDataLength(Item);
+        const auto &[KeyLen, DataLen] =
+            HeaderFileInfoTrait::ReadKeyDataLength(Item);
         // Read the key.
         const auto &Key = Info.ReadKey(Item, KeyLen);
         if (auto EKey = Info.getFile(Key)) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/140867


More information about the cfe-commits mailing list