[clang][ASTImporter] Improve import of InjectedClassNameType.
During AST import multiple different InjectedClassNameType objects could be created for a single class template. This can cause problems and failed assertions when these types are compared and found to be not the same (because the instance is different and there is no canonical type). The import of this type does not use the factory method in ASTContext, probably because the preconditions are not fulfilled at that state. The fix tries to make the code in ASTImporter work more like the code in ASTContext::getInjectedClassNameType. If a type is stored at the Decl or previous Decl object, it is reused instead of creating a new one. This avoids crash at least a part of the cases. Reviewed By: gamesh411, donat.nagy, vabridgers Differential Revision: https://reviews.llvm.org/D140562
Loading
Please sign in to comment