mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-01 20:28:15 +00:00
Remove need for __llvm_core
This commit is contained in:
+1
-1
@@ -459,7 +459,7 @@ void init_entity_foreign_library(CheckerContext *ctx, Entity *e) {
|
||||
Entity *found = scope_lookup_entity(ctx->scope, name);
|
||||
if (found == nullptr) {
|
||||
if (is_blank_ident(name)) {
|
||||
error(ident, "'_' cannot be used as a value type");
|
||||
// NOTE(bill): link against nothing
|
||||
} else {
|
||||
error(ident, "Undeclared name: %.*s", LIT(name));
|
||||
}
|
||||
|
||||
+3
-6
@@ -575,14 +575,11 @@ void init_universal_scope(void) {
|
||||
add_global_constant(str_lit("false"), t_untyped_bool, exact_value_bool(false));
|
||||
|
||||
add_global_entity(alloc_entity_nil(str_lit("nil"), t_untyped_nil));
|
||||
add_global_entity(alloc_entity_library_name(universal_scope,
|
||||
make_token_ident(str_lit("__llvm_core")), t_invalid,
|
||||
str_lit(""), str_lit("__llvm_core")));
|
||||
// add_global_entity(alloc_entity_library_name(universal_scope,
|
||||
// make_token_ident(str_lit("__llvm_core")), t_invalid,
|
||||
// str_lit(""), str_lit("__llvm_core")));
|
||||
|
||||
// TODO(bill): Set through flags in the compiler
|
||||
// add_global_string_constant(str_lit("ODIN_OS"), bc->ODIN_OS);
|
||||
// add_global_string_constant(str_lit("ODIN_ARCH"), bc->ODIN_ARCH);
|
||||
// add_global_string_constant(str_lit("ODIN_ENDIAN"), bc->ODIN_ENDIAN);
|
||||
add_global_string_constant(str_lit("ODIN_VENDOR"), bc->ODIN_VENDOR);
|
||||
add_global_string_constant(str_lit("ODIN_VERSION"), bc->ODIN_VERSION);
|
||||
add_global_string_constant(str_lit("ODIN_ROOT"), bc->ODIN_ROOT);
|
||||
|
||||
+3
-1
@@ -1327,7 +1327,9 @@ irValue *ir_add_global_string_array(irModule *m, String string) {
|
||||
}
|
||||
|
||||
void ir_add_foreign_library_path(irModule *m, Entity *e) {
|
||||
GB_ASSERT(e != nullptr);
|
||||
if (e == nullptr) {
|
||||
return;
|
||||
}
|
||||
GB_ASSERT(e->kind == Entity_LibraryName);
|
||||
GB_ASSERT(e->LibraryName.used);
|
||||
|
||||
|
||||
+11
-11
@@ -1318,7 +1318,7 @@ bool is_semicolon_optional_for_node(AstFile *f, AstNode *s) {
|
||||
case AstNode_BitFieldType:
|
||||
return true;
|
||||
case AstNode_ProcLit:
|
||||
return s->ProcLit.body != nullptr;
|
||||
return true;
|
||||
|
||||
case AstNode_PackageDecl:
|
||||
case AstNode_ImportDecl:
|
||||
@@ -2410,6 +2410,8 @@ AstNode *parse_foreign_block(AstFile *f, Token token) {
|
||||
AstNode *foreign_library = nullptr;
|
||||
if (f->curr_token.kind == Token_export) {
|
||||
foreign_library = ast_implicit(f, expect_token(f, Token_export));
|
||||
} else if (f->curr_token.kind == Token_OpenBrace) {
|
||||
foreign_library = ast_ident(f, blank_token);
|
||||
} else {
|
||||
foreign_library = parse_ident(f);
|
||||
}
|
||||
@@ -2421,19 +2423,16 @@ AstNode *parse_foreign_block(AstFile *f, Token token) {
|
||||
defer (f->in_foreign_block = prev_in_foreign_block);
|
||||
f->in_foreign_block = true;
|
||||
|
||||
if (f->curr_token.kind != Token_OpenBrace) {
|
||||
|
||||
open = expect_token(f, Token_OpenBrace);
|
||||
|
||||
while (f->curr_token.kind != Token_CloseBrace &&
|
||||
f->curr_token.kind != Token_EOF) {
|
||||
parse_foreign_block_decl(f, &decls);
|
||||
} else {
|
||||
open = expect_token(f, Token_OpenBrace);
|
||||
|
||||
while (f->curr_token.kind != Token_CloseBrace &&
|
||||
f->curr_token.kind != Token_EOF) {
|
||||
parse_foreign_block_decl(f, &decls);
|
||||
}
|
||||
|
||||
close = expect_token(f, Token_CloseBrace);
|
||||
}
|
||||
|
||||
close = expect_token(f, Token_CloseBrace);
|
||||
|
||||
AstNode *decl = ast_foreign_block_decl(f, token, foreign_library, open, close, decls, docs);
|
||||
expect_semicolon(f, decl);
|
||||
return decl;
|
||||
@@ -3512,6 +3511,7 @@ AstNode *parse_foreign_decl(AstFile *f) {
|
||||
switch (f->curr_token.kind) {
|
||||
case Token_export:
|
||||
case Token_Ident:
|
||||
case Token_OpenBrace:
|
||||
return parse_foreign_block(f, token);
|
||||
|
||||
case Token_import: {
|
||||
|
||||
Reference in New Issue
Block a user