Skip to content

Commit ccca7f3

Browse files
authored
Minor comment and naming cleanup. (#6070)
1 parent 95b5cce commit ccca7f3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

toolchain/check/cpp_type_mapping.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ static auto TryMapBuiltinType(Context& context, SemIR::InstId inst_id,
9999
}
100100
}
101101

102-
// Maps a Carbon record type to a Cpp type. Returns an empty `QualType` if
103-
// the Carbon type is not a `ClassType` or if the Cpp record type has not yet
104-
// been
105-
// TODO: Import the type if needed.
106-
static auto TryMapRecordType(Context& context, SemIR::TypeId type_id)
102+
// Maps a Carbon class type to a C++ type. Returns a null `QualType` if the
103+
// Carbon type is not a `ClassType` or was not imported from C++.
104+
// TODO: If the class type wasn't imported from C++, create a corresponding C++
105+
// class type.
106+
static auto TryMapClassType(Context& context, SemIR::TypeId type_id)
107107
-> clang::QualType {
108108
auto class_type =
109109
context.sem_ir().types().TryGetAs<SemIR::ClassType>(type_id);
@@ -120,16 +120,16 @@ static auto TryMapRecordType(Context& context, SemIR::TypeId type_id)
120120
}
121121
clang::Decl* clang_decl =
122122
context.sem_ir().clang_decls().Get(clang_decl_id).decl;
123-
auto* record_type_decl = clang::cast<clang::TagDecl>(clang_decl);
124-
return context.ast_context().getCanonicalTagType(record_type_decl);
123+
auto* tag_type_decl = clang::cast<clang::TagDecl>(clang_decl);
124+
return context.ast_context().getCanonicalTagType(tag_type_decl);
125125
}
126126

127-
// Maps a non-wrapper (no const or pointer) Carbon type to a Cpp type.
127+
// Maps a non-wrapper (no const or pointer) Carbon type to a C++ type.
128128
static auto MapNonWrapperType(Context& context, SemIR::InstId inst_id,
129129
SemIR::TypeId type_id) -> clang::QualType {
130130
clang::QualType mapped_type = TryMapBuiltinType(context, inst_id, type_id);
131131
if (mapped_type.isNull()) {
132-
mapped_type = TryMapRecordType(context, type_id);
132+
mapped_type = TryMapClassType(context, type_id);
133133
}
134134
return mapped_type;
135135
}

0 commit comments

Comments
 (0)