<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I am currently playing around with a Clang Libtool and I was wondering if there was a way to make the Clang Rewriter remove white space or if there is another utility class that can do this? For example I have an arbitrary
set of template parameters:</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">template <typename X, typename Y></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">And I wish to remove the first template parameter using the Rewriter in this case to modify the source code. To do this I remove the typename X and the comma. However, the result ends up like:</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">template < typename Y></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Which contains some unsightly white space! This persists even if I increase the SourceRange to just before the t of typename Y. So it seems to be ignoring the space.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">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. </p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Sorry if this is a silly question and t<span style="font-size: 12pt;">hank you very much for everyone's time. </span></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Best Regards,</p>
<p style="margin-top:0;margin-bottom:0">Andrew </p>
</div>
</body>
</html>