Re: [cfe-users] A question regarding formatting of function try-block
I replied. -- Forwarded message - From: Owen Pan Date: Mon, Sep 24, 2018 at 9:38 PM Subject: Fwd: [cfe-users] A question regarding formatting of function try-block To: , Hi Jakob, I have filed a bug report and assigned it to myself. See https://bugs.llvm.org/show_bug.cgi?id=39067. There is no combination of existing options can work around this problem. Please stay tuned... Thanks, Owen On Tue, Sep 25, 2018 at 2:30 PM David Blaikie via cfe-users < cfe-users@lists.llvm.org> wrote: > Not sure who's doing most of the work on clang-format these days - Sam, > maybe you know? > > On Mon, Sep 24, 2018 at 2:07 AM Jakob van Bethlehem via cfe-users < > cfe-users@lists.llvm.org> wrote: > >> Dear all, >> >> Recently we introduced clang-format into our company, for formatting >> c++-code. After some fine-tuning of the settings, we're extremely happy >> with it. Today I came across a bit of code that uses a function try-block - >> not a very-often use feature of C++, but sometimes usefuly, however, I >> don't really like what clang-format is doing, and I'm having trouble >> figuring out how to tell clang-format what to do. >> >> So, here is the header of the function that has the problem: >> >> HlPropertiesParser::HlPropertiesParserError >> HlPropertiesParser::readPropertiesDataFromFile( >> const std::wstring& filename, >> std::vector& hlPropertyRules, >> std::wstring& errorMsg) >> try >> { >> /// code >> >> Of course down below will be the closing brace of the function, and a >> number of catch-clauses. When I now run clang-format on it, it will move >> the 'try' after the closing bracket like so: >> >> HlPropertiesParser::HlPropertiesParserError >> HlPropertiesParser::readPropertiesDataFromFile( >> const std::wstring& filename, >> std::vector& hlPropertyRules, >> std::wstring& errorMsg) try >> { >> >> It looks as if clang-format considers this like a const- or noexcept >> specifier. However, I would really like to tell clang-format to put the >> 'try' on the next line, preferably even always at the start of the line. Is >> there a style option that will let be achieve this? >> >> Sincerely, >> Jakob van Bethlehem >> >> ___ >> cfe-users mailing list >> cfe-users@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users >> > ___ > cfe-users mailing list > cfe-users@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users > ___ cfe-users mailing list cfe-users@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
Re: [cfe-users] A question regarding formatting of function try-block
Fixed by Revision 343305. On Tue, Sep 25, 2018 at 2:30 PM David Blaikie via cfe-users < cfe-users@lists.llvm.org> wrote: > Not sure who's doing most of the work on clang-format these days - Sam, > maybe you know? > > On Mon, Sep 24, 2018 at 2:07 AM Jakob van Bethlehem via cfe-users < > cfe-users@lists.llvm.org> wrote: > >> Dear all, >> >> Recently we introduced clang-format into our company, for formatting >> c++-code. After some fine-tuning of the settings, we're extremely happy >> with it. Today I came across a bit of code that uses a function try-block - >> not a very-often use feature of C++, but sometimes usefuly, however, I >> don't really like what clang-format is doing, and I'm having trouble >> figuring out how to tell clang-format what to do. >> >> So, here is the header of the function that has the problem: >> >> HlPropertiesParser::HlPropertiesParserError >> HlPropertiesParser::readPropertiesDataFromFile( >> const std::wstring& filename, >> std::vector& hlPropertyRules, >> std::wstring& errorMsg) >> try >> { >> /// code >> >> Of course down below will be the closing brace of the function, and a >> number of catch-clauses. When I now run clang-format on it, it will move >> the 'try' after the closing bracket like so: >> >> HlPropertiesParser::HlPropertiesParserError >> HlPropertiesParser::readPropertiesDataFromFile( >> const std::wstring& filename, >> std::vector& hlPropertyRules, >> std::wstring& errorMsg) try >> { >> >> It looks as if clang-format considers this like a const- or noexcept >> specifier. However, I would really like to tell clang-format to put the >> 'try' on the next line, preferably even always at the start of the line. Is >> there a style option that will let be achieve this? >> >> Sincerely, >> Jakob van Bethlehem >> >> ___ >> cfe-users mailing list >> cfe-users@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users >> > ___ > cfe-users mailing list > cfe-users@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users > ___ cfe-users mailing list cfe-users@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
Re: [cfe-users] [clang-format] Trailing return type
I think that was a bug fix as the latest clang-format will convert the "Before" code to "After" even in the absence of the .clang-format configuration file. Regards, Owen On Wed, Oct 31, 2018 at 2:24 PM Mateusz Loskot via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi, > > I'm looking for clang-format features to control formatting of > functions with trailing return type. > > I found this related change > > http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20150601/130293.html > > What are the options to control the formatting presented in that message? > Namely, how to achieve the "After" formatting as copied here? > > Before: > template > auto aa(T t) -> decltype(eaaa(t.a) >.()); > > After: > template > auto aa(T t) > -> decltype(eaaa(t.a).()); > > There seem to be nothing related to trailing return or arrow formatting > on https://clang.llvm.org/docs/ClangFormatStyleOptions.html > > Best regards, > -- > Mateusz Loskot, http://mateusz.loskot.net > ___ > cfe-users mailing list > cfe-users@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users > ___ cfe-users mailing list cfe-users@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users