r248645 - Replace a loop and temporary string copying with llvm::join.
Eric Christopher via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 25 18:25:08 PDT 2015
Author: echristo
Date: Fri Sep 25 20:25:08 2015
New Revision: 248645
URL: http://llvm.org/viewvc/llvm-project?rev=248645&view=rev
Log:
Replace a loop and temporary string copying with llvm::join.
Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp
Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=248645&r1=248644&r2=248645&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Fri Sep 25 20:25:08 2015
@@ -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::Creat
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;
More information about the cfe-commits
mailing list