[cfe-commits] r38928 - /cfe/cfe/trunk/Parse/ParseDecl.cpp
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:25:52 PDT 2007
Author: sabre
Date: Wed Jul 11 11:25:52 2007
New Revision: 38928
URL: http://llvm.org/viewvc/llvm-project?rev=38928&view=rev
Log:
Fix test/Parser/types.c
Modified:
cfe/cfe/trunk/Parse/ParseDecl.cpp
Modified: cfe/cfe/trunk/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseDecl.cpp?rev=38928&r1=38927&r2=38928&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseDecl.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseDecl.cpp Wed Jul 11 11:25:52 2007
@@ -242,9 +242,13 @@
// typedef-name
case tok::identifier:
// This identifier can only be a typedef name if we haven't already seen
- // a typename. This avoids the virtual method call on things like
- // 'int foo'.
- if (DS.TypeSpecType == DeclSpec::TST_unspecified &&
+ // a type-specifier. Without this check we misparse:
+ // typedef int X; struct Y { short X; }; as 'short int'.
+ if (DS.TypeSpecType == DeclSpec::TST_unspecified &&
+ DS.TypeSpecWidth == DeclSpec::TSW_unspecified &&
+ DS.TypeSpecComplex == DeclSpec::TSC_unspecified &&
+ DS.TypeSpecSign == DeclSpec::TSS_unspecified &&
+ // It has to be available as a typedef too!
Actions.isTypedefName(*Tok.getIdentifierInfo(), CurScope)) {
isInvalid = DS.SetTypeSpecType(DeclSpec::TST_typedef, PrevSpec);
break;
More information about the cfe-commits
mailing list