mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-04 17:54:39 +00:00
cached.cpp: Improve internal cached robustness
Do not memory map files; Windows cannot write to a file that is memory mapped. Write cache after llvm building. This ensures the cache won't have a false positive if llvm fails.
This commit is contained in:
21
src/main.cpp
21
src/main.cpp
@@ -3391,6 +3391,7 @@ int main(int arg_count, char const **arg_ptr) {
|
||||
|
||||
Parser *parser = gb_alloc_item(permanent_allocator(), Parser);
|
||||
Checker *checker = gb_alloc_item(permanent_allocator(), Checker);
|
||||
bool failed_to_cache_parsing = false;
|
||||
|
||||
MAIN_TIME_SECTION("parse files");
|
||||
|
||||
@@ -3480,6 +3481,7 @@ int main(int arg_count, char const **arg_ptr) {
|
||||
if (try_cached_build(checker, args)) {
|
||||
goto end_of_code_gen;
|
||||
}
|
||||
failed_to_cache_parsing = true;
|
||||
}
|
||||
|
||||
#if ALLOW_TILDE
|
||||
@@ -3545,18 +3547,23 @@ int main(int arg_count, char const **arg_ptr) {
|
||||
|
||||
end_of_code_gen:;
|
||||
|
||||
if (build_context.show_timings) {
|
||||
show_timings(checker, &global_timings);
|
||||
}
|
||||
|
||||
if (build_context.export_dependencies_format != DependenciesExportUnspecified) {
|
||||
export_dependencies(checker);
|
||||
}
|
||||
|
||||
if (build_context.cached) {
|
||||
MAIN_TIME_SECTION("write cached build");
|
||||
if (!build_context.build_cache_data.copy_already_done) {
|
||||
try_copy_executable_to_cache();
|
||||
}
|
||||
|
||||
if (!build_context.build_cache_data.copy_already_done &&
|
||||
build_context.cached) {
|
||||
try_copy_executable_to_cache();
|
||||
if (failed_to_cache_parsing) {
|
||||
write_cached_build(checker, args);
|
||||
}
|
||||
}
|
||||
|
||||
if (build_context.show_timings) {
|
||||
show_timings(checker, &global_timings);
|
||||
}
|
||||
|
||||
if (run_output) {
|
||||
|
||||
Reference in New Issue
Block a user