const AttrVec &getAttrs() const;
void swapAttrs(Decl *D);
void dropAttrs();
+ void dropWeakImportAttr();
void addAttr(Attr *A) {
if (hasAttrs())
getASTContext().eraseDeclAttrs(this);
}
+void Decl::dropWeakImportAttr() {
+ if (!HasAttrs) return;
+ AttrVec &Attrs = getASTContext().getDeclAttrs(this);
+ for (llvm::SmallVectorImpl<Attr*>::iterator A = Attrs.begin();
+ A != Attrs.end(); ++A) {
+ if (isa<WeakImportAttr>(*A)) {
+ Attrs.erase(A);
+ break;
+ }
+ }
+ if (Attrs.empty())
+ HasAttrs = false;
+}
+
const AttrVec &Decl::getAttrs() const {
assert(HasAttrs && "No attrs to get!");
return getASTContext().getDeclAttrs(this);
Diag(New->getLocation(), diag::warn_weak_import) << New->getDeclName();
Diag(Old->getLocation(), diag::note_previous_definition);
// Remove weak_import attribute on new declaration.
- // I am just dropping all attributes in curernt decl. We have
- // already issued a warning, so we are OK.
- New->dropAttrs();
+ New->dropWeakImportAttr();
}
// Merge the types.