diff options
author | Eric Christopher <echristo@apple.com> | 2012-03-29 08:43:37 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2012-03-29 08:43:37 +0000 |
commit | 51c0371816edadfe6275945b4e2155efb9451b3a (patch) | |
tree | 5ac0ee5a9242a1a1659088c0924237342663b667 /lib/CodeGen/CGDebugInfo.cpp | |
parent | be5ff2f830d1833891051472d29818aa9f783cce (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153640 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 90eb861d93..fa26d4706d 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/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)); } } } |