diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-01-09 18:51:29 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-01-09 18:51:29 +0000 |
commit | c72e645fd6da47a5df13fcdc4d053d4e3a213377 (patch) | |
tree | 93b5824440819305843566b154d42b11d0f2418e /clang/lib/Sema/SemaDecl.cpp | |
parent | 5f54d50917d078ed09f5e8758c9c1d7e3fc05b76 (diff) | |
download | bcm5719-llvm-c72e645fd6da47a5df13fcdc4d053d4e3a213377.tar.gz bcm5719-llvm-c72e645fd6da47a5df13fcdc4d053d4e3a213377.zip |
Make sure that ScopedDecls passed to DeclContext::addDecl are added into their lexical context
llvm-svn: 61998
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index d9436ebdc7f..ecf6de9d96f 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -441,7 +441,13 @@ ScopedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid, // TUScope is the translation-unit scope to insert this function into. + // FIXME: This is hideous. We need to teach PushOnScopeChains to + // relate Scopes to DeclContexts, and probably eliminate CurContext + // entirely, but we're not there yet. + DeclContext *SavedContext = CurContext; + CurContext = Context.getTranslationUnitDecl(); PushOnScopeChains(New, TUScope); + CurContext = SavedContext; return New; } @@ -2705,6 +2711,8 @@ Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclTy *D) { // Introduce our parameters into the function scope for (unsigned p = 0, NumParams = FD->getNumParams(); p < NumParams; ++p) { ParmVarDecl *Param = FD->getParamDecl(p); + Param->setOwningFunction(FD); + // If this has an identifier, add it to the scope stack. if (Param->getIdentifier()) PushOnScopeChains(Param, FnBodyScope); |