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

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 6 00:58:26 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>


================
@@ -7230,6 +7230,9 @@ void ASTWriter::CompletedImplicitDefinition(const FunctionDecl *D) {
   if (!D->isFromASTFile())
     return; // Declaration not imported from PCH.
 
+  if (!D->doesThisDeclarationHaveABody())
+    return; // The function definition may not have a body due to parsing errors.
----------------
ChuanqiXu9 wrote:

I prefer to see the comments above the if.

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


More information about the cfe-commits mailing list