Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1935345 - [1/1] add
AttributeMacros
to .clang-format r=sylvestre
C++ technically allows the construct `struct foo bar{}` as an initialization: "struct foo" (a C-ism) is the type name, while "bar" is the variable name and "{}" is the brace-initialization. This construct should be formatted in a completely different way than the type-declaration `struct FOO bar {}`: here "FOO" is a macro that expands to an `__attribute__((...)))` definition or a comment, "bar" is the type name, and "{}" is the class body. These constructs are formally ambiguous at the level of a code formatter without access to macro-expansion and the like. Unfortunately, after years of assuming that the intended construct -- common in C++ codebases like, say, Gecko -- is the latter, clang-format has suddenly decided to assume instead that it's the former. [1] To preserve the previous formatter behavior, add the `AttributeMacros` option to our `.clang-format`, starting it off with a list of all the attribute-macro names from mfbt/Attributes.h which are marked as applying to classes. [1] llvm/llvm-project#94184 Differential Revision: https://phabricator.services.mozilla.com/D231824
- Loading branch information