r317986 - [python] [tests] Fix test_linkage for unique external linkage

Michal Gorny via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 11 12:01:42 PST 2017

Author: mgorny
Date: Sat Nov 11 12:01:41 2017
New Revision: 317986

URL: http://llvm.org/viewvc/llvm-project?rev=317986&view=rev
[python] [tests] Fix test_linkage for unique external linkage

Starting with r314037, anonymous namespaces no longer give
unique-external linkage to variables. However, this linkage can still be
achieved by using a type which is not exterally visible,
e.g. through being declared in an anonymous namespace but used outside
it. Fix the test to take advantage of that.

Differential Revision: https://reviews.llvm.org/D39810


Modified: cfe/trunk/bindings/python/tests/cindex/test_linkage.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/cindex/test_linkage.py?rev=317986&r1=317985&r2=317986&view=diff
--- cfe/trunk/bindings/python/tests/cindex/test_linkage.py (original)
+++ cfe/trunk/bindings/python/tests/cindex/test_linkage.py Sat Nov 11 12:01:41 2017
@@ -15,7 +15,8 @@ class TestLinkage(unittest.TestCase):
         tu = get_tu("""
 void foo() { int no_linkage; }
 static int internal;
-namespace { extern int unique_external; }
+namespace { struct unique_external_type {} }
+unique_external_type unique_external;
 extern int external;
 """, lang = 'cpp')

More information about the cfe-commits mailing list