diff options
51 files changed, 196 insertions, 200 deletions
diff --git a/include/llvm/ADT/StringMap.h b/include/llvm/ADT/StringMap.h index 73fd635ee2..86e8546adc 100644 --- a/include/llvm/ADT/StringMap.h +++ b/include/llvm/ADT/StringMap.h @@ -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); diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h index 2fa5c66aae..4e81b84252 100644 --- a/include/llvm/ADT/StringRef.h +++ b/include/llvm/ADT/StringRef.h @@ -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; } diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h index 7fb0014dc8..1b2a323b4e 100644 --- a/include/llvm/ADT/Triple.h +++ b/include/llvm/ADT/Triple.h @@ -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); /// @} }; diff --git a/include/llvm/Bitcode/BitstreamWriter.h b/include/llvm/Bitcode/BitstreamWriter.h index e48a190833..2b1b85ea41 100644 --- a/include/llvm/Bitcode/BitstreamWriter.h +++ b/include/llvm/Bitcode/BitstreamWriter.h @@ -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> diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 99928d9b85..caa13f6ac6 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -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. diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h index 7b0de34d9c..b8d219c726 100644 --- a/include/llvm/GlobalValue.h +++ b/include/llvm/GlobalValue.h @@ -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 diff --git a/include/llvm/InlineAsm.h b/include/llvm/InlineAsm.h index d54870e49f..482e53e3fe 100644 --- a/include/llvm/InlineAsm.h +++ b/include/llvm/InlineAsm.h @@ -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. diff --git a/include/llvm/Linker.h b/include/llvm/Linker.h index 1e1da86711..a68a2e0fd3 100644 --- a/include/llvm/Linker.h +++ b/include/llvm/Linker.h @@ -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 diff --git a/include/llvm/MC/MCAsmLexer.h b/include/llvm/MC/MCAsmLexer.h index e369e30a9a..da471d284c 100644 --- a/include/llvm/MC/MCAsmLexer.h +++ b/include/llvm/MC/MCAsmLexer.h @@ -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; } diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h index fa20f45064..95c6bd4bb4 100644 --- a/include/llvm/MC/MCContext.h +++ b/include/llvm/MC/MCContext.h @@ -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; /// @} diff --git a/include/llvm/MC/MCExpr.h b/include/llvm/MC/MCExpr.h index 4318628e5f..13d40eca7c 100644 --- a/include/llvm/MC/MCExpr.h +++ b/include/llvm/MC/MCExpr.h @@ -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 diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h index 9e071864e6..ceb6d278c9 100644 --- a/include/llvm/MC/MCSection.h +++ b/include/llvm/MC/MCSection.h @@ -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; } diff --git a/include/llvm/MC/MCSectionELF.h b/include/llvm/MC/MCSectionELF.h index 57fa903f71..4ec745fff8 100644 --- a/include/llvm/MC/MCSectionELF.h +++ b/include/llvm/MC/MCSectionELF.h @@ -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); diff --git a/include/llvm/MC/MCSectionMachO.h b/include/llvm/MC/MCSectionMachO.h index 251c88fa94..61568194d7 100644 --- a/include/llvm/MC/MCSectionMachO.h +++ b/include/llvm/MC/MCSectionMachO.h @@ -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); diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h index 4d72f324b9..5febed71b0 100644 --- a/include/llvm/MC/MCStreamer.h +++ b/include/llvm/MC/MCStreamer.h @@ -155,7 +155,7 @@ namespace llvm { /// |