[clang] [clang-format] Add anonymous namespace indentation option (PR #244933)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 26 11:52:46 PST 2026
================
@@ -3352,19 +3352,23 @@ void UnwrappedLineParser::parseNamespace() {
"'namespace' expected");
const FormatToken &InitialToken = *FormatTok;
+ bool IsAnonymousNamespace = InitialToken.is(tok::kw_namespace);
nextToken();
if (InitialToken.is(TT_NamespaceMacro)) {
parseParens();
} else {
while (FormatTok->isOneOf(tok::identifier, tok::coloncolon, tok::kw_inline,
tok::l_square, tok::period, tok::l_paren) ||
(Style.isCSharp() && FormatTok->is(tok::kw_union))) {
- if (FormatTok->is(tok::l_square))
+ if (FormatTok->is(tok::l_square)) {
parseSquare();
- else if (FormatTok->is(tok::l_paren))
+ } else if (FormatTok->is(tok::l_paren)) {
parseParens();
- else
+ } else {
+ if (FormatTok->is(tok::identifier))
----------------
HazardyKnusperkeks wrote:
The `parseSquare` handles c++11 attributes, and we handle `__attribute__` (and `__declspec`) equally. So either both, or none.
https://github.com/llvm/llvm-project/pull/244933
More information about the cfe-commits
mailing list