Hack clang-format config to format our macros better. (#2514)

This somewhat abuses control-flow macro handling in `clang-format` to get the behavior we want. Fortunately, I don't think we're ever likely to want this for its intended purpose so it seems harmless to co-opt it like this. If we really wanted, we can narrow it to `if`-macros, but I picked the simpler option to start.

FWIW, I tried all the other macro formatting special cases to see if one would work but it didn't. Might be worth filing a feature request to get a `TypeDefinitionMacros` setting to compliment `TypenameMacros` and format like this does, but it seems (very) low priority.
This commit is contained in:
Chandler Carruth
2023-01-05 09:38:21 -08:00
committed by GitHub
parent 2f84751d2b
commit d61531c82c
6 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
namespace Carbon {
CARBON_DEFINE_RAW_ENUM_CLASS(TestKind, uint8_t){
CARBON_DEFINE_RAW_ENUM_CLASS(TestKind, uint8_t) {
#define CARBON_ENUM_BASE_TEST_KIND(Name) CARBON_RAW_ENUM_ENUMERATOR(Name)
#include "toolchain/common/enum_base_test.def"
};