@@ -248,7 +248,7 @@ Record *Program::getOrCreateRecord(const RecordDecl *RD) {
248248
249249 // Helper to get a base descriptor.
250250 auto GetBaseDesc = [this ](const RecordDecl *BD,
251- const Record *BR) -> Descriptor * {
251+ const Record *BR) -> const Descriptor * {
252252 if (!BR)
253253 return nullptr ;
254254 return allocateDescriptor (BD, BR, std::nullopt , /* isConst=*/ false ,
@@ -268,9 +268,9 @@ Record *Program::getOrCreateRecord(const RecordDecl *RD) {
268268 // In error cases, the base might not be a RecordType.
269269 if (const auto *RT = Spec.getType ()->getAs <RecordType>()) {
270270 const RecordDecl *BD = RT->getDecl ();
271+ const Record *BR = getOrCreateRecord (BD);
271272
272- Record *BR = getOrCreateRecord (BD);
273- if (Descriptor *Desc = GetBaseDesc (BD, BR)) {
273+ if (const Descriptor *Desc = GetBaseDesc (BD, BR)) {
274274 BaseSize += align (sizeof (InlineDescriptor));
275275 Bases.push_back ({BD, BaseSize, Desc, BR});
276276 BaseSize += align (BR->getSize ());
@@ -284,9 +284,9 @@ Record *Program::getOrCreateRecord(const RecordDecl *RD) {
284284
285285 if (const auto *RT = Spec.getType ()->getAs <RecordType>()) {
286286 const RecordDecl *BD = RT->getDecl ();
287- Record *BR = getOrCreateRecord (BD);
287+ const Record *BR = getOrCreateRecord (BD);
288288
289- if (Descriptor *Desc = GetBaseDesc (BD, BR)) {
289+ if (const Descriptor *Desc = GetBaseDesc (BD, BR)) {
290290 VirtSize += align (sizeof (InlineDescriptor));
291291 VirtBases.push_back ({BD, VirtSize, Desc, BR});
292292 VirtSize += align (BR->getSize ());
@@ -307,7 +307,7 @@ Record *Program::getOrCreateRecord(const RecordDecl *RD) {
307307 QualType FT = FD->getType ();
308308 const bool IsConst = FT.isConstQualified ();
309309 const bool IsMutable = FD->isMutable ();
310- Descriptor *Desc;
310+ const Descriptor *Desc;
311311 if (std::optional<PrimType> T = Ctx.classify (FT)) {
312312 Desc = createDescriptor (FD, *T, std::nullopt , IsConst,
313313 /* isTemporary=*/ false , IsMutable);
0 commit comments