r269630 - CodeGen: convert some const char * to StringRef
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Sun May 15 22:06:49 PDT 2016
Author: compnerd
Date: Mon May 16 00:06:49 2016
New Revision: 269630
URL: http://llvm.org/viewvc/llvm-project?rev=269630&view=rev
Log:
CodeGen: convert some const char * to StringRef
Convert some use of const char * to StringRef. NFC.
Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=269630&r1=269629&r2=269630&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Mon May 16 00:06:49 2016
@@ -1133,9 +1133,8 @@ private:
/// EmitMethodList - Emit the method list for the given
/// implementation. The return value has type MethodListPtrTy.
- llvm::Constant *EmitMethodList(Twine Name,
- const char *Section,
- ArrayRef<llvm::Constant*> Methods);
+ llvm::Constant *EmitMethodList(Twine Name, StringRef Section,
+ ArrayRef<llvm::Constant *> Methods);
/// EmitMethodDescList - Emit a method description list for a list of
/// method declarations.
@@ -1148,9 +1147,8 @@ private:
/// - begin, end: The method list to output.
///
/// The return value has type MethodDescriptionListPtrTy.
- llvm::Constant *EmitMethodDescList(Twine Name,
- const char *Section,
- ArrayRef<llvm::Constant*> Methods);
+ llvm::Constant *EmitMethodDescList(Twine Name, StringRef Section,
+ ArrayRef<llvm::Constant *> Methods);
/// GetOrEmitProtocol - Get the protocol object for the given
/// declaration, emitting it if necessary. The return value has type
@@ -1307,9 +1305,8 @@ private:
/// AddModuleClassList - Add the given list of class pointers to the
/// module with the provided symbol and section names.
- void AddModuleClassList(ArrayRef<llvm::GlobalValue*> Container,
- const char *SymbolName,
- const char *SectionName);
+ void AddModuleClassList(ArrayRef<llvm::GlobalValue *> Container,
+ StringRef SymbolName, StringRef SectionName);
llvm::GlobalVariable * BuildClassRoTInitializer(unsigned flags,
unsigned InstanceStart,
@@ -1328,9 +1325,8 @@ private:
/// EmitMethodList - Emit the method list for the given
/// implementation. The return value has type MethodListnfABITy.
- llvm::Constant *EmitMethodList(Twine Name,
- const char *Section,
- ArrayRef<llvm::Constant*> Methods);
+ llvm::Constant *EmitMethodList(Twine Name, StringRef Section,
+ ArrayRef<llvm::Constant *> Methods);
/// EmitIvarList - Emit the ivar list for the given
/// implementation. If ForClass is true the list of class ivars
/// (i.e. metaclass ivars) is emitted, otherwise the list of
@@ -1412,13 +1408,9 @@ private:
llvm::Constant *GetInterfaceEHType(const ObjCInterfaceDecl *ID,
bool ForDefinition);
- const char *getMetaclassSymbolPrefix() const {
- return "OBJC_METACLASS_$_";
- }
+ StringRef getMetaclassSymbolPrefix() const { return "OBJC_METACLASS_$_"; }
- const char *getClassSymbolPrefix() const {
- return "OBJC_CLASS_$_";
- }
+ StringRef getClassSymbolPrefix() const { return "OBJC_CLASS_$_"; }
void GetClassSizeInfo(const ObjCImplementationDecl *OID,
uint32_t &InstanceStart,
@@ -3062,8 +3054,8 @@ CGObjCMac::GetMethodDescriptionConstant(
}
llvm::Constant *
-CGObjCMac::EmitMethodDescList(Twine Name, const char *Section,
- ArrayRef<llvm::Constant*> Methods) {
+CGObjCMac::EmitMethodDescList(Twine Name, StringRef Section,
+ ArrayRef<llvm::Constant *> Methods) {
// Return null for empty list.
if (Methods.empty())
return llvm::Constant::getNullValue(ObjCTypes.MethodDescriptionListPtrTy);
@@ -3606,9 +3598,8 @@ llvm::Constant *CGObjCMac::GetMethodCons
return llvm::ConstantStruct::get(ObjCTypes.MethodTy, Method);
}
-llvm::Constant *CGObjCMac::EmitMethodList(Twine Name,
- const char *Section,
- ArrayRef<llvm::Constant*> Methods) {
+llvm::Constant *CGObjCMac::EmitMethodList(Twine Name, StringRef Section,
+ ArrayRef<llvm::Constant *> Methods) {
// Return null for empty list.
if (Methods.empty())
return llvm::Constant::getNullValue(ObjCTypes.MethodListPtrTy);
@@ -5700,10 +5691,9 @@ llvm::Function *CGObjCNonFragileABIMac::
return nullptr;
}
-void CGObjCNonFragileABIMac::
-AddModuleClassList(ArrayRef<llvm::GlobalValue*> Container,
- const char *SymbolName,
- const char *SectionName) {
+void CGObjCNonFragileABIMac::AddModuleClassList(
+ ArrayRef<llvm::GlobalValue *> Container, StringRef SymbolName,
+ StringRef SectionName) {
unsigned NumClasses = Container.size();
if (!NumClasses)
@@ -6312,9 +6302,8 @@ llvm::Constant *CGObjCNonFragileABIMac::
/// }
///
llvm::Constant *
-CGObjCNonFragileABIMac::EmitMethodList(Twine Name,
- const char *Section,
- ArrayRef<llvm::Constant*> Methods) {
+CGObjCNonFragileABIMac::EmitMethodList(Twine Name, StringRef Section,
+ ArrayRef<llvm::Constant *> Methods) {
// Return null for empty list.
if (Methods.empty())
return llvm::Constant::getNullValue(ObjCTypes.MethodListnfABIPtrTy);
@@ -6911,9 +6900,8 @@ llvm::Value *CGObjCNonFragileABIMac::Emi
llvm::GlobalVariable *&Entry = ClassReferences[II];
if (!Entry) {
- std::string ClassName(
- getClassSymbolPrefix() +
- (ID ? ID->getObjCRuntimeNameAsString() : II->getName()).str());
+ StringRef Name = ID ? ID->getObjCRuntimeNameAsString() : II->getName();
+ std::string ClassName = (getClassSymbolPrefix() + Name).str();
llvm::GlobalVariable *ClassGV = GetClassGlobal(ClassName, Weak);
Entry = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABIPtrTy,
false, llvm::GlobalValue::PrivateLinkage,
More information about the cfe-commits
mailing list