[libcxx-commits] [PATCH] D151900: [libc++][NFC] Create a new folder for config-related headers.

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 7 22:43:10 PDT 2023


var-const added a comment.

@Mordante I gave granularizing a shot. There's still feedback to address, but I uploaded the split headers in case you'd like to take a look. Some notes:

- for splitting, some headers had to be split because they are essentially dependencies for other headers (e.g. that's why I split `object_format.h` even though it's very small). For others, I went mostly by size of the category, but sometimes created really small headers if the macros seemed focused on something very specific (e.g. `objc.h`). There definitely is some overlap between different categories, so I'm very open to suggestions on how to rearrange / combine / etc.;
- `base.h` probably can be renamed now (it feels more like "misc").

One important thing was to make sure that new small headers don't rely on macros from other headers that they don't include. Unfortunately since we rely on `#if defined`, forgetting to include a necessary header will often result in a silent error (I presume, I didn't test that yet). To make it easier, I created the `base_umbrella.h` header that contains the most commonly used "core" headers and decided to include it everywhere (except the core headers themselves). There are still a few places that include stuff like `abi.h` and `c_std_library.h`.

This problem existed before (it was quite possible to add new macros somewhere in the middle of the file and have them rely on something that wasn't defined yet). I wonder if moving to `#if` checks instead of `#if defined` would be a good idea.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151900/new/

https://reviews.llvm.org/D151900



More information about the libcxx-commits mailing list