@@ -104,6 +104,8 @@ static auto LookupCppType(
104104// type is not supported.
105105static auto TryMapClassType (Context& context, SemIR::ClassType class_type)
106106 -> clang::QualType {
107+ clang::ASTContext& ast_context = context.ast_context ();
108+
107109 // If the class was imported from C++, return the original C++ type.
108110 auto clang_decl_id =
109111 context.name_scopes ()
@@ -112,7 +114,7 @@ static auto TryMapClassType(Context& context, SemIR::ClassType class_type)
112114 if (clang_decl_id.has_value ()) {
113115 clang::Decl* clang_decl = context.clang_decls ().Get (clang_decl_id).key .decl ;
114116 auto * tag_type_decl = clang::cast<clang::TagDecl>(clang_decl);
115- return context. ast_context () .getCanonicalTagType (tag_type_decl);
117+ return ast_context.getCanonicalTagType (tag_type_decl);
116118 }
117119
118120 // If the class represents a Carbon type literal, map it to the corresponding
@@ -135,22 +137,28 @@ static auto TryMapClassType(Context& context, SemIR::ClassType class_type)
135137 CARBON_FATAL (" Unexpected invalid numeric type literal" );
136138 }
137139 case SemIR::NumericTypeLiteralInfo::Float: {
138- return context. ast_context () .getRealTypeForBitwidth (
140+ return ast_context.getRealTypeForBitwidth (
139141 bit_width, clang::FloatModeKind::NoFloat);
140142 }
141143 case SemIR::NumericTypeLiteralInfo::Int: {
142- return context. ast_context () .getIntTypeForBitwidth (bit_width, true );
144+ return ast_context.getIntTypeForBitwidth (bit_width, true );
143145 }
144146 case SemIR::NumericTypeLiteralInfo::UInt: {
145- return context. ast_context () .getIntTypeForBitwidth (bit_width, false );
147+ return ast_context.getIntTypeForBitwidth (bit_width, false );
146148 }
147149 }
148150 }
149151 case SemIR::TypeLiteralInfo::Char: {
150- return context.ast_context ().CharTy ;
152+ return ast_context.CharTy ;
153+ }
154+ case SemIR::TypeLiteralInfo::CppLong32: {
155+ if (ast_context.getIntWidth (ast_context.LongTy ) == 32 ) {
156+ return ast_context.LongTy ;
157+ }
158+ break ;
151159 }
152160 case SemIR::TypeLiteralInfo::CppNullptrT: {
153- return context. ast_context () .NullPtrTy ;
161+ return ast_context.NullPtrTy ;
154162 }
155163 case SemIR::TypeLiteralInfo::Str: {
156164 return LookupCppType (context, {" std" , " string_view" });
0 commit comments