[cfe-dev] clang-format breaks the code in short functions with C++ style comment

Daniel Jasper djasper at google.com
Sun Sep 7 00:05:41 PDT 2014


Yeah, that is very bad. However, I think it has already been fixed. What
version of clang-format are you using? If you are able to reproduce it with
a version built from the SVN trunk, please file a bug on
http://llvm.org/bugs.


On Sat, Sep 6, 2014 at 7:46 PM, Eran Ifrah <eran.ifrah at gmail.com> wrote:

> Hi,
> I just encountered this use case with clang-format:
>
> Consider the following function:
>
> ...
>     void Reset() { // Like Clear() but retain m_initialCommand. Used when
> an editor is reloaded
>        m_commands.clear();
>     }
> ​...​
>
> ​and in my clang-format plugin, I have the option:
> ​"Allow Short Functions on A Single Line" enabled.
>
> So, after indenting I get this:
>
>     void Reset() { // Like Clear() but retain m_initialCommand. Used when
> an editor is reloaded m_commands.clear(); }
>
> Which breaks compilation (and thanks to gcc poor error reporting it only
> took me 30 mins to figure what went wrong :P )
>
> Thanks,
>
> --
> Eran Ifrah,
> Author of codelite, a cross platform open source C/C++ IDE:
> http://www.codelite.org
> CodeLite IDE Blog: http://codeliteide.blogspot.com/
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140907/95ac8a15/attachment.html>


More information about the cfe-dev mailing list