Skip to content

Commit a866fd2

Browse files
Axel-Naumanndevajithvs
authored andcommitted
Clear pending decls from Builder in case of errors (ROOT-7295).
1 parent 811e6c5 commit a866fd2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clang/lib/CodeGen/ModuleBuilder.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ namespace clang {
107107
}
108108

109109
llvm::Module *ReleaseModule() {
110+
// Remove pending etc decls in case of error; the asserts in StartModule()
111+
// will rightfully be confused otherwise, as none of the decls were
112+
// emitted.
113+
if (Diags.hasErrorOccurred())
114+
Builder->clear();
110115
return M.release();
111116
}
112117

0 commit comments

Comments
 (0)