const ReferenceType *RefTy) {
LValueBaseInfo BaseInfo;
Address Addr = EmitLoadOfReference(RefAddr, RefTy, &BaseInfo);
- return MakeAddrLValue(Addr, RefTy->getPointeeType(), BaseInfo);
+ return MakeAddrLValue(Addr, RefTy->getPointeeType(), BaseInfo,
+ CGM.getTBAAAccessInfo(RefTy->getPointeeType()));
}
Address CodeGenFunction::EmitLoadOfPointer(Address Ptr,
const PointerType *PtrTy) {
LValueBaseInfo BaseInfo;
Address Addr = EmitLoadOfPointer(PtrAddr, PtrTy, &BaseInfo);
- return MakeAddrLValue(Addr, PtrTy->getPointeeType(), BaseInfo);
+ return MakeAddrLValue(Addr, PtrTy->getPointeeType(), BaseInfo,
+ CGM.getTBAAAccessInfo(PtrTy->getPointeeType()));
}
static LValue EmitGlobalVarDeclLValue(CodeGenFunction &CGF,
bool MayAlias = CapLVal.getBaseInfo().getMayAlias();
return MakeAddrLValue(
Address(CapLVal.getPointer(), getContext().getDeclAlign(VD)),
- CapLVal.getType(), LValueBaseInfo(AlignmentSource::Decl, MayAlias));
+ CapLVal.getType(), LValueBaseInfo(AlignmentSource::Decl, MayAlias),
+ CGM.getTBAAAccessInfo(CapLVal.getType()));
}
assert(isa<BlockDecl>(CurCodeDecl));
LValueBaseInfo BaseInfo;
Address Addr = EmitPointerWithAlignment(E->getSubExpr(), &BaseInfo);
- LValue LV = MakeAddrLValue(Addr, T, BaseInfo);
+ LValue LV = MakeAddrLValue(Addr, T, BaseInfo, CGM.getTBAAAccessInfo(T));
LV.getQuals().setAddressSpace(ExprTy.getAddressSpace());
// We should not generate __weak write barrier on indirect reference
(E->getOpcode() == UO_Real
? emitAddrOfRealComponent(LV.getAddress(), LV.getType())
: emitAddrOfImagComponent(LV.getAddress(), LV.getType()));
- LValue ElemLV = MakeAddrLValue(Component, T, LV.getBaseInfo());
+ LValue ElemLV = MakeAddrLValue(Component, T, LV.getBaseInfo(),
+ CGM.getTBAAAccessInfo(T));
ElemLV.getQuals().addQualifiers(LV.getQuals());
return ElemLV;
}
QualType EltType = LV.getType()->castAs<VectorType>()->getElementType();
Addr = emitArraySubscriptGEP(*this, Addr, Idx, EltType, /*inbounds*/ true,
SignedIndices, E->getExprLoc());
- return MakeAddrLValue(Addr, EltType, LV.getBaseInfo());
+ return MakeAddrLValue(Addr, EltType, LV.getBaseInfo(),
+ CGM.getTBAAAccessInfo(EltType));
}
LValueBaseInfo BaseInfo;
SignedIndices, E->getExprLoc());
}
- LValue LV = MakeAddrLValue(Addr, E->getType(), BaseInfo);
+ LValue LV = MakeAddrLValue(Addr, E->getType(), BaseInfo,
+ CGM.getTBAAAccessInfo(E->getType()));
// TODO: Preserve/extend path TBAA metadata?
/*SignedIndices=*/false, E->getExprLoc());
}
- return MakeAddrLValue(EltPtr, ResultExprTy, BaseInfo);
+ return MakeAddrLValue(EltPtr, ResultExprTy, BaseInfo,
+ CGM.getTBAAAccessInfo(ResultExprTy));
}
LValue CodeGenFunction::
LValueBaseInfo BaseInfo;
Address Ptr = EmitPointerWithAlignment(E->getBase(), &BaseInfo);
const PointerType *PT = E->getBase()->getType()->getAs<PointerType>();
- Base = MakeAddrLValue(Ptr, PT->getPointeeType(), BaseInfo);
+ Base = MakeAddrLValue(Ptr, PT->getPointeeType(), BaseInfo,
+ CGM.getTBAAAccessInfo(PT->getPointeeType()));
Base.getQuals().removeObjCGCAttr();
} else if (E->getBase()->isGLValue()) {
// Otherwise, if the base is an lvalue ( as in the case of foo.x.x),
SkippedChecks.set(SanitizerKind::Null, true);
EmitTypeCheck(TCK_MemberAccess, E->getExprLoc(), Addr.getPointer(), PtrTy,
/*Alignment=*/CharUnits::Zero(), SkippedChecks);
- BaseLV = MakeAddrLValue(Addr, PtrTy, BaseInfo);
+ BaseLV = MakeAddrLValue(Addr, PtrTy, BaseInfo,
+ CGM.getTBAAAccessInfo(PtrTy));
} else
BaseLV = EmitCheckedLValue(BaseExpr, TCK_MemberAccess);
if (field->hasAttr<AnnotateAttr>())
addr = EmitFieldAnnotations(field, addr);
- LValue LV = MakeAddrLValue(addr, type, FieldBaseInfo);
+ LValue LV = MakeAddrLValue(addr, type, FieldBaseInfo,
+ CGM.getTBAAAccessInfo(type));
LV.getQuals().addCVRQualifiers(cvr);
// Fields of may_alias structs act like 'char' for TBAA purposes.
LValueBaseInfo FieldBaseInfo(
getFieldAlignmentSource(BaseInfo.getAlignmentSource()),
BaseInfo.getMayAlias());
- return MakeAddrLValue(V, FieldType, FieldBaseInfo);
+ return MakeAddrLValue(V, FieldType, FieldBaseInfo,
+ CGM.getTBAAAccessInfo(FieldType));
}
LValue CodeGenFunction::EmitCompoundLiteralLValue(const CompoundLiteralExpr *E){
bool MayAlias = lhs->getBaseInfo().getMayAlias() ||
rhs->getBaseInfo().getMayAlias();
return MakeAddrLValue(result, expr->getType(),
- LValueBaseInfo(alignSource, MayAlias));
+ LValueBaseInfo(alignSource, MayAlias),
+ CGM.getTBAAAccessInfo(expr->getType()));
} else {
assert((lhs || rhs) &&
"both operands of glvalue conditional are throw-expressions?");
This, DerivedClassDecl, E->path_begin(), E->path_end(),
/*NullCheckValue=*/false, E->getExprLoc());
- return MakeAddrLValue(Base, E->getType(), LV.getBaseInfo());
+ return MakeAddrLValue(Base, E->getType(), LV.getBaseInfo(),
+ CGM.getTBAAAccessInfo(E->getType()));
}
case CK_ToUnion:
return EmitAggExprToLValue(E);
/*MayBeNull=*/false,
CFITCK_DerivedCast, E->getLocStart());
- return MakeAddrLValue(Derived, E->getType(), LV.getBaseInfo());
+ return MakeAddrLValue(Derived, E->getType(), LV.getBaseInfo(),
+ CGM.getTBAAAccessInfo(E->getType()));
}
case CK_LValueBitCast: {
// This must be a reinterpret_cast (or c-style equivalent).
/*MayBeNull=*/false,
CFITCK_UnrelatedCast, E->getLocStart());
- return MakeAddrLValue(V, E->getType(), LV.getBaseInfo());
+ return MakeAddrLValue(V, E->getType(), LV.getBaseInfo(),
+ CGM.getTBAAAccessInfo(E->getType()));
}
case CK_ObjCObjectLValueCast: {
LValue LV = EmitLValue(E->getSubExpr());
Address V = Builder.CreateElementBitCast(LV.getAddress(),
ConvertType(E->getType()));
- return MakeAddrLValue(V, E->getType(), LV.getBaseInfo());
+ return MakeAddrLValue(V, E->getType(), LV.getBaseInfo(),
+ CGM.getTBAAAccessInfo(E->getType()));
}
case CK_ZeroToOCLQueue:
llvm_unreachable("NULL to OpenCL queue lvalue cast is not valid");
Address MemberAddr =
EmitCXXMemberDataPointerAddress(E, BaseAddr, OffsetV, MPT, &BaseInfo);
- return MakeAddrLValue(MemberAddr, MPT->getPointeeType(), BaseInfo);
+ return MakeAddrLValue(MemberAddr, MPT->getPointeeType(), BaseInfo,
+ CGM.getTBAAAccessInfo(MPT->getPointeeType()));
}
/// Given the address of a temporary variable, produce an r-value of
SharedLVal = CGF.MakeAddrLValue(
CGF.Builder.CreateElementBitCast(SharedLVal.getAddress(),
CGF.ConvertTypeForMem(SharedType)),
- SharedType, SharedAddresses[N].first.getBaseInfo());
+ SharedType, SharedAddresses[N].first.getBaseInfo(),
+ CGF.CGM.getTBAAAccessInfo(SharedType));
if (isa<OMPArraySectionExpr>(ClausesData[N].Ref) ||
CGF.getContext().getAsArrayType(PrivateVD->getType())) {
emitAggregateInitialization(CGF, N, PrivateAddr, SharedLVal, DRD);
return CGF.MakeAddrLValue(
CGF.Builder.CreateElementBitCast(BaseLV.getAddress(),
CGF.ConvertTypeForMem(ElTy)),
- BaseLV.getType(), BaseLV.getBaseInfo());
+ BaseLV.getType(), BaseLV.getBaseInfo(),
+ CGF.CGM.getTBAAAccessInfo(BaseLV.getType()));
}
static Address castToBase(CodeGenFunction &CGF, QualType BaseTy, QualType ElTy,
Address(SharedRefLValue.getPointer(), C.getDeclAlign(OriginalVD)),
SharedRefLValue.getType(),
LValueBaseInfo(AlignmentSource::Decl,
- SharedRefLValue.getBaseInfo().getMayAlias()));
+ SharedRefLValue.getBaseInfo().getMayAlias()),
+ CGF.CGM.getTBAAAccessInfo(SharedRefLValue.getType()));
QualType Type = OriginalVD->getType();
if (Type->isArrayType()) {
// Initialize firstprivate array.