mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Revert "[Debug info] Emit bound generic class type parameters when emitting AST types"
This reverts commit f2132890db
it triggers the debug info sanity check when running the source compatibility testsuite.
This commit is contained in:
@@ -1283,12 +1283,16 @@ private:
|
|||||||
DBuilder.createInheritance(UnsubstitutedType, SuperClassDITy, 0, 0,
|
DBuilder.createInheritance(UnsubstitutedType, SuperClassDITy, 0, 0,
|
||||||
llvm::DINode::FlagZero);
|
llvm::DINode::FlagZero);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto *OpaqueType = createPointerSizedStruct(
|
||||||
|
Scope, Decl ? Decl->getNameStr() : MangledName, File, 0, Flags,
|
||||||
|
MangledName, UnsubstitutedType);
|
||||||
|
return OpaqueType;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *OpaqueType =
|
auto *OpaqueType = createOpaqueStruct(
|
||||||
createOpaqueStruct(Scope, Decl ? Decl->getNameStr() : "", File, Line,
|
Scope, "", File, Line, SizeInBits, AlignInBits, Flags, MangledName,
|
||||||
SizeInBits, AlignInBits, Flags, MangledName,
|
collectGenericParams(Type), UnsubstitutedType);
|
||||||
collectGenericParams(Type), UnsubstitutedType);
|
|
||||||
DBuilder.replaceTemporary(std::move(FwdDecl), OpaqueType);
|
DBuilder.replaceTemporary(std::move(FwdDecl), OpaqueType);
|
||||||
return OpaqueType;
|
return OpaqueType;
|
||||||
}
|
}
|
||||||
@@ -1975,9 +1979,18 @@ private:
|
|||||||
auto L = getFileAndLocation(Decl);
|
auto L = getFileAndLocation(Decl);
|
||||||
unsigned FwdDeclLine = 0;
|
unsigned FwdDeclLine = 0;
|
||||||
|
|
||||||
return createSpecializedStructOrClassType(ClassTy, Decl, Scope, L.File,
|
if (Opts.DebugInfoLevel > IRGenDebugInfoLevel::ASTTypes)
|
||||||
L.Line, SizeInBits, AlignInBits,
|
return createSpecializedStructOrClassType(
|
||||||
Flags, MangledName);
|
ClassTy, Decl, Scope, L.File, L.Line, SizeInBits, AlignInBits,
|
||||||
|
Flags, MangledName);
|
||||||
|
|
||||||
|
// TODO: We may want to peek at Decl->isObjC() and set this
|
||||||
|
// attribute accordingly.
|
||||||
|
assert(SizeInBits ==
|
||||||
|
CI.getTargetInfo().getPointerWidth(clang::LangAS::Default));
|
||||||
|
return createPointerSizedStruct(
|
||||||
|
Scope, Decl ? Decl->getNameStr() : MangledName, L.File, FwdDeclLine,
|
||||||
|
Flags, MangledName, SpecificationOf);
|
||||||
}
|
}
|
||||||
|
|
||||||
case TypeKind::Pack:
|
case TypeKind::Pack:
|
||||||
@@ -2161,14 +2174,8 @@ private:
|
|||||||
AliasedTy, DbgTy.getAlignment(), DbgTy.hasDefaultAlignment(),
|
AliasedTy, DbgTy.getAlignment(), DbgTy.hasDefaultAlignment(),
|
||||||
/* IsMetadataType = */ false, DbgTy.isFixedBuffer(),
|
/* IsMetadataType = */ false, DbgTy.isFixedBuffer(),
|
||||||
DbgTy.getNumExtraInhabitants());
|
DbgTy.getNumExtraInhabitants());
|
||||||
auto *TypeDef = DBuilder.createTypedef(getOrCreateType(AliasedDbgTy),
|
return DBuilder.createTypedef(getOrCreateType(AliasedDbgTy), MangledName,
|
||||||
MangledName, L.File, 0, Scope);
|
L.File, 0, Scope);
|
||||||
// Bound generic types don't reference their type parameters in ASTTypes
|
|
||||||
// mode, so we need to artificially keep typealiases alive, since they can
|
|
||||||
// appear in reflection metadata.
|
|
||||||
if (Opts.DebugInfoLevel < IRGenDebugInfoLevel::DwarfTypes)
|
|
||||||
DBuilder.retainType(TypeDef);
|
|
||||||
return TypeDef;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case TypeKind::Locatable: {
|
case TypeKind::Locatable: {
|
||||||
@@ -2504,7 +2511,6 @@ private:
|
|||||||
// winning over a full definition.
|
// winning over a full definition.
|
||||||
auto *FwdDecl = DBuilder.createReplaceableCompositeType(
|
auto *FwdDecl = DBuilder.createReplaceableCompositeType(
|
||||||
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, 0, 0,
|
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, 0, 0,
|
||||||
|
|
||||||
llvm::dwarf::DW_LANG_Swift);
|
llvm::dwarf::DW_LANG_Swift);
|
||||||
FwdDeclTypes.emplace_back(
|
FwdDeclTypes.emplace_back(
|
||||||
std::piecewise_construct, std::make_tuple(MangledName),
|
std::piecewise_construct, std::make_tuple(MangledName),
|
||||||
|
|||||||
@@ -351,14 +351,14 @@ func testBlocksWithGenerics(hba: HasBlockArray) -> Any {
|
|||||||
|
|
||||||
// CHECK: attributes [[NOUNWIND]] = { nounwind memory(read) }
|
// CHECK: attributes [[NOUNWIND]] = { nounwind memory(read) }
|
||||||
|
|
||||||
// CHECK-DAG: ![[SWIFT_NAME_ALIAS_VAR]] = !DILocalVariable(name: "obj", arg: 1, scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 328, type: ![[LET_SWIFT_NAME_ALIAS_TYPE:[0-9]+]])
|
// CHECK: ![[SWIFT_NAME_ALIAS_VAR]] = !DILocalVariable(name: "obj", arg: 1, scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: ![[SWIFT_NAME_ALIAS_TYPE:[0-9]+]])
|
||||||
// CHECK-DAG: ![[LET_SWIFT_NAME_ALIAS_TYPE]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: ![[SWIFT_NAME_ALIAS_TYPE:[0-9]+]])
|
// CHECK: ![[LET_SWIFT_NAME_ALIAS_TYPE:[0-9]+]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: ![[SWIFT_NAME_ALIAS_TYPE:[0-9]+]])
|
||||||
// CHECK-DAG: ![[SWIFT_NAME_ALIAS_TYPE]] = !DIDerivedType(tag: DW_TAG_typedef, name: "$sSo14SwiftNameAliasaD", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, baseType: !{{[0-9]+}})
|
// CHECK: ![[SWIFT_NAME_ALIAS_TYPE]] = !DIDerivedType(tag: DW_TAG_typedef, name: "$sSo14SwiftNameAliasaD", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, baseType: !{{[0-9]+}})
|
||||||
|
|
||||||
// CHECK-DAG: ![[SWIFT_GENERIC_NAME_ALIAS_VAR]] = !DILocalVariable(name: "generic_obj", arg: 1, scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: ![[LET_SWIFT_GENERIC_NAME_ALIAS_TYPE:[0-9]+]])
|
// CHECK: ![[SWIFT_GENERIC_NAME_ALIAS_VAR]] = !DILocalVariable(name: "generic_obj", arg: 1, scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: ![[LET_SWIFT_GENERIC_NAME_ALIAS_TYPE:[0-9]+]])
|
||||||
// CHECK-DAG: ![[LET_SWIFT_GENERIC_NAME_ALIAS_TYPE]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: ![[SWIFT_GENERIC_NAME_ALIAS_TYPE:[0-9]+]])
|
// CHECK: ![[LET_SWIFT_GENERIC_NAME_ALIAS_TYPE:[0-9]+]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: ![[SWIFT_GENERIC_NAME_ALIAS_TYPE:[0-9]+]])
|
||||||
// CHECK-DAG: ![[SWIFT_GENERIC_NAME_ALIAS_TYPE]] = !DIDerivedType(tag: DW_TAG_typedef, name: "$sSo21SwiftGenericNameAliasaySo8NSNumberCGD", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, baseType: !{{[0-9]+}})
|
// CHECK: ![[SWIFT_GENERIC_NAME_ALIAS_TYPE]] = !DIDerivedType(tag: DW_TAG_typedef, name: "$sSo21SwiftGenericNameAliasaySo8NSNumberCGD", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, baseType: !{{[0-9]+}})
|
||||||
|
|
||||||
// CHECK-DAG: ![[SWIFT_CONSTR_GENERIC_NAME_ALIAS_VAR]] = !DILocalVariable(name: "constr_generic_obj", arg: 1, scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: ![[LET_SWIFT_CONSTR_GENERIC_NAME_ALIAS_TYPE:[0-9]+]])
|
// CHECK: ![[SWIFT_CONSTR_GENERIC_NAME_ALIAS_VAR]] = !DILocalVariable(name: "constr_generic_obj", arg: 1, scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: ![[LET_SWIFT_CONSTR_GENERIC_NAME_ALIAS_TYPE:[0-9]+]])
|
||||||
// CHECK-DAG: ![[LET_SWIFT_CONSTR_GENERIC_NAME_ALIAS_TYPE]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: ![[SWIFT_CONSTR_GENERIC_NAME_ALIAS_TYPE:[0-9]+]])
|
// CHECK: ![[LET_SWIFT_CONSTR_GENERIC_NAME_ALIAS_TYPE:[0-9]+]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: ![[SWIFT_CONSTR_GENERIC_NAME_ALIAS_TYPE:[0-9]+]])
|
||||||
// CHECK-DAG: ![[SWIFT_CONSTR_GENERIC_NAME_ALIAS_TYPE]] = !DIDerivedType(tag: DW_TAG_typedef, name: "$sSo27SwiftConstrGenericNameAliasaySo8NSNumberCGD", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, baseType: !{{[0-9]+}})
|
// CHECK: ![[SWIFT_CONSTR_GENERIC_NAME_ALIAS_TYPE]] = !DIDerivedType(tag: DW_TAG_typedef, name: "$sSo27SwiftConstrGenericNameAliasaySo8NSNumberCGD", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, baseType: !{{[0-9]+}})
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public let s = S<Int>(t: 0)
|
|||||||
// CHECK: ![[INTPARAM]] = !DITemplateTypeParameter(type: ![[INT:[0-9]+]])
|
// CHECK: ![[INTPARAM]] = !DITemplateTypeParameter(type: ![[INT:[0-9]+]])
|
||||||
// CHECK: ![[INT]] = !DICompositeType(tag: DW_TAG_structure_type, {{.*}}identifier: "$sSiD"
|
// CHECK: ![[INT]] = !DICompositeType(tag: DW_TAG_structure_type, {{.*}}identifier: "$sSiD"
|
||||||
|
|
||||||
|
|
||||||
// DWARF: !DICompositeType(tag: DW_TAG_structure_type,
|
// DWARF: !DICompositeType(tag: DW_TAG_structure_type,
|
||||||
// DWARF-SAME: templateParams: ![[PARAMS:[0-9]+]]
|
// DWARF-SAME: templateParams: ![[PARAMS:[0-9]+]]
|
||||||
// DWARF-SAME: identifier: "$s18BoundGenericStruct1SVySiGD"
|
// DWARF-SAME: identifier: "$s18BoundGenericStruct1SVySiGD"
|
||||||
@@ -39,7 +40,10 @@ public let inner = S2<Double>.Inner(t:4.2)
|
|||||||
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "$s18BoundGenericStruct2S2VyxGD",
|
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "$s18BoundGenericStruct2S2VyxGD",
|
||||||
// CHECK-SAME: flags: DIFlagFwdDecl, runtimeLang: DW_LANG_Swift)
|
// CHECK-SAME: flags: DIFlagFwdDecl, runtimeLang: DW_LANG_Swift)
|
||||||
|
|
||||||
// DWARF: !DICompositeType(tag: DW_TAG_structure_type, name: "Inner", scope: ![[SCOPE1:[0-9]+]],{{.*}} size: 64, {{.*}}, templateParams: ![[PARAMS2:[0-9]+]], identifier: "$s18BoundGenericStruct2S2V5InnerVySd_GD",{{.*}} specification: ![[SPECIFICATION:[0-9]+]]
|
// DWARF: !DICompositeType(tag: DW_TAG_structure_type, scope: ![[SCOPE1:[0-9]+]],
|
||||||
|
// DWARF-SAME: size: 64, {{.*}}, templateParams: ![[PARAMS2:[0-9]+]], identifier: "$s18BoundGenericStruct2S2V5InnerVySd_GD"
|
||||||
|
// DWARF-SAME: specification: ![[SPECIFICATION:[0-9]+]]
|
||||||
|
|
||||||
// DWARF: ![[SCOPE1]] = !DICompositeType(tag: DW_TAG_structure_type, name: "$s18BoundGenericStruct2S2VyxGD",
|
// DWARF: ![[SCOPE1]] = !DICompositeType(tag: DW_TAG_structure_type, name: "$s18BoundGenericStruct2S2VyxGD",
|
||||||
|
|
||||||
// DWARF: ![[PARAMS2]] = !{![[PARAMS3:[0-9]+]]}
|
// DWARF: ![[PARAMS2]] = !{![[PARAMS3:[0-9]+]]}
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
// RUN: %target-swift-frontend %s -emit-ir -parse-as-library -module-name a -g -o - | %FileCheck %s
|
|
||||||
// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "$s1a10LocalAliasaD", {{.*}}baseType: ![[BASETY:[0-9]+]]
|
|
||||||
// CHECK: ![[BASETY]]{{.*}}$sSbD
|
|
||||||
public class MyClass<A, B> {}
|
|
||||||
public typealias LocalAlias = Bool
|
|
||||||
public typealias ClassAlias = MyClass<LocalAlias, Bool>
|
|
||||||
public func use(cls: ClassAlias?) {}
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user