Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of
uses of getName() with uses of getDeclName(). This upgrades a bunch of
diags to take DeclNames instead of std::strings.
This also tweaks a couple of diagnostics to be cleaner and changes
CheckInitializerTypes/PerformInitializationByConstructor to pass
around DeclarationNames instead of std::strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59947 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp
index 55a7d02..9254d80 100644
--- a/Driver/ASTConsumers.cpp
+++ b/Driver/ASTConsumers.cpp
@@ -83,7 +83,7 @@
for (unsigned i = 0, e = OFPD->getNumForwardDecls(); i != e; ++i) {
const ObjCProtocolDecl *D = OFPD->getForwardProtocolDecl(i);
if (i) Out << ", ";
- Out << D->getName();
+ Out << D->getNameAsString();
}
Out << ";\n";
} else if (ObjCImplementationDecl *OID =
@@ -104,13 +104,13 @@
for (unsigned i = 0, e = OFCD->getNumForwardDecls(); i != e; ++i) {
const ObjCInterfaceDecl *D = ForwardDecls[i];
if (i) Out << ", ";
- Out << D->getName();
+ Out << D->getNameAsString();
}
Out << ";\n";
} else if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
- Out << "Read top-level tag decl: '" << TD->getName() << "'\n";
+ Out << "Read top-level tag decl: '" << TD->getNameAsString() << "'\n";
} else if (ScopedDecl *SD = dyn_cast<ScopedDecl>(D)) {
- Out << "Read top-level variable decl: '" << SD->getName() << "'\n";
+ Out << "Read top-level variable decl: '" << SD->getNameAsString() << "'\n";
} else if (LinkageSpecDecl *LSD = dyn_cast<LinkageSpecDecl>(D)) {
PrintLinkageSpec(LSD);
} else if (FileScopeAsmDecl *AD = dyn_cast<FileScopeAsmDecl>(D)) {
@@ -138,7 +138,7 @@
if (FD->isInline())
Out << "inline ";
- std::string Proto = FD->getName();
+ std::string Proto = FD->getNameAsString();
const FunctionType *AFT = FD->getType()->getAsFunctionType();
if (const FunctionTypeProto *FT = dyn_cast<FunctionTypeProto>(AFT)) {
@@ -146,7 +146,7 @@
for (unsigned i = 0, e = FD->getNumParams(); i != e; ++i) {
if (i) Proto += ", ";
std::string ParamStr;
- if (HasBody) ParamStr = FD->getParamDecl(i)->getName();
+ if (HasBody) ParamStr = FD->getParamDecl(i)->getNameAsString();
FT->getArgType(i).getAsStringInternal(ParamStr);
Proto += ParamStr;
@@ -171,7 +171,7 @@
}
void DeclPrinter::PrintTypeDefDecl(TypedefDecl *TD) {
- std::string S = TD->getName();
+ std::string S = TD->getNameAsString();
TD->getUnderlyingType().getAsStringInternal(S);
Out << "typedef " << S << ";\n";
}
@@ -205,7 +205,8 @@
// FIXME: selector is missing here!
pos = name.find_first_of(":", lastPos);
Out << " " << name.substr(lastPos, pos - lastPos);
- Out << ":(" << PDecl->getType().getAsString() << ")" << PDecl->getName();
+ Out << ":(" << PDecl->getType().getAsString() << ")"
+ << PDecl->getNameAsString();
lastPos = pos + 1;
}
@@ -219,11 +220,11 @@
}
void DeclPrinter::PrintObjCImplementationDecl(ObjCImplementationDecl *OID) {
- std::string I = OID->getName();
+ std::string I = OID->getNameAsString();
ObjCInterfaceDecl *SID = OID->getSuperClass();
if (SID)
- Out << "@implementation " << I << " : " << SID->getName();
+ Out << "@implementation " << I << " : " << SID->getNameAsString();
else
Out << "@implementation " << I;
@@ -258,11 +259,11 @@
void DeclPrinter::PrintObjCInterfaceDecl(ObjCInterfaceDecl *OID) {
- std::string I = OID->getName();
+ std::string I = OID->getNameAsString();
ObjCInterfaceDecl *SID = OID->getSuperClass();
if (SID)
- Out << "@interface " << I << " : " << SID->getName();
+ Out << "@interface " << I << " : " << SID->getNameAsString();
else
Out << "@interface " << I;
@@ -271,7 +272,7 @@
if (!Protocols.empty()) {
for (ObjCList<ObjCProtocolDecl>::iterator I = Protocols.begin(),
E = Protocols.end(); I != E; ++I)
- Out << (I == Protocols.begin() ? '<' : ',') << (*I)->getName();
+ Out << (I == Protocols.begin() ? '<' : ',') << (*I)->getNameAsString();
}
if (!Protocols.empty())
@@ -283,7 +284,7 @@
for (ObjCInterfaceDecl::ivar_iterator I = OID->ivar_begin(),
E = OID->ivar_end(); I != E; ++I) {
Out << '\t' << (*I)->getType().getAsString()
- << ' ' << (*I)->getName() << ";\n";
+ << ' ' << (*I)->getNameAsString() << ";\n";
}
Out << "}\n";
}
@@ -305,7 +306,7 @@
}
void DeclPrinter::PrintObjCProtocolDecl(ObjCProtocolDecl *PID) {
- Out << "@protocol " << PID->getName() << '\n';
+ Out << "@protocol " << PID->getNameAsString() << '\n';
for (ObjCProtocolDecl::classprop_iterator I = PID->classprop_begin(),
E = PID->classprop_end(); I != E; ++I)
@@ -316,8 +317,8 @@
void DeclPrinter::PrintObjCCategoryImplDecl(ObjCCategoryImplDecl *PID) {
Out << "@implementation "
- << PID->getClassInterface()->getName()
- << '(' << PID->getName() << ");\n";
+ << PID->getClassInterface()->getNameAsString()
+ << '(' << PID->getNameAsString() << ");\n";
for (ObjCCategoryImplDecl::propimpl_iterator I = PID->propimpl_begin(),
E = PID->propimpl_end(); I != E; ++I)
PrintObjCPropertyImplDecl(*I);
@@ -327,8 +328,8 @@
void DeclPrinter::PrintObjCCategoryDecl(ObjCCategoryDecl *PID) {
Out << "@interface "
- << PID->getClassInterface()->getName()
- << '(' << PID->getName() << ");\n";
+ << PID->getClassInterface()->getNameAsString()
+ << '(' << PID->getNameAsString() << ");\n";
// Output property declarations.
for (ObjCCategoryDecl::classprop_iterator I = PID->classprop_begin(),
E = PID->classprop_end(); I != E; ++I)
@@ -339,8 +340,8 @@
}
void DeclPrinter::PrintObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *AID) {
- Out << "@compatibility_alias " << AID->getName()
- << ' ' << AID->getClassInterface()->getName() << ";\n";
+ Out << "@compatibility_alias " << AID->getNameAsString()
+ << ' ' << AID->getClassInterface()->getNameAsString() << ";\n";
}
/// PrintObjCPropertyDecl - print a property declaration.
@@ -401,7 +402,7 @@
Out << " )";
}
Out << ' ' << PDecl->getType().getAsString()
- << ' ' << PDecl->getName();
+ << ' ' << PDecl->getNameAsString();
Out << ";\n";
}
@@ -414,9 +415,9 @@
Out << "\n@synthesize ";
else
Out << "\n@dynamic ";
- Out << PID->getPropertyDecl()->getName();
+ Out << PID->getPropertyDecl()->getNameAsString();
if (PID->getPropertyIvarDecl())
- Out << "=" << PID->getPropertyIvarDecl()->getName();
+ Out << "=" << PID->getPropertyIvarDecl()->getNameAsString();
Out << ";\n";
}
//===----------------------------------------------------------------------===//
@@ -463,13 +464,14 @@
} else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
PrintTypeDefDecl(TD);
} else if (ScopedDecl *SD = dyn_cast<ScopedDecl>(D)) {
- Out << "Read top-level variable decl: '" << SD->getName() << "'\n";
+ Out << "Read top-level variable decl: '" << SD->getNameAsString()
+ << "'\n";
} else if (ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(D)) {
- Out << "Read objc interface '" << OID->getName() << "'\n";
+ Out << "Read objc interface '" << OID->getNameAsString() << "'\n";
} else if (ObjCProtocolDecl *OPD = dyn_cast<ObjCProtocolDecl>(D)) {
- Out << "Read objc protocol '" << OPD->getName() << "'\n";
+ Out << "Read objc protocol '" << OPD->getNameAsString() << "'\n";
} else if (ObjCCategoryDecl *OCD = dyn_cast<ObjCCategoryDecl>(D)) {
- Out << "Read objc category '" << OCD->getName() << "'\n";
+ Out << "Read objc category '" << OCD->getNameAsString() << "'\n";
} else if (isa<ObjCForwardProtocolDecl>(D)) {
Out << "Read objc fwd protocol decl\n";
} else if (isa<ObjCClassDecl>(D)) {
@@ -550,7 +552,7 @@
CXXRecordDecl* D = T->getDecl();
// FIXME: This lookup needs to be generalized to handle namespaces and
// (when we support them) templates.
- if (D->getName() == clsname) {
+ if (D->getNameAsString() == clsname) {
D->viewInheritance(C);
}
}
diff --git a/Driver/RewriteBlocks.cpp b/Driver/RewriteBlocks.cpp
index d07fb2c..5b6e1a9 100644
--- a/Driver/RewriteBlocks.cpp
+++ b/Driver/RewriteBlocks.cpp
@@ -384,7 +384,7 @@
for (BlockDecl::param_iterator AI = BD->param_begin(),
E = BD->param_end(); AI != E; ++AI) {
if (AI != BD->param_begin()) S += ", ";
- ParamStr = (*AI)->getName();
+ ParamStr = (*AI)->getNameAsString();
(*AI)->getType().getAsStringInternal(ParamStr);
S += ParamStr;
}
@@ -401,15 +401,15 @@
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
E = BlockByRefDecls.end(); I != E; ++I) {
S += " ";
- std::string Name = (*I)->getName();
+ std::string Name = (*I)->getNameAsString();
Context->getPointerType((*I)->getType()).getAsStringInternal(Name);
- S += Name + " = __cself->" + (*I)->getName() + "; // bound by ref\n";
+ S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by ref\n";
}
// Next, emit a declaration for all "by copy" declarations.
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
E = BlockByCopyDecls.end(); I != E; ++I) {
S += " ";
- std::string Name = (*I)->getName();
+ std::string Name = (*I)->getNameAsString();
// Handle nested closure invocation. For example:
//
// void (^myImportedClosure)(void);
@@ -424,7 +424,7 @@
S += "struct __block_impl *";
else
(*I)->getType().getAsStringInternal(Name);
- S += Name + " = __cself->" + (*I)->getName() + "; // bound by copy\n";
+ S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by copy\n";
}
std::string RewrittenStr = RewrittenBlockExprs[CE];
const char *cstr = RewrittenStr.c_str();
@@ -448,9 +448,9 @@
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = ImportedBlockDecls.begin(),
E = ImportedBlockDecls.end(); I != E; ++I) {
S += "_Block_copy_assign(&dst->";
- S += (*I)->getName();
+ S += (*I)->getNameAsString();
S += ", src->";
- S += (*I)->getName();
+ S += (*I)->getNameAsString();
S += ");}";
}
S += "\nstatic void __";
@@ -461,7 +461,7 @@
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = ImportedBlockDecls.begin(),
E = ImportedBlockDecls.end(); I != E; ++I) {
S += "_Block_destroy(src->";
- S += (*I)->getName();
+ S += (*I)->getNameAsString();
S += ");";
}
S += "}\n";
@@ -488,7 +488,7 @@
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
E = BlockByCopyDecls.end(); I != E; ++I) {
S += " ";
- std::string FieldName = (*I)->getName();
+ std::string FieldName = (*I)->getNameAsString();
std::string ArgName = "_" + FieldName;
// Handle nested closure invocation. For example:
//
@@ -514,7 +514,7 @@
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
E = BlockByRefDecls.end(); I != E; ++I) {
S += " ";
- std::string FieldName = (*I)->getName();
+ std::string FieldName = (*I)->getNameAsString();
std::string ArgName = "_" + FieldName;
// Handle nested closure invocation. For example:
//
@@ -548,7 +548,7 @@
// Initialize all "by copy" arguments.
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
E = BlockByCopyDecls.end(); I != E; ++I) {
- std::string Name = (*I)->getName();
+ std::string Name = (*I)->getNameAsString();
Constructor += " ";
if (isBlockPointerType((*I)->getType()))
Constructor += Name + " = (struct __block_impl *)_";
@@ -559,7 +559,7 @@
// Initialize all "by ref" arguments.
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
E = BlockByRefDecls.end(); I != E; ++I) {
- std::string Name = (*I)->getName();
+ std::string Name = (*I)->getNameAsString();
Constructor += " ";
if (isBlockPointerType((*I)->getType()))
Constructor += Name + " = (struct __block_impl *)_";
@@ -918,7 +918,7 @@
std::string FuncName;
if (CurFunctionDef)
- FuncName = std::string(CurFunctionDef->getName());
+ FuncName = std::string(CurFunctionDef->getNameAsString());
else if (CurMethodDef) {
FuncName = CurMethodDef->getSelector().getAsString();
// Convert colons to underscores.
@@ -926,7 +926,7 @@
while ((loc = FuncName.find(":", loc)) != std::string::npos)
FuncName.replace(loc, 1, "_");
} else if (VD)
- FuncName = std::string(VD->getName());
+ FuncName = std::string(VD->getNameAsString());
std::string BlockNumber = utostr(Blocks.size()-1);
@@ -961,20 +961,20 @@
Init += ",";
if (isObjCType((*I)->getType())) {
Init += "[[";
- Init += (*I)->getName();
+ Init += (*I)->getNameAsString();
Init += " retain] autorelease]";
} else if (isBlockPointerType((*I)->getType())) {
Init += "(void *)";
- Init += (*I)->getName();
+ Init += (*I)->getNameAsString();
} else {
- Init += (*I)->getName();
+ Init += (*I)->getNameAsString();
}
}
// Output all "by ref" declarations.
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
E = BlockByRefDecls.end(); I != E; ++I) {
Init += ",&";
- Init += (*I)->getName();
+ Init += (*I)->getNameAsString();
}
}
Init += ")";
diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp
index 1ff778e..1c20ef1 100644
--- a/Driver/RewriteObjC.cpp
+++ b/Driver/RewriteObjC.cpp
@@ -605,13 +605,13 @@
for (int i = 0; i < numDecls; i++) {
ObjCInterfaceDecl *ForwardDecl = ForwardDecls[i];
typedefString += "#ifndef _REWRITER_typedef_";
- typedefString += ForwardDecl->getName();
+ typedefString += ForwardDecl->getNameAsString();
typedefString += "\n";
typedefString += "#define _REWRITER_typedef_";
- typedefString += ForwardDecl->getName();
+ typedefString += ForwardDecl->getNameAsString();
typedefString += "\n";
typedefString += "typedef struct objc_object ";
- typedefString += ForwardDecl->getName();
+ typedefString += ForwardDecl->getNameAsString();
typedefString += ";\n#endif\n";
}
@@ -739,13 +739,13 @@
else
NameStr += "_C_";
- NameStr += OMD->getClassInterface()->getName();
+ NameStr += OMD->getClassInterface()->getNameAsString();
NameStr += "_";
NamedDecl *MethodContext = OMD->getMethodContext();
if (ObjCCategoryImplDecl *CID =
dyn_cast<ObjCCategoryImplDecl>(MethodContext)) {
- NameStr += CID->getName();
+ NameStr += CID->getNameAsString();
NameStr += "_";
}
// Append selector names, replacing ':' with '_'
@@ -773,7 +773,7 @@
ResultStr += "struct ";
}
// When rewriting for Microsoft, explicitly omit the structure name.
- ResultStr += OMD->getClassInterface()->getName();
+ ResultStr += OMD->getClassInterface()->getNameAsString();
ResultStr += " *";
}
else
@@ -789,9 +789,9 @@
ResultStr += ", ";
if (PDecl->getType()->isObjCQualifiedIdType()) {
ResultStr += "id ";
- ResultStr += PDecl->getName();
+ ResultStr += PDecl->getNameAsString();
} else {
- std::string Name = PDecl->getName();
+ std::string Name = PDecl->getNameAsString();
if (isBlockPointerType(PDecl->getType())) {
// Make sure we convert "t (^)(...)" to "t (*)(...)".
const BlockPointerType *BPT = PDecl->getType()->getAsBlockPointerType();
@@ -875,13 +875,13 @@
if (!ObjCForwardDecls.count(ClassDecl)) {
// we haven't seen a forward decl - generate a typedef.
ResultStr = "#ifndef _REWRITER_typedef_";
- ResultStr += ClassDecl->getName();
+ ResultStr += ClassDecl->getNameAsString();
ResultStr += "\n";
ResultStr += "#define _REWRITER_typedef_";
- ResultStr += ClassDecl->getName();
+ ResultStr += ClassDecl->getNameAsString();
ResultStr += "\n";
ResultStr += "typedef struct objc_object ";
- ResultStr += ClassDecl->getName();
+ ResultStr += ClassDecl->getNameAsString();
ResultStr += ";\n#endif\n";
// Mark this typedef as having been generated.
ObjCForwardDecls.insert(ClassDecl);
@@ -1355,7 +1355,7 @@
cls = dyn_cast<ObjCInterfaceType>(pType->getPointeeType().getTypePtr());
if (cls) {
buf += "objc_exception_match((struct objc_class *)objc_getClass(\"";
- buf += cls->getDecl()->getName();
+ buf += cls->getDecl()->getNameAsString();
buf += "\"), (struct objc_object *)_caught)) { ";
ReplaceText(startLoc, lParenLoc-startBuf+1, buf.c_str(), buf.size());
}
@@ -2377,7 +2377,7 @@
// FIXME: This has potential of causing problem. If
// SynthesizeObjCInternalStruct is ever called recursively.
Result += "\nstruct ";
- Result += CDecl->getName();
+ Result += CDecl->getNameAsString();
if (LangOpts.Microsoft)
Result += "_IMPL";
@@ -2419,9 +2419,9 @@
}
if (RCDecl && ObjCSynthesizedStructs.count(RCDecl)) {
Result = "\n struct ";
- Result += RCDecl->getName();
+ Result += RCDecl->getNameAsString();
Result += "_IMPL ";
- Result += RCDecl->getName();
+ Result += RCDecl->getNameAsString();
Result += "_IVARS;\n";
// insert the super class structure definition.
@@ -2468,9 +2468,9 @@
} else { // we don't have any instance variables - insert super struct.
endBuf += Lexer::MeasureTokenLength(LocEnd, *SM);
Result += " {\n struct ";
- Result += RCDecl->getName();
+ Result += RCDecl->getNameAsString();
Result += "_IMPL ";
- Result += RCDecl->getName();
+ Result += RCDecl->getNameAsString();
Result += "_IVARS;\n};\n";
ReplaceText(LocStart, endBuf-startBuf, Result.c_str(), Result.size());
}
@@ -2593,7 +2593,7 @@
Result += "\tstruct protocol_methods protocols[";
Result += utostr(NumMethods);
Result += "];\n} _OBJC_PROTOCOL_INSTANCE_METHODS_";
- Result += PDecl->getName();
+ Result += PDecl->getNameAsString();
Result += " __attribute__ ((used, section (\"__OBJC, __cat_inst_meth\")))= "
"{\n\t" + utostr(NumMethods) + "\n";
@@ -2627,7 +2627,7 @@
Result += "\tstruct protocol_methods protocols[";
Result += utostr(NumMethods);
Result += "];\n} _OBJC_PROTOCOL_CLASS_METHODS_";
- Result += PDecl->getName();
+ Result += PDecl->getNameAsString();
Result += " __attribute__ ((used, section (\"__OBJC, __cat_cls_meth\")))= "
"{\n\t";
Result += utostr(NumMethods);
@@ -2674,21 +2674,21 @@
}
Result += "\nstatic struct _objc_protocol _OBJC_PROTOCOL_";
- Result += PDecl->getName();
+ Result += PDecl->getNameAsString();
Result += " __attribute__ ((used, section (\"__OBJC, __protocol\")))= "
"{\n\t0, \"";
- Result += PDecl->getName();
+ Result += PDecl->getNameAsString();
Result += "\", 0, ";
if (PDecl->instmeth_begin() != PDecl->instmeth_end()) {
Result += "(struct _objc_protocol_method_list *)&_OBJC_PROTOCOL_INSTANCE_METHODS_";
- Result += PDecl->getName();
+ Result += PDecl->getNameAsString();
Result += ", ";
}
else
Result += "0, ";
if (PDecl->getNumClassMethods() > 0) {
Result += "(struct _objc_protocol_method_list *)&_OBJC_PROTOCOL_CLASS_METHODS_";
- Result += PDecl->getName();
+ Result += PDecl->getNameAsString();
Result += "\n";
}
else
@@ -2721,12 +2721,12 @@
Result += "\n";
Result += "\t,{&_OBJC_PROTOCOL_";
- Result += Protocols[0]->getName();
+ Result += Protocols[0]->getNameAsString();
Result += " \n";
for (unsigned i = 1; i != Protocols.size(); i++) {
Result += "\t ,&_OBJC_PROTOCOL_";
- Result += Protocols[i]->getName();
+ Result += Protocols[i]->getNameAsString();
Result += "\n";
}
Result += "\t }\n};\n";
@@ -2744,9 +2744,9 @@
if (CDecl->getIdentifier() == IDecl->getIdentifier())
break;
- std::string FullCategoryName = ClassDecl->getName();
+ std::string FullCategoryName = ClassDecl->getNameAsString();
FullCategoryName += '_';
- FullCategoryName += IDecl->getName();
+ FullCategoryName += IDecl->getNameAsString();
// Build _objc_method_list for class's instance methods if needed
RewriteObjCMethodsMetaData(IDecl->instmeth_begin(), IDecl->instmeth_end(),
@@ -2793,9 +2793,9 @@
Result += "\nstatic struct _objc_category _OBJC_CATEGORY_";
Result += FullCategoryName;
Result += " __attribute__ ((used, section (\"__OBJC, __category\")))= {\n\t\"";
- Result += IDecl->getName();
+ Result += IDecl->getNameAsString();
Result += "\"\n\t, \"";
- Result += ClassDecl->getName();
+ Result += ClassDecl->getNameAsString();
Result += "\"\n";
if (IDecl->getNumInstanceMethods() > 0) {
@@ -2836,11 +2836,11 @@
Result += "0";
} else {
Result += "__OFFSETOFIVAR__(struct ";
- Result += IDecl->getName();
+ Result += IDecl->getNameAsString();
if (LangOpts.Microsoft)
Result += "_IMPL";
Result += ", ";
- Result += ivar->getName();
+ Result += ivar->getNameAsString();
Result += ")";
}
}
@@ -2892,7 +2892,7 @@
Result += "\tstruct _objc_ivar ivar_list[";
Result += utostr(NumIvars);
Result += "];\n} _OBJC_INSTANCE_VARIABLES_";
- Result += IDecl->getName();
+ Result += IDecl->getNameAsString();
Result += " __attribute__ ((used, section (\"__OBJC, __instance_vars\")))= "
"{\n\t";
Result += utostr(NumIvars);
@@ -2907,7 +2907,7 @@
IVE = CDecl->ivar_end();
}
Result += "\t,{{\"";
- Result += (*IVI)->getName();
+ Result += (*IVI)->getNameAsString();
Result += "\", \"";
std::string StrEncoding;
Context->getObjCEncodingForType((*IVI)->getType(), StrEncoding);
@@ -2917,7 +2917,7 @@
Result += "}\n";
for (++IVI; IVI != IVE; ++IVI) {
Result += "\t ,{\"";
- Result += (*IVI)->getName();
+ Result += (*IVI)->getNameAsString();
Result += "\", \"";
std::string StrEncoding;
Context->getObjCEncodingForType((*IVI)->getType(), StrEncoding);
@@ -2988,22 +2988,22 @@
SuperClass = CDecl->getSuperClass();
Result += "\nstatic struct _objc_class _OBJC_METACLASS_";
- Result += CDecl->getName();
+ Result += CDecl->getNameAsString();
Result += " __attribute__ ((used, section (\"__OBJC, __meta_class\")))= "
"{\n\t(struct _objc_class *)\"";
- Result += (RootClass ? RootClass->getName() : CDecl->getName());
+ Result += (RootClass ? RootClass->getNameAsString() : CDecl->getNameAsString());
Result += "\"";
if (SuperClass) {
Result += ", \"";
- Result += SuperClass->getName();
+ Result += SuperClass->getNameAsString();
Result += "\", \"";
- Result += CDecl->getName();
+ Result += CDecl->getNameAsString();
Result += "\"";
}
else {
Result += ", 0, \"";
- Result += CDecl->getName();
+ Result += CDecl->getNameAsString();
Result += "\"";
}
// Set 'ivars' field for root class to 0. ObjC1 runtime does not use it.
@@ -3011,14 +3011,14 @@
Result += ", 0,2, sizeof(struct _objc_class), 0";
if (IDecl->getNumClassMethods() > 0) {
Result += "\n\t, (struct _objc_method_list *)&_OBJC_CLASS_METHODS_";
- Result += IDecl->getName();
+ Result += IDecl->getNameAsString();
Result += "\n";
}
else
Result += ", 0\n";
if (!CDecl->getReferencedProtocols().empty()) {
Result += "\t,0, (struct _objc_protocol_list *)&_OBJC_CLASS_PROTOCOLS_";
- Result += CDecl->getName();
+ Result += CDecl->getNameAsString();
Result += ",0,0\n";
}
else
@@ -3027,20 +3027,20 @@
// class metadata generation.
Result += "\nstatic struct _objc_class _OBJC_CLASS_";
- Result += CDecl->getName();
+ Result += CDecl->getNameAsString();
Result += " __attribute__ ((used, section (\"__OBJC, __class\")))= "
"{\n\t&_OBJC_METACLASS_";
- Result += CDecl->getName();
+ Result += CDecl->getNameAsString();
if (SuperClass) {
Result += ", \"";
- Result += SuperClass->getName();
+ Result += SuperClass->getNameAsString();
Result += "\", \"";
- Result += CDecl->getName();
+ Result += CDecl->getNameAsString();
Result += "\"";
}
else {
Result += ", 0, \"";
- Result += CDecl->getName();
+ Result += CDecl->getNameAsString();
Result += "\"";
}
// 'info' field is initialized to CLS_CLASS(1) for class
@@ -3050,28 +3050,28 @@
else {
// class has size. Must synthesize its size.
Result += ",sizeof(struct ";
- Result += CDecl->getName();
+ Result += CDecl->getNameAsString();
if (LangOpts.Microsoft)
Result += "_IMPL";
Result += ")";
}
if (NumIvars > 0) {
Result += ", (struct _objc_ivar_list *)&_OBJC_INSTANCE_VARIABLES_";
- Result += CDecl->getName();
+ Result += CDecl->getNameAsString();
Result += "\n\t";
}
else
Result += ",0";
if (IDecl->getNumInstanceMethods() > 0) {
Result += ", (struct _objc_method_list *)&_OBJC_INSTANCE_METHODS_";
- Result += CDecl->getName();
+ Result += CDecl->getNameAsString();
Result += ", 0\n\t";
}
else
Result += ",0,0";
if (!CDecl->getReferencedProtocols().empty()) {
Result += ", (struct _objc_protocol_list*)&_OBJC_CLASS_PROTOCOLS_";
- Result += CDecl->getName();
+ Result += CDecl->getNameAsString();
Result += ", 0,0\n";
}
else
@@ -3134,15 +3134,15 @@
+ ", " + utostr(CatDefCount) + "\n";
for (int i = 0; i < ClsDefCount; i++) {
Result += "\t,&_OBJC_CLASS_";
- Result += ClassImplementation[i]->getName();
+ Result += ClassImplementation[i]->getNameAsString();
Result += "\n";
}
for (int i = 0; i < CatDefCount; i++) {
Result += "\t,&_OBJC_CATEGORY_";
- Result += CategoryImplementation[i]->getClassInterface()->getName();
+ Result += CategoryImplementation[i]->getClassInterface()->getNameAsString();
Result += "_";
- Result += CategoryImplementation[i]->getName();
+ Result += CategoryImplementation[i]->getNameAsString();
Result += "\n";
}
@@ -3205,7 +3205,7 @@
for (BlockDecl::param_iterator AI = BD->param_begin(),
E = BD->param_end(); AI != E; ++AI) {
if (AI != BD->param_begin()) S += ", ";
- ParamStr = (*AI)->getName();
+ ParamStr = (*AI)->getNameAsString();
(*AI)->getType().getAsStringInternal(ParamStr);
S += ParamStr;
}
@@ -3222,15 +3222,15 @@
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
E = BlockByRefDecls.end(); I != E; ++I) {
S += " ";
- std::string Name = (*I)->getName();
+ std::string Name = (*I)->getNameAsString();
Context->getPointerType((*I)->getType()).getAsStringInternal(Name);
- S += Name + " = __cself->" + (*I)->getName() + "; // bound by ref\n";
+ S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by ref\n";
}
// Next, emit a declaration for all "by copy" declarations.
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
E = BlockByCopyDecls.end(); I != E; ++I) {
S += " ";
- std::string Name = (*I)->getName();
+ std::string Name = (*I)->getNameAsString();
// Handle nested closure invocation. For example:
//
// void (^myImportedClosure)(void);
@@ -3245,7 +3245,7 @@
S += "struct __block_impl *";
else
(*I)->getType().getAsStringInternal(Name);
- S += Name + " = __cself->" + (*I)->getName() + "; // bound by copy\n";
+ S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by copy\n";
}
std::string RewrittenStr = RewrittenBlockExprs[CE];
const char *cstr = RewrittenStr.c_str();
@@ -3269,9 +3269,9 @@
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = ImportedBlockDecls.begin(),
E = ImportedBlockDecls.end(); I != E; ++I) {
S += "_Block_copy_assign(&dst->";
- S += (*I)->getName();
+ S += (*I)->getNameAsString();
S += ", src->";
- S += (*I)->getName();
+ S += (*I)->getNameAsString();
S += ");}";
}
S += "\nstatic void __";
@@ -3282,7 +3282,7 @@
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = ImportedBlockDecls.begin(),
E = ImportedBlockDecls.end(); I != E; ++I) {
S += "_Block_destroy(src->";
- S += (*I)->getName();
+ S += (*I)->getNameAsString();
S += ");";
}
S += "}\n";
@@ -3309,7 +3309,7 @@
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
E = BlockByCopyDecls.end(); I != E; ++I) {
S += " ";
- std::string FieldName = (*I)->getName();
+ std::string FieldName = (*I)->getNameAsString();
std::string ArgName = "_" + FieldName;
// Handle nested closure invocation. For example:
//
@@ -3335,7 +3335,7 @@
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
E = BlockByRefDecls.end(); I != E; ++I) {
S += " ";
- std::string FieldName = (*I)->getName();
+ std::string FieldName = (*I)->getNameAsString();
std::string ArgName = "_" + FieldName;
// Handle nested closure invocation. For example:
//
@@ -3369,7 +3369,7 @@
// Initialize all "by copy" arguments.
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByCopyDecls.begin(),
E = BlockByCopyDecls.end(); I != E; ++I) {
- std::string Name = (*I)->getName();
+ std::string Name = (*I)->getNameAsString();
Constructor += " ";
if (isBlockPointerType((*I)->getType()))
Constructor += Name + " = (struct __block_impl *)_";
@@ -3380,7 +3380,7 @@
// Initialize all "by ref" arguments.
for (llvm::SmallPtrSet<ValueDecl*,8>::iterator I = BlockByRefDecls.begin(),
E = BlockByRefDecls.end(); I != E; ++I) {
- std::string Name = (*I)->getName();
+ std::string Name = (*I)->getNameAsString();
Constructor += " ";
if (isBlockPointerType((*I)->getType()))
Constructor += Name + " = (struct __block_impl *)_";
@@ -3773,7 +3773,7 @@
while ((loc = FuncName.find(":", loc)) != std::string::npos)
FuncName.replace(loc, 1, "_");
} else if (GlobalVarDecl)
- FuncName = std::string(GlobalVarDecl->getName());
+ FuncName = std::string(GlobalVarDecl->getNameAsString());
std::string BlockNumber = utostr(Blocks.size()-1);