Issue 141129
Summary Clang-format not following rule `UseTab: Always`
Labels clang-format
Assignees
Reporter kunalchandan
    # Issue

First I would like to thank the authors of the tool. I have enjoyed using it and hope to continue using it.
If there is something I am doing incorrectly I would gladly be corrected.


I believe Clang-format is indenting with spaces when I want to only use tab indents.

## Sample

```c

#define FG_CYN	"\x1B[36m"
#define FG_WHT	"\x1B[37m"

#define RST	"\x1B[0m"

void fun_function(int param_a) {
	printf("I have a really long string here that exceeds my column limit");
	printf("I sometimes like" FG_CYN " to break with inserted defines" RST);
}
```

My minimal `.clang-format`

```yaml
BasedOnStyle: GNU
Language: Cpp
ColumnLimit: 80

UseTab: Always
IndentWidth: 8
TabWidth: 8
ContinuationIndentWidth: 8

BreakStringLiterals: true
```

## Output

```c

#define FG_CYN	"\x1B[36m"
#define FG_WHT	"\x1B[37m"

#define RST	"\x1B[0m"

void fun_function(int param_a)
{
	printf("I have a really long string I's extra super long here that "
	       "exceeds my column limit");
	printf("I sometimes like colors and I insert them like this " FG_CYN
	       " to break with inserted defines" RST);
}
```

more clearly or in another way

```c

void fun_function(int param_a)
{
\tprintf("I have a really long string I's extra super long here that "
\t\s\s\s\s\s\s\s\s"exceeds my column limit");
\tprintf("I sometimes like colors and I insert them like this " FG_CYN
\t\s\s\s\s\s\s\s\s" to break with inserted defines" RST);
}

```

I don't want to see `\s` or space characters used to indent, and only ever want to see `\t` or tabs as indents.

Thanks in advance :)


## Other supporting system information

Using vscode.

```
$ clang-format --version
clang-format version 20.1.4
```
clang-format installed with python venv

Ubuntu 22.04

Python 3.10

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to