[MC][DWARF] Corrected handling of is_stmt flag in .loc directives
authorDmitry Preobrazhensky <dmitry.preobrazhensky@amd.com>
Mon, 20 Apr 2020 10:53:15 +0000 (13:53 +0300)
committerDmitry Preobrazhensky <dmitry.preobrazhensky@amd.com>
Mon, 20 Apr 2020 10:57:49 +0000 (13:57 +0300)
commit4a983b25bf224b47cd56a53a5f4cbe139dc7a648
tree160115b32f26f4cc487a01408116b571e9b4f5d8
parent2cfcbc52c3f5886f30cf3e7e8d5155598bc22732
[MC][DWARF] Corrected handling of is_stmt flag in .loc directives

According to DWARF standard, is_stmt is a global flag; when set or cleared it should affect subsequent .loc directives.

However llvm assembler handled is_stmt differently: it forced all locations to have is_stmt=1 unless is_stmt was specified explicitly as 0.

The fix utilizes current DWARF state flags to compute correct is_stmt values.

See https://bugs.llvm.org/show_bug.cgi?id=45529 for a detailed issue description.

Reviewers: arsenm, probinson, enderby

Differential Revision: https://reviews.llvm.org/D78102
llvm/lib/MC/MCParser/AsmParser.cpp
llvm/lib/MC/MCParser/MasmParser.cpp
llvm/test/MC/AsmParser/directive_loc_2.s [new file with mode: 0644]