[llvm] r176166 - std::string to StringRef.

David Blaikie dblaikie at gmail.com
Tue Feb 26 21:35:06 PST 2013


On Tue, Feb 26, 2013 at 9:23 PM, Nadav Rotem <nrotem at apple.com> wrote:
> Author: nadav
> Date: Tue Feb 26 23:23:56 2013
> New Revision: 176166
>
> URL: http://llvm.org/viewvc/llvm-project?rev=176166&view=rev
> Log:
> std::string to StringRef.
>
> Modified:
>     llvm/trunk/lib/Target/X86/X86Subtarget.cpp
>
> Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=176166&r1=176165&r2=176166&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Tue Feb 26 23:23:56 2013
> @@ -332,9 +332,9 @@ void X86Subtarget::resetSubtargetFeature
>                                             "target-cpu");
>    Attribute FSAttr = FnAttrs.getAttribute(AttributeSet::FunctionIndex,
>                                            "target-features");
> -  std::string CPU =
> -    !CPUAttr.hasAttribute(Attribute::None) ?CPUAttr.getValueAsString() : "";
> -  std::string FS =
> +  StringRef CPU =
> +    !CPUAttr.hasAttribute(Attribute::None) ? CPUAttr.getValueAsString() : "";
> +  StringRef FS =
>      !FSAttr.hasAttribute(Attribute::None) ? FSAttr.getValueAsString() : "";
>    if (!FS.empty()) {
>      initializeEnvironment();
> @@ -343,7 +343,7 @@ void X86Subtarget::resetSubtargetFeature
>  }
>
>  void X86Subtarget::resetSubtargetFeatures(StringRef CPU, StringRef FS) {
> -  std::string CPUName = CPU;
> +  StringRef CPUName = CPU;

Unless I'm misreading this function it seems we could drop the CPUName
variable entirely (possibly just delete the declaration and rename the
parameter from CPU to CPUName & it should all still compile I think)

>    if (!FS.empty() || !CPU.empty()) {
>      if (CPUName.empty()) {
>  #if defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86)\
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list