r213578 - Fix build breakage caused by use of std::to_string(int). Replace with raw_string_ostream.

Aaron Ballman aaron at aaronballman.com
Mon Jul 21 12:19:51 PDT 2014


On Mon, Jul 21, 2014 at 3:06 PM, Mark Heffernan <meheff at google.com> wrote:
> Author: meheff
> Date: Mon Jul 21 14:06:29 2014
> New Revision: 213578
>
> URL: http://llvm.org/viewvc/llvm-project?rev=213578&view=rev
> Log:
> Fix build breakage caused by use of std::to_string(int).  Replace with raw_string_ostream.

Out of curiosity, which bot(s) can't handle std::to_string?

~Aaron

>
> Modified:
>     cfe/trunk/include/clang/Basic/Attr.td
>
> Modified: cfe/trunk/include/clang/Basic/Attr.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=213578&r1=213577&r2=213578&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/Attr.td (original)
> +++ cfe/trunk/include/clang/Basic/Attr.td Mon Jul 21 14:06:29 2014
> @@ -1814,40 +1814,45 @@ def LoopHint : Attr {
>        // String "unroll" of "#pragma unroll" is already emitted as the
>        // pragma name.
>        if (option == UnrollCount)
> -        OS << getValueString();
> +        printArgument(OS);
>        OS << "\n";
>        return;
>      }
>      assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling");
> -    OS << getOptionName(option) << getValueString() << "\n";
> +    OS << getOptionName(option);
> +    printArgument(OS);
> +    OS << "\n";
>    }
>
> -  // Return a string containing the loop hint argument including the
> -  // enclosing parentheses.
> -  std::string getValueString() const {
> -    std::string ValueName;
> +  // Prints the loop hint argument including the enclosing parentheses to OS.
> +  void printArgument(raw_ostream &OS) const {
> +    OS << "(";
>      if (option == VectorizeWidth || option == InterleaveCount ||
>          option == UnrollCount)
> -      ValueName = std::to_string(value);
> +      OS << value;
>      else if (value)
> -      ValueName = "enable";
> +      OS << "enable";
>      else
> -      ValueName = "disable";
> -
> -    return "(" + ValueName + ")";
> +      OS << "disable";
> +    OS << ")";
>    }
>
>    // Return a string suitable for identifying this attribute in diagnostics.
>    std::string getDiagnosticName() const {
> +    std::string DiagnosticName;
> +    llvm::raw_string_ostream OS(DiagnosticName);
>      unsigned SpellingIndex = getSpellingListIndex();
>      if (SpellingIndex == Pragma_unroll && option == Unroll)
> -      return "#pragma unroll";
> +      OS << "#pragma unroll";
>      else if (SpellingIndex == Pragma_unroll && option == UnrollCount) {
> -      return "#pragma unroll" + getValueString();
> +      OS << "#pragma unroll";
> +      printArgument(OS);
>      } else {
>        assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling");
> -      return std::string(getOptionName(option)) + getValueString();
> +      OS << getOptionName(option);
> +      printArgument(OS);
>      }
> +    return OS.str();
>    }
>    }];
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list