mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add a basic "re-mangler", which turns a parsed
demangling tree back into a mangled string. Also, extend the demangling API in a few obvious ways, and simplify testing for failure in the node-returning APIs by having them simply return null instead of a spurious Failure node. Also, preserve slightly more information in the demangling tree. The goal here is eventually to always allow a perfect round-trip through the demangler parse tree. This patch gets us close, but we're not quite there yet. Tests to follow. Swift SVN r24473
This commit is contained in:
@@ -18,22 +18,28 @@
|
||||
/// NODE(ID)
|
||||
/// The node's enumerator value is Node::Kind::ID.
|
||||
|
||||
NODE(Failure)
|
||||
NODE(Allocator)
|
||||
NODE(ArchetypeAndProtocol)
|
||||
/// CONTEXT_NODE(ID)
|
||||
/// Nodes that can serve as contexts for other entities.
|
||||
#ifndef CONTEXT_NODE
|
||||
#define CONTEXT_NODE(ID) NODE(ID)
|
||||
#endif
|
||||
|
||||
CONTEXT_NODE(Allocator)
|
||||
NODE(Archetype)
|
||||
NODE(ArchetypeRef)
|
||||
NODE(ArgumentTuple)
|
||||
NODE(AssociatedType)
|
||||
NODE(AssociatedTypeRef)
|
||||
NODE(AutoClosureType)
|
||||
NODE(BoundGenericClass)
|
||||
NODE(BoundGenericEnum)
|
||||
NODE(BoundGenericStructure)
|
||||
NODE(BuiltinTypeName)
|
||||
NODE(Class)
|
||||
NODE(Constructor)
|
||||
NODE(Deallocator)
|
||||
CONTEXT_NODE(Class)
|
||||
CONTEXT_NODE(Constructor)
|
||||
CONTEXT_NODE(Deallocator)
|
||||
NODE(DeclContext)
|
||||
NODE(DefaultArgumentInitializer)
|
||||
CONTEXT_NODE(DefaultArgumentInitializer)
|
||||
NODE(DependentGenericSignature)
|
||||
NODE(DependentGenericParamCount)
|
||||
NODE(DependentGenericConformanceRequirement)
|
||||
@@ -43,63 +49,68 @@ NODE(DependentMemberType)
|
||||
NODE(DependentGenericParamType)
|
||||
NODE(DependentProtocolWitnessTableGenerator)
|
||||
NODE(DependentProtocolWitnessTableTemplate)
|
||||
NODE(Destructor)
|
||||
NODE(DidSet)
|
||||
CONTEXT_NODE(Destructor)
|
||||
CONTEXT_NODE(DidSet)
|
||||
NODE(Directness)
|
||||
NODE(DynamicAttribute)
|
||||
NODE(DynamicSelf)
|
||||
NODE(Enum)
|
||||
CONTEXT_NODE(Enum)
|
||||
NODE(ErrorType)
|
||||
NODE(ExistentialMetatype)
|
||||
NODE(ExplicitClosure)
|
||||
NODE(Extension)
|
||||
CONTEXT_NODE(ExplicitClosure)
|
||||
CONTEXT_NODE(Extension)
|
||||
NODE(FieldOffset)
|
||||
NODE(Function)
|
||||
CONTEXT_NODE(Function)
|
||||
NODE(FunctionSignatureSpecialization)
|
||||
NODE(FunctionSignatureSpecializationParam)
|
||||
NODE(FunctionSignatureSpecializationParamInfo)
|
||||
NODE(FunctionType)
|
||||
NODE(Generics)
|
||||
NODE(GenericSpecialization)
|
||||
NODE(GenericSpecializationParam)
|
||||
NODE(GenericType)
|
||||
NODE(GenericTypeMetadataPattern)
|
||||
NODE(Getter)
|
||||
CONTEXT_NODE(Getter)
|
||||
NODE(Global)
|
||||
NODE(GlobalGetter)
|
||||
CONTEXT_NODE(GlobalGetter)
|
||||
NODE(Identifier)
|
||||
NODE(IVarInitializer)
|
||||
NODE(IVarDestroyer)
|
||||
CONTEXT_NODE(IVarInitializer)
|
||||
CONTEXT_NODE(IVarDestroyer)
|
||||
NODE(ImplConvention)
|
||||
NODE(ImplFunctionAttribute)
|
||||
NODE(ImplFunctionType)
|
||||
NODE(ImplicitClosure)
|
||||
CONTEXT_NODE(ImplicitClosure)
|
||||
NODE(ImplParameter)
|
||||
NODE(ImplResult)
|
||||
NODE(InOut)
|
||||
NODE(InfixOperator)
|
||||
NODE(Initializer)
|
||||
CONTEXT_NODE(Initializer)
|
||||
NODE(LazyProtocolWitnessTableAccessor)
|
||||
NODE(LazyProtocolWitnessTableTemplate)
|
||||
NODE(LocalDeclName)
|
||||
NODE(MaterializeForSet)
|
||||
CONTEXT_NODE(MaterializeForSet)
|
||||
NODE(Metatype)
|
||||
NODE(MetatypeRepresentation)
|
||||
NODE(Metaclass)
|
||||
NODE(Module)
|
||||
NODE(NativeOwningAddressor)
|
||||
NODE(NativeOwningMutableAddressor)
|
||||
NODE(NativePinningAddressor)
|
||||
NODE(NativePinningMutableAddressor)
|
||||
CONTEXT_NODE(Module)
|
||||
CONTEXT_NODE(NativeOwningAddressor)
|
||||
CONTEXT_NODE(NativeOwningMutableAddressor)
|
||||
CONTEXT_NODE(NativePinningAddressor)
|
||||
CONTEXT_NODE(NativePinningMutableAddressor)
|
||||
NODE(NominalTypeDescriptor)
|
||||
NODE(NonObjCAttribute)
|
||||
NODE(NonVariadicTuple)
|
||||
NODE(Number)
|
||||
NODE(ObjCAttribute)
|
||||
NODE(ObjCBlock)
|
||||
NODE(OwningAddressor)
|
||||
NODE(OwningMutableAddressor)
|
||||
CONTEXT_NODE(OwningAddressor)
|
||||
CONTEXT_NODE(OwningMutableAddressor)
|
||||
NODE(PartialApplyForwarder)
|
||||
NODE(PartialApplyObjCForwarder)
|
||||
NODE(PostfixOperator)
|
||||
NODE(PrefixOperator)
|
||||
NODE(PrivateDeclName)
|
||||
NODE(Protocol)
|
||||
CONTEXT_NODE(Protocol)
|
||||
NODE(ProtocolConformance)
|
||||
NODE(ProtocolList)
|
||||
NODE(ProtocolWitness)
|
||||
@@ -109,37 +120,32 @@ NODE(ReabstractionThunk)
|
||||
NODE(ReabstractionThunkHelper)
|
||||
NODE(ReturnType)
|
||||
NODE(SelfTypeRef)
|
||||
NODE(Setter)
|
||||
NODE(SpecializedAttribute)
|
||||
NODE(SpecializationKind)
|
||||
NODE(GenericSpecializationParam)
|
||||
NODE(FunctionSignatureSpecializationParam)
|
||||
NODE(FunctionSignatureSpecializationParamInfo)
|
||||
NODE(Structure)
|
||||
NODE(Subscript)
|
||||
CONTEXT_NODE(Setter)
|
||||
CONTEXT_NODE(Structure)
|
||||
CONTEXT_NODE(Subscript)
|
||||
NODE(Suffix)
|
||||
NODE(ThinFunctionType)
|
||||
NODE(TupleElement)
|
||||
NODE(TupleElementName)
|
||||
NODE(TupleElementType)
|
||||
NODE(Type)
|
||||
NODE(TypeAlias)
|
||||
NODE(TypeList)
|
||||
NODE(TypeMangling)
|
||||
NODE(TypeMetadata)
|
||||
NODE(TypeMetadataAccessFunction)
|
||||
NODE(TypeMetadataLazyCache)
|
||||
NODE(UncurriedFunctionType)
|
||||
NODE(Unknown)
|
||||
NODE(Unmanaged)
|
||||
NODE(Unowned)
|
||||
NODE(UnsafeAddressor)
|
||||
NODE(UnsafeMutableAddressor)
|
||||
CONTEXT_NODE(UnsafeAddressor)
|
||||
CONTEXT_NODE(UnsafeMutableAddressor)
|
||||
NODE(ValueWitness)
|
||||
NODE(ValueWitnessTable)
|
||||
NODE(Variable)
|
||||
CONTEXT_NODE(Variable)
|
||||
NODE(VariadicTuple)
|
||||
NODE(Weak)
|
||||
NODE(WillSet)
|
||||
CONTEXT_NODE(WillSet)
|
||||
NODE(WitnessTableOffset)
|
||||
|
||||
#undef CONTEXT_NODE
|
||||
#undef NODE
|
||||
|
||||
Reference in New Issue
Block a user