[llvm-bugs] [Bug 38381] New: Support using tab for continuation indent while keeping to use spaces for continuation alignment

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 31 01:54:13 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38381

            Bug ID: 38381
           Summary: Support using tab for continuation indent while
                    keeping to use spaces for continuation alignment
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lassi.niemisto at wapice.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

In our project, we have the rule to use tabs for indentation and spaces for
alignment (starting from the indentation level).

Clang-format makes a difference between indentation (block indentation) and
continuation (any indentation or alignment of the splitted lines). This kind of
makes sense, but at the same time it forces to use either tabs or spaces for
both cases, as controlled by UseTab=ForContinuationAndIndentation.

Examples (Tab='--->', space='.')
--------------------------------

With 
UseTab: ForContinuationAndIndentation
ContinuationIndentWidth: '4'
--->--->int file =
--->--->--->open(logfile_path, ???);
--->--->myFunction(param1,
--->--->--->--->...param2, // tabs used for alignment (bad)
--->--->--->--->...param3);

With 
UseTab: ForIndentation
ContinuationIndentWidth: '4'
--->--->int file =
--->--->....open(logfile_path, ???); // spaces used for indent (bad)
--->--->myFunction(param1,
--->--->...........param2,
--->--->...........param3);

I would assume there are others that would like to follow the similar rules, so
could there be an option e.g. UseTab:ForContinuationIndentAndIndentation or
just change the current behavior and never use tabs for alignment (does someone
really like to use it that way, i wonder).

Desired output:
--->--->int file =
--->--->--->open(logfile_path, ???); // indent
--->--->myFunction(param1,
--->--->...........param2,       // alignment
--->--->...........param3);

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180731/9c44860a/attachment-0001.html>


More information about the llvm-bugs mailing list