[llvm-bugs] [Bug 34525] New: 'AllowShortFunctionsOnASingleLine: Inline' put always inline definition into an one line

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 8 02:12:07 PDT 2017


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

            Bug ID: 34525
           Summary: 'AllowShortFunctionsOnASingleLine: Inline' put always
                    inline definition into an one line
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: acieszkiel at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

It should allow to declare a inline definition in one line but no reformat it
always into an one-liner.

// BEFORE:

class MyClass
{
public:
    int getMemberInline() const
    {
        return member;
    }
    int getMember() const;
private:
    int member = 0;
};

int MyClass::getMember() const
{
    return member;
}

int main()
{
    MyClass m;
    int x{m.getMember()};
    int y{m.getMemberInline()};

    return 0;
}

// AFTER:

class MyClass {
public:
  int getMemberInline() const { return member; } // NOT GOOD!
  int getMember() const;

private:
  int member = 0;
};

int MyClass::getMember() const { // GOOD
  return member;
}

int main() {
  MyClass m;
  int x{m.getMember()};
  int y{m.getMemberInline()};

  return 0;
}

-- 
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/20170908/5fb3a53a/attachment.html>


More information about the llvm-bugs mailing list