summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasud Rahman <llvm@masudrahman.com>2017-11-08 19:17:27 +0000
committerMasud Rahman <llvm@masudrahman.com>2017-11-08 19:17:27 +0000
commit299a2452998f3ff3c6587d0c5b1c11e8f717d52d (patch)
tree6d98e450883e64d9ac79165b2c55cc10c06f3d3d
parenta9a85a6f7686a079146debf56cec182ed6c884f7 (diff)
[bindings] fix TLS test failure
Since cfe commit r237337, '__declspec(thread)' and 'thread_local' have been the same since MSVC 2015. i.e. they are both considered to supply a dynamic TLS kind, not a static TLS kind. This test originally did not specify which version of MS compatibility to assume. As a result, the test was brittle, since changing the default compatibility version could break the test. This commit adds a specific version when building up the flags used to parse the translation unit, and tests both versions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317706 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--bindings/python/tests/cindex/test_tls_kind.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/bindings/python/tests/cindex/test_tls_kind.py b/bindings/python/tests/cindex/test_tls_kind.py
index 6a03c0d5ee..d0ee4587bc 100644
--- a/bindings/python/tests/cindex/test_tls_kind.py
+++ b/bindings/python/tests/cindex/test_tls_kind.py
@@ -27,11 +27,21 @@ _Thread_local int tls_static;
# The following case tests '__declspec(thread)'. Since it is a Microsoft
# specific extension, specific flags are required for the parser to pick
# these up.
- flags = ['-fms-extensions', '-target', 'x86_64-unknown-windows-win32']
+ flags = ['-fms-extensions', '-target', 'x86_64-unknown-windows-win32',
+ '-fms-compatibility-version=18']
tu = get_tu("""
-__declspec(thread) int tls_declspec;
+__declspec(thread) int tls_declspec_msvc18;
""", lang = 'cpp', flags=flags)
- tls_declspec = get_cursor(tu.cursor, 'tls_declspec')
- assert tls_declspec.tls_kind == TLSKind.STATIC
+ tls_declspec_msvc18 = get_cursor(tu.cursor, 'tls_declspec_msvc18')
+ assert tls_declspec_msvc18.tls_kind == TLSKind.STATIC
+
+ flags = ['-fms-extensions', '-target', 'x86_64-unknown-windows-win32',
+ '-fms-compatibility-version=19']
+ tu = get_tu("""
+__declspec(thread) int tls_declspec_msvc19;
+""", lang = 'cpp', flags=flags)
+
+ tls_declspec_msvc19 = get_cursor(tu.cursor, 'tls_declspec_msvc19')
+ assert tls_declspec_msvc19.tls_kind == TLSKind.DYNAMIC