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

Eran Ifrah eran.ifrah at gmail.com
Thu Sep 11 09:15:43 PDT 2014


Confirmed. With latest trunk this bug is now fixed

Thanks,


On Sun, Sep 7, 2014 at 7:00 PM, Eran Ifrah <eran.ifrah at gmail.com> wrote:

> The current version is:
>
> D:\src\CppLexer>clang-format --version
> clang-format version 3.5.0 (210970)
>
> Will svn update my local build and I will report back
>
> Eran
>
>
>
> On Sun, Sep 7, 2014 at 10:05 AM, Daniel Jasper <djasper at google.com> wrote:
>
>> 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
>>>
>>>
>>
>
>
> --
> Eran Ifrah,
> Author of codelite, a cross platform open source C/C++ IDE:
> http://www.codelite.org
> CodeLite IDE Blog: http://codeliteide.blogspot.com/
>



-- 
Eran Ifrah,
Author of codelite, a cross platform open source C/C++ IDE:
http://www.codelite.org
CodeLite IDE Blog: http://codeliteide.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140911/5a9234ab/attachment.html>


More information about the cfe-dev mailing list