[cfe-dev] Pseudo-functions taking types as arguments - keywords?

Sebastian Redl sebastian.redl at getdesigned.at
Mon Dec 29 03:38:33 PST 2008


Hi,

I just implemented the POD property of C++ classes, but to test it, I 
also need a way to determine if a class is a POD. Since the rules in the 
C++ standard only specify runtime behaviour of PODs, I can't use those. 
I'm therefore looking to type traits, which expose this information.

To implement TR1 type traits, the compiler must provide some sort of 
help. In GCC, this help takes the form of about 15 type-traits extension 
built-ins, like __is_pod, __is_abstract, __has_trivial_constructor, etc. 
These built-ins take the form of unary and binary functions that take 
types as arguments and return a bool constant expression. So my goal is 
to implement the __is_pod, and the only sane way to do this is to 
provide the infrastructure for all these type traits.

The question is, how do I implement the names of these functions? If 
they are normal identifiers, their arguments will be mis-parsed, unless 
I introduce a lot of special cases in the parser. However, it's a lot of 
keywords to add. Thus, I'm wondering if Clang has some pre-established 
way of handling such things.

Sebastian



More information about the cfe-dev mailing list