This allows users to query the target triple and target pointer width, which
would make me able to fix https://github.com/servo/rust-bindgen/issues/593 and
other related bugs in an elegant way (without having to manually parse the
target triple in the command line arguments).
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
I'd appreciate if anyone could point me to an appropriate reviewer for this.
Thanks in advance! :)
Maybe it would be better to introduce a CXTargetInfo type, and change the API to be:
clang_getTranslationUnitTargetInfo clang_TargetInfo_getTriple clang_TargetInfo_getPointerWidth
?
This way the TargetInfo functions will be cleanly separated, so we can extend the API easier in the future.
Updated per comments, I used clang_TargetInfo_dispose following recent APIs instead of clang_disposeTargetInfo, let me know if I should change that.
Also, didn't add a new header for CXTargetInfo, since it's rather small, but can definitely do if needed.
It looks good, I have a couple of comments:
clang/include/clang-c/Index.h | ||
---|---|---|
1573 | Please capitalize Info here and in the other parameter lists. | |
1584 | You could mention that the function returns the width in bits. | |
clang/test/Index/target-info.c | ||
5 | NIT: Please put both RUN lines at the top of the file. | |
clang/tools/libclang/CIndex.cpp | ||
4035 | Please add a message to the assert (e.g. && "message"). | |
4048 | Please add an assertion message here as well. |
Please capitalize Info here and in the other parameter lists.