[cfe-dev] Adding support for Cloning in the AST

moataz ragab mtzrgb at gmail.com
Tue May 19 19:18:46 PDT 2009


I am just testing the cloning by calling it recursively over the AST so it
goes on. It should stop at the DeclRefExpr.

Whether it might be useful or not to clone a declaration, it might be useful
if you want to create a new variable declaration similar to another
declaration and only change the name.

Moataz


On Mon, May 18, 2009 at 8:14 PM, Douglas Gregor <dgregor at apple.com> wrote:

>
> On May 17, 2009, at 2:22 AM, Sebastian Redl wrote:
>
>  moataz ragab wrote:
>>
>>> Hi Sebastian,
>>>
>>> Thanks.
>>>
>>> Attached 3 files: the patch "clone.diff". should be applied on the
>>> clang directory.
>>>                        RewriteLoopUnroll.cpp you have to put it in
>>> the clang-cc directory.
>>>                        test2.c: simple testcase for a forloop with
>>> array access in the body.
>>>
>>>
>>> you can invoke the loopunroller using:
>>>
>>> ../../../../Debug/bin/clang-cc -loop-unroll tests/test2.c
>>>
>>> Currently it crashes because ImplicitCastExpr object doesn't get
>>> cloned. The Stmt base class gets called instead of ImplicitCastExpr
>>>
>> It calls ImplicitCastExpr::Clone just fine. It crashes because it can't
>> clone the VarDecl.
>>
>
>
> Why would we clone declarations?
>
>  - Doug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090520/3f1afea9/attachment.html>


More information about the cfe-dev mailing list