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

2025-01-06 Thread Chuanqi Xu via cfe-commits
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?=, Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: https://github.com/ChuanqiXu9 closed https://github.com/llvm/llvm-project/pull/1215

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

2025-01-06 Thread Chuanqi Xu via cfe-commits
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?=, Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: ChuanqiXu9 wrote: > Thanks for the review! Would you mind doing the merge? I do not

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
alejandro-alvarez-sonarsource wrote: Thanks for the review! Would you mind doing the merge? I do not have permission. https://github.com/llvm/llvm-project/pull/121550 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
https://github.com/alejandro-alvarez-sonarsource updated https://github.com/llvm/llvm-project/pull/121550 From fe4adf2f95aeb72436eead3567767c8c539811c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20=C3=81lvarez=20Ayll=C3=B3n?= Date: Fri, 3 Jan 2025 08:58:23 +0100 Subject: [PATCH 1/6] [c

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
https://github.com/alejandro-alvarez-sonarsource updated https://github.com/llvm/llvm-project/pull/121550 From fe4adf2f95aeb72436eead3567767c8c539811c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20=C3=81lvarez=20Ayll=C3=B3n?= Date: Fri, 3 Jan 2025 08:58:23 +0100 Subject: [PATCH 1/6] [c

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
https://github.com/alejandro-alvarez-sonarsource updated https://github.com/llvm/llvm-project/pull/121550 From fe4adf2f95aeb72436eead3567767c8c539811c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20=C3=81lvarez=20Ayll=C3=B3n?= Date: Fri, 3 Jan 2025 08:58:23 +0100 Subject: [PATCH 1/7] [c

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
@@ -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 t

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
https://github.com/alejandro-alvarez-sonarsource updated https://github.com/llvm/llvm-project/pull/121550 From fe4adf2f95aeb72436eead3567767c8c539811c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20=C3=81lvarez=20Ayll=C3=B3n?= Date: Fri, 3 Jan 2025 08:58:23 +0100 Subject: [PATCH 1/6] [c

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

