[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-03-07 Thread Michael Jabbour via cfe-commits
michael-jabbour-sonarsource wrote: Thank you all for looking into this. Note that I don't have commit access, and I would appreciate it if someone merges this if/when it is ready to merge! https://github.com/llvm/llvm-project/pull/114240 ___ cfe-comm

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-03-07 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource updated https://github.com/llvm/llvm-project/pull/114240 >From d5c710e5a16f77b5a44bb842d09674a8b40dbd0d Mon Sep 17 00:00:00 2001 From: Michael Jabbour Date: Fri, 7 Mar 2025 09:32:54 +0100 Subject: [PATCH] [clang] Fix ASTWriter crash after merging n

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-03-07 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource updated https://github.com/llvm/llvm-project/pull/114240 >From 9eede4531ad27ce1d77df492076d5fbcd237fd3f Mon Sep 17 00:00:00 2001 From: Michael Jabbour Date: Fri, 7 Mar 2025 09:32:54 +0100 Subject: [PATCH] [clang] Fix ASTWriter crash after merging n

[clang] Fix quadratic slowdown in AST matcher parent map generation (PR #87824)

2025-03-04 Thread Michael Jabbour via cfe-commits
michael-jabbour-sonarsource wrote: Hello, This seems to cause a noticeable increase in memory consumption on some examples. See https://github.com/llvm/llvm-project/issues/129808#issuecomment-2700015065. https://github.com/llvm/llvm-project/pull/87824 __

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-02-27 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource updated https://github.com/llvm/llvm-project/pull/114240 >From cc3cf25da67c9f8b9edabb318c6011cad9bd2f58 Mon Sep 17 00:00:00 2001 From: Michael Jabbour Date: Tue, 29 Oct 2024 11:16:09 +0100 Subject: [PATCH 1/9] [NFC] Factor out RetireNodesFromMerged

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-02-27 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-02-27 Thread Michael Jabbour via cfe-commits
@@ -2551,18 +2551,7 @@ void Sema::MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New, // Make the old tag definition visible. makeMergedDefinitionVisible(Hidden); - // If this was an unscoped enumeration, yank all of its enumerators - // out of the scop

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-02-27 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource updated https://github.com/llvm/llvm-project/pull/114240 >From cc3cf25da67c9f8b9edabb318c6011cad9bd2f58 Mon Sep 17 00:00:00 2001 From: Michael Jabbour Date: Tue, 29 Oct 2024 11:16:09 +0100 Subject: [PATCH 1/8] [NFC] Factor out RetireNodesFromMerged

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-02-26 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource updated https://github.com/llvm/llvm-project/pull/114240 >From cc3cf25da67c9f8b9edabb318c6011cad9bd2f58 Mon Sep 17 00:00:00 2001 From: Michael Jabbour Date: Tue, 29 Oct 2024 11:16:09 +0100 Subject: [PATCH 1/8] [NFC] Factor out RetireNodesFromMerged

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-02-26 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource updated https://github.com/llvm/llvm-project/pull/114240 >From cc3cf25da67c9f8b9edabb318c6011cad9bd2f58 Mon Sep 17 00:00:00 2001 From: Michael Jabbour Date: Tue, 29 Oct 2024 11:16:09 +0100 Subject: [PATCH 1/8] [NFC] Factor out RetireNodesFromMerged

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-02-23 Thread Michael Jabbour via cfe-commits
michael-jabbour-sonarsource wrote: Gentle ping :smile: @vsapsai, @vgvassilev, I think I have responded to your inquiries and added a few related questions. Could you have a look? https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailin

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-02-05 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-02-05 Thread Michael Jabbour via cfe-commits
@@ -2551,18 +2551,7 @@ void Sema::MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New, // Make the old tag definition visible. makeMergedDefinitionVisible(Hidden); - // If this was an unscoped enumeration, yank all of its enumerators - // out of the scop

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-02-05 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-02-05 Thread Michael Jabbour via cfe-commits
@@ -2639,6 +2628,19 @@ void Sema::MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New, notePreviousDefinition(Old, New->getLocation()); } +void Sema::CleanupMergedEnum(Scope *S, Decl *New) { michael-jabbour-sonarsource wrote: > Is MergeTypedefNameDecl not

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-27 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-26 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-26 Thread Michael Jabbour via cfe-commits
@@ -2551,18 +2551,7 @@ void Sema::MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New, // Make the old tag definition visible. makeMergedDefinitionVisible(Hidden); - // If this was an unscoped enumeration, yank all of its enumerators - // out of the scop

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-26 Thread Michael Jabbour via cfe-commits
michael-jabbour-sonarsource wrote: @vsapsai Thank you for sharing the previous patch. This is really interesting. > For the record, the previous work I've abandoned is > https://reviews.llvm.org/D114833 Doesn't seem particularly relevant to this > change to be honest. As far as I can see, it

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-26 Thread Michael Jabbour via cfe-commits
michael-jabbour-sonarsource wrote: @vsapsai Thanks again for the feedback :pray: > I've realized that the test doesn't have to be Objective-C, the failure is > reproducible in C. Curiously, we aren't hitting the assertion in > C++/Objective-C++ but I don't know why. I dug a bit into this tod

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-26 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource updated https://github.com/llvm/llvm-project/pull/114240 >From cc3cf25da67c9f8b9edabb318c6011cad9bd2f58 Mon Sep 17 00:00:00 2001 From: Michael Jabbour Date: Tue, 29 Oct 2024 11:16:09 +0100 Subject: [PATCH 1/8] [NFC] Factor out RetireNodesFromMerged

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-21 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-21 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-21 Thread Michael Jabbour via cfe-commits
michael-jabbour-sonarsource wrote: @vsapsai Thank you very much for the input. :pray: > Can you trigger the crash without -ast-dump-all? > Can you use in the test %clang_cc1 instead of %clang? I addressed both of these in f6f0887d22172c9db4f602b7f272630a97a708bd. I added a separate invocatio

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-21 Thread Michael Jabbour via cfe-commits
@@ -2551,18 +2551,7 @@ void Sema::MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New, // Make the old tag definition visible. makeMergedDefinitionVisible(Hidden); - // If this was an unscoped enumeration, yank all of its enumerators - // out of the scop

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-21 Thread Michael Jabbour via cfe-commits
@@ -2551,18 +2551,7 @@ void Sema::MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New, // Make the old tag definition visible. makeMergedDefinitionVisible(Hidden); - // If this was an unscoped enumeration, yank all of its enumerators - // out of the scop

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-21 Thread Michael Jabbour via cfe-commits
@@ -4034,6 +4034,12 @@ class Sema final : public SemaBase { void MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New, LookupResult &OldDecls); + /// RetireNodesFromMergedDecl - We have just merged the decl 'New' by making + /// another definitio

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-21 Thread Michael Jabbour via cfe-commits
@@ -2551,18 +2551,7 @@ void Sema::MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New, // Make the old tag definition visible. makeMergedDefinitionVisible(Hidden); - // If this was an unscoped enumeration, yank all of its enumerators - // out of the scop

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-21 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource updated https://github.com/llvm/llvm-project/pull/114240 >From cc3cf25da67c9f8b9edabb318c6011cad9bd2f58 Mon Sep 17 00:00:00 2001 From: Michael Jabbour Date: Tue, 29 Oct 2024 11:16:09 +0100 Subject: [PATCH 1/7] [NFC] Factor out RetireNodesFromMerged

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-21 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource updated https://github.com/llvm/llvm-project/pull/114240 >From cc3cf25da67c9f8b9edabb318c6011cad9bd2f58 Mon Sep 17 00:00:00 2001 From: Michael Jabbour Date: Tue, 29 Oct 2024 11:16:09 +0100 Subject: [PATCH 1/6] [NFC] Factor out RetireNodesFromMerged

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2025-01-06 Thread Michael Jabbour via cfe-commits
michael-jabbour-sonarsource wrote: Gentle ping, and I wish you all a happy new year. :smile: https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2024-12-16 Thread Michael Jabbour via cfe-commits
michael-jabbour-sonarsource wrote: Thanks for the update @vsapsai. Sounds good. Let me know if there are any changes that can make reviewing the PR easier! https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2024-12-03 Thread Michael Jabbour via cfe-commits
michael-jabbour-sonarsource wrote: Gentle ping :smile: I would love to hear your feedback, and if any changes are needed, I am happy to address them promptly. https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@l

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2024-11-17 Thread Michael Jabbour via cfe-commits
michael-jabbour-sonarsource wrote: Gentle ping :smile: The aim of the PR is to fix an ASTWriter crash that currently happens when serializing merged enums. Such a case was encountered while parsing Objective-C code that uses the XCode 16 SDK. If any of the changes look risky, I am happy to re

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2024-11-06 Thread Michael Jabbour via cfe-commits
michael-jabbour-sonarsource wrote: Ping? Note that this PR fixes a crash in ASTWriter on valid Objective-C modules code; The initial PR title didn't accurately reflect that. https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing lis

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2024-10-31 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2024-10-31 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

2024-10-31 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix crash after merging named enums (PR #114240)

2024-10-30 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Clean up enumerators when merging named enums (PR #114240)

2024-10-30 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Clean up enumerators when merging named enums (PR #114240)

2024-10-30 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Clean up enumerators when merging named enums (PR #114240)

2024-10-30 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Clean up enumerators when merging named enums (PR #114240)

2024-10-30 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Clean up enumerators when merging named enums (PR #114240)

2024-10-30 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource edited https://github.com/llvm/llvm-project/pull/114240 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Clean up enumerators when merging named enums (PR #114240)

2024-10-30 Thread Michael Jabbour via cfe-commits
https://github.com/michael-jabbour-sonarsource created https://github.com/llvm/llvm-project/pull/114240 Clang already has a mechanism to cleanup enumerators for typedefs to anonymous enums. So the following example code used to be handled correctly while merging, and ASTWriter behaves as expec