[cfe-commits] r104121 - in /cfe/trunk: lib/Sema/SemaTemplateInstantiate.cpp lib/Sema/SemaTemplateInstantiateDecl.cpp test/SemaTemplate/attributes.cpp

Douglas Gregor dgregor at apple.com
Wed May 19 10:02:24 PDT 2010


Author: dgregor
Date: Wed May 19 12:02:24 2010
New Revision: 104121

URL: http://llvm.org/viewvc/llvm-project?rev=104121&view=rev
Log:
Revert r104106; it's breaking linking of Boost.Serialization.

Modified:
    cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
    cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
    cfe/trunk/test/SemaTemplate/attributes.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=104121&r1=104120&r2=104121&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Wed May 19 12:02:24 2010
@@ -1036,9 +1036,7 @@
                                         OldParm->getStorageClassAsWritten());
   if (!NewParm)
     return 0;
-                  
-  // FIXME: Instantiate attributes
-  
+                                                
   // Mark the (new) default argument as uninstantiated (if any).
   if (OldParm->hasUninstantiatedDefaultArg()) {
     Expr *Arg = OldParm->getUninstantiatedDefaultArg();

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=104121&r1=104120&r2=104121&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Wed May 19 12:02:24 2010
@@ -31,7 +31,7 @@
     DeclContext *Owner;
     const MultiLevelTemplateArgumentList &TemplateArgs;
 
-    bool InstantiateAttrs(Decl *Tmpl, Decl *New);
+    void InstantiateAttrs(Decl *Tmpl, Decl *New);
       
   public:
     typedef Sema::OwningExprResult OwningExprResult;
@@ -143,7 +143,7 @@
 }
 
 // FIXME: Is this too simple?
-bool TemplateDeclInstantiator::InstantiateAttrs(Decl *Tmpl, Decl *New) {
+void TemplateDeclInstantiator::InstantiateAttrs(Decl *Tmpl, Decl *New) {
   for (const Attr *TmplAttr = Tmpl->getAttrs(); TmplAttr; 
        TmplAttr = TmplAttr->getNext()) {
     
@@ -152,8 +152,6 @@
     
     New->addAttr(NewAttr);
   }
-  
-  return false;
 }
 
 Decl *
@@ -179,9 +177,7 @@
                                  D->getQualifier(),
                                  D->getTargetNameLoc(),
                                  D->getNamespace());
-  InstantiateAttrs(D, Inst);  
   Owner->addDecl(Inst);
-
   return Inst;
 }
 
@@ -357,8 +353,7 @@
 
   Var->setAccess(D->getAccess());
   Var->setUsed(D->isUsed());
-  InstantiateAttrs(D, Var);  
-
+  
   // FIXME: In theory, we could have a previous declaration for variables that
   // are not static data members.
   bool Redeclaration = false;
@@ -536,8 +531,6 @@
   FriendDecl *FD =
     FriendDecl::Create(SemaRef.Context, Owner, D->getLocation(), 
                        cast<NamedDecl>(NewND), D->getFriendLoc());
-  InstantiateAttrs(D, FD);  
-
   FD->setAccess(AS_public);
   Owner->addDecl(FD);
   return FD;
@@ -571,7 +564,6 @@
   Enum->setInstantiationOfMemberEnum(D);
   Enum->setAccess(D->getAccess());
   if (SubstQualifier(D, Enum)) return 0;
-  InstantiateAttrs(D, Enum);
   Owner->addDecl(Enum);
   Enum->startDefinition();
 
@@ -771,8 +763,6 @@
                                 PrevClassTemplate);
   RecordInst->setDescribedClassTemplate(Inst);
 
-  InstantiateAttrs(D, Inst);
-
   if (isFriend) {
     if (PrevClassTemplate)
       Inst->setAccess(PrevClassTemplate->getAccess());
@@ -881,8 +871,6 @@
       !(isFriend && !D->getTemplatedDecl()->isThisDeclarationADefinition()))
     InstTemplate->setInstantiatedFromMemberTemplate(D);
   
-  InstantiateAttrs(D, InstTemplate);
-
   // Make declarations visible in the appropriate context.
   if (!isFriend)
     Owner->addDecl(InstTemplate);
@@ -907,8 +895,6 @@
                             D->getLocation(), D->getIdentifier(),
                             D->getTagKeywordLoc(), PrevDecl);
 
