aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2021-09-29 19:22:56 +0100
committerGitHub <noreply@github.com>2021-09-29 19:22:56 +0100
commitbd1e1c66f3e56ba03fbd18ea1e928a6eb1f90205 (patch)
treee769323ad65402660fa3beede7deb286bf0a49ff /src/llvm_backend.cpp
parent08ac2fd1b6c83a1f567a3866b74512d53a322cef (diff)
parent48f496f3b30cc5e0d6fc751d3f8af75616cf74e6 (diff)
Merge pull request #1188 from krux02/minor-fix-3
fix #1187
Diffstat (limited to 'src/llvm_backend.cpp')
-rw-r--r--src/llvm_backend.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp
index 5c00bb05f..840c7b4a5 100644
--- a/src/llvm_backend.cpp
+++ b/src/llvm_backend.cpp
@@ -21,7 +21,7 @@
#include "llvm_backend_stmt.cpp"
#include "llvm_backend_proc.cpp"
-#if LLVM_VERSION_MAJOR < 11
+#if LLVM_VERSION_MAJOR < 11
#error "LLVM Version 11 is the minimum required"
#elif LLVM_VERSION_MAJOR == 12 && !(LLVM_VERSION_MINOR > 0 || LLVM_VERSION_PATCH > 0)
#error "If LLVM Version 12.x.y is wanted, at least LLVM 12.0.1 is required"
@@ -1207,9 +1207,13 @@ void lb_generate_code(lbGenerator *gen) {
LLVMBool is_optimized = build_context.optimization_level > 0;
AstFile *init_file = m->info->init_package->files[0];
- Ast *ident = m->info->entry_point->identifier.load();
- if (m->info->entry_point && ident && ident->file) {
- init_file = ident->file;
+
+ if (Entity *entry_point = m->info->entry_point) {
+ if (Ast *ident = entry_point->identifier.load()) {
+ if (ident->file) {
+ init_file = ident->file;
+ }
+ }
}
LLVMBool split_debug_inlining = false;