llvm / llvm/llvm-project

[clang-format] Skip Indentation on anonymous namespaces

Open
#221,584 1 comment 0 reactions 0 assignees View on GitHub
clang-format
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

It would be nice to have an option for clang-format to skip the indentation on anonymous namespaces only.

**Current Behavior**:

```
namespace {
void anon_func(); // is indented
}
```

**Desired Behavior**:

```
namespace {
void anon_func(); // do not indent
}
```

Contributor guide

Open the contributing guide

Research direction

Start with clang-format's handling of anonymous namespaces and locate the relevant formatting tests. Add an option that leaves declarations in anonymous namespaces unindented, then verify formatting matches the desired behavior while other namespace indentation remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.