[llvm-bugs] [Bug 24385] New: Formatter needs more than 1 iteration to arrive at a fixed point

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 6 14:23:18 PDT 2015


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

            Bug ID: 24385
           Summary: Formatter needs more than 1 iteration to arrive at a
                    fixed point
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

Consider:

class A {
  //    void                        ParsePopupMenuObj(APP_MENUITEM *
  //ppMenuItem,JSObject * pObj);
  //    void                        DeleteMenuItems(APP_MENUITEM_ARRAY *
  //pMenuItems);
  //     void                        AddMenuItem(APP_MENUITEM_ARRAY *
pMenuItems, HMENU
  // hMenu, MENUITEMINFO MenuItemInfo);
};

If I format this repeatedly, I get (in sequence):

class A {
  //    void                        ParsePopupMenuObj(APP_MENUITEM
  //*
  // ppMenuItem,JSObject * pObj);
  //    void                        DeleteMenuItems(APP_MENUITEM_ARRAY
  //*
  // pMenuItems);
  //     void                        AddMenuItem(APP_MENUITEM_ARRAY *
pMenuItems,
  // HMENU
  // hMenu, MENUITEMINFO MenuItemInfo);
};


class A {
  //    void
  //ParsePopupMenuObj(APP_MENUITEM
  //*
  // ppMenuItem,JSObject * pObj);
  //    void
  //DeleteMenuItems(APP_MENUITEM_ARRAY
  //*
  // pMenuItems);
  //     void                        AddMenuItem(APP_MENUITEM_ARRAY *
  // pMenuItems,
  // HMENU
  // hMenu, MENUITEMINFO MenuItemInfo);
};


class A {
  //    void
  // ParsePopupMenuObj(APP_MENUITEM
  //*
  // ppMenuItem,JSObject * pObj);
  //    void
  // DeleteMenuItems(APP_MENUITEM_ARRAY
  //*
  // pMenuItems);
  //     void                        AddMenuItem(APP_MENUITEM_ARRAY
  // *
  // pMenuItems,
  // HMENU
  // hMenu, MENUITEMINFO MenuItemInfo);
};

class A {
  //    void
  // ParsePopupMenuObj(APP_MENUITEM
  //*
  // ppMenuItem,JSObject * pObj);
  //    void
  // DeleteMenuItems(APP_MENUITEM_ARRAY
  //*
  // pMenuItems);
  //     void
  // AddMenuItem(APP_MENUITEM_ARRAY
  // *
  // pMenuItems,
  // HMENU
  // hMenu, MENUITEMINFO MenuItemInfo);
};


This is a bit annoying: We have a presubmit that checks that new code is
clang-formatted by formatting the new lines and comparing it to the existing
code. If it's not equal, the tool suggests to run `git cl format`. Due to this
bug, the tool suggests doing that several times, until things finally settle
down.

-- 
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/20150806/58c5a44f/attachment-0001.html>


More information about the llvm-bugs mailing list