Douglas Gregor | 1 Feb 2012 03:04
Picon
Favicon

Re: Parsing and rewriting ObjC



Sent from my iPhone

On Jan 29, 2012, at 7:36 AM, Tayyab Akram <mail.tayyab-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

Thanks  Fariborz,

I am already looking at RewriteObjc and its really helpful. I just need to get opinion that I am on write track, and it is doable. Can you please confirm regarding PCH files? Is it possible that I generate PCH file of ObjC code on Mac OS X and then use Clang parser on Windows to parse ObjC code using that PCH file. Because I don't have Mac headers on windows so can I resolve these headers using pch file?

No, this won't work. PCH is an optimization only, which assumes that the headers are still available. 

Thanks,
--Tayyab  

On Sun, Jan 29, 2012 at 1:36 AM, jahanian <fjahanian-2kanFRK1NckAvxtiuMwx3w@public.gmane.org> wrote:

On Jan 28, 2012, at 11:25 AM, Tayyab Akram wrote:

> Dear all,
>
> I need some help/advice regarding Clang. My requirement is to do source-to-source transformation. I have to parse Objective C code and build AST and then modify AST (insert, delete or modify AST nodes) and generate finally output custom code having different semantics and syntax (not Objective C). I do not require to generate IR or binary code. Can someone please confirm following understandings,
>
> 1. I can parse ObjC code using Clang and then write my Visitor class by extending ASTConsumer to transform the AST and finally I will implement a CustomRewriter to generate the output in my custom format.
>

You may take a look at objective rewriter source code in:  lib/Rewriter/RewriteObjC.cpp

- Fariborz



_______________________________________________
cfe-dev mailing list
cfe-dev-Tmj1lob9twqVc3sceRu5cw@public.gmane.org
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
cfe-dev@...
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Tayyab Akram | 1 Feb 2012 10:32
Picon

Re: Parsing and rewriting ObjC

Thanks Douglas,

So nice of you.

Regards,
--Tayyab

On Wed, Feb 1, 2012 at 7:04 AM, Douglas Gregor <dgregor-2kanFRK1NckAvxtiuMwx3w@public.gmane.org> wrote:


Sent from my iPhone

On Jan 29, 2012, at 7:36 AM, Tayyab Akram <mail.tayyab-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

Thanks  Fariborz,

I am already looking at RewriteObjc and its really helpful. I just need to get opinion that I am on write track, and it is doable. Can you please confirm regarding PCH files? Is it possible that I generate PCH file of ObjC code on Mac OS X and then use Clang parser on Windows to parse ObjC code using that PCH file. Because I don't have Mac headers on windows so can I resolve these headers using pch file?

No, this won't work. PCH is an optimization only, which assumes that the headers are still available. 

Thanks,
--Tayyab  

On Sun, Jan 29, 2012 at 1:36 AM, jahanian <fjahanian-2kanFRK1NckAvxtiuMwx3w@public.gmane.org> wrote:

On Jan 28, 2012, at 11:25 AM, Tayyab Akram wrote:

> Dear all,
>
> I need some help/advice regarding Clang. My requirement is to do source-to-source transformation. I have to parse Objective C code and build AST and then modify AST (insert, delete or modify AST nodes) and generate finally output custom code having different semantics and syntax (not Objective C). I do not require to generate IR or binary code. Can someone please confirm following understandings,
>
> 1. I can parse ObjC code using Clang and then write my Visitor class by extending ASTConsumer to transform the AST and finally I will implement a CustomRewriter to generate the output in my custom format.
>

You may take a look at objective rewriter source code in:  lib/Rewriter/RewriteObjC.cpp

- Fariborz



_______________________________________________
cfe-dev mailing list
cfe-dev-Tmj1lob9twqVc3sceRu5cw@public.gmane.org
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
cfe-dev@...
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

Gmane