Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert comment_data to a value from a pointer #16663

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions compiler/src/dmd/backend/elfobj.d
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@

IDXSEC secidx_note; // Final table index for note data

OutBuffer* comment_data; // Comment data for compiler version
OutBuffer comment_data; // Comment data for compiler version

int seg_tlsseg = UNKNOWN;
int seg_tlsseg_bss = UNKNOWN;
Expand Down Expand Up @@ -615,7 +615,7 @@

elfobj.note_data = null;
elfobj.secidx_note = 0;
elfobj.comment_data = null;
elfobj.comment_data.reset();

Check warning on line 618 in compiler/src/dmd/backend/elfobj.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/backend/elfobj.d#L618

Added line #L618 was not covered by tests
elfobj.seg_tlsseg = UNKNOWN;
elfobj.seg_tlsseg_bss = UNKNOWN;
elfobj.GOTsym = null;
Expand Down Expand Up @@ -738,8 +738,7 @@
if (elfobj.note_data)
elfobj.note_data.reset();

if (elfobj.comment_data)
elfobj.comment_data.reset();
elfobj.comment_data.reset();

Check warning on line 741 in compiler/src/dmd/backend/elfobj.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/backend/elfobj.d#L741

Added line #L741 was not covered by tests

elfobj.symbol_idx = 0;
elfobj.local_cnt = 0;
Expand Down Expand Up @@ -1080,7 +1079,7 @@
foffset += sechdr.sh_size;
}

if (elfobj.comment_data)
if (elfobj.comment_data.length())

Check warning on line 1082 in compiler/src/dmd/backend/elfobj.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/backend/elfobj.d#L1082

Added line #L1082 was not covered by tests
{
sechdr = &elfobj.SecHdrTab[SHN_COM]; // Comments
sechdr.sh_size = cast(uint)elfobj.comment_data.length();
Expand Down Expand Up @@ -1432,14 +1431,8 @@
void ElfObj_user(const(char)* p)
{
//printf("ElfObj_user(char *%s)\n",p);
if (!elfobj.comment_data)
{
elfobj.comment_data = cast(OutBuffer*) calloc(1, OutBuffer.sizeof);
if (!elfobj.comment_data)
err_nomem();
if (elfobj.comment_data.length() == 0)

Check warning on line 1434 in compiler/src/dmd/backend/elfobj.d

View check run for this annotation

Codecov / codecov/patch

compiler/src/dmd/backend/elfobj.d#L1434

Added line #L1434 was not covered by tests
elfobj.comment_data.writeByte(0);
}

elfobj.comment_data.writestring(p);
elfobj.comment_data.writeByte(0);
}
Expand Down
Loading