From 6bf7c0c954a1beaf84a49dbd6914ae720060dffb Mon Sep 17 00:00:00 2001 From: Erik Eckstein Date: Wed, 11 Oct 2023 07:58:51 +0200 Subject: [PATCH 1/2] ASTBridging: make BridgedDiagnosticEngine a typedef again Diverging from the definition in CASTBridging probably causes a compiler crash in the swift runtime when getting the metatype for BridgedDiagnosticEngine. rdar://116686158 --- include/swift/AST/ASTBridging.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/swift/AST/ASTBridging.h b/include/swift/AST/ASTBridging.h index 50985bf7ee7ef..2efe5101a11e3 100644 --- a/include/swift/AST/ASTBridging.h +++ b/include/swift/AST/ASTBridging.h @@ -40,9 +40,10 @@ typedef enum ENUM_EXTENSIBILITY_ATTR(open) BridgedDiagID : uint32_t { #include "swift/AST/DiagnosticsAll.def" } BridgedDiagID; -struct BridgedDiagnosticEngine { +// Must match the definition of BridgedDiagnosticEngine in CASTBridging.h. +typedef struct { void * _Nonnull object; -}; +} BridgedDiagnosticEngine; struct BridgedOptionalDiagnosticEngine { void *_Nullable object; From 93db0897c85249af6d715c32cf9dee9bef228908 Mon Sep 17 00:00:00 2001 From: Erik Eckstein Date: Wed, 11 Oct 2023 07:59:20 +0200 Subject: [PATCH 2/2] ASTBridging: fix storage size of BridgedDiagnosticFixIt and fix the static_assert error message --- include/swift/AST/ASTBridging.h | 2 +- lib/AST/ASTBridging.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/swift/AST/ASTBridging.h b/include/swift/AST/ASTBridging.h index 2efe5101a11e3..3d26622667e4b 100644 --- a/include/swift/AST/ASTBridging.h +++ b/include/swift/AST/ASTBridging.h @@ -67,7 +67,7 @@ class BridgedDiagnosticArgument { }; class BridgedDiagnosticFixIt { - int64_t storage[6]; + int64_t storage[7]; public: #ifdef USED_IN_CPP_SOURCE diff --git a/lib/AST/ASTBridging.cpp b/lib/AST/ASTBridging.cpp index a6d8a42ab3d2e..db58aaa98fe1b 100644 --- a/lib/AST/ASTBridging.cpp +++ b/lib/AST/ASTBridging.cpp @@ -35,7 +35,7 @@ BridgedDiagnosticArgument::BridgedDiagnosticArgument(BridgedStringRef s) : BridgedDiagnosticArgument(DiagnosticArgument(s.get())) {} static_assert(sizeof(BridgedDiagnosticFixIt) >= sizeof(DiagnosticInfo::FixIt), - "BridgedDiagnosticArgument has wrong size"); + "BridgedDiagnosticFixIt has wrong size"); static SourceLoc getSourceLoc(BridgedSourceLoc bridgedLoc) { return SourceLoc(llvm::SMLoc::getFromPointer(bridgedLoc.getLoc()));