mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 07:24:25 +00:00
Add support for objc property decls according to the page at:
http://llvm.org/docs/SourceLevelDebugging.html#objcproperty including type and DECL. Expand the metadata needed accordingly. rdar://11144023 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153639 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -211,12 +211,18 @@ namespace llvm {
|
|||||||
/// createObjCProperty - Create debugging information entry for Objective-C
|
/// createObjCProperty - Create debugging information entry for Objective-C
|
||||||
/// property.
|
/// property.
|
||||||
/// @param Name Property name.
|
/// @param Name Property name.
|
||||||
|
/// @param File File where this property is defined.
|
||||||
|
/// @param LineNumber Line number.
|
||||||
/// @param GetterName Name of the Objective C property getter selector.
|
/// @param GetterName Name of the Objective C property getter selector.
|
||||||
/// @param SetterName Name of the Objective C property setter selector.
|
/// @param SetterName Name of the Objective C property setter selector.
|
||||||
/// @param PropertyAttributes Objective C property attributes.
|
/// @param PropertyAttributes Objective C property attributes.
|
||||||
DIObjCProperty createObjCProperty(StringRef Name, StringRef GetterName,
|
/// @param Ty Type.
|
||||||
|
DIObjCProperty createObjCProperty(StringRef Name,
|
||||||
|
DIFile File, unsigned LineNumber,
|
||||||
|
StringRef GetterName,
|
||||||
StringRef SetterName,
|
StringRef SetterName,
|
||||||
unsigned PropertyAttributes);
|
unsigned PropertyAttributes,
|
||||||
|
DIType Ty);
|
||||||
|
|
||||||
/// createClassType - Create debugging information entry for a class.
|
/// createClassType - Create debugging information entry for a class.
|
||||||
/// @param Scope Scope in which this class is defined.
|
/// @param Scope Scope in which this class is defined.
|
||||||
|
@ -792,31 +792,36 @@ namespace llvm {
|
|||||||
explicit DIObjCProperty(const MDNode *N) : DIDescriptor(N) { }
|
explicit DIObjCProperty(const MDNode *N) : DIDescriptor(N) { }
|
||||||
|
|
||||||
StringRef getObjCPropertyName() const { return getStringField(1); }
|
StringRef getObjCPropertyName() const { return getStringField(1); }
|
||||||
|
DIFile getFile() const { return getFieldAs<DIFile>(2); }
|
||||||
|
unsigned getLineNumber() const { return getUnsignedField(3); }
|
||||||
|
|
||||||
StringRef getObjCPropertyGetterName() const {
|
StringRef getObjCPropertyGetterName() const {
|
||||||
return getStringField(2);
|
return getStringField(4);
|
||||||
}
|
}
|
||||||
StringRef getObjCPropertySetterName() const {
|
StringRef getObjCPropertySetterName() const {
|
||||||
return getStringField(3);
|
return getStringField(5);
|
||||||
}
|
}
|
||||||
bool isReadOnlyObjCProperty() {
|
bool isReadOnlyObjCProperty() {
|
||||||
return (getUnsignedField(4) & dwarf::DW_APPLE_PROPERTY_readonly) != 0;
|
return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_readonly) != 0;
|
||||||
}
|
}
|
||||||
bool isReadWriteObjCProperty() {
|
bool isReadWriteObjCProperty() {
|
||||||
return (getUnsignedField(4) & dwarf::DW_APPLE_PROPERTY_readwrite) != 0;
|
return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_readwrite) != 0;
|
||||||
}
|
}
|
||||||
bool isAssignObjCProperty() {
|
bool isAssignObjCProperty() {
|
||||||
return (getUnsignedField(4) & dwarf::DW_APPLE_PROPERTY_assign) != 0;
|
return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_assign) != 0;
|
||||||
}
|
}
|
||||||
bool isRetainObjCProperty() {
|
bool isRetainObjCProperty() {
|
||||||
return (getUnsignedField(4) & dwarf::DW_APPLE_PROPERTY_retain) != 0;
|
return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_retain) != 0;
|
||||||
}
|
}
|
||||||
bool isCopyObjCProperty() {
|
bool isCopyObjCProperty() {
|
||||||
return (getUnsignedField(4) & dwarf::DW_APPLE_PROPERTY_copy) != 0;
|
return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_copy) != 0;
|
||||||
}
|
}
|
||||||
bool isNonAtomicObjCProperty() {
|
bool isNonAtomicObjCProperty() {
|
||||||
return (getUnsignedField(4) & dwarf::DW_APPLE_PROPERTY_nonatomic) != 0;
|
return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_nonatomic) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DIType getType() const { return getFieldAs<DIType>(7); }
|
||||||
|
|
||||||
/// Verify - Verify that a derived type descriptor is well formed.
|
/// Verify - Verify that a derived type descriptor is well formed.
|
||||||
bool Verify() const;
|
bool Verify() const;
|
||||||
|
|
||||||
|
@ -386,15 +386,20 @@ DIType DIBuilder::createObjCIVar(StringRef Name,
|
|||||||
/// createObjCProperty - Create debugging information entry for Objective-C
|
/// createObjCProperty - Create debugging information entry for Objective-C
|
||||||
/// property.
|
/// property.
|
||||||
DIObjCProperty DIBuilder::createObjCProperty(StringRef Name,
|
DIObjCProperty DIBuilder::createObjCProperty(StringRef Name,
|
||||||
|
DIFile File, unsigned LineNumber,
|
||||||
StringRef GetterName,
|
StringRef GetterName,
|
||||||
StringRef SetterName,
|
StringRef SetterName,
|
||||||
unsigned PropertyAttributes) {
|
unsigned PropertyAttributes,
|
||||||
|
DIType Ty) {
|
||||||
Value *Elts[] = {
|
Value *Elts[] = {
|
||||||
GetTagConstant(VMContext, dwarf::DW_TAG_APPLE_Property),
|
GetTagConstant(VMContext, dwarf::DW_TAG_APPLE_Property),
|
||||||
MDString::get(VMContext, Name),
|
MDString::get(VMContext, Name),
|
||||||
|
File,
|
||||||
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
|
||||||
MDString::get(VMContext, GetterName),
|
MDString::get(VMContext, GetterName),
|
||||||
MDString::get(VMContext, SetterName),
|
MDString::get(VMContext, SetterName),
|
||||||
ConstantInt::get(Type::getInt32Ty(VMContext), PropertyAttributes)
|
ConstantInt::get(Type::getInt32Ty(VMContext), PropertyAttributes),
|
||||||
|
Ty
|
||||||
};
|
};
|
||||||
return DIObjCProperty(MDNode::get(VMContext, Elts));
|
return DIObjCProperty(MDNode::get(VMContext, Elts));
|
||||||
}
|
}
|
||||||
|
@ -377,6 +377,19 @@ bool DICompileUnit::Verify() const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Verify - Verify that an ObjC property is well formed.
|
||||||
|
bool DIObjCProperty::Verify() const {
|
||||||
|
if (!DbgNode)
|
||||||
|
return false;
|
||||||
|
unsigned Tag = getTag();
|
||||||
|
if (Tag != dwarf::DW_TAG_APPLE_Property) return false;
|
||||||
|
DIType Ty = getType();
|
||||||
|
if (!Ty.Verify()) return false;
|
||||||
|
|
||||||
|
// Don't worry about the rest of the strings for now.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// Verify - Verify that a type descriptor is well formed.
|
/// Verify - Verify that a type descriptor is well formed.
|
||||||
bool DIType::Verify() const {
|
bool DIType::Verify() const {
|
||||||
if (!DbgNode)
|
if (!DbgNode)
|
||||||
|
@ -186,6 +186,24 @@ void CompileUnit::addSourceLine(DIE *Die, DIType Ty) {
|
|||||||
addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);
|
addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// addSourceLine - Add location information to specified debug information
|
||||||
|
/// entry.
|
||||||
|
void CompileUnit::addSourceLine(DIE *Die, DIObjCProperty Ty) {
|
||||||
|
// Verify type.
|
||||||
|
if (!Ty.Verify())
|
||||||
|
return;
|
||||||
|
|
||||||
|
unsigned Line = Ty.getLineNumber();
|
||||||
|
if (Line == 0)
|
||||||
|
return;
|
||||||
|
DIFile File = Ty.getFile();
|
||||||
|
unsigned FileID = DD->GetOrCreateSourceID(File.getFilename(),
|
||||||
|
File.getDirectory());
|
||||||
|
assert(FileID && "Invalid file id");
|
||||||
|
addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);
|
||||||
|
addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);
|
||||||
|
}
|
||||||
|
|
||||||
/// addSourceLine - Add location information to specified debug information
|
/// addSourceLine - Add location information to specified debug information
|
||||||
/// entry.
|
/// entry.
|
||||||
void CompileUnit::addSourceLine(DIE *Die, DINameSpace NS) {
|
void CompileUnit::addSourceLine(DIE *Die, DINameSpace NS) {
|
||||||
@ -839,6 +857,8 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
|
|||||||
ElemDie = new DIE(Property.getTag());
|
ElemDie = new DIE(Property.getTag());
|
||||||
StringRef PropertyName = Property.getObjCPropertyName();
|
StringRef PropertyName = Property.getObjCPropertyName();
|
||||||
addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName);
|
addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName);
|
||||||
|
addType(ElemDie, Property.getType());
|
||||||
|
addSourceLine(ElemDie, Property);
|
||||||
StringRef GetterName = Property.getObjCPropertyGetterName();
|
StringRef GetterName = Property.getObjCPropertyGetterName();
|
||||||
if (!GetterName.empty())
|
if (!GetterName.empty())
|
||||||
addString(ElemDie, dwarf::DW_AT_APPLE_property_getter, GetterName);
|
addString(ElemDie, dwarf::DW_AT_APPLE_property_getter, GetterName);
|
||||||
|
@ -213,6 +213,7 @@ public:
|
|||||||
void addSourceLine(DIE *Die, DISubprogram SP);
|
void addSourceLine(DIE *Die, DISubprogram SP);
|
||||||
void addSourceLine(DIE *Die, DIType Ty);
|
void addSourceLine(DIE *Die, DIType Ty);
|
||||||
void addSourceLine(DIE *Die, DINameSpace NS);
|
void addSourceLine(DIE *Die, DINameSpace NS);
|
||||||
|
void addSourceLine(DIE *Die, DIObjCProperty Ty);
|
||||||
|
|
||||||
/// addAddress - Add an address attribute to a die based on the location
|
/// addAddress - Add an address attribute to a die based on the location
|
||||||
/// provided.
|
/// provided.
|
||||||
|
Reference in New Issue
Block a user