<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi Pardis,</p>
which location does the `getEnd()` return?<br>
I assume it's one byte to early: You can do offset-calculations with
`SourceLocation`, therefore
`YourStmt->getEnd().getLocWithOffset(1)` returns one element past
the end-location.<br>
Be careful with corner-cases as the new Location might be invalid,
in a Macro-Range (isMarcoID()) and so on. Please note, that the
`DeclStmt` might not always have a semicolon after itself.<br>
E.g. `int my_variable = 42 /* This is my variable */;` could be such
a case. You might want to take a lookÂ
`clang-tidy/utils/LexerUtils.{h,cpp}` as it has some functionality
to deal with such situations.<br>
<br>
<p>Best, Jonas</p>
<p><br>
</p>
<div class="moz-cite-prefix">Am 02.12.18 um 02:50 schrieb Pardis
Pashakhanloo via cfe-dev:<br>
</div>
<blockquote type="cite"
cite="mid:CAMPUm_WgiQVrQEigy-OB6jedvJ-w+_mNswAe2eFgNREjZHfsMw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div class="gmail_default"
style="font-family:tahoma,sans-serif;color:#444444">Hi all,</div>
<div class="gmail_default"
style="font-family:tahoma,sans-serif;color:#444444"><br>
</div>
<div class="gmail_default"
style="font-family:tahoma,sans-serif;color:#444444">My goal is
to remove a DeclStmt from the beginning to end (including the
semicolon) using the Rewriter.</div>
<div class="gmail_default"
style="font-family:tahoma,sans-serif;color:#444444">However,
calling getEnd() on a DeclStmt does not give the correct
location. Is there a way to get the end location properly?</div>
<div class="gmail_default"
style="font-family:tahoma,sans-serif;color:#444444"><br>
</div>
<div>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">Best,
<div>Pardis</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
</body>
</html>