mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Set the file's filename and directory in init_ast_file
This commit is contained in:
@@ -1740,12 +1740,9 @@ gb_internal void lb_generate_code(lbGenerator *gen) {
|
|||||||
if (m->debug_builder) { // Debug Info
|
if (m->debug_builder) { // Debug Info
|
||||||
for (auto const &file_entry : info->files) {
|
for (auto const &file_entry : info->files) {
|
||||||
AstFile *f = file_entry.value;
|
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,
|
LLVMMetadataRef res = LLVMDIBuilderCreateFile(m->debug_builder,
|
||||||
cast(char const *)filename.text, filename.len,
|
cast(char const *)f->filename.text, f->filename.len,
|
||||||
cast(char const *)directory.text, directory.len);
|
cast(char const *)f->directory.text, f->directory.len);
|
||||||
lb_set_llvm_metadata(m, f, res);
|
lb_set_llvm_metadata(m, f, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -4768,8 +4768,10 @@ gb_internal Array<Ast *> parse_stmt_list(AstFile *f) {
|
|||||||
|
|
||||||
gb_internal ParseFileError init_ast_file(AstFile *f, String const &fullpath, TokenPos *err_pos) {
|
gb_internal ParseFileError init_ast_file(AstFile *f, String const &fullpath, TokenPos *err_pos) {
|
||||||
GB_ASSERT(f != nullptr);
|
GB_ASSERT(f != nullptr);
|
||||||
f->fullpath = string_trim_whitespace(fullpath); // Just in case
|
f->fullpath = string_trim_whitespace(fullpath); // Just in case
|
||||||
set_file_path_string(f->id, fullpath);
|
f->filename = remove_directory_from_path(f->fullpath);
|
||||||
|
f->directory = directory_from_path(f->fullpath);
|
||||||
|
set_file_path_string(f->id, f->fullpath);
|
||||||
thread_safe_set_ast_file_from_id(f->id, f);
|
thread_safe_set_ast_file_from_id(f->id, f);
|
||||||
if (!string_ends_with(f->fullpath, str_lit(".odin"))) {
|
if (!string_ends_with(f->fullpath, str_lit(".odin"))) {
|
||||||
return ParseFile_WrongExtension;
|
return ParseFile_WrongExtension;
|
||||||
|
|||||||
@@ -99,7 +99,11 @@ struct AstFile {
|
|||||||
Scope * scope;
|
Scope * scope;
|
||||||
|
|
||||||
Ast * pkg_decl;
|
Ast * pkg_decl;
|
||||||
|
|
||||||
String fullpath;
|
String fullpath;
|
||||||
|
String filename;
|
||||||
|
String directory;
|
||||||
|
|
||||||
Tokenizer tokenizer;
|
Tokenizer tokenizer;
|
||||||
Array<Token> tokens;
|
Array<Token> tokens;
|
||||||
isize curr_token_index;
|
isize curr_token_index;
|
||||||
@@ -109,6 +113,7 @@ struct AstFile {
|
|||||||
Token package_token;
|
Token package_token;
|
||||||
String package_name;
|
String package_name;
|
||||||
|
|
||||||
|
|
||||||
// >= 0: In Expression
|
// >= 0: In Expression
|
||||||
// < 0: In Control Clause
|
// < 0: In Control Clause
|
||||||
// NOTE(bill): Used to prevent type literals in control clauses
|
// NOTE(bill): Used to prevent type literals in control clauses
|
||||||
|
|||||||
Reference in New Issue
Block a user