clang/bindings tests for builds constrained to certain targets

Hi all, I have a question regarding the python unittests in the clang/bindings directory.

I’m running into an issue where my LLVM check-all is failing in the ‘’ unittest file. The toolchain I’ve built is one whose default (and only available) target is one which has TLSSupported set to false in the clang/lib/Basic/Targets/*.(h|cpp) file.

The test unconditionally attempts to use the TLS language features and fails due to the above configuration being false.

I’ve found no uses of skips in this test suite other than skipping when ‘os.fspath’ isn’t available, or when the test is run on Windows. I was hoping for a ‘skip if feature not enabled’.

The only other method I’ve found is just to not run all of these tests at all. I can do this through a special case in the clang/bindings/python/tests CMakeLists, but I’d rather not do so unless there’s no better way.

Any ideas?


J.B. Nagurne

Code Generation

Texas Instruments

I wanted to check in with a solution I came up with that seems novel with regards to the rest of the python bindings tests.

I noticed that ‘tls’ is a valid feature in include/clang/Basic/Features.def, and maps to the target’s isTLSSupported() value.

So I modified the test source to utilize that fact:

int tls_none;

thread_local int tls_dynamic;

_Thread_local int tls_static;

#if __has_feature(tls)

int tls_supported;


I then test for the presence of a ‘tls_supported’ cursor and change the checks from DYNAMIC and STATIC to NONE.

It works well, but I believe this isn’t in the spirit of the test as-written. I could also have added default flags to change the target to one known to support TLS to ensure both thread_local and _Thread_local work.