summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2012-03-29 08:43:37 +0000
committerEric Christopher <echristo@apple.com>2012-03-29 08:43:37 +0000
commiteb03169b9ae71439eef2d60fc79a62faa8f78218 (patch)
treec3829a9177e2903823457e55e3a997a280b9b29c
parent70e1bd8872a230d60c2fc2dd2bb19c7f16fcfce0 (diff)
downloadbcm5719-llvm-eb03169b9ae71439eef2d60fc79a62faa8f78218.tar.gz
bcm5719-llvm-eb03169b9ae71439eef2d60fc79a62faa8f78218.zip
Add support for objc property decls according to the page at:
http://llvm.org/docs/SourceLevelDebugging.html#objcproperty including type and DECL. Expand the getter and setter names into the fully qualified names. rdar://11144023 llvm-svn: 153640
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp39
-rw-r--r--clang/test/CodeGenObjC/debug-info-property3.m2
2 files changed, 23 insertions, 18 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 90eb861d939..fa26d4706d6 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -165,15 +165,6 @@ StringRef CGDebugInfo::getObjCMethodName(const ObjCMethodDecl *OMD) {
return StringRef(StrPtr, OS.tell());
}
-/// getSelectorName - Return selector name. This is used for debugging
-/// info.
-StringRef CGDebugInfo::getSelectorName(Selector S) {
- const std::string &SName = S.getAsString();
- char *StrPtr = DebugInfoNames.Allocate<char>(SName.size());
- memcpy(StrPtr, SName.data(), SName.size());
- return StringRef(StrPtr, SName.size());
-}
-
/// getClassName - Get class name including template argument list.
StringRef
CGDebugInfo::getClassName(const RecordDecl *RD) {
@@ -1324,11 +1315,18 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
for (ObjCContainerDecl::prop_iterator I = ID->prop_begin(),
E = ID->prop_end(); I != E; ++I) {
const ObjCPropertyDecl *PD = *I;
+ SourceLocation Loc = PD->getLocation();
+ llvm::DIFile PUnit = getOrCreateFile(Loc);
+ unsigned PLine = getLineNumber(Loc);
+ ObjCMethodDecl *GDecl = PD->getGetterMethodDecl();
+ ObjCMethodDecl *SDecl = PD->getSetterMethodDecl();
llvm::MDNode *PropertyNode =
DBuilder.createObjCProperty(PD->getName(),
- getSelectorName(PD->getGetterName()),
- getSelectorName(PD->getSetterName()),
- PD->getPropertyAttributes());
+ PUnit, PLine,
+ GDecl ? getObjCMethodName(GDecl) : "",
+ SDecl ? getObjCMethodName(SDecl) : "",
+ PD->getPropertyAttributes(),
+ getOrCreateType(PD->getType(), PUnit));
EltTys.push_back(PropertyNode);
}
@@ -1380,11 +1378,18 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
if (ObjCPropertyImplDecl *PImpD =
ImpD->FindPropertyImplIvarDecl(Field->getIdentifier())) {
if (ObjCPropertyDecl *PD = PImpD->getPropertyDecl()) {
- PropertyNode =
- DBuilder.createObjCProperty(PD->getName(),
- getSelectorName(PD->getGetterName()),
- getSelectorName(PD->getSetterName()),
- PD->getPropertyAttributes());
+ SourceLocation Loc = PD->getLocation();
+ llvm::DIFile PUnit = getOrCreateFile(Loc);
+ unsigned PLine = getLineNumber(Loc);
+ ObjCMethodDecl *GDecl = PD->getGetterMethodDecl();
+ ObjCMethodDecl *SDecl = PD->getSetterMethodDecl();
+ PropertyNode =
+ DBuilder.createObjCProperty(PD->getName(),
+ PUnit, PLine,
+ GDecl ? getObjCMethodName(GDecl) : "",
+ SDecl ? getObjCMethodName(SDecl) : "",
+ PD->getPropertyAttributes(),
+ getOrCreateType(PD->getType(),PUnit));
}
}
}
diff --git a/clang/test/CodeGenObjC/debug-info-property3.m b/clang/test/CodeGenObjC/debug-info-property3.m
index 330c8db4cdf..804127d8c47 100644
--- a/clang/test/CodeGenObjC/debug-info-property3.m
+++ b/clang/test/CodeGenObjC/debug-info-property3.m
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -S -emit-llvm -g %s -o - | FileCheck %s
-// CHECK: metadata !"p1", metadata !"p1", metadata !"setP1:", i32 2316} ; [ DW_TAG_APPLE_property ]
+// CHECK: metadata !"p1", metadata !6, i32 5, metadata !"-[I1 p1]", metadata !"-[I1 setP1:]", i32 2316, metadata !9} ; [ DW_TAG_APPLE_property ]
@interface I1
@property int p1;
@end
OpenPOWER on IntegriCloud