[PATCH] D26752: [include-fixer] Refactor include fixer to be usable as a plugin

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 17 03:51:30 PST 2016


bkramer added inline comments.


================
Comment at: include-fixer/IncludeFixer.cpp:136
+
+    auto Begin = StartOfFile.getLocWithOffset(Placed.getOffset());
+    auto End = Begin.getLocWithOffset(Placed.getLength());
----------------
hokein wrote:
> I have a concern that `Placed` here might be not the replacement for inserting the new header, becuase the `Reps` returned from `createIncludeFixerReplacements` may have some replacements for cleanup.
> 
> To make it more correct, maybe we can check whether `Placed.getReplacementText()` is equal to `"#include" + Context.getHeaderInfos().front().Header`?
I don't think that will work. We do want to put the replacement into the right position so we have to apply the full cleanup, right? Just comparing with the header path doesn't work because the cleanup is larger than that.


https://reviews.llvm.org/D26752





More information about the cfe-commits mailing list