diff --git a/Sources/CIndexStore/include/indexstore.h b/Sources/CIndexStore/include/indexstore.h index abcb9dd..328b3c2 100644 --- a/Sources/CIndexStore/include/indexstore.h +++ b/Sources/CIndexStore/include/indexstore.h @@ -25,7 +25,7 @@ * INDEXSTORE_VERSION_MAJOR is intended for "major" source/ABI breaking changes. */ #define INDEXSTORE_VERSION_MAJOR 0 -#define INDEXSTORE_VERSION_MINOR 13 +#define INDEXSTORE_VERSION_MINOR 15 /* added Swift init accessor sub-symbol */ #define INDEXSTORE_VERSION_ENCODE(major, minor) ( \ ((major) * 10000) \ @@ -128,6 +128,8 @@ typedef struct { INDEXSTORE_PUBLIC unsigned indexstore_format_version(void); +INDEXSTORE_PUBLIC unsigned indexstore_version(void); + typedef void *indexstore_t; typedef void *indexstore_creation_options_t; @@ -280,6 +282,7 @@ typedef enum { INDEXSTORE_SYMBOL_KIND_CONVERSIONFUNCTION = 24, INDEXSTORE_SYMBOL_KIND_PARAMETER = 25, INDEXSTORE_SYMBOL_KIND_USING = 26, + INDEXSTORE_SYMBOL_KIND_CONCEPT = 27, INDEXSTORE_SYMBOL_KIND_COMMENTTAG = 1000, } indexstore_symbol_kind_t; @@ -310,6 +313,7 @@ typedef enum { INDEXSTORE_SYMBOL_SUBKIND_SWIFTGENERICTYPEPARAM = 1013, INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORREAD = 1014, INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORMODIFY = 1015, + INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORINIT = 1016, } indexstore_symbol_subkind_t; INDEXSTORE_OPTIONS(uint64_t, indexstore_symbol_property_t) { diff --git a/Sources/CSwiftDemangle/PrivateHeaders/include/swift/Demangling/Demangle.h b/Sources/CSwiftDemangle/PrivateHeaders/include/swift/Demangling/Demangle.h index 0d42977..6ca1efb 100644 --- a/Sources/CSwiftDemangle/PrivateHeaders/include/swift/Demangling/Demangle.h +++ b/Sources/CSwiftDemangle/PrivateHeaders/include/swift/Demangling/Demangle.h @@ -19,18 +19,14 @@ #ifndef SWIFT_DEMANGLING_DEMANGLE_H #define SWIFT_DEMANGLING_DEMANGLE_H -#include -#include +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/Compiler.h" + #include #include #include -#define LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING 1 -#include "llvm/ADT/StringRef.h" -// #include "swift/Runtime/Config.h" - -namespace llvm { - class raw_ostream; -} +#include +#include namespace swift { namespace Demangle { @@ -44,7 +40,6 @@ std::string genericParameterName(uint64_t depth, uint64_t index); /// Display style options for the demangler. struct DemangleOptions { bool SynthesizeSugarOnTypes = false; - bool DisplayDebuggerGeneratedModule = true; bool QualifyEntities = true; bool DisplayExtensionContexts = true; bool DisplayUnmangledSuffix = true; @@ -53,12 +48,23 @@ struct DemangleOptions { bool DisplayProtocolConformances = true; bool DisplayWhereClauses = true; bool DisplayEntityTypes = true; + bool DisplayLocalNameContexts = true; bool ShortenPartialApply = false; bool ShortenThunk = false; bool ShortenValueWitness = false; bool ShortenArchetype = false; bool ShowPrivateDiscriminators = true; bool ShowFunctionArgumentTypes = true; + bool DisplayDebuggerGeneratedModule = true; + bool DisplayStdlibModule = true; + bool DisplayObjCModule = true; + bool PrintForTypeName = false; + bool ShowAsyncResumePartial = true; + bool ShowClosureSignature = true; + + /// If this is nonempty, entities in this module name will not be qualified. + llvm::StringRef HidingCurrentModule; + /// A function to render generic parameter names. std::function GenericParameterName = genericParameterName; @@ -81,6 +87,7 @@ struct DemangleOptions { Opt.ShortenArchetype = true; Opt.ShowPrivateDiscriminators = false; Opt.ShowFunctionArgumentTypes = false; + Opt.ShowAsyncResumePartial = false; return Opt; }; }; @@ -99,6 +106,8 @@ enum class FunctionSigSpecializationParamKind : unsigned { ClosureProp = 5, BoxToValue = 6, BoxToStack = 7, + InOutToOut = 8, + ConstantPropKeyPath = 9, // Option Set Flags use bits 6-31. This gives us 26 bits to use for option // flags. @@ -109,19 +118,45 @@ enum class FunctionSigSpecializationParamKind : unsigned { ExistentialToGeneric = 1 << 10, }; +enum class AutoDiffFunctionKind : char { + JVP = 'f', + VJP = 'r', + Differential = 'd', + Pullback = 'p', +}; + +enum class MangledDifferentiabilityKind : char { + NonDifferentiable = 0, + Forward = 'f', + Reverse = 'r', + Normal = 'd', + Linear = 'l', +}; + +enum class MangledLifetimeDependenceKind : char { Inherit = 'i', Scope = 's' }; + /// The pass that caused the specialization to occur. We use this to make sure /// that two passes that generate similar changes do not yield the same /// mangling. This currently cannot happen, so this is just a safety measure /// that creates separate name spaces. +/// +/// The number of entries is limited! See `Demangler::demangleSpecAttributes`. +/// If you exceed the max, you'll need to upgrade the mangling. enum class SpecializationPass : uint8_t { - AllocBoxToStack, + AllocBoxToStack = 0, ClosureSpecializer, CapturePromotion, CapturePropagation, FunctionSignatureOpts, GenericSpecializer, + MoveDiagnosticInOutToOut, + AsyncDemotion, + LAST = AsyncDemotion }; +constexpr uint8_t MAX_SPECIALIZATION_PASS = 10; +static_assert((uint8_t)SpecializationPass::LAST < MAX_SPECIALIZATION_PASS); + static inline char encodeSpecializationPass(SpecializationPass Pass) { return char(uint8_t(Pass)) + '0'; } @@ -169,7 +204,8 @@ class Node { Kind NodeKind; enum class PayloadKind : uint8_t { - None, Text, Index, OneChild, TwoChildren, ManyChildren + None = 0, OneChild = 1, TwoChildren = 2, + Text, Index, ManyChildren }; PayloadKind NodePayloadKind; @@ -190,6 +226,22 @@ class Node { public: Kind getKind() const { return NodeKind; } + bool isSimilarTo(const Node *other) const { + if (NodeKind != other->NodeKind + || NodePayloadKind != other->NodePayloadKind) + return false; + switch (NodePayloadKind) { + case PayloadKind::ManyChildren: + return Children.Number == other->Children.Number; + case PayloadKind::Index: + return Index == other->Index; + case PayloadKind::Text: + return Text == other->Text; + default: + return true; + } + } + bool hasText() const { return NodePayloadKind == PayloadKind::Text; } llvm::StringRef getText() const { assert(hasText()); @@ -204,19 +256,51 @@ class Node { using iterator = const NodePointer *; - size_t getNumChildren() const; + size_t getNumChildren() const { + switch (NodePayloadKind) { + case PayloadKind::OneChild: return 1; + case PayloadKind::TwoChildren: return 2; + case PayloadKind::ManyChildren: return Children.Number; + default: return 0; + } + } bool hasChildren() const { return getNumChildren() != 0; } - iterator begin() const; + iterator begin() const { + switch (NodePayloadKind) { + case PayloadKind::OneChild: + case PayloadKind::TwoChildren: + return &InlineChildren[0]; + case PayloadKind::ManyChildren: + return Children.Nodes; + default: + return nullptr; + } + } - iterator end() const; + iterator end() const { + switch (NodePayloadKind) { + case PayloadKind::OneChild: + return &InlineChildren[1]; + case PayloadKind::TwoChildren: + return &InlineChildren[2]; + case PayloadKind::ManyChildren: + return Children.Nodes + Children.Number; + default: + return nullptr; + } + } NodePointer getFirstChild() const { return getChild(0); } + NodePointer getLastChild() const { + return getChild(getNumChildren() - 1); + } NodePointer getChild(size_t index) const { - assert(getNumChildren() > index); + if (index >= getNumChildren()) + return nullptr; return begin()[index]; } @@ -225,13 +309,19 @@ class Node { // Only to be used by the demangler parsers. void removeChildAt(unsigned Pos); + void replaceChild(unsigned Pos, NodePointer Child); + // Reverses the order of children. void reverseChildren(size_t StartingAt = 0); + // Find a node by its kind, traversing the node depth-first, + // and bailing out early if not found at the 'maxDepth'. + NodePointer findByKind(Node::Kind kind, int maxDepth); + /// Prints the whole node tree in readable form to stderr. /// /// Useful to be called from the debugger. - void dump(); + void dump() LLVM_ATTRIBUTE_USED; }; /// Returns the length of the swift mangling prefix of the \p SymbolName. @@ -486,8 +576,78 @@ enum class OperatorKind { Infix, }; +/// A mangling error, which consists of an error code and a Node pointer +struct [[nodiscard]] ManglingError { + enum Code { + Success = 0, + AssertionFailed, + Uninitialized, + TooComplex, + BadNodeKind, + BadNominalTypeKind, + NotAStorageNode, + UnsupportedNodeKind, + UnexpectedBuiltinVectorType, + UnexpectedBuiltinType, + MultipleChildNodes, + WrongNodeType, + WrongDependentMemberType, + BadDirectness, + UnknownEncoding, + InvalidImplCalleeConvention, + InvalidImplDifferentiability, + InvalidImplCoroutineKind, + InvalidImplFunctionAttribute, + InvalidImplParameterConvention, + InvalidImplParameterSending, + InvalidMetatypeRepresentation, + MultiByteRelatedEntity, + BadValueWitnessKind, + NotAContextNode, + }; + + Code code; + NodePointer node; + unsigned line; + + ManglingError() : code(Uninitialized), node(nullptr) {} + ManglingError(Code c) : code(c), node(nullptr), line(0) {} + ManglingError(Code c, NodePointer n, unsigned l) : code(c), node(n), line(l) {} + + bool isSuccess() const { return code == Success; } +}; + +#define MANGLING_ERROR(c,n) ManglingError((c), (n), __LINE__) + +/// Used as a return type for mangling functions that may fail +template +class [[nodiscard]] ManglingErrorOr { +private: + ManglingError err_; + T value_; + +public: + ManglingErrorOr() : err_() {} + ManglingErrorOr(ManglingError::Code code, + NodePointer node = nullptr, + unsigned line = 0) + : err_(code, node, line) {} + ManglingErrorOr(const ManglingError &err) : err_(err) {} + ManglingErrorOr(const T &t) : err_(ManglingError::Success), value_(t) {} + ManglingErrorOr(T &&t) : err_(ManglingError::Success), value_(std::move(t)) {} + + bool isSuccess() const { return err_.code == ManglingError::Success; } + + const ManglingError &error() const { return err_; } + + const T &result() const { + assert(isSuccess()); + return value_; + } +}; + /// Remangle a demangled parse tree. -std::string mangleNode(NodePointer root); +ManglingErrorOr mangleNode(NodePointer root); using SymbolicResolver = llvm::function_ref mangleNode(NodePointer root, SymbolicResolver resolver); /// Remangle a demangled parse tree, using a callback to resolve /// symbolic references. /// /// The returned string is owned by \p Factory. This means \p Factory must stay /// alive as long as the returned string is used. -llvm::StringRef mangleNode(NodePointer root, SymbolicResolver resolver, - NodeFactory &Factory); +ManglingErrorOr mangleNode(NodePointer root, + SymbolicResolver resolver, + NodeFactory &Factory); /// Remangle in the old mangling scheme. /// /// This is only used for objc-runtime names. -std::string mangleNodeOld(NodePointer root); +ManglingErrorOr mangleNodeOld(NodePointer root); /// Remangle in the old mangling scheme. /// /// This is only used for objc-runtime names. /// The returned string is owned by \p Factory. This means \p Factory must stay /// alive as long as the returned string is used. -llvm::StringRef mangleNodeOld(NodePointer node, NodeFactory &Factory); +ManglingErrorOr mangleNodeOld(NodePointer node, + NodeFactory &Factory); /// Remangle in the old mangling scheme and embed the name in "_Tt_". /// /// The returned string is null terminated and owned by \p Factory. This means /// \p Factory must stay alive as long as the returned string is used. -const char *mangleNodeAsObjcCString(NodePointer node, NodeFactory &Factory); +ManglingErrorOr mangleNodeAsObjcCString(NodePointer node, + NodeFactory &Factory); /// Transform the node structure to a string. /// @@ -539,6 +702,11 @@ const char *mangleNodeAsObjcCString(NodePointer node, NodeFactory &Factory); std::string nodeToString(NodePointer Root, const DemangleOptions &Options = DemangleOptions()); +/// Transforms a mangled key path accessor thunk helper +/// into the identfier/subscript that would be used to invoke it in swift code. +std::string keyPathSourceString(const char *MangledName, + size_t MangledNameLength); + /// A class for printing to a std::string. class DemanglerPrinter { public: @@ -600,7 +768,7 @@ bool nodeConsumesGenericArgs(Node *node); bool isSpecialized(Node *node); -NodePointer getUnspecialized(Node *node, NodeFactory &Factory); +ManglingErrorOr getUnspecialized(Node *node, NodeFactory &Factory); /// Returns true if the node \p kind refers to a context node, e.g. a nominal /// type or a function. @@ -614,32 +782,13 @@ bool isFunctionAttr(Node::Kind kind); /// contain symbolic references. llvm::StringRef makeSymbolicMangledNameStringRef(const char *base); +/// Produce the mangled name for the nominal type descriptor of a type +/// referenced by its module and type name. +std::string mangledNameForTypeMetadataAccessor(llvm::StringRef moduleName, + llvm::StringRef typeName, + Node::Kind typeKind); + } // end namespace Demangle } // end namespace swift -// NB: This function is not used directly in the Swift codebase, but is -// exported for Xcode support and is used by the sanitizers. Please coordinate -// before changing. -// -/// Demangles a Swift symbol name. -/// -/// \param mangledName is the symbol name that needs to be demangled. -/// \param mangledNameLength is the length of the string that should be -/// demangled. -/// \param outputBuffer is the user provided buffer where the demangled name -/// will be placed. If nullptr, a new buffer will be malloced. In that case, -/// the user of this API is responsible for freeing the returned buffer. -/// \param outputBufferSize is the size of the output buffer. If the demangled -/// name does not fit into the outputBuffer, the output will be truncated and -/// the size will be updated, indicating how large the buffer should be. -/// \param flags can be used to select the demangling style. TODO: We should -//// define what these will be. -/// \returns the demangled name. Returns nullptr if the input String is not a -/// Swift mangled name. -char *swift_demangle(const char *mangledName, - size_t mangledNameLength, - char *outputBuffer, - size_t *outputBufferSize, - uint32_t flags); - #endif // SWIFT_DEMANGLING_DEMANGLE_H diff --git a/Sources/CSwiftDemangle/PrivateHeaders/include/swift/Demangling/DemangleNodes.def b/Sources/CSwiftDemangle/PrivateHeaders/include/swift/Demangling/DemangleNodes.def index dad2653..c872f1b 100644 --- a/Sources/CSwiftDemangle/PrivateHeaders/include/swift/Demangling/DemangleNodes.def +++ b/Sources/CSwiftDemangle/PrivateHeaders/include/swift/Demangling/DemangleNodes.def @@ -36,6 +36,7 @@ NODE(AccessorAttachedMacroExpansion) NODE(AssociatedTypeWitnessTableAccessor) NODE(BaseWitnessTableAccessor) NODE(AutoClosureType) +NODE(BodyAttachedMacroExpansion) NODE(BoundGenericClass) NODE(BoundGenericEnum) NODE(BoundGenericStructure) @@ -44,11 +45,13 @@ NODE(BoundGenericOtherNominalType) NODE(BoundGenericTypeAlias) NODE(BoundGenericFunction) NODE(BuiltinTypeName) +NODE(BuiltinTupleType) NODE(CFunctionPointer) NODE(ClangType) CONTEXT_NODE(Class) NODE(ClassMetadataBaseOffset) NODE(ConcreteProtocolConformance) +NODE(PackProtocolConformance) NODE(ConformanceAttachedMacroExpansion) CONTEXT_NODE(Constructor) NODE(CoroutineContinuationPrototype) @@ -129,7 +132,10 @@ CONTEXT_NODE(IVarDestroyer) NODE(ImplEscaping) NODE(ImplConvention) NODE(ImplDifferentiabilityKind) +NODE(ImplErasedIsolation) +NODE(ImplSendingResult) NODE(ImplParameterResultDifferentiability) +NODE(ImplParameterSending) NODE(ImplFunctionAttribute) NODE(ImplFunctionConvention) NODE(ImplFunctionConventionName) @@ -146,6 +152,9 @@ NODE(InfixOperator) CONTEXT_NODE(Initializer) CONTEXT_NODE(InitAccessor) NODE(Isolated) +NODE(Sending) +NODE(IsolatedAnyFunctionType) +NODE(SendingResultFunctionType) NODE(KeyPathGetterThunkHelper) NODE(KeyPathSetterThunkHelper) NODE(KeyPathEqualsThunkHelper) @@ -154,6 +163,7 @@ NODE(LazyProtocolWitnessTableAccessor) NODE(LazyProtocolWitnessTableCacheVariable) NODE(LocalDeclName) NODE(Macro) +NODE(MacroExpansionLoc) NODE(MacroExpansionUniqueName) CONTEXT_NODE(MaterializeForSet) NODE(MemberAttachedMacroExpansion) @@ -188,6 +198,7 @@ NODE(PartialApplyForwarder) NODE(PartialApplyObjCForwarder) NODE(PeerAttachedMacroExpansion) NODE(PostfixOperator) +NODE(PreambleAttachedMacroExpansion) NODE(PrefixOperator) NODE(PrivateDeclName) NODE(PropertyDescriptor) @@ -285,6 +296,7 @@ NODE(BaseConformanceDescriptor) NODE(AssociatedTypeDescriptor) NODE(AsyncAnnotation) NODE(ThrowsAnnotation) +NODE(TypedThrowsAnnotation) NODE(EmptyList) NODE(FirstElementMarker) NODE(VariadicMarker) @@ -364,10 +376,27 @@ NODE(SymbolicExtendedExistentialType) // Added in Swift 5.8 NODE(MetatypeParamsRemoved) NODE(HasSymbolQuery) -NODE(RuntimeDiscoverableAttributeRecord) -CONTEXT_NODE(RuntimeAttributeGenerator) NODE(OpaqueReturnTypeIndex) NODE(OpaqueReturnTypeParent) +// Addedn in Swift 6.0 +NODE(OutlinedEnumTagStore) +NODE(OutlinedEnumProjectDataForLoad) +NODE(OutlinedEnumGetTag) +// Added in Swift 5.9 + 1 +NODE(AsyncRemoved) + +// Added in Swift 5.TBD +NODE(ObjectiveCProtocolSymbolicReference) +NODE(ParamLifetimeDependence) +NODE(SelfLifetimeDependence) + +NODE(OutlinedInitializeWithCopyNoValueWitness) +NODE(OutlinedAssignWithTakeNoValueWitness) +NODE(OutlinedAssignWithCopyNoValueWitness) +NODE(OutlinedDestroyNoValueWitness) + +NODE(DependentGenericInverseConformanceRequirement) + #undef CONTEXT_NODE #undef NODE diff --git a/Sources/CSwiftDemangle/include/CSwiftDemangleNodeKind.h b/Sources/CSwiftDemangle/include/CSwiftDemangleNodeKind.h index b128cef..2a9a5b4 100644 --- a/Sources/CSwiftDemangle/include/CSwiftDemangleNodeKind.h +++ b/Sources/CSwiftDemangle/include/CSwiftDemangleNodeKind.h @@ -23,6 +23,7 @@ demangle_node_kind_AccessorAttachedMacroExpansion, demangle_node_kind_AssociatedTypeWitnessTableAccessor, demangle_node_kind_BaseWitnessTableAccessor, demangle_node_kind_AutoClosureType, +demangle_node_kind_BodyAttachedMacroExpansion, demangle_node_kind_BoundGenericClass, demangle_node_kind_BoundGenericEnum, demangle_node_kind_BoundGenericStructure, @@ -31,11 +32,13 @@ demangle_node_kind_BoundGenericOtherNominalType, demangle_node_kind_BoundGenericTypeAlias, demangle_node_kind_BoundGenericFunction, demangle_node_kind_BuiltinTypeName, +demangle_node_kind_BuiltinTupleType, demangle_node_kind_CFunctionPointer, demangle_node_kind_ClangType, demangle_node_kind_Class, demangle_node_kind_ClassMetadataBaseOffset, demangle_node_kind_ConcreteProtocolConformance, +demangle_node_kind_PackProtocolConformance, demangle_node_kind_ConformanceAttachedMacroExpansion, demangle_node_kind_Constructor, demangle_node_kind_CoroutineContinuationPrototype, @@ -116,7 +119,10 @@ demangle_node_kind_IVarDestroyer, demangle_node_kind_ImplEscaping, demangle_node_kind_ImplConvention, demangle_node_kind_ImplDifferentiabilityKind, +demangle_node_kind_ImplErasedIsolation, +demangle_node_kind_ImplSendingResult, demangle_node_kind_ImplParameterResultDifferentiability, +demangle_node_kind_ImplParameterSending, demangle_node_kind_ImplFunctionAttribute, demangle_node_kind_ImplFunctionConvention, demangle_node_kind_ImplFunctionConventionName, @@ -133,6 +139,9 @@ demangle_node_kind_InfixOperator, demangle_node_kind_Initializer, demangle_node_kind_InitAccessor, demangle_node_kind_Isolated, +demangle_node_kind_Sending, +demangle_node_kind_IsolatedAnyFunctionType, +demangle_node_kind_SendingResultFunctionType, demangle_node_kind_KeyPathGetterThunkHelper, demangle_node_kind_KeyPathSetterThunkHelper, demangle_node_kind_KeyPathEqualsThunkHelper, @@ -141,6 +150,7 @@ demangle_node_kind_LazyProtocolWitnessTableAccessor, demangle_node_kind_LazyProtocolWitnessTableCacheVariable, demangle_node_kind_LocalDeclName, demangle_node_kind_Macro, +demangle_node_kind_MacroExpansionLoc, demangle_node_kind_MacroExpansionUniqueName, demangle_node_kind_MaterializeForSet, demangle_node_kind_MemberAttachedMacroExpansion, @@ -175,6 +185,7 @@ demangle_node_kind_PartialApplyForwarder, demangle_node_kind_PartialApplyObjCForwarder, demangle_node_kind_PeerAttachedMacroExpansion, demangle_node_kind_PostfixOperator, +demangle_node_kind_PreambleAttachedMacroExpansion, demangle_node_kind_PrefixOperator, demangle_node_kind_PrivateDeclName, demangle_node_kind_PropertyDescriptor, @@ -277,6 +288,7 @@ demangle_node_kind_BaseConformanceDescriptor, demangle_node_kind_AssociatedTypeDescriptor, demangle_node_kind_AsyncAnnotation, demangle_node_kind_ThrowsAnnotation, +demangle_node_kind_TypedThrowsAnnotation, demangle_node_kind_EmptyList, demangle_node_kind_FirstElementMarker, demangle_node_kind_VariadicMarker, @@ -303,7 +315,7 @@ demangle_node_kind_SugaredArray, demangle_node_kind_SugaredDictionary, demangle_node_kind_SugaredParen, - +// Added in Swift 5.1 demangle_node_kind_AccessorFunctionReference, demangle_node_kind_OpaqueType, demangle_node_kind_OpaqueTypeDescriptorSymbolicReference, @@ -316,7 +328,7 @@ demangle_node_kind_OpaqueTypeDescriptorAccessorVar, demangle_node_kind_OpaqueReturnType, demangle_node_kind_OpaqueReturnTypeOf, - +// Added in Swift 5.4 demangle_node_kind_CanonicalSpecializedGenericMetaclass, demangle_node_kind_CanonicalSpecializedGenericTypeMetadataAccessFunction, demangle_node_kind_MetadataInstantiationCache, @@ -327,7 +339,7 @@ demangle_node_kind_GlobalVariableOnceToken, demangle_node_kind_GlobalVariableOnceDeclList, demangle_node_kind_CanonicalPrespecializedGenericTypeCachingOnceToken, - +// Added in Swift 5.5 demangle_node_kind_AsyncFunctionPointer, demangle_node_kind_AutoDiffFunction, demangle_node_kind_AutoDiffFunctionKind, @@ -340,11 +352,11 @@ demangle_node_kind_IndexSubset, demangle_node_kind_AsyncAwaitResumePartialFunction, demangle_node_kind_AsyncSuspendResumePartialFunction, - +// Added in Swift 5.6 demangle_node_kind_AccessibleFunctionRecord, demangle_node_kind_CompileTimeConst, - +// Added in Swift 5.7 demangle_node_kind_BackDeploymentThunk, demangle_node_kind_BackDeploymentFallback, demangle_node_kind_ExtendedExistentialTypeShape, @@ -353,12 +365,29 @@ demangle_node_kind_UniqueExtendedExistentialTypeShapeSymbolicReference, demangle_node_kind_NonUniqueExtendedExistentialTypeShapeSymbolicReference, demangle_node_kind_SymbolicExtendedExistentialType, - +// Added in Swift 5.8 demangle_node_kind_MetatypeParamsRemoved, demangle_node_kind_HasSymbolQuery, -demangle_node_kind_RuntimeDiscoverableAttributeRecord, -demangle_node_kind_RuntimeAttributeGenerator, demangle_node_kind_OpaqueReturnTypeIndex, demangle_node_kind_OpaqueReturnTypeParent, + +// Addedn in Swift 6.0 +demangle_node_kind_OutlinedEnumTagStore, +demangle_node_kind_OutlinedEnumProjectDataForLoad, +demangle_node_kind_OutlinedEnumGetTag, +// Added in Swift 5.9 + 1 +demangle_node_kind_AsyncRemoved, + +// Added in Swift 5.TBD +demangle_node_kind_ObjectiveCProtocolSymbolicReference, +demangle_node_kind_ParamLifetimeDependence, +demangle_node_kind_SelfLifetimeDependence, + +demangle_node_kind_OutlinedInitializeWithCopyNoValueWitness, +demangle_node_kind_OutlinedAssignWithTakeNoValueWitness, +demangle_node_kind_OutlinedAssignWithCopyNoValueWitness, +demangle_node_kind_OutlinedDestroyNoValueWitness, + +demangle_node_kind_DependentGenericInverseConformanceRequirement, # 4 "" 2 }; diff --git a/Sources/IndexStore/Constants.swift b/Sources/IndexStore/Constants.swift index c2087d6..7d66193 100644 --- a/Sources/IndexStore/Constants.swift +++ b/Sources/IndexStore/Constants.swift @@ -1,6 +1,6 @@ import CIndexStore -public struct SymbolRoles: OptionSet { +public struct SymbolRoles: OptionSet, Sendable { public let rawValue: UInt64 public init(rawValue: UInt64) { @@ -194,7 +194,7 @@ public extension SymbolKind { static let commentTag = INDEXSTORE_SYMBOL_KIND_COMMENTTAG } -extension SymbolKind: CustomStringConvertible { +extension SymbolKind: @retroactive CustomStringConvertible { public var description: String { switch self { case INDEXSTORE_SYMBOL_KIND_UNKNOWN: return "unknown" @@ -260,7 +260,7 @@ public extension SymbolSubkind { static let swiftAccessorModify = INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORMODIFY } -extension SymbolSubkind: CustomStringConvertible { +extension SymbolSubkind: @retroactive CustomStringConvertible { public var description: String { switch self { case INDEXSTORE_SYMBOL_SUBKIND_NONE: return "none" diff --git a/Sources/SwiftDemangle/DemangledNode.swift b/Sources/SwiftDemangle/DemangledNode.swift index 6e3c6f4..933d1bb 100644 --- a/Sources/SwiftDemangle/DemangledNode.swift +++ b/Sources/SwiftDemangle/DemangledNode.swift @@ -54,7 +54,7 @@ public struct DemangledNode { } } -extension DemangledNodeKind: CustomDebugStringConvertible { +extension DemangledNodeKind: @retroactive CustomDebugStringConvertible { public var debugDescription: String { String(cString: node_getKindName(self)) }