mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-03 14:21:30 +00:00 
			
		
		
		
	Debug Info IR: Switch DIObjCProperty to use DITypeRef.
This is a prerequisite for turning on ODR type uniquing for ObjC++. rdar://problem/21377883 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239780 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		@@ -2092,7 +2092,7 @@ class DIObjCProperty : public DINode {
 | 
				
			|||||||
  static DIObjCProperty *
 | 
					  static DIObjCProperty *
 | 
				
			||||||
  getImpl(LLVMContext &Context, StringRef Name, DIFile *File, unsigned Line,
 | 
					  getImpl(LLVMContext &Context, StringRef Name, DIFile *File, unsigned Line,
 | 
				
			||||||
          StringRef GetterName, StringRef SetterName, unsigned Attributes,
 | 
					          StringRef GetterName, StringRef SetterName, unsigned Attributes,
 | 
				
			||||||
          DIType *Type, StorageType Storage, bool ShouldCreate = true) {
 | 
					          DITypeRef Type, StorageType Storage, bool ShouldCreate = true) {
 | 
				
			||||||
    return getImpl(Context, getCanonicalMDString(Context, Name), File, Line,
 | 
					    return getImpl(Context, getCanonicalMDString(Context, Name), File, Line,
 | 
				
			||||||
                   getCanonicalMDString(Context, GetterName),
 | 
					                   getCanonicalMDString(Context, GetterName),
 | 
				
			||||||
                   getCanonicalMDString(Context, SetterName), Attributes, Type,
 | 
					                   getCanonicalMDString(Context, SetterName), Attributes, Type,
 | 
				
			||||||
@@ -2114,7 +2114,7 @@ public:
 | 
				
			|||||||
  DEFINE_MDNODE_GET(DIObjCProperty,
 | 
					  DEFINE_MDNODE_GET(DIObjCProperty,
 | 
				
			||||||
                    (StringRef Name, DIFile *File, unsigned Line,
 | 
					                    (StringRef Name, DIFile *File, unsigned Line,
 | 
				
			||||||
                     StringRef GetterName, StringRef SetterName,
 | 
					                     StringRef GetterName, StringRef SetterName,
 | 
				
			||||||
                     unsigned Attributes, DIType *Type),
 | 
					                     unsigned Attributes, DITypeRef Type),
 | 
				
			||||||
                    (Name, File, Line, GetterName, SetterName, Attributes,
 | 
					                    (Name, File, Line, GetterName, SetterName, Attributes,
 | 
				
			||||||
                     Type))
 | 
					                     Type))
 | 
				
			||||||
  DEFINE_MDNODE_GET(DIObjCProperty,
 | 
					  DEFINE_MDNODE_GET(DIObjCProperty,
 | 
				
			||||||
@@ -2132,12 +2132,7 @@ public:
 | 
				
			|||||||
  DIFile *getFile() const { return cast_or_null<DIFile>(getRawFile()); }
 | 
					  DIFile *getFile() const { return cast_or_null<DIFile>(getRawFile()); }
 | 
				
			||||||
  StringRef getGetterName() const { return getStringOperand(2); }
 | 
					  StringRef getGetterName() const { return getStringOperand(2); }
 | 
				
			||||||
  StringRef getSetterName() const { return getStringOperand(3); }
 | 
					  StringRef getSetterName() const { return getStringOperand(3); }
 | 
				
			||||||
 | 
					  DITypeRef getType() const { return DITypeRef(getRawType()); }
 | 
				
			||||||
  /// \brief Get the type.
 | 
					 | 
				
			||||||
  ///
 | 
					 | 
				
			||||||
  /// \note Objective-C doesn't have an ODR, so there is no benefit in storing
 | 
					 | 
				
			||||||
  /// a type ref here.
 | 
					 | 
				
			||||||
  DIType *getType() const { return cast_or_null<DIType>(getRawType()); }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  StringRef getFilename() const {
 | 
					  StringRef getFilename() const {
 | 
				
			||||||
    if (auto *F = getFile())
 | 
					    if (auto *F = getFile())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -931,7 +931,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const DICompositeType *CTy) {
 | 
				
			|||||||
        StringRef PropertyName = Property->getName();
 | 
					        StringRef PropertyName = Property->getName();
 | 
				
			||||||
        addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName);
 | 
					        addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName);
 | 
				
			||||||
        if (Property->getType())
 | 
					        if (Property->getType())
 | 
				
			||||||
          addType(ElemDie, Property->getType());
 | 
					          addType(ElemDie, resolve(Property->getType()));
 | 
				
			||||||
        addSourceLine(ElemDie, Property);
 | 
					        addSourceLine(ElemDie, Property);
 | 
				
			||||||
        StringRef GetterName = Property->getGetterName();
 | 
					        StringRef GetterName = Property->getGetterName();
 | 
				
			||||||
        if (!GetterName.empty())
 | 
					        if (!GetterName.empty())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -327,7 +327,8 @@ DIBuilder::createObjCProperty(StringRef Name, DIFile *File, unsigned LineNumber,
 | 
				
			|||||||
                              StringRef GetterName, StringRef SetterName,
 | 
					                              StringRef GetterName, StringRef SetterName,
 | 
				
			||||||
                              unsigned PropertyAttributes, DIType *Ty) {
 | 
					                              unsigned PropertyAttributes, DIType *Ty) {
 | 
				
			||||||
  return DIObjCProperty::get(VMContext, Name, File, LineNumber, GetterName,
 | 
					  return DIObjCProperty::get(VMContext, Name, File, LineNumber, GetterName,
 | 
				
			||||||
                             SetterName, PropertyAttributes, Ty);
 | 
					                             SetterName, PropertyAttributes,
 | 
				
			||||||
 | 
					                             DITypeRef::get(Ty));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DITemplateTypeParameter *
 | 
					DITemplateTypeParameter *
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1086,7 +1086,7 @@ void Verifier::visitDIExpression(const DIExpression &N) {
 | 
				
			|||||||
void Verifier::visitDIObjCProperty(const DIObjCProperty &N) {
 | 
					void Verifier::visitDIObjCProperty(const DIObjCProperty &N) {
 | 
				
			||||||
  Assert(N.getTag() == dwarf::DW_TAG_APPLE_property, "invalid tag", &N);
 | 
					  Assert(N.getTag() == dwarf::DW_TAG_APPLE_property, "invalid tag", &N);
 | 
				
			||||||
  if (auto *T = N.getRawType())
 | 
					  if (auto *T = N.getRawType())
 | 
				
			||||||
    Assert(isa<DIType>(T), "invalid type ref", &N, T);
 | 
					    Assert(isTypeRef(N, T), "invalid type ref", &N, T);
 | 
				
			||||||
  if (auto *F = N.getRawFile())
 | 
					  if (auto *F = N.getRawFile())
 | 
				
			||||||
    Assert(isa<DIFile>(F), "invalid file", &N, F);
 | 
					    Assert(isa<DIFile>(F), "invalid file", &N, F);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1945,7 +1945,7 @@ TEST_F(DIObjCPropertyTest, get) {
 | 
				
			|||||||
  StringRef GetterName = "getter";
 | 
					  StringRef GetterName = "getter";
 | 
				
			||||||
  StringRef SetterName = "setter";
 | 
					  StringRef SetterName = "setter";
 | 
				
			||||||
  unsigned Attributes = 7;
 | 
					  unsigned Attributes = 7;
 | 
				
			||||||
  DIType *Type = cast<DIBasicType>(getBasicType("basic"));
 | 
					  DITypeRef Type = getBasicType("basic");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  auto *N = DIObjCProperty::get(Context, Name, File, Line, GetterName,
 | 
					  auto *N = DIObjCProperty::get(Context, Name, File, Line, GetterName,
 | 
				
			||||||
                                SetterName, Attributes, Type);
 | 
					                                SetterName, Attributes, Type);
 | 
				
			||||||
@@ -1975,7 +1975,7 @@ TEST_F(DIObjCPropertyTest, get) {
 | 
				
			|||||||
                                   SetterName, Attributes + 1, Type));
 | 
					                                   SetterName, Attributes + 1, Type));
 | 
				
			||||||
  EXPECT_NE(N, DIObjCProperty::get(Context, Name, File, Line, GetterName,
 | 
					  EXPECT_NE(N, DIObjCProperty::get(Context, Name, File, Line, GetterName,
 | 
				
			||||||
                                   SetterName, Attributes,
 | 
					                                   SetterName, Attributes,
 | 
				
			||||||
                                   cast<DIBasicType>(getBasicType("other"))));
 | 
					                                   getBasicType("other")));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TempDIObjCProperty Temp = N->clone();
 | 
					  TempDIObjCProperty Temp = N->clone();
 | 
				
			||||||
  EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
 | 
					  EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user