[cfe-commits] r41521 - in /cfe/trunk: Parse/ParseDecl.cpp Sema/SemaDecl.cpp Sema/SemaExpr.cpp Sema/SemaType.cpp include/clang/AST/Decl.h include/clang/Parse/DeclSpec.h

Chris Lattner clattner at apple.com
Mon Aug 27 21:38:16 PDT 2007


On Aug 27, 2007, at 9:12 PM, Steve Naroff wrote:
>> I think this should move all the way up to Decl (even past  
>> VarDecl) and be generalized to just be "InvalidDecl". This will  
>> allow it to be set for a decl that has any erroneous aspect: for  
>> example, on a "void foo" parm decl (void is a valid type, but not  
>> a valid type for a parmdecl, f.e.).
>>
>
> Agreed. This was only temporary (to prove the approach for ParmDecls).

Yep, understood.

>> Why does this need invalidtype here?
>
> It is needed for ParmVarDecls (see Sema::ParseParmDeclarator() for  
> more details).

You're absolutely right as usual, thanks for the pointer!


>> Thanks Steve, I think this is a very nice solution!
>
> Great. This will also enable us to fix the following "undeclared  
> identifier" diags:-)
>
> [dylan:~/llvm/tools/clang] admin% cat x.c
> struct s;
> void proto(struct s);
>
> void f () {
>   struct s v, *p;
>
>   p = &v; // v is currently undeclared.
> }
>
> [dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang x.c
> x.c:5:12: error: variable has incomplete type 'struct s'
>   struct s v, *p;
>            ^
> x.c:7:8: error: use of undeclared identifier 'v'
>   p = &v; // v is currently undeclared.
>        ^
> 2 diagnostics generated.

yep!

-Chris




More information about the cfe-commits mailing list