[cfe-dev] Creating New Types

Bill Wendling isanbard at gmail.com
Mon Aug 6 23:14:33 PDT 2007


Hi all,

I'd like to create new types based on previous types. E.g., if I have  
two types like this:

	int const * volatile * const * const
	float     * volatile * const * volatile * const * const * restrict

I'd like to be able to create these two types from them:

	char const    * volatile * const *
	char volatile * const    * const *

(This is related to the description of "casting away constness" in  
the C++ standard [5.2.11p8].)

What's the best way to code this? I'm currently thinking of using the  
context to get the builtin type "char", and then creating a QualType  
around that. Then continuing to create QualTypes around that, etc.

When I do this, will the QualType be uniqued? Is there something not  
good about doing this? Or is there a simpler way of doing this?

Thanks!
-bw



More information about the cfe-dev mailing list