diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 542fba29b9f1..9743b96b40c8 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -119,6 +119,17 @@ llvm::StringRef CGDebugInfo::getObjCMethodName(const ObjCMethodDecl *OMD) { return llvm::StringRef(StrPtr, OS.tell()); } +/// getSelectporName - Return selector name. This is used for debugging +/// info. +llvm::StringRef CGDebugInfo::getSelectorName(Selector S) { + llvm::SmallString<256> SName; + llvm::raw_svector_ostream OS(SName); + OS << S.getAsString(); + char *StrPtr = DebugInfoNames.Allocate(OS.tell()); + memcpy(StrPtr, SName.begin(), OS.tell()); + return llvm::StringRef(StrPtr, OS.tell()); +} + /// getClassName - Get class name including template argument list. llvm::StringRef CGDebugInfo::getClassName(RecordDecl *RD) { @@ -1198,8 +1209,8 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty, if (ObjCPropertyDecl *PD = ID->FindPropertyVisibleInPrimaryClass(Field->getIdentifier())) { PropertyName = PD->getName(); - PropertyGetter = PD->getGetterName().getNameForSlot(0); - PropertySetter = PD->getSetterName().getNameForSlot(0); + PropertyGetter = getSelectorName(PD->getGetterName()); + PropertySetter = getSelectorName(PD->getSetterName()); PropertyAttributes = PD->getPropertyAttributes(); } FieldTy = DBuilder.createObjCIVar(FieldName, FieldDefUnit, diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index fbe4c1d2c003..f658ea63ac99 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -267,6 +267,10 @@ private: /// This is the display name for the debugging info. llvm::StringRef getObjCMethodName(const ObjCMethodDecl *FD); + /// getSelectporName - Return selector name. This is used for debugging + /// info. + llvm::StringRef getSelectorName(Selector S); + /// getClassName - Get class name including template argument list. llvm::StringRef getClassName(RecordDecl *RD);