[cfe-dev] Tentative typeid Parser/AST implementation

Argiris Kirtzidis akyrtzi at gmail.com
Sun Nov 9 11:49:04 PST 2008


Hi Sebastian,

Sebastian Redl wrote:
>
> Attached patch implements parsing and AST support for typeid. It's not 
> complete in that the type of a typeid expression is const void instead 
> of const std::type_info, but otherwise everything should be correct. 
> However, since this is my first big change of the parser and AST, I 
> might well have overlooked something.

Your approach is not wrong, but I think that is better for consistency 
if you implement typeid in a similar way as sizeof/alignof is implemented.
sizeof for type calls Action.ActOnSizeOfAlignOfTypeExpr (creating a 
SizeOfAlignOfTypeExpr node), while sizeof for expression calls 
Action.ActOnUnaryOp (creating a UnaryOperator expression node).

-Argiris



More information about the cfe-dev mailing list