[clang] [Serialization] Use 32 bit aligned decl id instead of unaligned decl id (PR #95348)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 12 20:47:41 PDT 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 78ee473784e5ef6f0b19ce4cb111fb6e4d23c6b2 eeef0c06e2a17f49ce3bdf8ae78b9bf1cd05a077 -- clang/include/clang/Serialization/ASTBitCodes.h clang/include/clang/Serialization/ASTReader.h clang/include/clang/Serialization/ModuleFile.h clang/lib/Serialization/ASTReader.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/include/clang/Serialization/ASTBitCodes.h b/clang/include/clang/Serialization/ASTBitCodes.h
index be5b6c4e3b..2b672f01fd 100644
--- a/clang/include/clang/Serialization/ASTBitCodes.h
+++ b/clang/include/clang/Serialization/ASTBitCodes.h
@@ -175,9 +175,7 @@ public:
   UnalignedUInt64() = default;
   UnalignedUInt64(uint64_t BitOffset) { set(BitOffset); }
 
-  operator uint64_t() const {
-    return get();
-  }
+  operator uint64_t() const { return get(); }
 
   void set(uint64_t Offset) {
     BitLow = Offset;
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 6ef74296c8..15be400454 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -1265,9 +1265,9 @@ bool ASTReader::ReadLexicalDeclContextStorage(ModuleFile &M,
   auto &Lex = LexicalDecls[DC];
   if (!Lex.first) {
     Lex = std::make_pair(
-        &M, llvm::ArrayRef(
-                reinterpret_cast<const SerializedDeclID *>(Blob.data()),
-                Blob.size() / sizeof(DeclID)));
+        &M,
+        llvm::ArrayRef(reinterpret_cast<const SerializedDeclID *>(Blob.data()),
+                       Blob.size() / sizeof(DeclID)));
   }
   DC->setHasExternalLexicalStorage(true);
   return false;
@@ -7972,8 +7972,7 @@ void ASTReader::FindFileRegionDecls(FileID File,
   if (EndIt != DInfo.Decls.end())
     ++EndIt;
 
-  for (ArrayRef<SerializedDeclID>::iterator DIt = BeginIt; DIt != EndIt;
-       ++DIt)
+  for (ArrayRef<SerializedDeclID>::iterator DIt = BeginIt; DIt != EndIt; ++DIt)
     Decls.push_back(GetDecl(getGlobalDeclID(*DInfo.Mod, (LocalDeclID)(*DIt))));
 }
 

``````````

</details>


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


More information about the cfe-commits mailing list