Skip to content

Commit 0bf1389

Browse files
authored
Merge pull request swiftlang#40907 from apple/rebranch
Update swift:main to support llvm-project:stable/20211026 changes (Rebranch merge)
2 parents 6d4f2d9 + 32b5f85 commit 0bf1389

File tree

62 files changed

+209
-282
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+209
-282
lines changed

include/swift/Basic/APIntMap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ struct WidthPreservingAPIntDenseMapInfo {
3838
}
3939

4040
static unsigned getHashValue(const APInt &Key) {
41-
return static_cast<unsigned>(hash_value(Key));
41+
return llvm::DenseMapInfo<APInt>::getHashValue(Key);
4242
}
4343

4444
static bool isEqual(const APInt &LHS, const APInt &RHS) {
45-
return LHS.getBitWidth() == RHS.getBitWidth() && LHS == RHS;
45+
return llvm::DenseMapInfo<APInt>::isEqual(LHS, RHS);
4646
}
4747
};
4848

include/swift/Basic/ExponentialGrowthAppendingBinaryByteStream.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,29 @@ class ExponentialGrowthAppendingBinaryByteStream
4242

4343
llvm::support::endianness getEndian() const override { return Endian; }
4444

45-
llvm::Error readBytes(uint32_t Offset, uint32_t Size,
45+
llvm::Error readBytes(uint64_t Offset, uint64_t Size,
4646
ArrayRef<uint8_t> &Buffer) override;
4747

48-
llvm::Error readLongestContiguousChunk(uint32_t Offset,
48+
llvm::Error readLongestContiguousChunk(uint64_t Offset,
4949
ArrayRef<uint8_t> &Buffer) override;
5050

5151
MutableArrayRef<uint8_t> data() { return Data; }
5252

53-
uint32_t getLength() override { return Data.size(); }
53+
uint64_t getLength() override { return Data.size(); }
5454

55-
llvm::Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Buffer) override;
55+
llvm::Error writeBytes(uint64_t Offset, ArrayRef<uint8_t> Buffer) override;
5656

5757
/// This is an optimized version of \c writeBytes specifically for integers.
5858
/// Integers are written in little-endian byte order.
5959
template<typename T>
60-
llvm::Error writeInteger(uint32_t Offset, T Value) {
60+
llvm::Error writeInteger(uint64_t Offset, T Value) {
6161
static_assert(std::is_integral<T>::value, "Integer required.");
6262
if (auto Error = checkOffsetForWrite(Offset, sizeof(T))) {
6363
return Error;
6464
}
6565

6666
// Resize the internal buffer if needed.
67-
uint32_t RequiredSize = Offset + sizeof(T);
67+
uint64_t RequiredSize = Offset + sizeof(T);
6868
if (RequiredSize > Data.size()) {
6969
Data.resize(RequiredSize);
7070
}

include/swift/Basic/ExternalUnion.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424

2525
#include "llvm/Support/ErrorHandling.h"
2626
#include "swift/Basic/type_traits.h"
27+
#include <cassert>
28+
#include <cstdint>
2729
#include <utility>
28-
#include <assert.h>
2930

3031
namespace swift {
3132

include/swift/Demangling/TypeLookupError.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020

2121
#include "swift/Basic/TaggedUnion.h"
2222
#include "swift/Runtime/Portability.h"
23-
#include <string.h>
23+
#include <cstring>
24+
#include <string>
2425

2526
namespace swift {
2627

lib/AST/Availability.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ ASTContext::getSwift5PlusAvailability(llvm::VersionTuple swiftVersion) {
506506
default: break;
507507
}
508508
}
509-
llvm::report_fatal_error("Missing call to getSwiftXYAvailability for Swift " +
510-
swiftVersion.getAsString());
509+
llvm::report_fatal_error(
510+
Twine("Missing call to getSwiftXYAvailability for Swift ") +
511+
swiftVersion.getAsString());
511512
}

lib/AST/Builtins.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2208,18 +2208,17 @@ getSwiftFunctionTypeForIntrinsic(llvm::Intrinsic::ID ID,
22082208
return false;
22092209
ArgElts.push_back(ArgTy);
22102210
}
2211-
2211+
22122212
// Translate LLVM function attributes to Swift function attributes.
22132213
IntrinsicInfo II;
22142214
II.ID = ID;
22152215
auto attrs = II.getOrCreateAttributes(Context);
2216-
if (attrs.hasAttribute(llvm::AttributeList::FunctionIndex,
2217-
llvm::Attribute::NoReturn)) {
2216+
if (attrs.hasFnAttr(llvm::Attribute::NoReturn)) {
22182217
ResultTy = Context.getNeverType();
22192218
if (!ResultTy)
22202219
return false;
22212220
}
2222-
2221+
22232222
return true;
22242223
}
22252224

lib/Basic/ExponentialGrowthAppendingBinaryByteStream.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ using namespace llvm;
1616
using namespace swift;
1717

1818
Error ExponentialGrowthAppendingBinaryByteStream::readBytes(
19-
uint32_t Offset, uint32_t Size, ArrayRef<uint8_t> &Buffer) {
19+
uint64_t Offset, uint64_t Size, ArrayRef<uint8_t> &Buffer) {
2020
if (auto Error = checkOffsetForRead(Offset, Size)) {
2121
return Error;
2222
}
@@ -26,7 +26,7 @@ Error ExponentialGrowthAppendingBinaryByteStream::readBytes(
2626
}
2727

2828
Error ExponentialGrowthAppendingBinaryByteStream::readLongestContiguousChunk(
29-
uint32_t Offset, ArrayRef<uint8_t> &Buffer) {
29+
uint64_t Offset, ArrayRef<uint8_t> &Buffer) {
3030
if (auto Error = checkOffsetForRead(Offset, 0)) {
3131
return Error;
3232
}
@@ -40,7 +40,7 @@ void ExponentialGrowthAppendingBinaryByteStream::reserve(size_t Size) {
4040
}
4141

4242
Error ExponentialGrowthAppendingBinaryByteStream::writeBytes(
43-
uint32_t Offset, ArrayRef<uint8_t> Buffer) {
43+
uint64_t Offset, ArrayRef<uint8_t> Buffer) {
4444
if (Buffer.empty())
4545
return Error::success();
4646

@@ -49,7 +49,7 @@ Error ExponentialGrowthAppendingBinaryByteStream::writeBytes(
4949
}
5050

5151
// Resize the internal buffer if needed.
52-
uint32_t RequiredSize = Offset + Buffer.size();
52+
uint64_t RequiredSize = Offset + Buffer.size();
5353
if (RequiredSize > Data.size()) {
5454
Data.resize(RequiredSize);
5555
}

lib/ClangImporter/CFTypeInfo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
//
1515
//===----------------------------------------------------------------------===//
1616
#ifndef SWIFT_IMPORTER_CFTYPEINFO_H
17-
#define SWIFT_IMPORTER_CFTYPEINFO_H
17+
#define SWIFT_IMPORTER_CFTYPEINFO_H
1818

1919
#include "llvm/ADT/PointerUnion.h"
20+
#include "llvm/ADT/StringRef.h"
2021

2122
namespace clang {
2223
class RecordDecl;

lib/ClangImporter/ClangAdapter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ OmissionTypeName importer::getClangTypeNameForOmission(clang::ASTContext &ctx,
396396
case clang::BuiltinType::Float16:
397397
case clang::BuiltinType::Float128:
398398
case clang::BuiltinType::NullPtr:
399+
case clang::BuiltinType::Ibm128:
399400
return OmissionTypeName();
400401

401402
// Objective-C types that aren't mapped directly; rather, pointers to

lib/ClangImporter/ClangImporter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,10 @@ ClangImporter::create(ASTContext &ctx,
11301130

11311131
// Create a compiler instance.
11321132
{
1133+
// The Clang modules produced by ClangImporter are always embedded in an
1134+
// ObjectFilePCHContainer and contain -gmodules debug info.
1135+
importer->Impl.Invocation->getCodeGenOpts().DebugTypeExtRefs = true;
1136+
11331137
auto PCHContainerOperations =
11341138
std::make_shared<clang::PCHContainerOperations>();
11351139
PCHContainerOperations->registerWriter(

0 commit comments

Comments
 (0)