Skip to content

Commit 2f95f0d

Browse files
committed
Fix allocations of file name of included type
1 parent 90b2969 commit 2f95f0d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cpp/codegen/from.odin

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ parse_cursor_not_from_main :: proc(cursor: clang.Cursor) -> bool {
719719
}
720720

721721
ctx.included_types[type_name] = IncludedType {
722-
file_name = file_name if rel_ok else strings.clone(file_name, ctx.allocator),
722+
file_name = strings.clone(file_name, ctx.allocator),
723723
type = type,
724724
system = bool(
725725
clang.Location_isInSystemHeader(cursor_location),
@@ -730,7 +730,7 @@ parse_cursor_not_from_main :: proc(cursor: clang.Cursor) -> bool {
730730
}
731731

732732
ctx.included_types[type_name] = IncludedType {
733-
file_name = file_name if rel_ok else strings.clone(file_name, ctx.allocator),
733+
file_name = strings.clone(file_name, ctx.allocator),
734734
type = typedef,
735735
system = bool(
736736
clang.Location_isInSystemHeader(cursor_location),
@@ -744,7 +744,7 @@ parse_cursor_not_from_main :: proc(cursor: clang.Cursor) -> bool {
744744
// TODO: if a forward declaration is declared in one included file (included by header A), but the implementation is defined in a file included by header B. This leads to the forward declaration being added instead of the implementation, maybe changing included_types to a map of arrays and then add every declaration found could solve this.
745745
if !(display_name in ctx.included_types) {
746746
ctx.included_types[display_name] = IncludedType {
747-
file_name = file_name if rel_ok else strings.clone(file_name, ctx.allocator),
747+
file_name = strings.clone(file_name, ctx.allocator),
748748
type = cursor_type,
749749
system = bool(
750750
clang.Location_isInSystemHeader(cursor_location),
@@ -757,7 +757,7 @@ parse_cursor_not_from_main :: proc(cursor: clang.Cursor) -> bool {
757757

758758
if !(display_name in ctx.included_types) {
759759
ctx.included_types[display_name] = IncludedType {
760-
file_name = file_name if rel_ok else strings.clone(file_name, ctx.allocator),
760+
file_name = strings.clone(file_name, ctx.allocator),
761761
type = cursor_type,
762762
system = bool(
763763
clang.Location_isInSystemHeader(cursor_location),
@@ -770,7 +770,7 @@ parse_cursor_not_from_main :: proc(cursor: clang.Cursor) -> bool {
770770

771771
if !(display_name in ctx.included_types) {
772772
ctx.included_types[display_name] = IncludedType {
773-
file_name = file_name if rel_ok else strings.clone(file_name, ctx.allocator),
773+
file_name = strings.clone(file_name, ctx.allocator),
774774
type = cursor_type,
775775
system = bool(
776776
clang.Location_isInSystemHeader(cursor_location),

0 commit comments

Comments
 (0)