[all-commits] [llvm/llvm-project] feba03: [clang][ASTImporter] Improve import of InjectedCla...
Balázs Kéri via All-commits
all-commits at lists.llvm.org
Wed Mar 1 00:26:57 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: feba03340cf3a1690e75ede75ca4603acb9dc2a6
https://github.com/llvm/llvm-project/commit/feba03340cf3a1690e75ede75ca4603acb9dc2a6
Author: Balázs Kéri <1.int32 at gmail.com>
Date: 2023-03-01 (Wed, 01 Mar 2023)
Changed paths:
M clang/lib/AST/ASTImporter.cpp
M clang/unittests/AST/ASTImporterTest.cpp
Log Message:
-----------
[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
More information about the All-commits
mailing list