[cfe-commits] r172673 - /cfe/trunk/lib/Sema/SemaDeclAttr.cpp

Rafael Espindola rafael.espindola at gmail.com
Wed Jan 16 15:21:33 PST 2013


Author: rafael
Date: Wed Jan 16 17:21:32 2013
New Revision: 172673

URL: http://llvm.org/viewvc/llvm-project?rev=172673&view=rev
Log:
Simplify code. No functionality change.

Modified:
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=172673&r1=172672&r2=172673&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Wed Jan 16 17:21:32 2013
@@ -1370,25 +1370,6 @@
                                              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 @@
   // 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;
   }





More information about the cfe-commits mailing list