From 72b0120b4325f2c8e403e4342cdeeea37b908b55 Mon Sep 17 00:00:00 2001 From: Augusto Noronha Date: Fri, 22 Nov 2024 08:00:56 +0000 Subject: [PATCH] [DebugInfo] Fix handling of @_originallyDefinedIn types Emit an imported declaration for @_originallyDefinedIn under the real module that these types live in. This patch also changes the mangling for the debugger to respect @_originallyDefinedIn, and fixes a bug where @_originallyDefinedIn that should be ignored was still being used when mangling. rdar://137146961 --- lib/AST/ASTMangler.cpp | 2 +- lib/AST/Decl.cpp | 2 +- lib/IRGen/IRGenDebugInfo.cpp | 166 ++++++++++++++---- ...cal_type_originally_defined_in_other.swift | 24 ++- .../local_type_originally_defined_in.swift | 26 ++- test/DebugInfo/module_abi_name.swift | 6 - .../module_abi_name_and_orig_defined_in.swift | 11 ++ test/DebugInfo/originally_defined_in.swift | 47 +++-- .../demangleToMetadataMovedSymbols.swift | 6 +- 9 files changed, 232 insertions(+), 58 deletions(-) create mode 100644 test/DebugInfo/module_abi_name_and_orig_defined_in.swift diff --git a/lib/AST/ASTMangler.cpp b/lib/AST/ASTMangler.cpp index fd9842cfda693..1b5c03833ec19 100644 --- a/lib/AST/ASTMangler.cpp +++ b/lib/AST/ASTMangler.cpp @@ -717,7 +717,7 @@ std::string ASTMangler::mangleTypeForDebugger(Type Ty, GenericSignature sig) { Ty); DWARFMangling = true; - RespectOriginallyDefinedIn = false; + RespectOriginallyDefinedIn = true; OptimizeProtocolNames = false; beginMangling(); diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 5bfaf3ec28e03..119baf9be9a96 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -979,7 +979,7 @@ const ExternalSourceLocs *Decl::getSerializedLocs() const { StringRef Decl::getAlternateModuleName() const { for (auto *Att: Attrs) { if (auto *OD = dyn_cast(Att)) { - if (OD->isActivePlatform(getASTContext())) { + if (!OD->isInvalid() && OD->isActivePlatform(getASTContext())) { return OD->OriginalModuleName; } } diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index 156bd21e52f26..f624cf3049e1d 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -23,13 +23,17 @@ #include "IRBuilder.h" #include "swift/AST/ASTDemangler.h" #include "swift/AST/ASTMangler.h" +#include "swift/AST/Attr.h" +#include "swift/AST/Decl.h" #include "swift/AST/Expr.h" #include "swift/AST/GenericEnvironment.h" #include "swift/AST/IRGenOptions.h" #include "swift/AST/Module.h" #include "swift/AST/ModuleLoader.h" +#include "swift/AST/ParameterList.h" #include "swift/AST/Pattern.h" #include "swift/AST/TypeDifferenceVisitor.h" +#include "swift/AST/TypeWalker.h" #include "swift/Basic/Assertions.h" #include "swift/Basic/Compiler.h" #include "swift/Basic/SourceManager.h" @@ -137,7 +141,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { return Line == other.Line && Column == other.Column && File == other.File; } }; - + /// Various caches. /// \{ llvm::StringSet<> VarNames; @@ -150,6 +154,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { llvm::DenseMap DIModuleCache; llvm::StringMap DIFileCache; llvm::StringMap RuntimeErrorFnCache; + llvm::StringSet<> OriginallyDefinedInTypes; TrackingDIRefMap DIRefMap; TrackingDIRefMap InnerTypeCache; /// \} @@ -1026,9 +1031,12 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { Mangle::ASTMangler Mangler(IGM.Context); std::string Result = Mangler.mangleTypeForDebugger(Ty, Sig); + bool IsTypeOriginallyDefinedIn = + containsOriginallyDefinedIn(DbgTy.getType()); // TODO(https://github.com/apple/swift/issues/57699): We currently cannot round trip some C++ types. + // There's no way to round trip when respecting @_originallyDefinedIn for a type. if (!Opts.DisableRoundTripDebugTypes && - !Ty->getASTContext().LangOpts.EnableCXXInterop) { + !Ty->getASTContext().LangOpts.EnableCXXInterop && !IsTypeOriginallyDefinedIn) { // Make sure we can reconstruct mangled types for the debugger. auto &Ctx = Ty->getASTContext(); Type Reconstructed = Demangle::getTypeForMangling(Ctx, Result, Sig); @@ -1507,7 +1515,7 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type, /// anchor any typedefs that may appear in parameters so they can be /// resolved in the debugger without needing to query the Swift module. llvm::DINodeArray - collectGenericParams(NominalOrBoundGenericNominalType *BGT) { + collectGenericParams(NominalOrBoundGenericNominalType *BGT, bool AsForwardDeclarations = false) { // Collect the generic args from the type and its parent. std::vector GenericArgs; @@ -1522,7 +1530,8 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type, SmallVector TemplateParams; for (auto Arg : GenericArgs) { DebugTypeInfo ParamDebugType; - if (Opts.DebugInfoLevel > IRGenDebugInfoLevel::ASTTypes) + if (Opts.DebugInfoLevel > IRGenDebugInfoLevel::ASTTypes && + !AsForwardDeclarations) // For the DwarfTypes level don't generate just a forward declaration // for the generic type parameters. ParamDebugType = DebugTypeInfo::getFromTypeInfo( @@ -1790,39 +1799,19 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type, } llvm::DIType *SpecificationOf = nullptr; - if (auto *TypeDecl = DbgTy.getType()->getNominalOrBoundGenericNominal()) { - // If this is a nominal type that has the @_originallyDefinedIn attribute, - // IRGenDebugInfo emits a forward declaration of the type as a child - // of the original module, and the type with a specification pointing to - // the forward declaraation. We do this so LLDB has enough information to - // both find the type in reflection metadata (the parent module name) and - // find it in the swiftmodule (the module name in the type mangled name). - if (auto Attribute = - TypeDecl->getAttrs().getAttribute()) { - auto Identifier = IGM.getSILModule().getASTContext().getIdentifier( - Attribute->OriginalModuleName); - - void *Key = (void *)Identifier.get(); - auto InnerScope = - getOrCreateModule(Key, TheCU, Attribute->OriginalModuleName, {}); - SpecificationOf = DBuilder.createForwardDecl( - llvm::dwarf::DW_TAG_structure_type, TypeDecl->getNameStr(), - InnerScope, File, 0, llvm::dwarf::DW_LANG_Swift, 0, 0); - } - } // Here goes! switch (BaseTy->getKind()) { case TypeKind::BuiltinUnboundGeneric: llvm_unreachable("not a real type"); - + case TypeKind::BuiltinFixedArray: { // TODO: provide proper array debug info unsigned FwdDeclLine = 0; return createOpaqueStruct(Scope, "Builtin.FixedArray", MainFile, FwdDeclLine, SizeInBits, AlignInBits, Flags, MangledName); } - + case TypeKind::BuiltinPackIndex: case TypeKind::BuiltinInteger: { Encoding = llvm::dwarf::DW_ATE_unsigned; @@ -1846,7 +1835,7 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type, break; } - case TypeKind::BuiltinNativeObject: + case TypeKind::BuiltinNativeObject: case TypeKind::BuiltinBridgeObject: case TypeKind::BuiltinRawPointer: case TypeKind::BuiltinRawUnsafeContinuation: @@ -1928,7 +1917,7 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type, assert(SizeInBits == CI.getTargetInfo().getPointerWidth(clang::LangAS::Default)); if (Opts.DebugInfoLevel > IRGenDebugInfoLevel::ASTTypes) { - if (ClassTy->isSpecialized()) + if (ClassTy->isSpecialized()) return createSpecializedStructOrClassType( ClassTy, Decl, Scope, L.File, L.Line, SizeInBits, AlignInBits, Flags, MangledName); @@ -2011,7 +2000,7 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type, auto L = getFileAndLocation(Decl); unsigned FwdDeclLine = 0; - if (Opts.DebugInfoLevel > IRGenDebugInfoLevel::ASTTypes) + if (Opts.DebugInfoLevel > IRGenDebugInfoLevel::ASTTypes) return createSpecializedStructOrClassType( ClassTy, Decl, Scope, L.File, L.Line, SizeInBits, AlignInBits, Flags, MangledName); @@ -2315,8 +2304,8 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type, unsigned CachedSizeInBits = getSizeInBits(CachedType); if ((SizeInBits && CachedSizeInBits != *SizeInBits) || (!SizeInBits && CachedSizeInBits)) { - // In some situation a specialized type is emitted with size 0, even if the real - // type has a size. + // In some situation a specialized type is emitted with size 0, even if + // the real type has a size. if (DbgTy.getType()->isSpecialized() && SizeInBits && *SizeInBits > 0 && CachedSizeInBits == 0) return true; @@ -2336,7 +2325,7 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type, /// needed to correctly calculate the layout of more complex types built on /// top of them. void createSpecialStlibBuiltinTypes() { - if (Opts.DebugInfoLevel <= IRGenDebugInfoLevel::ASTTypes) + if (Opts.DebugInfoLevel <= IRGenDebugInfoLevel::ASTTypes) return; for (auto BuiltinType: IGM.getOrCreateSpecialStlibBuiltinTypes()) { auto DbgTy = DebugTypeInfo::getFromTypeInfo( @@ -2345,6 +2334,103 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type, } } + /// A TypeWalker that finds if a given type's mangling is affected by an + /// @_originallyDefinedIn annotation. + struct OriginallyDefinedInFinder : public TypeWalker { + bool visitedOriginallyDefinedIn = false; + + TypeWalker::Action walkToTypePre(Type T) override { + if (visitedOriginallyDefinedIn) + return TypeWalker::Action::Stop; + + // A typealias inside a function used that function's signature as part of + // its mangling, so check if any types in the generic signature are + // annotated with @_originallyDefinedIn. + if (auto *TAT = llvm::dyn_cast(T)) { + auto D = TAT->getDecl()->getDeclContext(); + if (auto AFD = llvm::dyn_cast(D)) { + OriginallyDefinedInFinder InnerWalker; + AFD->getInterfaceType().walk(InnerWalker); + if (InnerWalker.visitedOriginallyDefinedIn) { + visitedOriginallyDefinedIn = true; + return TypeWalker::Action::Stop; + } + } + } + + auto *TypeDecl = T->getNominalOrBoundGenericNominal(); + if (!TypeDecl) + return TypeWalker::Action::Continue; + + NominalTypeDecl *ParentDecl = TypeDecl; + while (llvm::isa_and_nonnull(ParentDecl->getParent())) + ParentDecl = llvm::cast(ParentDecl->getParent()); + + if (ParentDecl->getAttrs().hasAttribute()) { + visitedOriginallyDefinedIn = true; + return TypeWalker::Action::Stop; + } + + return TypeWalker::Action::Continue; + } + }; + + /// Returns true if the type's mangled name is affected by an + /// @_originallyDefinedIn annotation. This annotation can be on the type + /// itself, one of its generic arguments, etc. + bool containsOriginallyDefinedIn(Type T) { + OriginallyDefinedInFinder Walker; + T.walk(Walker); + return Walker.visitedOriginallyDefinedIn; + } + + /// Returns the decl of the type's parent chain annotated by + /// @_originallyDefinedIn. Returns null if no type is annotated. + NominalTypeDecl *getDeclAnnotatedByOriginallyDefinedIn(DebugTypeInfo DbgTy) { + auto Type = DbgTy.getType(); + auto *TypeDecl = Type->getNominalOrBoundGenericNominal(); + if (!TypeDecl) + return nullptr; + + // Find the outermost type, since only those can have @_originallyDefinedIn + // attached to them. + NominalTypeDecl *ParentDecl = TypeDecl; + while (llvm::isa_and_nonnull(ParentDecl->getParent())) + ParentDecl = llvm::cast(ParentDecl->getParent()); + + if (ParentDecl->getAttrs().hasAttribute()) + return ParentDecl;; + + return nullptr; + } + + /// If this is a nominal type that has the @_originallyDefinedIn + /// attribute, IRGenDebugInfo emits an imported declaration of the type as + /// a child of the real module. We do this so LLDB has enough + /// information to both find the type in reflection metadata (the module name + /// in the type's mangled name), and find it in the swiftmodule (the type's + /// imported declaration's parent module name). + void handleOriginallyDefinedIn(DebugTypeInfo DbgTy, llvm::DIType *DITy, + StringRef MangledName, llvm::DIFile *File) { + if (OriginallyDefinedInTypes.contains(MangledName)) + return; + + // Force the generation of the generic type parameters as forward + // declarations, as those types might be annotated with + // @_originallyDefinedIn. + if (auto *BoundDecl = llvm::dyn_cast(DbgTy.getType())) + collectGenericParams(BoundDecl, /*AsForwardDeclarations=*/true); + + NominalTypeDecl *OriginallyDefinedInDecl = getDeclAnnotatedByOriginallyDefinedIn(DbgTy); + if (!OriginallyDefinedInDecl) + return; + + // Emit the imported declaration under the real swiftmodule the type lives on. + auto RealModule = getOrCreateContext(OriginallyDefinedInDecl->getParent()); + DBuilder.createImportedDeclaration(RealModule, DITy, File, 0, MangledName); + OriginallyDefinedInTypes.insert(MangledName); + } + llvm::DIType *getOrCreateType(DebugTypeInfo DbgTy, llvm::DIScope *Scope = nullptr) { // Is this an empty type? @@ -2389,7 +2475,18 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type, ClangDecl = AliasDecl->getClangDecl(); } else if (auto *ND = DbgTy.getType()->getNominalOrBoundGenericNominal()) { TypeDecl = ND; - Context = ND->getParent(); + // If this is an originally defined in type, we want to emit this type's + // scope to be the ABI module. + if (auto Attribute = + ND->getAttrs().getAttribute()) { + auto Identifier = IGM.getSILModule().getASTContext().getIdentifier( + Attribute->OriginalModuleName); + void *Key = (void *)Identifier.get(); + Scope = + getOrCreateModule(Key, TheCU, Attribute->OriginalModuleName, {}); + } else { + Context = ND->getParent(); + } ClangDecl = ND->getClangDecl(); } else if (auto BNO = dyn_cast(DbgTy.getType())) { Context = BNO->getASTContext().TheBuiltinModule; @@ -2438,6 +2535,8 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type, FwdDeclTypes.emplace_back( std::piecewise_construct, std::make_tuple(MangledName), std::make_tuple(static_cast(FwdDecl))); + + handleOriginallyDefinedIn(DbgTy, FwdDecl, MangledName, getFile(Scope)); return FwdDecl; } llvm::DIType *DITy = createType(DbgTy, MangledName, Scope, getFile(Scope)); @@ -2466,6 +2565,7 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type, // Store it in the cache. DITypeCache.insert({DbgTy.getType(), llvm::TrackingMDNodeRef(DITy)}); + handleOriginallyDefinedIn(DbgTy, DITy, MangledName, getFile(Scope)); return DITy; } }; diff --git a/test/DebugInfo/Inputs/local_type_originally_defined_in_other.swift b/test/DebugInfo/Inputs/local_type_originally_defined_in_other.swift index 8f92fdeb8f7f0..31b15f8a87df6 100644 --- a/test/DebugInfo/Inputs/local_type_originally_defined_in_other.swift +++ b/test/DebugInfo/Inputs/local_type_originally_defined_in_other.swift @@ -1,2 +1,22 @@ -@available(macOS 10, *) -@_originallyDefinedIn(module: "Barn", macOS 10.1) public struct Horse {} +@_originallyDefinedIn( + module: "Barn", iOS 2.0, macOS 2.0, tvOS 2.0, watchOS 2.0) + @available(iOS 1.0, macOS 1.0, tvOS 1.0, watchOS 1.0, *) +public struct Horse { + public init() {} +} + +@_originallyDefinedIn( + module: "Barn", iOS 2.0, macOS 2.0, tvOS 2.0, watchOS 2.0) + @available(iOS 1.0, macOS 1.0, tvOS 1.0, watchOS 1.0, *) +public class Cow { + public init() {} +} + + +@_originallyDefinedIn( + module: "Barn", iOS 2.0, macOS 2.0, tvOS 2.0, watchOS 2.0) + @available(iOS 1.0, macOS 1.0, tvOS 1.0, watchOS 1.0, *) +public class Sheep { + public init() {} +} + diff --git a/test/DebugInfo/local_type_originally_defined_in.swift b/test/DebugInfo/local_type_originally_defined_in.swift index 82a2e31c7cca1..3f58ca032e59d 100644 --- a/test/DebugInfo/local_type_originally_defined_in.swift +++ b/test/DebugInfo/local_type_originally_defined_in.swift @@ -1,9 +1,14 @@ // RUN: %empty-directory(%t) // RUN: %target-swift-frontend -emit-module -emit-module-path %t/local_type_originally_defined_in_other.swiftmodule %S/Inputs/local_type_originally_defined_in_other.swift -// RUN: %target-swift-frontend -I%t -g -emit-ir %s +// RUN: %target-swift-frontend -I%t -g -emit-ir %s -o - | %FileCheck %s +// REQUIRES: OS=macosx import local_type_originally_defined_in_other +public func definedInOtherModule() { + let s = Sheep() + // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "Sheep"{{.*}}identifier: "$s4Barn5SheepCD +} public func localTypeAliasTest(horse: Horse) { // The local type mangling for 'A' mentions 'Horse', which must // be mangled using it's current module name, and not the @@ -13,4 +18,21 @@ public func localTypeAliasTest(horse: Horse) { let info = UnsafeMutablePointer.allocate(capacity: 1) _ = info -} \ No newline at end of file + // CHECK: DIDerivedType(tag: DW_TAG_typedef, name: "$s32local_type_originally_defined_in0A13TypeAliasTest5horsey4Barn5HorseV_tF1AL_aD" +} + +public func localTypeAliasTest() -> Horse { + typealias B = Int + + let info = UnsafeMutablePointer.allocate(capacity: 1) + _ = info + return Horse() + // CHECK: DIDerivedType(tag: DW_TAG_typedef, name: "$s32local_type_originally_defined_in0A13TypeAliasTest4Barn5HorseVyF1BL_aD" +} + +public func localTypeAliasTestGeneric(cow: T) { + typealias C = Int + + let info = UnsafeMutablePointer.allocate(capacity: 1) + _ = info +} diff --git a/test/DebugInfo/module_abi_name.swift b/test/DebugInfo/module_abi_name.swift index 23c0668200636..da6b21383bd96 100644 --- a/test/DebugInfo/module_abi_name.swift +++ b/test/DebugInfo/module_abi_name.swift @@ -3,11 +3,5 @@ class SomeClass {} // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "SomeClass",{{.*}}runtimeLang: DW_LANG_Swift, identifier: "$s7Goodbye9SomeClassCD" -@available(macOS 10.13, *) -@_originallyDefinedIn(module: "ThirdModule", OSX 10.12) -class DefinedElsewhere {} -// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "DefinedElsewhere",{{.*}}runtimeLang: DW_LANG_Swift, identifier: "$s7Goodbye16DefinedElsewhereCD") - let v1 = SomeClass() -let v2 = DefinedElsewhere() diff --git a/test/DebugInfo/module_abi_name_and_orig_defined_in.swift b/test/DebugInfo/module_abi_name_and_orig_defined_in.swift new file mode 100644 index 0000000000000..a37ad7d4ce199 --- /dev/null +++ b/test/DebugInfo/module_abi_name_and_orig_defined_in.swift @@ -0,0 +1,11 @@ +// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -module-name=Hello -module-abi-name Goodbye -emit-ir -o - | %FileCheck %s + +// REQUIRES: OS=macosx +// +@available(iOS 1.0, macOS 1.0, tvOS 1.0, watchOS 1.0, *) +@_originallyDefinedIn( + module: "ThirdModule", iOS 2.0, macOS 2.0, tvOS 2.0, watchOS 2.0) +public class DefinedElsewhere {} +// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "DefinedElsewhere",{{.*}}runtimeLang: DW_LANG_Swift, identifier: "$s11ThirdModule16DefinedElsewhereCD") + +let v2 = DefinedElsewhere() diff --git a/test/DebugInfo/originally_defined_in.swift b/test/DebugInfo/originally_defined_in.swift index 889616f6248cb..168aa9cd2f9b5 100644 --- a/test/DebugInfo/originally_defined_in.swift +++ b/test/DebugInfo/originally_defined_in.swift @@ -1,14 +1,41 @@ -// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s +// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - - @_originallyDefinedIn( - module: "Other", iOS 2.0, macOS 2.0, tvOS 2.0, watchOS 2.0) - @available(iOS 1.0, macOS 1.0, tvOS 1.0, watchOS 1.0, *) - public struct A { - let i = 10 - } +// REQUIRES: OS=macosx +// +@_originallyDefinedIn( + module: "Other", iOS 2.0, macOS 2.0, tvOS 2.0, watchOS 2.0) +@available(iOS 1.0, macOS 1.0, tvOS 1.0, watchOS 1.0, *) +public struct A { + let i = 10 +} - // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "A",{{.*}}identifier: "$s21originally_defined_in1AVD",{{.*}}specification: ![[S1:[0-9]+]] - // CHECK: [[S1]] = !DICompositeType(tag: DW_TAG_structure_type, name: "A", scope: ![[S2:[0-9]+]] - // CHECK: [[S2]] = !DIModule({{.*}}name: "Other" +@_originallyDefinedIn( + module: "Other", iOS 2.0, macOS 2.0, tvOS 2.0, watchOS 2.0) +@available(iOS 1.0, macOS 1.0, tvOS 1.0, watchOS 1.0, *) +public struct B { + let i = 10 +} + +// Test that a type with an invalid @_originallyDefinedIn does not change the mangled name. +@_originallyDefinedIn( + module: "Other", iOS 2.0, macOS 2.0, tvOS 2.0, watchOS 2.0) +@available(iOS 1.0, macOS 1.0, tvOS 1.0, watchOS 1.0, *) +private struct Invalid { + let i = 20 +} + +// CHECK: ![[MOD:[0-9]+]] = !DIModule(scope: null, name: "originally_defined_in" +// +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "A",{{.*}}scope: ![[S:[0-9]+]]{{.*}}identifier: "$s5Other1AVD" +// CHECK: [[S]] = !DIModule({{.*}}name: "Other" + +// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "Invalid",{{.*}}identifier: "$s21originally_defined_in + +// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "$s5Other1AVD",{{.*}}scope: ![[MOD]] +// +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "$s5Other1AV_ACtD", let a = A() +let b = B.self +let c = (A(), A()) +private let i = Invalid() diff --git a/test/Runtime/demangleToMetadataMovedSymbols.swift b/test/Runtime/demangleToMetadataMovedSymbols.swift index 397d51701d736..3fdc86802010e 100644 --- a/test/Runtime/demangleToMetadataMovedSymbols.swift +++ b/test/Runtime/demangleToMetadataMovedSymbols.swift @@ -12,17 +12,17 @@ let DemangleToMetadataMovedSymbolsTests = TestSuite("DemangleToMetadataMovedSymb @available(OSX 10.9, *) @_originallyDefinedIn(module: "foo", OSX 10.13) -struct MovedS { +public struct MovedS { struct Nested { } } @available(OSX 10.9, *) @_originallyDefinedIn(module: "foo", OSX 10.13) -enum MovedE { case e } +public enum MovedE { case e } @available(OSX 10.9, *) @_originallyDefinedIn(module: "bar", OSX 10.13) -class MovedC {} +public class MovedC {} DemangleToMetadataMovedSymbolsTests.test("Moved Nominals") { // Simple Struct