本文整理汇总了C++中recorddecl::field_iterator::isAnonymousStructOrUnion方法的典型用法代码示例。如果您正苦于以下问题:C++ field_iterator::isAnonymousStructOrUnion方法的具体用法?C++ field_iterator::isAnonymousStructOrUnion怎么用?C++ field_iterator::isAnonymousStructOrUnion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类recorddecl::field_iterator
的用法示例。
在下文中一共展示了field_iterator::isAnonymousStructOrUnion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFields
bool GetFields( RecordDecl * rd, Obj * entries) {
//check the fields of this struct, if any one of them is not understandable, then this struct becomes 'opaque'
//that is, we insert the type, and link it to its llvm type, so it can be used in terra code
//but none of its fields are exposed (since we don't understand the layout)
bool opaque = false;
for(RecordDecl::field_iterator it = rd->field_begin(), end = rd->field_end(); it != end; ++it) {
if(it->isBitField() || it->isAnonymousStructOrUnion() || !it->getDeclName()) {
opaque = true;
continue;
}
DeclarationName declname = it->getDeclName();
std::string declstr = declname.getAsString();
QualType FT = it->getType();
Obj fobj;
if(!GetType(FT,&fobj)) {
opaque = true;
continue;
}
lua_newtable(L);
fobj.push();
lua_setfield(L,-2,"type");
lua_pushstring(L,declstr.c_str());
lua_setfield(L,-2,"field");
entries->addentry();
}
return !opaque;
}