r180783 - Always use / when computing mips specific paths.
Chandler Carruth
chandlerc at google.com
Tue Apr 30 05:32:23 PDT 2013
On Tue, Apr 30, 2013 at 2:24 PM, Rafael Espindola <
rafael.espindola at gmail.com> wrote:
> Author: rafael
> Date: Tue Apr 30 07:24:40 2013
> New Revision: 180783
>
> URL: http://llvm.org/viewvc/llvm-project?rev=180783&view=rev
> Log:
> Always use / when computing mips specific paths.
>
> We were getting paths with both / and \ in them. This should fix
> mips-cs-ld.c
> on the windows bots.
>
You also removed a bunch of '.str()' method calls here, which is good but
should be mentioned in the commit or committed in a separate patch.
>
> Modified:
> cfe/trunk/lib/Driver/ToolChains.cpp
>
> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=180783&r1=180782&r2=180783&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Apr 30 07:24:40 2013
> @@ -1298,20 +1298,20 @@ static bool hasMipsN32ABIArg(const ArgLi
> return A && (A->getValue() == StringRef("n32"));
> }
>
> -static void appendMipsTargetSuffix(SmallVectorImpl<char> &Path,
> +static void appendMipsTargetSuffix(std::string &Path,
> llvm::Triple::ArchType TargetArch,
> const ArgList &Args) {
> if (isMips16(Args))
> - llvm::sys::path::append(Path, "/mips16");
> + Path += "/mips16";
> else if (isMicroMips(Args))
> - llvm::sys::path::append(Path, "/micromips");
> + Path += "/micromips";
>
> if (isSoftFloatABI(Args))
> - llvm::sys::path::append(Path, "/soft-float");
> + Path += "/soft-float";
>
> if (TargetArch == llvm::Triple::mipsel ||
> TargetArch == llvm::Triple::mips64el)
> - llvm::sys::path::append(Path, "/el");
> + Path += "/el";
> }
>
> static StringRef getMipsTargetABISuffix(llvm::Triple::ArchType TargetArch,
> @@ -1323,7 +1323,7 @@ static StringRef getMipsTargetABISuffix(
> return "/32";
> }
>
> -static bool findTargetMultiarchSuffix(SmallString<32> &Suffix,
> +static bool findTargetMultiarchSuffix(std::string &Suffix,
> StringRef Path,
> llvm::Triple::ArchType TargetArch,
> const ArgList &Args) {
> @@ -1337,15 +1337,15 @@ static bool findTargetMultiarchSuffix(Sm
>
> if (TargetArch == llvm::Triple::mips64 ||
> TargetArch == llvm::Triple::mips64el)
> - llvm::sys::path::append(Suffix, ABISuffix);
> + Suffix += ABISuffix;
>
> - if (llvm::sys::fs::exists(Path + Suffix.str() + "/crtbegin.o"))
> + if (llvm::sys::fs::exists(Path + Suffix + "/crtbegin.o"))
> return true;
>
> // Then fall back and probe a simple case like
> // mips-linux-gnu/4.7/32/crtbegin.o
> Suffix = ABISuffix;
> - return llvm::sys::fs::exists(Path + Suffix.str() + "/crtbegin.o");
> + return llvm::sys::fs::exists(Path + Suffix + "/crtbegin.o");
> }
>
> if (TargetArch == llvm::Triple::x86_64 ||
> @@ -1354,7 +1354,7 @@ static bool findTargetMultiarchSuffix(Sm
> else
> Suffix = "/32";
>
> - return llvm::sys::fs::exists(Path + Suffix.str() + "/crtbegin.o");
> + return llvm::sys::fs::exists(Path + Suffix + "/crtbegin.o");
> }
>
> void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
> @@ -1407,10 +1407,10 @@ void Generic_GCC::GCCInstallationDetecto
> // we use that. If not, and if not a multiarch triple, we look for
> // crtbegin.o without the subdirectory.
>
> - SmallString<32> MultiarchSuffix;
> + std::string MultiarchSuffix;
> if (findTargetMultiarchSuffix(MultiarchSuffix,
> LI->path(), TargetArch, Args)) {
> - GCCMultiarchSuffix = MultiarchSuffix.str();
> + GCCMultiarchSuffix = MultiarchSuffix;
> } else {
> if (NeedsMultiarchSuffix ||
> !llvm::sys::fs::exists(LI->path() + "/crtbegin.o"))
> @@ -2295,10 +2295,10 @@ Linux::Linux(const Driver &D, const llvm
> // Sourcery CodeBench MIPS toolchain holds some libraries under
> // the parent prefix of the GCC installation.
> if (IsMips) {
> - SmallString<128> Suffix;
> + std::string Suffix;
> appendMipsTargetSuffix(Suffix, Arch, Args);
> addPathIfExists(LibPath + "/../" + GCCTriple.str() + "/lib/../" +
> - Multilib + Suffix.str(),
> + Multilib + Suffix,
> Paths);
> }
> }
> @@ -2363,14 +2363,12 @@ std::string Linux::computeSysRoot(const
> if (!GCCInstallation.isValid() || !isMipsArch(getTriple().getArch()))
> return std::string();
>
> - SmallString<128> Path;
> - llvm::sys::path::append(Path, GCCInstallation.getInstallPath(),
> - "../../../..",
> - GCCInstallation.getTriple().str(),
> - "libc");
> + std::string Path =
> + (GCCInstallation.getInstallPath() +
> + "/../../../../" + GCCInstallation.getTriple().str() + "/libc").str();
> appendMipsTargetSuffix(Path, getTriple().getArch(), Args);
>
> - return llvm::sys::fs::exists(Path.str()) ? Path.str() : "";
> + return llvm::sys::fs::exists(Path) ? Path : "";
> }
>
> void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130430/d745e570/attachment.html>
More information about the cfe-commits
mailing list