2025-01-06 Thread Chuanqi Xu via cfe-commits
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: @@ -7230,6 +7230,9 @@ void ASTWriter::CompletedImplicitDefinition(const FunctionDecl *D) { if (!D->is

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

2025-01-06 Thread Chuanqi Xu via cfe-commits
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: https://github.com/ChuanqiXu9 edited https://github.com/llvm/llvm-project/pull/121550 ___

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

2025-01-06 Thread Chuanqi Xu via cfe-commits
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: https://github.com/ChuanqiXu9 approved this pull request. LGTM now. We can land this after you fix the formatting issue.

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

2025-01-06 Thread via cfe-commits
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: github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You c

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
@@ -6092,12 +6092,14 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context, // An updated body is emitted last, so that the reader doesn't need // to skip over the lazy body to reach statements for other records. - if (Kind == UPD_CXX_ADDED_FUNCTION_D

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
https://github.com/alejandro-alvarez-sonarsource updated https://github.com/llvm/llvm-project/pull/121550 From fe4adf2f95aeb72436eead3567767c8c539811c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20=C3=81lvarez=20Ayll=C3=B3n?= Date: Fri, 3 Jan 2025 08:58:23 +0100 Subject: [PATCH 1/5] [c

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

2025-01-06 Thread Chuanqi Xu via cfe-commits
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: @@ -6092,12 +6092,14 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context, // An updated body is emitted last, so that the r

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
@@ -6092,9 +6092,10 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context, // An updated body is emitted last, so that the reader doesn't need // to skip over the lazy body to reach statements for other records. - if (Kind == UPD_CXX_ADDED_FUNCTION_DE

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
@@ -6092,9 +6092,10 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context, // An updated body is emitted last, so that the reader doesn't need // to skip over the lazy body to reach statements for other records. - if (Kind == UPD_CXX_ADDED_FUNCTION_DE

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
https://github.com/alejandro-alvarez-sonarsource updated https://github.com/llvm/llvm-project/pull/121550 From fe4adf2f95aeb72436eead3567767c8c539811c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20=C3=81lvarez=20Ayll=C3=B3n?= Date: Fri, 3 Jan 2025 08:58:23 +0100 Subject: [PATCH 1/4] [c

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
https://github.com/alejandro-alvarez-sonarsource updated https://github.com/llvm/llvm-project/pull/121550 From fe4adf2f95aeb72436eead3567767c8c539811c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20=C3=81lvarez=20Ayll=C3=B3n?= Date: Fri, 3 Jan 2025 08:58:23 +0100 Subject: [PATCH 1/3] [c

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

2025-01-06 Thread Chuanqi Xu via cfe-commits
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?= Message-ID: In-Reply-To: https://github.com/ChuanqiXu9 approved this pull request. LGTM with nits https://github.com/llvm/llvm-project/pull/121550 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2025-01-06 Thread Chuanqi Xu via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -6092,9 +6092,10 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context, // An updated body is emitted last, so that the reader doesn't need // to skip over the lazy body to reach statements f

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

2025-01-06 Thread Chuanqi Xu via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -6092,9 +6092,10 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context, // An updated body is emitted last, so that the reader doesn't need // to skip over the lazy body to reach statements f

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

2025-01-06 Thread Chuanqi Xu via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: @@ -6092,9 +6092,10 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context, // An updated body is emitted last, so that the reader doesn't need // to skip over the lazy body to reach statements f

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
@@ -6227,8 +6227,10 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context, // Add a trailing update record, if any. These must go last because we // lazily load their attached statement. if (!GeneratingReducedBMI || !CanElideDeclDef(D)) { - if (HasUpda

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
https://github.com/alejandro-alvarez-sonarsource updated https://github.com/llvm/llvm-project/pull/121550 From fe4adf2f95aeb72436eead3567767c8c539811c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20=C3=81lvarez=20Ayll=C3=B3n?= Date: Fri, 3 Jan 2025 08:58:23 +0100 Subject: [PATCH 1/2] [c

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
alejandro-alvarez-sonarsource wrote: > You hope the linter doesn't give up `some.cc` if `mod` contains some errors? > If yes, that makes sense to me. Precisely. > But why Sanitizers? IIRC, they should only work if the project compiles. Or > are you saying the static analyzer? Sorry, my mind

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

2025-01-06 Thread Chuanqi Xu via cfe-commits
ChuanqiXu9 wrote: > > Out of curiosity (not a blocking issue), why do you want this feature for > > C++20 modules? > > Sanitizers, linters and indexers have to deal with code using non supported > C++ language features or extensions. This is also true for C++20 modules. > While conceivably on

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

2025-01-06 Thread Alejandro Álvarez Ayllón via cfe-commits
alejandro-alvarez-sonarsource wrote: > Out of curiosity (not a blocking issue), why do you want this feature for > C++20 modules? Sanitizers, linters and indexers have to deal with code using non supported C++ language features or extensions. This is also true for C++20 modules. While conceiv

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

2025-01-05 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 commented: Oh, previously we didn't allow `-fallow-pcm-with-compiler-errors` so we didn't meet such problems. Out of curiosity (not a blocking issue), why do you want this feature for C++20 modules? https://github.com/llvm/llvm-project/pull/121550

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

2025-01-05 Thread Chuanqi Xu via cfe-commits
@@ -6227,8 +6227,10 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context, // Add a trailing update record, if any. These must go last because we // lazily load their attached statement. if (!GeneratingReducedBMI || !CanElideDeclDef(D)) { - if (HasUpda

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

2025-01-05 Thread Chuanqi Xu via cfe-commits
https://github.com/ChuanqiXu9 edited https://github.com/llvm/llvm-project/pull/121550 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-01-03 Thread via cfe-commits
https://github.com/cor3ntin approved this pull request. I think this looks correct but I'd like @ChuanqiXu9 to confirm https://github.com/llvm/llvm-project/pull/121550 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-b

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

2025-01-03 Thread Alejandro Álvarez Ayllón via cfe-commits
https://github.com/alejandro-alvarez-sonarsource created https://github.com/llvm/llvm-project/pull/121550 An instantiated templated function definition may not have a body due to parsing errors inside the templated function. When serializing, an assert is triggered inside `ASTRecordWriter::Add

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

2025-01-03 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Alejandro Álvarez Ayllón (alejandro-alvarez-sonarsource) Changes An instantiated templated function definition may not have a body due to parsing errors inside the templated function. When serializing, an assert is triggered inside `ASTRe

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

2025-01-03 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-modules Author: Alejandro Álvarez Ayllón (alejandro-alvarez-sonarsource) Changes An instantiated templated function definition may not have a body due to parsing errors inside the templated function. When serializing, an assert is triggered insid