[PATCH] D49726: [emacs] Indent statement continuation to match clang-format

Andrew Savonichev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 31 03:04:08 PDT 2018


asavonic added inline comments.


================
Comment at: utils/emacs/emacs.el:14
+				   (member-init-intro . ++)
+				   (statement-cont . ++)))))
 
----------------
MaskRay wrote:
> How about
> 
>                                (statement-cont . c-lineup-assignments)
> 
Thanks, your reference `c-lineup-assignments' helped me find another
pattern for which our current style does not work:

  // no statement-cont
  int ShortVar = veryLongFunctionNameThatStillFitsIntoOneLine(SomeParameter)
    .nowThisDoesntFit()
    .andThis()
  /* clang-format:
  int ShortVar = veryLongFunctionNameThatStillFitsIntoOneLine(SomeParameter)
                     .nowThisDoesntFit()
                     .andThis()
  */

`c-lineup-assignments' helps here, but we need more indentation for
subsequent lines:

  // (statement-cont . c-lineup-assignments)
  int ShortVar = veryLongFunctionNameThatStillFitsIntoOneLine(SomeParameter)
                 .nowThisDoesntFit()
                 .andThis()
  /* clang-format:
  int ShortVar = veryLongFunctionNameThatStillFitsIntoOneLine(SomeParameter)
                     .nowThisDoesntFit()
                     .andThis()
  */


So I used a custom function to handle this:

  // (statement-cont . llvm-lineup-statement)
  int ShortVar = veryLongFunctionNameThatStillFitsIntoOneLine(SomeParameter)
                     .nowThisDoesntFit()
                     .andThis()
  /* clang-format:
  int ShortVar = veryLongFunctionNameThatStillFitsIntoOneLine(SomeParameter)
                     .nowThisDoesntFit()
                     .andThis()
  */



Repository:
  rL LLVM

https://reviews.llvm.org/D49726





More information about the llvm-commits mailing list