summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjCMac.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-24 03:33:13 +0000
committerChris Lattner <sabre@nondot.org>2008-11-24 03:33:13 +0000
commite4b95698df99424e287b34c76da92add5a773392 (patch)
tree7e5bd35e6fdb76f86c7c56137405e4e2a50e0e08 /clang/lib/CodeGen/CGObjCMac.cpp
parent8361d4c51bd191f29dca50f5320e9c36955887c4 (diff)
downloadbcm5719-llvm-e4b95698df99424e287b34c76da92add5a773392.tar.gz
bcm5719-llvm-e4b95698df99424e287b34c76da92add5a773392.zip
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. llvm-svn: 59933
Diffstat (limited to 'clang/lib/CodeGen/CGObjCMac.cpp')
-rw-r--r--clang/lib/CodeGen/CGObjCMac.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index 8eb81a4b4b6..f9a4d779257 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/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() {
OpenPOWER on IntegriCloud