[cfe-dev] RefactoringTool - set output file path?

Gabor Kozar kozargabor at gmail.com
Sat Mar 28 10:14:55 PDT 2015


> Otherwise, you can write out the modified files in whatever way
> you want.

I cannot find any way to do that, nor the RefactoringTool, nor the
Rewriter classes seem to expose any functionality at all to write the
modified files anywhere else. How should I go about this (without
modifying clang itself)?

> Usually what people want to do is to write the diffs / changes out,
> instead of the modified files, in that case...

I need to specifically write out the modified files.

> Do you need to instrument the /source code/ in particular?

Unfortunately, I do, because I work in an environment where we cannot
compile using clang, only GCC. The reasons for this are... interesting,
at best, but unfortunately this is what I have to work. I agree with you
though, IR-level instrumentation is obviously a much better idea... one
that's not feasible in my situation.

---
Best regards,

Gábor 'ShdNx' Kozár http://gaborkozar.me



On Mon, Mar 16, 2015, at 15:59, David Blaikie wrote:
>
>
> On Sat, Mar 14, 2015 at 4:52 AM, Gabor Kozar
> <kozargabor at gmail.com> wrote:
>> __
>> I'm working on a clang tool that instruments source code.
>
> Do you need to instrument the /source code/ in particular? The usual
> approach with other instrumentation (sanitizers, code coverage, etc)
> is just to instrument the resulting binary (by instrumenting the LLVM
> IR generated by the frontend - usually during IR generation in the
> frontend (Clang, most often)) rather than mutating the source (or
> generating a mutated copy of the source) & then compiling that.
>
> The refactoring tools are really focussed on the scenario of
> refactoring - where you actually want to modify the original source.
> (not that they can't be used for other things, just that they might
> not be the best tool for the job)
>
>> However, I can't seem to find any option to set the output file path,
>> i.e. my tool will always modify the original file, which is not what
>> I want.
>>
>> Was this a deliberate decision, or am I just missing something?
>>
>> ---
>> Best regards,
>>
>> Gábor 'ShdNx' Kozár http://gaborkozar.me
>>
>>
>>
>> _______________________________________________
>>
cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150328/d2363ed0/attachment.html>


More information about the cfe-dev mailing list