Clang的'type_visibility'属性做什么,什么时候应该使用它? [英] What does Clang's 'type_visibility' attribute do, and when should one use it?

查看:155
本文介绍了Clang的'type_visibility'属性做什么,什么时候应该使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它在libc ++中用于许多模板类型,例如 tuple_element tuple 等。

It is used in libc++ on many template types such as tuple_element, tuple, etc.

据我所知,除了提交消息对其进行介绍,并对此单元测试在clang项目中。

As far as I can tell there is no public documentation of what it does other than the commit message introducing it and this unit test in the clang project.

推荐答案

此属性允许一种类型的ELF可见性,以及(可能)模糊的链接对象(vtable,typeinfos)要与该类型的函数和数据成员的可见性分开控制。

This attribute allows the ELF visibility of a type and (presumably) its vague linkage objects (vtable, typeinfos) to be controlled separately from the visibility of functions and data members of the type.

这允许将typeinfos和vtable(例如,模板化多态类型的显式实例化)集中放置在中央,而不必强制默认类型的私有静态数据成员的默认可见性-在使用共享库时,为没有人真正跨过库边界访问的东西导出符号会浪费运行时间和符号表空间。

This allows typeinfos and the vtable for, say, explicit instantiations of a templated polymorphic type to be located centrally without forcing default visibility on for the type's private static data members as well -- exporting symbols for things that nobody will ever actually access across a library boundary is wasteful of runtime and symbol table space when working with shared libraries.

这篇关于Clang的'type_visibility'属性做什么,什么时候应该使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