Skip to content

Commit 779bdf0

Browse files
authored
Merge pull request #41550 from benlangmuir/make-next-less-sad
Pre-fix some build failures that we'll see with newer llvm
2 parents bd5a437 + 3547863 commit 779bdf0

File tree

15 files changed

+22
-19
lines changed

15 files changed

+22
-19
lines changed

include/swift/ABI/TypeIdentity.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define SWIFT_ABI_TYPEIDENTITY_H
2020

2121
#include "swift/Basic/LLVM.h"
22+
#include <llvm/ADT/Optional.h>
2223
#include <llvm/ADT/StringRef.h>
2324

2425
namespace swift {

include/swift/Basic/DiverseStack.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,7 @@ class DiverseValueBuffer {
395395
public:
396396
DiverseValueBuffer(const T &value) {
397397
size_t size = value.allocated_size();
398-
data.reserve(size);
399-
data.set_size(size);
398+
data.resize_for_overwrite(size);
400399
memcpy(data.data(), reinterpret_cast<const void *>(&value), size);
401400
}
402401

include/swift/Basic/Fingerprint.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "swift/Basic/StableHasher.h"
1717
#include "llvm/ADT/Hashing.h"
18+
#include "llvm/ADT/Optional.h"
1819
#include "llvm/ADT/SmallString.h"
1920
#include "llvm/ADT/StringRef.h"
2021

include/swift/Basic/SourceLoc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "swift/Basic/Debug.h"
2121
#include "swift/Basic/LLVM.h"
2222
#include "llvm/ADT/DenseMapInfo.h"
23+
#include "llvm/ADT/Hashing.h"
2324
#include "llvm/ADT/StringRef.h"
2425
#include "llvm/Support/SMLoc.h"
2526
#include <functional>

include/swift/Basic/Statistic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef SWIFT_BASIC_STATISTIC_H
1414
#define SWIFT_BASIC_STATISTIC_H
1515

16+
#include "llvm/ADT/Optional.h"
1617
#include "llvm/ADT/SmallString.h"
1718
#include "llvm/ADT/Statistic.h"
1819
#include "llvm/Support/Timer.h"

include/swift/Demangling/ManglingUtils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef SWIFT_DEMANGLING_MANGLINGUTILS_H
1414
#define SWIFT_DEMANGLING_MANGLINGUTILS_H
1515

16+
#include "llvm/ADT/Optional.h"
1617
#include "llvm/ADT/StringRef.h"
1718
#include "swift/Demangling/NamespaceMacros.h"
1819
#include "swift/Demangling/Punycode.h"

include/swift/Remote/MemoryReader.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "swift/Remote/RemoteAddress.h"
2222
#include "swift/SwiftRemoteMirror/MemoryReaderInterface.h"
23+
#include "llvm/ADT/Optional.h"
2324

2425
#include <cstring>
2526
#include <functional>

include/swift/SIL/SILInstruction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,12 @@ SILInstructionResultArray::end() const {
277277

278278
inline SILInstructionResultArray::reverse_iterator
279279
SILInstructionResultArray::rbegin() const {
280-
return llvm::make_reverse_iterator(end());
280+
return std::make_reverse_iterator(end());
281281
}
282282

283283
inline SILInstructionResultArray::reverse_iterator
284284
SILInstructionResultArray::rend() const {
285-
return llvm::make_reverse_iterator(begin());
285+
return std::make_reverse_iterator(begin());
286286
}
287287

288288
inline SILInstructionResultArray::range

include/swift/Syntax/AbsoluteRawSyntax.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,11 +397,11 @@ class OptionalStorage<AbsoluteRawSyntax> {
397397

398398
bool hasValue() const { return !Storage.isNull(); }
399399

400-
AbsoluteRawSyntax &getValue() LLVM_LVALUE_FUNCTION {
400+
AbsoluteRawSyntax &getValue() & {
401401
assert(hasValue());
402402
return Storage;
403403
}
404-
AbsoluteRawSyntax const &getValue() const LLVM_LVALUE_FUNCTION {
404+
AbsoluteRawSyntax const &getValue() const & {
405405
assert(hasValue());
406406
return Storage;
407407
}

include/swift/Syntax/SyntaxData.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,11 @@ class OptionalStorage<SyntaxDataRef> {
416416

417417
bool hasValue() const { return !Storage.getAbsoluteRaw().isNull(); }
418418

419-
SyntaxDataRef &getValue() LLVM_LVALUE_FUNCTION {
419+
SyntaxDataRef &getValue() & {
420420
assert(hasValue());
421421
return Storage;
422422
}
423-
SyntaxDataRef const &getValue() const LLVM_LVALUE_FUNCTION {
423+
SyntaxDataRef const &getValue() const & {
424424
assert(hasValue());
425425
return Storage;
426426
}

lib/Basic/StringExtras.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,8 +675,8 @@ static Words::iterator matchTypeNameFromBackWithSpecialCases(
675675

676676
if (shortenedNameWord != newShortenedNameWord) {
677677
unsigned targetSize = newShortenedNameWord.size();
678-
auto newIter = llvm::make_reverse_iterator(WordIterator(name,
679-
targetSize));
678+
auto newIter = std::make_reverse_iterator(WordIterator(name,
679+
targetSize));
680680
#ifndef NDEBUG
681681
while (nameWordRevIter.base().getPosition() > targetSize)
682682
++nameWordRevIter;

lib/IRGen/Explosion.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ class Explosion {
4545
Explosion &operator=(const Explosion &) = delete;
4646
Explosion(Explosion &&other) : NextValue(0) {
4747
// Do an uninitialized copy of the non-consumed elements.
48-
Values.reserve(other.size());
49-
Values.set_size(other.size());
48+
Values.resize_for_overwrite(other.size());
5049
std::uninitialized_copy(other.begin(), other.end(), Values.begin());
5150

5251
// Remove everything from the other explosion.

lib/IRGen/GenCall.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3240,8 +3240,7 @@ void CallEmission::setFromCallee() {
32403240

32413241
// Set up the args array.
32423242
assert(Args.empty());
3243-
Args.reserve(numArgs);
3244-
Args.set_size(numArgs);
3243+
Args.resize_for_overwrite(numArgs);
32453244
LastArgWritten = numArgs;
32463245
}
32473246

lib/SIL/Utils/MemoryLocations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ void MemoryLocations::analyzeLocation(SILValue loc) {
200200
SubLocationMap subLocationMap;
201201
if (!analyzeLocationUsesRecursively(loc, currentLocIdx, collectedVals,
202202
subLocationMap)) {
203-
locations.set_size(currentLocIdx);
203+
locations.truncate(currentLocIdx);
204204
for (SILValue V : collectedVals) {
205205
addr2LocIdx.erase(V);
206206
}

tools/SourceKit/tools/sourcekitd-repl/sourcekitd-repl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,29 +91,29 @@ using Convert = ConvertForWcharSize<sizeof(wchar_t)>;
9191
static void convertFromUTF8(llvm::StringRef utf8,
9292
llvm::SmallVectorImpl<wchar_t> &out) {
9393
size_t reserve = out.size() + utf8.size();
94-
out.reserve(reserve);
94+
out.resize_for_overwrite(reserve);
9595
const char *utf8_begin = utf8.begin();
9696
wchar_t *wide_begin = out.end();
9797
auto res = Convert::ConvertFromUTF8(&utf8_begin, utf8.end(),
9898
&wide_begin, out.data() + reserve,
9999
lenientConversion);
100100
assert(res == conversionOK && "utf8-to-wide conversion failed!");
101101
(void)res;
102-
out.set_size(wide_begin - out.begin());
102+
out.truncate(wide_begin - out.begin());
103103
}
104104

105105
static void convertToUTF8(llvm::ArrayRef<wchar_t> wide,
106106
llvm::SmallVectorImpl<char> &out) {
107107
size_t reserve = out.size() + wide.size()*4;
108-
out.reserve(reserve);
108+
out.resize_for_overwrite(reserve);
109109
const wchar_t *wide_begin = wide.begin();
110110
char *utf8_begin = out.end();
111111
auto res = Convert::ConvertToUTF8(&wide_begin, wide.end(),
112112
&utf8_begin, out.data() + reserve,
113113
lenientConversion);
114114
assert(res == conversionOK && "wide-to-utf8 conversion failed!");
115115
(void)res;
116-
out.set_size(utf8_begin - out.begin());
116+
out.truncate(utf8_begin - out.begin());
117117
}
118118
} // end anonymous namespace
119119

0 commit comments

Comments
 (0)