@@ -315,14 +315,14 @@ Descriptor *Program::createDescriptor(const DeclTy &D, const Type *Ty,
315
315
bool IsConst, bool IsTemporary,
316
316
bool IsMutable, const Expr *Init) {
317
317
// Classes and structures.
318
- if (auto *RT = Ty->getAs <RecordType>()) {
319
- if (auto *Record = getOrCreateRecord (RT->getDecl ()))
318
+ if (const auto *RT = Ty->getAs <RecordType>()) {
319
+ if (const auto *Record = getOrCreateRecord (RT->getDecl ()))
320
320
return allocateDescriptor (D, Record, MDSize, IsConst, IsTemporary,
321
321
IsMutable);
322
322
}
323
323
324
324
// Arrays.
325
- if (auto ArrayType = Ty->getAsArrayTypeUnsafe ()) {
325
+ if (const auto ArrayType = Ty->getAsArrayTypeUnsafe ()) {
326
326
QualType ElemTy = ArrayType->getElementType ();
327
327
// Array of well-known bounds.
328
328
if (auto CAT = dyn_cast<ConstantArrayType>(ArrayType)) {
@@ -338,7 +338,7 @@ Descriptor *Program::createDescriptor(const DeclTy &D, const Type *Ty,
338
338
} else {
339
339
// Arrays of composites. In this case, the array is a list of pointers,
340
340
// followed by the actual elements.
341
- Descriptor *ElemDesc = createDescriptor (
341
+ const Descriptor *ElemDesc = createDescriptor (
342
342
D, ElemTy.getTypePtr (), std::nullopt, IsConst, IsTemporary);
343
343
if (!ElemDesc)
344
344
return nullptr ;
@@ -358,8 +358,8 @@ Descriptor *Program::createDescriptor(const DeclTy &D, const Type *Ty,
358
358
return allocateDescriptor (D, *T, IsTemporary,
359
359
Descriptor::UnknownSize{});
360
360
} else {
361
- Descriptor *Desc = createDescriptor (D, ElemTy.getTypePtr (), MDSize ,
362
- IsConst, IsTemporary);
361
+ const Descriptor *Desc = createDescriptor (D, ElemTy.getTypePtr (),
362
+ MDSize, IsConst, IsTemporary);
363
363
if (!Desc)
364
364
return nullptr ;
365
365
return allocateDescriptor (D, Desc, IsTemporary,
@@ -369,14 +369,14 @@ Descriptor *Program::createDescriptor(const DeclTy &D, const Type *Ty,
369
369
}
370
370
371
371
// Atomic types.
372
- if (auto *AT = Ty->getAs <AtomicType>()) {
372
+ if (const auto *AT = Ty->getAs <AtomicType>()) {
373
373
const Type *InnerTy = AT->getValueType ().getTypePtr ();
374
374
return createDescriptor (D, InnerTy, MDSize, IsConst, IsTemporary,
375
375
IsMutable);
376
376
}
377
377
378
378
// Complex types - represented as arrays of elements.
379
- if (auto *CT = Ty->getAs <ComplexType>()) {
379
+ if (const auto *CT = Ty->getAs <ComplexType>()) {
380
380
PrimType ElemTy = *Ctx.classify (CT->getElementType ());
381
381
return allocateDescriptor (D, ElemTy, MDSize, 2 , IsConst, IsTemporary,
382
382
IsMutable);
0 commit comments