Skip to content

Commit ffecd5b

Browse files
committed
IRGen: Don't emit empty module records in YAML type info dump
1 parent b7b814d commit ffecd5b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/IRGen/TypeLayoutDumper.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ static void addYAMLTypeInfoNode(NominalTypeDecl *NTD,
111111
Result.push_back(createYAMLTypeInfoNode(NTD, IGM, fixedTI));
112112
}
113113

114-
static YAMLModuleNode createYAMLModuleNode(ModuleDecl *Mod,
115-
IRGenModule &IGM) {
114+
static Optional<YAMLModuleNode>
115+
createYAMLModuleNode(ModuleDecl *Mod, IRGenModule &IGM) {
116116
std::vector<NominalTypeDecl *> Decls;
117117
NominalTypeWalker Walker(Decls);
118118

@@ -132,9 +132,12 @@ static YAMLModuleNode createYAMLModuleNode(ModuleDecl *Mod,
132132
}
133133
}
134134

135+
if (Nodes.empty())
136+
return None;
137+
135138
std::sort(Nodes.begin(), Nodes.end());
136139

137-
return {Mod->getName().str(), Nodes};
140+
return YAMLModuleNode{Mod->getName().str(), Nodes};
138141
}
139142

140143
void TypeLayoutDumper::write(ArrayRef<ModuleDecl *> AllModules,
@@ -144,7 +147,8 @@ void TypeLayoutDumper::write(ArrayRef<ModuleDecl *> AllModules,
144147
// Collect all nominal types, including nested types.
145148
for (auto *Mod : AllModules) {
146149
auto Node = createYAMLModuleNode(Mod, IGM);
147-
yout << Node;
150+
if (Node)
151+
yout << *Node;
148152
}
149153
}
150154

0 commit comments

Comments
 (0)