Skip to content

Commit 55607b2

Browse files
committed
Move IRGenDebugInfo Doxygen comments into the header file, LLVM-style.
NFC
1 parent e6d1344 commit 55607b2

File tree

2 files changed

+69
-63
lines changed

2 files changed

+69
-63
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ SILLocation::DebugLoc getDeserializedLoc(Decl *D) {
207207

208208
/// Use the SM to figure out the actual line/column of a SourceLoc.
209209
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) {
211212
SILLocation::DebugLoc L;
212213
if (S == nullptr)
213214
return L;
@@ -273,8 +274,6 @@ static bool isAbstractClosure(const SILLocation &Loc) {
273274
return false;
274275
}
275276

276-
/// Construct an LLVM inlined-at location from a SILDebugScope,
277-
/// reversing the order in the process.
278277
llvm::MDNode *IRGenDebugInfo::createInlinedAt(const SILDebugScope *DS) {
279278
llvm::MDNode *InlinedAt = nullptr;
280279
if (DS) {
@@ -372,7 +371,6 @@ void IRGenDebugInfo::setCurrentLoc(IRBuilder &Builder, const SILDebugScope *DS,
372371
Builder.SetCurrentDebugLocation(DL);
373372
}
374373

375-
/// getOrCreateScope - Translate a SILDebugScope into an llvm::DIDescriptor.
376374
llvm::DIScope *IRGenDebugInfo::getOrCreateScope(const SILDebugScope *DS) {
377375
if (DS == 0)
378376
return MainFile;
@@ -424,7 +422,6 @@ llvm::DIScope *IRGenDebugInfo::getOrCreateScope(const SILDebugScope *DS) {
424422
return DScope;
425423
}
426424

427-
/// getOrCreateFile - Translate filenames into DIFiles.
428425
llvm::DIFile *IRGenDebugInfo::getOrCreateFile(const char *Filename) {
429426
if (!Filename)
430427
return MainFile;
@@ -461,7 +458,6 @@ llvm::DIFile *IRGenDebugInfo::getOrCreateFile(const char *Filename) {
461458
return F;
462459
}
463460

464-
/// Attempt to figure out the unmangled name of a function.
465461
StringRef IRGenDebugInfo::getName(const FuncDecl &FD) {
466462
// Getters and Setters are anonymous functions, so we forge a name
467463
// using its parent declaration.
@@ -490,7 +486,6 @@ StringRef IRGenDebugInfo::getName(const FuncDecl &FD) {
490486
return StringRef();
491487
}
492488

493-
/// Attempt to figure out the unmangled name of a function.
494489
StringRef IRGenDebugInfo::getName(SILLocation L) {
495490
if (L.isNull())
496491
return StringRef();
@@ -521,7 +516,6 @@ static CanSILFunctionType getFunctionType(SILType SILTy) {
521516
return FnTy;
522517
}
523518

524-
/// Build the context chain for a given DeclContext.
525519
llvm::DIScope *IRGenDebugInfo::getOrCreateContext(DeclContext *DC) {
526520
if (!DC)
527521
return TheCU;
@@ -575,7 +569,6 @@ llvm::DIScope *IRGenDebugInfo::getOrCreateContext(DeclContext *DC) {
575569
return TheCU;
576570
}
577571

578-
/// Create a single parameter type and push it.
579572
void IRGenDebugInfo::createParameterType(
580573
llvm::SmallVectorImpl<llvm::Metadata *> &Parameters, SILType type,
581574
DeclContext *DeclCtx) {
@@ -584,7 +577,6 @@ void IRGenDebugInfo::createParameterType(
584577
Parameters.push_back(getOrCreateType(DbgTy));
585578
}
586579

587-
/// Create the array of function parameters for FnTy. SIL Version.
588580
llvm::DITypeRefArray
589581
IRGenDebugInfo::createParameterTypes(SILType SILTy, DeclContext *DeclCtx) {
590582
if (!SILTy)
@@ -607,7 +599,6 @@ static SILType getResultTypeForDebugInfo(CanSILFunctionType fnTy) {
607599
}
608600
}
609601

610-
/// Create the array of function parameters for a function type.
611602
llvm::DITypeRefArray
612603
IRGenDebugInfo::createParameterTypes(CanSILFunctionType FnTy,
613604
DeclContext *DeclCtx) {
@@ -751,15 +742,6 @@ llvm::DISubprogram *IRGenDebugInfo::emitFunction(
751742
/// TODO: This is no longer needed.
752743
void IRGenDebugInfo::eraseFunction(llvm::Function *Fn) {}
753744

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-
///
763745
void IRGenDebugInfo::emitImport(ImportDecl *D) {
764746
if (Opts.DebugInfoKind == IRGenDebugInfoKind::LineTables)
765747
return;
@@ -800,7 +782,6 @@ IRGenDebugInfo::getOrCreateModule(ModuleDecl::ImportedModule M) {
800782
return cast<llvm::DIModule>(Scope);
801783
}
802784

803-
/// Return a cached module for an access path or create a new one.
804785
llvm::DIModule *IRGenDebugInfo::getOrCreateModule(StringRef Key,
805786
llvm::DIScope *Parent,
806787
StringRef Name,
@@ -1046,8 +1027,6 @@ void IRGenDebugInfo::emitGlobalVariableDeclaration(llvm::GlobalValue *Var,
10461027
Var->hasInternalLinkage(), Var, nullptr);
10471028
}
10481029

1049-
/// Return the mangled name of any nominal type, including the global
1050-
/// _Tt prefix, which marks the Swift namespace for types in DWARF.
10511030
StringRef IRGenDebugInfo::getMangledName(DebugTypeInfo DbgTy) {
10521031
if (MetadataTypeDecl && DbgTy.getDecl() == MetadataTypeDecl)
10531032
return BumpAllocatedString(DbgTy.getDecl()->getName().str());
@@ -1057,7 +1036,6 @@ StringRef IRGenDebugInfo::getMangledName(DebugTypeInfo DbgTy) {
10571036
return BumpAllocatedString(M.finalize());
10581037
}
10591038

1060-
/// Create a member of a struct, class, tuple, or enum.
10611039
llvm::DIDerivedType *
10621040
IRGenDebugInfo::createMemberType(DebugTypeInfo DbgTy, StringRef Name,
10631041
unsigned &OffsetInBits, llvm::DIScope *Scope,
@@ -1073,7 +1051,6 @@ IRGenDebugInfo::createMemberType(DebugTypeInfo DbgTy, StringRef Name,
10731051
return DITy;
10741052
}
10751053

1076-
/// Return an array with the DITypes for each of a tuple's elements.
10771054
llvm::DINodeArray IRGenDebugInfo::getTupleElements(
10781055
TupleType *TupleTy, llvm::DIScope *Scope, llvm::DIFile *File,
10791056
unsigned Flags, DeclContext *DeclContext, unsigned &SizeInBits) {
@@ -1093,7 +1070,6 @@ llvm::DINodeArray IRGenDebugInfo::getTupleElements(
10931070
return DBuilder.getOrCreateArray(Elements);
10941071
}
10951072

1096-
/// Return an array with the DITypes for each of a struct's elements.
10971073
llvm::DINodeArray
10981074
IRGenDebugInfo::getStructMembers(NominalTypeDecl *D, Type BaseTy,
10991075
llvm::DIScope *Scope, llvm::DIFile *File,
@@ -1114,8 +1090,6 @@ IRGenDebugInfo::getStructMembers(NominalTypeDecl *D, Type BaseTy,
11141090
return DBuilder.getOrCreateArray(Elements);
11151091
}
11161092

1117-
/// Create a temporary forward declaration for a struct and add it to
1118-
/// the type cache so we can safely build recursive types.
11191093
llvm::DICompositeType *IRGenDebugInfo::createStructType(
11201094
DebugTypeInfo DbgTy, NominalTypeDecl *Decl, Type BaseTy,
11211095
llvm::DIScope *Scope, llvm::DIFile *File, unsigned Line,
@@ -1147,7 +1121,6 @@ llvm::DICompositeType *IRGenDebugInfo::createStructType(
11471121
return DITy;
11481122
}
11491123

1150-
/// Return an array with the DITypes for each of an enum's elements.
11511124
llvm::DINodeArray IRGenDebugInfo::getEnumElements(DebugTypeInfo DbgTy,
11521125
EnumDecl *ED,
11531126
llvm::DIScope *Scope,
@@ -1192,8 +1165,6 @@ llvm::DINodeArray IRGenDebugInfo::getEnumElements(DebugTypeInfo DbgTy,
11921165
return DBuilder.getOrCreateArray(Elements);
11931166
}
11941167

1195-
/// Create a temporary forward declaration for an enum and add it to
1196-
/// the type cache so we can safely build recursive types.
11971168
llvm::DICompositeType *IRGenDebugInfo::createEnumType(
11981169
DebugTypeInfo DbgTy, EnumDecl *Decl, StringRef MangledName,
11991170
llvm::DIScope *Scope, llvm::DIFile *File, unsigned Line, unsigned Flags) {
@@ -1221,7 +1192,6 @@ llvm::DICompositeType *IRGenDebugInfo::createEnumType(
12211192
return DITy;
12221193
}
12231194

1224-
/// Return a DIType for Ty reusing any DeclContext found in DbgTy.
12251195
llvm::DIType *IRGenDebugInfo::getOrCreateDesugaredType(Type Ty,
12261196
DebugTypeInfo DbgTy) {
12271197
DebugTypeInfo BlandDbgTy(Ty, DbgTy.StorageType, DbgTy.size, DbgTy.align,
@@ -1245,7 +1215,6 @@ uint64_t IRGenDebugInfo::getSizeOfBasicType(DebugTypeInfo DbgTy) {
12451215
return BitWidth;
12461216
}
12471217

1248-
/// Convenience function that creates a forward declaration for PointeeTy.
12491218
llvm::DIType *IRGenDebugInfo::createPointerSizedStruct(
12501219
llvm::DIScope *Scope, StringRef Name, llvm::DIFile *File, unsigned Line,
12511220
unsigned Flags, StringRef MangledName) {
@@ -1256,8 +1225,6 @@ llvm::DIType *IRGenDebugInfo::createPointerSizedStruct(
12561225
MangledName);
12571226
}
12581227

1259-
/// Create a pointer-sized struct with a mangled name and a single
1260-
/// member of PointeeTy.
12611228
llvm::DIType *IRGenDebugInfo::createPointerSizedStruct(
12621229
llvm::DIScope *Scope, StringRef Name, llvm::DIType *PointeeTy,
12631230
llvm::DIFile *File, unsigned Line, unsigned Flags, StringRef MangledName) {
@@ -1274,8 +1241,6 @@ llvm::DIType *IRGenDebugInfo::createPointerSizedStruct(
12741241
llvm::dwarf::DW_LANG_Swift, nullptr, MangledName);
12751242
}
12761243

1277-
/// Create a 2*pointer-sized struct with a mangled name and a single
1278-
/// member of PointeeTy.
12791244
llvm::DIType *IRGenDebugInfo::createDoublePointerSizedStruct(
12801245
llvm::DIScope *Scope, StringRef Name, llvm::DIType *PointeeTy,
12811246
llvm::DIFile *File, unsigned Line, unsigned Flags, StringRef MangledName) {
@@ -1294,7 +1259,6 @@ llvm::DIType *IRGenDebugInfo::createDoublePointerSizedStruct(
12941259
llvm::dwarf::DW_LANG_Swift, nullptr, MangledName);
12951260
}
12961261

1297-
/// Create an opaque struct with a mangled name.
12981262
llvm::DIType *
12991263
IRGenDebugInfo::createOpaqueStruct(llvm::DIScope *Scope, StringRef Name,
13001264
llvm::DIFile *File, unsigned Line,
@@ -1307,18 +1271,6 @@ IRGenDebugInfo::createOpaqueStruct(llvm::DIScope *Scope, StringRef Name,
13071271
llvm::dwarf::DW_LANG_Swift, nullptr, MangledName);
13081272
}
13091273

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.
13221274
llvm::DIType *IRGenDebugInfo::createType(DebugTypeInfo DbgTy,
13231275
StringRef MangledName,
13241276
llvm::DIScope *Scope,
@@ -1783,10 +1735,6 @@ static bool canMangle(TypeBase *Ty) {
17831735
}
17841736
}
17851737

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.
17901738
llvm::DIType *IRGenDebugInfo::getOrCreateType(DebugTypeInfo DbgTy) {
17911739
// Is this an empty type?
17921740
if (DbgTy.isNull())

0 commit comments

Comments
 (0)