From: Rafael Espindola Date: Wed, 16 Jan 2013 23:21:32 +0000 (+0000) Subject: Simplify code. No functionality change. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2df0df8de44845a441f07a37db5bfcadd0215019;p=clang Simplify code. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172673 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index efeafa697f..5f9516f70e 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -1370,25 +1370,6 @@ static void handleOwnershipAttr(Sema &S, Decl *D, const AttributeList &AL) { start, size)); } -/// Whether this declaration has internal linkage for the purposes of -/// things that want to complain about things not have internal linkage. -static bool hasEffectivelyInternalLinkage(NamedDecl *D) { - switch (D->getLinkage()) { - case NoLinkage: - case InternalLinkage: - return true; - - // Template instantiations that go from external to unique-external - // shouldn't get diagnosed. - case UniqueExternalLinkage: - return true; - - case ExternalLinkage: - return false; - } - llvm_unreachable("unknown linkage kind!"); -} - static void handleWeakRefAttr(Sema &S, Decl *D, const AttributeList &Attr) { // Check the attribute arguments. if (Attr.getNumArgs() > 1) { @@ -1439,7 +1420,7 @@ 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 (!hasEffectivelyInternalLinkage(nd)) { + if (nd->getLinkage() == ExternalLinkage) { S.Diag(Attr.getLoc(), diag::err_attribute_weakref_not_static); return; }