Fix "DWARF2 reader: Badly formed extended line op encountered" (#20862)

This commit is contained in:
Dennis 2025-02-13 21:47:28 +01:00 committed by GitHub
parent fe345e8ae9
commit 842dd20ea5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 10 deletions

View file

@ -72,7 +72,7 @@ alias StmtState = dmd.stmtstate.StmtState!block;
void elem_setLoc(elem* e, Loc loc) nothrow
{
srcpos_setLoc(e.Esrcpos, loc);
e.Esrcpos = toSrcpos(loc);
}
void Statement_toIR(Statement s, ref IRState irs)
@ -1710,13 +1710,7 @@ void insertFinallyBlockGotos(block* startblock)
private void block_setLoc(block* b, Loc loc) nothrow
{
srcpos_setLoc(b.Bsrcpos, loc);
}
private void srcpos_setLoc(ref Srcpos s, Loc loc) nothrow
{
SourceLoc sl = SourceLoc(loc);
s.set(sl.filename.ptr, sl.line, sl.column);
b.Bsrcpos = toSrcpos(loc);
}
private bool isAssertFalse(const Expression e) nothrow

View file

@ -880,8 +880,11 @@ Symbol* toSymbol(Type t)
* Returns:
* Srcpos backend struct corresponding to the given location
*/
Srcpos toSrcpos(Loc loc)
Srcpos toSrcpos(Loc loc) nothrow
{
SourceLoc sl = SourceLoc(loc);
return Srcpos.create(sl.filename.ptr, sl.line, sl.column);
if (sl.filename.length > 0)
return Srcpos.create(sl.filename.ptr, sl.line, sl.column);
else
return Srcpos.create(null, 0, 0);
}