[cfe-dev] Question about Clang Rewriter and white space

Stephan Bergmann via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 13 00:12:58 PST 2017


On 12/13/2017 06:32 AM, Andrew Gozillon via cfe-dev wrote:
> So in essence is there a way to make the Rewriter consider white space 
> for removal or is there an alternative tool or method (like using a 
> function of Clangs AST) to avoid this? At the moment I work around this 
> by injecting an arbitrary character in the empty space and then I delete 
> it. Which works, but doesn't seem like the ideal solution.

For inspiration, you could take a look at how the LibreOffice Clang 
plugin solves that, RewritePlugin::adjustRangeForOptions at 
<https://opengrok.libreoffice.org/xref/core/compilerplugins/clang/plugin.cxx#466>.



More information about the cfe-dev mailing list