@@ -581,10 +581,8 @@ static auto IsDeclInjectedClassName(const Context& context,
581
581
582
582
const clang::ASTContext& ast_context =
583
583
context.sem_ir ().clang_ast_unit ()->getASTContext ();
584
- CARBON_CHECK (
585
- ast_context.getCanonicalType (
586
- ast_context.getRecordType (scope_record_decl)) ==
587
- ast_context.getCanonicalType (ast_context.getRecordType (record_decl)));
584
+ CARBON_CHECK (ast_context.getCanonicalTagType (scope_record_decl) ==
585
+ ast_context.getCanonicalTagType (record_decl));
588
586
589
587
auto class_decl =
590
588
context.sem_ir ().insts ().GetAs <SemIR::ClassDecl>(clang_decl.inst_id );
@@ -1117,7 +1115,7 @@ auto ImportClassDefinitionForClangDecl(Context& context, SemIR::LocId loc_id,
1117
1115
// instantiation if necessary.
1118
1116
clang::DiagnosticErrorTrap trap (ast->getDiagnostics ());
1119
1117
if (!ast->getSema ().isCompleteType (
1120
- loc, context.ast_context ().getTypeDeclType (clang_decl))) {
1118
+ loc, context.ast_context ().getCanonicalTagType (clang_decl))) {
1121
1119
// Type is incomplete. Nothing more to do, but tell the caller if we
1122
1120
// produced an error.
1123
1121
return !trap.hasErrorOccurred ();
@@ -1267,7 +1265,7 @@ static auto LookupCustomRecordType(Context& context,
1267
1265
// Maps a C++ tag type (class, struct, union, enum) to a Carbon type.
1268
1266
static auto MapTagType (Context& context, const clang::TagType& type)
1269
1267
-> TypeExpr {
1270
- auto * tag_decl = type.getDecl ();
1268
+ auto * tag_decl = type.getOriginalDecl ();
1271
1269
CARBON_CHECK (tag_decl);
1272
1270
1273
1271
// Check if the declaration is already mapped.
@@ -1810,7 +1808,7 @@ static auto AddDependentUnimportedTypeDecls(const Context& context,
1810
1808
}
1811
1809
1812
1810
if (const auto * tag_type = type->getAs <clang::TagType>()) {
1813
- AddDependentDecl (context, tag_type->getDecl (), worklist);
1811
+ AddDependentDecl (context, tag_type->getOriginalDecl (), worklist);
1814
1812
}
1815
1813
}
1816
1814
0 commit comments