summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2012-02-04 00:59:25 +0000
committerDevang Patel <dpatel@apple.com>2012-02-04 00:59:25 +0000
commit1ea02d467a311b4846b942377d0b00fde987be65 (patch)
tree92afebc7ef93b63205b67f9ffd8460a7483e6cb2
parent2f2d1d7ec0a0178c76c29a13ab39d3f33d9b097b (diff)
downloadllvm-1ea02d467a311b4846b942377d0b00fde987be65.tar.gz
llvm-1ea02d467a311b4846b942377d0b00fde987be65.tar.bz2
llvm-1ea02d467a311b4846b942377d0b00fde987be65.tar.xz
Introduce DIObjCProperty. This will be used to encode objective-c property.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149732 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/DIBuilder.h11
-rw-r--r--include/llvm/Analysis/DebugInfo.h41
-rw-r--r--lib/Analysis/DIBuilder.cpp16
-rw-r--r--lib/Analysis/DebugInfo.cpp4
4 files changed, 72 insertions, 0 deletions
diff --git a/include/llvm/Analysis/DIBuilder.h b/include/llvm/Analysis/DIBuilder.h
index ee24226c74..3b2b8976db 100644
--- a/include/llvm/Analysis/DIBuilder.h
+++ b/include/llvm/Analysis/DIBuilder.h
@@ -42,6 +42,7 @@ namespace llvm {
class DISubprogram;
class DITemplateTypeParameter;
class DITemplateValueParameter;
+ class DIObjCProperty;
class DIBuilder {
private:
@@ -190,6 +191,16 @@ namespace llvm {
StringRef PropertySetterName = StringRef(),
unsigned PropertyAttributes = 0);
+ /// createObjCProperty - Create debugging information entry for Objective-C
+ /// property.
+ /// @param Name Property name.
+ /// @param GetterName Name of the Objective C property getter selector.
+ /// @param SetterName Name of the Objective C property setter selector.
+ /// @param PropertyAttributes Objective C property attributes.
+ DIObjCProperty createObjCProperty(StringRef Name, StringRef GetterName,
+ StringRef SetterName,
+ unsigned PropertyAttributes);
+
/// createClassType - Create debugging information entry for a class.
/// @param Scope Scope in which this class is defined.
/// @param Name class name.
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h
index f62dddd669..625ba2ed68 100644
--- a/include/llvm/Analysis/DebugInfo.h
+++ b/include/llvm/Analysis/DebugInfo.h
@@ -128,6 +128,7 @@ namespace llvm {
bool isUnspecifiedParameter() const;
bool isTemplateTypeParameter() const;
bool isTemplateValueParameter() const;
+ bool isObjCProperty() const;
};
/// DISubrange - This is used to represent ranges, for array bounds.
@@ -769,6 +770,46 @@ namespace llvm {
bool Verify() const;
};
+ class DIObjCProperty : public DIDescriptor {
+ public:
+ explicit DIObjCProperty(const MDNode *N) : DIDescriptor(N) { }
+
+ StringRef getObjCPropertyName() const { return getStringField(1); }
+ StringRef getObjCPropertyGetterName() const {
+ return getStringField(2);
+ }
+ StringRef getObjCPropertySetterName() const {
+ return getStringField(3);
+ }
+ bool isReadOnlyObjCProperty() {
+ return (getUnsignedField(4) & dwarf::DW_APPLE_PROPERTY_readonly) != 0;
+ }
+ bool isReadWriteObjCProperty() {
+ return (getUnsignedField(4) & dwarf::DW_APPLE_PROPERTY_readwrite) != 0;
+ }
+ bool isAssignObjCProperty() {
+ return (getUnsignedField(4) & dwarf::DW_APPLE_PROPERTY_assign) != 0;
+ }
+ bool isRetainObjCProperty() {
+ return (getUnsignedField(4) & dwarf::DW_APPLE_PROPERTY_retain) != 0;
+ }
+ bool isCopyObjCProperty() {
+ return (getUnsignedField(4) & dwarf::DW_APPLE_PROPERTY_copy) != 0;
+ }
+ bool isNonAtomicObjCProperty() {
+ return (getUnsignedField(4) & dwarf::DW_APPLE_PROPERTY_nonatomic) != 0;
+ }
+
+ /// Verify - Verify that a derived type descriptor is well formed.
+ bool Verify() const;
+
+ /// print - print derived type.
+ void print(raw_ostream &OS) const;
+
+ /// dump - print derived type to dbgs() with a newline.
+ void dump() const;
+ };
+
/// getDISubprogram - Find subprogram that is enclosing this scope.
DISubprogram getDISubprogram(const MDNode *Scope);
diff --git a/lib/Analysis/DIBuilder.cpp b/lib/Analysis/DIBuilder.cpp
index 5e94d899b9..ee7ecd1b05 100644
--- a/lib/Analysis/DIBuilder.cpp
+++ b/lib/Analysis/DIBuilder.cpp
@@ -359,6 +359,22 @@ DIType DIBuilder::createObjCIVar(StringRef Name,
return DIType(MDNode::get(VMContext, Elts));
}
+/// createObjCProperty - Create debugging information entry for Objective-C
+/// property.
+DIObjCProperty DIBuilder::createObjCProperty(StringRef Name,
+ StringRef GetterName,
+ StringRef SetterName,
+ unsigned PropertyAttributes) {
+ Value *Elts[] = {
+ GetTagConstant(VMContext, dwarf::DW_TAG_APPLE_Property),
+ MDString::get(VMContext, Name),
+ MDString::get(VMContext, GetterName),
+ MDString::get(VMContext, SetterName),
+ ConstantInt::get(Type::getInt32Ty(VMContext), PropertyAttributes)
+ };
+ return DIObjCProperty(MDNode::get(VMContext, Elts));
+}
+
/// createClassType - Create debugging information entry for a class.
DIType DIBuilder::createClassType(DIDescriptor Context, StringRef Name,
DIFile File, unsigned LineNumber,
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index f925b5ca43..a2d2c5f580 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -289,6 +289,10 @@ bool DIDescriptor::isEnumerator() const {
return DbgNode && getTag() == dwarf::DW_TAG_enumerator;
}
+/// isObjCProperty - Return true if the specified tag is DW_TAG
+bool DIDescriptor::isObjCProperty() const {
+ return DbgNode && getTag() == dwarf::DW_TAG_APPLE_Property;
+}
//===----------------------------------------------------------------------===//
// Simple Descriptor Constructors and other Methods
//===----------------------------------------------------------------------===//