[all-commits] [llvm/llvm-project] 195ba4: [MCAsmParser] .macro/.rept/.irp/.irpc: remove exce...

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri May 17 23:03:16 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 195ba4572129befa25ca56439515d7cb91587c56
      https://github.com/llvm/llvm-project/commit/195ba4572129befa25ca56439515d7cb91587c56
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-05-17 (Fri, 17 May 2024)

  Changed paths:
    M llvm/lib/MC/MCParser/AsmParser.cpp
    M llvm/test/MC/AsmParser/macro-arg.s
    M llvm/test/MC/AsmParser/macro-irp.s
    M llvm/test/MC/AsmParser/macro-rept.s

  Log Message:
  -----------
  [MCAsmParser] .macro/.rept/.irp/.irpc: remove excess \n after expansion

```
.irp foo,1
nop
.endr
nop
```

expands to an excess EOL between two nop lines. Other loop directives
and .macro have the same issue.

`Lex()` at "Jump to the macro instantiation and prime the lexer"
requires that there is one single \n token in CurTok. Therefore, we
cannot consume the trailing \n when parsing the macro(-like) body.
(commit c6e787f771d1f9d6a846b2d9b8db6adcd87e8dba (reverted by
1e5f29af81a5f6fda308074f6345b9fba4faa71c))

Instead, skip the potential \n after jumpToLoc at handleMacroExit.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list