MyDeveloperDay marked 2 inline comments as done. MyDeveloperDay added inline comments.
================ Comment at: clang/docs/ClangFormatStyleOptions.rst:401 + * ``SIS_AlwaysNoElse`` (in configuration: ``AlwaysNoElse``) + Allow short if/else if statements even if the else is a compound statement. + ---------------- klimek wrote: > I'd try to make this either unconditionally what we do, or decide against > doing it. see note before, this is really about maintaining compatibility, I don't want to make the assumption that everyone likes ``` if (x) return 1; else if (x) return 2; else return 3; ``` There could easily be users who want this. ``` if (x) return 1; else if (x) return 2; else return 3; ``` I don't think it over complicates it, but it keeps the flexibility. The name of the option may not be the best 'suggestions welcome' ================ Comment at: clang/include/clang/Format/Format.h:263-264 SIS_WithoutElse, - /// Always put short ifs on the same line if - /// the else is not a compound statement or not. + /// If Else statements have no braces don't put them + /// on the same line. + /// \code ---------------- klimek wrote: > This seems weird - why would we want this? This is a compatiblity case for the previous "true" as it was before Before ``` if (x) return 1; else return 2; ``` would be transformed to ``` if (x) return 1; else return 2; ``` but ``` if (x) return 1; else { return 2; } ``` would not be transformed at all CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59408/new/ https://reviews.llvm.org/D59408 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits