]> granicus.if.org Git - clang/commitdiff
Move definition of template <typename T> void Decl::dropAttr
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 23 Jun 2011 20:24:38 +0000 (20:24 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 23 Jun 2011 20:24:38 +0000 (20:24 +0000)
to its header to avoid an explicit instantiation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133753 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclBase.h
lib/AST/DeclBase.cpp

index d39ad72bd79ab06841b7d389d9d5f2498c09c9d7..8b2ef2a81acb967a194164f22b5daeacac237518 100644 (file)
@@ -383,8 +383,22 @@ public:
   }
   
   template <typename T>
-  void dropAttr();
-  
+  void dropAttr() {
+    if (!HasAttrs) return;
+    
+    AttrVec &Attrs = getAttrs();
+    for (unsigned i = 0, e = Attrs.size(); i != e; /* in loop */) {
+      if (isa<T>(Attrs[i])) {
+        Attrs.erase(Attrs.begin() + i);
+        --e;
+      }
+      else
+        ++i;
+    }
+    if (Attrs.empty())
+      HasAttrs = false;
+  }
+    
   template <typename T>
   specific_attr_iterator<T> specific_attr_begin() const {
     return specific_attr_iterator<T>(attr_begin());
index 575b82d9afc5d2afcd4e75d3d997665547bc5737..1766d39c1405f0ecace7b4548f366ea91e7b2989 100644 (file)
@@ -571,24 +571,6 @@ Decl *Decl::castFromDeclContext (const DeclContext *D) {
   }
 }
 
-template <typename T>
-void Decl::dropAttr() {
-  if (!HasAttrs) return;
-  AttrVec &Attrs = getASTContext().getDeclAttrs(this);
-  for (unsigned i = 0, e = Attrs.size(); i != e; /* in loop */) {
-    if (isa<T>(Attrs[i])) {
-      Attrs.erase(Attrs.begin() + i);
-      --e;
-    }
-    else
-      ++i;
-  }
-  if (Attrs.empty())
-    HasAttrs = false;
-}
-// Force instantiation for WeakImportAttr which gets used.
-template void Decl::dropAttr<WeakImportAttr>();
-
 DeclContext *Decl::castToDeclContext(const Decl *D) {
   Decl::Kind DK = D->getKind();
   switch(DK) {