diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-24 03:33:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-24 03:33:13 +0000 |
commit | 077bf5e2f48acfa9e7d69429b6e4ba86ea14896d (patch) | |
tree | 55c540d3cfe45fb990f27b56635fcec5865bcc16 /lib/CodeGen/CGObjCMac.cpp | |
parent | d0fd3b747c46211c481021ffb9cabd5635f918ed (diff) |
Rename Selector::getName() to Selector::getAsString(), and add
a new NamedDecl::getAsString() method.
Change uses of Selector::getName() to just pass in a Selector
where possible (e.g. to diagnostics) instead of going through
an std::string.
This also adds new formatters for objcinstance and objcclass
as described in the dox.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59933 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r-- | lib/CodeGen/CGObjCMac.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 8eb81a4b4b..f9a4d77925 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -2065,7 +2065,8 @@ llvm::Constant *CGObjCMac::GetMethodVarName(Selector Sel) { llvm::GlobalVariable *&Entry = MethodVarNames[Sel]; if (!Entry) { - llvm::Constant *C = llvm::ConstantArray::get(Sel.getName()); + // FIXME: Avoid std::string copying. + llvm::Constant *C = llvm::ConstantArray::get(Sel.getAsString()); Entry = new llvm::GlobalVariable(C->getType(), false, llvm::GlobalValue::InternalLinkage, @@ -2143,14 +2144,12 @@ llvm::Constant *CGObjCMac::GetPropertyTypeString(const ObjCPropertyDecl *PD, void CGObjCMac::GetNameForMethod(const ObjCMethodDecl *D, std::string &NameOut) { // FIXME: Find the mangling GCC uses. - std::stringstream s; - s << (D->isInstance() ? "-" : "+"); - s << "["; - s << D->getClassInterface()->getName(); - s << " "; - s << D->getSelector().getName(); - s << "]"; - NameOut = s.str(); + NameOut = (D->isInstance() ? "-" : "+"); + NameOut += '['; + NameOut += D->getClassInterface()->getName(); + NameOut += ' '; + NameOut += D->getSelector().getAsString(); + NameOut += ']'; } void CGObjCMac::FinishModule() { |