diff options
author | Steve Naroff <snaroff@apple.com> | 2007-09-12 14:07:44 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2007-09-12 14:07:44 +0000 |
commit | 6109140b00acb6b245c7aa545da4d13a058e33d4 (patch) | |
tree | 0c0ba0409c8342d8c5cb5d645132d4ea32bfcd13 /clang/Sema/Sema.h | |
parent | 100410af133f319cfcea9bffb1f341d9b362aa44 (diff) | |
download | llvm-6109140b00acb6b245c7aa545da4d13a058e33d4.tar.gz |
Fix the following bug submitted by Ted Kremenek:
void func() {
int xx = xx; // incorrectly diagnosed 'xx' as an undeclared identifier.
}
This smallish bug resulted in a largish fix. Here are some highlights:
- Needed to make sure ParseDeclarator is called *before* parsing any
initializer. Removed the "Init" argument to ParseDeclarator.
- Added AddInitializerToDecl() to the Action & Sema classes.
In Sema, this hook is responsible for validating the initializer and
installing it into the respective decl.
- Moved several semantic checks from ParseDeclarator() to
FinalizeDeclaratorGroup(). Previously, this hook was only responsible for
reversing a list. Now it plays a much larger semantic role.
All of the above changes ended up simplifying ParseDeclarator(), which
is goodness...
llvm-svn: 41877
Diffstat (limited to 'clang/Sema/Sema.h')
-rw-r--r-- | clang/Sema/Sema.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/Sema/Sema.h b/clang/Sema/Sema.h index 2be727a42687..b6fe89a3fa19 100644 --- a/clang/Sema/Sema.h +++ b/clang/Sema/Sema.h @@ -137,8 +137,8 @@ private: // Symbol table / Decl tracking callbacks: SemaDecl.cpp. // virtual DeclTy *isTypeName(const IdentifierInfo &II, Scope *S) const; - virtual DeclTy *ParseDeclarator(Scope *S, Declarator &D, ExprTy *Init, - DeclTy *LastInGroup); + virtual DeclTy *ParseDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup); + void AddInitializerToDecl(DeclTy *dcl, ExprTy *init); virtual DeclTy *FinalizeDeclaratorGroup(Scope *S, DeclTy *Group); virtual DeclTy *ParseStartOfFunctionDef(Scope *S, Declarator &D); @@ -361,7 +361,7 @@ public: virtual void ObjcAddMethodsToClass(DeclTy *ClassDecl, DeclTy **allMethods, unsigned allNum); - virtual void ObjcAddInstanceVariable(DeclTy *ClassDec, DeclTy *Ivars, + virtual void ObjcAddInstanceVariable(DeclTy *ClassDec, DeclTy *Ivar, tok::ObjCKeywordKind visibility); private: // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts |