r178768 - Use isExternalLinkage instead of hasExternalLinkage.
Rafael Espindola
rafael.espindola at gmail.com
Thu Apr 4 10:16:12 PDT 2013
Author: rafael
Date: Thu Apr 4 12:16:12 2013
New Revision: 178768
URL: http://llvm.org/viewvc/llvm-project?rev=178768&view=rev
Log:
Use isExternalLinkage instead of hasExternalLinkage.
Having these not be the same makes an easy to misuse API. We should audit the
uses and probably rename to something like
foo->hasExternalLinkage():
The c++ standard one. That is UniqueExternalLinkage or ExternalLinkage.
foo->hasUniqueExternalLinkage():
Is UniqueExternalLinkage.
foo->hasCogeGenExternalLinkage():
Is ExternalLinkage.
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=178768&r1=178767&r2=178768&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Apr 4 12:16:12 2013
@@ -2328,7 +2328,7 @@ bool Sema::MergeFunctionDecl(FunctionDec
// storage classes.
if (!isa<CXXMethodDecl>(New) && !isa<CXXMethodDecl>(Old) &&
New->getStorageClass() == SC_Static &&
- Old->hasExternalLinkage() &&
+ isExternalLinkage(Old->getLinkage()) &&
!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=178768&r1=178767&r2=178768&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/linkage2.cpp (original)
+++ cfe/trunk/test/SemaCXX/linkage2.cpp Thu Apr 4 12:16:12 2013
@@ -140,3 +140,10 @@ namespace test13 {
extern void a();
static void a(void) {}
}
+
+namespace test14 {
+ namespace {
+ void a(void); // expected-note {{previous declaration is here}}
+ static void a(void) {} // expected-error {{static declaration of 'a' follows non-static declaration}}
+ }
+}
More information about the cfe-commits
mailing list