[cfe-dev] RefactoringTool corrupts source file

Daniel Dilts via cfe-dev cfe-dev at lists.llvm.org
Tue Sep 1 09:15:07 PDT 2015

I cleared the replacements in between and it still corrupted the file.  I
am spending some time trying to track it down.  Easy work around is to
create two tool instances without overlapped lifetimes.

On Tue, Sep 1, 2015 at 4:58 AM, Manuel Klimek <klimek at google.com> wrote:

> On Mon, Aug 31, 2015 at 10:07 PM Daniel Dilts via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>> I have a pair of FrontEndActions that I am running against a source
>> file.  The first one modifies the token stream.  The second one modifies
>> the AST.
>> I am running them both using the same RefactoringTool instance.  When
>> both actions modify the source it corrupts the file.  Looking at it more
>> closely it appears to be caused by runAndSave() not clearing out
>> RefactoringTool::Replace after applying the replacements.
>> Should runAndSave() clear the replacements collection after applying them
>> or is the current behavior correct?
> So far I never thought of anybody wanting to call runAndSave multiple
> times. If we can make it work, you're right, we should clear the
> replacements in between - feel free to send me a patch to that end :)
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150901/a841c7c8/attachment.html>

More information about the cfe-dev mailing list