[cfe-dev] Changing the size of ConstantArrayType

Dimitrij Kotrev dimitrij.kotrev at googlemail.com
Mon Jan 31 15:37:35 PST 2011


Hello again,
thank you for your answers, John and Peter.

2011/1/31 Peter Collingbourne <peter at pcc.me.uk>:
> To answer this question it would help if you explain more about what
> you are trying to do and why you think you need to change array sizes
> after AST construction.

I'm going to try to explain my problem.

First of all, i have some class hierarchy, which could depend on some
template parameters:

template<class T> class Base { ... };
template<class T> class Derived1 {...};
template<class T> class Derived2 {...};

And another class:

template<class T> class Other {
  char buffer[ <here i need the max size of a derived class from Base> ];
};

I would name it something like the 'maxsizeof' operator of a class hierarchy.

Well i have another way to solve this problem, but i wanted to know if
it was possible
to solve it that way.


> ... as the AST is not designed to be modified after semantic analysis.
This is very sad and i realized it very late, otherwise i would have looked for
another tool. The AST is one of the things a lot of people want to
play with. Not
being able to modify or transform it, makes clang not very appealing.

Thanks



More information about the cfe-dev mailing list