diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-09-23 00:00:24 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-09-23 00:00:24 -0700 |
| commit | 800a4a6cebf363c8ba3d1fcfff55db8bfb71f731 (patch) | |
| tree | 566a2b9995048fb457bda97db04f8d5d5c5d50be /src/zig_clang.cpp | |
| parent | fc88d36daea40b69690186730ae7f2a5296585a9 (diff) | |
| download | zig-800a4a6cebf363c8ba3d1fcfff55db8bfb71f731.tar.gz zig-800a4a6cebf363c8ba3d1fcfff55db8bfb71f731.zip | |
eliminate dependency of libzigcpp.a on libzigstage1.a
This allows us to create a build of self-hosted with LLVM extensions
enabled but without the stage1 backend.
Diffstat (limited to 'src/zig_clang.cpp')
| -rw-r--r-- | src/zig_clang.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/zig_clang.cpp b/src/zig_clang.cpp index 21d0c5c0ca..31c4404083 100644 --- a/src/zig_clang.cpp +++ b/src/zig_clang.cpp @@ -13,7 +13,6 @@ * 3. Prevent C++ from infecting the rest of the project. */ #include "zig_clang.h" -#include "list.hpp" #if __GNUC__ >= 8 #pragma GCC diagnostic push @@ -2186,7 +2185,7 @@ ZigClangASTUnit *ZigClangLoadFromCommandLine(const char **args_begin, const char // 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 = {}; + Stage2ErrorMsg *errors = nullptr; for (clang::ASTUnit::stored_diag_iterator it = unit->stored_diag_begin(), it_end = unit->stored_diag_end(); it != it_end; ++it) @@ -2204,7 +2203,10 @@ ZigClangASTUnit *ZigClangLoadFromCommandLine(const char **args_begin, const char llvm::StringRef msg_str_ref = it->getMessage(); - Stage2ErrorMsg *msg = errors.add_one(); + *errors_len += 1; + errors = reinterpret_cast<Stage2ErrorMsg*>(realloc(errors, sizeof(Stage2ErrorMsg) * *errors_len)); + if (errors == nullptr) abort(); + Stage2ErrorMsg *msg = &errors[*errors_len - 1]; memset(msg, 0, sizeof(*msg)); msg->msg_ptr = (const char *)msg_str_ref.bytes_begin(); @@ -2242,8 +2244,7 @@ ZigClangASTUnit *ZigClangLoadFromCommandLine(const char **args_begin, const char } } - *errors_ptr = errors.items; - *errors_len = errors.length; + *errors_ptr = errors; return nullptr; } |
