<div dir="ltr">No technical problem, but the coding standards do say this "<tt class="" style="font-family:Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono',monospace;font-size:0.95em;color:rgb(0,0,0);line-height:21px"><span class="">StringRef</span></tt><span style="color:rgb(0,0,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px"> is small and pervasive enough in LLVM that it should always be passed by value."</span></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 30, 2014 at 10:06 AM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Sat, Aug 30, 2014 at 12:48 PM, Craig Topper <<a href="mailto:craig.topper@gmail.com">craig.topper@gmail.com</a>> wrote:<br>

> Author: ctopper<br>
> Date: Sat Aug 30 11:48:02 2014<br>
> New Revision: 216820<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=216820&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=216820&view=rev</a><br>
> Log:<br>
> Fix some cases where StringRef was being passed by const reference. Remove const from some other StringRefs since its implicitly const already.<br>
<br>
</div>Just curious, but is there a technical problem with StringRef being<br>
passed by const reference?<br>
<span class="HOEnZb"><font color="#888888"><br>
~Aaron<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> Modified:<br>
>     llvm/trunk/include/llvm/MC/MCDwarf.h<br>
>     llvm/trunk/include/llvm/MC/SubtargetFeature.h<br>
>     llvm/trunk/include/llvm/Support/Path.h<br>
>     llvm/trunk/include/llvm/Support/SpecialCaseList.h<br>
>     llvm/trunk/include/llvm/Target/TargetMachine.h<br>
>     llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h<br>
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h<br>
>     llvm/trunk/lib/MC/SubtargetFeature.cpp<br>
>     llvm/trunk/lib/Support/Path.cpp<br>
>     llvm/trunk/lib/Support/SpecialCaseList.cpp<br>
>     llvm/trunk/lib/Support/YAMLParser.cpp<br>
>     llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp<br>
>     llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp<br>
>     llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp<br>
>     llvm/trunk/lib/Target/Mips/MipsISelLowering.h<br>
>     llvm/trunk/lib/Target/Mips/MipsMachineFunction.cpp<br>
>     llvm/trunk/lib/Target/Mips/MipsMachineFunction.h<br>
>     llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp<br>
>     llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.h<br>
>     llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp<br>
>     llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp<br>
><br>
> Modified: llvm/trunk/include/llvm/MC/MCDwarf.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCDwarf.h?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCDwarf.h?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/include/llvm/MC/MCDwarf.h (original)<br>
> +++ llvm/trunk/include/llvm/MC/MCDwarf.h Sat Aug 30 11:48:02 2014<br>
> @@ -457,7 +457,7 @@ public:<br>
>      return Offset;<br>
>    }<br>
><br>
> -  const StringRef getValues() const {<br>
> +  StringRef getValues() const {<br>
>      assert(Operation == OpEscape);<br>
>      return StringRef(&Values[0], Values.size());<br>
>    }<br>
><br>
> Modified: llvm/trunk/include/llvm/MC/SubtargetFeature.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/SubtargetFeature.h?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/SubtargetFeature.h?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/include/llvm/MC/SubtargetFeature.h (original)<br>
> +++ llvm/trunk/include/llvm/MC/SubtargetFeature.h Sat Aug 30 11:48:02 2014<br>
> @@ -72,21 +72,21 @@ struct SubtargetInfoKV {<br>
>  class SubtargetFeatures {<br>
>    std::vector<std::string> Features;    // Subtarget features as a vector<br>
>  public:<br>
> -  explicit SubtargetFeatures(const StringRef Initial = "");<br>
> +  explicit SubtargetFeatures(StringRef Initial = "");<br>
><br>
>    /// Features string accessors.<br>
>    std::string getString() const;<br>
><br>
>    /// Adding Features.<br>
> -  void AddFeature(const StringRef String);<br>
> +  void AddFeature(StringRef String);<br>
><br>
>    /// ToggleFeature - Toggle a feature and returns the newly updated feature<br>
>    /// bits.<br>
> -  uint64_t ToggleFeature(uint64_t Bits, const StringRef String,<br>
> +  uint64_t ToggleFeature(uint64_t Bits, StringRef String,<br>
>                           ArrayRef<SubtargetFeatureKV> FeatureTable);<br>
><br>
>    /// Get feature bits of a CPU.<br>
> -  uint64_t getFeatureBits(const StringRef CPU,<br>
> +  uint64_t getFeatureBits(StringRef CPU,<br>
>                            ArrayRef<SubtargetFeatureKV> CPUTable,<br>
>                            ArrayRef<SubtargetFeatureKV> FeatureTable);<br>
><br>
><br>
> Modified: llvm/trunk/include/llvm/Support/Path.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Path.h?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Path.h?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/include/llvm/Support/Path.h (original)<br>
> +++ llvm/trunk/include/llvm/Support/Path.h Sat Aug 30 11:48:02 2014<br>
> @@ -204,7 +204,7 @@ void native(SmallVectorImpl<char> &path)<br>
>  ///<br>
>  /// @param path Input path.<br>
>  /// @result The root name of \a path if it has one, otherwise "".<br>
> -const StringRef root_name(StringRef path);<br>
> +StringRef root_name(StringRef path);<br>
><br>
>  /// @brief Get root directory.<br>
>  ///<br>
> @@ -217,7 +217,7 @@ const StringRef root_name(StringRef path<br>
>  /// @param path Input path.<br>
>  /// @result The root directory of \a path if it has one, otherwise<br>
>  ///               "".<br>
> -const StringRef root_directory(StringRef path);<br>
> +StringRef root_directory(StringRef path);<br>
><br>
>  /// @brief Get root path.<br>
>  ///<br>
> @@ -225,7 +225,7 @@ const StringRef root_directory(StringRef<br>
>  ///<br>
>  /// @param path Input path.<br>
>  /// @result The root path of \a path if it has one, otherwise "".<br>
> -const StringRef root_path(StringRef path);<br>
> +StringRef root_path(StringRef path);<br>
><br>
>  /// @brief Get relative path.<br>
>  ///<br>
> @@ -237,7 +237,7 @@ const StringRef root_path(StringRef path<br>
>  ///<br>
>  /// @param path Input path.<br>
>  /// @result The path starting after root_path if one exists, otherwise "".<br>
> -const StringRef relative_path(StringRef path);<br>
> +StringRef relative_path(StringRef path);<br>
><br>
>  /// @brief Get parent path.<br>
>  ///<br>
> @@ -249,7 +249,7 @@ const StringRef relative_path(StringRef<br>
>  ///<br>
>  /// @param path Input path.<br>
>  /// @result The parent path of \a path if one exists, otherwise "".<br>
> -const StringRef parent_path(StringRef path);<br>
> +StringRef parent_path(StringRef path);<br>
><br>
>  /// @brief Get filename.<br>
>  ///<br>
> @@ -263,7 +263,7 @@ const StringRef parent_path(StringRef pa<br>
>  /// @param path Input path.<br>
>  /// @result The filename part of \a path. This is defined as the last component<br>
>  ///         of \a path.<br>
> -const StringRef filename(StringRef path);<br>
> +StringRef filename(StringRef path);<br>
><br>
>  /// @brief Get stem.<br>
>  ///<br>
> @@ -281,7 +281,7 @@ const StringRef filename(StringRef path)<br>
>  ///<br>
>  /// @param path Input path.<br>
>  /// @result The stem of \a path.<br>
> -const StringRef stem(StringRef path);<br>
> +StringRef stem(StringRef path);<br>
><br>
>  /// @brief Get extension.<br>
>  ///<br>
> @@ -297,7 +297,7 @@ const StringRef stem(StringRef path);<br>
>  ///<br>
>  /// @param path Input path.<br>
>  /// @result The extension of \a path.<br>
> -const StringRef extension(StringRef path);<br>
> +StringRef extension(StringRef path);<br>
><br>
>  /// @brief Check whether the given char is a path separator on the host OS.<br>
>  ///<br>
> @@ -308,7 +308,7 @@ bool is_separator(char value);<br>
>  /// @brief Return the preferred separator for this platform.<br>
>  ///<br>
>  /// @result StringRef of the preferred separator, null-terminated.<br>
> -const StringRef get_separator();<br>
> +StringRef get_separator();<br>
><br>
>  /// @brief Get the typical temporary directory for the system, e.g.,<br>
>  /// "/var/tmp" or "C:/TEMP"<br>
><br>
> Modified: llvm/trunk/include/llvm/Support/SpecialCaseList.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SpecialCaseList.h?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SpecialCaseList.h?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/include/llvm/Support/SpecialCaseList.h (original)<br>
> +++ llvm/trunk/include/llvm/Support/SpecialCaseList.h Sat Aug 30 11:48:02 2014<br>
> @@ -60,13 +60,13 @@ class SpecialCaseList {<br>
>    /// Parses the special case list from a file. If Path is empty, returns<br>
>    /// an empty special case list. On failure, returns 0 and writes an error<br>
>    /// message to string.<br>
> -  static SpecialCaseList *create(const StringRef Path, std::string &Error);<br>
> +  static SpecialCaseList *create(StringRef Path, std::string &Error);<br>
>    /// Parses the special case list from a memory buffer. On failure, returns<br>
>    /// 0 and writes an error message to string.<br>
>    static SpecialCaseList *create(const MemoryBuffer *MB, std::string &Error);<br>
>    /// Parses the special case list from a file. On failure, reports a fatal<br>
>    /// error.<br>
> -  static SpecialCaseList *createOrDie(const StringRef Path);<br>
> +  static SpecialCaseList *createOrDie(StringRef Path);<br>
><br>
>    ~SpecialCaseList();<br>
><br>
> @@ -75,8 +75,8 @@ class SpecialCaseList {<br>
>    ///   @Section:<E>=@Category<br>
>    /// \endcode<br>
>    /// and @Query satisfies a wildcard expression <E>.<br>
> -  bool inSection(const StringRef Section, const StringRef Query,<br>
> -                 const StringRef Category = StringRef()) const;<br>
> +  bool inSection(StringRef Section, StringRef Query,<br>
> +                 StringRef Category = StringRef()) const;<br>
><br>
>   private:<br>
>    SpecialCaseList(SpecialCaseList const &) LLVM_DELETED_FUNCTION;<br>
><br>
> Modified: llvm/trunk/include/llvm/Target/TargetMachine.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/include/llvm/Target/TargetMachine.h (original)<br>
> +++ llvm/trunk/include/llvm/Target/TargetMachine.h Sat Aug 30 11:48:02 2014<br>
> @@ -92,9 +92,9 @@ public:<br>
><br>
>    const Target &getTarget() const { return TheTarget; }<br>
><br>
> -  const StringRef getTargetTriple() const { return TargetTriple; }<br>
> -  const StringRef getTargetCPU() const { return TargetCPU; }<br>
> -  const StringRef getTargetFeatureString() const { return TargetFS; }<br>
> +  StringRef getTargetTriple() const { return TargetTriple; }<br>
> +  StringRef getTargetCPU() const { return TargetCPU; }<br>
> +  StringRef getTargetFeatureString() const { return TargetFS; }<br>
><br>
>    /// getSubtargetImpl - virtual method implemented by subclasses that returns<br>
>    /// a reference to that target's TargetSubtargetInfo-derived member variable.<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h (original)<br>
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h Sat Aug 30 11:48:02 2014<br>
> @@ -381,10 +381,10 @@ public:<br>
>  ///<br>
>  class DIEString : public DIEValue {<br>
>    const DIEValue *Access;<br>
> -  const StringRef Str;<br>
> +  StringRef Str;<br>
><br>
>  public:<br>
> -  DIEString(const DIEValue *Acc, const StringRef S)<br>
> +  DIEString(const DIEValue *Acc, StringRef S)<br>
>        : DIEValue(isString), Access(Acc), Str(S) {}<br>
><br>
>    /// getString - Grab the string out of the object.<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)<br>
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Sat Aug 30 11:48:02 2014<br>
> @@ -275,11 +275,11 @@ public:<br>
>    void addSInt(DIELoc &Die, Optional<dwarf::Form> Form, int64_t Integer);<br>
><br>
>    /// addString - Add a string attribute data and value.<br>
> -  void addString(DIE &Die, dwarf::Attribute Attribute, const StringRef Str);<br>
> +  void addString(DIE &Die, dwarf::Attribute Attribute, StringRef Str);<br>
><br>
>    /// addLocalString - Add a string attribute data and value.<br>
>    void addLocalString(DIE &Die, dwarf::Attribute Attribute,<br>
> -                      const StringRef Str);<br>
> +                      StringRef Str);<br>
><br>
>    /// addExpr - Add a Dwarf expression attribute data and value.<br>
>    void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr);<br>
><br>
> Modified: llvm/trunk/lib/MC/SubtargetFeature.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/SubtargetFeature.cpp?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/SubtargetFeature.cpp?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/MC/SubtargetFeature.cpp (original)<br>
> +++ llvm/trunk/lib/MC/SubtargetFeature.cpp Sat Aug 30 11:48:02 2014<br>
> @@ -27,7 +27,7 @@ using namespace llvm;<br>
><br>
>  /// hasFlag - Determine if a feature has a flag; '+' or '-'<br>
>  ///<br>
> -static inline bool hasFlag(const StringRef Feature) {<br>
> +static inline bool hasFlag(StringRef Feature) {<br>
>    assert(!Feature.empty() && "Empty string");<br>
>    // Get first character<br>
>    char Ch = Feature[0];<br>
> @@ -37,13 +37,13 @@ static inline bool hasFlag(const StringR<br>
><br>
>  /// StripFlag - Return string stripped of flag.<br>
>  ///<br>
> -static inline std::string StripFlag(const StringRef Feature) {<br>
> +static inline std::string StripFlag(StringRef Feature) {<br>
>    return hasFlag(Feature) ? Feature.substr(1) : Feature;<br>
>  }<br>
><br>
>  /// isEnabled - Return true if enable flag; '+'.<br>
>  ///<br>
> -static inline bool isEnabled(const StringRef Feature) {<br>
> +static inline bool isEnabled(StringRef Feature) {<br>
>    assert(!Feature.empty() && "Empty string");<br>
>    // Get first character<br>
>    char Ch = Feature[0];<br>
> @@ -53,7 +53,7 @@ static inline bool isEnabled(const Strin<br>
><br>
>  /// Split - Splits a string of comma separated items in to a vector of strings.<br>
>  ///<br>
> -static void Split(std::vector<std::string> &V, const StringRef S) {<br>
> +static void Split(std::vector<std::string> &V, StringRef S) {<br>
>    SmallVector<StringRef, 3> Tmp;<br>
>    S.split(Tmp, ",", -1, false /* KeepEmpty */);<br>
>    V.assign(Tmp.begin(), Tmp.end());<br>
> @@ -81,7 +81,7 @@ static std::string Join(const std::vecto<br>
>  }<br>
><br>
>  /// Adding features.<br>
> -void SubtargetFeatures::AddFeature(const StringRef String) {<br>
> +void SubtargetFeatures::AddFeature(StringRef String) {<br>
>    // Don't add empty features or features we already have.<br>
>    if (!String.empty())<br>
>      // Convert to lowercase, prepend flag if we don't already have a flag.<br>
> @@ -136,7 +136,7 @@ static void Help(ArrayRef<SubtargetFeatu<br>
>  //                    SubtargetFeatures Implementation<br>
>  //===----------------------------------------------------------------------===//<br>
><br>
> -SubtargetFeatures::SubtargetFeatures(const StringRef Initial) {<br>
> +SubtargetFeatures::SubtargetFeatures(StringRef Initial) {<br>
>    // Break up string into separate features<br>
>    Split(Features, Initial);<br>
>  }<br>
> @@ -181,7 +181,7 @@ void ClearImpliedBits(uint64_t &Bits, co<br>
>  /// ToggleFeature - Toggle a feature and returns the newly updated feature<br>
>  /// bits.<br>
>  uint64_t<br>
> -SubtargetFeatures::ToggleFeature(uint64_t Bits, const StringRef Feature,<br>
> +SubtargetFeatures::ToggleFeature(uint64_t Bits, StringRef Feature,<br>
>                                   ArrayRef<SubtargetFeatureKV> FeatureTable) {<br>
><br>
>    // Find feature in table.<br>
> @@ -213,7 +213,7 @@ SubtargetFeatures::ToggleFeature(uint64_<br>
>  /// getFeatureBits - Get feature bits a CPU.<br>
>  ///<br>
>  uint64_t<br>
> -SubtargetFeatures::getFeatureBits(const StringRef CPU,<br>
> +SubtargetFeatures::getFeatureBits(StringRef CPU,<br>
>                                    ArrayRef<SubtargetFeatureKV> CPUTable,<br>
>                                    ArrayRef<SubtargetFeatureKV> FeatureTable) {<br>
><br>
><br>
> Modified: llvm/trunk/lib/Support/Path.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Path.cpp?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Path.cpp?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/Support/Path.cpp (original)<br>
> +++ llvm/trunk/lib/Support/Path.cpp Sat Aug 30 11:48:02 2014<br>
> @@ -359,7 +359,7 @@ bool reverse_iterator::operator==(const<br>
>           Position == RHS.Position;<br>
>  }<br>
><br>
> -const StringRef root_path(StringRef path) {<br>
> +StringRef root_path(StringRef path) {<br>
>    const_iterator b = begin(path),<br>
>                   pos = b,<br>
>                   e = end(path);<br>
> @@ -391,7 +391,7 @@ const StringRef root_path(StringRef path<br>
>    return StringRef();<br>
>  }<br>
><br>
> -const StringRef root_name(StringRef path) {<br>
> +StringRef root_name(StringRef path) {<br>
>    const_iterator b = begin(path),<br>
>                   e = end(path);<br>
>    if (b != e) {<br>
> @@ -413,7 +413,7 @@ const StringRef root_name(StringRef path<br>
>    return StringRef();<br>
>  }<br>
><br>
> -const StringRef root_directory(StringRef path) {<br>
> +StringRef root_directory(StringRef path) {<br>
>    const_iterator b = begin(path),<br>
>                   pos = b,<br>
>                   e = end(path);<br>
> @@ -442,7 +442,7 @@ const StringRef root_directory(StringRef<br>
>    return StringRef();<br>
>  }<br>
><br>
> -const StringRef relative_path(StringRef path) {<br>
> +StringRef relative_path(StringRef path) {<br>
>    StringRef root = root_path(path);<br>
>    return path.substr(root.size());<br>
>  }<br>
> @@ -494,7 +494,7 @@ void append(SmallVectorImpl<char> &path,<br>
>      path::append(path, *begin);<br>
>  }<br>
><br>
> -const StringRef parent_path(StringRef path) {<br>
> +StringRef parent_path(StringRef path) {<br>
>    size_t end_pos = parent_path_end(path);<br>
>    if (end_pos == StringRef::npos)<br>
>      return StringRef();<br>
> @@ -552,11 +552,11 @@ void native(SmallVectorImpl<char> &Path)<br>
>  #endif<br>
>  }<br>
><br>
> -const StringRef filename(StringRef path) {<br>
> +StringRef filename(StringRef path) {<br>
>    return *rbegin(path);<br>
>  }<br>
><br>
> -const StringRef stem(StringRef path) {<br>
> +StringRef stem(StringRef path) {<br>
>    StringRef fname = filename(path);<br>
>    size_t pos = fname.find_last_of('.');<br>
>    if (pos == StringRef::npos)<br>
> @@ -569,7 +569,7 @@ const StringRef stem(StringRef path) {<br>
>        return fname.substr(0, pos);<br>
>  }<br>
><br>
> -const StringRef extension(StringRef path) {<br>
> +StringRef extension(StringRef path) {<br>
>    StringRef fname = filename(path);<br>
>    size_t pos = fname.find_last_of('.');<br>
>    if (pos == StringRef::npos)<br>
> @@ -594,7 +594,7 @@ bool is_separator(char value) {<br>
><br>
>  static const char preferred_separator_string[] = { preferred_separator, '\0' };<br>
><br>
> -const StringRef get_separator() {<br>
> +StringRef get_separator() {<br>
>    return preferred_separator_string;<br>
>  }<br>
><br>
><br>
> Modified: llvm/trunk/lib/Support/SpecialCaseList.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SpecialCaseList.cpp?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SpecialCaseList.cpp?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/Support/SpecialCaseList.cpp (original)<br>
> +++ llvm/trunk/lib/Support/SpecialCaseList.cpp Sat Aug 30 11:48:02 2014<br>
> @@ -48,8 +48,7 @@ struct SpecialCaseList::Entry {<br>
><br>
>  SpecialCaseList::SpecialCaseList() : Entries() {}<br>
><br>
> -SpecialCaseList *SpecialCaseList::create(<br>
> -    const StringRef Path, std::string &Error) {<br>
> +SpecialCaseList *SpecialCaseList::create(StringRef Path, std::string &Error) {<br>
>    if (Path.empty())<br>
>      return new SpecialCaseList();<br>
>    ErrorOr<std::unique_ptr<MemoryBuffer>> FileOrErr =<br>
> @@ -69,7 +68,7 @@ SpecialCaseList *SpecialCaseList::create<br>
>    return SCL.release();<br>
>  }<br>
><br>
> -SpecialCaseList *SpecialCaseList::createOrDie(const StringRef Path) {<br>
> +SpecialCaseList *SpecialCaseList::createOrDie(StringRef Path) {<br>
>    std::string Error;<br>
>    if (SpecialCaseList *SCL = create(Path, Error))<br>
>      return SCL;<br>
> @@ -157,8 +156,8 @@ bool SpecialCaseList::parse(const Memory<br>
><br>
>  SpecialCaseList::~SpecialCaseList() {}<br>
><br>
> -bool SpecialCaseList::inSection(const StringRef Section, const StringRef Query,<br>
> -                                const StringRef Category) const {<br>
> +bool SpecialCaseList::inSection(StringRef Section, StringRef Query,<br>
> +                                StringRef Category) const {<br>
>    StringMap<StringMap<Entry> >::const_iterator I = Entries.find(Section);<br>
>    if (I == Entries.end()) return false;<br>
>    StringMap<Entry>::const_iterator II = I->second.find(Category);<br>
><br>
> Modified: llvm/trunk/lib/Support/YAMLParser.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/YAMLParser.cpp?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/YAMLParser.cpp?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/Support/YAMLParser.cpp (original)<br>
> +++ llvm/trunk/lib/Support/YAMLParser.cpp Sat Aug 30 11:48:02 2014<br>
> @@ -259,7 +259,7 @@ namespace yaml {<br>
>  /// @brief Scans YAML tokens from a MemoryBuffer.<br>
>  class Scanner {<br>
>  public:<br>
> -  Scanner(const StringRef Input, SourceMgr &SM);<br>
> +  Scanner(StringRef Input, SourceMgr &SM);<br>
>    Scanner(MemoryBufferRef Buffer, SourceMgr &SM_);<br>
><br>
>    /// @brief Parse the next token and return it without popping it.<br>
><br>
> Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp (original)<br>
> +++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp Sat Aug 30 11:48:02 2014<br>
> @@ -44,7 +44,7 @@ class ARMAsmBackend : public MCAsmBacken<br>
>    bool isThumbMode;     // Currently emitting Thumb code.<br>
>    bool IsLittleEndian;  // Big or little endian.<br>
>  public:<br>
> -  ARMAsmBackend(const Target &T, const StringRef TT, bool IsLittle)<br>
> +  ARMAsmBackend(const Target &T, StringRef TT, bool IsLittle)<br>
>      : MCAsmBackend(), STI(ARM_MC::createARMMCSubtargetInfo(TT, "", "")),<br>
>        isThumbMode(TT.startswith("thumb")), IsLittleEndian(IsLittle) {}<br>
><br>
> @@ -761,7 +761,7 @@ namespace {<br>
>  // FIXME: This should be in a separate file.<br>
>  class ARMWinCOFFAsmBackend : public ARMAsmBackend {<br>
>  public:<br>
> -  ARMWinCOFFAsmBackend(const Target &T, const StringRef &Triple)<br>
> +  ARMWinCOFFAsmBackend(const Target &T, StringRef Triple)<br>
>      : ARMAsmBackend(T, Triple, true) { }<br>
>    MCObjectWriter *createObjectWriter(raw_ostream &OS) const override {<br>
>      return createARMWinCOFFObjectWriter(OS, /*Is64Bit=*/false);<br>
> @@ -773,7 +773,7 @@ public:<br>
>  class ELFARMAsmBackend : public ARMAsmBackend {<br>
>  public:<br>
>    uint8_t OSABI;<br>
> -  ELFARMAsmBackend(const Target &T, const StringRef TT,<br>
> +  ELFARMAsmBackend(const Target &T, StringRef TT,<br>
>                     uint8_t OSABI, bool IsLittle)<br>
>      : ARMAsmBackend(T, TT, IsLittle), OSABI(OSABI) { }<br>
><br>
> @@ -786,7 +786,7 @@ public:<br>
>  class DarwinARMAsmBackend : public ARMAsmBackend {<br>
>  public:<br>
>    const MachO::CPUSubTypeARM Subtype;<br>
> -  DarwinARMAsmBackend(const Target &T, const StringRef TT,<br>
> +  DarwinARMAsmBackend(const Target &T, StringRef TT,<br>
>                        MachO::CPUSubTypeARM st)<br>
>      : ARMAsmBackend(T, TT, /* IsLittleEndian */ true), Subtype(st) {<br>
>        HasDataInCodeSupport = true;<br>
><br>
> Modified: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)<br>
> +++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Sat Aug 30 11:48:02 2014<br>
> @@ -2081,7 +2081,7 @@ bool MipsAsmParser::searchSymbolAlias(Op<br>
>        return false;<br>
>      if (Expr->getKind() == MCExpr::SymbolRef) {<br>
>        const MCSymbolRefExpr *Ref = static_cast<const MCSymbolRefExpr *>(Expr);<br>
> -      const StringRef DefSymbol = Ref->getSymbol().getName();<br>
> +      StringRef DefSymbol = Ref->getSymbol().getName();<br>
>        if (DefSymbol.startswith("$")) {<br>
>          OperandMatchResultTy ResTy =<br>
>              MatchAnyRegisterNameWithoutDollar(Operands, DefSymbol.substr(1), S);<br>
><br>
> Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original)<br>
> +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Sat Aug 30 11:48:02 2014<br>
> @@ -3034,7 +3034,7 @@ MipsTargetLowering::getSingleConstraintM<br>
>  /// that is returned indicates whether parsing was successful. The second flag<br>
>  /// is true if the numeric part exists.<br>
>  static std::pair<bool, bool><br>
> -parsePhysicalReg(const StringRef &C, std::string &Prefix,<br>
> +parsePhysicalReg(StringRef C, std::string &Prefix,<br>
>                   unsigned long long &Reg) {<br>
>    if (C.front() != '{' || C.back() != '}')<br>
>      return std::make_pair(false, false);<br>
> @@ -3055,7 +3055,7 @@ parsePhysicalReg(const StringRef &C, std<br>
>  }<br>
><br>
>  std::pair<unsigned, const TargetRegisterClass *> MipsTargetLowering::<br>
> -parseRegForInlineAsmConstraint(const StringRef &C, MVT VT) const {<br>
> +parseRegForInlineAsmConstraint(StringRef C, MVT VT) const {<br>
>    const TargetRegisterInfo *TRI =<br>
>        getTargetMachine().getSubtargetImpl()->getRegisterInfo();<br>
>    const TargetRegisterClass *RC;<br>
><br>
> Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.h?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.h?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/Target/Mips/MipsISelLowering.h (original)<br>
> +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.h Sat Aug 30 11:48:02 2014<br>
> @@ -563,7 +563,7 @@ namespace llvm {<br>
>      /// This function parses registers that appear in inline-asm constraints.<br>
>      /// It returns pair (0, 0) on failure.<br>
>      std::pair<unsigned, const TargetRegisterClass *><br>
> -    parseRegForInlineAsmConstraint(const StringRef &C, MVT VT) const;<br>
> +    parseRegForInlineAsmConstraint(StringRef C, MVT VT) const;<br>
><br>
>      std::pair<unsigned, const TargetRegisterClass*><br>
>                getRegForInlineAsmConstraint(const std::string &Constraint,<br>
><br>
> Modified: llvm/trunk/lib/Target/Mips/MipsMachineFunction.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsMachineFunction.cpp?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsMachineFunction.cpp?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/Target/Mips/MipsMachineFunction.cpp (original)<br>
> +++ llvm/trunk/lib/Target/Mips/MipsMachineFunction.cpp Sat Aug 30 11:48:02 2014<br>
> @@ -24,7 +24,7 @@ FixGlobalBaseReg("mips-fix-global-base-r<br>
>                   cl::desc("Always use $gp as the global base register."));<br>
><br>
>  // class MipsCallEntry.<br>
> -MipsCallEntry::MipsCallEntry(const StringRef &N) {<br>
> +MipsCallEntry::MipsCallEntry(StringRef N) {<br>
>  #ifndef NDEBUG<br>
>    Name = N;<br>
>    Val = nullptr;<br>
> @@ -119,7 +119,7 @@ bool MipsFunctionInfo::isEhDataRegFI(int<br>
>                          || FI == EhDataRegFI[2] || FI == EhDataRegFI[3]);<br>
>  }<br>
><br>
> -MachinePointerInfo MipsFunctionInfo::callPtrInfo(const StringRef &Name) {<br>
> +MachinePointerInfo MipsFunctionInfo::callPtrInfo(StringRef Name) {<br>
>    const MipsCallEntry *&E = ExternalCallEntries[Name];<br>
><br>
>    if (!E)<br>
><br>
> Modified: llvm/trunk/lib/Target/Mips/MipsMachineFunction.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsMachineFunction.h?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsMachineFunction.h?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/Target/Mips/MipsMachineFunction.h (original)<br>
> +++ llvm/trunk/lib/Target/Mips/MipsMachineFunction.h Sat Aug 30 11:48:02 2014<br>
> @@ -34,7 +34,7 @@ namespace llvm {<br>
>  /// resolved by lazy-binding.<br>
>  class MipsCallEntry : public PseudoSourceValue {<br>
>  public:<br>
> -  explicit MipsCallEntry(const StringRef &N);<br>
> +  explicit MipsCallEntry(StringRef N);<br>
>    explicit MipsCallEntry(const GlobalValue *V);<br>
>    bool isConstant(const MachineFrameInfo *) const override;<br>
>    bool isAliased(const MachineFrameInfo *) const override;<br>
> @@ -88,7 +88,7 @@ public:<br>
><br>
>    /// \brief Create a MachinePointerInfo that has a MipsCallEntr object<br>
>    /// representing a GOT entry for an external function.<br>
> -  MachinePointerInfo callPtrInfo(const StringRef &Name);<br>
> +  MachinePointerInfo callPtrInfo(StringRef Name);<br>
><br>
>    /// \brief Create a MachinePointerInfo that has a MipsCallEntr object<br>
>    /// representing a GOT entry for a global function.<br>
><br>
> Modified: llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp (original)<br>
> +++ llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp Sat Aug 30 11:48:02 2014<br>
> @@ -25,7 +25,7 @@ static cl::opt<bool> CompileForDebugging<br>
><br>
>  void NVPTXMCAsmInfo::anchor() {}<br>
><br>
> -NVPTXMCAsmInfo::NVPTXMCAsmInfo(const StringRef &TT) {<br>
> +NVPTXMCAsmInfo::NVPTXMCAsmInfo(StringRef TT) {<br>
>    Triple TheTriple(TT);<br>
>    if (TheTriple.getArch() == Triple::nvptx64) {<br>
>      PointerSize = CalleeSaveStackSlotSize = 8;<br>
><br>
> Modified: llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.h?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.h?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.h (original)<br>
> +++ llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.h Sat Aug 30 11:48:02 2014<br>
> @@ -23,7 +23,7 @@ class StringRef;<br>
>  class NVPTXMCAsmInfo : public MCAsmInfo {<br>
>    virtual void anchor();<br>
>  public:<br>
> -  explicit NVPTXMCAsmInfo(const StringRef &TT);<br>
> +  explicit NVPTXMCAsmInfo(StringRef TT);<br>
>  };<br>
>  } // namespace llvm<br>
><br>
><br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp Sat Aug 30 11:48:02 2014<br>
> @@ -143,7 +143,7 @@ class DFSanABIList {<br>
><br>
>    /// Returns whether either this function or its source file are listed in the<br>
>    /// given category.<br>
> -  bool isIn(const Function &F, const StringRef Category) const {<br>
> +  bool isIn(const Function &F, StringRef Category) const {<br>
>      return isIn(*F.getParent(), Category) ||<br>
>             SCL->inSection("fun", F.getName(), Category);<br>
>    }<br>
> @@ -152,7 +152,7 @@ class DFSanABIList {<br>
>    ///<br>
>    /// If GA aliases a function, the alias's name is matched as a function name<br>
>    /// would be.  Similarly, aliases of globals are matched like globals.<br>
> -  bool isIn(const GlobalAlias &GA, const StringRef Category) const {<br>
> +  bool isIn(const GlobalAlias &GA, StringRef Category) const {<br>
>      if (isIn(*GA.getParent(), Category))<br>
>        return true;<br>
><br>
> @@ -164,7 +164,7 @@ class DFSanABIList {<br>
>    }<br>
><br>
>    /// Returns whether this module is listed in the given category.<br>
> -  bool isIn(const Module &M, const StringRef Category) const {<br>
> +  bool isIn(const Module &M, StringRef Category) const {<br>
>      return SCL->inSection("src", M.getModuleIdentifier(), Category);<br>
>    }<br>
>  };<br>
><br>
> Modified: llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=216820&r1=216819&r2=216820&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp?rev=216820&r1=216819&r2=216820&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp (original)<br>
> +++ llvm/trunk/tools/llvm-dwarfdump/llvm-dwarfdump.cpp Sat Aug 30 11:48:02 2014<br>
> @@ -65,7 +65,7 @@ DumpType("debug-dump", cl::init(DIDT_All<br>
>          clEnumValN(DIDT_StrOffsetsDwo, "str_offsets.dwo", ".debug_str_offsets.dwo"),<br>
>          clEnumValEnd));<br>
><br>
> -static void DumpInput(const StringRef &Filename) {<br>
> +static void DumpInput(StringRef Filename) {<br>
>    ErrorOr<std::unique_ptr<MemoryBuffer>> BuffOrErr =<br>
>        MemoryBuffer::getFileOrSTDIN(Filename);<br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>~Craig
</div>