[cfe-dev] ParseTag only called from ParseEnumSpecifier

Ted Kremenek kremenek at apple.com
Thu Sep 4 08:47:16 PDT 2008

On Sep 4, 2008, at 6:40 AM, Doug Gregor wrote:

>> On Wed, Sep 3, 2008 at 2:36 PM, Ted Kremenek <kremenek at apple.com>  
>> wrote:
>>> As a side note, my original interest in this code was to allow the
>>> parser+actions to be able to distinguish up front between enum/ 
>>> struct/
>>> union/class forward declarations and definitions.
>> Doesn't already the parser+actions distinguish them ? ActOnTag gets  
>> passed a
>> TagKind which is one of TK_Definition/TK_Declaration/TK_Reference.
> I *think* Ted meant that he wants to be able to know before actually
> parsing the struct-or-union-specifier (in C) whether it's going to
> declare, define, or reference a tag. This can be done with just a
> little bit of lookahead. In the C++ world, this would mean knowing
> whether we're parsing a class-specifier or an
> elaborated-type-specifier, and allow us to have different Parse
> functions for these two nonterminals (which are actually quite
> different, despite the ambiguity), rather than combining them into a
> single ParseClassSpecifier (which is really
> ParseClassSpecifierOrNonEnumElaboratedTypeSpecifier!).

Argiris is correct.  My mind short-circuited.  I believe that the  
TagKind should be enough for ActOnTag to take the appropriate action  
based on a definition/declaration/reference.

Thanks everyone!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080904/b756b21b/attachment.html>

More information about the cfe-dev mailing list