[cfe-commits] r133753 - in /cfe/trunk: include/clang/AST/DeclBase.h lib/AST/DeclBase.cpp
Fariborz Jahanian
fjahanian at apple.com
Thu Jun 23 13:24:38 PDT 2011
Author: fjahanian
Date: Thu Jun 23 15:24:38 2011
New Revision: 133753
URL: http://llvm.org/viewvc/llvm-project?rev=133753&view=rev
Log:
Move definition of template <typename T> void Decl::dropAttr
to its header to avoid an explicit instantiation.
Modified:
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/lib/AST/DeclBase.cpp
Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=133753&r1=133752&r2=133753&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Thu Jun 23 15:24:38 2011
@@ -383,8 +383,22 @@
}
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());
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=133753&r1=133752&r2=133753&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Thu Jun 23 15:24:38 2011
@@ -571,24 +571,6 @@
}
}
-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) {
More information about the cfe-commits
mailing list