- /// refineAbstractType - The callback method invoked when an abstract type is
- /// resolved to another type. An object must override this method to update
- /// its internal state to reference NewType instead of OldType.
- ///
- virtual void refineAbstractType(const DerivedType *OldTy,
- const Type *) {
- const StructType *STy = dyn_cast<const StructType>(OldTy);
- if (!STy) {
- OldTy->removeAbstractTypeUser(this);
- return;
- }
-
- StructLayout *SL = LayoutInfo[STy];
- if (SL) {
- SL->~StructLayout();
- free(SL);
- LayoutInfo[STy] = NULL;
- }
-
- OldTy->removeAbstractTypeUser(this);
- }
-
- /// typeBecameConcrete - The other case which AbstractTypeUsers must be aware
- /// of is when a type makes the transition from being abstract (where it has
- /// clients on its AbstractTypeUsers list) to concrete (where it does not).
- /// This method notifies ATU's when this occurs for a type.
- ///
- virtual void typeBecameConcrete(const DerivedType *AbsTy) {
- const StructType *STy = dyn_cast<const StructType>(AbsTy);
- if (!STy) {
- AbsTy->removeAbstractTypeUser(this);
- return;
- }
-
- StructLayout *SL = LayoutInfo[STy];
- if (SL) {
- SL->~StructLayout();
- free(SL);
- LayoutInfo[STy] = NULL;
- }
-
- AbsTy->removeAbstractTypeUser(this);
- }
-
- bool insert(const Type *Ty) {
- if (Ty->isAbstract())
- Ty->addAbstractTypeUser(this);
- return true;
- }
-