From 17381a06273637ef77efda0c8351655c7ea40d7a Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Fri, 28 Jun 2013 16:25:46 +0000 Subject: [PATCH] Use the multiple argument form of path::append. llvm-svn: 185164 --- clang/lib/Driver/ToolChains.cpp | 15 ++++----------- clang/lib/Frontend/CompilerInvocation.cpp | 4 +--- clang/lib/Lex/ModuleMap.cpp | 15 +++++---------- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index 47a5f33..854a6f4 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/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/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index f362226..d8b4392 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/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/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 4c876f9..d411ead 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/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 { -- 2.7.4