[PATCH] D20734: [clang-format] insert new #includes into correct blocks when cleaning up Replacement with cleanupAroundReplacements().
Eric Liu via cfe-commits
cfe-commits at lists.llvm.org
Tue May 31 05:02:40 PDT 2016
ioeric added inline comments.
================
Comment at: unittests/Format/CleanupTest.cpp:310
@@ +309,3 @@
+ Context.createInMemoryFile("fix.cpp", Code);
+ tooling::Replacements Replaces = {
+ tooling::Replacement("fix.cpp", UINT_MAX, 0, "#include \"b.h\"")};
----------------
djasper wrote:
> Well, the only reason you seem to be using the FileID or "Context" for that matter is to translate between line/col and offset. I'd just pull that functionality out into a separate function (which does it based on the "Code" input) or not at all (hard-coding the offset doesn't seem *that* bad).
Ohh, I see! Thanks!
================
Comment at: unittests/Format/CleanupTest.cpp:510
@@ +509,3 @@
+TEST_F(CleanUpReplacementsTest, InsertMultipleNewHeadersAndSortGoogle) {
+ std::string Code = "\nint x;";
+ std::string Expected = "#include \"fix.h\"\n"
----------------
djasper wrote:
> Have you seen this comment?
Sorry that I missed this one...
http://reviews.llvm.org/D20734
More information about the cfe-commits
mailing list