[PATCH] D17852: Added formatAndApplyAllReplacements that works on multiple files in libTooling.

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 21 06:37:40 PDT 2016


klimek added inline comments.

================
Comment at: include/clang/Tooling/Core/Replacement.h:231
@@ +230,3 @@
+typedef std::map<std::string, Replacements>
+    FileToReplacementsMap;
+
----------------
Honestly, I'd get rid of the typedef. Daniel, what do you think?

================
Comment at: lib/Tooling/Refactoring.cpp:90
@@ +89,3 @@
+
+// FIXME: duplicated code here. Any better way to overload?
+bool formatAndApplyAllReplacements(const Replacements &Replaces,
----------------
Just call the above with the format::getStyle("file", FilePath, "LLVM")?
(note that I think "Google" is a bad default style here)

================
Comment at: unittests/Tooling/RefactoringTest.cpp:206
@@ +205,3 @@
+TEST_F(ReplacementTest, ReplaceAndFormatNoStyle) {
+  std::string Code = "MyType012345678901234567890123456789 *a =\n"
+                     "    new MyType012345678901234567890123456789();\n"
----------------
Also use a ColumnLimit to make the test more readable?


http://reviews.llvm.org/D17852





More information about the cfe-commits mailing list