Import starts with a lookup and then we create a new Decl. Then in certain cases (e.g. CXXConstructorDecl) we further import other Decls (base classes, members through CXXConstructorDecl::inits()) before connecting the redecl chain.
During those in-between imports structural eq fails because the canonical decl is different.
Currently this problem impacts only CXXConstructorDecl, however we plan to properly import the redecl chains in other kind of Decls too. Thus, we should add a new PrevDecl parameter to GetImportedOrCreateDecl on a long term.
This implies that first we have to implement the import of the redecl chains for all nodes. E.g. EnumDecl, VarTemplateDecl, and lot of other nodes still do not handle the redecl chain properly.
Import starts with a lookup and then we create a new Decl. Then in certain cases (e.g.
CXXConstructorDecl
) we further import other Decls (base classes, members throughCXXConstructorDecl::inits()
) before connecting the redecl chain. During those in-between imports structural eq fails because the canonical decl is different.Currently this problem impacts only
CXXConstructorDecl
, however we plan to properly import the redecl chains in other kind of Decls too. Thus, we should add a new PrevDecl parameter toGetImportedOrCreateDecl
on a long term.