-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 357 codegen fails if datatype and function have the same name (#…
…384) * added pou_types to TypeIndex, visitor registers POUs to pou_types (#357) * added find_pou_type/find_effective_pou_type methodes in index, visitor registers actions in pou_types, fix index_tests (#357) * resolver first search in types if none search in pou_types (#357) * variable_validator data_type_is_fb_or_class_instance only search in pou_types (#357) * added pou_type_associations to llvm_index (#357) * index find_type() try find_pou_type() if cannot find any (#357) * llvm_index find_associated_type() search for pou_types if cannot find type (#357) * create and generate pou_types (#357) * generate function with same name as return type (#357)
- Loading branch information
Showing
12 changed files
with
331 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...s/rusty__codegen__tests__code_gen_tests__function_call_with_same_name_as_return_type.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
source: src/codegen/tests/code_gen_tests.rs | ||
expression: result | ||
|
||
--- | ||
; ModuleID = 'main' | ||
source_filename = "main" | ||
|
||
%prg_interface = type {} | ||
%TIME_interface = type {} | ||
|
||
@prg_instance = global %prg_interface zeroinitializer | ||
|
||
define i64 @TIME(%TIME_interface* %0) { | ||
entry: | ||
%TIME = alloca i64, align 8 | ||
%TIME_ret = load i64, i64* %TIME, align 4 | ||
ret i64 %TIME_ret | ||
} | ||
|
||
define void @prg(%prg_interface* %0) { | ||
entry: | ||
%TIME_instance = alloca %TIME_interface, align 8 | ||
br label %input | ||
|
||
input: ; preds = %entry | ||
br label %call | ||
|
||
call: ; preds = %input | ||
%call1 = call i64 @TIME(%TIME_interface* %TIME_instance) | ||
br label %output | ||
|
||
output: ; preds = %call | ||
br label %continue | ||
|
||
continue: ; preds = %output | ||
ret void | ||
} | ||
|
27 changes: 27 additions & 0 deletions
27
...napshots/rusty__codegen__tests__code_gen_tests__variable_with_same_name_as_data_type.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
source: src/codegen/tests/code_gen_tests.rs | ||
expression: result | ||
|
||
--- | ||
; ModuleID = 'main' | ||
source_filename = "main" | ||
|
||
%prog_interface = type { i64 } | ||
%func_interface = type { i64 } | ||
|
||
@prog_instance = global %prog_interface zeroinitializer | ||
|
||
define i64 @func(%func_interface* %0) { | ||
entry: | ||
%TIME = getelementptr inbounds %func_interface, %func_interface* %0, i32 0, i32 0 | ||
%func = alloca i64, align 8 | ||
%func_ret = load i64, i64* %func, align 4 | ||
ret i64 %func_ret | ||
} | ||
|
||
define void @prog(%prog_interface* %0) { | ||
entry: | ||
%TIME = getelementptr inbounds %prog_interface, %prog_interface* %0, i32 0, i32 0 | ||
ret void | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
...snapshots/rusty__codegen__tests__code_gen_tests__variable_with_same_name_as_function.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
source: src/codegen/tests/code_gen_tests.rs | ||
expression: result | ||
|
||
--- | ||
; ModuleID = 'main' | ||
source_filename = "main" | ||
|
||
%TIME_interface = type {} | ||
|
||
define i64 @TIME(%TIME_interface* %0) { | ||
entry: | ||
%TIME = alloca i64, align 8 | ||
%TIME_ret = load i64, i64* %TIME, align 4 | ||
ret i64 %TIME_ret | ||
} | ||
|
Oops, something went wrong.