cameron314 added a comment.
Ooh, and I should also add, there's a non-trivial cost to grabbing the entire
file contents as a string and then converting it to UTF-8. If ClangFormat was
faster, this would certainly become a significant bottleneck that can't really
be worked around.
http://revie
cameron314 added a comment.
We did profile at one point, to see if it was something we could trivially
speed up (it wasn't). Most of it was on the parsing/annotation side, yes (which
makes sense, since that's the majority of the work when the format region
itself is limited). I'm afraid I don't
djasper added a comment.
It has very basic newline detection, but if possible, I'd like to not
significantly increase that. Specifically, I don't think it is worth the
complexity of additional configuration options that users have to worry about,
if it can just do the right thing (which IMO, it
cameron314 added a comment.
Too late ;-) We've successfully integrated it as the engine behind our
auto-formatting feature, passing only the minimal context necessary.
We tried at first to supply the full file context, but that turned out to be
much too slow in larger files. (We did a fair bit o
djasper added a comment.
Passing snippets / single lines from an IDE does not make sense. Don't try to
go down this road. clang-format always needs the full file as context.
If you are already in an IDE, that IDE should control the line endings, not
clang-format. Write a thin wrapper that chang
cameron314 added a comment.
Sure :-)
The motivation behind this patch (and a few more upcoming ones) is to make
ClangFormat (the library) more friendly for IDE integration (which is our
primary use case), in particular for on-the-fly auto-formatting.
In an IDE auto-format setting, it's often t
djasper added a comment.
Can you elaborate more on what case this is actually addressing? Are you saying
that you have a one-line file without linebreaks that you want clang-format to
format?
http://reviews.llvm.org/D19031
___
cfe-commits mailing
cameron314 added a comment.
ClangFormat still needs to know what kind of newline to insert when
reformatting code.
It already had the "auto-detect newline" behaviour; this patch simply allows
the auto-detection to be overridden with an explicit setting. This is important
for short files that ha