Skip to content

Commit aa6a588

Browse files
authored
Merge pull request #69163 from apple/rebranch
Merge `rebranch` into `main` to support `stable/20230725` llvm-project branch
2 parents e950a2f + 69c807a commit aa6a588

File tree

395 files changed

+19845
-2450
lines changed

Some content is hidden

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

395 files changed

+19845
-2450
lines changed

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,12 @@ How swift-C++ bridging code is compiled:
353353
DEFAULT: based on the build configuration
354354
]=] DEFAULT)
355355

356+
option(SWIFT_USE_SYMLINKS "Use symlinks instead of copying binaries" ${CMAKE_HOST_UNIX})
357+
set(SWIFT_COPY_OR_SYMLINK "copy")
358+
if(SWIFT_USE_SYMLINKS)
359+
set(SWIFT_COPY_OR_SYMLINK "create_symlink")
360+
endif()
361+
356362
# The following only works with the Ninja generator in CMake >= 3.0.
357363
set(SWIFT_PARALLEL_LINK_JOBS "" CACHE STRING
358364
"Define the maximum number of linker jobs for swift.")
@@ -1333,6 +1339,15 @@ endif()
13331339
add_subdirectory(include)
13341340

13351341
if(SWIFT_INCLUDE_TOOLS)
1342+
1343+
# TODO Remove this once release/5.9 is done and we can finish migrating Swift
1344+
# off of `llvm::None`/`llvm::Optional`, and `llvm::makeArrayRef`.
1345+
# This is to silence the avalanche of deprecation warnings from LLVM headers
1346+
# until we can actually do something about them. This is nasty, but it's
1347+
# better than losing context due to the sheer number in-actionable deprecation
1348+
# warnings or the massive number of merge-conflicts we would get otherwise.
1349+
add_definitions(-DSWIFT_TARGET)
1350+
13361351
# Include 'swift-syntax'.
13371352
# This is a function because we want to set some 'CMAKE_*' variables temporarily.'
13381353
# TODO: Replace this with 'block()' after CMake 3.25

cmake/modules/Libdispatch.cmake

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
88
set(SWIFT_LIBDISPATCH_CXX_COMPILER ${CMAKE_CXX_COMPILER})
99
elseif(CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME)
1010
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
11-
if(CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR AND
12-
TARGET clang)
11+
if(DEFINED SWIFT_CLANG_LOCATION)
12+
set(SWIFT_LIBDISPATCH_C_COMPILER ${SWIFT_CLANG_LOCATION}/clang-cl${CMAKE_EXECUTABLE_SUFFIX})
13+
set(SWIFT_LIBDISPATCH_CXX_COMPILER ${SWIFT_CLANG_LOCATION}/clang-cl${CMAKE_EXECUTABLE_SUFFIX})
14+
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_SYSTEM_PROCESSOR AND TARGET clang)
1315
set(SWIFT_LIBDISPATCH_C_COMPILER
1416
$<TARGET_FILE_DIR:clang>/clang-cl${CMAKE_EXECUTABLE_SUFFIX})
1517
set(SWIFT_LIBDISPATCH_CXX_COMPILER
1618
$<TARGET_FILE_DIR:clang>/clang-cl${CMAKE_EXECUTABLE_SUFFIX})
17-
elseif(DEFINED SWIFT_CLANG_LOCATION)
18-
set(SWIFT_LIBDISPATCH_C_COMPILER ${SWIFT_CLANG_LOCATION}/clang-cl${CMAKE_EXECUTABLE_SUFFIX})
19-
set(SWIFT_LIBDISPATCH_CXX_COMPILER ${SWIFT_CLANG_LOCATION}/clang-cl${CMAKE_EXECUTABLE_SUFFIX})
2019
else()
2120
set(SWIFT_LIBDISPATCH_C_COMPILER clang-cl${CMAKE_EXECUTABLE_SUFFIX})
2221
set(SWIFT_LIBDISPATCH_CXX_COMPILER clang-cl${CMAKE_EXECUTABLE_SUFFIX})

cmake/modules/SwiftComponents.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ function(swift_install_symlink_component component)
203203
# otherwise.
204204
install(DIRECTORY DESTINATION "${ARG_DESTINATION}" COMPONENT ${component})
205205
install(SCRIPT ${INSTALL_SYMLINK}
206-
CODE "install_symlink(${ARG_LINK_NAME} ${ARG_TARGET} ${ARG_DESTINATION})"
206+
CODE "install_symlink(${ARG_LINK_NAME}
207+
${ARG_TARGET}
208+
${ARG_DESTINATION}
209+
${SWIFT_COPY_OR_SYMLINK})"
207210
COMPONENT ${component})
208211
endfunction()

include/swift/ABI/ObjectFile.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
#ifndef SWIFT_ABI_OBJECTFILE_H
88
#define SWIFT_ABI_OBJECTFILE_H
99

10-
#include "llvm/Support/ErrorHandling.h"
10+
#include "llvm/ADT/Optional.h"
1111
#include "llvm/ADT/StringRef.h"
12+
#include "llvm/Support/ErrorHandling.h"
1213

