1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

Pass StringRef by value.

llvm-svn: 86251
This commit is contained in:
Daniel Dunbar 2009-11-06 10:58:06 +00:00
parent cfd2ade9d2
commit 4daaf9d3f4
51 changed files with 196 additions and 200 deletions

View File

@ -96,12 +96,12 @@ protected:
/// specified bucket will be non-null. Otherwise, it will be null. In either
/// case, the FullHashValue field of the bucket will be set to the hash value
/// of the string.
unsigned LookupBucketFor(const StringRef &Key);
unsigned LookupBucketFor(StringRef Key);
/// FindKey - Look up the bucket that contains the specified key. If it exists
/// in the map, return the bucket number of the key. Otherwise return -1.
/// This does not modify the map.
int FindKey(const StringRef &Key) const;
int FindKey(StringRef Key) const;
/// RemoveKey - Remove the specified StringMapEntry from the table, but do not
/// delete it. This aborts if the value isn't in the table.
@ -109,7 +109,7 @@ protected:
/// RemoveKey - Remove the StringMapEntry for the specified key from the
/// table, returning it. If the key is not in the table, this returns null.
StringMapEntryBase *RemoveKey(const StringRef &Key);
StringMapEntryBase *RemoveKey(StringRef Key);
private:
void init(unsigned Size);
public:
@ -282,13 +282,13 @@ public:
return const_iterator(TheTable+NumBuckets, true);
}
iterator find(const StringRef &Key) {
iterator find(StringRef Key) {
int Bucket = FindKey(Key);
if (Bucket == -1) return end();
return iterator(TheTable+Bucket);
}
const_iterator find(const StringRef &Key) const {
const_iterator find(StringRef Key) const {
int Bucket = FindKey(Key);
if (Bucket == -1) return end();
return const_iterator(TheTable+Bucket);
@ -296,18 +296,18 @@ public:
/// lookup - Return the entry for the specified key, or a default
/// constructed value if no such entry exists.
ValueTy lookup(const StringRef &Key) const {
ValueTy lookup(StringRef Key) const {
const_iterator it = find(Key);
if (it != end())
return it->second;
return ValueTy();
}
ValueTy& operator[](const StringRef &Key) {
ValueTy& operator[](StringRef Key) {
return GetOrCreateValue(Key).getValue();
}
size_type count(const StringRef &Key) const {
size_type count(StringRef Key) const {
return find(Key) == end() ? 0 : 1;
}
@ -350,7 +350,7 @@ public:
/// exists, return it. Otherwise, default construct a value, insert it, and
/// return.
template <typename InitTy>
StringMapEntry<ValueTy> &GetOrCreateValue(const StringRef &Key,
StringMapEntry<ValueTy> &GetOrCreateValue(StringRef Key,
InitTy Val) {
unsigned BucketNo = LookupBucketFor(Key);
ItemBucket &Bucket = TheTable[BucketNo];
@ -373,7 +373,7 @@ public:
return *NewItem;
}
StringMapEntry<ValueTy> &GetOrCreateValue(const StringRef &Key) {
StringMapEntry<ValueTy> &GetOrCreateValue(StringRef Key) {
return GetOrCreateValue(Key, ValueTy());
}
@ -401,7 +401,7 @@ public:
V.Destroy(Allocator);
}
bool erase(const StringRef &Key) {
bool erase(StringRef Key) {
iterator I = find(Key);
if (I == end()) return false;
erase(I);

View File

@ -92,14 +92,14 @@ namespace llvm {
/// equals - Check for string equality, this is more efficient than
/// compare() when the relative ordering of inequal strings isn't needed.
bool equals(const StringRef &RHS) const {
bool equals(StringRef RHS) const {
return (Length == RHS.Length &&
memcmp(Data, RHS.Data, RHS.Length) == 0);
}
/// compare - Compare two strings; the result is -1, 0, or 1 if this string
/// is lexicographically less than, equal to, or greater than the \arg RHS.
int compare(const StringRef &RHS) const {
int compare(StringRef RHS) const {
// Check the prefix for a mismatch.
if (int Res = memcmp(Data, RHS.Data, std::min(Length, RHS.Length)))
return Res < 0 ? -1 : 1;
@ -135,12 +135,12 @@ namespace llvm {
/// @{
/// startswith - Check if this string starts with the given \arg Prefix.
bool startswith(const StringRef &Prefix) const {
bool startswith(StringRef Prefix) const {
return substr(0, Prefix.Length).equals(Prefix);
}
/// endswith - Check if this string ends with the given \arg Suffix.
bool endswith(const StringRef &Suffix) const {
bool endswith(StringRef Suffix) const {
return slice(size() - Suffix.Length, size()).equals(Suffix);
}
@ -163,7 +163,7 @@ namespace llvm {
///
/// \return - The index of the first occurence of \arg Str, or npos if not
/// found.
size_t find(const StringRef &Str) const;
size_t find(StringRef Str) const;
/// rfind - Search for the last character \arg C in the string.
///
@ -184,7 +184,7 @@ namespace llvm {
///
/// \return - The index of the last occurence of \arg Str, or npos if not
/// found.
size_t rfind(const StringRef &Str) const;
size_t rfind(StringRef Str) const;
/// find_first_of - Find the first instance of the specified character or
/// return npos if not in string. Same as find.
@ -213,7 +213,7 @@ namespace llvm {
/// count - Return the number of non-overlapped occurrences of \arg Str in
/// the string.
size_t count(const StringRef &Str) const;
size_t count(StringRef Str) const;
/// getAsInteger - Parse the current string as an integer of the specified
/// radix. If Radix is specified as zero, this does radix autosensing using
@ -304,27 +304,27 @@ namespace llvm {
/// @name StringRef Comparison Operators
/// @{
inline bool operator==(const StringRef &LHS, const StringRef &RHS) {
inline bool operator==(StringRef LHS, StringRef RHS) {
return LHS.equals(RHS);
}
inline bool operator!=(const StringRef &LHS, const StringRef &RHS) {
inline bool operator!=(StringRef LHS, StringRef RHS) {
return !(LHS == RHS);
}
inline bool operator<(const StringRef &LHS, const StringRef &RHS) {
inline bool operator<(StringRef LHS, StringRef RHS) {
return LHS.compare(RHS) == -1;
}
inline bool operator<=(const StringRef &LHS, const StringRef &RHS) {
inline bool operator<=(StringRef LHS, StringRef RHS) {
return LHS.compare(RHS) != 1;
}
inline bool operator>(const StringRef &LHS, const StringRef &RHS) {
inline bool operator>(StringRef LHS, StringRef RHS) {
return LHS.compare(RHS) == 1;
}
inline bool operator>=(const StringRef &LHS, const StringRef &RHS) {
inline bool operator>=(StringRef LHS, StringRef RHS) {
return LHS.compare(RHS) != -1;
}

View File

@ -218,23 +218,23 @@ public:
/// setArchName - Set the architecture (first) component of the
/// triple by name.
void setArchName(const StringRef &Str);
void setArchName(StringRef Str);
/// setVendorName - Set the vendor (second) component of the triple
/// by name.
void setVendorName(const StringRef &Str);
void setVendorName(StringRef Str);
/// setOSName - Set the operating system (third) component of the
/// triple by name.
void setOSName(const StringRef &Str);
void setOSName(StringRef Str);
/// setEnvironmentName - Set the optional environment (fourth)
/// component of the triple by name.
void setEnvironmentName(const StringRef &Str);
void setEnvironmentName(StringRef Str);
/// setOSAndEnvironmentName - Set the operating system and optional
/// environment components with a single string.
void setOSAndEnvironmentName(const StringRef &Str);
void setOSAndEnvironmentName(StringRef Str);
/// @}
/// @name Static helpers for IDs.
@ -265,12 +265,12 @@ public:
/// getArchTypeForLLVMName - The canonical type for the given LLVM
/// architecture name (e.g., "x86").
static ArchType getArchTypeForLLVMName(const StringRef &Str);
static ArchType getArchTypeForLLVMName(StringRef Str);
/// getArchTypeForDarwinArchName - Get the architecture type for a "Darwin"
/// architecture name, for example as accepted by "gcc -arch" (see also
/// arch(3)).
static ArchType getArchTypeForDarwinArchName(const StringRef &Str);
static ArchType getArchTypeForDarwinArchName(StringRef Str);
/// @}
};

View File

@ -294,7 +294,7 @@ private:
/// known to exist at the end of the the record.
template<typename uintty>
void EmitRecordWithAbbrevImpl(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
const StringRef &Blob) {
StringRef Blob) {
const char *BlobData = Blob.data();
unsigned BlobLen = (unsigned) Blob.size();
unsigned AbbrevNo = Abbrev-bitc::FIRST_APPLICATION_ABBREV;
@ -422,7 +422,7 @@ public:
/// of the record.
template<typename uintty>
void EmitRecordWithBlob(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
const StringRef &Blob) {
StringRef Blob) {
EmitRecordWithAbbrevImpl(Abbrev, Vals, Blob);
}
template<typename uintty>
@ -435,7 +435,7 @@ public:
/// that end with an array.
template<typename uintty>
void EmitRecordWithArray(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
const StringRef &Array) {
StringRef Array) {
EmitRecordWithAbbrevImpl(Abbrev, Vals, Array);
}
template<typename uintty>

View File

@ -86,7 +86,7 @@ public:
/// Return a ConstantInt constructed from the string strStart with the given
/// radix.
static ConstantInt *get(const IntegerType *Ty, const StringRef &Str,
static ConstantInt *get(const IntegerType *Ty, StringRef Str,
uint8_t radix);
/// If Ty is a vector type, return a Constant with a splat of the given
@ -255,7 +255,7 @@ public:
/// only be used for simple constant values like 2.0/1.0 etc, that are
/// known-valid both as host double and as the target format.
static Constant *get(const Type* Ty, double V);
static Constant *get(const Type* Ty, const StringRef &Str);
static Constant *get(const Type* Ty, StringRef Str);
static ConstantFP *get(LLVMContext &Context, const APFloat &V);
static ConstantFP *getNegativeZero(const Type* Ty);
static ConstantFP *getInfinity(const Type *Ty, bool Negative = false);
@ -353,7 +353,7 @@ public:
/// of the array by one (you've been warned). However, in some situations
/// this is not desired so if AddNull==false then the string is copied without
/// null termination.
static Constant *get(LLVMContext &Context, const StringRef &Initializer,
static Constant *get(LLVMContext &Context, StringRef Initializer,
bool AddNull = true);
/// Transparently provide more efficient getOperand methods.

View File

@ -90,7 +90,7 @@ public:
bool hasSection() const { return !Section.empty(); }
const std::string &getSection() const { return Section; }
void setSection(const StringRef &S) { Section = S; }
void setSection(StringRef S) { Section = S; }
/// If the usage is empty (except transitively dead constants), then this
/// global value can can be safely deleted since the destructor will

View File

@ -33,16 +33,16 @@ class InlineAsm : public Value {
bool HasSideEffects;
bool IsAlignStack;
InlineAsm(const FunctionType *Ty, const StringRef &AsmString,
const StringRef &Constraints, bool hasSideEffects,
InlineAsm(const FunctionType *Ty, StringRef AsmString,
StringRef Constraints, bool hasSideEffects,
bool isAlignStack = false);
virtual ~InlineAsm();
public:
/// InlineAsm::get - Return the the specified uniqued inline asm string.
///
static InlineAsm *get(const FunctionType *Ty, const StringRef &AsmString,
const StringRef &Constraints, bool hasSideEffects,
static InlineAsm *get(const FunctionType *Ty, StringRef AsmString,
StringRef Constraints, bool hasSideEffects,
bool isAlignStack = false);
bool hasSideEffects() const { return HasSideEffects; }
@ -65,7 +65,7 @@ public:
/// the specified constraint string is legal for the type. This returns true
/// if legal, false if not.
///
static bool Verify(const FunctionType *Ty, const StringRef &Constraints);
static bool Verify(const FunctionType *Ty, StringRef Constraints);
// Constraint String Parsing
enum ConstraintPrefix {
@ -110,7 +110,7 @@ public:
/// Parse - Analyze the specified string (e.g. "=*&{eax}") and fill in the
/// fields in this structure. If the constraint string is not understood,
/// return true, otherwise return false.
bool Parse(const StringRef &Str,
bool Parse(StringRef Str,
std::vector<InlineAsm::ConstraintInfo> &ConstraintsSoFar);
};
@ -118,7 +118,7 @@ public:
/// constraints and their prefixes. If this returns an empty vector, and if
/// the constraint string itself isn't empty, there was an error parsing.
static std::vector<ConstraintInfo>
ParseConstraints(const StringRef &ConstraintString);
ParseConstraints(StringRef ConstraintString);
/// ParseConstraints - Parse the constraints of this inlineasm object,
/// returning them the same way that ParseConstraints(str) does.

View File

@ -65,8 +65,8 @@ class Linker {
/// Construct the Linker with an empty module which will be given the
/// name \p progname. \p progname will also be used for error messages.
/// @brief Construct with empty module
Linker(const StringRef &progname, ///< name of tool running linker
const StringRef &modulename, ///< name of linker's end-result module
Linker(StringRef progname, ///< name of tool running linker
StringRef modulename, ///< name of linker's end-result module
LLVMContext &C, ///< Context for global info
unsigned Flags = 0 ///< ControlFlags (one or more |'d together)
);
@ -74,7 +74,7 @@ class Linker {
/// Construct the Linker with a previously defined module, \p aModule. Use
/// \p progname for the name of the program in error messages.
/// @brief Construct with existing module
Linker(const StringRef& progname, Module* aModule, unsigned Flags = 0);
Linker(StringRef progname, Module* aModule, unsigned Flags = 0);
/// Destruct the Linker.
/// @brief Destructor
@ -214,8 +214,8 @@ class Linker {
/// @returns true if an error occurs, false otherwise
/// @brief Link one library into the module
bool LinkInLibrary (
const StringRef &Library, ///< The library to link in
bool& is_native ///< Indicates if lib a native library
StringRef Library, ///< The library to link in
bool& is_native ///< Indicates if lib a native library
);
/// This function links one bitcode archive, \p Filename, into the module.
@ -267,7 +267,7 @@ class Linker {
/// will be empty (i.e. sys::Path::isEmpty() will return true).
/// @returns A sys::Path to the found library
/// @brief Find a library from its short name.
sys::Path FindLib(const StringRef &Filename);
sys::Path FindLib(StringRef Filename);
/// @}
/// @name Implementation
@ -277,9 +277,9 @@ class Linker {
/// Module it contains (wrapped in an auto_ptr), or 0 if an error occurs.
std::auto_ptr<Module> LoadObject(const sys::Path& FN);
bool warning(const StringRef &message);
bool error(const StringRef &message);
void verbose(const StringRef &message);
bool warning(StringRef message);
bool error(StringRef message);
void verbose(StringRef message);
/// @}
/// @name Data

View File

@ -56,7 +56,7 @@ struct AsmToken {
public:
AsmToken() {}
AsmToken(TokenKind _Kind, const StringRef &_Str, int64_t _IntVal = 0)
AsmToken(TokenKind _Kind, StringRef _Str, int64_t _IntVal = 0)
: Kind(_Kind), Str(_Str), IntVal(_IntVal) {}
TokenKind getKind() const { return Kind; }

View File

@ -49,7 +49,7 @@ namespace llvm {
/// CreateSymbol - Create a new symbol with the specified @param Name.
///
/// @param Name - The symbol name, which must be unique across all symbols.
MCSymbol *CreateSymbol(const StringRef &Name);
MCSymbol *CreateSymbol(StringRef Name);
/// GetOrCreateSymbol - Lookup the symbol inside with the specified
/// @param Name. If it exists, return it. If not, create a forward
@ -58,7 +58,7 @@ namespace llvm {
/// @param Name - The symbol name, which must be unique across all symbols.
/// @param IsTemporary - Whether this symbol is an assembler temporary,
/// which should not survive into the symbol table for the translation unit.
MCSymbol *GetOrCreateSymbol(const StringRef &Name);
MCSymbol *GetOrCreateSymbol(StringRef Name);
MCSymbol *GetOrCreateSymbol(const Twine &Name);
/// CreateTemporarySymbol - Create a new temporary symbol with the specified
@ -67,10 +67,10 @@ namespace llvm {
/// @param Name - The symbol name, for debugging purposes only, temporary
/// symbols do not surive assembly. If non-empty the name must be unique
/// across all symbols.
MCSymbol *CreateTemporarySymbol(const StringRef &Name = "");
MCSymbol *CreateTemporarySymbol(StringRef Name = "");
/// LookupSymbol - Get the symbol for @param Name, or null.
MCSymbol *LookupSymbol(const StringRef &Name) const;
MCSymbol *LookupSymbol(StringRef Name) const;
/// @}

View File

@ -120,7 +120,7 @@ public:
/// @{
static const MCSymbolRefExpr *Create(const MCSymbol *Symbol, MCContext &Ctx);
static const MCSymbolRefExpr *Create(const StringRef &Name, MCContext &Ctx);
static const MCSymbolRefExpr *Create(StringRef Name, MCContext &Ctx);
/// @}
/// @name Accessors

View File

@ -51,13 +51,13 @@ namespace llvm {
/// of a syntactic one.
bool IsDirective;
MCSectionCOFF(const StringRef &name, bool isDirective, SectionKind K)
MCSectionCOFF(StringRef name, bool isDirective, SectionKind K)
: MCSection(K), Name(name), IsDirective(isDirective) {
}
public:
static MCSectionCOFF *Create(const StringRef &Name, bool IsDirective,
SectionKind K, MCContext &Ctx);
static MCSectionCOFF *Create(StringRef Name, bool IsDirective,
SectionKind K, MCContext &Ctx);
const std::string &getName() const { return Name; }
bool isDirective() const { return IsDirective; }

View File

@ -35,13 +35,13 @@ class MCSectionELF : public MCSection {
bool IsExplicit;
protected:
MCSectionELF(const StringRef &Section, unsigned type, unsigned flags,
MCSectionELF(StringRef Section, unsigned type, unsigned flags,
SectionKind K, bool isExplicit)
: MCSection(K), SectionName(Section.str()), Type(type), Flags(flags),
IsExplicit(isExplicit) {}
public:
static MCSectionELF *Create(const StringRef &Section, unsigned Type,
static MCSectionELF *Create(StringRef Section, unsigned Type,
unsigned Flags, SectionKind K, bool isExplicit,
MCContext &Ctx);

View File

@ -33,7 +33,7 @@ class MCSectionMachO : public MCSection {
/// size of stubs, for example.
unsigned Reserved2;
MCSectionMachO(const StringRef &Segment, const StringRef &Section,
MCSectionMachO(StringRef Segment, StringRef Section,
unsigned TAA, unsigned reserved2, SectionKind K)
: MCSection(K), TypeAndAttributes(TAA), Reserved2(reserved2) {
assert(Segment.size() <= 16 && Section.size() <= 16 &&
@ -52,8 +52,8 @@ class MCSectionMachO : public MCSection {
}
public:
static MCSectionMachO *Create(const StringRef &Segment,
const StringRef &Section,
static MCSectionMachO *Create(StringRef Segment,
StringRef Section,
unsigned TypeAndAttributes,
unsigned Reserved2,
SectionKind K, MCContext &Ctx);

View File

@ -155,7 +155,7 @@ namespace llvm {
///
/// This is used to implement assembler directives such as .byte, .ascii,
/// etc.
virtual void EmitBytes(const StringRef &Data) = 0;
virtual void EmitBytes(StringRef Data) = 0;
/// EmitValue - Emit the expression @param Value into the output as a native
/// integer of the given @param Size bytes.

View File

@ -56,7 +56,7 @@ namespace llvm {
private: // MCContext creates and uniques these.
friend class MCContext;
MCSymbol(const StringRef &_Name, bool _IsTemporary)
MCSymbol(StringRef _Name, bool _IsTemporary)
: Name(_Name), Section(0), Value(0), IsTemporary(_IsTemporary) {}
MCSymbol(const MCSymbol&); // DO NOT IMPLEMENT

View File

@ -154,7 +154,7 @@ private:
public:
/// The Module constructor. Note that there is no default constructor. You
/// must provide a name for the module upon construction.
explicit Module(const StringRef &ModuleID, LLVMContext& C);
explicit Module(StringRef ModuleID, LLVMContext& C);
/// The module destructor. This will dropAllReferences.
~Module();
@ -196,20 +196,20 @@ public:
public:
/// Set the module identifier.
void setModuleIdentifier(const StringRef &ID) { ModuleID = ID; }
void setModuleIdentifier(StringRef ID) { ModuleID = ID; }
/// Set the data layout
void setDataLayout(const StringRef &DL) { DataLayout = DL; }
void setDataLayout(StringRef DL) { DataLayout = DL; }
/// Set the target triple.
void setTargetTriple(const StringRef &T) { TargetTriple = T; }
void setTargetTriple(StringRef T) { TargetTriple = T; }
/// Set the module-scope inline assembly blocks.
void setModuleInlineAsm(const StringRef &Asm) { GlobalScopeAsm = Asm; }
void setModuleInlineAsm(StringRef Asm) { GlobalScopeAsm = Asm; }
/// Append to the module-scope inline assembly blocks, automatically
/// appending a newline to the end.
void appendModuleInlineAsm(const StringRef &Asm) {
void appendModuleInlineAsm(StringRef Asm) {
GlobalScopeAsm += Asm;
GlobalScopeAsm += '\n';
}
@ -221,7 +221,7 @@ public:
/// getNamedValue - Return the first global value in the module with
/// the specified name, of arbitrary type. This method returns null
/// if a global with the specified name is not found.
GlobalValue *getNamedValue(const StringRef &Name) const;
GlobalValue *getNamedValue(StringRef Name) const;
/// @}
/// @name Function Accessors
@ -236,10 +236,10 @@ public:
/// the existing function.
/// 4. Finally, the function exists but has the wrong prototype: return the
/// function with a constantexpr cast to the right prototype.
Constant *getOrInsertFunction(const StringRef &Name, const FunctionType *T,
Constant *getOrInsertFunction(StringRef Name, const FunctionType *T,
AttrListPtr AttributeList);
Constant *getOrInsertFunction(const StringRef &Name, const FunctionType *T);
Constant *getOrInsertFunction(StringRef Name, const FunctionType *T);
/// getOrInsertFunction - Look up the specified function in the module symbol
/// table. If it does not exist, add a prototype for the function and return
@ -248,21 +248,21 @@ public:
/// named function has a different type. This version of the method takes a
/// null terminated list of function arguments, which makes it easier for
/// clients to use.
Constant *getOrInsertFunction(const StringRef &Name,
Constant *getOrInsertFunction(StringRef Name,
AttrListPtr AttributeList,
const Type *RetTy, ...) END_WITH_NULL;
/// getOrInsertFunction - Same as above, but without the attributes.
Constant *getOrInsertFunction(const StringRef &Name, const Type *RetTy, ...)
Constant *getOrInsertFunction(StringRef Name, const Type *RetTy, ...)
END_WITH_NULL;
Constant *getOrInsertTargetIntrinsic(const StringRef &Name,
Constant *getOrInsertTargetIntrinsic(StringRef Name,
const FunctionType *Ty,
AttrListPtr AttributeList);
/// getFunction - Look up the specified function in the module symbol table.
/// If it does not exist, return null.
Function *getFunction(const StringRef &Name) const;
Function *getFunction(StringRef Name) const;
/// @}
/// @name Global Variable Accessors
@ -272,13 +272,13 @@ public:
/// symbol table. If it does not exist, return null. If AllowInternal is set
/// to true, this function will return types that have InternalLinkage. By
/// default, these types are not returned.
GlobalVariable *getGlobalVariable(const StringRef &Name,
GlobalVariable *getGlobalVariable(StringRef Name,
bool AllowInternal = false) const;
/// getNamedGlobal - Return the first global variable in the module with the
/// specified name, of arbitrary type. This method returns null if a global
/// with the specified name is not found.
GlobalVariable *getNamedGlobal(const StringRef &Name) const {
GlobalVariable *getNamedGlobal(StringRef Name) const {
return getGlobalVariable(Name, true);
}
@ -289,7 +289,7 @@ public:
/// with a constantexpr cast to the right type.
/// 3. Finally, if the existing global is the correct delclaration, return
/// the existing global.
Constant *getOrInsertGlobal(const StringRef &Name, const Type *Ty);
Constant *getOrInsertGlobal(StringRef Name, const Type *Ty);
/// @}
/// @name Global Alias Accessors
@ -298,7 +298,7 @@ public:
/// getNamedAlias - Return the first global alias in the module with the
/// specified name, of arbitrary type. This method returns null if a global
/// with the specified name is not found.
GlobalAlias *getNamedAlias(const StringRef &Name) const;
GlobalAlias *getNamedAlias(StringRef Name) const;
/// @}
/// @name Named Metadata Accessors
@ -307,12 +307,12 @@ public:
/// getNamedMetadata - Return the first NamedMDNode in the module with the
/// specified name. This method returns null if a NamedMDNode with the
/// specified name is not found.
NamedMDNode *getNamedMetadata(const StringRef &Name) const;
NamedMDNode *getNamedMetadata(StringRef Name) const;
/// getOrInsertNamedMetadata - Return the first named MDNode in the module
/// with the specified name. This method returns a new NamedMDNode if a
/// NamedMDNode with the specified name is not found.
NamedMDNode *getOrInsertNamedMetadata(const StringRef &Name);
NamedMDNode *getOrInsertNamedMetadata(StringRef Name);
/// @}
/// @name Type Accessors
@ -321,7 +321,7 @@ public:
/// addTypeName - Insert an entry in the symbol table mapping Str to Type. If
/// there is already an entry for this name, true is returned and the symbol
/// table is not modified.
bool addTypeName(const StringRef &Name, const Type *Ty);
bool addTypeName(StringRef Name, const Type *Ty);
/// getTypeName - If there is at least one entry in the symbol table for the
/// specified type, return it.
@ -329,7 +329,7 @@ public:
/// getTypeByName - Return the type with the specified name in this module, or
/// null if there is none by that name.
const Type *getTypeByName(const StringRef &Name) const;
const Type *getTypeByName(StringRef Name) const;
/// @}
/// @name Direct access to the globals list, functions list, and symbol table
@ -415,9 +415,9 @@ public:
/// @brief Returns the number of items in the list of libraries.
inline size_t lib_size() const { return LibraryList.size(); }
/// @brief Add a library to the list of dependent libraries
void addLibrary(const StringRef &Lib);
void addLibrary(StringRef Lib);
/// @brief Remove a library from the list of dependent libraries
void removeLibrary(const StringRef &Lib);
void removeLibrary(StringRef Lib);
/// @brief Get all the libraries
inline const LibraryListType& getLibraries() const { return LibraryList; }

View File

@ -167,7 +167,7 @@ public:
// lookupPassInfo - Return the pass info object for the pass with the given
// argument string, or null if it is not known.
static const PassInfo *lookupPassInfo(const StringRef &Arg);
static const PassInfo *lookupPassInfo(StringRef Arg);
/// getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to
/// get analysis information that might be around, for example to update it.

View File

@ -22,6 +22,7 @@
#include <vector>
#include "llvm/Pass.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
namespace llvm {
@ -95,7 +96,7 @@ public:
// This can be useful when a pass is trivially preserved, but may not be
// linked in. Be careful about spelling!
//
AnalysisUsage &addPreserved(const StringRef &Arg) {
AnalysisUsage &addPreserved(StringRef Arg) {
const PassInfo *PI = Pass::lookupPassInfo(Arg);
// If the pass exists, preserve it. Otherwise silently do nothing.
if (PI) Preserved.push_back(PI);

View File

@ -284,11 +284,11 @@ public:
void removeNotPreservedAnalysis(Pass *P);
/// Remove dead passes used by P.
void removeDeadPasses(Pass *P, const StringRef &Msg,
void removeDeadPasses(Pass *P, StringRef Msg,
enum PassDebuggingString);
/// Remove P.
void freePass(Pass *P, const StringRef &Msg,
void freePass(Pass *P, StringRef Msg,
enum PassDebuggingString);
/// Add pass P into the PassVector. Update
@ -344,7 +344,7 @@ public:
void dumpLastUses(Pass *P, unsigned Offset) const;
void dumpPassArguments() const;
void dumpPassInfo(Pass *P, enum PassDebuggingString S1,
enum PassDebuggingString S2, const StringRef &Msg);
enum PassDebuggingString S2, StringRef Msg);
void dumpRequiredSet(const Pass *P) const;
void dumpPreservedSet(const Pass *P) const;
@ -388,8 +388,8 @@ protected:
bool isPassDebuggingExecutionsOrMore() const;
private:
void dumpAnalysisUsage(const StringRef &Msg, const Pass *P,
const AnalysisUsage::VectorType &Set) const;
void dumpAnalysisUsage(StringRef Msg, const Pass *P,
const AnalysisUsage::VectorType &Set) const;
// Set of available Analysis. This information is used while scheduling
// pass. If a pass requires an analysis which is not not available then

View File

@ -169,7 +169,7 @@ public:
return *this;
}
raw_ostream &operator<<(const StringRef &Str) {
raw_ostream &operator<<(StringRef Str) {
// Inline fast path, particularly for strings with a known length.
size_t Size = Str.size();

View File

@ -15,6 +15,7 @@
#ifndef LLVM_TARGET_TARGETLOWERINGOBJECTFILE_H
#define LLVM_TARGET_TARGETLOWERINGOBJECTFILE_H
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/SectionKind.h"
namespace llvm {
@ -26,7 +27,6 @@ namespace llvm {
class MCSectionMachO;
class MCContext;
class GlobalValue;
class StringRef;
class TargetMachine;
class TargetLoweringObjectFile {
@ -288,14 +288,14 @@ public:
/// getMachOSection - Return the MCSection for the specified mach-o section.
/// This requires the operands to be valid.
const MCSectionMachO *getMachOSection(const StringRef &Segment,
const StringRef &Section,
const MCSectionMachO *getMachOSection(StringRef Segment,
StringRef Section,
unsigned TypeAndAttributes,
SectionKind K) const {
return getMachOSection(Segment, Section, TypeAndAttributes, 0, K);
}
const MCSectionMachO *getMachOSection(const StringRef &Segment,
const StringRef &Section,
const MCSectionMachO *getMachOSection(StringRef Segment,
StringRef Section,
unsigned TypeAndAttributes,
unsigned Reserved2,
SectionKind K) const;

View File

@ -51,7 +51,7 @@ namespace llvm {
typedef unsigned (*TripleMatchQualityFnTy)(const std::string &TT);
typedef const MCAsmInfo *(*AsmInfoCtorFnTy)(const Target &T,
const StringRef &TT);
StringRef TT);
typedef TargetMachine *(*TargetMachineCtorTy)(const Target &T,
const std::string &TT,
const std::string &Features);
@ -163,7 +163,7 @@ namespace llvm {
/// feature set; it should always be provided. Generally this should be
/// either the target triple from the module, or the target triple of the
/// host if that does not exist.
const MCAsmInfo *createAsmInfo(const StringRef &Triple) const {
const MCAsmInfo *createAsmInfo(StringRef Triple) const {
if (!AsmInfoCtorFn)
return 0;
return AsmInfoCtorFn(*this, Triple);
@ -461,7 +461,7 @@ namespace llvm {
TargetRegistry::RegisterAsmInfo(T, &Allocator);
}
private:
static const MCAsmInfo *Allocator(const Target &T, const StringRef &TT) {
static const MCAsmInfo *Allocator(const Target &T, StringRef TT) {
return new MCAsmInfoImpl(T, TT);
}

View File

@ -58,26 +58,26 @@ public:
/// incrementing an integer and appending it to the name, if necessary
/// @returns the unique name
/// @brief Get a unique name for a type
std::string getUniqueName(const StringRef &BaseName) const;
std::string getUniqueName(StringRef BaseName) const;
/// This method finds the type with the given \p name in the type map
/// and returns it.
/// @returns null if the name is not found, otherwise the Type
/// associated with the \p name.
/// @brief Lookup a type by name.
Type *lookup(const StringRef &name) const;
Type *lookup(StringRef name) const;
/// Lookup the type associated with name.
/// @returns end() if the name is not found, or an iterator at the entry for
/// Type.
iterator find(const StringRef &Name) {
iterator find(StringRef Name) {
return tmap.find(Name);
}
/// Lookup the type associated with name.
/// @returns end() if the name is not found, or an iterator at the entry for
/// Type.
const_iterator find(const StringRef &Name) const {
const_iterator find(StringRef Name) const {
return tmap.find(Name);
}
@ -119,7 +119,7 @@ public:
/// a many-to-one mapping between names and types. This method allows a type
/// with an existing entry in the symbol table to get a new name.
/// @brief Insert a type under a new name.
void insert(const StringRef &Name, const Type *Typ);
void insert(StringRef Name, const Type *Typ);
/// Remove a type at the specified position in the symbol table.
/// @returns the removed Type.

View File

@ -69,7 +69,7 @@ public:
/// the symbol table.
/// @returns the value associated with the \p Name
/// @brief Lookup a named Value.
Value *lookup(const StringRef &Name) const { return vmap.lookup(Name); }
Value *lookup(StringRef Name) const { return vmap.lookup(Name); }
/// @returns true iff the symbol table is empty
/// @brief Determine if the symbol table is empty
@ -112,7 +112,7 @@ private:
/// createValueName - This method attempts to create a value name and insert
/// it into the symbol table with the specified name. If it conflicts, it
/// auto-renames the name and returns that instead.
ValueName *createValueName(const StringRef &Name, Value *V);
ValueName *createValueName(StringRef Name, Value *V);
/// This method removes a value from the symbol table. It leaves the
/// ValueName attached to the value, but it is no longer inserted in the

View File

@ -70,7 +70,7 @@ Linker::LinkInItems(const ItemList& Items, ItemList& NativeItems) {
/// LinkInLibrary - links one library into the HeadModule.
///
bool Linker::LinkInLibrary(const StringRef &Lib, bool& is_native) {
bool Linker::LinkInLibrary(StringRef Lib, bool& is_native) {
is_native = false;
// Determine where this library lives.
sys::Path Pathname = FindLib(Lib);

View File

@ -20,8 +20,8 @@
#include "llvm/Config/config.h"
using namespace llvm;
Linker::Linker(const StringRef &progname, const StringRef &modname,
LLVMContext& C, unsigned flags):
Linker::Linker(StringRef progname, StringRef modname,
LLVMContext& C, unsigned flags):
Context(C),
Composite(new Module(modname, C)),
LibPaths(),
@ -29,7 +29,7 @@ Linker::Linker(const StringRef &progname, const StringRef &modname,
Error(),
ProgramName(progname) { }
Linker::Linker(const StringRef &progname, Module* aModule, unsigned flags) :
Linker::Linker(StringRef progname, Module* aModule, unsigned flags) :
Context(aModule->getContext()),
Composite(aModule),
LibPaths(),
@ -42,7 +42,7 @@ Linker::~Linker() {
}
bool
Linker::error(const StringRef &message) {
Linker::error(StringRef message) {
Error = message;
if (!(Flags&QuietErrors))
errs() << ProgramName << ": error: " << message << "\n";
@ -50,7 +50,7 @@ Linker::error(const StringRef &message) {
}
bool
Linker::warning(const StringRef &message) {
Linker::warning(StringRef message) {
Error = message;
if (!(Flags&QuietWarnings))
errs() << ProgramName << ": warning: " << message << "\n";
@ -58,7 +58,7 @@ Linker::warning(const StringRef &message) {
}
void
Linker::verbose(const StringRef &message) {
Linker::verbose(StringRef message) {
if (Flags&Verbose)
errs() << " " << message << "\n";
}
@ -114,7 +114,7 @@ Linker::LoadObject(const sys::Path &FN) {
// IsLibrary - Determine if "Name" is a library in "Directory". Return
// a non-empty sys::Path if its found, an empty one otherwise.
static inline sys::Path IsLibrary(const StringRef &Name,
static inline sys::Path IsLibrary(StringRef Name,
const sys::Path &Directory) {
sys::Path FullPath(Directory);
@ -153,7 +153,7 @@ static inline sys::Path IsLibrary(const StringRef &Name,
/// Path if no matching file can be found.
///
sys::Path
Linker::FindLib(const StringRef &Filename) {
Linker::FindLib(StringRef Filename) {
// Determine if the pathname can be found as it stands.
sys::Path FilePath(Filename);
if (FilePath.canRead() &&

View File

@ -58,7 +58,7 @@ public:
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
unsigned Size = 0, unsigned ByteAlignment = 0);
virtual void EmitBytes(const StringRef &Data);
virtual void EmitBytes(StringRef Data);
virtual void EmitValue(const MCExpr *Value, unsigned Size);
@ -186,7 +186,7 @@ void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
OS << '\n';
}
void MCAsmStreamer::EmitBytes(const StringRef &Data) {
void MCAsmStreamer::EmitBytes(StringRef Data) {
assert(CurSection && "Cannot emit contents before setting section!");
for (unsigned i = 0, e = Data.size(); i != e; ++i)
OS << ".byte " << (unsigned) (unsigned char) Data[i] << '\n';

View File

@ -180,7 +180,7 @@ public:
OS << StringRef(Zeros, N % 16);
}
void WriteString(const StringRef &Str, unsigned ZeroFillSize = 0) {
void WriteString(StringRef Str, unsigned ZeroFillSize = 0) {
OS << Str;
if (ZeroFillSize)
WriteZeros(ZeroFillSize - Str.size());

View File

@ -23,7 +23,7 @@ MCContext::~MCContext() {
// we don't need to free them here.
}
MCSymbol *MCContext::CreateSymbol(const StringRef &Name) {
MCSymbol *MCContext::CreateSymbol(StringRef Name) {
assert(Name[0] != '\0' && "Normal symbols cannot be unnamed!");
// Create and bind the symbol, and ensure that names are unique.
@ -32,7 +32,7 @@ MCSymbol *MCContext::CreateSymbol(const StringRef &Name) {
return Entry = new (*this) MCSymbol(Name, false);
}
MCSymbol *MCContext::GetOrCreateSymbol(const StringRef &Name) {
MCSymbol *MCContext::GetOrCreateSymbol(StringRef Name) {
MCSymbol *&Entry = Symbols[Name];
if (Entry) return Entry;
@ -46,7 +46,7 @@ MCSymbol *MCContext::GetOrCreateSymbol(const Twine &Name) {
}
MCSymbol *MCContext::CreateTemporarySymbol(const StringRef &Name) {
MCSymbol *MCContext::CreateTemporarySymbol(StringRef Name) {
// If unnamed, just create a symbol.
if (Name.empty())
new (*this) MCSymbol("", true);
@ -57,6 +57,6 @@ MCSymbol *MCContext::CreateTemporarySymbol(const StringRef &Name) {
return Entry = new (*this) MCSymbol(Name, true);
}
MCSymbol *MCContext::LookupSymbol(const StringRef &Name) const {
MCSymbol *MCContext::LookupSymbol(StringRef Name) const {
return Symbols.lookup(Name);
}

View File

@ -133,8 +133,7 @@ const MCSymbolRefExpr *MCSymbolRefExpr::Create(const MCSymbol *Sym,
return new (Ctx) MCSymbolRefExpr(Sym);
}
const MCSymbolRefExpr *MCSymbolRefExpr::Create(const StringRef &Name,
MCContext &Ctx) {
const MCSymbolRefExpr *MCSymbolRefExpr::Create(StringRef Name, MCContext &Ctx) {
return Create(Ctx.GetOrCreateSymbol(Name), Ctx);
}

View File

@ -134,7 +134,7 @@ public:
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
unsigned Size = 0, unsigned ByteAlignment = 0);
virtual void EmitBytes(const StringRef &Data);
virtual void EmitBytes(StringRef Data);
virtual void EmitValue(const MCExpr *Value, unsigned Size);
@ -315,7 +315,7 @@ void MCMachOStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
SectData.setAlignment(ByteAlignment);
}
void MCMachOStreamer::EmitBytes(const StringRef &Data) {
void MCMachOStreamer::EmitBytes(StringRef Data) {
MCDataFragment *DF = dyn_cast_or_null<MCDataFragment>(getCurrentFragment());
if (!DF)
DF = new MCDataFragment(CurSectionData);

View File

@ -45,7 +45,7 @@ namespace {
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
unsigned Size = 0, unsigned ByteAlignment = 0) {}
virtual void EmitBytes(const StringRef &Data) {}
virtual void EmitBytes(StringRef Data) {}
virtual void EmitValue(const MCExpr *Value, unsigned Size) {}

View File

@ -25,7 +25,7 @@ MCSection::~MCSection() {
//===----------------------------------------------------------------------===//
MCSectionCOFF *MCSectionCOFF::
Create(const StringRef &Name, bool IsDirective, SectionKind K, MCContext &Ctx) {
Create(StringRef Name, bool IsDirective, SectionKind K, MCContext &Ctx) {
return new (Ctx) MCSectionCOFF(Name, IsDirective, K);
}

View File

@ -15,7 +15,7 @@
using namespace llvm;
MCSectionELF *MCSectionELF::
Create(const StringRef &Section, unsigned Type, unsigned Flags,
Create(StringRef Section, unsigned Type, unsigned Flags,
SectionKind K, bool isExplicit, MCContext &Ctx) {
return new (Ctx) MCSectionELF(Section, Type, Flags, K, isExplicit);
}

View File

@ -66,7 +66,7 @@ ENTRY(0 /*FIXME*/, S_ATTR_LOC_RELOC)
MCSectionMachO *MCSectionMachO::
Create(const StringRef &Segment, const StringRef &Section,
Create(StringRef Segment, StringRef Section,
unsigned TypeAndAttributes, unsigned Reserved2,
SectionKind K, MCContext &Ctx) {
// S_SYMBOL_STUBS must be set for Reserved2 to be non-zero.

View File

@ -35,7 +35,7 @@ static void MangleLetter(raw_ostream &OS, unsigned char C) {
/// NameNeedsEscaping - Return true if the identifier \arg Str needs quotes
/// for this assembler.
static bool NameNeedsEscaping(const StringRef &Str, const MCAsmInfo &MAI) {
static bool NameNeedsEscaping(StringRef Str, const MCAsmInfo &MAI) {
assert(!Str.empty() && "Cannot create an empty MCSymbol");
// If the first character is a number and the target does not allow this, we

View File

@ -52,7 +52,7 @@ void StringMapImpl::init(unsigned InitSize) {
/// specified bucket will be non-null. Otherwise, it will be null. In either
/// case, the FullHashValue field of the bucket will be set to the hash value
/// of the string.
unsigned StringMapImpl::LookupBucketFor(const StringRef &Name) {
unsigned StringMapImpl::LookupBucketFor(StringRef Name) {
unsigned HTSize = NumBuckets;
if (HTSize == 0) { // Hash table unallocated so far?
init(16);
@ -110,7 +110,7 @@ unsigned StringMapImpl::LookupBucketFor(const StringRef &Name) {
/// FindKey - Look up the bucket that contains the specified key. If it exists
/// in the map, return the bucket number of the key. Otherwise return -1.
/// This does not modify the map.
int StringMapImpl::FindKey(const StringRef &Key) const {
int StringMapImpl::FindKey(StringRef Key) const {
unsigned HTSize = NumBuckets;
if (HTSize == 0) return -1; // Really empty table?
unsigned FullHashValue = HashString(Key);
@ -161,7 +161,7 @@ void StringMapImpl::RemoveKey(StringMapEntryBase *V) {
/// RemoveKey - Remove the StringMapEntry for the specified key from the
/// table, returning it. If the key is not in the table, this returns null.
StringMapEntryBase *StringMapImpl::RemoveKey(const StringRef &Key) {
StringMapEntryBase *StringMapImpl::RemoveKey(StringRef Key) {
int Bucket = FindKey(Key);
if (Bucket == -1) return 0;

View File

@ -24,7 +24,7 @@ const size_t StringRef::npos;
///
/// \return - The index of the first occurence of \arg Str, or npos if not
/// found.
size_t StringRef::find(const StringRef &Str) const {
size_t StringRef::find(StringRef Str) const {
size_t N = Str.size();
if (N > Length)
return npos;
@ -38,7 +38,7 @@ size_t StringRef::find(const StringRef &Str) const {
///
/// \return - The index of the last occurence of \arg Str, or npos if not
/// found.
size_t StringRef::rfind(const StringRef &Str) const {
size_t StringRef::rfind(StringRef Str) const {
size_t N = Str.size();
if (N > Length)
return npos;
@ -75,7 +75,7 @@ StringRef::size_type StringRef::find_first_not_of(StringRef Chars) const {
/// count - Return the number of non-overlapped occurrences of \arg Str in
/// the string.
size_t StringRef::count(const StringRef &Str) const {
size_t StringRef::count(StringRef Str) const {
size_t Count = 0;
size_t N = Str.size();
if (N > Length)

View File

@ -102,7 +102,7 @@ const char *Triple::getOSTypeName(OSType Kind) {
return "<invalid>";
}
Triple::ArchType Triple::getArchTypeForLLVMName(const StringRef &Name) {
Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) {
if (Name == "alpha")
return alpha;
if (Name == "arm")
@ -141,7 +141,7 @@ Triple::ArchType Triple::getArchTypeForLLVMName(const StringRef &Name) {
return UnknownArch;
}
Triple::ArchType Triple::getArchTypeForDarwinArchName(const StringRef &Str) {
Triple::ArchType Triple::getArchTypeForDarwinArchName(StringRef Str) {
// See arch(3) and llvm-gcc's driver-driver.c. We don't implement support for
// archs which Darwin doesn't use.
@ -393,7 +393,7 @@ void Triple::setOS(OSType Kind) {
setOSName(getOSTypeName(Kind));
}
void Triple::setArchName(const StringRef &Str) {
void Triple::setArchName(StringRef Str) {
// Work around a miscompilation bug for Twines in gcc 4.0.3.
SmallString<64> Triple;
Triple += Str;
@ -404,11 +404,11 @@ void Triple::setArchName(const StringRef &Str) {
setTriple(Triple.str());
}
void Triple::setVendorName(const StringRef &Str) {
void Triple::setVendorName(StringRef Str) {
setTriple(getArchName() + "-" + Str + "-" + getOSAndEnvironmentName());
}
void Triple::setOSName(const StringRef &Str) {
void Triple::setOSName(StringRef Str) {
if (hasEnvironment())
setTriple(getArchName() + "-" + getVendorName() + "-" + Str +
"-" + getEnvironmentName());
@ -416,11 +416,11 @@ void Triple::setOSName(const StringRef &Str) {
setTriple(getArchName() + "-" + getVendorName() + "-" + Str);
}
void Triple::setEnvironmentName(const StringRef &Str) {
setTriple(getArchName() + "-" + getVendorName() + "-" + getOSName() +
void Triple::setEnvironmentName(StringRef Str) {
setTriple(getArchName() + "-" + getVendorName() + "-" + getOSName() +
"-" + Str);
}
void Triple::setOSAndEnvironmentName(const StringRef &Str) {
void Triple::setOSAndEnvironmentName(StringRef Str) {
setTriple(getArchName() + "-" + getVendorName() + "-" + Str);
}

View File

@ -21,8 +21,7 @@
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
static const MCAsmInfo *createMCAsmInfo(const Target &T,
const StringRef &TT) {
static const MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
Triple TheTriple(TT);
switch (TheTriple.getOS()) {
case Triple::Darwin:

View File

@ -20,8 +20,7 @@
#include "llvm/Support/FormattedStream.h"
using namespace llvm;
static const MCAsmInfo *createMCAsmInfo(const Target &T,
const StringRef &TT) {
static const MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
Triple TheTriple(TT);
bool isPPC64 = TheTriple.getArch() == Triple::ppc64;
if (TheTriple.getOS() == Triple::Darwin)

View File

@ -671,7 +671,7 @@ TargetLoweringObjectFileMachO::~TargetLoweringObjectFileMachO() {
const MCSectionMachO *TargetLoweringObjectFileMachO::
getMachOSection(const StringRef &Segment, const StringRef &Section,
getMachOSection(StringRef Segment, StringRef Section,
unsigned TypeAndAttributes,
unsigned Reserved2, SectionKind Kind) const {
// We unique sections by their segment/section pair. The returned section

View File

@ -22,8 +22,7 @@
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
static const MCAsmInfo *createMCAsmInfo(const Target &T,
const StringRef &TT) {
static const MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
Triple TheTriple(TT);
switch (TheTriple.getOS()) {
case Triple::Darwin:

View File

@ -318,7 +318,7 @@ Constant* ConstantInt::get(const Type* Ty, const APInt& V) {
return C;
}
ConstantInt* ConstantInt::get(const IntegerType* Ty, const StringRef& Str,
ConstantInt* ConstantInt::get(const IntegerType* Ty, StringRef Str,
uint8_t radix) {
return get(Ty->getContext(), APInt(Ty->getBitWidth(), Str, radix));
}
@ -362,7 +362,7 @@ Constant* ConstantFP::get(const Type* Ty, double V) {
}
Constant* ConstantFP::get(const Type* Ty, const StringRef& Str) {
Constant* ConstantFP::get(const Type* Ty, StringRef Str) {
LLVMContext &Context = Ty->getContext();
APFloat FV(*TypeToFloatSemantics(Ty->getScalarType()), Str);
@ -508,7 +508,7 @@ Constant* ConstantArray::get(const ArrayType* T, Constant* const* Vals,
/// Otherwise, the length parameter specifies how much of the string to use
/// and it won't be null terminated.
///
Constant* ConstantArray::get(LLVMContext &Context, const StringRef &Str,
Constant* ConstantArray::get(LLVMContext &Context, StringRef Str,
bool AddNull) {
std::vector<Constant*> ElementVals;
for (unsigned i = 0; i < Str.size(); ++i)

View File

@ -26,16 +26,16 @@ InlineAsm::~InlineAsm() {
// NOTE: when memoizing the function type, we have to be careful to handle the
// case when the type gets refined.
InlineAsm *InlineAsm::get(const FunctionType *Ty, const StringRef &AsmString,
const StringRef &Constraints, bool hasSideEffects,
InlineAsm *InlineAsm::get(const FunctionType *Ty, StringRef AsmString,
StringRef Constraints, bool hasSideEffects,
bool isAlignStack) {
// FIXME: memoize!
return new InlineAsm(Ty, AsmString, Constraints, hasSideEffects,
isAlignStack);
}
InlineAsm::InlineAsm(const FunctionType *Ty, const StringRef &asmString,
const StringRef &constraints, bool hasSideEffects,
InlineAsm::InlineAsm(const FunctionType *Ty, StringRef asmString,
StringRef constraints, bool hasSideEffects,
bool isAlignStack)
: Value(PointerType::getUnqual(Ty),
Value::InlineAsmVal),
@ -54,7 +54,7 @@ const FunctionType *InlineAsm::getFunctionType() const {
/// Parse - Analyze the specified string (e.g. "==&{eax}") and fill in the
/// fields in this structure. If the constraint string is not understood,
/// return true, otherwise return false.
bool InlineAsm::ConstraintInfo::Parse(const StringRef &Str,
bool InlineAsm::ConstraintInfo::Parse(StringRef Str,
std::vector<InlineAsm::ConstraintInfo> &ConstraintsSoFar) {
StringRef::iterator I = Str.begin(), E = Str.end();
@ -149,7 +149,7 @@ bool InlineAsm::ConstraintInfo::Parse(const StringRef &Str,
}
std::vector<InlineAsm::ConstraintInfo>
InlineAsm::ParseConstraints(const StringRef &Constraints) {
InlineAsm::ParseConstraints(StringRef Constraints) {
std::vector<ConstraintInfo> Result;
// Scan the constraints string.
@ -183,7 +183,7 @@ InlineAsm::ParseConstraints(const StringRef &Constraints) {
/// Verify - Verify that the specified constraint string is reasonable for the
/// specified function type, and otherwise validate the constraint string.
bool InlineAsm::Verify(const FunctionType *Ty, const StringRef &ConstStr) {
bool InlineAsm::Verify(const FunctionType *Ty, StringRef ConstStr) {
if (Ty->isVarArg()) return false;
std::vector<ConstraintInfo> Constraints = ParseConstraints(ConstStr);

View File

@ -55,7 +55,7 @@ template class SymbolTableListTraits<GlobalAlias, Module>;
// Primitive Module methods.
//
Module::Module(const StringRef &MID, LLVMContext& C)
Module::Module(StringRef MID, LLVMContext& C)
: Context(C), ModuleID(MID), DataLayout("") {
ValSymTab = new ValueSymbolTable();
TypeSymTab = new TypeSymbolTable();
@ -114,7 +114,7 @@ Module::PointerSize Module::getPointerSize() const {
/// getNamedValue - Return the first global value in the module with
/// the specified name, of arbitrary type. This method returns null
/// if a global with the specified name is not found.
GlobalValue *Module::getNamedValue(const StringRef &Name) const {
GlobalValue *Module::getNamedValue(StringRef Name) const {
return cast_or_null<GlobalValue>(getValueSymbolTable().lookup(Name));
}
@ -127,7 +127,7 @@ GlobalValue *Module::getNamedValue(const StringRef &Name) const {
// it. This is nice because it allows most passes to get away with not handling
// the symbol table directly for this common task.
//
Constant *Module::getOrInsertFunction(const StringRef &Name,
Constant *Module::getOrInsertFunction(StringRef Name,
const FunctionType *Ty,
AttrListPtr AttributeList) {
// See if we have a definition for the specified function already.
@ -160,7 +160,7 @@ Constant *Module::getOrInsertFunction(const StringRef &Name,
return F;
}
Constant *Module::getOrInsertTargetIntrinsic(const StringRef &Name,
Constant *Module::getOrInsertTargetIntrinsic(StringRef Name,
const FunctionType *Ty,
AttrListPtr AttributeList) {
// See if we have a definition for the specified function already.
@ -177,7 +177,7 @@ Constant *Module::getOrInsertTargetIntrinsic(const StringRef &Name,
return F;
}
Constant *Module::getOrInsertFunction(const StringRef &Name,
Constant *Module::getOrInsertFunction(StringRef Name,
const FunctionType *Ty) {
AttrListPtr AttributeList = AttrListPtr::get((AttributeWithIndex *)0, 0);
return getOrInsertFunction(Name, Ty, AttributeList);
@ -188,7 +188,7 @@ Constant *Module::getOrInsertFunction(const StringRef &Name,
// This version of the method takes a null terminated list of function
// arguments, which makes it easier for clients to use.
//
Constant *Module::getOrInsertFunction(const StringRef &Name,
Constant *Module::getOrInsertFunction(StringRef Name,
AttrListPtr AttributeList,
const Type *RetTy, ...) {
va_list Args;
@ -207,7 +207,7 @@ Constant *Module::getOrInsertFunction(const StringRef &Name,
AttributeList);
}
Constant *Module::getOrInsertFunction(const StringRef &Name,
Constant *Module::getOrInsertFunction(StringRef Name,
const Type *RetTy, ...) {
va_list Args;
va_start(Args, RetTy);
@ -228,7 +228,7 @@ Constant *Module::getOrInsertFunction(const StringRef &Name,
// getFunction - Look up the specified function in the module symbol table.
// If it does not exist, return null.
//
Function *Module::getFunction(const StringRef &Name) const {
Function *Module::getFunction(StringRef Name) const {
return dyn_cast_or_null<Function>(getNamedValue(Name));
}
@ -243,7 +243,7 @@ Function *Module::getFunction(const StringRef &Name) const {
/// If AllowLocal is set to true, this function will return types that
/// have an local. By default, these types are not returned.
///
GlobalVariable *Module::getGlobalVariable(const StringRef &Name,
GlobalVariable *Module::getGlobalVariable(StringRef Name,
bool AllowLocal) const {
if (GlobalVariable *Result =
dyn_cast_or_null<GlobalVariable>(getNamedValue(Name)))
@ -258,7 +258,7 @@ GlobalVariable *Module::getGlobalVariable(const StringRef &Name,
/// with a constantexpr cast to the right type.
/// 3. Finally, if the existing global is the correct delclaration, return the
/// existing global.
Constant *Module::getOrInsertGlobal(const StringRef &Name, const Type *Ty) {
Constant *Module::getOrInsertGlobal(StringRef Name, const Type *Ty) {
// See if we have a definition for the specified global already.
GlobalVariable *GV = dyn_cast_or_null<GlobalVariable>(getNamedValue(Name));
if (GV == 0) {
@ -285,21 +285,21 @@ Constant *Module::getOrInsertGlobal(const StringRef &Name, const Type *Ty) {
// getNamedAlias - Look up the specified global in the module symbol table.
// If it does not exist, return null.
//
GlobalAlias *Module::getNamedAlias(const StringRef &Name) const {
GlobalAlias *Module::getNamedAlias(StringRef Name) const {
return dyn_cast_or_null<GlobalAlias>(getNamedValue(Name));
}
/// getNamedMetadata - Return the first NamedMDNode in the module with the
/// specified name. This method returns null if a NamedMDNode with the
//// specified name is not found.
NamedMDNode *Module::getNamedMetadata(const StringRef &Name) const {
NamedMDNode *Module::getNamedMetadata(StringRef Name) const {
return dyn_cast_or_null<NamedMDNode>(getValueSymbolTable().lookup(Name));
}
/// getOrInsertNamedMetadata - Return the first named MDNode in the module
/// with the specified name. This method returns a new NamedMDNode if a
/// NamedMDNode with the specified name is not found.
NamedMDNode *Module::getOrInsertNamedMetadata(const StringRef &Name) {
NamedMDNode *Module::getOrInsertNamedMetadata(StringRef Name) {
NamedMDNode *NMD =
dyn_cast_or_null<NamedMDNode>(getValueSymbolTable().lookup(Name));
if (!NMD)
@ -316,7 +316,7 @@ NamedMDNode *Module::getOrInsertNamedMetadata(const StringRef &Name) {
// there is already an entry for this name, true is returned and the symbol
// table is not modified.
//
bool Module::addTypeName(const StringRef &Name, const Type *Ty) {
bool Module::addTypeName(StringRef Name, const Type *Ty) {
TypeSymbolTable &ST = getTypeSymbolTable();
if (ST.lookup(Name)) return true; // Already in symtab...
@ -330,7 +330,7 @@ bool Module::addTypeName(const StringRef &Name, const Type *Ty) {
/// getTypeByName - Return the type with the specified name in this module, or
/// null if there is none by that name.
const Type *Module::getTypeByName(const StringRef &Name) const {
const Type *Module::getTypeByName(StringRef Name) const {
const TypeSymbolTable &ST = getTypeSymbolTable();
return cast_or_null<Type>(ST.lookup(Name));
}
@ -376,14 +376,14 @@ void Module::dropAllReferences() {
I->dropAllReferences();
}
void Module::addLibrary(const StringRef& Lib) {
void Module::addLibrary(StringRef Lib) {
for (Module::lib_iterator I = lib_begin(), E = lib_end(); I != E; ++I)
if (*I == Lib)
return;
LibraryList.push_back(Lib);
}
void Module::removeLibrary(const StringRef& Lib) {
void Module::removeLibrary(StringRef Lib) {
LibraryListType::iterator I = LibraryList.begin();
LibraryListType::iterator E = LibraryList.end();
for (;I != E; ++I)

View File

@ -149,7 +149,7 @@ public:
return I != PassInfoMap.end() ? I->second : 0;
}
const PassInfo *GetPassInfo(const StringRef &Arg) const {
const PassInfo *GetPassInfo(StringRef Arg) const {
StringMapType::const_iterator I = PassInfoStringMap.find(Arg);
return I != PassInfoStringMap.end() ? I->second : 0;
}
@ -238,7 +238,7 @@ const PassInfo *Pass::lookupPassInfo(intptr_t TI) {
return getPassRegistrar()->GetPassInfo(TI);
}
const PassInfo *Pass::lookupPassInfo(const StringRef &Arg) {
const PassInfo *Pass::lookupPassInfo(StringRef Arg) {
return getPassRegistrar()->GetPassInfo(Arg);
}

View File

@ -746,7 +746,7 @@ void PMDataManager::removeNotPreservedAnalysis(Pass *P) {
}
/// Remove analysis passes that are not used any longer
void PMDataManager::removeDeadPasses(Pass *P, const StringRef &Msg,
void PMDataManager::removeDeadPasses(Pass *P, StringRef Msg,
enum PassDebuggingString DBG_STR) {
SmallVector<Pass *, 12> DeadPasses;
@ -768,7 +768,7 @@ void PMDataManager::removeDeadPasses(Pass *P, const StringRef &Msg,
freePass(*I, Msg, DBG_STR);
}
void PMDataManager::freePass(Pass *P, const StringRef &Msg,
void PMDataManager::freePass(Pass *P, StringRef Msg,
enum PassDebuggingString DBG_STR) {
dumpPassInfo(P, FREEING_MSG, DBG_STR, Msg);
@ -972,7 +972,7 @@ void PMDataManager::dumpPassArguments() const {
void PMDataManager::dumpPassInfo(Pass *P, enum PassDebuggingString S1,
enum PassDebuggingString S2,
const StringRef &Msg) {
StringRef Msg) {
if (PassDebugging < Executions)
return;
errs() << (void*)this << std::string(getDepth()*2+1, ' ');
@ -1028,7 +1028,7 @@ void PMDataManager::dumpPreservedSet(const Pass *P) const {
dumpAnalysisUsage("Preserved", P, analysisUsage.getPreservedSet());
}
void PMDataManager::dumpAnalysisUsage(const StringRef &Msg, const Pass *P,
void PMDataManager::dumpAnalysisUsage(StringRef Msg, const Pass *P,
const AnalysisUsage::VectorType &Set) const {
assert(PassDebugging >= Details);
if (Set.empty())

View File

@ -31,7 +31,7 @@ TypeSymbolTable::~TypeSymbolTable() {
}
}
std::string TypeSymbolTable::getUniqueName(const StringRef &BaseName) const {
std::string TypeSymbolTable::getUniqueName(StringRef BaseName) const {
std::string TryName = BaseName;
const_iterator End = tmap.end();
@ -43,7 +43,7 @@ std::string TypeSymbolTable::getUniqueName(const StringRef &BaseName) const {
}
// lookup a type by name - returns null on failure
Type* TypeSymbolTable::lookup(const StringRef &Name) const {
Type* TypeSymbolTable::lookup(StringRef Name) const {
const_iterator TI = tmap.find(Name);
Type* result = 0;
if (TI != tmap.end())
@ -51,7 +51,6 @@ Type* TypeSymbolTable::lookup(const StringRef &Name) const {
return result;
}
// remove - Remove a type from the symbol table...
Type* TypeSymbolTable::remove(iterator Entry) {
assert(Entry != tmap.end() && "Invalid entry to remove!");
@ -80,7 +79,7 @@ Type* TypeSymbolTable::remove(iterator Entry) {
// insert - Insert a type into the symbol table with the specified name...
void TypeSymbolTable::insert(const StringRef &Name, const Type* T) {
void TypeSymbolTable::insert(StringRef Name, const Type* T) {
assert(T && "Can't insert null type into symbol table!");
if (tmap.insert(std::make_pair(Name, T)).second) {

View File

@ -77,7 +77,7 @@ void ValueSymbolTable::removeValueName(ValueName *V) {
/// createValueName - This method attempts to create a value name and insert
/// it into the symbol table with the specified name. If it conflicts, it
/// auto-renames the name and returns that instead.
ValueName *ValueSymbolTable::createValueName(const StringRef &Name, Value *V) {
ValueName *ValueSymbolTable::createValueName(StringRef Name, Value *V) {
// In the common case, the name is not already in the symbol table.
ValueName &Entry = vmap.GetOrCreateValue(Name);
if (Entry.getValue() == 0) {