r178766 - Fix a recent linkage regression.

Rafael Espindola rafael.espindola at gmail.com
Thu Apr 4 09:43:41 PDT 2013


Author: rafael
Date: Thu Apr  4 11:43:41 2013
New Revision: 178766

URL: http://llvm.org/viewvc/llvm-project?rev=178766&view=rev
Log:
Fix a recent linkage regression.

Now that we don't have a semantic storage class, use the linkage.

Thanks to Bruce Stephens for reporting this.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/SemaCXX/linkage2.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=178766&r1=178765&r2=178766&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Apr  4 11:43:41 2013
@@ -2328,7 +2328,7 @@ bool Sema::MergeFunctionDecl(FunctionDec
   // storage classes.
   if (!isa<CXXMethodDecl>(New) && !isa<CXXMethodDecl>(Old) &&
       New->getStorageClass() == SC_Static &&
-      Old->getStorageClass() != SC_Static &&
+      Old->hasExternalLinkage() &&
       !New->getTemplateSpecializationInfo() &&
       !canRedefineFunction(Old, getLangOpts())) {
     if (getLangOpts().MicrosoftExt) {

Modified: cfe/trunk/test/SemaCXX/linkage2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/linkage2.cpp?rev=178766&r1=178765&r2=178766&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/linkage2.cpp (original)
+++ cfe/trunk/test/SemaCXX/linkage2.cpp Thu Apr  4 11:43:41 2013
@@ -134,3 +134,9 @@ namespace test12 {
     extern const int n;
   }
 }
+
+namespace test13 {
+  static void a(void);
+  extern void a();
+  static void a(void) {}
+}





More information about the cfe-commits mailing list