Skip to content

Merge rebranch and get next building #74371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
093bea2
Migrate to common OptTable macros
bnbarham Mar 15, 2024
624e0bf
Rename llvm::support::endianness to llvm::endianness
bnbarham Mar 14, 2024
814f2ee
Fix up various references to renamed/moved enums
bnbarham Mar 15, 2024
face772
Rename `ThreadPool` to `StdThreadPool`
bnbarham Mar 23, 2024
e85d61a
`FileEntry` to `FileEntryRef` updates
bnbarham Mar 23, 2024
bc5346b
[AST] Use erase instead of erase_value
bnbarham Mar 15, 2024
162d859
[Basic] Handle added/removed triples
bnbarham Mar 15, 2024
f9dd661
[Driver] Update argument to `SmallVectorImpl` instead of `std::vector`
bnbarham Mar 15, 2024
bb72c19
[Driver] Fix up `AddAllArgs`
bnbarham Mar 15, 2024
2787d72
[ClangImporter] Add empty visit implementation for new types
bnbarham Mar 26, 2024
e81f3f0
[ClangImporter] Rename `mangleTypeName` to `mangleCanonicalTypeName`
bnbarham Mar 15, 2024
ceb2b40
[ClangImporter] Add missing include for `llvm::size`
bnbarham Mar 22, 2024
076ee37
[ClangImporter] Add `readDeclAs` reader implementation
bnbarham Mar 22, 2024
de50a2c
[ClangImporter] Use new `CXXThisExpr::Create` function
bnbarham Mar 22, 2024
5c608c6
[ClangImporter] Remove `ClassScopeFunctionSpecializationDecl`
bnbarham Mar 22, 2024
02e032f
[ClangImporter] Copy `APSInt` rather than taking its address
bnbarham Mar 22, 2024
dc4a505
[ClangImporter] Rename `CXXMethodDecl::isPure` to `isVirtualPure`
bnbarham Mar 22, 2024
286b9a1
[ClangImporter] Update moved `isSimpleTypeSpecifier` reference
bnbarham Mar 22, 2024
58fa8c9
[ClangImporter] Rename `SwiftVersionedAttr` to `SwiftVersionedAdditio…
bnbarham Mar 30, 2024
a49ac2f
[ClangImporter] Handle new `TypeCoupledDeclRefInfo`
bnbarham Mar 30, 2024
e09f6bb
[Coverage] Bump coverage version to match clang
bnbarham Mar 23, 2024
06fdb5f
[IRGen] Rename `InstrProfiling` to `InstrProfilingLoweringPass`
bnbarham Mar 23, 2024
1f43a75
[IRGen] Remove bitcasts and zext and sext constant expressions
bnbarham Mar 23, 2024
2d32518
[IRGen] Start cleaning up typed pointers
bnbarham Mar 26, 2024
0da9c9f
[IRGen] Update `DbgIntrinsicEmitter::insert` functions to `DbgInstPtr`
bnbarham Mar 26, 2024
0e8f049
[IRGen] Add missing case for `ArrayParameter`
bnbarham Apr 3, 2024
c56cac8
[IRGen] Add type arguments to stacksave and stackrestore
bnbarham Apr 4, 2024
9585150
[Opt] Move uses of FunctionHash to StructuralHash
bnbarham Mar 15, 2024
2845445
[Opt] Make sure to set `IsNewDbgInfoFormat` when creating functions
bnbarham Apr 8, 2024
4a58901
[SIL] Add has_iterators_bits to the node options for a SILInstruction…
bnbarham Mar 14, 2024
109069f
[Test] Update `verify-fixits.swift` after upstream FileCheck change
bnbarham Apr 30, 2024
1f6f4ac
[ClangImporter] Fix up for CountAttributedType and TypeCoupledDeclRef…
rapidsna Apr 30, 2024
cd52115
IRGen: Fix some test cases for llvm rebranch
aschwaighofer May 1, 2024
fa5b2e3
Fix test IRGen/large_argument_result_c.swift
aschwaighofer May 2, 2024
4c30e2c
[Rebranch] Test: Redefine some macros.
nate-chandler May 2, 2024
6689ab4
[rebranch] Fix validation-test/IRGen/pack_stack_metadata_alloc_loop.sil
aschwaighofer May 3, 2024
58efa55
[Test] Un-xfail passing load-target-normalization.swift test
bnbarham May 16, 2024
51d7799
[cxx-interop][rebranch] Fix an IRGen test
egorzhdan May 21, 2024
e75a170
[Test] Fix signature mismatch in issue-58123-invalid-debug-info.swift
drexin May 21, 2024
cbd1d86
[Test] Require arm64 in pack_stack_metadata_alloc_loop.sil
drexin May 23, 2024
ae81bf0
[ClangImporter] Add missing include
bnbarham Jun 6, 2024
c2ef48d
[ClangImporter] Handle `DefaultArgument` now being a `TemplateArgment…
bnbarham Jun 6, 2024
01d8343
[ClangImporter] Add various `const`
bnbarham Jun 6, 2024
cbd40c5
[ClangImporter] Handle split sema
bnbarham Jun 6, 2024
0470156
[ClangImporter] Handle `pair` to actual struct change
bnbarham Jun 6, 2024
3a66b0f
[ClangImporter] Add initial empty handling for `UnresolvedTemplate`
bnbarham Jun 6, 2024
3229ac2
[ClangImporter] Use new `LocalDeclID`
bnbarham Jun 6, 2024
80d60de
[ClangImporter] Rename `isUnnamedBitfield` to `isUnnamedBitField`
bnbarham Jun 7, 2024
e4b8f23
[ClangImporter] Rename `OMPArraySection` to `ArraySection`
bnbarham Jun 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/swift/AST/PluginRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class LoadedExecutablePlugin {

/// Remove "on reconnect" callback.
void removeOnReconnect(std::function<void(void)> *fn) {
llvm::erase_value(onReconnect, fn);
llvm::erase(onReconnect, fn);
}

llvm::sys::procid_t getPid() { return Process->process.Pid; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "swift/Basic/LLVM.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/BinaryByteStream.h"
#include "llvm/Support/Endian.h"

namespace swift {

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

/// Data in the stream is always encoded in little-endian byte order.
const llvm::support::endianness Endian = llvm::support::endianness::little;
const llvm::endianness Endian = llvm::endianness::little;

public:
ExponentialGrowthAppendingBinaryByteStream() = default;

void reserve(size_t Size);

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

llvm::Error readBytes(uint64_t Offset, uint64_t Size,
ArrayRef<uint8_t> &Buffer) override;
Expand Down
4 changes: 2 additions & 2 deletions include/swift/Basic/StableHasher.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class StableHasher final {
return setBufferLength(bufLen + N);
}

constexpr auto endian = llvm::support::endianness::little;
constexpr auto endian = llvm::endianness::little;
compress(llvm::support::endian::read<uint64_t>(byteBuffer, endian));

// Now reseed the buffer with the remaining bytes.
Expand All @@ -146,7 +146,7 @@ class StableHasher final {
typename T,
typename std::enable_if<std::is_integral<T>::value>::type * = nullptr>
void combine(T bits) {
constexpr auto endian = llvm::support::endianness::little;
constexpr auto endian = llvm::endianness::little;
uint8_t buf[sizeof(T)] = {0};
bits = llvm::support::endian::byte_swap<T>(bits, endian);
std::memcpy(buf, &bits, sizeof(T));
Expand Down
1 change: 1 addition & 0 deletions include/swift/ClangImporter/ClangModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "swift/Basic/Version.h"
#include "swift/ClangImporter/ClangImporter.h"
#include "clang/AST/ExternalASTSource.h"
#include "clang/Basic/ASTSourceDescriptor.h"
#include "clang/Basic/Module.h"

namespace clang {
Expand Down
7 changes: 6 additions & 1 deletion include/swift/ClangImporter/SwiftAbstractBasicReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class DataStreamBasicReader
return clang::Selector();

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

Expand All @@ -94,6 +94,11 @@ class DataStreamBasicReader
llvm::report_fatal_error("Read BTFTypeTagAttr that should never have been"
" serialized");
}

template<typename T>
T *readDeclAs() {
return asImpl().template readDeclAs<T>();
}
};

}
Expand Down
2 changes: 1 addition & 1 deletion include/swift/DependencyScan/ModuleDependencyScanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class ModuleDependencyScanner {
/// The available pool of workers for filesystem module search
unsigned NumThreads;
std::list<std::unique_ptr<ModuleDependencyScanningWorker>> Workers;
llvm::ThreadPool ScanningThreadPool;
llvm::StdThreadPool ScanningThreadPool;
/// Protect worker access.
std::mutex WorkersLock;
};
Expand Down
14 changes: 8 additions & 6 deletions include/swift/Localization/LocalizationFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ enum class DiagID : uint32_t;

namespace diag {

using namespace llvm::support;

enum LocalizationProducerState : uint8_t {
NotInitialized,
Initialized,
Expand Down Expand Up @@ -77,14 +75,15 @@ class LocalizationWriterInfo {
key_type_ref key,
data_type_ref data) {
offset_type dataLength = static_cast<offset_type>(data.size());
endian::write<offset_type>(out, dataLength, little);
llvm::support::endian::write<offset_type>(out, dataLength,
llvm::endianness::little);
// No need to write the key length; it's constant.
return {sizeof(key_type), dataLength};
}

void EmitKey(llvm::raw_ostream &out, key_type_ref key, unsigned len) {
assert(len == sizeof(key_type));
endian::write<key_type>(out, key, little);
llvm::support::endian::write<key_type>(out, key, llvm::endianness::little);
}

void EmitData(llvm::raw_ostream &out, key_type_ref key, data_type_ref data,
Expand Down Expand Up @@ -120,12 +119,15 @@ class LocalizationReaderInfo {
static std::pair<offset_type, offset_type>
ReadKeyDataLength(const unsigned char *&data) {
offset_type dataLength =
endian::readNext<offset_type, little, unaligned>(data);
llvm::support::endian::readNext<offset_type, llvm::endianness::little,
llvm::support::unaligned>(data);
return {sizeof(uint32_t), dataLength};
}

internal_key_type ReadKey(const unsigned char *data, offset_type length) {
return endian::readNext<internal_key_type, little, unaligned>(data);
return llvm::support::endian::readNext<
internal_key_type, llvm::endianness::little, llvm::support::unaligned>(
data);
}

data_type ReadData(internal_key_type Key, const unsigned char *data,
Expand Down
12 changes: 3 additions & 9 deletions include/swift/Option/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@
#ifndef SWIFT_OPTION_OPTIONS_H
#define SWIFT_OPTION_OPTIONS_H

#include <memory>
#include "llvm/Option/OptTable.h"

namespace llvm {
namespace opt {
class OptTable;
}
}
#include <memory>

namespace swift {
namespace options {
Expand Down Expand Up @@ -49,9 +45,7 @@ namespace options {

enum ID {
OPT_INVALID = 0, // This is not an option ID.
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
HELPTEXT, METAVAR, VALUES) \
OPT_##ID,
#define OPTION(...) LLVM_MAKE_OPT_ID(__VA_ARGS__),
#include "swift/Option/Options.inc"
LastOption
#undef OPTION
Expand Down
1 change: 1 addition & 0 deletions include/swift/SIL/SILInstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ template <> struct compute_node_options<::swift::SILInstruction> {

static const bool enable_sentinel_tracking = false;
static const bool is_sentinel_tracking_explicit = false;
static const bool has_iterator_bits = false;
typedef void tag;
typedef ilist_node_base<enable_sentinel_tracking> node_base_type;
typedef SILInstructionListBase list_base_type;
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/ASTMangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3038,7 +3038,7 @@ void ASTMangler::appendClangType(FnType *fn, llvm::raw_svector_ostream &out) {
fn->getASTContext().getClangModuleLoader()->getClangASTContext();
std::unique_ptr<clang::ItaniumMangleContext> mangler{
clang::ItaniumMangleContext::create(clangCtx, clangCtx.getDiagnostics())};
mangler->mangleTypeName(clang::QualType(clangType, 0), scratchOS);
mangler->mangleCanonicalTypeName(clang::QualType(clangType, 0), scratchOS);
out << scratchOS.str().size() << scratchOS.str();
}

Expand Down
22 changes: 11 additions & 11 deletions lib/AST/ClangTypeConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ clang::QualType ClangTypeConverter::convertMemberType(NominalTypeDecl *DC,
// we could recover in some other way.
static clang::QualType getClangVectorType(const clang::ASTContext &ctx,
clang::BuiltinType::Kind eltKind,
clang::VectorType::VectorKind vecKind,
clang::VectorKind vecKind,
StringRef numEltsString) {
unsigned numElts;
bool failedParse = numEltsString.getAsInteger<unsigned>(10, numElts);
Expand Down Expand Up @@ -268,11 +268,11 @@ clang::QualType ClangTypeConverter::visitStructType(StructType *type) {
#undef CHECK_NAMED_TYPE

// Map vector types to the corresponding C vectors.
#define MAP_SIMD_TYPE(TYPE_NAME, _, BUILTIN_KIND) \
if (name.starts_with(#TYPE_NAME)) { \
return getClangVectorType(ctx, clang::BuiltinType::BUILTIN_KIND, \
clang::VectorType::GenericVector, \
name.drop_front(sizeof(#TYPE_NAME)-1)); \
#define MAP_SIMD_TYPE(TYPE_NAME, _, BUILTIN_KIND) \
if (name.starts_with(#TYPE_NAME)) { \
return getClangVectorType(ctx, clang::BuiltinType::BUILTIN_KIND, \
clang::VectorKind::Generic, \
name.drop_front(sizeof(#TYPE_NAME) - 1)); \
}
#include "swift/ClangImporter/SIMDMappedTypes.def"

Expand Down Expand Up @@ -427,8 +427,8 @@ clang::QualType ClangTypeConverter::visitTupleType(TupleType *type) {
return clang::QualType();

APInt size(32, tupleNumElements);
return ClangASTContext.getConstantArrayType(clangEltTy, size, nullptr,
clang::ArrayType::Normal, 0);
return ClangASTContext.getConstantArrayType(
clangEltTy, size, nullptr, clang::ArraySizeModifier::Normal, 0);
}

clang::QualType ClangTypeConverter::visitProtocolType(ProtocolType *type) {
Expand Down Expand Up @@ -617,7 +617,7 @@ ClangTypeConverter::visitBoundGenericType(BoundGenericType *type) {
return clang::QualType();
(void) failedParse;
auto vectorTy = ClangASTContext.getVectorType(scalarTy, numElts,
clang::VectorType::VectorKind::GenericVector);
clang::VectorKind::Generic);
return vectorTy;
}
}
Expand Down Expand Up @@ -890,8 +890,8 @@ ClangTypeConverter::getClangTemplateArguments(
auto templateParam = cast<clang::TemplateTypeParmDecl>(param);
// We must have found a defaulted parameter at the end of the list.
if (templateParam->getIndex() >= genericArgs.size()) {
templateArgs.push_back(
clang::TemplateArgument(templateParam->getDefaultArgument()));
templateArgs.push_back(clang::TemplateArgument(
templateParam->getDefaultArgument().getArgument()));
continue;
}

Expand Down
8 changes: 4 additions & 4 deletions lib/AST/PluginRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ llvm::Error LoadedExecutablePlugin::sendMessage(llvm::StringRef message) const {
size_t size = message.size();

// Write header (message size).
uint64_t header = llvm::support::endian::byte_swap(
uint64_t(size), llvm::support::endianness::little);
uint64_t header = llvm::support::endian::byte_swap(uint64_t(size),
llvm::endianness::little);
writtenSize = Process->write(&header, sizeof(header));
if (writtenSize != sizeof(header)) {
setStale();
Expand Down Expand Up @@ -304,8 +304,8 @@ llvm::Expected<std::string> LoadedExecutablePlugin::waitForNextMessage() const {
"failed to read plugin message header");
}

size_t size = llvm::support::endian::read<uint64_t>(
&header, llvm::support::endianness::little);
size_t size =
llvm::support::endian::read<uint64_t>(&header, llvm::endianness::little);

// Read message.
std::string message;
Expand Down
31 changes: 15 additions & 16 deletions lib/Basic/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,32 +196,31 @@ static StringRef getPlatformNameForDarwin(const DarwinPlatformKind platform) {

StringRef swift::getPlatformNameForTriple(const llvm::Triple &triple) {
switch (triple.getOS()) {
case llvm::Triple::ZOS:
case llvm::Triple::Ananas:
case llvm::Triple::CloudABI:
case llvm::Triple::AIX:
case llvm::Triple::AMDHSA:
case llvm::Triple::AMDPAL:
case llvm::Triple::BridgeOS:
case llvm::Triple::CUDA:
case llvm::Triple::DragonFly:
case llvm::Triple::DriverKit:
case llvm::Triple::ELFIAMCU:
case llvm::Triple::Emscripten:
case llvm::Triple::Fuchsia:
case llvm::Triple::HermitCore:
case llvm::Triple::Hurd:
case llvm::Triple::KFreeBSD:
case llvm::Triple::Lv2:
case llvm::Triple::Mesa3D:
case llvm::Triple::NaCl:
case llvm::Triple::NetBSD:
case llvm::Triple::NVCL:
case llvm::Triple::PS5:
case llvm::Triple::RTEMS:
case llvm::Triple::Serenity:
case llvm::Triple::ShaderModel:
case llvm::Triple::Solaris:
case llvm::Triple::Minix:
case llvm::Triple::RTEMS:
case llvm::Triple::NaCl:
case llvm::Triple::AIX:
case llvm::Triple::CUDA:
case llvm::Triple::NVCL:
case llvm::Triple::AMDHSA:
case llvm::Triple::ELFIAMCU:
case llvm::Triple::Mesa3D:
case llvm::Triple::Contiki:
case llvm::Triple::AMDPAL:
case llvm::Triple::HermitCore:
case llvm::Triple::Hurd:
case llvm::Triple::Vulkan:
case llvm::Triple::ZOS:
return "";
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
Expand Down
5 changes: 3 additions & 2 deletions lib/ClangImporter/ClangAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ OmissionTypeName importer::getClangTypeNameForOmission(clang::ASTContext &ctx,
case clang::BuiltinType::Overload:
case clang::BuiltinType::PseudoObject:
case clang::BuiltinType::UnknownAny:
case clang::BuiltinType::UnresolvedTemplate:
return OmissionTypeName();

// FIXME: Types that can be mapped, but aren't yet.
Expand Down Expand Up @@ -464,7 +465,7 @@ OmissionTypeName importer::getClangTypeNameForOmission(clang::ASTContext &ctx,
return OmissionTypeName();

// OpenMP types that don't have Swift equivalents.
case clang::BuiltinType::OMPArraySection:
case clang::BuiltinType::ArraySection:
case clang::BuiltinType::OMPArrayShaping:
case clang::BuiltinType::OMPIterator:
return OmissionTypeName();
Expand Down Expand Up @@ -776,7 +777,7 @@ OptionalTypeKind importer::getParamOptionality(const clang::ParmVarDecl *param,
// Check for the 'static' annotation on C arrays.
if (const auto *DT = dyn_cast<clang::DecayedType>(paramTy))
if (const auto *AT = DT->getOriginalType()->getAsArrayTypeUnsafe())
if (AT->getSizeModifier() == clang::ArrayType::Static)
if (AT->getSizeModifier() == clang::ArraySizeModifier::Static)
return OTK_None;

// Default to implicitly unwrapped optionals.
Expand Down
4 changes: 2 additions & 2 deletions lib/ClangImporter/ClangDerivedConformances.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ instantiateTemplatedOperator(ClangImporter::Implementation &impl,

clang::UnresolvedSet<1> ops;
auto qualType = clang::QualType(classDecl->getTypeForDecl(), 0);
auto arg = new (clangCtx)
clang::CXXThisExpr(clang::SourceLocation(), qualType, false);
auto arg = clang::CXXThisExpr::Create(clangCtx, clang::SourceLocation(),
qualType, false);
arg->setType(clang::QualType(classDecl->getTypeForDecl(), 0));

clang::OverloadedOperatorKind opKind =
Expand Down
Loading