[clang] [clang][serialization] Blobify IMPORTS strings and signatures (PR #116095)

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 13 11:26:22 PST 2024


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 929cbe7f596733f85cd274485acc19442dd34a80 3d50eff35fe68cfa7d94d27ccd51e9d1b864417a --extensions h,cpp -- clang/include/clang/Serialization/ASTBitCodes.h clang/include/clang/Serialization/ASTReader.h clang/include/clang/Serialization/ASTWriter.h clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.cpp clang/lib/Serialization/GlobalModuleIndex.cpp
``````````

</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 ec85fad338..c4ae4e18f8 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -3126,7 +3126,8 @@ ASTReader::ReadControlBlock(ModuleFile &F,
       // explicit name to file mappings. Also, we will still verify the
       // size/signature making sure it is essentially the same file but
       // perhaps in a different location.
-      if (ImportedKind == MK_PrebuiltModule || ImportedKind == MK_ExplicitModule)
+      if (ImportedKind == MK_PrebuiltModule ||
+          ImportedKind == MK_ExplicitModule)
         ImportedFile = PP.getHeaderSearchInfo().getPrebuiltModuleFileName(
             ImportedName, /*FileMapOnly*/ !IsImportingStdCXXModule);
 
@@ -3159,9 +3160,9 @@ ASTReader::ReadControlBlock(ModuleFile &F,
         Capabilities &= ~ARR_Missing;
 
       // Load the AST file.
-      auto Result = ReadASTCore(ImportedFile, ImportedKind, ImportLoc, &F,
-                                Loaded, StoredSize, StoredModTime,
-                                StoredSignature, Capabilities);
+      auto Result =
+          ReadASTCore(ImportedFile, ImportedKind, ImportLoc, &F, Loaded,
+                      StoredSize, StoredModTime, StoredSignature, Capabilities);
 
       // If we diagnosed a problem, produce a backtrace.
       bool recompilingFinalized =
@@ -3174,14 +3175,20 @@ ASTReader::ReadControlBlock(ModuleFile &F,
         Diag(diag::note_module_file_conflict);
 
       switch (Result) {
-      case Failure: return Failure;
+      case Failure:
+        return Failure;
         // If we have to ignore the dependency, we'll have to ignore this too.
       case Missing:
-      case OutOfDate: return OutOfDate;
-      case VersionMismatch: return VersionMismatch;
-      case ConfigurationMismatch: return ConfigurationMismatch;
-      case HadErrors: return HadErrors;
-      case Success: break;
+      case OutOfDate:
+        return OutOfDate;
+      case VersionMismatch:
+        return VersionMismatch;
+      case ConfigurationMismatch:
+        return ConfigurationMismatch;
+      case HadErrors:
+        return HadErrors;
+      case Success:
+        break;
       }
       break;
     }
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index a52d59c61c..5683549233 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -1539,13 +1539,13 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, StringRef isysroot) {
     auto Abbrev = std::make_shared<BitCodeAbbrev>();
     Abbrev->Add(BitCodeAbbrevOp(IMPORT));
     Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Kind
-    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ImportLoc
-    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Module name len
+    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));   // ImportLoc
+    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));   // Module name len
     Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Standard C++ mod
-    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // File size
-    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // File timestamp
-    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // File name len
-    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Strings
+    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));   // File size
+    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));   // File timestamp
+    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));   // File name len
+    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));     // Strings
     unsigned AbbrevCode = Stream.EmitAbbrev(std::move(Abbrev));
 
     SmallString<128> Blob;
diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp
index 4b920fccec..f76c31a61f 100644
--- a/clang/lib/Serialization/GlobalModuleIndex.cpp
+++ b/clang/lib/Serialization/GlobalModuleIndex.cpp
@@ -660,8 +660,8 @@ llvm::Error GlobalModuleIndexBuilder::loadModuleFile(FileEntryRef File) {
       // Save the information in ImportedModuleFileInfo so we can verify after
       // loading all pcms.
       ImportedModuleFiles.insert(std::make_pair(
-          *DependsOnFile, ImportedModuleFileInfo(StoredSize, StoredModTime,
-                                                 StoredSignature)));
+          *DependsOnFile,
+          ImportedModuleFileInfo(StoredSize, StoredModTime, StoredSignature)));
 
       // Record the dependency.
       unsigned DependsOnID = getModuleFileInfo(*DependsOnFile).ID;

``````````

</details>


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


More information about the cfe-commits mailing list