aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-01-16 23:49:06 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-01-16 23:49:06 +0000
commit4d8a33b4cea46948f86afccf0ad3675aff924148 (patch)
treefbfbe1eb5cc63b692482448dac42c66ce2a9018a /lib/Sema/SemaDeclAttr.cpp
parentafb7ce3f877594362381926eaeac8ed6bbe18069 (diff)
Delay linkage checks when validating the weakref attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--lib/Sema/SemaDeclAttr.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 5f9516f70e..acd075ee7f 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -1420,11 +1420,6 @@ static void handleWeakRefAttr(Sema &S, Decl *D, const AttributeList &Attr) {
// This looks like a bug in gcc. We reject that for now. We should revisit
// it if this behaviour is actually used.
- if (nd->getLinkage() == ExternalLinkage) {
- S.Diag(Attr.getLoc(), diag::err_attribute_weakref_not_static);
- return;
- }
-
// GCC rejects
// static ((alias ("y"), weakref)).
// Should we? How to check that weakref is before or after alias?
@@ -4583,7 +4578,8 @@ void Sema::ProcessDeclAttributeList(Scope *S, Decl *D,
// but that looks really pointless. We reject it.
if (Inheritable && D->hasAttr<WeakRefAttr>() && !D->hasAttr<AliasAttr>()) {
Diag(AttrList->getLoc(), diag::err_attribute_weakref_without_alias) <<
- dyn_cast<NamedDecl>(D)->getNameAsString();
+ cast<NamedDecl>(D)->getNameAsString();
+ D->dropAttr<WeakRefAttr>();
return;
}
}