[cfe-dev] overwrite rewritten text

Kihong Heo via cfe-dev cfe-dev at lists.llvm.org
Mon Dec 10 09:53:54 PST 2018


Hi,

Thanks for your suggestion.
But the result is the same.
I noticed that It works as if the new string was not inserted.
For example, “Loc” points to the location after the inserted string, and “Loc.getWithOffset(-1)” points to the location before the string.
Is there any solution to sync up the mismatch?

Thanks,
Kihong

> On Dec 10, 2018, at 11:38 AM, Jonas Toth <development at jonas-toth.eu> wrote:
> 
> Hi,
> 
> did you consider creating a Replacement instead of a Insert-Remove
> combination?
> 
> Best, Jonas
> 
> Am 10.12.18 um 06:04 schrieb Kihong Heo via cfe-dev:
>> Hi All,
>> 
>> How can I overwrite or remove some code parts which were already rewritten?
>> 
>> Here is my code:
>> 
>> string S = …
>> Rewriter.InsertText(Loc, S);
>> Rewriter.RemoveText(Loc, S.length());    <=== Here, Segmentation fault.
>> 
>> 
>> Thanks for your help!
>> 
>> Best,
>> Kihong
>> 
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list