[llvm-bugs] [Bug 32151] New: AlwaysBreakLambda

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 6 07:49:25 PST 2017


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

            Bug ID: 32151
           Summary: AlwaysBreakLambda
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rianquinn at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

This is more of an enhancement than a bug, but it would be great if there was
an option like: AlwaysBreakLambda that did the following:

Before:
TEST_CASE("cout")
{
    CHECK_COUT("hello\n", [] { std::cout << "hello\n"; });
}

After:
TEST_CASE("cout")
{
    CHECK_COUT("hello\n", [] { 
        std::cout << "hello\n"; 
    });
}

Currently, clang format is always outputting the "before" case if it can fit on
a single line, and it just looks bad IMO. The "after" case is really what I
would like to see since I am defining a function. 

It also seems to do the following which is even worse IMO:

Odd Ball Case:
TEST_CASE("cout")
{
    CHECK_COUT(
        "slightly longer\n", [] { std::cout << "slightly longer\n"; });
}

-- 
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/20170306/c4921bae/attachment.html>


More information about the llvm-bugs mailing list