[libc-commits] [PATCH] D150942: [libc] Make predicate macros be usable in `if constexpr (...)` contexts.

Guillaume Chatelet via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon May 22 02:19:52 PDT 2023


gchatelet added a comment.

The pattern is smart but I can see two issues with it:

1. Depending on the context, the literal (i.e. `LIBC_TARGET_ARCH_IS_ARM`) is a preprocessor definition or a variable, this can be confusing.
2. It's easy to mess up when defining (or renaming) the preprocessor definitions.

Also, we can already achieve the same behavior - although I agree it is more verbose.

  if constexpr (LLVM_LIBC_IS_DEFINED(LIBC_TARGET_ARCH_IS_ARM)) {
   ...
  }

I'm not completely sure it's worth the complexity.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150942



More information about the libc-commits mailing list