MyDeveloperDay added a comment.

In D68554#1696675 <https://reviews.llvm.org/D68554#1696675>, @klimek wrote:

> Why not build a tool that takes the diff output of clang-format and changes 
> it to what you want? Wouldn't that be a couple of lines of python?


Thanks for taking the time to look at this idea. At least initially I can see 
that that would seem like a low impact way of doing it, and this also relates 
to D29039: [clang-format] Proposal for clang-format -r option 
<https://reviews.llvm.org/D29039>, initially I felt this is not clang-formats 
job.. but the more I look online the more I see people using tricks to parse 
the output-replacements-xml

https://stackoverflow.com/questions/22866609/can-clang-format-tell-me-if-formatting-changes-are-necessary

But really what it means is each developer/group has to come up with their own 
solution or we have to develop some external python script.

But take a look at the hoops people are jumping thought just to determine if 
something needs to be formatted. All the additional tools like find/xargs/grep 
and these tools aren't always truly cross-platform, throw in additional 
complications of those people not using WSL,MingW or Cygwin and you now need a 
powershell or cmd.exe solution too. To make matters work every build system is 
different or needs some $shell() magic to run a series of commands, and all of 
that's before we even mention the whole python issue of getting it to work 
reliably in both Cygwin and/or Windows.  (did I even mention the whole color 
diagnostics etc.. that you get for free by reusing the LLVM classes)

When you consider that really apart of the setting up of the DiagnosticsEngine 
(which is a large portion of this code change), its actually quite a small fix. 
(which still needs lit tests in clang/test/Format I know, I'm trying to get 
those working and failing miserably)

This idea really amounts to making the xml <replacements> human-readable, in a 
way in which both developers but also build systems which are used to parsing 
and/or displaying the output of compilers know and understand.

Like the quote says, its about making clang-format violations seem much more 
like build errors:

> If it's not formatted with clang-format it's a build error.




Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68554/new/

https://reviews.llvm.org/D68554



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to