Skip to content

Commit 560fe75

Browse files
authored
Merge pull request #77212 from bnbarham/2024-rebranch-to-main
Update LLVM to stable/20240723
2 parents 71e3136 + f59b2f1 commit 560fe75

File tree

227 files changed

+1809
-1570
lines changed

Some content is hidden

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

227 files changed

+1809
-1570
lines changed

include/swift/AST/PluginRegistry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class CompilerPlugin {
8787

8888
/// Remove "on reconnect" callback.
8989
void removeOnReconnect(std::function<void(void)> *fn) {
90-
llvm::erase_value(onReconnect, fn);
90+
llvm::erase(onReconnect, fn);
9191
}
9292

9393
ArrayRef<std::function<void(void)> *> getOnReconnectCallbacks() {

include/swift/Basic/ExponentialGrowthAppendingBinaryByteStream.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "swift/Basic/LLVM.h"
2424
#include "llvm/ADT/ArrayRef.h"
2525
#include "llvm/Support/BinaryByteStream.h"
26+
#include "llvm/Support/Endian.h"
2627

2728
namespace swift {
2829

@@ -34,13 +35,14 @@ class ExponentialGrowthAppendingBinaryByteStream
3435
SmallVector<uint8_t, 0> Data;
3536

3637
/// Data in the stream is always encoded in little-endian byte order.
37-
const llvm::support::endianness Endian = llvm::support::endianness::little;
38+
const llvm::endianness Endian = llvm::endianness::little;
39+
3840
public:
3941
ExponentialGrowthAppendingBinaryByteStream() = default;
4042

4143
void reserve(size_t Size);
4244

43-
llvm::support::endianness getEndian() const override { return Endian; }
45+
llvm::endianness getEndian() const override { return Endian; }
4446

4547
llvm::Error readBytes(uint64_t Offset, uint64_t Size,
4648
ArrayRef<uint8_t> &Buffer) override;

include/swift/Basic/StableHasher.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class StableHasher final {
133133
return setBufferLength(bufLen + N);
134134
}
135135

136-
constexpr auto endian = llvm::support::endianness::little;
136+
constexpr auto endian = llvm::endianness::little;
137137
compress(llvm::support::endian::read<uint64_t>(byteBuffer, endian));
138138

139139
// Now reseed the buffer with the remaining bytes.
@@ -146,7 +146,7 @@ class StableHasher final {
146146
typename T,
147147
typename std::enable_if<std::is_integral<T>::value>::type * = nullptr>
148148
void combine(T bits) {
149-
constexpr auto endian = llvm::support::endianness::little;
149+
constexpr auto endian = llvm::endianness::little;
150150
uint8_t buf[sizeof(T)] = {0};
151151
bits = llvm::support::endian::byte_swap<T>(bits, endian);
152152
std::memcpy(buf, &bits, sizeof(T));

include/swift/ClangImporter/ClangModule.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "swift/Basic/Version.h"
2121
#include "swift/ClangImporter/ClangImporter.h"
2222
#include "clang/AST/ExternalASTSource.h"
23+
#include "clang/Basic/ASTSourceDescriptor.h"
2324
#include "clang/Basic/Module.h"
2425

2526
namespace clang {

include/swift/ClangImporter/SwiftAbstractBasicReader.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class DataStreamBasicReader
7272
return clang::Selector();
7373

7474
unsigned numArgs = unsigned(numArgsPlusOne - 1);
75-
SmallVector<clang::IdentifierInfo *, 4> chunks;
75+
SmallVector<const clang::IdentifierInfo *, 4> chunks;
7676
for (unsigned i = 0, e = std::max(numArgs, 1U); i != e; ++i)
7777
chunks.push_back(asImpl().readIdentifier());
7878

@@ -94,6 +94,11 @@ class DataStreamBasicReader
9494
llvm::report_fatal_error("Read BTFTypeTagAttr that should never have been"
9595
" serialized");
9696
}
97+
98+
template<typename T>
99+
T *readDeclAs() {
100+
return asImpl().template readDeclAs<T>();
101+
}
97102
};
98103

99104
}

include/swift/DependencyScan/ModuleDependencyScanner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class ModuleDependencyScanner {
149149
/// The available pool of workers for filesystem module search
150150
unsigned NumThreads;
151151
std::list<std::unique_ptr<ModuleDependencyScanningWorker>> Workers;
152-
llvm::ThreadPool ScanningThreadPool;
152+
llvm::StdThreadPool ScanningThreadPool;
153153
/// Protect worker access.
154154
std::mutex WorkersLock;
155155
};

include/swift/Localization/LocalizationFormat.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ enum class DiagID : uint32_t;
4040

4141
namespace diag {
4242

43-
using namespace llvm::support;
44-
4543
enum LocalizationProducerState : uint8_t {
4644
NotInitialized,
4745
Initialized,
@@ -77,14 +75,15 @@ class LocalizationWriterInfo {
7775
key_type_ref key,
7876
data_type_ref data) {
7977
offset_type dataLength = static_cast<offset_type>(data.size());
80-
endian::write<offset_type>(out, dataLength, little);
78+
llvm::support::endian::write<offset_type>(out, dataLength,
79+
llvm::endianness::little);
8180
// No need to write the key length; it's constant.
8281
return {sizeof(key_type), dataLength};
8382
}
8483

8584
void EmitKey(llvm::raw_ostream &out, key_type_ref key, unsigned len) {
8685
assert(len == sizeof(key_type));
87-
endian::write<key_type>(out, key, little);
86+
llvm::support::endian::write<key_type>(out, key, llvm::endianness::little);
8887
}
8988

9089
void EmitData(llvm::raw_ostream &out, key_type_ref key, data_type_ref data,
@@ -118,12 +117,15 @@ class LocalizationReaderInfo {
118117
static std::pair<offset_type, offset_type>
119118
ReadKeyDataLength(const unsigned char *&data) {
120119
offset_type dataLength =
121-
endian::readNext<offset_type, little, unaligned>(data);
120+
llvm::support::endian::readNext<offset_type, llvm::endianness::little,
121+
llvm::support::unaligned>(data);
122122
return {sizeof(uint32_t), dataLength};
123123
}
124124

125125
internal_key_type ReadKey(const unsigned char *data, offset_type length) {
126-
return endian::readNext<internal_key_type, little, unaligned>(data);
126+
return llvm::support::endian::readNext<
127+
internal_key_type, llvm::endianness::little, llvm::support::unaligned>(
128+
data);
127129
}
128130

129131
data_type ReadData(internal_key_type Key, const unsigned char *data,

include/swift/Option/Options.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@
1313
#ifndef SWIFT_OPTION_OPTIONS_H
1414
#define SWIFT_OPTION_OPTIONS_H
1515

16-
#include <memory>
16+
#include "llvm/Option/OptTable.h"
1717

18-
namespace llvm {
19-
namespace opt {
20-
class OptTable;
21-
}
22-
}
18+
#include <memory>
2319

2420
namespace swift {
2521
namespace options {
@@ -47,9 +43,7 @@ namespace options {
4743

4844
enum ID {
4945
OPT_INVALID = 0, // This is not an option ID.
50-
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
51-
HELPTEXT, METAVAR, VALUES) \
52-
OPT_##ID,
46+
#define OPTION(...) LLVM_MAKE_OPT_ID(__VA_ARGS__),
5347
#include "swift/Option/Options.inc"
5448
LastOption
5549
#undef OPTION

include/swift/SIL/SILInstruction.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace ilist_detail {
5959
///
6060
/// We need a custom base class to not clear the prev/next pointers when
6161
/// removing an instruction from the list.
62-
class SILInstructionListBase : public ilist_base<false> {
62+
class SILInstructionListBase : public ilist_base<false, void> {
6363
public:
6464
/// Remove an instruction from the list.
6565
///
@@ -95,8 +95,10 @@ template <> struct compute_node_options<::swift::SILInstruction> {
9595

9696
static const bool enable_sentinel_tracking = false;
9797
static const bool is_sentinel_tracking_explicit = false;
98+
static const bool has_iterator_bits = false;
9899
typedef void tag;
99-
typedef ilist_node_base<enable_sentinel_tracking> node_base_type;
100+
typedef void parent_ty;
101+
typedef ilist_node_base<enable_sentinel_tracking, void> node_base_type;
100102
typedef SILInstructionListBase list_base_type;
101103
};
102104
};

lib/AST/ASTMangler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3075,7 +3075,7 @@ void ASTMangler::appendClangType(FnType *fn, llvm::raw_svector_ostream &out) {
30753075
fn->getASTContext().getClangModuleLoader()->getClangASTContext();
30763076
std::unique_ptr<clang::ItaniumMangleContext> mangler{
30773077
clang::ItaniumMangleContext::create(clangCtx, clangCtx.getDiagnostics())};
3078-
mangler->mangleTypeName(clang::QualType(clangType, 0), scratchOS);
3078+
mangler->mangleCanonicalTypeName(clang::QualType(clangType, 0), scratchOS);
30793079
out << scratchOS.str().size() << scratchOS.str();
30803080
}
30813081

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3597,7 +3597,7 @@ void PrintAST::visitEnumDecl(EnumDecl *decl) {
35973597
dyn_cast_or_null<clang::NamespaceDecl>(decl->getClangDecl())) {
35983598
// Enum that correponds to the C++ namespace should only be printed once.
35993599
if (!Printer.shouldPrintRedeclaredClangDecl(
3600-
namespaceDecl->getOriginalNamespace()))
3600+
namespaceDecl->getFirstDecl()))
36013601
return;
36023602

36033603
if (Options.SkipInlineCXXNamespace && namespaceDecl->isInline()) {

lib/AST/ClangTypeConverter.cpp

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,14 @@ getClangBuiltinTypeFromKind(const clang::ASTContext &context,
7575
case clang::BuiltinType::Id: \
7676
return context.Id##Ty;
7777
#include "clang/Basic/RISCVVTypes.def"
78-
#define WASM_REF_TYPE(Name, MangedNameBase, Id, SingletonId, AS) \
78+
#define WASM_REF_TYPE(Name, MangledNameBase, Id, SingletonId, AS) \
7979
case clang::BuiltinType::Id: \
8080
return context.SingletonId;
8181
#include "clang/Basic/WebAssemblyReferenceTypes.def"
82+
#define AMDGPU_TYPE(Name, Id, SingletonId) \
83+
case clang::BuiltinType::Id: \
84+
return context.SingletonId;
85+
#include "clang/Basic/AMDGPUTypes.def"
8286
}
8387

8488
// Not a valid BuiltinType.
@@ -228,7 +232,7 @@ clang::QualType ClangTypeConverter::convertMemberType(NominalTypeDecl *DC,
228232
// we could recover in some other way.
229233
static clang::QualType getClangVectorType(const clang::ASTContext &ctx,
230234
clang::BuiltinType::Kind eltKind,
231-
clang::VectorType::VectorKind vecKind,
235+
clang::VectorKind vecKind,
232236
StringRef numEltsString) {
233237
unsigned numElts;
234238
bool failedParse = numEltsString.getAsInteger<unsigned>(10, numElts);
@@ -269,11 +273,11 @@ clang::QualType ClangTypeConverter::visitStructType(StructType *type) {
269273
#undef CHECK_NAMED_TYPE
270274

271275
// Map vector types to the corresponding C vectors.
272-
#define MAP_SIMD_TYPE(TYPE_NAME, _, BUILTIN_KIND) \
273-
if (name.starts_with(#TYPE_NAME)) { \
274-
return getClangVectorType(ctx, clang::BuiltinType::BUILTIN_KIND, \
275-
clang::VectorType::GenericVector, \
276-
name.drop_front(sizeof(#TYPE_NAME)-1)); \
276+
#define MAP_SIMD_TYPE(TYPE_NAME, _, BUILTIN_KIND) \
277+
if (name.starts_with(#TYPE_NAME)) { \
278+
return getClangVectorType(ctx, clang::BuiltinType::BUILTIN_KIND, \
279+
clang::VectorKind::Generic, \
280+
name.drop_front(sizeof(#TYPE_NAME) - 1)); \
277281
}
278282
#include "swift/ClangImporter/SIMDMappedTypes.def"
279283

@@ -428,8 +432,8 @@ clang::QualType ClangTypeConverter::visitTupleType(TupleType *type) {
428432
return clang::QualType();
429433

430434
APInt size(32, tupleNumElements);
431-
return ClangASTContext.getConstantArrayType(clangEltTy, size, nullptr,
432-
clang::ArrayType::Normal, 0);
435+
return ClangASTContext.getConstantArrayType(
436+
clangEltTy, size, nullptr, clang::ArraySizeModifier::Normal, 0);
433437
}
434438

435439
clang::QualType ClangTypeConverter::visitProtocolType(ProtocolType *type) {
@@ -618,7 +622,7 @@ ClangTypeConverter::visitBoundGenericType(BoundGenericType *type) {
618622
return clang::QualType();
619623
(void) failedParse;
620624
auto vectorTy = ClangASTContext.getVectorType(scalarTy, numElts,
621-
clang::VectorType::VectorKind::GenericVector);
625+
clang::VectorKind::Generic);
622626
return vectorTy;
623627
}
624628
}
@@ -895,8 +899,8 @@ ClangTypeConverter::getClangTemplateArguments(
895899
auto templateParam = cast<clang::TemplateTypeParmDecl>(param);
896900
// We must have found a defaulted parameter at the end of the list.
897901
if (templateParam->getIndex() >= genericArgs.size()) {
898-
templateArgs.push_back(
899-
clang::TemplateArgument(templateParam->getDefaultArgument()));
902+
templateArgs.push_back(clang::TemplateArgument(
903+
templateParam->getDefaultArgument().getArgument()));
900904
continue;
901905
}
902906

lib/AST/NameLookup.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
#include "llvm/Support/Debug.h"
5151
#include "llvm/Support/raw_ostream.h"
5252

53+
#include <deque>
54+
5355
#define DEBUG_TYPE "namelookup"
5456

5557
using namespace swift;

lib/AST/PluginRegistry.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,8 @@ llvm::Error LoadedExecutablePlugin::sendMessage(llvm::StringRef message) {
352352
size_t size = message.size();
353353

354354
// Write header (message size).
355-
uint64_t header = llvm::support::endian::byte_swap(
356-
uint64_t(size), llvm::support::endianness::little);
355+
uint64_t header = llvm::support::endian::byte_swap(uint64_t(size),
356+
llvm::endianness::little);
357357
writtenSize = Process->write(&header, sizeof(header));
358358
if (writtenSize != sizeof(header)) {
359359
setStale();
@@ -385,8 +385,8 @@ llvm::Expected<std::string> LoadedExecutablePlugin::waitForNextMessage() {
385385
"failed to read plugin message header");
386386
}
387387

388-
size_t size = llvm::support::endian::read<uint64_t>(
389-
&header, llvm::support::endianness::little);
388+
size_t size =
389+
llvm::support::endian::read<uint64_t>(&header, llvm::endianness::little);
390390

391391
// Read message.
392392
std::string message;

lib/AST/RequirementMachine/KnuthBendix.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include "llvm/Support/Debug.h"
3535
#include "llvm/Support/raw_ostream.h"
3636
#include <algorithm>
37-
#include <deque>
3837
#include <vector>
3938

4039
#include "RewriteContext.h"

lib/Basic/Platform.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -197,32 +197,31 @@ static StringRef getPlatformNameForDarwin(const DarwinPlatformKind platform) {
197197

198198
StringRef swift::getPlatformNameForTriple(const llvm::Triple &triple) {
199199
switch (triple.getOS()) {
200-
case llvm::Triple::ZOS:
201-
case llvm::Triple::Ananas:
202-
case llvm::Triple::CloudABI:
200+
case llvm::Triple::AIX:
201+
case llvm::Triple::AMDHSA:
202+
case llvm::Triple::AMDPAL:
203+
case llvm::Triple::BridgeOS:
204+
case llvm::Triple::CUDA:
203205
case llvm::Triple::DragonFly:
204206
case llvm::Triple::DriverKit:
207+
case llvm::Triple::ELFIAMCU:
205208
case llvm::Triple::Emscripten:
206209
case llvm::Triple::Fuchsia:
210+
case llvm::Triple::HermitCore:
211+
case llvm::Triple::Hurd:
207212
case llvm::Triple::KFreeBSD:
208213
case llvm::Triple::Lv2:
214+
case llvm::Triple::Mesa3D:
215+
case llvm::Triple::NaCl:
209216
case llvm::Triple::NetBSD:
217+
case llvm::Triple::NVCL:
210218
case llvm::Triple::PS5:
219+
case llvm::Triple::RTEMS:
220+
case llvm::Triple::Serenity:
211221
case llvm::Triple::ShaderModel:
212222
case llvm::Triple::Solaris:
213-
case llvm::Triple::Minix:
214-
case llvm::Triple::RTEMS:
215-
case llvm::Triple::NaCl:
216-
case llvm::Triple::AIX:
217-
case llvm::Triple::CUDA:
218-
case llvm::Triple::NVCL:
219-
case llvm::Triple::AMDHSA:
220-
case llvm::Triple::ELFIAMCU:
221-
case llvm::Triple::Mesa3D:
222-
case llvm::Triple::Contiki:
223-
case llvm::Triple::AMDPAL:
224-
case llvm::Triple::HermitCore:
225-
case llvm::Triple::Hurd:
223+
case llvm::Triple::Vulkan:
224+
case llvm::Triple::ZOS:
226225
return "";
227226
case llvm::Triple::Darwin:
228227
case llvm::Triple::MacOSX:

0 commit comments

Comments
 (0)