[cfe-commits] r133721 - in /cfe/trunk: include/clang/AST/DeclBase.h lib/AST/DeclBase.cpp lib/Sema/SemaDecl.cpp
Fariborz Jahanian
fjahanian at apple.com
Thu Jun 23 09:18:44 PDT 2011
Author: fjahanian
Date: Thu Jun 23 11:18:44 2011
New Revision: 133721
URL: http://llvm.org/viewvc/llvm-project?rev=133721&view=rev
Log:
Remove weak_import attribute on new declaration.
// rdar://9538608
Modified:
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=133721&r1=133720&r2=133721&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Thu Jun 23 11:18:44 2011
@@ -363,6 +363,7 @@
const AttrVec &getAttrs() const;
void swapAttrs(Decl *D);
void dropAttrs();
+ void dropWeakImportAttr();
void addAttr(Attr *A) {
if (hasAttrs())
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=133721&r1=133720&r2=133721&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Thu Jun 23 11:18:44 2011
@@ -520,6 +520,20 @@
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);
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=133721&r1=133720&r2=133721&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Jun 23 11:18:44 2011
@@ -2046,9 +2046,7 @@
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.
More information about the cfe-commits
mailing list