Skip to content

Commit

Permalink
Merge pull request #255 from savi-lang/fix-codegen-struct-ptr-debug-info
Browse files Browse the repository at this point in the history
Fix debug info generation for a pointer to a Savi `:struct` value.
  • Loading branch information
jemc authored Mar 12, 2022
2 parents 840f650 + 4836700 commit cea1cae
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ from ./manifest.savi:1:
^~~~~~~~~

- this transitive dependency needs to be added:
from ./deps/github:savi-lang/TCP/v0.20220304.0/manifest.savi:4:
from ./deps/github:savi-lang/TCP/v0.20220309.0/manifest.savi:4:
:dependency ByteStream v0
^~~~~~~~~~

Expand All @@ -28,7 +28,7 @@ from ./manifest.savi:4:
^~~

- this transitive dependency needs to be added:
from ./deps/github:savi-lang/TCP/v0.20220304.0/manifest.savi:4:
from ./deps/github:savi-lang/TCP/v0.20220309.0/manifest.savi:4:
:dependency ByteStream v0
^~~~~~~~~~

Expand All @@ -42,7 +42,7 @@ from ./manifest.savi:1:
^~~~~~~~~

- this transitive dependency needs to be added:
from ./deps/github:savi-lang/TCP/v0.20220304.0/manifest.savi:7:
from ./deps/github:savi-lang/TCP/v0.20220309.0/manifest.savi:7:
:dependency IO v0
^~

Expand All @@ -61,7 +61,7 @@ from ./manifest.savi:4:
^~~

- this transitive dependency needs to be added:
from ./deps/github:savi-lang/TCP/v0.20220304.0/manifest.savi:7:
from ./deps/github:savi-lang/TCP/v0.20220309.0/manifest.savi:7:
:dependency IO v0
^~

Expand All @@ -75,7 +75,7 @@ from ./manifest.savi:1:
^~~~~~~~~

- this transitive dependency needs to be added:
from ./deps/github:savi-lang/TCP/v0.20220304.0/manifest.savi:12:
from ./deps/github:savi-lang/TCP/v0.20220309.0/manifest.savi:12:
:dependency OSError v0
^~~~~~~

Expand All @@ -84,6 +84,8 @@ from ./manifest.savi:1:
:dependency TCP v0
^~~

- run again with --fix to auto-fix this issue.

---

A `:depends on` declaration is missing from this dependency:
Expand All @@ -92,7 +94,7 @@ from ./manifest.savi:4:
^~~

- this transitive dependency needs to be added:
from ./deps/github:savi-lang/TCP/v0.20220304.0/manifest.savi:12:
from ./deps/github:savi-lang/TCP/v0.20220309.0/manifest.savi:12:
:dependency OSError v0
^~~~~~~

Expand Down
6 changes: 5 additions & 1 deletion src/savi/compiler/code_gen/debug_info.cr
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ class Savi::Compiler::CodeGen
),
)
elsif t.llvm_use_type(ctx) == :struct_value
di_create_fields_struct_type(t, llvm_type)
if llvm_type.kind == LLVM::Type::Kind::Pointer
di_create_object_struct_pointer_type(t, llvm_type)
else
di_create_fields_struct_type(t, llvm_type)
end
elsif t.llvm_use_type(ctx) == :struct_ptr
di_create_object_struct_pointer_type(t, llvm_type)
elsif t.llvm_use_type(ctx) == :struct_ptr_opaque
Expand Down
2 changes: 1 addition & 1 deletion src/savi/compiler/manifests.cr
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ class Savi::Compiler::Manifests
private def check_transitive_deps(ctx, manifest, dep, dep_manifest)
dep_manifest.dependencies.each { |dep_dep|
# Check that the transitive dependency has been loaded.
if !@manifests_by_name.has_key?(dep_dep.name.value)
if !manifest.dependencies.any?(&.name.value.==(dep_dep.name.value))
can_fix = dep_dep.location_nodes.any?
fix_lines = ["\n"]
fix_lines << " :transitive dependency #{dep_dep.name.value} #{dep_dep.version.try(&.value)}"
Expand Down

0 comments on commit cea1cae

Please sign in to comment.