[llvm-bugs] [Bug 46240] New: Wrongly incrementing indentation for a multiline macro

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 8 02:30:29 PDT 2020


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

            Bug ID: 46240
           Summary: Wrongly incrementing indentation for a multiline macro
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: anton.kochkov at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

.clang-format has the following contents
(https://github.com/radareorg/radare2/blob/master/.clang-format):

Language: Cpp
MaxEmptyLinesToKeep: 1
SpaceBeforeParens: Always
SpaceInEmptyParentheses: false
SpacesInContainerLiterals: true
BasedOnStyle: LLVM
ContinuationIndentWidth: 8
IndentCaseLabels: false
IndentFunctionDeclarationAfterType: false
IndentWidth: 8
UseTab: Always
ColumnLimit: 0
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
AllowShortIfStatementsOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortLoopsOnASingleLine: false
AlignAfterOpenBracket: DontAlign
AlignTrailingComments: false
AlignOperands: false
Cpp11BracedListStyle: false
ForEachMacros: ['r_list_foreach', 'ls_foreach', 'fcn_tree_foreach_intersect',
'r_skiplist_foreach', 'graph_foreach_anode']
SortIncludes: false

The code below

#define R2R_CMD_TEST_FOREACH_RECORD_NOP(name, field)
#define R2R_CMD_TEST_FOREACH_RECORD(macro_str, macro_bool) \
        macro_str ("NAME", name) \
        macro_str ("FILE", file) \
        macro_str ("ARGS", args) \
        macro_str ("SOURCE", source) \
        macro_str ("CMDS", cmds) \
        macro_str ("EXPECT", expect) \
        macro_str ("EXPECT_ERR", expect_err) \
        macro_bool ("BROKEN", broken)

becomes 

#define R2R_CMD_TEST_FOREACH_RECORD_NOP(name, field)
#define R2R_CMD_TEST_FOREACH_RECORD(macro_str, macro_bool)                     
             \
        macro_str ("NAME", name)                                               
             \
                macro_str ("FILE", file)                                       
             \
                        macro_str ("ARGS", args)                               
             \
                                macro_str ("SOURCE", source)                   
             \
                                        macro_str ("CMDS", cmds)               
             \
                                                macro_str ("EXPECT", expect)   
             \
                                                        macro_str
("EXPECT_ERR", expect_err) \
                                                                macro_bool
("BROKEN", broken)


Which is obviously wrong.

See the code
https://github.com/radareorg/radare2/blob/master/binr/r2r/r2r.h#L53

-- 
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/20200608/8e71d1e7/attachment-0001.html>


More information about the llvm-bugs mailing list