Skip to content

clang-format formats lines exceeding ColumnLimit. #116179

@LinZhihao-723

Description

@LinZhihao-723

When running clang-format on the following code section:

    RegexASTCapture(
            std::unique_ptr<RegexAST<NFAStateType>> group_regex_ast,
            std::unique_ptr<Tag> tag
    )
            : m_group_regex_ast{
                      nullptr == group_regex_ast
                              ? throw std::invalid_argument("Group regex AST cannot be null")
                              : std::move(group_regex_ast)},
              m_tag{nullptr == tag ? throw std::invalid_argument("Tag cannot be null")
                                   : std::move(tag)} {
        RegexAST<NFAStateType>::set_subtree_positive_tags(
                m_group_regex_ast->get_subtree_positive_tags()
        );
        RegexAST<NFAStateType>::add_subtree_positive_tags({m_tag.get()});
    }

The formatted result is:

    RegexASTCapture(
            std::unique_ptr<RegexAST<NFAStateType>> group_regex_ast,
            std::unique_ptr<Tag> tag
    )
            : m_group_regex_ast{nullptr == group_regex_ast ? throw std::invalid_argument("Group regex AST cannot be null") : std::move(group_regex_ast)},
              m_tag{nullptr == tag ? throw std::invalid_argument("Tag cannot be null")
                                   : std::move(tag)} {
        RegexAST<NFAStateType>::set_subtree_positive_tags(
                m_group_regex_ast->get_subtree_positive_tags()
        );
        RegexAST<NFAStateType>::add_subtree_positive_tags({m_tag.get()});
    }

Configure files we used: y-scope/yscope-dev-utils@0ae873b
The ColumnLimit is set to 100, but exceeded
The bug can be reproduced on both clang-format 18.1 and 19.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions