本文整理汇总了C++中cxxrecorddecl::base_class_iterator::getAccessSpecifierAsWritten方法的典型用法代码示例。如果您正苦于以下问题:C++ base_class_iterator::getAccessSpecifierAsWritten方法的具体用法?C++ base_class_iterator::getAccessSpecifierAsWritten怎么用?C++ base_class_iterator::getAccessSpecifierAsWritten使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cxxrecorddecl::base_class_iterator
的用法示例。
在下文中一共展示了base_class_iterator::getAccessSpecifierAsWritten方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addSubNodes
void addSubNodes(CXXRecordDecl* RD) {
addSubNodes(cast<RecordDecl>(RD));
if (RD->isDefinition()) {
// FIXME: This breaks XML generation
//Doc.addAttribute("num_bases", RD->getNumBases());
for (CXXRecordDecl::base_class_iterator
base = RD->bases_begin(),
bend = RD->bases_end();
base != bend;
++base) {
Doc.addSubNode("Base");
Doc.addAttribute("id", base->getType());
AccessSpecifier as = base->getAccessSpecifierAsWritten();
const char* as_name = "";
switch(as) {
case AS_none: as_name = ""; break;
case AS_public: as_name = "public"; break;
case AS_protected: as_name = "protected"; break;
case AS_private: as_name = "private"; break;
}
Doc.addAttributeOptional("access", as_name);
Doc.addAttribute("is_virtual", base->isVirtual());
Doc.toParent();
}
}
}
示例2: VisitCXXRecordDecl
void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) {
// FIXME: add printing of pragma attributes if required.
if (!Policy.SuppressSpecifiers && D->isModulePrivate())
Out << "__module_private__ ";
Out << D->getKindName();
prettyPrintAttributes(D);
if (D->getIdentifier()) {
Out << ' ' << *D;
if (auto S = dyn_cast<ClassTemplatePartialSpecializationDecl>(D))
printTemplateArguments(S->getTemplateArgs(), S->getTemplateParameters());
else if (auto S = dyn_cast<ClassTemplateSpecializationDecl>(D))
printTemplateArguments(S->getTemplateArgs());
}
if (D->isCompleteDefinition()) {
// Print the base classes
if (D->getNumBases()) {
Out << " : ";
for (CXXRecordDecl::base_class_iterator Base = D->bases_begin(),
BaseEnd = D->bases_end(); Base != BaseEnd; ++Base) {
if (Base != D->bases_begin())
Out << ", ";
if (Base->isVirtual())
Out << "virtual ";
AccessSpecifier AS = Base->getAccessSpecifierAsWritten();
if (AS != AS_none) {
Print(AS);
Out << " ";
}
Out << Base->getType().getAsString(Policy);
if (Base->isPackExpansion())
Out << "...";
}
}
// Print the class definition
// FIXME: Doesn't print access specifiers, e.g., "public:"
if (Policy.TerseOutput) {
Out << " {}";
} else {
Out << " {\n";
VisitDeclContext(D);
Indent() << "}";
}
}
}