When formatting only certain lines for a file (clang-format -lines=x:x), two types of indentation could be expected:
- absolute: the indentation as if the whole file was formatted
- relative: the indentation is relative to the previous line, even if those are not indented correctly and are not in the range of lines to format
The default behavior for clang-format is relative formatting; e.g: running clang-format -lines=3:3 on (note the extra white space in front of @optional):
@protocol A @optional // comment - (void)f; @end MACRO
would give:
@protocol A @optional // comment - (void)f; @end MACRO
This diff adds a style option to specify absolute indentation; continuing the example above, with the option set, running clang-format -lines=3:3 would give:
@protocol A @optional // comment - (void)f; @end MACRO
Initial bug report / feature request: https://bugs.llvm.org/show_bug.cgi?id=37975