[cfe-commits] r108195 - in /cfe/trunk: include/clang/AST/DeclBase.h lib/AST/DeclBase.cpp lib/Sema/SemaTemplateInstantiateDecl.cpp lib/Sema/TreeTransform.h
Fariborz Jahanian
fjahanian at apple.com
Mon Jul 12 17:18:12 PDT 2010
On Jul 12, 2010, at 4:46 PM, Douglas Gregor wrote:
>>
>> Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=108195&r1=108194&r2=108195&view=diff
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Mon Jul 12
>> 16:12:19 2010
>> @@ -2591,7 +2591,10 @@
>> ParentDC->isFunctionOrMethod()) {
>> // D is a local of some kind. Look into the map of local
>> // declarations to their instantiations.
>> - return cast<NamedDecl>(CurrentInstantiationScope-
>> >getInstantiationOf(D));
>> + NamedDecl *ND =
>> + cast<NamedDecl>(CurrentInstantiationScope-
>> >getInstantiationOf(D));
>> + ND->copyAttrs(D);
>> + return ND;
>> }
>
> This occurs at the point where we try to find the instantiated
> variable given the variable in the template, and is too late to copy
> the attributes. It looks like we're missing an InstantiateAttrs call
> inside TemplateDeclInstantiator::VisitVarDecl that would instantiate
> attributes when the instantiated VarDecl is initially built.
Nifty. Much simpler that I thought. Fixed in r108218.
- Thanks, Fariborz
>
>
> - Doug
More information about the cfe-commits
mailing list