[clang] [clang] Do not serialize function definitions without a body (PR #121550)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 6 00:56:02 PST 2025


Alejandro =?utf-8?q?Álvarez_Ayllón?=,
Alejandro =?utf-8?q?Álvarez_Ayllón?=,
Alejandro =?utf-8?q?Álvarez_Ayllón?=,
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/121550 at github.com>


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 82fecab85ae2d72ffac0e44749d99f12d6f71cc0 3e2c300ba13bd299b3f0bce52f62729519174504 --extensions cpp -- clang/test/Modules/missing-body-in-import.cpp clang/lib/Serialization/ASTWriter.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index fc66ac01d9..54dc1d44e2 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -7231,7 +7231,8 @@ void ASTWriter::CompletedImplicitDefinition(const FunctionDecl *D) {
     return; // Declaration not imported from PCH.
 
   if (!D->doesThisDeclarationHaveABody())
-    return; // The function definition may not have a body due to parsing errors.
+    return; // The function definition may not have a body due to parsing
+            // errors.
 
   // Implicit function decl from a PCH was defined.
   DeclUpdates[D].push_back(DeclUpdate(UPD_CXX_ADDED_FUNCTION_DEFINITION));
@@ -7252,7 +7253,8 @@ void ASTWriter::FunctionDefinitionInstantiated(const FunctionDecl *D) {
   if (!D->isFromASTFile())
     return;
   if (!D->doesThisDeclarationHaveABody())
-    return; // The function definition may not have a body due to parsing errors.
+    return; // The function definition may not have a body due to parsing
+            // errors.
 
   DeclUpdates[D].push_back(DeclUpdate(UPD_CXX_ADDED_FUNCTION_DEFINITION));
 }

``````````

</details>


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


More information about the cfe-commits mailing list