@@ -450,10 +450,13 @@ let Class = PropertyTypeCase<APValue, "LValue"> in {
450
450
lvalueBase ? lvalueBase.dyn_cast<const Expr *>() : nullptr;
451
451
bool lvalueBaseIsExpr = (bool) expr;
452
452
bool lvalueBaseIsTypeInfo = lvalueBase.is<TypeInfoLValue>();
453
+ bool lvalueBaseIsDynamicAlloc = lvalueBase.is<DynamicAllocLValue>();
453
454
QualType elemTy;
454
455
if (lvalueBase) {
455
456
if (lvalueBaseIsTypeInfo) {
456
457
elemTy = lvalueBase.getTypeInfoType();
458
+ } else if (lvalueBaseIsDynamicAlloc) {
459
+ elemTy = lvalueBase.getDynamicAllocType();
457
460
} else if (lvalueBaseIsExpr) {
458
461
elemTy = expr->getType();
459
462
} else {
@@ -473,6 +476,9 @@ let Class = PropertyTypeCase<APValue, "LValue"> in {
473
476
def : Property<"isTypeInfo", Bool> {
474
477
let Read = [{ lvalueBaseIsTypeInfo }];
475
478
}
479
+ def : Property<"isDynamicAlloc", Bool> {
480
+ let Read = [{ lvalueBaseIsDynamicAlloc }];
481
+ }
476
482
def : Property<"hasBase", Bool> {
477
483
let Read = [{ static_cast<bool>(lvalueBase) }];
478
484
}
@@ -485,9 +491,17 @@ let Class = PropertyTypeCase<APValue, "LValue"> in {
485
491
QualType(node.getLValueBase().get<TypeInfoLValue>().getType(), 0)
486
492
}];
487
493
}
494
+ def : Property<"dynamicAlloc", UInt32> {
495
+ let Conditional = [{ hasBase && isDynamicAlloc }];
496
+ let Read = [{ node.getLValueBase().get<DynamicAllocLValue>().getIndex() }];
497
+ }
488
498
def : Property<"type", QualType> {
489
- let Conditional = [{ hasBase && isTypeInfo }];
490
- let Read = [{ node.getLValueBase().getTypeInfoType() }];
499
+ let Conditional = [{ hasBase && (isTypeInfo || isDynamicAlloc) }];
500
+ let Read = [{
501
+ isTypeInfo
502
+ ? node.getLValueBase().getTypeInfoType()
503
+ : node.getLValueBase().getDynamicAllocType()
504
+ }];
491
505
}
492
506
def : Property<"callIndex", UInt32> {
493
507
let Conditional = [{ hasBase && !isTypeInfo }];
@@ -502,7 +516,7 @@ let Class = PropertyTypeCase<APValue, "LValue"> in {
502
516
let Read = [{ const_cast<Expr *>(expr) }];
503
517
}
504
518
def : Property<"decl", DeclRef> {
505
- let Conditional = [{ hasBase && !isTypeInfo && !isExpr }];
519
+ let Conditional = [{ hasBase && !isTypeInfo && !isDynamicAlloc && ! isExpr }];
506
520
let Read = [{ lvalueBase.get<const ValueDecl *>() }];
507
521
}
508
522
def : Property<"offsetQuantity", UInt32> {
@@ -521,6 +535,9 @@ let Class = PropertyTypeCase<APValue, "LValue"> in {
521
535
if (isTypeInfo) {
522
536
base = APValue::LValueBase::getTypeInfo(
523
537
TypeInfoLValue(typeInfo->getTypePtr()), *type);
538
+ } else if (isDynamicAlloc) {
539
+ base = APValue::LValueBase::getDynamicAlloc(
540
+ DynamicAllocLValue(*dynamicAlloc), *type);
524
541
} else if (isExpr) {
525
542
base = APValue::LValueBase(cast<Expr>(*stmt),
526
543
*callIndex, *version);
0 commit comments