[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
This commit is contained in:
Jordan Rupprecht 2022-11-29 04:14:55 -08:00
parent 36fa80b046
commit cd02e78cd5
3 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,8 @@
#ifndef LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
#define LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
#include <Python.h>
// Defined here instead of a .swig file because SWIG 2 doesn't support
// explicit deleted functions.
struct Py_buffer_RAII {

View File

@ -12,6 +12,7 @@
#include <cstdint>
#include <variant>
#include "Plugins/Process/Utility/lldb-riscv-register-enums.h"
#include "RISCVInstructions.h"
#include "llvm/ADT/Optional.h"

View File

@ -12,7 +12,6 @@
#include <cstdint>
#include <variant>
#include "EmulateInstructionRISCV.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/Optional.h"