[PATCH] D18551: Added Fixer implementation and fix() interface in clang-format for removing redundant code.

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 22 03:20:54 PDT 2016

djasper added inline comments.

Comment at: lib/Format/Format.cpp:1544
@@ -1508,2 +1543,3 @@
-    computeAffectedLines(AnnotatedLines.begin(), AnnotatedLines.end());
+    AffectedRangeMgr.computeAffectedLines(AnnotatedLines.begin(),
+                                          AnnotatedLines.end());
Move this into the base class?

Comment at: lib/Format/Format.cpp:2097
@@ +2096,3 @@
+static tooling::Replacements
+setupEnvironmentAndProcess(T Callback, const FormatStyle &Style, StringRef Code,
+                           ArrayRef<tooling::Range> Ranges, StringRef FileName,
Instead, create a class Environment that does all of these and makes SourceMgr, ID and CharRanges available via getters (maybe more). Then you should be able to just instantiate an environment and call the other reformat/cleanup function with the corresponding arguments.


More information about the cfe-commits mailing list