[clang] [clang-format] Add support for absl nullability macros (PR #130346)

Jan Voung via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 9 18:53:36 PDT 2025


jvoung wrote:

It would be nice to to avoid having each project configure via `AttributeMacros`.

The Abseil macro is meant to be a portable way to use the Clang-specific nullability attributes like `_Nonnull` (portable in that it will be empty for non-Clang compilers). So one would expect it to be treated the same as the attributes w.r.t. formatting. I don't think it makes sense to opt-out of it / configure it the other way. So users of these absl macros would want this on.

I see some other library-specific bits in `Format.cpp` like `Q_FOREACH`, `KJ_IF_MAYBE`, `BOOST_PP_STRINGIZE`, so it seemed like there is precedent for library-specific bits baked in?

https://github.com/llvm/llvm-project/pull/130346


More information about the cfe-commits mailing list