sammccall added a comment.

> I don't know the history behind the desired dependencies, I'll let others 
> comment whether this is OK, but my guess it that it depends on the tradeoff, 
> it's hard to justify 3 new deps for a change that is supposed to be simple. 
> How hard is to implement this without using libFormat?

What libFormat does is fairly complex:

- it parses header guards/file comments to avoid violating them
- it locates existing includes to insert nearby
- it is aware of "main header", and system vs user headers
- it avoids generating a fixit if the header is already included somewhere
- it preserves sort order within include blocks (I forgot to include this!)

This is fixCppIncludeInsertions in Format.cpp plus its helpers, and 
sortCppIncludes.

Altogether this looks like being around 500LOC that would be directly 
duplicated, plus some replacements for policy handled by LLVMStyle, plus tests 
(a new impl would need to be more thoroughly tested).
I also don't know what the costs of the dependency are.

ioeric: is my estimate about right?



================
Comment at: lib/Sema/SemaLookup.cpp:4997
+                                        format::getLLVMStyle());
+  if (Reps)
+    for (const auto &Placed : *Reps) {
----------------
Hmm, I probably want to formatReplacements here for sorting...


https://reviews.llvm.org/D25311



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

Reply via email to