hahnjo wrote:

> If I understand correctly, we could implement this locally in 
> `ASTReaderDecl.cpp`, matching a number of patterns in 
> `ASTReader::finishPendingActions()`:
> 
> ```diff
> diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp 
> b/clang/lib/Serialization/ASTReaderDecl.cpp
> index 882d54f31280..ec7c2449d77e 100644
> --- a/clang/lib/Serialization/ASTReaderDecl.cpp
> +++ b/clang/lib/Serialization/ASTReaderDecl.cpp
> @@ -2107,8 +2107,10 @@ void ASTDeclMerger::MergeDefinitionData(
>      auto *Def = DD.Definition;
>      DD = std::move(MergeDD);
>      DD.Definition = Def;
> -    for (auto *D : Def->redecls())
> -      cast<CXXRecordDecl>(D)->DefinitionData = &DD;
> +    // FIXME: this duplicates logic from ASTReader::finishPendingActions()...
> +    for (auto *R = Reader.getMostRecentExistingDecl(Def); R;
> +         R = R->getPreviousDecl())
> +      cast<CXXRecordDecl>(R)->DefinitionData = &DD;
>      return;
>    }
>  
> ```

https://github.com/llvm/llvm-project/pull/172559 landed this change and fixed 
the reported crashes 
(https://github.com/llvm/llvm-project/pull/172559#discussion_r2636632321). 
@alexfh if you have time, could you give this PR one more run?

https://github.com/llvm/llvm-project/pull/133057
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to