Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions rs_bindings_from_cc/importers/cxx_record.cc
Original file line number Diff line number Diff line change
Expand Up @@ -638,12 +638,21 @@ absl::StatusOr<TemplateSpecialization::Kind> GetTemplateSpecializationKind(
}
} else if (top_level_namespace == "c9") {
if (templated_decl->getName() == "Co") {
LOG_IF(FATAL, specialization_decl->getTemplateArgs().size() != 1)
<< "c9::Co should have one template arg";
if (specialization_decl->getTemplateArgs().size() != 1) {
return absl::InvalidArgumentError(
"c9::Co should have one template arg");
}
// TODO(b/454627672): is specialization_decl the right decl to check for
// assumed_lifetimes?
clang::QualType t = specialization_decl->getTemplateArgs()[0].getAsType();
// Check that t is completable, or void (which is always incomplete).
if (!t->isVoidType() &&
!ictx.sema_.isCompleteType(specialization_decl->getLocation(), t)) {
return absl::InvalidArgumentError(absl::StrCat(
"c9::Co return type is incomplete: ", t.getAsString()));
}
return TemplateSpecialization::C9Co(TemplateArg(ictx.ConvertQualType(
specialization_decl->getTemplateArgs()[0].getAsType(),
t,
/*lifetimes=*/nullptr, /*nullable=*/true,
ictx.AreAssumedLifetimesEnabledForTarget(
ictx.GetOwningTarget(specialization_decl)))));
Expand Down
Loading