[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)

2024-06-21 Thread Balázs Kéri via cfe-commits
https://github.com/balazske closed https://github.com/llvm/llvm-project/pull/89887 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)

2024-06-21 Thread Balázs Kéri via cfe-commits
balazske wrote: I have not enough resources to create a reproducer and it is not trivial, so I would merge this change now. https://github.com/llvm/llvm-project/pull/89887 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)

2024-05-25 Thread Qizhi Hu via cfe-commits
https://github.com/jcsxky approved this pull request. https://github.com/llvm/llvm-project/pull/89887 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)

2024-05-25 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > > Could you please show your commands which reproduced this crash? I tested > > locally with the following commands and it runs OK. > > ```c++ > > clang++ -cc1 -std=c++17 -emit-pch -o test.cpp.ast test.cpp > > clang++ -cc1 -x c++ -ast-merge test.cpp.ast /dev/null -ast-dump > >

[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)

2024-05-24 Thread Balázs Kéri via cfe-commits
balazske wrote: > Could you please show your commands which reproduced this crash? I tested > locally with the following commands and it runs OK. > > ```c++ > clang++ -cc1 -std=c++17 -emit-pch -o test.cpp.ast test.cpp > clang++ -cc1 -x c++ -ast-merge test.cpp.ast /dev/null -ast-dump > ```

[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)

2024-05-24 Thread Qizhi Hu via cfe-commits
jcsxky wrote: > A test is needed to make the change acceptable but I could not find an easy > case to provoke the situation. The problem looks to be related to his code: > > ```c++ > using size_t = int; > template class tuple; > > template > struct integral_constant > { > static constexpr

[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)

2024-05-23 Thread Donát Nagy via cfe-commits
https://github.com/NagyDonat approved this pull request. This seems to be a reasonable and straightforward improvement which rules out a hard-to test corner case. I think it's acceptable to merge this as it is now, because crafting a testcase would require a disproportionate amount of work.

[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)

2024-05-22 Thread Balázs Kéri via cfe-commits
balazske wrote: The problem is that there is a distance between getting the "InsertPos" and the insetion into the list. Between getting the `InsertPos` (`VarTemplate->findSpecialization`) and the insertion further AST import statements can occur and probably it can cause the list of

[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)

2024-05-22 Thread Balázs Kéri via cfe-commits
balazske wrote: I could reproduce this assertion (with CTU analysis on project "contour"): ``` clang-19: llvm-project/clang/lib/AST/DeclTemplate.cpp:370: void clang::RedeclarableTemplateDecl::addSpecializationImpl(llvm::FoldingSetVector&, EntryType*, void*) [with Derived =

[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)

2024-04-24 Thread Balázs Kéri via cfe-commits
balazske wrote: A test is needed to make the change acceptable but I could not find an easy case to provoke the situation. The problem looks to be related to his code: ```c++ using size_t = int; template class tuple; template struct integral_constant { static constexpr T value = v;

[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)

2024-04-24 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Balázs Kéri (balazske) Changes In some situations a new `VarTemplateSpecializationDecl` (for the same template) can be added during import of another one. The "insert position" that is used to insert the current object into the list of

[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)

2024-04-24 Thread Balázs Kéri via cfe-commits
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/89887 In some situations a new `VarTemplateSpecializationDecl` (for the same template) can be added during import of another one. The "insert position" that is used to insert the current object into the list of