r181163 - Use lexical contexts when checking for conflicting language linkages.
Rafael Espindola
rafael.espindola at gmail.com
Sun May 5 11:24:05 PDT 2013
Author: rafael
Date: Sun May 5 13:24:05 2013
New Revision: 181163
URL: http://llvm.org/viewvc/llvm-project?rev=181163&view=rev
Log:
Use lexical contexts when checking for conflicting language linkages.
This fixes pr14958. I will audit other calls to isExternCContext to see
if there are any similar bugs left.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/linkage-spec.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=181163&r1=181162&r2=181163&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sun May 5 13:24:05 2013
@@ -2247,10 +2247,10 @@ static bool haveIncompatibleLanguageLink
LanguageLinkage OldLinkage = Old->getLanguageLinkage();
if (OldLinkage == CXXLanguageLinkage &&
- New->getDeclContext()->isExternCContext())
+ New->getLexicalDeclContext()->isExternCContext())
return true;
if (OldLinkage == CLanguageLinkage &&
- New->getDeclContext()->isExternCXXContext())
+ New->getLexicalDeclContext()->isExternCXXContext())
return true;
return false;
}
Modified: cfe/trunk/test/SemaCXX/linkage-spec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/linkage-spec.cpp?rev=181163&r1=181162&r2=181163&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/linkage-spec.cpp (original)
+++ cfe/trunk/test/SemaCXX/linkage-spec.cpp Sun May 5 13:24:05 2013
@@ -106,3 +106,11 @@ namespace PR9162 {
return sizeof(ArtsSink);
}
}
+
+namespace pr14958 {
+ namespace js { extern int ObjectClass; }
+ extern "C" {
+ namespace js {}
+ }
+ int js::ObjectClass;
+}
More information about the cfe-commits
mailing list