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/Driver/PrintParserCallbacks.cpp | |
| parent | 100410af133f319cfcea9bffb1f341d9b362aa44 (diff) | |
| download | bcm5719-llvm-6109140b00acb6b245c7aa545da4d13a058e33d4.tar.gz bcm5719-llvm-6109140b00acb6b245c7aa545da4d13a058e33d4.zip | |
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/Driver/PrintParserCallbacks.cpp')
| -rw-r--r-- | clang/Driver/PrintParserCallbacks.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/Driver/PrintParserCallbacks.cpp b/clang/Driver/PrintParserCallbacks.cpp index 3730d19a7d0..3e37514bb28 100644 --- a/clang/Driver/PrintParserCallbacks.cpp +++ b/clang/Driver/PrintParserCallbacks.cpp @@ -25,7 +25,7 @@ namespace { /// ParseDeclarator - This callback is invoked when a declarator is parsed /// and 'Init' specifies the initializer if any. This is for things like: /// "int X = 4" or "typedef int foo". - virtual DeclTy *ParseDeclarator(Scope *S, Declarator &D, ExprTy *Init, + virtual DeclTy *ParseDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup) { std::cout << "ParseDeclarator "; if (IdentifierInfo *II = D.getIdentifier()) { @@ -36,7 +36,7 @@ namespace { std::cout << "\n"; // Pass up to EmptyActions so that the symbol table is maintained right. - return MinimalAction::ParseDeclarator(S, D, Init, LastInGroup); + return MinimalAction::ParseDeclarator(S, D, LastInGroup); } /// PopScope - This callback is called immediately before the specified scope |

