Skip to content

Put types consistently on the same line #15541

Closed as not planned
Closed as not planned
@tobiasgrosser

Description

Bugzilla Link 15169
Version unspecified
OS Linux
CC @NN--

Extended Description

Clang format does a good job in formatting the following global variable definitions by itself. However, the different decisions it takes for each makes it difficult to read a list of such definitions:

static cl::opt<unsigned>                                                        
MaxInsts("bb-vectorize-max-instr-per-group", cl::init(500), cl::Hidden,         
         cl::desc("The maximum number of pairable instructions per group"));    
                                                                                
static cl::opt<unsigned> MaxCandPairsForCycleCheck(                             
    "bb-vectorize-max-cycle-check-pairs", cl::init(200), cl::Hidden,            
    cl::desc("The maximum number of candidate pairs with which to use"          
             " a full cycle check"));                                           
                                                                                
static cl::opt<bool>                                                            
NoBools("bb-vectorize-no-bools", cl::init(false), cl::Hidden,                   
        cl::desc("Don't try to vectorize boolean (i1) values"));                
                                                                                
static cl::opt<bool> NoInts("bb-vectorize-no-ints", cl::init(false), cl::Hidden,
                            cl::desc("Don't try to vectorize integer values")); 
                                                                                
static cl::opt<bool>                                                            
NoFloats("bb-vectorize-no-floats", cl::init(false), cl::Hidden,              
         cl::desc("Don't try to vectorize floating-point values"));

In LLVM there exists both code that breaks after the type of the global and code that keeps
the variable name in the same line of the type. However, within one file I have never seen a mix here.

The very same is true for function definitions and their return types.

I believe choosing one strategy would increase overall readability.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang-formatinvalidResolved as invalid, i.e. not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions