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

Eli Friedman eli.friedman at gmail.com
Mon Dec 29 09:26:53 PST 2008


On Mon, Dec 29, 2008 at 3:38 AM, Sebastian Redl
<sebastian.redl at getdesigned.at> wrote:
> 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.

In the past, we've just used keywords; as far as I recall, the only
cases we've had to deal with so far are sizeof, alignof, and typeof.
You're pretty much forced to use keywords, actually, because you'll
need a special action to pass the type names to Sema.  If you want to
avoid adding 15 Actions, you can probably make a single ActOnTypeTrait
which takes an enum.

-Eli



More information about the cfe-dev mailing list