[cfe-commits] r94892 - in /cfe/trunk: include/clang/Driver/ToolChain.h lib/Driver/Tools.cpp
Daniel Dunbar
daniel at zuster.org
Sat Jan 30 09:57:49 PST 2010
Doh, thanks!
- Daniel
On Sat, Jan 30, 2010 at 7:01 AM, Benjamin Kramer
<benny.kra at googlemail.com> wrote:
> Author: d0k
> Date: Sat Jan 30 09:01:47 2010
> New Revision: 94892
>
> URL: http://llvm.org/viewvc/llvm-project?rev=94892&view=rev
> Log:
> Use StringRef instead of returning a temporary std::string.
>
> This fixes a really nasty bug in Darwin::getDarwinArchName where we were going
> StringRef -> temporary std::string -> StringRef (and return the dead StringRef).
> The StringRefs from Triple live as long as the Triple itself, that should be
> long enough.
>
> Hopefully 2 of 4 MSVC buildbot failures are gone now.
>
> Modified:
> cfe/trunk/include/clang/Driver/ToolChain.h
> cfe/trunk/lib/Driver/Tools.cpp
>
> Modified: cfe/trunk/include/clang/Driver/ToolChain.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=94892&r1=94891&r2=94892&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Driver/ToolChain.h (original)
> +++ cfe/trunk/include/clang/Driver/ToolChain.h Sat Jan 30 09:01:47 2010
> @@ -53,9 +53,9 @@
> const Driver &getDriver() const;
> const llvm::Triple &getTriple() const { return Triple; }
>
> - std::string getArchName() const { return Triple.getArchName(); }
> - std::string getPlatform() const { return Triple.getVendorName(); }
> - std::string getOS() const { return Triple.getOSName(); }
> + llvm::StringRef getArchName() const { return Triple.getArchName(); }
> + llvm::StringRef getPlatform() const { return Triple.getVendorName(); }
> + llvm::StringRef getOS() const { return Triple.getOSName(); }
>
> std::string getTripleString() const {
> return Triple.getTriple();
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=94892&r1=94891&r2=94892&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Sat Jan 30 09:01:47 2010
> @@ -512,7 +512,7 @@
> // Select the default CPU if none was given (or detection failed).
> if (!CPUName) {
> // FIXME: Need target hooks.
> - if (memcmp(getToolChain().getOS().c_str(), "darwin", 6) == 0) {
> + if (getToolChain().getOS().startswith("darwin")) {
> if (getToolChain().getArchName() == "x86_64")
> CPUName = "core2";
> else if (getToolChain().getArchName() == "i386")
>
>
> _______________________________________________
> 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