[cfe-dev] Why "Invalid region to erase" when replace or remove the whole VarDecl text?

Shuai Wang wangshuai901 at gmail.com
Mon Nov 4 07:42:04 PST 2013


Hi,

I want to remove certain VarDecl, using this:


   rewrite.RemoveText(decl->getRange());

Then I got :
   Assertion failed: (RealOffset+Size < Buffer.size() && "Invalid
location"), function RemoveText, file
/usr/local/src/llvm/tools/clang/lib/Rewrite/Core/Rewriter.cpp

The same satuation happens when I try to :
   rewrite.ReplaceText(decl->getRange(), " ");


Could anyone tell me how to Remove the text of certain VarDecl..?

I really appreciate that!

Best Regards,
Shuai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131104/2e95b9b5/attachment.html>


More information about the cfe-dev mailing list