[llvm-bugs] [Bug 30656] New: setting MacroBlockBegin / MacroBlockEnd slows down clang-format 4x

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 10 10:40:48 PDT 2016


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

            Bug ID: 30656
           Summary: setting MacroBlockBegin / MacroBlockEnd slows down
                    clang-format 4x
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            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

clang-formatting all files in blink takes about 15s on my machine. We recently
deleted the blink-specific .clang-format file which makes it fall back to the
global chromium .clang-format file. That one sets MacroBlockBegin/End, and with
that .clang-format file, reformatting all files in blink now takes about 60s.
(Deleting the MacroBlockBegin / MacroBlockEnd from our global .clang-format
file makes things fast again.)

Here's our .clang-format file:

BasedOnStyle: Chromium
Standard: Cpp11
MacroBlockBegin: "^\
BEGIN_MSG_MAP|\
BEGIN_MSG_MAP_EX|\
BEGIN_SAFE_MSG_MAP_EX|\
CR_BEGIN_MSG_MAP_EX|\
IPC_BEGIN_MESSAGE_MAP|\
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM|\
IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN|\
IPC_STRUCT_BEGIN|\
IPC_STRUCT_BEGIN_WITH_PARENT|\
IPC_STRUCT_TRAITS_BEGIN|\
POLPARAMS_BEGIN|\
PPAPI_BEGIN_MESSAGE_MAP$"
MacroBlockEnd: "^\
CR_END_MSG_MAP|\
END_MSG_MAP|\
IPC_END_MESSAGE_MAP|\
IPC_PROTOBUF_MESSAGE_TRAITS_END|\
IPC_STRUCT_END|\
IPC_STRUCT_TRAITS_END|\
POLPARAMS_END|\
PPAPI_END_MESSAGE_MAP$"


This looks reasonably short and shouldn't slow down formatting 4x. (I'm not
sure if ^ has higher precedence than |, but changing the regexen to "^(a|b|c)$"
didn't change performance)

-- 
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/20161010/40f2226b/attachment.html>


More information about the llvm-bugs mailing list