[cfe-commits] r39321 - /cfe/cfe/trunk/Parse/ParseStmt.cpp
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:43:04 PDT 2007
Author: sabre
Date: Wed Jul 11 11:43:04 2007
New Revision: 39321
URL: http://llvm.org/viewvc/llvm-project?rev=39321&view=rev
Log:
Implement a FIXME: when a typedef is seen at statement scope, make sure to
actually add it into the declspec for the type being parsed. This allows us
to do correct semantic analysis on:
typedef int bar;
int foo() {
bar a;
return a;
}
This reduces # errors parsing carbon.h from 731 to 654.
Modified:
cfe/cfe/trunk/Parse/ParseStmt.cpp
Modified: cfe/cfe/trunk/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseStmt.cpp?rev=39321&r1=39320&r2=39321&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseStmt.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseStmt.cpp Wed Jul 11 11:43:04 2007
@@ -203,12 +203,18 @@
}
// Check to see if this is a declaration.
+ void *TypeRep;
if (!OnlyStatement &&
- Actions.isTypeName(*IdentTok.getIdentifierInfo(), CurScope)) {
+ (TypeRep = Actions.isTypeName(*IdentTok.getIdentifierInfo(), CurScope))) {
// Handle this. Warn/disable if in middle of block and !C99.
DeclSpec DS;
- // FIXME: Add the typedef name to the start of the decl-specs.
+ // Add the typedef name to the start of the decl-specs.
+ const char *PrevSpec = 0;
+ int isInvalid = DS.SetTypeSpecType(DeclSpec::TST_typedef,
+ IdentTok.getLocation(), PrevSpec,
+ TypeRep);
+ assert(!isInvalid && "First declspec can't be invalid!");
// ParseDeclarationSpecifiers will continue from there.
ParseDeclarationSpecifiers(DS);
More information about the cfe-commits
mailing list