-  InstantiateAttrs(D, Record);
-
   // Substitute the nested name specifier, if any.
   if (SubstQualifier(D, Record))
     return 0;
@@ -1436,7 +1422,6 @@
                                  TTPT->getName(),
                                  D->wasDeclaredWithTypename(),
                                  D->isParameterPack());
-  InstantiateAttrs(D, Inst);
 
   if (D->hasDefaultArgument())
     Inst->setDefaultArgument(D->getDefaultArgumentInfo(), false);  
@@ -1480,7 +1465,6 @@
   if (Invalid)
     Param->setInvalidDecl();
   
-  InstantiateAttrs(D, Param);
   Param->setDefaultArgument(D->getDefaultArgument());
   
   // Introduce this template parameter's instantiation into the instantiation 
@@ -1510,8 +1494,7 @@
                                        D->getDepth() - 1, D->getPosition(),
                                        D->getIdentifier(), InstParams);
   Param->setDefaultArgument(D->getDefaultArgument());
-  InstantiateAttrs(D, Param);
-
+  
   // Introduce this template parameter's instantiation into the instantiation 
   // scope.
   SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Param);
@@ -1529,8 +1512,6 @@
                                  D->getIdentLocation(), 
                                  D->getNominatedNamespace(), 
                                  D->getCommonAncestor());
-  InstantiateAttrs(D, Inst);
-
   Owner->addDecl(Inst);
   return Inst;
 }
@@ -1554,7 +1535,6 @@
                                        D->getTargetNestedNameDecl(),
                                        D->getDeclName(),
                                        D->isTypeName());
-  InstantiateAttrs(D, NewUD);
 
   CXXScopeSpec SS;
   SS.setScopeRep(D->getTargetNestedNameDecl());
@@ -1635,10 +1615,8 @@
                                   D->getDeclName(), 0,
                                   /*instantiation*/ true,
                                   /*typename*/ true, D->getTypenameLoc());
-  if (UD) {
-    InstantiateAttrs(D, UD);
+  if (UD)
     SemaRef.Context.setInstantiatedFromUsingDecl(cast<UsingDecl>(UD), D);
-  }
 
   return UD;
 }
@@ -1662,10 +1640,8 @@
                                   D->getDeclName(), 0,
                                   /*instantiation*/ true,
                                   /*typename*/ false, SourceLocation());
-  if (UD) {
-    InstantiateAttrs(D, UD);
+  if (UD)
     SemaRef.Context.setInstantiatedFromUsingDecl(cast<UsingDecl>(UD), D);
-  }
 
   return UD;
 }
@@ -1844,9 +1820,8 @@
     return 0;
 
   InstPartialSpec->setInstantiatedFromMember(PartialSpec);
-  InstPartialSpec->setTypeAsWritten(WrittenTy);  
-  InstantiateAttrs(PartialSpec, InstPartialSpec);
-
+  InstPartialSpec->setTypeAsWritten(WrittenTy);
+  
   // Add this partial specialization to the set of class template partial
   // specializations.
   ClassTemplate->getPartialSpecializations().InsertNode(InstPartialSpec,
@@ -1911,9 +1886,6 @@
   if (Tmpl->isDeleted())
     New->setDeleted();
 
-  if (InstantiateAttrs(Tmpl, New))
-    return true;
-
   // If we are performing substituting explicitly-specified template arguments
   // or deduced template arguments into a function template and we reach this
   // point, we are now past the point where SFINAE applies and have committed

Modified: cfe/trunk/test/SemaTemplate/attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/attributes.cpp?rev=104121&r1=104120&r2=104121&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/attributes.cpp (original)
+++ cfe/trunk/test/SemaTemplate/attributes.cpp Wed May 19 12:02:24 2010
@@ -6,24 +6,3 @@
 
   int __attribute__((__address_space__(N))) *ptr; // expected-error{{attribute requires 1 argument(s)}}
 };
-
-namespace PR7102 {
-
-  class NotTpl {
-  public:
-    union {
-      char space[11];
-      void* ptr;
-    }  __attribute__((packed));
-  };
-  template<unsigned N>
-  class Tpl {
-  public:
-    union {
-      char space[N];
-      void* ptr;
-    }  __attribute__((packed));
-  };
-
-  int array[sizeof(NotTpl) == sizeof(Tpl<11>)? 1 : -1];
-}





More information about the cfe-commits mailing list