TypeAndOrName AppleObjCRuntime::FixUpDynamicType (const TypeAndOrName& type_and_or_name, ValueObject& static_value) { CompilerType static_type(static_value.GetCompilerType()); Flags static_type_flags(static_type.GetTypeInfo()); TypeAndOrName ret(type_and_or_name); if (type_and_or_name.HasType()) { // The type will always be the type of the dynamic object. If our parent's type was a pointer, // then our type should be a pointer to the type of the dynamic object. If a reference, then the original type // should be okay... CompilerType orig_type = type_and_or_name.GetCompilerType(); CompilerType corrected_type = orig_type; if (static_type_flags.AllSet(eTypeIsPointer)) corrected_type = orig_type.GetPointerType (); ret.SetCompilerType(corrected_type); } else { // If we are here we need to adjust our dynamic type name to include the correct & or * symbol std::string corrected_name (type_and_or_name.GetName().GetCString()); if (static_type_flags.AllSet(eTypeIsPointer)) corrected_name.append(" *"); // the parent type should be a correctly pointer'ed or referenc'ed type ret.SetCompilerType(static_type); ret.SetName(corrected_name.c_str()); } return ret; }
static TypeAndOrName FixupTypeAndOrName (const TypeAndOrName& type_andor_name, ValueObject& parent) { TypeAndOrName ret(type_andor_name); if (type_andor_name.HasType()) { // The type will always be the type of the dynamic object. If our parent's type was a pointer, // then our type should be a pointer to the type of the dynamic object. If a reference, then the original type // should be okay... ClangASTType orig_type = type_andor_name.GetClangASTType(); ClangASTType corrected_type = orig_type; if (parent.IsPointerType()) corrected_type = orig_type.GetPointerType (); else if (parent.IsPointerOrReferenceType()) corrected_type = orig_type.GetLValueReferenceType (); ret.SetClangASTType(corrected_type); } else /*if (m_dynamic_type_info.HasName())*/ { // If we are here we need to adjust our dynamic type name to include the correct & or * symbol std::string corrected_name (type_andor_name.GetName().GetCString()); if (parent.IsPointerType()) corrected_name.append(" *"); else if (parent.IsPointerOrReferenceType()) corrected_name.append(" &"); // the parent type should be a correctly pointer'ed or referenc'ed type ret.SetClangASTType(parent.GetClangType()); ret.SetName(corrected_name.c_str()); } return ret; }