[all-commits] [llvm/llvm-project] cd02e7: [NFC] Make headers self-contained.

Jordan Rupprecht via All-commits all-commits at lists.llvm.org
Tue Nov 29 04:15:10 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cd02e78cd5cdfa079f2a82f34fea25bee1ae02da
      https://github.com/llvm/llvm-project/commit/cd02e78cd5cdfa079f2a82f34fea25bee1ae02da
  Author: Jordan Rupprecht <rupprecht at google.com>
  Date:   2022-11-29 (Tue, 29 Nov 2022)

  Changed paths:
    M lldb/bindings/python/python-typemaps.h
    M lldb/source/Plugins/Instruction/RISCV/RISCVCInstructions.h
    M lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h

  Log Message:
  -----------
  [NFC] Make headers self-contained.

Some headers in LLDB work only when considered as textual inclusion, but not if one attempts to use them on their own or with a different context.

- python-typemaps.h: uses Python definitions without using "Python.h".
- RISCVCInstructions.h uses RISC-V register enums without including the enums header.
- RISCVInstructions.h includes EmulateInstructionRISCV.h, but is unnecessary since we forward-declare EmulateInstructionRISCV anyway. Including the header is problematic because EmulateInstructionRISCV.h uses DecodeResult which isn't defined until later in RISCVInstructions.h.

This makes LLDB build cleanly with the "parse_headers" feature [1]. I'm not sure what the analagous CMake option is.

[1] I didn't find public documentation but @MaskRay wrote this up: https://maskray.me/blog/2022-09-25-layering-check-with-clang#parse_headers

Reviewed By: labath, MaskRay

Differential Revision: https://reviews.llvm.org/D138310




More information about the All-commits mailing list