From 703dba9846ba25c8e9255a6976cd7a11ddbb86bc Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Thu, 27 Jun 2024 20:52:33 -0700 Subject: [PATCH 01/15] Rename `erase_value` to `erase` `llvm::erase_value` was deprecated and removed. --- include/swift/AST/PluginRegistry.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/swift/AST/PluginRegistry.h b/include/swift/AST/PluginRegistry.h index 3f417e1ad3d55..10142459d73db 100644 --- a/include/swift/AST/PluginRegistry.h +++ b/include/swift/AST/PluginRegistry.h @@ -88,7 +88,7 @@ class CompilerPlugin { /// Remove "on reconnect" callback. void removeOnReconnect(std::function *fn) { - llvm::erase_value(onReconnect, fn); + llvm::erase(onReconnect, fn); } ArrayRef *> getOnReconnectCallbacks() { From a6cf31036a0939ac43b71c7ea236413c3b1f129f Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Thu, 27 Jun 2024 22:01:40 -0700 Subject: [PATCH 02/15] Add AMDGPU builtin handling --- lib/AST/ClangTypeConverter.cpp | 6 ++- lib/ClangImporter/ClangAdapter.cpp | 81 ++++++++---------------------- lib/ClangImporter/ImportType.cpp | 73 +++++++-------------------- lib/IRGen/GenCall.cpp | 61 ++++------------------ 4 files changed, 54 insertions(+), 167 deletions(-) diff --git a/lib/AST/ClangTypeConverter.cpp b/lib/AST/ClangTypeConverter.cpp index 3c956ca8c05bb..f9e573c8d5ded 100644 --- a/lib/AST/ClangTypeConverter.cpp +++ b/lib/AST/ClangTypeConverter.cpp @@ -75,10 +75,14 @@ getClangBuiltinTypeFromKind(const clang::ASTContext &context, case clang::BuiltinType::Id: \ return context.Id##Ty; #include "clang/Basic/RISCVVTypes.def" -#define WASM_REF_TYPE(Name, MangedNameBase, Id, SingletonId, AS) \ +#define WASM_REF_TYPE(Name, MangledNameBase, Id, SingletonId, AS) \ case clang::BuiltinType::Id: \ return context.SingletonId; #include "clang/Basic/WebAssemblyReferenceTypes.def" +#define AMDGPU_TYPE(Name, Id, SingletonId) \ + case clang::BuiltinType::Id: \ + return context.SingletonId; +#include "clang/Basic/AMDGPUTypes.def" } // Not a valid BuiltinType. diff --git a/lib/ClangImporter/ClangAdapter.cpp b/lib/ClangImporter/ClangAdapter.cpp index 4c02ab936b3bd..8f595d59aca2d 100644 --- a/lib/ClangImporter/ClangAdapter.cpp +++ b/lib/ClangImporter/ClangAdapter.cpp @@ -407,87 +407,48 @@ OmissionTypeName importer::getClangTypeNameForOmission(clang::ASTContext &ctx, case clang::BuiltinType::ObjCSel: return OmissionTypeName(); - // OpenCL types that don't have Swift equivalents. - case clang::BuiltinType::OCLImage1dRO: - case clang::BuiltinType::OCLImage1dRW: - case clang::BuiltinType::OCLImage1dWO: - case clang::BuiltinType::OCLImage1dArrayRO: - case clang::BuiltinType::OCLImage1dArrayRW: - case clang::BuiltinType::OCLImage1dArrayWO: - case clang::BuiltinType::OCLImage1dBufferRO: - case clang::BuiltinType::OCLImage1dBufferRW: - case clang::BuiltinType::OCLImage1dBufferWO: - case clang::BuiltinType::OCLImage2dRO: - case clang::BuiltinType::OCLImage2dRW: - case clang::BuiltinType::OCLImage2dWO: - case clang::BuiltinType::OCLImage2dArrayRO: - case clang::BuiltinType::OCLImage2dArrayRW: - case clang::BuiltinType::OCLImage2dArrayWO: - case clang::BuiltinType::OCLImage2dDepthRO: - case clang::BuiltinType::OCLImage2dDepthRW: - case clang::BuiltinType::OCLImage2dDepthWO: - case clang::BuiltinType::OCLImage2dArrayDepthRO: - case clang::BuiltinType::OCLImage2dArrayDepthRW: - case clang::BuiltinType::OCLImage2dArrayDepthWO: - case clang::BuiltinType::OCLImage2dMSAARO: - case clang::BuiltinType::OCLImage2dMSAARW: - case clang::BuiltinType::OCLImage2dMSAAWO: - case clang::BuiltinType::OCLImage2dArrayMSAARO: - case clang::BuiltinType::OCLImage2dArrayMSAARW: - case clang::BuiltinType::OCLImage2dArrayMSAAWO: - case clang::BuiltinType::OCLImage2dMSAADepthRO: - case clang::BuiltinType::OCLImage2dMSAADepthRW: - case clang::BuiltinType::OCLImage2dMSAADepthWO: - case clang::BuiltinType::OCLImage2dArrayMSAADepthRO: - case clang::BuiltinType::OCLImage2dArrayMSAADepthRW: - case clang::BuiltinType::OCLImage2dArrayMSAADepthWO: - case clang::BuiltinType::OCLImage3dRO: - case clang::BuiltinType::OCLImage3dRW: - case clang::BuiltinType::OCLImage3dWO: - case clang::BuiltinType::OCLSampler: - case clang::BuiltinType::OCLEvent: - case clang::BuiltinType::OCLClkEvent: - case clang::BuiltinType::OCLQueue: - case clang::BuiltinType::OCLReserveID: - case clang::BuiltinType::OCLIntelSubgroupAVCMcePayload: - case clang::BuiltinType::OCLIntelSubgroupAVCImePayload: - case clang::BuiltinType::OCLIntelSubgroupAVCRefPayload: - case clang::BuiltinType::OCLIntelSubgroupAVCSicPayload: - case clang::BuiltinType::OCLIntelSubgroupAVCMceResult: - case clang::BuiltinType::OCLIntelSubgroupAVCImeResult: - case clang::BuiltinType::OCLIntelSubgroupAVCRefResult: - case clang::BuiltinType::OCLIntelSubgroupAVCSicResult: - case clang::BuiltinType::OCLIntelSubgroupAVCImeResultSingleReferenceStreamout: - case clang::BuiltinType::OCLIntelSubgroupAVCImeResultDualReferenceStreamout: - case clang::BuiltinType::OCLIntelSubgroupAVCImeSingleReferenceStreamin: - case clang::BuiltinType::OCLIntelSubgroupAVCImeDualReferenceStreamin: - return OmissionTypeName(); - // OpenMP types that don't have Swift equivalents. case clang::BuiltinType::OMPArraySection: case clang::BuiltinType::OMPArrayShaping: case clang::BuiltinType::OMPIterator: return OmissionTypeName(); + // OpenCL builtin types that don't have Swift equivalents. + case clang::BuiltinType::OCLClkEvent: + case clang::BuiltinType::OCLEvent: + case clang::BuiltinType::OCLSampler: + case clang::BuiltinType::OCLQueue: + case clang::BuiltinType::OCLReserveID: +#define IMAGE_TYPE(Name, Id, ...) case clang::BuiltinType::Id: +#include "clang/Basic/OpenCLImageTypes.def" +#define EXT_OPAQUE_TYPE(Name, Id, ...) case clang::BuiltinType::Id: +#include "clang/Basic/OpenCLExtensionTypes.def" + return OmissionTypeName(); + // ARM SVE builtin types that don't have Swift equivalents. #define SVE_TYPE(Name, Id, ...) case clang::BuiltinType::Id: #include "clang/Basic/AArch64SVEACLETypes.def" return OmissionTypeName(); // PPC MMA builtin types that don't have Swift equivalents. -#define PPC_VECTOR_TYPE(Name, Id, Size) case clang::BuiltinType::Id: +#define PPC_VECTOR_TYPE(Name, Id, ...) case clang::BuiltinType::Id: #include "clang/Basic/PPCTypes.def" return OmissionTypeName(); // RISC-V V builtin types that don't have Swift equivalents. -#define RVV_TYPE(Name, Id, Size) case clang::BuiltinType::Id: +#define RVV_TYPE(Name, Id, ...) case clang::BuiltinType::Id: #include "clang/Basic/RISCVVTypes.def" return OmissionTypeName(); - // WAM builtin types that don't have Swift equivalents. -#define WASM_TYPE(Name, Id, Size) case clang::BuiltinType::Id: + // WASM builtin types that don't have Swift equivalents. +#define WASM_TYPE(Name, Id, ...) case clang::BuiltinType::Id: #include "clang/Basic/WebAssemblyReferenceTypes.def" return OmissionTypeName(); + + // AMDGPU builtins that don't have Swift equivalents. +#define AMDGPU_TYPE(Name, Id, ...) case clang::BuiltinType::Id: +#include "clang/Basic/AMDGPUTypes.def" + return OmissionTypeName(); } } diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index 520cedc75886f..f660fad4bc0e3 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -325,68 +325,24 @@ namespace { case clang::BuiltinType::ObjCSel: return Type(); - // OpenCL types that don't have Swift equivalents. - case clang::BuiltinType::OCLImage1dRO: - case clang::BuiltinType::OCLImage1dRW: - case clang::BuiltinType::OCLImage1dWO: - case clang::BuiltinType::OCLImage1dArrayRO: - case clang::BuiltinType::OCLImage1dArrayRW: - case clang::BuiltinType::OCLImage1dArrayWO: - case clang::BuiltinType::OCLImage1dBufferRO: - case clang::BuiltinType::OCLImage1dBufferRW: - case clang::BuiltinType::OCLImage1dBufferWO: - case clang::BuiltinType::OCLImage2dRO: - case clang::BuiltinType::OCLImage2dRW: - case clang::BuiltinType::OCLImage2dWO: - case clang::BuiltinType::OCLImage2dArrayRO: - case clang::BuiltinType::OCLImage2dArrayRW: - case clang::BuiltinType::OCLImage2dArrayWO: - case clang::BuiltinType::OCLImage2dDepthRO: - case clang::BuiltinType::OCLImage2dDepthRW: - case clang::BuiltinType::OCLImage2dDepthWO: - case clang::BuiltinType::OCLImage2dArrayDepthRO: - case clang::BuiltinType::OCLImage2dArrayDepthRW: - case clang::BuiltinType::OCLImage2dArrayDepthWO: - case clang::BuiltinType::OCLImage2dMSAARO: - case clang::BuiltinType::OCLImage2dMSAARW: - case clang::BuiltinType::OCLImage2dMSAAWO: - case clang::BuiltinType::OCLImage2dArrayMSAARO: - case clang::BuiltinType::OCLImage2dArrayMSAARW: - case clang::BuiltinType::OCLImage2dArrayMSAAWO: - case clang::BuiltinType::OCLImage2dMSAADepthRO: - case clang::BuiltinType::OCLImage2dMSAADepthRW: - case clang::BuiltinType::OCLImage2dMSAADepthWO: - case clang::BuiltinType::OCLImage2dArrayMSAADepthRO: - case clang::BuiltinType::OCLImage2dArrayMSAADepthRW: - case clang::BuiltinType::OCLImage2dArrayMSAADepthWO: - case clang::BuiltinType::OCLImage3dRO: - case clang::BuiltinType::OCLImage3dRW: - case clang::BuiltinType::OCLImage3dWO: - case clang::BuiltinType::OCLSampler: - case clang::BuiltinType::OCLEvent: - case clang::BuiltinType::OCLClkEvent: - case clang::BuiltinType::OCLQueue: - case clang::BuiltinType::OCLReserveID: - case clang::BuiltinType::OCLIntelSubgroupAVCMcePayload: - case clang::BuiltinType::OCLIntelSubgroupAVCImePayload: - case clang::BuiltinType::OCLIntelSubgroupAVCRefPayload: - case clang::BuiltinType::OCLIntelSubgroupAVCSicPayload: - case clang::BuiltinType::OCLIntelSubgroupAVCMceResult: - case clang::BuiltinType::OCLIntelSubgroupAVCImeResult: - case clang::BuiltinType::OCLIntelSubgroupAVCRefResult: - case clang::BuiltinType::OCLIntelSubgroupAVCSicResult: - case clang::BuiltinType::OCLIntelSubgroupAVCImeResultSingleReferenceStreamout: - case clang::BuiltinType::OCLIntelSubgroupAVCImeResultDualReferenceStreamout: - case clang::BuiltinType::OCLIntelSubgroupAVCImeSingleReferenceStreamin: - case clang::BuiltinType::OCLIntelSubgroupAVCImeDualReferenceStreamin: - return Type(); - // OpenMP types that don't have Swift equivalents. case clang::BuiltinType::OMPArraySection: case clang::BuiltinType::OMPArrayShaping: case clang::BuiltinType::OMPIterator: return Type(); + // OpenCL builtin types that don't have Swift equivalents. + case clang::BuiltinType::OCLClkEvent: + case clang::BuiltinType::OCLEvent: + case clang::BuiltinType::OCLSampler: + case clang::BuiltinType::OCLQueue: + case clang::BuiltinType::OCLReserveID: +#define IMAGE_TYPE(Name, Id, ...) case clang::BuiltinType::Id: +#include "clang/Basic/OpenCLImageTypes.def" +#define EXT_OPAQUE_TYPE(Name, Id, ...) case clang::BuiltinType::Id: +#include "clang/Basic/OpenCLExtensionTypes.def" + return Type(); + // ARM SVE builtin types that don't have Swift equivalents. #define SVE_TYPE(Name, Id, ...) case clang::BuiltinType::Id: #include "clang/Basic/AArch64SVEACLETypes.def" @@ -406,6 +362,11 @@ namespace { #include "clang/Basic/WebAssemblyReferenceTypes.def" return Type(); + // AMDGPU builtin types that don't have Swift equivalents. +#define AMDGPU_TYPE(Name, Id, SingletonId) case clang::BuiltinType::Id: +#include "clang/Basic/AMDGPUTypes.def" + return Type(); + } llvm_unreachable("Invalid BuiltinType."); diff --git a/lib/IRGen/GenCall.cpp b/lib/IRGen/GenCall.cpp index 74b6d3658732a..fb7321c7f5173 100644 --- a/lib/IRGen/GenCall.cpp +++ b/lib/IRGen/GenCall.cpp @@ -1242,59 +1242,15 @@ namespace { llvm_unreachable("bare void type in ABI lowering"); // We should never see the OpenCL builtin types at all. - case clang::BuiltinType::OCLImage1dRO: - case clang::BuiltinType::OCLImage1dRW: - case clang::BuiltinType::OCLImage1dWO: - case clang::BuiltinType::OCLImage1dArrayRO: - case clang::BuiltinType::OCLImage1dArrayRW: - case clang::BuiltinType::OCLImage1dArrayWO: - case clang::BuiltinType::OCLImage1dBufferRO: - case clang::BuiltinType::OCLImage1dBufferRW: - case clang::BuiltinType::OCLImage1dBufferWO: - case clang::BuiltinType::OCLImage2dRO: - case clang::BuiltinType::OCLImage2dRW: - case clang::BuiltinType::OCLImage2dWO: - case clang::BuiltinType::OCLImage2dArrayRO: - case clang::BuiltinType::OCLImage2dArrayRW: - case clang::BuiltinType::OCLImage2dArrayWO: - case clang::BuiltinType::OCLImage2dDepthRO: - case clang::BuiltinType::OCLImage2dDepthRW: - case clang::BuiltinType::OCLImage2dDepthWO: - case clang::BuiltinType::OCLImage2dArrayDepthRO: - case clang::BuiltinType::OCLImage2dArrayDepthRW: - case clang::BuiltinType::OCLImage2dArrayDepthWO: - case clang::BuiltinType::OCLImage2dMSAARO: - case clang::BuiltinType::OCLImage2dMSAARW: - case clang::BuiltinType::OCLImage2dMSAAWO: - case clang::BuiltinType::OCLImage2dArrayMSAARO: - case clang::BuiltinType::OCLImage2dArrayMSAARW: - case clang::BuiltinType::OCLImage2dArrayMSAAWO: - case clang::BuiltinType::OCLImage2dMSAADepthRO: - case clang::BuiltinType::OCLImage2dMSAADepthRW: - case clang::BuiltinType::OCLImage2dMSAADepthWO: - case clang::BuiltinType::OCLImage2dArrayMSAADepthRO: - case clang::BuiltinType::OCLImage2dArrayMSAADepthRW: - case clang::BuiltinType::OCLImage2dArrayMSAADepthWO: - case clang::BuiltinType::OCLImage3dRO: - case clang::BuiltinType::OCLImage3dRW: - case clang::BuiltinType::OCLImage3dWO: - case clang::BuiltinType::OCLSampler: - case clang::BuiltinType::OCLEvent: case clang::BuiltinType::OCLClkEvent: + case clang::BuiltinType::OCLEvent: + case clang::BuiltinType::OCLSampler: case clang::BuiltinType::OCLQueue: case clang::BuiltinType::OCLReserveID: - case clang::BuiltinType::OCLIntelSubgroupAVCMcePayload: - case clang::BuiltinType::OCLIntelSubgroupAVCImePayload: - case clang::BuiltinType::OCLIntelSubgroupAVCRefPayload: - case clang::BuiltinType::OCLIntelSubgroupAVCSicPayload: - case clang::BuiltinType::OCLIntelSubgroupAVCMceResult: - case clang::BuiltinType::OCLIntelSubgroupAVCImeResult: - case clang::BuiltinType::OCLIntelSubgroupAVCRefResult: - case clang::BuiltinType::OCLIntelSubgroupAVCSicResult: - case clang::BuiltinType::OCLIntelSubgroupAVCImeResultSingleReferenceStreamout: - case clang::BuiltinType::OCLIntelSubgroupAVCImeResultDualReferenceStreamout: - case clang::BuiltinType::OCLIntelSubgroupAVCImeSingleReferenceStreamin: - case clang::BuiltinType::OCLIntelSubgroupAVCImeDualReferenceStreamin: +#define IMAGE_TYPE(Name, Id, ...) case clang::BuiltinType::Id: +#include "clang/Basic/OpenCLImageTypes.def" +#define EXT_OPAQUE_TYPE(Name, Id, ...) case clang::BuiltinType::Id: +#include "clang/Basic/OpenCLExtensionTypes.def" llvm_unreachable("OpenCL type in ABI lowering"); // We should never see ARM SVE types at all. @@ -1316,6 +1272,11 @@ namespace { #include "clang/Basic/WebAssemblyReferenceTypes.def" llvm_unreachable("WASM type in ABI lowering"); + // We should never see AMDGPU types at all. +#define AMDGPU_TYPE(Name, Id, ...) case clang::BuiltinType::Id: +#include "clang/Basic/AMDGPUTypes.def" + llvm_unreachable("AMDGPU type in ABI lowering"); + // Handle all the integer types as opaque values. #define BUILTIN_TYPE(Id, SingletonId) #define SIGNED_TYPE(Id, SingletonId) \ From c4fd432b6ca2163973e1df3a707cb2cdcac39966 Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Thu, 27 Jun 2024 20:52:01 -0700 Subject: [PATCH 03/15] [SIL] Add missing ilist details --- include/swift/SIL/SILInstruction.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/swift/SIL/SILInstruction.h b/include/swift/SIL/SILInstruction.h index c6b42b12db6d9..4f84c9ff5de57 100644 --- a/include/swift/SIL/SILInstruction.h +++ b/include/swift/SIL/SILInstruction.h @@ -58,7 +58,7 @@ namespace ilist_detail { /// /// We need a custom base class to not clear the prev/next pointers when /// removing an instruction from the list. -class SILInstructionListBase : public ilist_base { +class SILInstructionListBase : public ilist_base { public: /// Remove an instruction from the list. /// @@ -96,7 +96,8 @@ template <> struct compute_node_options<::swift::SILInstruction> { static const bool is_sentinel_tracking_explicit = false; static const bool has_iterator_bits = false; typedef void tag; - typedef ilist_node_base node_base_type; + typedef void parent_ty; + typedef ilist_node_base node_base_type; typedef SILInstructionListBase list_base_type; }; }; From 4ee4c0fbac53550b12f2edd948325f19c19a13c8 Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Thu, 27 Jun 2024 23:24:15 -0700 Subject: [PATCH 04/15] [IRGen] Use new `ASSERT` macro over `requires` `requires` was removed and replaced with `ASSERT`. --- lib/IRGen/GenConstant.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/IRGen/GenConstant.cpp b/lib/IRGen/GenConstant.cpp index ae70237728615..8dbfd6563f152 100644 --- a/lib/IRGen/GenConstant.cpp +++ b/lib/IRGen/GenConstant.cpp @@ -31,7 +31,6 @@ #include "swift/IRGen/Linking.h" #include "swift/Basic/Assertions.h" #include "swift/Basic/Range.h" -#include "swift/Basic/Require.h" #include "swift/SIL/SILModule.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Support/BLAKE3.h" @@ -331,8 +330,8 @@ Explosion irgen::emitConstantValue(IRGenModule &IGM, SILValue operand, auto *result = llvm::ConstantFoldCastOperand( llvm::Instruction::ZExt, val, storageTy, IGM.DataLayout); - require(result != nullptr, - "couldn't constant fold initializer expression"); + ASSERT(result != nullptr && + "couldn't constant fold initializer expression"); return result; } case BuiltinValueKind::StringObjectOr: { From 8e9ac93bd3b4d5b93dd1bcde4ad73d562ea0ece4 Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Fri, 28 Jun 2024 14:11:40 -0700 Subject: [PATCH 05/15] [IRGen] Use `ConstantInt` for `otherDiscriminator` --- lib/IRGen/GenConstant.cpp | 3 +-- lib/IRGen/GenPointerAuth.cpp | 19 +++++++++++-------- lib/IRGen/IRGenModule.h | 8 ++++---- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/IRGen/GenConstant.cpp b/lib/IRGen/GenConstant.cpp index 8dbfd6563f152..aaa064c97abe2 100644 --- a/lib/IRGen/GenConstant.cpp +++ b/lib/IRGen/GenConstant.cpp @@ -404,8 +404,7 @@ Explosion irgen::emitConstantValue(IRGenModule &IGM, SILValue operand, auto authInfo = PointerAuthInfo::forFunctionPointer(IGM, fnType); if (authInfo.isSigned()) { auto constantDiscriminator = - cast(authInfo.getDiscriminator()); - assert(!constantDiscriminator->getType()->isPointerTy()); + cast(authInfo.getDiscriminator()); fnPtr = IGM.getConstantSignedPointer(fnPtr, authInfo.getKey(), nullptr, constantDiscriminator); } diff --git a/lib/IRGen/GenPointerAuth.cpp b/lib/IRGen/GenPointerAuth.cpp index 23006d5e0d1dd..d0cbb9264ab11 100644 --- a/lib/IRGen/GenPointerAuth.cpp +++ b/lib/IRGen/GenPointerAuth.cpp @@ -128,11 +128,14 @@ llvm::Value *irgen::emitPointerAuthSign(IRGenFunction &IGF, llvm::Value *fnPtr, if (auto constantFnPtr = dyn_cast(fnPtr)) { if (auto constantDiscriminator = dyn_cast(newAuthInfo.getDiscriminator())) { - llvm::Constant *other = nullptr, *address = nullptr; - if (constantDiscriminator->getType()->isPointerTy()) + llvm::Constant *address = nullptr; + llvm::ConstantInt *other = nullptr; + if (constantDiscriminator->getType()->isPointerTy()) { address = constantDiscriminator; - else - other = constantDiscriminator; + } else if (auto otherDiscriminator = + dyn_cast(constantDiscriminator)) { + other = otherDiscriminator; + } return IGF.IGM.getConstantSignedPointer(constantFnPtr, newAuthInfo.getKey(), address, other); @@ -716,10 +719,10 @@ IRGenModule::getConstantSignedCFunctionPointer(llvm::Constant *fn) { return fn; } -llvm::Constant *IRGenModule::getConstantSignedPointer(llvm::Constant *pointer, - unsigned key, - llvm::Constant *storageAddress, - llvm::Constant *otherDiscriminator) { +llvm::Constant * +IRGenModule::getConstantSignedPointer(llvm::Constant *pointer, unsigned key, + llvm::Constant *storageAddress, + llvm::ConstantInt *otherDiscriminator) { return clang::CodeGen::getConstantSignedPointer(getClangCGM(), pointer, key, storageAddress, otherDiscriminator); diff --git a/lib/IRGen/IRGenModule.h b/lib/IRGen/IRGenModule.h index dffeb0ca20ba2..9ae62970b8428 100644 --- a/lib/IRGen/IRGenModule.h +++ b/lib/IRGen/IRGenModule.h @@ -1200,10 +1200,10 @@ class IRGenModule { llvm::Constant *getConstantSignedCFunctionPointer(llvm::Constant *fn); - llvm::Constant *getConstantSignedPointer(llvm::Constant *pointer, - unsigned key, - llvm::Constant *addrDiscriminator, - llvm::Constant *otherDiscriminator); + llvm::Constant * + getConstantSignedPointer(llvm::Constant *pointer, unsigned key, + llvm::Constant *storageAddress, + llvm::ConstantInt *otherDiscriminator); llvm::Constant *getConstantSignedPointer(llvm::Constant *pointer, const clang::PointerAuthSchema &schema, const PointerAuthEntity &entity, From 4a5e1cd3da685be23bea33801345aa62798c1ae6 Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Wed, 5 Jun 2024 20:13:41 -0700 Subject: [PATCH 06/15] [ClangImporter] Add missing include --- include/swift/ClangImporter/ClangModule.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/swift/ClangImporter/ClangModule.h b/include/swift/ClangImporter/ClangModule.h index 470c7b481f4b4..29cf61c9b64c9 100644 --- a/include/swift/ClangImporter/ClangModule.h +++ b/include/swift/ClangImporter/ClangModule.h @@ -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 { From 701800fbeb343e148b45afa993b8bf6d80194c8b Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Wed, 5 Jun 2024 21:25:31 -0700 Subject: [PATCH 07/15] [ClangImporter] Handle `DefaultArgument` now being a `TemplateArgmentLoc` This was changed in upstream LLVM 142c3f394e1b34dcefcaf0887a6fd4711b78eeb3. --- lib/AST/ClangTypeConverter.cpp | 4 ++-- lib/ClangImporter/ImportDecl.cpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/AST/ClangTypeConverter.cpp b/lib/AST/ClangTypeConverter.cpp index f9e573c8d5ded..37742fbad9f69 100644 --- a/lib/AST/ClangTypeConverter.cpp +++ b/lib/AST/ClangTypeConverter.cpp @@ -895,8 +895,8 @@ ClangTypeConverter::getClangTemplateArguments( auto templateParam = cast(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; } diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp index 2156d6ea1689e..ad91cda5031c7 100644 --- a/lib/ClangImporter/ImportDecl.cpp +++ b/lib/ClangImporter/ImportDecl.cpp @@ -3457,8 +3457,9 @@ namespace { // parameters when the function template is instantiated, so do not // import the function template if the template parameter has // dependent default value. - auto defaultArgumentType = templateTypeParam->getDefaultArgument(); - if (defaultArgumentType->isDependentType()) + auto &defaultArgument = + templateTypeParam->getDefaultArgument().getArgument(); + if (defaultArgument.isDependent()) return nullptr; continue; } From 226ba82525f87e9d6d7c11cc73b5aa7b8b01f37e Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Wed, 5 Jun 2024 21:30:30 -0700 Subject: [PATCH 08/15] [ClangImporter] Add various `const` `getSelector` now takes a `const clang::IdentifierInfo *` `ArrayRef`. Sprinkle a bunch of `const`s in. --- .../ClangImporter/SwiftAbstractBasicReader.h | 2 +- lib/ClangImporter/ClangImporter.cpp | 18 +++++++++--------- lib/ClangImporter/ImportName.cpp | 2 +- .../lib/SwiftLang/SwiftSourceDocInfo.cpp | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/swift/ClangImporter/SwiftAbstractBasicReader.h b/include/swift/ClangImporter/SwiftAbstractBasicReader.h index b5df306987b43..b5063c1c43493 100644 --- a/include/swift/ClangImporter/SwiftAbstractBasicReader.h +++ b/include/swift/ClangImporter/SwiftAbstractBasicReader.h @@ -72,7 +72,7 @@ class DataStreamBasicReader return clang::Selector(); unsigned numArgs = unsigned(numArgsPlusOne - 1); - SmallVector chunks; + SmallVector chunks; for (unsigned i = 0, e = std::max(numArgs, 1U); i != e; ++i) chunks.push_back(asImpl().readIdentifier()); diff --git a/lib/ClangImporter/ClangImporter.cpp b/lib/ClangImporter/ClangImporter.cpp index 1f46ab6ab16de..e0eb3f6e02ef8 100644 --- a/lib/ClangImporter/ClangImporter.cpp +++ b/lib/ClangImporter/ClangImporter.cpp @@ -1510,18 +1510,18 @@ ClangImporter::create(ASTContext &ctx, importer->Impl.objectAtIndexedSubscript = clangContext.Selectors.getUnarySelector( &clangContext.Idents.get("objectAtIndexedSubscript")); - clang::IdentifierInfo *setObjectAtIndexedSubscriptIdents[2] = { - &clangContext.Idents.get("setObject"), - &clangContext.Idents.get("atIndexedSubscript") + const clang::IdentifierInfo *setObjectAtIndexedSubscriptIdents[2] = { + &clangContext.Idents.get("setObject"), + &clangContext.Idents.get("atIndexedSubscript"), }; importer->Impl.setObjectAtIndexedSubscript = clangContext.Selectors.getSelector(2, setObjectAtIndexedSubscriptIdents); importer->Impl.objectForKeyedSubscript = clangContext.Selectors.getUnarySelector( &clangContext.Idents.get("objectForKeyedSubscript")); - clang::IdentifierInfo *setObjectForKeyedSubscriptIdents[2] = { - &clangContext.Idents.get("setObject"), - &clangContext.Idents.get("forKeyedSubscript") + const clang::IdentifierInfo *setObjectForKeyedSubscriptIdents[2] = { + &clangContext.Idents.get("setObject"), + &clangContext.Idents.get("forKeyedSubscript"), }; importer->Impl.setObjectForKeyedSubscript = clangContext.Selectors.getSelector(2, setObjectForKeyedSubscriptIdents); @@ -2882,7 +2882,7 @@ ClangImporter::Implementation::exportSelector(DeclName name, clang::ASTContext &ctx = getClangASTContext(); - SmallVector pieces; + SmallVector pieces; pieces.push_back(exportName(name.getBaseIdentifier()).getAsIdentifierInfo()); auto argNames = name.getArgumentNames(); @@ -2901,7 +2901,7 @@ ClangImporter::Implementation::exportSelector(DeclName name, clang::Selector ClangImporter::Implementation::exportSelector(ObjCSelector selector) { - SmallVector pieces; + SmallVector pieces; for (auto piece : selector.getSelectorPieces()) pieces.push_back(exportName(piece).getAsIdentifierInfo()); return getClangASTContext().Selectors.getSelector(selector.getNumArgs(), @@ -2917,7 +2917,7 @@ isPotentiallyConflictingSetter(const clang::ObjCProtocolDecl *proto, if (sel.getNumArgs() != 1) return false; - clang::IdentifierInfo *setterID = sel.getIdentifierInfoForSlot(0); + const clang::IdentifierInfo *setterID = sel.getIdentifierInfoForSlot(0); if (!setterID || !setterID->getName().starts_with("set")) return false; diff --git a/lib/ClangImporter/ImportName.cpp b/lib/ClangImporter/ImportName.cpp index f8c3f69a8f818..d8af0c8045de0 100644 --- a/lib/ClangImporter/ImportName.cpp +++ b/lib/ClangImporter/ImportName.cpp @@ -1431,7 +1431,7 @@ bool NameImporter::hasErrorMethodNameCollision( unsigned numArgs = selector.getNumArgs(); assert(numArgs > 0); - SmallVector chunks; + SmallVector chunks; for (unsigned i = 0, e = selector.getNumArgs(); i != e; ++i) { chunks.push_back(selector.getIdentifierInfoForSlot(i)); } diff --git a/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp b/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp index 9ec7a99e4f8a3..b3f9be68d82a7 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp @@ -1351,7 +1351,7 @@ getClangDeclarationName(const clang::NamedDecl *ND, NameTranslatingInfo &Info) { return clang::DeclarationName(); ArrayRef Args = llvm::ArrayRef(Info.ArgNames); - std::vector Pieces; + std::vector Pieces; for (unsigned i = 0; i < NumPieces; ++i) { if (i >= Info.ArgNames.size() || Info.ArgNames[i].empty()) { Pieces.push_back(OrigSel.getIdentifierInfoForSlot(i)); From b429c70a246d37073aac763d010e4dca1811d1c0 Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Wed, 5 Jun 2024 22:12:36 -0700 Subject: [PATCH 09/15] [ClangImporter] Handle split sema `Sema` was split up in LLVM upstream 31a203fa8af47a8b2e8e357857b114cf90638b2eq. --- lib/ClangImporter/ClangImporter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ClangImporter/ClangImporter.cpp b/lib/ClangImporter/ClangImporter.cpp index e0eb3f6e02ef8..c3d89ed21dff6 100644 --- a/lib/ClangImporter/ClangImporter.cpp +++ b/lib/ClangImporter/ClangImporter.cpp @@ -3951,11 +3951,12 @@ void ClangModuleUnit::lookupObjCMethods( // Collect all of the Objective-C methods with this selector. SmallVector objcMethods; auto &clangSema = owner.getClangSema(); - clangSema.CollectMultipleMethodsInGlobalPool(clangSelector, + auto &clangObjc = clangSema.ObjC(); + clangObjc.CollectMultipleMethodsInGlobalPool(clangSelector, objcMethods, /*InstanceFirst=*/true, /*CheckTheOther=*/false); - clangSema.CollectMultipleMethodsInGlobalPool(clangSelector, + clangObjc.CollectMultipleMethodsInGlobalPool(clangSelector, objcMethods, /*InstanceFirst=*/false, /*CheckTheOther=*/false); From 22cc33a09807aab16243f6a01ef279328f381cf6 Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Wed, 5 Jun 2024 22:14:43 -0700 Subject: [PATCH 10/15] [ClangImporter] Handle `pair` to actual struct change Use `FeatureName` rather than `first`. --- lib/ClangImporter/ClangImporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ClangImporter/ClangImporter.cpp b/lib/ClangImporter/ClangImporter.cpp index c3d89ed21dff6..40499193714f3 100644 --- a/lib/ClangImporter/ClangImporter.cpp +++ b/lib/ClangImporter/ClangImporter.cpp @@ -7894,7 +7894,7 @@ bool importer::requiresCPlusPlus(const clang::Module *module) { } return llvm::any_of(module->Requirements, [](clang::Module::Requirement req) { - return req.first == "cplusplus"; + return req.FeatureName == "cplusplus"; }); } From 701430f20943f39d742952772dcf42425b299a22 Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Wed, 5 Jun 2024 22:26:52 -0700 Subject: [PATCH 11/15] [ClangImporter] Add initial empty handling for `UnresolvedTemplate` --- lib/ClangImporter/ClangAdapter.cpp | 1 + lib/ClangImporter/ImportType.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/ClangImporter/ClangAdapter.cpp b/lib/ClangImporter/ClangAdapter.cpp index 8f595d59aca2d..e3144ca30438c 100644 --- a/lib/ClangImporter/ClangAdapter.cpp +++ b/lib/ClangImporter/ClangAdapter.cpp @@ -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. diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index f660fad4bc0e3..a5a7b38dd9f96 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -284,6 +284,7 @@ namespace { case clang::BuiltinType::Overload: case clang::BuiltinType::PseudoObject: case clang::BuiltinType::UnknownAny: + case clang::BuiltinType::UnresolvedTemplate: return Type(); // FIXME: Types that can be mapped, but aren't yet. From 47a06b232fb1d107e2ebd6157925940fd1b7744c Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Thu, 6 Jun 2024 17:55:59 -0700 Subject: [PATCH 12/15] [ClangImporter] Rename `isUnnamedBitfield` to `isUnnamedBitField` --- lib/ClangImporter/ImportDecl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp index ad91cda5031c7..ccd091cf921d1 100644 --- a/lib/ClangImporter/ImportDecl.cpp +++ b/lib/ClangImporter/ImportDecl.cpp @@ -2237,7 +2237,7 @@ namespace { // Unnamed bitfields are just for padding and should not // inhibit creation of a memberwise initializer. - if (field->isUnnamedBitfield()) { + if (field->isUnnamedBitField()) { hasUnreferenceableStorage = true; continue; } @@ -9213,7 +9213,7 @@ void ClangImporter::Implementation::loadAllMembersOfRecordDecl( // Currently, we don't import unnamed bitfields. if (isa(m) && - cast(m)->isUnnamedBitfield()) + cast(m)->isUnnamedBitField()) continue; // Make sure we always pull in record fields. Everything else had better From f375e36cc86ed508102a74fe23d14c71ff3c2cd0 Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Wed, 5 Jun 2024 22:22:01 -0700 Subject: [PATCH 13/15] [ClangImporter] Rename `OMPArraySection` to `ArraySection` --- lib/ClangImporter/ClangAdapter.cpp | 2 +- lib/ClangImporter/ImportType.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ClangImporter/ClangAdapter.cpp b/lib/ClangImporter/ClangAdapter.cpp index e3144ca30438c..f832a5af21f05 100644 --- a/lib/ClangImporter/ClangAdapter.cpp +++ b/lib/ClangImporter/ClangAdapter.cpp @@ -409,7 +409,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(); diff --git a/lib/ClangImporter/ImportType.cpp b/lib/ClangImporter/ImportType.cpp index a5a7b38dd9f96..b316e96da65f0 100644 --- a/lib/ClangImporter/ImportType.cpp +++ b/lib/ClangImporter/ImportType.cpp @@ -327,7 +327,7 @@ namespace { return Type(); // 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 Type(); From 70c348129f46f3d9232c565acd880df68ebbee02 Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Wed, 5 Jun 2024 23:30:00 -0700 Subject: [PATCH 14/15] [ClangImporter] Use new `LocalDeclID` There were a number of upstream LLVM changes to `DeclID` in order to separate "local" and "global" IDs: https://github.com/llvm/llvm-project/commit/07b1177eed7549d0badf72078388422ce73167a0 https://github.com/llvm/llvm-project/commit/b8e3b2ad66cf78ad2b7832577b1d58dc93c5da21 https://github.com/llvm/llvm-project/commit/b467c6b53660dcaa458c2b5d7fbf5f93ee2af910 https://github.com/llvm/llvm-project/pull/89873 https://github.com/llvm/llvm-project/commit/d86cc73bbfd9a22d9a0d498d72c9b2ee235128e9 https://github.com/llvm/llvm-project/commit/8af86025af2456c70c84aec309cca9a069124671 ... and probably more. This likely needs further cleaning up to not use `DeclID` at all. --- lib/ClangImporter/SwiftLookupTable.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/ClangImporter/SwiftLookupTable.cpp b/lib/ClangImporter/SwiftLookupTable.cpp index b12729c13fea8..c7b564d8a6111 100644 --- a/lib/ClangImporter/SwiftLookupTable.cpp +++ b/lib/ClangImporter/SwiftLookupTable.cpp @@ -833,12 +833,12 @@ ArrayRef SwiftLookupTable::categories() { // Map categories known to the reader. for (auto declID : Reader->categories()) { - auto category = - cast_or_null( - Reader->getASTReader().GetLocalDecl(Reader->getModuleFile(), declID)); + auto localID = clang::LocalDeclID::get(Reader->getASTReader(), + Reader->getModuleFile(), declID); + auto category = cast_or_null( + Reader->getASTReader().GetLocalDecl(Reader->getModuleFile(), localID)); if (category) Categories.push_back(category); - } return Categories; @@ -930,8 +930,8 @@ static void printStoredContext(SwiftLookupTable::StoredContext context, } } -static uint32_t getEncodedDeclID(uint64_t entry) { - assert(SwiftLookupTable::isSerializationIDEntry(entry)); +static uint64_t getEncodedDeclID(uint64_t entry) { + assert(SwiftLookupTable::isSerializationIDEntry(entry)); assert(SwiftLookupTable::isDeclEntry(entry)); return entry >> 2; } @@ -1190,7 +1190,7 @@ namespace { uint64_t id; auto mappedEntry = Table.mapStored(entry, isModule); if (auto *decl = mappedEntry.dyn_cast()) { - id = (Writer.getDeclID(decl) << 2) | 0x02; + id = (Writer.getDeclID(decl).getRawValue() << 2) | 0x02; } else if (auto *macro = mappedEntry.dyn_cast()) { id = static_cast(Writer.getMacroID(macro)) << 32; id |= 0x02 | 0x01; @@ -1272,7 +1272,7 @@ namespace { uint64_t id; auto mappedEntry = Table.mapStored(entry, isModule); if (auto *decl = mappedEntry.dyn_cast()) { - id = (Writer.getDeclID(decl) << 2) | 0x02; + id = (Writer.getDeclID(decl).getRawValue() << 2) | 0x02; } else if (auto *macro = mappedEntry.dyn_cast()) { id = static_cast(Writer.getMacroID(macro)) << 32; id |= 0x02 | 0x01; @@ -1332,7 +1332,7 @@ void SwiftLookupTableWriter::writeExtensionContents( if (!table.Categories.empty()) { SmallVector categoryIDs; for (auto category : table.Categories) { - categoryIDs.push_back(Writer.getDeclID(category)); + categoryIDs.push_back(Writer.getDeclID(category).getRawValue()); } StringRef blob(reinterpret_cast(categoryIDs.data()), @@ -1555,10 +1555,11 @@ clang::NamedDecl *SwiftLookupTable::mapStoredDecl(uint64_t &entry) { // Otherwise, resolve the declaration. assert(Reader && "Cannot resolve the declaration without a reader"); - uint32_t declID = getEncodedDeclID(entry); + auto declID = getEncodedDeclID(entry); + auto localID = clang::LocalDeclID::get(Reader->getASTReader(), + Reader->getModuleFile(), declID); auto decl = cast_or_null( - Reader->getASTReader().GetLocalDecl(Reader->getModuleFile(), - declID)); + Reader->getASTReader().GetLocalDecl(Reader->getModuleFile(), localID)); // Update the entry now that we've resolved the declaration. entry = encodeEntry(decl); From aa7a3a8268676582283e8c0f6b94083fc1a83a48 Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Mon, 1 Jul 2024 14:55:22 -0700 Subject: [PATCH 15/15] Cleanup std includes Remove `deque` from files it isn't actually used in. Add it and `stack` to files that it is - presumably they were previously transitively found through other includes. --- lib/AST/NameLookup.cpp | 2 ++ lib/AST/RequirementMachine/KnuthBendix.cpp | 1 - lib/DependencyScan/ScanDependencies.cpp | 1 + lib/IDE/ImportDepth.cpp | 2 ++ lib/SILOptimizer/Utils/CastOptimizer.cpp | 1 - lib/SILOptimizer/Utils/InstOptUtils.cpp | 1 - tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp | 1 - 7 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/AST/NameLookup.cpp b/lib/AST/NameLookup.cpp index a7a852ec057e3..58a330b333f6c 100644 --- a/lib/AST/NameLookup.cpp +++ b/lib/AST/NameLookup.cpp @@ -49,6 +49,8 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" +#include + #define DEBUG_TYPE "namelookup" using namespace swift; diff --git a/lib/AST/RequirementMachine/KnuthBendix.cpp b/lib/AST/RequirementMachine/KnuthBendix.cpp index 2720deff65608..a0fc682574b63 100644 --- a/lib/AST/RequirementMachine/KnuthBendix.cpp +++ b/lib/AST/RequirementMachine/KnuthBendix.cpp @@ -34,7 +34,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include -#include #include #include "RewriteContext.h" diff --git a/lib/DependencyScan/ScanDependencies.cpp b/lib/DependencyScan/ScanDependencies.cpp index 354a91ddd504e..d8bf05315ca7a 100644 --- a/lib/DependencyScan/ScanDependencies.cpp +++ b/lib/DependencyScan/ScanDependencies.cpp @@ -65,6 +65,7 @@ #include #include #include +#include #include #include diff --git a/lib/IDE/ImportDepth.cpp b/lib/IDE/ImportDepth.cpp index ba23234cefc47..402966b96251f 100644 --- a/lib/IDE/ImportDepth.cpp +++ b/lib/IDE/ImportDepth.cpp @@ -15,6 +15,8 @@ #include "swift/Basic/Assertions.h" #include "clang/Basic/Module.h" +#include + using namespace swift; using namespace swift::ide; diff --git a/lib/SILOptimizer/Utils/CastOptimizer.cpp b/lib/SILOptimizer/Utils/CastOptimizer.cpp index fdbc17f85719d..9c2881acf3f32 100644 --- a/lib/SILOptimizer/Utils/CastOptimizer.cpp +++ b/lib/SILOptimizer/Utils/CastOptimizer.cpp @@ -42,7 +42,6 @@ #include "llvm/IR/Intrinsics.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" -#include #include using namespace swift; diff --git a/lib/SILOptimizer/Utils/InstOptUtils.cpp b/lib/SILOptimizer/Utils/InstOptUtils.cpp index ce18b9dfa9ae4..5b0754f0ee0c8 100644 --- a/lib/SILOptimizer/Utils/InstOptUtils.cpp +++ b/lib/SILOptimizer/Utils/InstOptUtils.cpp @@ -45,7 +45,6 @@ #include "llvm/IR/Intrinsics.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" -#include #include using namespace swift; diff --git a/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp b/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp index 6fd08774332b3..bbbabb2f6d499 100644 --- a/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp +++ b/tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp @@ -23,7 +23,6 @@ #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/ilist.h" #include "llvm/ADT/ilist_node.h" -#include using namespace SourceKit; using namespace CodeCompletion;