1314
namespace swift {
1415

include/swift/AST/ASTContext.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,9 @@ class ASTContext final {
506506
return StringRef(Result.data(), Result.size());
507507
}
508508

509-
template<typename T, typename Vector, typename Set>
509+
template<typename T, typename Vector, typename Set, unsigned N>
510510
MutableArrayRef<T>
511-
AllocateCopy(llvm::SetVector<T, Vector, Set> setVector,
511+
AllocateCopy(llvm::SetVector<T, Vector, Set, N> setVector,
512512
AllocationArena arena = AllocationArena::Permanent) const {
513513
return MutableArrayRef<T>(AllocateCopy<T>(setVector.begin(),
514514
setVector.end(),

include/swift/AST/ASTWalker.h

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

1616
#include "swift/Basic/LLVM.h"
1717
#include "llvm/ADT/Optional.h"
18+
#include "llvm/ADT/None.h"
1819
#include "llvm/ADT/PointerUnion.h"
1920
#include <utility>
2021

include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5020,7 +5020,7 @@ class ProtocolDecl final : public NominalTypeDecl {
50205020
/// \c None if it hasn't yet been computed.
50215021
llvm::Optional<bool> getCachedHasSelfOrAssociatedTypeRequirements() {
50225022
if (Bits.ProtocolDecl.HasSelfOrAssociatedTypeRequirementsValid)
5023-
return Bits.ProtocolDecl.HasSelfOrAssociatedTypeRequirements;
5023+
return static_cast<bool>(Bits.ProtocolDecl.HasSelfOrAssociatedTypeRequirements);
50245024

50255025
return llvm::None;
50265026
}

include/swift/AST/FileUnit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class FileUnit : public DeclContext, public ASTAllocated<FileUnit> {
122122
/// collecting the identifiers in \p spiGroups.
123123
virtual void lookupImportedSPIGroups(
124124
const ModuleDecl *importedModule,
125-
SmallSetVector<Identifier, 4> &spiGroups) const {};
125+
llvm::SmallSetVector<Identifier, 4> &spiGroups) const {};
126126

127127
/// Checks whether this file imports \c module as \c @_weakLinked.
128128
virtual bool importsModuleAsWeakLinked(const ModuleDecl *module) const {

include/swift/AST/IRGenOptions.h

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,15 @@ class IRGenOptions {
502502
/// The calling convention used to perform non-swift calls.
503503
llvm::CallingConv::ID PlatformCCallingConvention;
504504

505+
/// Use CAS based object format as the output.
506+
bool UseCASBackend;
507+
508+
/// The output mode for the CAS Backend.
509+
llvm::CASBackendMode CASObjMode;
510+
511+
/// Emit a .casid file next to the object file if CAS Backend is used.
512+
bool EmitCASIDFile;
513+
505514
IRGenOptions()
506515
: DWARFVersion(2),
507516
OutputKind(IRGenOutputKind::LLVMAssemblyAfterOptimization),
@@ -513,9 +522,9 @@ class IRGenOptions {
513522
DebugInfoFormat(IRGenDebugInfoFormat::None),
514523
DisableClangModuleSkeletonCUs(false), UseJIT(false),
515524
DisableLLVMOptzns(false), DisableSwiftSpecificLLVMOptzns(false),
516-
Playground(false),
517-
EmitStackPromotionChecks(false), UseSingleModuleLLVMEmission(false),
518-
FunctionSections(false), PrintInlineTree(false), AlwaysCompile(false),
525+
Playground(false), EmitStackPromotionChecks(false),
526+
UseSingleModuleLLVMEmission(false), FunctionSections(false),
527+
PrintInlineTree(false), AlwaysCompile(false),
519528
EmbedMode(IRGenEmbedMode::None), LLVMLTOKind(IRGenLLVMLTOKind::None),
520529
SwiftAsyncFramePointer(SwiftAsyncFramePointerKind::Auto),
521530
HasValueNamesSetting(false), ValueNames(false),
@@ -538,13 +547,12 @@ class IRGenOptions {
538547
WitnessMethodElimination(false), ConditionalRuntimeRecords(false),
539548
InternalizeAtLink(false), InternalizeSymbols(false),
540549
EmitGenericRODatas(false), NoPreallocatedInstantiationCaches(false),
541-
DisableReadonlyStaticObjects(false),
542-
CollocatedMetadataFunctions(false),
543-
ColocateTypeDescriptors(true),
544-
UseRelativeProtocolWitnessTables(false), CmdArgs(),
545-
SanitizeCoverage(llvm::SanitizerCoverageOptions()),
550+
DisableReadonlyStaticObjects(false), CollocatedMetadataFunctions(false),
551+
ColocateTypeDescriptors(true), UseRelativeProtocolWitnessTables(false),
552+
CmdArgs(), SanitizeCoverage(llvm::SanitizerCoverageOptions()),
546553
TypeInfoFilter(TypeInfoDumpFilter::All),
547-
PlatformCCallingConvention(llvm::CallingConv::C) {
554+
PlatformCCallingConvention(llvm::CallingConv::C), UseCASBackend(false),
555+
CASObjMode(llvm::CASBackendMode::Native) {
548556
#ifndef NDEBUG
549557
DisableRoundTripDebugTypes = false;
550558
#else

include/swift/AST/Import.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,15 +776,15 @@ struct DenseMapInfo<swift::AttributedImport<ModuleInfo>> {
776776
SourceLocDMI::getEmptyKey(),
777777
ImportOptionsDMI::getEmptyKey(),
778778
StringRefDMI::getEmptyKey(),
779-
{}, {}, None,
779+
{}, {}, llvm::None,
780780
swift::AccessLevel::Public, {});
781781
}
782782
static inline AttributedImport getTombstoneKey() {
783783
return AttributedImport(ModuleInfoDMI::getTombstoneKey(),
784784
SourceLocDMI::getEmptyKey(),
785785
ImportOptionsDMI::getTombstoneKey(),
786786
StringRefDMI::getTombstoneKey(),
787-
{}, {}, None,
787+
{}, {}, llvm::None,
788788
swift::AccessLevel::Public, {});
789789
}
790790
static inline unsigned getHashValue(const AttributedImport &import) {

0 commit comments

Comments
 (0)