protected boolean updateBitFieldDataType(DataTypeComponentDB bitfieldComponent, DataType oldDt,
			DataType newDt) {
		if (!bitfieldComponent.isBitFieldComponent()) {
			throw new AssertException("expected bitfield component");
		}

		BitFieldDBDataType bitfieldDt = (BitFieldDBDataType) bitfieldComponent.getDataType();
		if (bitfieldDt.getBaseDataType() != oldDt || !BitFieldDataType.isValidBaseDataType(newDt)) {
			return false;
		}

		if (newDt != null) {
			int maxBitSize = 8 * newDt.getLength();
			if (bitfieldDt.getBitSize() > maxBitSize) {
				// Replacement datatype too small for bitfield
				return false;
			}
		}

		try {
			BitFieldDBDataType newBitfieldDt = new BitFieldDBDataType(newDt,
				bitfieldDt.getDeclaredBitSize(), bitfieldDt.getBitOffset());
			bitfieldComponent.setDataType(newBitfieldDt);
			oldDt.removeParent(this);
			newDt.addParent(this);
		}
		catch (InvalidDataTypeException e) {
			throw new AssertException(e); // unexpected
		}

		return true;
	}
Handle replacement of datatype which may impact bitfield datatype.

@param bitfieldComponent bitfield component
@param oldDt             affected datatype which has been removed or replaced
@param newDt             replacement datatype
@return                  true if bitfield component was modified
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/data/CompositeDB.java