From 55a17c057c5293e517609a91438342737ef51545 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108273 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaTemplateInstantiate.cpp | 3 +-- lib/Sema/SemaTemplateInstantiateDecl.cpp | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 539b4c409f..0cdc8a12ab 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/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/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index b80e824bfd..2fd3528532 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/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. -- 2.40.0