zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 0267afa9c0aac51089150a9d2f6b2e53e9d2dbff (tree)
parent 8a792db2d8b0ea775cb255c31c207c513a45ff01
Author: LemonBoy <thatlemon@gmail.com>
Date:   Thu, 16 Jan 2020 12:52:04 +0100

Fix garbled error messages from clang

Diffstat:
Msrc/zig_clang.cpp | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/zig_clang.cpp b/src/zig_clang.cpp @@ -2096,7 +2096,9 @@ ZigClangASTUnit *ZigClangLoadFromCommandLine(const char **args_begin, const char } if (diags->hasErrorOccurred()) { - clang::ASTUnit *unit = ast_unit ? ast_unit : err_unit.get(); + // Take ownership of the err_unit ASTUnit object so that it won't be + // free'd when we return, invalidating the error message pointers + clang::ASTUnit *unit = ast_unit ? ast_unit : err_unit.release(); ZigList<Stage2ErrorMsg> errors = {}; for (clang::ASTUnit::stored_diag_iterator it = unit->stored_diag_begin(),