LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 35298 - Provide a way to add spaces inside an initalizer list when formatting
Summary: Provide a way to add spaces inside an initalizer list when formatting
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: Formatter (show other bugs)
Version: 5.0
Hardware: Macintosh MacOS X
: P enhancement
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-14 03:06 PST by Hugh Bellamy
Modified: 2017-11-14 03:37 PST (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hugh Bellamy 2017-11-14 03:06:03 PST
E.g.

static CapClass vtable = { CustomLineCapTypeAdjustableArrow,
			   gdip_adjust_arrowcap_setup,
			   gdip_adjust_arrowcap_clone_cap,
			   gdip_adjust_arrowcap_destroy,
			   gdip_adjust_arrowcap_draw };

Formatting this code with clang-format removes the spaces inside the initializer list:

static CapClass vtable = {CustomLineCapTypeAdjustableArrow,
                          gdip_adjust_arrowcap_setup,
                          gdip_adjust_arrowcap_clone_cap,
                          gdip_adjust_arrowcap_destroy,
                          gdip_adjust_arrowcap_draw};


Please provide a way (e.g. something like SpacesInSquareBrackets) to provide the functionality to add spaces inside an initializer list.
Comment 1 Daniel Jasper 2017-11-14 03:37:51 PST
Have you tried setting Cpp11BracedListStyle to false?