@@ -1098,6 +1098,12 @@ class DIDerivedType : public DIType {
10981098
10991099 TempDIDerivedType clone() const { return cloneImpl (); }
11001100
1101+ TempDIDerivedType cloneWithAddressSpace (unsigned DWARFAddrSpace) const {
1102+ auto Tmp = clone ();
1103+ Tmp->DWARFAddressSpace = DWARFAddrSpace;
1104+ return Tmp;
1105+ }
1106+
11011107 // / Get the base type this is derived from.
11021108 DIType *getBaseType () const { return cast_or_null<DIType>(getRawBaseType ()); }
11031109 Metadata *getRawBaseType () const { return getOperand (3 ); }
@@ -3345,6 +3351,19 @@ class DIExpression : public MDNode {
33453351 element_iterator elements_begin () const { return getElements ().begin (); }
33463352 element_iterator elements_end () const { return getElements ().end (); }
33473353
3354+ // / Returns the pointer address space this DIOp-based DIExpression produces.
3355+ // / Note that this may diverge from the the pointer address space of the
3356+ // / result type. When there is a divergent address space, the DIExpression
3357+ // / must produce a generic pointer whose value can be proven to belong to a
3358+ // / more specific address space. For instance in this expression, this
3359+ // / function returns 4:
3360+ // /
3361+ // / !DIExpression(DIOpArg(0, ptr addrspace(4)), DIOpConvert(ptr))
3362+ // /
3363+ // / A divergent address space can be created by a DIOpConvert, and is
3364+ // / preserved across DIOpReinterpret.
3365+ std::optional<unsigned > getNewDivergentAddrSpace () const ;
3366+
33483367 // / A lightweight wrapper around an expression operand.
33493368 // /
33503369 // / TODO: Store arguments directly and change \a DIExpression to store a
0 commit comments