14 changed files
src | ||
newlines.cpp | ||
options.h | ||
tests | ||
cli/output | ||
mini_d_uc.txt | ||
mini_d_ucwd.txt | ||
mini_nd_uc.txt | ||
mini_nd_ucwd.txt | ||
show_config.txt | ||
universalindent.cfg | ||
config | ||
nl_before_struct.cfg + | ||
expected/cpp | ||
34360-nl_before_struct_struct.cpp + | ||
34361-nl_before_struct_scoped_enum.cpp + | ||
input/cpp | ||
nl_before_struct_scoped_enum.cpp + | ||
nl_before_struct_struct.cpp + | ||
cpp.test | ||
Add comment 6024 }
Add comment 6025 }
Add comment 6026
Add comment 6027 Minus // Control blanks before a class
Add comment 6027 Plus // Control blanks before a class/struct
Add comment 6028 if ( ( chunk_is_token(prev, CT_SEMICOLON)
Add comment 6029 || chunk_is_token(prev, CT_BRACE_CLOSE))
Add comment 6030 Minus && get_chunk_parent_type(prev) == CT_CLASS)
Add comment 6030 Plus && ( get_chunk_parent_type(prev) == CT_CLASS
Add comment 6031 Plus || get_chunk_parent_type(prev) == CT_STRUCT))
Add comment 6031 6032 {
Add comment 6032 Minus chunk_t *start = chunk_get_prev_type(prev, CT_CLASS, prev->level);
Add comment 6033 Minus chunk_t *tmp = start;
Add comment 6033 Plus c_token_t parent_type = get_chunk_parent_type(prev);
Add comment 6034 Plus chunk_t *start = chunk_get_prev_type(prev, parent_type, prev->level);
Add comment 6035 Plus chunk_t *tmp = start;
Add comment 6034 6036
Add comment 6035 Minus // Is this a class template?
Add comment 6037 Plus // Is this a class/struct template?
Add comment 6036 6038 if (get_chunk_parent_type(tmp) == CT_TEMPLATE)
Add comment 6037 6039 {
Add comment 6038 6040 tmp = chunk_get_prev_type(tmp, CT_TEMPLATE, prev->level);
Add comment 6062 6064 }
Add comment 6063 6065
Add comment 6064 6066 if ( tmp != nullptr
Add comment 6065 Minus && !start->flags.test(PCF_INCOMPLETE)
Add comment 6066 Minus && options::nl_before_class() > tmp->nl_count)
Add comment 6067 Plus && !start->flags.test(PCF_INCOMPLETE))
Add comment 6068 Plus {
Add comment 6069 Plus if (parent_type == CT_CLASS && options::nl_before_class() > tmp->nl_count)
Add comment 6067 6070 {
Add comment 6068 6071 log_rule_B("nl_before_class");
Add comment 6069 6072 blank_line_set(tmp, options::nl_before_class);
Add comment 6070 6073 }
Add comment 6074 Plus else if (parent_type == CT_STRUCT && options::nl_before_struct() > tmp->nl_count)
Add comment 6075 Plus {
Add comment 6076 Plus log_rule_B("nl_before_struct");
Add comment 6077 Plus blank_line_set(tmp, options::nl_before_struct);
Add comment 6078 Plus }
Add comment 6079 Plus }
Add comment 6071 6080 }
Add comment 6072 6081
Add comment 6073 6082 if ( chunk_is_token(prev, CT_BRACE_CLOSE)
Add comment 2664 extern Option<bool>
Add comment 2665 nl_after_label_colon;
Add comment 2666
Add comment 2667 Plus // The number of newlines before a struct definition.
Add comment 2668 Plus extern BoundedOption<unsigned, 0, 16>
Add comment 2669 Plus nl_before_struct;
Add comment 2670 Plus
Add comment 2667 2671 // The number of newlines after '}' or ';' of a struct/enum/union definition.
Add comment 2668 2672 extern BoundedOption<unsigned, 0, 16>
Add comment 2669 2673 nl_after_struct;
Add comment 549 nl_before_cpp_comment = 0
Add comment 550 nl_after_multiline_comment = false
Add comment 551 nl_after_label_colon = false
Add comment 552 Plus nl_before_struct = 0
Add comment 552 553 nl_after_struct = 0
Add comment 553 554 nl_before_class = 0
Add comment 554 555 nl_after_class = 0
Add comment 549 nl_before_cpp_comment = 0
Add comment 550 nl_after_multiline_comment = false
Add comment 551 nl_after_label_colon = false
Add comment 552 Plus nl_before_struct = 0
Add comment 552 553 nl_after_struct = 0
Add comment 553 554 nl_before_class = 0
Add comment 554 555 nl_after_class = 0
Add comment 2151 # Whether to force a newline after a label's colon.
Add comment 2152 nl_after_label_colon = false # true/false
Add comment 2153
Add comment 2154 Plus # The number of newlines before a struct definition.
Add comment 2155 Plus nl_before_struct = 0 # unsigned number
Add comment 2156 Plus
Add comment 2154 2157 # The number of newlines after '}' or ';' of a struct/enum/union definition.
Add comment 2155 2158 nl_after_struct = 0 # unsigned number
Add comment 2156 2159
34360-nl_before_struct_struct.cpp
/tests/expected/cpp/34360-nl_before_struct_struct.cpp/tests/expected/cpp/34360-nl_before_struct_struct.cpp
34361-nl_before_struct_scoped_enum.cpp
/tests/expected/cpp/34361-nl_before_struct_scoped_enum.cpp/tests/expected/cpp/34361-nl_before_struct_scoped_enum.cpp
nl_before_struct_scoped_enum.cpp
/tests/input/cpp/nl_before_struct_scoped_enum.cpp/tests/input/cpp/nl_before_struct_scoped_enum.cpp
nl_before_struct_struct.cpp
/tests/input/cpp/nl_before_struct_struct.cpp/tests/input/cpp/nl_before_struct_struct.cpp