[all-commits] [llvm/llvm-project] c9f6d2: [MC] Merge MCAsmLexer.{h, cpp} into AsmLexer.{h, cpp...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Apr 3 19:23:07 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c9f6d26e049849a8d8d31deaf6c710894a361b0e
      https://github.com/llvm/llvm-project/commit/c9f6d26e049849a8d8d31deaf6c710894a361b0e
  Author: Fangrui Song <i at maskray.me>
  Date:   2025-04-03 (Thu, 03 Apr 2025)

  Changed paths:
    M llvm/include/llvm/MC/MCParser/AsmLexer.h
    M llvm/include/llvm/MC/MCParser/MCAsmLexer.h
    M llvm/lib/MC/MCParser/AsmLexer.cpp
    M llvm/lib/MC/MCParser/CMakeLists.txt
    R llvm/lib/MC/MCParser/MCAsmLexer.cpp
    M llvm/utils/gn/secondary/llvm/lib/MC/MCParser/BUILD.gn

  Log Message:
  -----------
  [MC] Merge MCAsmLexer.{h,cpp} into AsmLexer.{h,cpp} (#134207)

2b11c7de4ae182496438e166cb6758d41b6e1740 introduced
`llvm/include/llvm/MC/MCAsmLexer.h` and made `AsmLexer` inherit from
`MCAsmLexer`, likely to allow target-specific parsers to depend solely
on `MCAsmLexer`. However, this separation now seems unnecessary and
confusing.

`MCAsmLexer` defines virtual functions with `AsmLexer` as its only
implementation, and `AsmLexer` itself has few extra public methods.

To simplify the codebase, this change merges MCAsmLexer.{h,cpp} into
AsmLexer.{h,cpp}. MCAsmLexer.h is temporarily kept as a forwarder.

Note: I doubt that a downstream lexer handling an assembly syntax
significantly different from the standard GNU Assembler syntax would
want to inherit from `MCAsmLexer`. Instead, it's more likely they'd
extend `AsmLexer` by adding new states and modifying its internal logic,
as seen with variables for MASM, M68k, and HLASM.



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