Set the file's filename and directory in init_ast_file

This commit is contained in:
gingerBill
2022-12-20 14:56:44 +00:00
parent eb0775ad53
commit 44caa96d50
3 changed files with 11 additions and 7 deletions

View File

@@ -1740,12 +1740,9 @@ gb_internal void lb_generate_code(lbGenerator *gen) {
if (m->debug_builder) { // Debug Info
for (auto const &file_entry : info->files) {
AstFile *f = file_entry.value;
String fullpath = f->fullpath;
String filename = remove_directory_from_path(fullpath);
String directory = directory_from_path(fullpath);
LLVMMetadataRef res = LLVMDIBuilderCreateFile(m->debug_builder,
cast(char const *)filename.text, filename.len,
cast(char const *)directory.text, directory.len);
cast(char const *)f->filename.text, f->filename.len,
cast(char const *)f->directory.text, f->directory.len);
lb_set_llvm_metadata(m, f, res);
}