From 335d6aeaf25aed5bd4cd42214797832befa528e1 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Sat, 26 Sep 2015 01:25:08 +0000 Subject: [PATCH] Replace a loop and temporary string copying with llvm::join. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248645 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/BackendUtil.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index 998a07c787..3ba0f80c93 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -14,6 +14,7 @@ #include "clang/Frontend/CodeGenOptions.h" #include "clang/Frontend/FrontendDiagnostic.h" #include "clang/Frontend/Utils.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" @@ -455,13 +456,8 @@ TargetMachine *EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) { llvm::cl::ParseCommandLineOptions(BackendArgs.size() - 1, BackendArgs.data()); - std::string FeaturesStr; - if (!TargetOpts.Features.empty()) { - SubtargetFeatures Features; - for (const std::string &Feature : TargetOpts.Features) - Features.AddFeature(Feature); - FeaturesStr = Features.getString(); - } + std::string FeaturesStr = + llvm::join(TargetOpts.Features.begin(), TargetOpts.Features.end(), ","); // Keep this synced with the equivalent code in tools/driver/cc1as_main.cpp. llvm::Reloc::Model RM = llvm::Reloc::Default; -- 2.40.0