@@ -207,7 +207,8 @@ SILLocation::DebugLoc getDeserializedLoc(Decl *D) {
207
207
208
208
// / Use the SM to figure out the actual line/column of a SourceLoc.
209
209
template <typename WithLoc>
210
- SILLocation::DebugLoc getDebugLoc (SourceManager &SM, WithLoc *S, bool End = false ) {
210
+ SILLocation::DebugLoc getDebugLoc (SourceManager &SM, WithLoc *S,
211
+ bool End = false ) {
211
212
SILLocation::DebugLoc L;
212
213
if (S == nullptr )
213
214
return L;
@@ -273,8 +274,6 @@ static bool isAbstractClosure(const SILLocation &Loc) {
273
274
return false ;
274
275
}
275
276
276
- // / Construct an LLVM inlined-at location from a SILDebugScope,
277
- // / reversing the order in the process.
278
277
llvm::MDNode *IRGenDebugInfo::createInlinedAt (const SILDebugScope *DS) {
279
278
llvm::MDNode *InlinedAt = nullptr ;
280
279
if (DS) {
@@ -372,7 +371,6 @@ void IRGenDebugInfo::setCurrentLoc(IRBuilder &Builder, const SILDebugScope *DS,
372
371
Builder.SetCurrentDebugLocation (DL);
373
372
}
374
373
375
- // / getOrCreateScope - Translate a SILDebugScope into an llvm::DIDescriptor.
376
374
llvm::DIScope *IRGenDebugInfo::getOrCreateScope (const SILDebugScope *DS) {
377
375
if (DS == 0 )
378
376
return MainFile;
@@ -424,7 +422,6 @@ llvm::DIScope *IRGenDebugInfo::getOrCreateScope(const SILDebugScope *DS) {
424
422
return DScope;
425
423
}
426
424
427
- // / getOrCreateFile - Translate filenames into DIFiles.
428
425
llvm::DIFile *IRGenDebugInfo::getOrCreateFile (const char *Filename) {
429
426
if (!Filename)
430
427
return MainFile;
@@ -461,7 +458,6 @@ llvm::DIFile *IRGenDebugInfo::getOrCreateFile(const char *Filename) {
461
458
return F;
462
459
}
463
460
464
- // / Attempt to figure out the unmangled name of a function.
465
461
StringRef IRGenDebugInfo::getName (const FuncDecl &FD) {
466
462
// Getters and Setters are anonymous functions, so we forge a name
467
463
// using its parent declaration.
@@ -490,7 +486,6 @@ StringRef IRGenDebugInfo::getName(const FuncDecl &FD) {
490
486
return StringRef ();
491
487
}
492
488
493
- // / Attempt to figure out the unmangled name of a function.
494
489
StringRef IRGenDebugInfo::getName (SILLocation L) {
495
490
if (L.isNull ())
496
491
return StringRef ();
@@ -521,7 +516,6 @@ static CanSILFunctionType getFunctionType(SILType SILTy) {
521
516
return FnTy;
522
517
}
523
518
524
- // / Build the context chain for a given DeclContext.
525
519
llvm::DIScope *IRGenDebugInfo::getOrCreateContext (DeclContext *DC) {
526
520
if (!DC)
527
521
return TheCU;
@@ -575,7 +569,6 @@ llvm::DIScope *IRGenDebugInfo::getOrCreateContext(DeclContext *DC) {
575
569
return TheCU;
576
570
}
577
571
578
- // / Create a single parameter type and push it.
579
572
void IRGenDebugInfo::createParameterType (
580
573
llvm::SmallVectorImpl<llvm::Metadata *> &Parameters, SILType type,
581
574
DeclContext *DeclCtx) {
@@ -584,7 +577,6 @@ void IRGenDebugInfo::createParameterType(
584
577
Parameters.push_back (getOrCreateType (DbgTy));
585
578
}
586
579
587
- // / Create the array of function parameters for FnTy. SIL Version.
588
580
llvm::DITypeRefArray
589
581
IRGenDebugInfo::createParameterTypes (SILType SILTy, DeclContext *DeclCtx) {
590
582
if (!SILTy)
@@ -607,7 +599,6 @@ static SILType getResultTypeForDebugInfo(CanSILFunctionType fnTy) {
607
599
}
608
600
}
609
601
610
- // / Create the array of function parameters for a function type.
611
602
llvm::DITypeRefArray
612
603
IRGenDebugInfo::createParameterTypes (CanSILFunctionType FnTy,
613
604
DeclContext *DeclCtx) {
@@ -751,15 +742,6 @@ llvm::DISubprogram *IRGenDebugInfo::emitFunction(
751
742
// / TODO: This is no longer needed.
752
743
void IRGenDebugInfo::eraseFunction (llvm::Function *Fn) {}
753
744
754
- // / The DWARF output for import decls is similar to that of a using
755
- // / directive in C++:
756
- // / import Foundation
757
- // / -->
758
- // / 0: DW_TAG_imported_module
759
- // / DW_AT_import(*1)
760
- // / 1: DW_TAG_module // instead of DW_TAG_namespace.
761
- // / DW_AT_name("Foundation")
762
- // /
763
745
void IRGenDebugInfo::emitImport (ImportDecl *D) {
764
746
if (Opts.DebugInfoKind == IRGenDebugInfoKind::LineTables)
765
747
return ;
@@ -800,7 +782,6 @@ IRGenDebugInfo::getOrCreateModule(ModuleDecl::ImportedModule M) {
800
782
return cast<llvm::DIModule>(Scope);
801
783
}
802
784
803
- // / Return a cached module for an access path or create a new one.
804
785
llvm::DIModule *IRGenDebugInfo::getOrCreateModule (StringRef Key,
805
786
llvm::DIScope *Parent,
806
787
StringRef Name,
@@ -1046,8 +1027,6 @@ void IRGenDebugInfo::emitGlobalVariableDeclaration(llvm::GlobalValue *Var,
1046
1027
Var->hasInternalLinkage (), Var, nullptr );
1047
1028
}
1048
1029
1049
- // / Return the mangled name of any nominal type, including the global
1050
- // / _Tt prefix, which marks the Swift namespace for types in DWARF.
1051
1030
StringRef IRGenDebugInfo::getMangledName (DebugTypeInfo DbgTy) {
1052
1031
if (MetadataTypeDecl && DbgTy.getDecl () == MetadataTypeDecl)
1053
1032
return BumpAllocatedString (DbgTy.getDecl ()->getName ().str ());
@@ -1057,7 +1036,6 @@ StringRef IRGenDebugInfo::getMangledName(DebugTypeInfo DbgTy) {
1057
1036
return BumpAllocatedString (M.finalize ());
1058
1037
}
1059
1038
1060
- // / Create a member of a struct, class, tuple, or enum.
1061
1039
llvm::DIDerivedType *
1062
1040
IRGenDebugInfo::createMemberType (DebugTypeInfo DbgTy, StringRef Name,
1063
1041
unsigned &OffsetInBits, llvm::DIScope *Scope,
@@ -1073,7 +1051,6 @@ IRGenDebugInfo::createMemberType(DebugTypeInfo DbgTy, StringRef Name,
1073
1051
return DITy;
1074
1052
}
1075
1053
1076
- // / Return an array with the DITypes for each of a tuple's elements.
1077
1054
llvm::DINodeArray IRGenDebugInfo::getTupleElements (
1078
1055
TupleType *TupleTy, llvm::DIScope *Scope, llvm::DIFile *File,
1079
1056
unsigned Flags, DeclContext *DeclContext, unsigned &SizeInBits) {
@@ -1093,7 +1070,6 @@ llvm::DINodeArray IRGenDebugInfo::getTupleElements(
1093
1070
return DBuilder.getOrCreateArray (Elements);
1094
1071
}
1095
1072
1096
- // / Return an array with the DITypes for each of a struct's elements.
1097
1073
llvm::DINodeArray
1098
1074
IRGenDebugInfo::getStructMembers (NominalTypeDecl *D, Type BaseTy,
1099
1075
llvm::DIScope *Scope, llvm::DIFile *File,
@@ -1114,8 +1090,6 @@ IRGenDebugInfo::getStructMembers(NominalTypeDecl *D, Type BaseTy,
1114
1090
return DBuilder.getOrCreateArray (Elements);
1115
1091
}
1116
1092
1117
- // / Create a temporary forward declaration for a struct and add it to
1118
- // / the type cache so we can safely build recursive types.
1119
1093
llvm::DICompositeType *IRGenDebugInfo::createStructType (
1120
1094
DebugTypeInfo DbgTy, NominalTypeDecl *Decl, Type BaseTy,
1121
1095
llvm::DIScope *Scope, llvm::DIFile *File, unsigned Line,
@@ -1147,7 +1121,6 @@ llvm::DICompositeType *IRGenDebugInfo::createStructType(
1147
1121
return DITy;
1148
1122
}
1149
1123
1150
- // / Return an array with the DITypes for each of an enum's elements.
1151
1124
llvm::DINodeArray IRGenDebugInfo::getEnumElements (DebugTypeInfo DbgTy,
1152
1125
EnumDecl *ED,
1153
1126
llvm::DIScope *Scope,
@@ -1192,8 +1165,6 @@ llvm::DINodeArray IRGenDebugInfo::getEnumElements(DebugTypeInfo DbgTy,
1192
1165
return DBuilder.getOrCreateArray (Elements);
1193
1166
}
1194
1167
1195
- // / Create a temporary forward declaration for an enum and add it to
1196
- // / the type cache so we can safely build recursive types.
1197
1168
llvm::DICompositeType *IRGenDebugInfo::createEnumType (
1198
1169
DebugTypeInfo DbgTy, EnumDecl *Decl, StringRef MangledName,
1199
1170
llvm::DIScope *Scope, llvm::DIFile *File, unsigned Line, unsigned Flags) {
@@ -1221,7 +1192,6 @@ llvm::DICompositeType *IRGenDebugInfo::createEnumType(
1221
1192
return DITy;
1222
1193
}
1223
1194
1224
- // / Return a DIType for Ty reusing any DeclContext found in DbgTy.
1225
1195
llvm::DIType *IRGenDebugInfo::getOrCreateDesugaredType (Type Ty,
1226
1196
DebugTypeInfo DbgTy) {
1227
1197
DebugTypeInfo BlandDbgTy (Ty, DbgTy.StorageType , DbgTy.size , DbgTy.align ,
@@ -1245,7 +1215,6 @@ uint64_t IRGenDebugInfo::getSizeOfBasicType(DebugTypeInfo DbgTy) {
1245
1215
return BitWidth;
1246
1216
}
1247
1217
1248
- // / Convenience function that creates a forward declaration for PointeeTy.
1249
1218
llvm::DIType *IRGenDebugInfo::createPointerSizedStruct (
1250
1219
llvm::DIScope *Scope, StringRef Name, llvm::DIFile *File, unsigned Line,
1251
1220
unsigned Flags, StringRef MangledName) {
@@ -1256,8 +1225,6 @@ llvm::DIType *IRGenDebugInfo::createPointerSizedStruct(
1256
1225
MangledName);
1257
1226
}
1258
1227
1259
- // / Create a pointer-sized struct with a mangled name and a single
1260
- // / member of PointeeTy.
1261
1228
llvm::DIType *IRGenDebugInfo::createPointerSizedStruct (
1262
1229
llvm::DIScope *Scope, StringRef Name, llvm::DIType *PointeeTy,
1263
1230
llvm::DIFile *File, unsigned Line, unsigned Flags, StringRef MangledName) {
@@ -1274,8 +1241,6 @@ llvm::DIType *IRGenDebugInfo::createPointerSizedStruct(
1274
1241
llvm::dwarf::DW_LANG_Swift, nullptr , MangledName);
1275
1242
}
1276
1243
1277
- // / Create a 2*pointer-sized struct with a mangled name and a single
1278
- // / member of PointeeTy.
1279
1244
llvm::DIType *IRGenDebugInfo::createDoublePointerSizedStruct (
1280
1245
llvm::DIScope *Scope, StringRef Name, llvm::DIType *PointeeTy,
1281
1246
llvm::DIFile *File, unsigned Line, unsigned Flags, StringRef MangledName) {
@@ -1294,7 +1259,6 @@ llvm::DIType *IRGenDebugInfo::createDoublePointerSizedStruct(
1294
1259
llvm::dwarf::DW_LANG_Swift, nullptr , MangledName);
1295
1260
}
1296
1261
1297
- // / Create an opaque struct with a mangled name.
1298
1262
llvm::DIType *
1299
1263
IRGenDebugInfo::createOpaqueStruct (llvm::DIScope *Scope, StringRef Name,
1300
1264
llvm::DIFile *File, unsigned Line,
@@ -1307,18 +1271,6 @@ IRGenDebugInfo::createOpaqueStruct(llvm::DIScope *Scope, StringRef Name,
1307
1271
llvm::dwarf::DW_LANG_Swift, nullptr , MangledName);
1308
1272
}
1309
1273
1310
- // / Construct a DIType from a DebugTypeInfo object.
1311
- // /
1312
- // / At this point we do not plan to emit full DWARF for all swift
1313
- // / types, the goal is to emit only the name and provenance of the
1314
- // / type, where possible. A can import the type definition directly
1315
- // / from the module/framework/source file the type is specified in.
1316
- // / For this reason we emit the fully qualified (=mangled) name for
1317
- // / each type whenever possible.
1318
- // /
1319
- // / The ultimate goal is to emit something like a
1320
- // / DW_TAG_APPLE_ast_ref_type (an external reference) instead of a
1321
- // / local reference to the type.
1322
1274
llvm::DIType *IRGenDebugInfo::createType (DebugTypeInfo DbgTy,
1323
1275
StringRef MangledName,
1324
1276
llvm::DIScope *Scope,
@@ -1783,10 +1735,6 @@ static bool canMangle(TypeBase *Ty) {
1783
1735
}
1784
1736
}
1785
1737
1786
- // / Get the DIType corresponding to this DebugTypeInfo from the cache,
1787
- // / or build a fresh DIType otherwise. There is the underlying
1788
- // / assumption that no two types that share the same canonical type
1789
- // / can have different storage size or alignment.
1790
1738
llvm::DIType *IRGenDebugInfo::getOrCreateType (DebugTypeInfo DbgTy) {
1791
1739
// Is this an empty type?
1792
1740
if (DbgTy.isNull ())
0 commit comments