File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,12 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
204
204
IRGenModule &IGM, llvm::Module &M,
205
205
StringRef MainOutputFilenameForDebugInfo,
206
206
StringRef PrivateDiscriminator);
207
+ ~IRGenDebugInfoImpl () {
208
+ // FIXME: SILPassManager sometimes creates an IGM and doesn't finalize it.
209
+ if (!FwdDeclTypes.empty ())
210
+ finalize ();
211
+ assert (FwdDeclTypes.empty () && " finalize() was not called" );
212
+ }
207
213
void finalize ();
208
214
209
215
void setCurrentLoc (IRBuilder &Builder, const SILDebugScope *DS,
@@ -2478,6 +2484,7 @@ void IRGenDebugInfoImpl::finalize() {
2478
2484
finalize (cast<llvm::MDNode>(Ty.second ),
2479
2485
llvm::cast_or_null<llvm::DIType>(DIRefMap.lookup (UID)), UID);
2480
2486
}
2487
+ FwdDeclTypes.clear ();
2481
2488
2482
2489
// Finalize the DIBuilder.
2483
2490
DBuilder.finalize ();
Original file line number Diff line number Diff line change @@ -1947,6 +1947,9 @@ bool IRGenModule::finalize() {
1947
1947
// Finalize clang IR-generation.
1948
1948
finalizeClangCodeGen ();
1949
1949
1950
+ if (DebugInfo)
1951
+ DebugInfo->finalize ();
1952
+
1950
1953
// If that failed, report failure up and skip the final clean-up.
1951
1954
if (!ClangCodeGen->GetModule ())
1952
1955
return false ;
@@ -1955,8 +1958,6 @@ bool IRGenModule::finalize() {
1955
1958
emitAutolinkInfo ();
1956
1959
emitGlobalLists ();
1957
1960
emitUsedConditionals ();
1958
- if (DebugInfo)
1959
- DebugInfo->finalize ();
1960
1961
cleanupClangCodeGenMetadata ();
1961
1962
1962
1963
// Clean up DSOLocal & DLLImport attributes, they cannot be applied together.
You can’t perform that action at this time.
0 commit comments