mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 21:21:04 +01:00
Add location to clang classes created via reverse interop (#7533)
The specific location's not ideal (rather than the open curly, or semicolon for a declaration - the two locations should be the `class` and then the class name), but the same as we do for functions for now & enough to get by. This specifically also fixes a crash I found due to dtors being generated without a location (because implicitly created functions would use the class's location), creating a function call without a debug location, which fails the LLVM IR verifier.
This commit is contained in:
@@ -156,10 +156,11 @@ auto ExportClassToCpp(Context& context, SemIR::LocId loc_id,
|
||||
|
||||
auto* decl_context =
|
||||
ExportNameScopeToCpp(context, loc_id, class_info.parent_scope_id);
|
||||
// TODO: Provide a source location.
|
||||
auto clang_loc =
|
||||
GetCppLocation(context, SemIR::LocId(class_info.first_decl_id()));
|
||||
auto* record_decl = clang::CXXRecordDecl::Create(
|
||||
context.ast_context(), clang::TagTypeKind::Class, decl_context,
|
||||
clang::SourceLocation(), clang::SourceLocation(), identifier_info);
|
||||
context.ast_context(), clang::TagTypeKind::Class, decl_context, clang_loc,
|
||||
clang_loc, identifier_info);
|
||||
// If this is a member class, set its access.
|
||||
if (isa<clang::CXXRecordDecl>(decl_context)) {
|
||||
// TODO: Map Carbon access to C++ access.
|
||||
|
||||
Reference in New Issue
Block a user