diff options
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjCGNU.cpp | 13 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 51 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 12 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenTypes.cpp | 6 |
6 files changed, 41 insertions, 47 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 444ee7c4005..e862808d12a 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -291,7 +291,7 @@ llvm::DIType CGDebugInfo::CreateType(const EnumType *Ty, // Create DIEnumerator elements for each enumerator. for (EnumConstantDecl *Elt = Decl->getEnumConstantList(); Elt; Elt = dyn_cast_or_null<EnumConstantDecl>(Elt->getNextDeclarator())) { - Enumerators.push_back(DebugFactory.CreateEnumerator(Elt->getName(), + Enumerators.push_back(DebugFactory.CreateEnumerator(Elt->getNameAsString(), Elt->getInitVal().getZExtValue())); } @@ -484,7 +484,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *Decl, unsigned Tag, // Create the descriptor for the variable. llvm::DIVariable D = - DebugFactory.CreateVariable(Tag, RegionStack.back(), Decl->getName(), + DebugFactory.CreateVariable(Tag, RegionStack.back(),Decl->getNameAsString(), Unit, Line, getOrCreateType(Decl->getType(), Unit)); // Insert an llvm.dbg.declare into the current block. diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 4ad698ad11a..bdbd5caa089 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -649,7 +649,7 @@ LValue CodeGenFunction::EmitPredefinedFunctionName(unsigned Type) { std::string FunctionName; if(const FunctionDecl *FD = dyn_cast<FunctionDecl>(CurFuncDecl)) { - FunctionName = FD->getName(); + FunctionName = FD->getNameAsString(); } else { // Just get the mangled name. FunctionName = CurFn->getName(); diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index 32da770ba60..3f2f99c97c1 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -193,7 +193,7 @@ CGObjCGNU::CGObjCGNU(CodeGen::CodeGenModule &cgm) // techniques can modify the name -> class mapping. llvm::Value *CGObjCGNU::GetClass(CGBuilderTy &Builder, const ObjCInterfaceDecl *OID) { - llvm::Value *ClassName = CGM.GetAddrOfConstantCString(OID->getName()); + llvm::Value *ClassName = CGM.GetAddrOfConstantCString(OID->getNameAsString()); ClassName = Builder.CreateStructGEP(ClassName, 0); llvm::Constant *ClassLookupFn = @@ -565,7 +565,7 @@ llvm::Constant *CGObjCGNU::GenerateProtocolList( llvm::Value *CGObjCGNU::GenerateProtocolRef(CGBuilderTy &Builder, const ObjCProtocolDecl *PD) { - return ExistingProtocols[PD->getName()]; + return ExistingProtocols[PD->getNameAsString()]; } void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) { @@ -574,7 +574,7 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) { llvm::SmallVector<std::string, 16> Protocols; for (ObjCProtocolDecl::protocol_iterator PI = PD->protocol_begin(), E = PD->protocol_end(); PI != E; ++PI) - Protocols.push_back((*PI)->getName()); + Protocols.push_back((*PI)->getNameAsString()); llvm::SmallVector<llvm::Constant*, 16> InstanceMethodNames; llvm::SmallVector<llvm::Constant*, 16> InstanceMethodTypes; for (ObjCProtocolDecl::instmeth_iterator iter = PD->instmeth_begin(), @@ -655,7 +655,7 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) { const ObjCList<ObjCProtocolDecl> &Protos =ClassDecl->getReferencedProtocols(); for (ObjCList<ObjCProtocolDecl>::iterator I = Protos.begin(), E = Protos.end(); I != E; ++I) - Protocols.push_back((*I)->getName()); + Protocols.push_back((*I)->getNameAsString()); std::vector<llvm::Constant*> Elements; Elements.push_back(MakeConstantString(CategoryName)); @@ -713,7 +713,8 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { for (ObjCInterfaceDecl::ivar_iterator iter = ClassDecl->ivar_begin(), endIter = ClassDecl->ivar_end() ; iter != endIter ; iter++) { // Store the name - IvarNames.push_back(CGM.GetAddrOfConstantCString((*iter)->getName())); + IvarNames.push_back(CGM.GetAddrOfConstantCString((*iter) + ->getNameAsString())); // Get the type encoding for this ivar std::string TypeStr; Context.getObjCEncodingForType((*iter)->getType(), TypeStr); @@ -751,7 +752,7 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { const ObjCList<ObjCProtocolDecl> &Protos =ClassDecl->getReferencedProtocols(); for (ObjCList<ObjCProtocolDecl>::iterator I = Protos.begin(), E = Protos.end(); I != E; ++I) - Protocols.push_back((*I)->getName()); + Protocols.push_back((*I)->getNameAsString()); diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 975e386c705..67f65599388 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -695,17 +695,17 @@ llvm::Constant *CGObjCMac::GetOrEmitProtocol(const ObjCProtocolDecl *PD) { Values[0] = EmitProtocolExtension(PD, OptInstanceMethods, OptClassMethods); Values[1] = GetClassName(PD->getIdentifier()); Values[2] = - EmitProtocolList(std::string("\01L_OBJC_PROTOCOL_REFS_")+PD->getName(), + EmitProtocolList("\01L_OBJC_PROTOCOL_REFS_" + PD->getNameAsString(), PD->protocol_begin(), PD->protocol_end()); Values[3] = - EmitMethodDescList(std::string("\01L_OBJC_PROTOCOL_INSTANCE_METHODS_") - + PD->getName(), + EmitMethodDescList("\01L_OBJC_PROTOCOL_INSTANCE_METHODS_" + + PD->getNameAsString(), "__OBJC,__cat_inst_meth,regular,no_dead_strip", InstanceMethods); Values[4] = - EmitMethodDescList(std::string("\01L_OBJC_PROTOCOL_CLASS_METHODS_") - + PD->getName(), + EmitMethodDescList("\01L_OBJC_PROTOCOL_CLASS_METHODS_" + + PD->getNameAsString(), "__OBJC,__cat_cls_meth,regular,no_dead_strip", ClassMethods); llvm::Constant *Init = llvm::ConstantStruct::get(ObjCTypes.ProtocolTy, @@ -742,7 +742,7 @@ llvm::Constant *CGObjCMac::GetOrEmitProtocolRef(const ObjCProtocolDecl *PD) { new llvm::GlobalVariable(ObjCTypes.ProtocolTy, false, llvm::GlobalValue::ExternalLinkage, 0, - std::string("\01L_OBJC_PROTOCOL_")+PD->getName(), + "\01L_OBJC_PROTOCOL_" + PD->getNameAsString(), &CGM.getModule()); Entry->setSection("__OBJC,__protocol,regular,no_dead_strip"); UsedGlobals.push_back(Entry); @@ -770,17 +770,17 @@ CGObjCMac::EmitProtocolExtension(const ObjCProtocolDecl *PD, std::vector<llvm::Constant*> Values(4); Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size); Values[1] = - EmitMethodDescList(std::string("\01L_OBJC_PROTOCOL_INSTANCE_METHODS_OPT_") - + PD->getName(), + EmitMethodDescList("\01L_OBJC_PROTOCOL_INSTANCE_METHODS_OPT_" + + PD->getNameAsString(), "__OBJC,__cat_inst_meth,regular,no_dead_strip", OptInstanceMethods); Values[2] = - EmitMethodDescList(std::string("\01L_OBJC_PROTOCOL_CLASS_METHODS_OPT_") - + PD->getName(), + EmitMethodDescList("\01L_OBJC_PROTOCOL_CLASS_METHODS_OPT_" + + PD->getNameAsString(), "__OBJC,__cat_cls_meth,regular,no_dead_strip", OptClassMethods); - Values[3] = EmitPropertyList(std::string("\01L_OBJC_$_PROP_PROTO_LIST_") + - PD->getName(), + Values[3] = EmitPropertyList("\01L_OBJC_$_PROP_PROTO_LIST_" + + PD->getNameAsString(), 0, PD->classprop_begin(), PD->classprop_end()); @@ -796,8 +796,7 @@ CGObjCMac::EmitProtocolExtension(const ObjCProtocolDecl *PD, new llvm::GlobalVariable(ObjCTypes.ProtocolExtensionTy, false, llvm::GlobalValue::InternalLinkage, Init, - (std::string("\01L_OBJC_PROTOCOLEXT_") + - PD->getName()), + "\01L_OBJC_PROTOCOLEXT_" + PD->getNameAsString(), &CGM.getModule()); // No special section, but goes in llvm.used UsedGlobals.push_back(GV); @@ -962,9 +961,8 @@ void CGObjCMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) { const ObjCInterfaceDecl *Interface = OCD->getClassInterface(); const ObjCCategoryDecl *Category = Interface->FindCategoryDeclaration(OCD->getIdentifier()); - std::string ExtName(std::string(Interface->getName()) + - "_" + - OCD->getName()); + std::string ExtName(Interface->getNameAsString() + "_" + + OCD->getNameAsString()); std::vector<llvm::Constant*> InstanceMethods, ClassMethods; for (ObjCCategoryImplDecl::instmeth_iterator i = OCD->instmeth_begin(), @@ -1081,7 +1079,7 @@ void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) { ObjCInterfaceDecl *Interface = const_cast<ObjCInterfaceDecl*>(ID->getClassInterface()); llvm::Constant *Protocols = - EmitProtocolList(std::string("\01L_OBJC_CLASS_PROTOCOLS_") + ID->getName(), + EmitProtocolList("\01L_OBJC_CLASS_PROTOCOLS_" + ID->getNameAsString(), Interface->protocol_begin(), Interface->protocol_end()); const llvm::Type *InterfaceTy = @@ -1140,7 +1138,7 @@ void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) { Values[ 5] = llvm::ConstantInt::get(ObjCTypes.LongTy, Size); Values[ 6] = EmitIvarList(ID, false, InterfaceTy); Values[ 7] = - EmitMethodList(std::string("\01L_OBJC_INSTANCE_METHODS_") + ID->getName(), + EmitMethodList("\01L_OBJC_INSTANCE_METHODS_" + ID->getNameAsString(), "__OBJC,__inst_meth,regular,no_dead_strip", InstanceMethods); // cache is always NULL. @@ -1200,7 +1198,7 @@ llvm::Constant *CGObjCMac::EmitMetaClass(const ObjCImplementationDecl *ID, Values[ 5] = llvm::ConstantInt::get(ObjCTypes.LongTy, Size); Values[ 6] = EmitIvarList(ID, true, InterfaceTy); Values[ 7] = - EmitMethodList(std::string("\01L_OBJC_CLASS_METHODS_") + ID->getName(), + EmitMethodList("\01L_OBJC_CLASS_METHODS_" + ID->getNameAsString(), "__OBJC,__inst_meth,regular,no_dead_strip", Methods); // cache is always NULL. @@ -1238,8 +1236,7 @@ llvm::Constant *CGObjCMac::EmitMetaClass(const ObjCImplementationDecl *ID, } llvm::Constant *CGObjCMac::EmitMetaClassRef(const ObjCInterfaceDecl *ID) { - std::string Name("\01L_OBJC_METACLASS_"); - Name += ID->getName(); + std::string Name = "\01L_OBJC_METACLASS_" + ID->getNameAsString(); // FIXME: Should we look these up somewhere other than the // module. Its a bit silly since we only generate these while @@ -1278,8 +1275,7 @@ CGObjCMac::EmitClassExtension(const ObjCImplementationDecl *ID) { Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size); // FIXME: Output weak_ivar_layout string. Values[1] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy); - Values[2] = EmitPropertyList(std::string("\01L_OBJC_$_PROP_LIST_") + - ID->getName(), + Values[2] = EmitPropertyList("\01L_OBJC_$_PROP_LIST_" + ID->getNameAsString(), ID, ID->getClassInterface()->classprop_begin(), ID->getClassInterface()->classprop_end()); @@ -1294,8 +1290,7 @@ CGObjCMac::EmitClassExtension(const ObjCImplementationDecl *ID) { new llvm::GlobalVariable(ObjCTypes.ClassExtensionTy, false, llvm::GlobalValue::InternalLinkage, Init, - (std::string("\01L_OBJC_CLASSEXT_") + - ID->getName()), + "\01L_OBJC_CLASSEXT_" + ID->getNameAsString(), &CGM.getModule()); // No special section, but goes in llvm.used UsedGlobals.push_back(GV); @@ -1361,7 +1356,7 @@ llvm::Constant *CGObjCMac::EmitIvarList(const ObjCImplementationDecl *ID, new llvm::GlobalVariable(Init->getType(), false, llvm::GlobalValue::InternalLinkage, Init, - std::string(Prefix) + ID->getName(), + Prefix + ID->getNameAsString(), &CGM.getModule()); if (ForClass) { GV->setSection("__OBJC,__cls_vars,regular,no_dead_strip"); @@ -2145,7 +2140,7 @@ void CGObjCMac::GetNameForMethod(const ObjCMethodDecl *D, // FIXME: Find the mangling GCC uses. NameOut = (D->isInstance() ? "-" : "+"); NameOut += '['; - NameOut += D->getClassInterface()->getName(); + NameOut += D->getClassInterface()->getNameAsString(); NameOut += ' '; NameOut += D->getSelector().getAsString(); NameOut += ']'; diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 2ff2beeb836..f0aa8b7d141 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -321,9 +321,7 @@ void CodeGenModule::EmitAliases() { llvm::GlobalValue *GA = new llvm::GlobalAlias(aliasee->getType(), llvm::Function::ExternalLinkage, - D->getName(), - aliasee, - &getModule()); + D->getNameAsString(), aliasee, &getModule()); llvm::GlobalValue *&Entry = GlobalDeclMap[D->getIdentifier()]; if (Entry) { @@ -482,7 +480,7 @@ void CodeGenModule::EmitGlobalDefinition(const ValueDecl *D) { if (!Entry) Entry = new llvm::GlobalVariable(Ty, false, llvm::GlobalValue::ExternalLinkage, - 0, D->getName(), &getModule(), 0, + 0, D->getNameAsString(), &getModule(), 0, ASTTy.getAddressSpace()); // Make sure the result is of the correct type. @@ -518,7 +516,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { if (!GV) { GV = new llvm::GlobalVariable(InitType, false, llvm::GlobalValue::ExternalLinkage, - 0, D->getName(), &getModule(), 0, + 0, D->getNameAsString(), &getModule(), 0, ASTTy.getAddressSpace()); } else if (GV->getType() != llvm::PointerType::get(InitType, ASTTy.getAddressSpace())) { @@ -542,7 +540,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { // Make a new global with the correct type GV = new llvm::GlobalVariable(InitType, false, llvm::GlobalValue::ExternalLinkage, - 0, D->getName(), &getModule(), 0, + 0, D->getNameAsString(), &getModule(), 0, ASTTy.getAddressSpace()); // Steal the name of the old global GV->takeName(OldGV); @@ -630,7 +628,7 @@ CodeGenModule::EmitForwardFunctionDefinition(const FunctionDecl *D) { const llvm::Type *Ty = getTypes().ConvertType(D->getType()); llvm::Function *F = llvm::Function::Create(cast<llvm::FunctionType>(Ty), llvm::Function::ExternalLinkage, - D->getName(), &getModule()); + D->getNameAsString(),&getModule()); SetFunctionAttributes(D, F); return F; } diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp index e49281dd685..18cfdeaff6e 100644 --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -291,7 +291,7 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) { std::vector<const llvm::Type*> IvarTypes; CollectObjCIvarTypes(OIT.getDecl(), IvarTypes); llvm::Type *T = llvm::StructType::get(IvarTypes); - TheModule.addTypeName(std::string("struct.") + OIT.getDecl()->getName(), T); + TheModule.addTypeName("struct." + OIT.getDecl()->getNameAsString(), T); return T; } @@ -315,9 +315,9 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) { // Name the codegen type after the typedef name // if there is no tag type name available if (TD->getIdentifier()) - TypeName += TD->getName(); + TypeName += TD->getNameAsString(); else if (const TypedefType *TdT = dyn_cast<TypedefType>(T)) - TypeName += TdT->getDecl()->getName(); + TypeName += TdT->getDecl()->getNameAsString(); else TypeName += "anon"; |