6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
9
+ #include " llvm/Option/Arg.h"
9
10
#include " llvm/ADT/SmallString.h"
10
11
#include " llvm/Config/llvm-config.h"
11
- #include " llvm/Option/Arg.h"
12
12
#include " llvm/Option/ArgList.h"
13
13
#include " llvm/Option/Option.h"
14
14
#include " llvm/Support/Compiler.h"
15
15
#include " llvm/Support/Debug.h"
16
+ #include " llvm/Support/InterleavedRange.h"
16
17
#include " llvm/Support/raw_ostream.h"
17
18
18
19
using namespace llvm ;
@@ -72,13 +73,7 @@ std::string Arg::getAsString(const ArgList &Args) const {
72
73
73
74
ArgStringList ASL;
74
75
render (Args, ASL);
75
- for (ArgStringList::iterator
76
- it = ASL.begin (), ie = ASL.end (); it != ie; ++it) {
77
- if (it != ASL.begin ())
78
- OS << ' ' ;
79
- OS << *it;
80
- }
81
-
76
+ OS << llvm::interleaved (ASL, " " );
82
77
return std::string (OS.str ());
83
78
}
84
79
@@ -100,11 +95,7 @@ void Arg::render(const ArgList &Args, ArgStringList &Output) const {
100
95
case Option::RenderCommaJoinedStyle: {
101
96
SmallString<256 > Res;
102
97
raw_svector_ostream OS (Res);
103
- OS << getSpelling ();
104
- for (unsigned i = 0 , e = getNumValues (); i != e; ++i) {
105
- if (i) OS << ' ,' ;
106
- OS << getValue (i);
107
- }
98
+ OS << getSpelling () << llvm::interleaved (getValues (), " ," );
108
99
Output.push_back (Args.MakeArgString (OS.str ()));
109
100
break ;
110
101
}
0 commit comments