From 714447b2ed8217cb546efafca0c4b06f3feb9df0 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Tue, 13 Jul 2010 21:05:02 +0000 Subject: [PATCH] Set DeclContext of ParamVarDecl only. No need to set that of VarDecl for block variables (they are already set). Per Doug's comment. llvm-svn: 108273 --- clang/lib/Sema/SemaTemplateInstantiate.cpp | 3 +-- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 539b4c409fdb..0cdc8a12ab73 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -1068,8 +1068,7 @@ ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm, CurrentInstantiationScope->InstantiatedLocal(OldParm, NewParm); // Set DeclContext if inside a Block. - if (BlockScopeInfo *CurBlock = getCurBlock()) - NewParm->setDeclContext(CurBlock->TheDecl); + NewParm->setDeclContext(CurContext); return NewParm; } diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index b80e824bfd67..2fd35285324e 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -400,9 +400,6 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) { SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Var); } InstantiateAttrs(D, Var); - // Set DeclContext if inside a Block. - if (BlockScopeInfo *CurBlock = SemaRef.getCurBlock()) - D->setDeclContext(CurBlock->TheDecl); // Link instantiations of static data members back to the template from // which they were instantiated.