aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjCMac.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-24 03:54:41 +0000
committerChris Lattner <sabre@nondot.org>2008-11-24 03:54:41 +0000
commit8ec03f58c33c33a917f54bb7f2cd61b6d7ffe0ca (patch)
treeab82837deaf7ca40831de4b7467d2d3c1982c9ff /lib/CodeGen/CGObjCMac.cpp
parentbb49c3ee5d270485f4b273691fd14bc97403fa5d (diff)
Rename NamedDecl::getIdentifierName() to ::getNameAsCString() and make it
assert if the name is not an identifier. Update callers to do the right thing and avoid this method in unsafe cases. This also fixes an objc warning that was missing a space, and migrates a couple more to taking IdentifierInfo and QualTypes instead of std::strings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59936 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r--lib/CodeGen/CGObjCMac.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index f9a4d77925..975e386c70 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -664,7 +664,7 @@ llvm::Constant *CGObjCMac::GetOrEmitProtocol(const ObjCProtocolDecl *PD) {
// over.
LazySymbols.insert(&CGM.getContext().Idents.get("Protocol"));
- const char *ProtocolName = PD->getIdentifierName();
+ const char *ProtocolName = PD->getNameAsCString();
// Construct method lists.
std::vector<llvm::Constant*> InstanceMethods, ClassMethods;
@@ -1076,7 +1076,7 @@ static bool IsClassHidden(const ObjCInterfaceDecl *ID) {
void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) {
DefinedSymbols.insert(ID->getIdentifier());
- const char *ClassName = ID->getIdentifierName();
+ std::string ClassName = ID->getNameAsString();
// FIXME: Gross
ObjCInterfaceDecl *Interface =
const_cast<ObjCInterfaceDecl*>(ID->getClassInterface());
@@ -1169,7 +1169,6 @@ llvm::Constant *CGObjCMac::EmitMetaClass(const ObjCImplementationDecl *ID,
llvm::Constant *Protocols,
const llvm::Type *InterfaceTy,
const ConstantVector &Methods) {
- const char *ClassName = ID->getIdentifierName();
unsigned Flags = eClassFlags_Meta;
unsigned Size = CGM.getTargetData().getABITypeSize(ObjCTypes.ClassTy);
@@ -1215,7 +1214,7 @@ llvm::Constant *CGObjCMac::EmitMetaClass(const ObjCImplementationDecl *ID,
Values);
std::string Name("\01L_OBJC_METACLASS_");
- Name += ClassName;
+ Name += ID->getNameAsCString();
// Check for a forward reference.
llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name);