File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 2222#include " llvm/ADT/StringExtras.h"
2323#include " llvm/Support/raw_ostream.h"
2424
25+ #include < array>
26+ #include < cstring>
2527#include < vector>
2628
2729#define TOSTR2 (X ) #X
@@ -90,6 +92,26 @@ raw_ostream &operator<<(raw_ostream &os, const Version &version) {
9092 return os;
9193}
9294
95+ template <size_t InternalLen>
96+ static SmallString<InternalLen> &operator +=(SmallString<InternalLen> &buf, unsigned int value) {
97+ std::array<char , 64 > valueBuf;
98+ snprintf (valueBuf.data (), valueBuf.size (), " %u" , value);
99+ buf += valueBuf.data ();
100+ return buf;
101+ }
102+
103+ template <size_t InternalLen>
104+ static SmallString<InternalLen> &operator +=(SmallString<InternalLen> &buf, const Version &version) {
105+ if (version.empty ())
106+ return buf;
107+ buf += version[0 ];
108+ for (size_t i = 1 , e = version.size (); i != e; ++i) {
109+ buf += " ." ;
110+ buf += version[i];
111+ }
112+ return os;
113+ }
114+
93115std::string
94116Version::preprocessorDefinition (StringRef macroName,
95117 ArrayRef<uint64_t > componentWeights) const {
@@ -277,7 +299,8 @@ static SmallString<256> getSwiftFullVersionImpl(Version effectiveVersion) {
277299#endif
278300
279301 if (effectiveVersion != Version::getCurrentLanguageVersion ()) {
280- buf += " effective-" << effectiveVersion;
302+ buf += " effective-" ;
303+ buf += effectiveVersion;
281304 }
282305
283306#if defined(SWIFT_COMPILER_VERSION)
You can’t perform that action at this time.
0 commit comments