krasimir added a comment.

I have an example where this goes wrong in ObjC (modulo indentation):

  struct Stuff stuff[] = {                                                      
                                                                                
                                                                                
                        
        {key, value},  // comment                                               
                                                                                
                                                                                
                        
        {key, value},  // comment                                               
                                                                                
                                                                                
                        
        {key, value},  // comment                                               
                                                                                
                                                                                
                        
        {key, value},                                                           
                                                                                
                                                                                
            
        {key, value},                                                           
                                                                                
                                                                                
        
        {nil, 0}};

gets formatted to (module indentation):

  struct Stuff stuff[] = {                                                      
                                                                                
                                                                                
                        
        {key, value},  // comment                                               
                                                                                
                                                                                
                        
        {key, value},  // comment                                               
                                                                                
                                                                                
                        
        {key, value},  // comment                                               
                                                                                
                                                                                
                        
        {key, value},                                                           
                                                                                
                                                                                
            
        {key, value},                                                           
                                                                                
                                                                                
        
        {
          nil, 0
        }
    };

I think we should try harder to detect the beginning of an attribute specifier. 
I think there may be a helper for that somewhere in clang-format.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79354/new/

https://reviews.llvm.org/D79354



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to