From: Benjamin Kramer Date: Fri, 28 Jun 2013 16:25:46 +0000 (+0000) Subject: Use the multiple argument form of path::append. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ceb6dc8e5afbd8e4dad7aaa1948994965fd8ff2e;p=clang Use the multiple argument form of path::append. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185164 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 47a5f33017..854a6f49f8 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -222,9 +222,7 @@ void DarwinClang::AddLinkARCArgs(const ArgList &Args, SmallString<128> P(getDriver().ClangExecutable); llvm::sys::path::remove_filename(P); // 'clang' llvm::sys::path::remove_filename(P); // 'bin' - llvm::sys::path::append(P, "lib"); - llvm::sys::path::append(P, "arc"); - llvm::sys::path::append(P, "libarclite_"); + llvm::sys::path::append(P, "lib", "arc", "libarclite_"); // Mash in the platform. if (isTargetIOSSimulator()) P += "iphonesimulator"; @@ -242,9 +240,7 @@ void DarwinClang::AddLinkRuntimeLib(const ArgList &Args, const char *DarwinStaticLib, bool AlwaysLink) const { SmallString<128> P(getDriver().ResourceDir); - llvm::sys::path::append(P, "lib"); - llvm::sys::path::append(P, "darwin"); - llvm::sys::path::append(P, DarwinStaticLib); + llvm::sys::path::append(P, "lib", "darwin", DarwinStaticLib); // For now, allow missing resource libraries to support developers who may // not have compiler-rt checked out or integrated into their build (unless @@ -539,9 +535,7 @@ void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args, // Check in the sysroot first. if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) { SmallString<128> P(A->getValue()); - llvm::sys::path::append(P, "usr"); - llvm::sys::path::append(P, "lib"); - llvm::sys::path::append(P, "libstdc++.dylib"); + llvm::sys::path::append(P, "usr", "lib", "libstdc++.dylib"); if (!llvm::sys::fs::exists(P.str())) { llvm::sys::path::remove_filename(P); @@ -577,8 +571,7 @@ void DarwinClang::AddCCKextLibArgs(const ArgList &Args, // only present in the gcc lib dir, which makes it hard to find). SmallString<128> P(getDriver().ResourceDir); - llvm::sys::path::append(P, "lib"); - llvm::sys::path::append(P, "darwin"); + llvm::sys::path::append(P, "lib", "darwin"); // Use the newer cc_kext for iOS ARM after 6.0. if (!isTargetIPhoneOS() || isTargetIOSSimulator() || diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index f362226459..d8b4392278 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -852,9 +852,7 @@ std::string CompilerInvocation::GetResourcesPath(const char *Argv0, llvm::sys::path::remove_filename(P); // Remove /bin from foo/bin // Get foo/lib/clang//include - llvm::sys::path::append(P, "lib"); - llvm::sys::path::append(P, "clang"); - llvm::sys::path::append(P, CLANG_VERSION_STRING); + llvm::sys::path::append(P, "lib", "clang", CLANG_VERSION_STRING); } return P.str(); diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index 4c876f92b9..d411ead7e9 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/lib/Lex/ModuleMap.cpp @@ -507,8 +507,7 @@ ModuleMap::inferFrameworkModule(StringRef ModuleName, // Look for an umbrella header. SmallString<128> UmbrellaName = StringRef(FrameworkDir->getName()); - llvm::sys::path::append(UmbrellaName, "Headers"); - llvm::sys::path::append(UmbrellaName, ModuleName + ".h"); + llvm::sys::path::append(UmbrellaName, "Headers", ModuleName + ".h"); const FileEntry *UmbrellaHeader = FileMgr.getFile(UmbrellaName); // FIXME: If there's no umbrella header, we could probably scan the @@ -1324,10 +1323,8 @@ static void appendSubframeworkPaths(Module *Mod, return; // Add Frameworks/Name.framework for each subframework. - for (unsigned I = Paths.size() - 1; I != 0; --I) { - llvm::sys::path::append(Path, "Frameworks"); - llvm::sys::path::append(Path, Paths[I-1] + ".framework"); - } + for (unsigned I = Paths.size() - 1; I != 0; --I) + llvm::sys::path::append(Path, "Frameworks", Paths[I-1] + ".framework"); } /// \brief Parse a header declaration. @@ -1378,15 +1375,13 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken, appendSubframeworkPaths(ActiveModule, PathName); // Check whether this file is in the public headers. - llvm::sys::path::append(PathName, "Headers"); - llvm::sys::path::append(PathName, FileName); + llvm::sys::path::append(PathName, "Headers", FileName); File = SourceMgr.getFileManager().getFile(PathName); if (!File) { // Check whether this file is in the private headers. PathName.resize(PathLength); - llvm::sys::path::append(PathName, "PrivateHeaders"); - llvm::sys::path::append(PathName, FileName); + llvm::sys::path::append(PathName, "PrivateHeaders", FileName); File = SourceMgr.getFileManager().getFile(PathName); } } else {