[cfe-dev] Using Rewriter to remove a function call argument along with preceding comma?
Stephan Bergmann
sbergman at redhat.com
Tue Jun 11 14:21:19 PDT 2013
On 06/11/2013 11:13 PM, Argyrios Kyrtzidis wrote:
> On Jun 11, 2013, at 1:34 PM, Stephan Bergmann <sbergman at redhat.com> wrote:
>> On 06/07/2013 08:19 PM, Argyrios Kyrtzidis wrote:
>>> On Jun 7, 2013, at 5:31 AM, Stephan Bergmann <sbergman at redhat.com
>>> <mailto:sbergman at redhat.com>> wrote:
>>>> Anyway, what I want to do is a rewriting Clang plugin that removes one
>>>> argument from specific function calls. But where I'm lost is how to
>>>> determine the SourceLocation of the comma preceding the given
>>>> argument, to do something like
>>>
>>> You could remove this range:
>>>
>>> [loc-for-end-of-token of end location of preceding argument, end
>>> location of removed argument]
>>
>> Yeah, but how do I get that loc-for-end-of-token?
>
> See Lexer::getLocForEndOfToken() or Preprocessor::getLocForEndOfToken() (the latter delegates to the former).
Ah, that was the missing link.
Thanks a lot,
Stephan
More information about the cfe-dev
mailing list