[cfe-commits] r39217 - /cfe/cfe/trunk/Parse/ParseDecl.cpp
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:41:22 PDT 2007
Author: sabre
Date: Wed Jul 11 11:41:22 2007
New Revision: 39217
URL: http://llvm.org/viewvc/llvm-project?rev=39217&view=rev
Log:
add some comments.
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=39217&r1=39216&r2=39217&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseDecl.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseDecl.cpp Wed Jul 11 11:41:22 2007
@@ -878,10 +878,11 @@
isGrouping = true;
} else if (Tok.getKind() == tok::r_paren || // 'int()' is a function.
isDeclarationSpecifier()) { // 'int(int)' is a function.
-
+ // This handles C99 6.7.5.3p11: in "typedef int X; void foo(X)", X is
+ // considered to be a type, not a K&R identifier-list.
isGrouping = false;
} else {
- // Otherwise, this is a grouping paren, e.g. 'int (*X)'.
+ // Otherwise, this is a grouping paren, e.g. 'int (*X)' or 'int(X)'.
isGrouping = true;
}
@@ -908,6 +909,8 @@
// Okay, this is the parameter list of a function definition, or it is an
// identifier list of a K&R-style function.
+
+
// TODO: enter function-declaration scope, limiting any declarators for
// arguments to the function scope.
// NOTE: better to only create a scope if not '()'
@@ -922,6 +925,8 @@
HasPrototype = false;
IsEmpty = true;
} else if (Tok.getKind() == tok::identifier &&
+ // K&R identifier lists can't have typedefs as identifiers, per
+ // C99 6.7.5.3p11.
!Actions.isTypeName(*Tok.getIdentifierInfo(), CurScope)) {
// Identifier list. Note that '(' identifier-list ')' is only allowed for
// normal declarators, not for abstract-declarators.
More information about the cfe-commits
mailing list