This is an archive of the discontinued LLVM Phabricator instance.

[libclang] add 'clang_getCursorTLSKind'
ClosedPublic

Authored by frutiger on Sep 7 2017, 11:11 AM.

Details

Reviewers
compnerd
hans
Summary

Introduce the 'TLS Kind' property of variable declarations through
libclang. Additionally, provide a Python accessor for it, and test that
functionality.

Diff Detail

Event Timeline

frutiger created this revision.Sep 7 2017, 11:11 AM
frutiger updated this revision to Diff 114256.Sep 7 2017, 2:30 PM

Exports 'TLSKind' in the 'all' array.

compnerd added inline comments.Sep 11 2017, 9:01 AM
bindings/python/tests/cindex/test_tls_kind.py
15

Can we add a test case for static TLS as well please? Also, I think that we should add a test case for __declspec(thread).

tools/libclang/CIndex.cpp
7426

This block is not properly formatted. Please clang-format your code.

frutiger added inline comments.Sep 11 2017, 10:19 AM
bindings/python/tests/cindex/test_tls_kind.py
15

I will add a test case for static TLS.

__declspec(thread) is not implemented as a TLS kind on a cursor; instead it is implemented as a child attribute of the cursor. Would you like me to add a test case for that here?

tools/libclang/CIndex.cpp
7426

I will fix this, thank you for the feedback.

frutiger added inline comments.Sep 11 2017, 10:31 AM
bindings/python/tests/cindex/test_tls_kind.py
15

Please ignore the above comment regarding __declspec(thread), it does indeed add a static TLS kind to the cursor.

frutiger updated this revision to Diff 114640.Sep 11 2017, 11:23 AM

Add test cases for __declspec(thread) and static TLS. Clean up formatting to adhere to the project style.

compnerd accepted this revision.Sep 11 2017, 1:52 PM
compnerd added inline comments.
bindings/python/tests/cindex/test_tls_kind.py
33

Would be nicer to use x86_64-unknown-windows-msvc as the target.

This revision is now accepted and ready to land.Sep 11 2017, 1:52 PM
frutiger updated this revision to Diff 114701.Sep 11 2017, 2:28 PM

Use more specific target platform.

frutiger marked 6 inline comments as done.Sep 11 2017, 2:29 PM
nik added a subscriber: nik.Sep 12 2017, 12:05 AM
nik added inline comments.
include/clang-c/Index.h
2840

I was wondering what "TLS" is and had to look it up. If not adapting the function and enum name, then maybe at least write it out once in the documentation.

frutiger updated this revision to Diff 114818.Sep 12 2017, 6:22 AM

Expand the acronym 'TLS' to 'thread-local storage' in documentation.

frutiger marked an inline comment as done.Sep 12 2017, 6:22 AM

Do you have commit rights or would you like me to commit this on your behalf?

I do not have commit rights - please commit this yourself, thanks!

compnerd closed this revision.Sep 12 2017, 8:36 PM

SVN r313111