本文整理汇总了C++中SgInitializedName::get_typeptr方法的典型用法代码示例。如果您正苦于以下问题:C++ SgInitializedName::get_typeptr方法的具体用法?C++ SgInitializedName::get_typeptr怎么用?C++ SgInitializedName::get_typeptr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SgInitializedName
的用法示例。
在下文中一共展示了SgInitializedName::get_typeptr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isSgArrayType
/**
* class: SgVarRefExp
* term: var_ref_exp_annotation(tpe,name,static,scope)
* arg tpe: type
* arg name: name
* arg static: wether the declaration was static
* arg scope: scope name (either from a namespace, a class or "null")
*/
PrologCompTerm*
RoseToTerm::getVarRefExpSpecific(SgVarRefExp* vr) {
SgInitializedName* n = vr->get_symbol()->get_declaration();
/* type: in general, this can be taken "as is" from the ROSE AST. However,
* ROSE (up to 0.9.4a-8xxx at least) gets a detail wrong: a declaration
* like "int arr[]" as a function parameter declares a *pointer*, not an
* array. Thus we check whether the variable might be of this sort, and if
* yes, we must make a pointer type for it. */
PrologTerm* typeSpecific = NULL;
SgInitializedName* vardecl = vr->get_symbol()->get_declaration();
SgType* t = vr->get_type()->stripType(SgType::STRIP_MODIFIER_TYPE
| SgType::STRIP_REFERENCE_TYPE
| SgType::STRIP_TYPEDEF_TYPE);
if (isSgFunctionParameterList(vardecl->get_parent()) && isSgArrayType(t)) {
SgType* baseType = isSgArrayType(t)->get_base_type();
PrologTerm* baseTypeSpecific = getTypeSpecific(baseType);
typeSpecific = new PrologCompTerm("pointer_type", /*1,*/ baseTypeSpecific);
} else {
typeSpecific = getTypeSpecific(n->get_typeptr());
}
/* static? (relevant for unparsing if scope is a class)*/
PrologTerm *isStatic;
SgDeclarationStatement* vdec = n->get_declaration();
if (vdec != NULL) {
isStatic =
getEnum(vdec->get_declarationModifier().get_storageModifier().isStatic(),
re.static_flags);
} else {
isStatic = getEnum(0, re.static_flags);
}
PrologTerm* scope;
if (vdec != NULL) {
/* named scope or irrelevant?*/
if (SgNamespaceDefinitionStatement* scn =
isSgNamespaceDefinitionStatement(vdec->get_parent())) {
scope = getNamespaceScopeName(scn);
} else if (SgClassDefinition* scn =
isSgClassDefinition(vdec->get_parent())) {
scope = getClassScopeName(scn);
} else {
scope = new PrologAtom("null");
}
} else {
scope = new PrologAtom("null");
}
return new PrologCompTerm
("var_ref_exp_annotation", //5,
typeSpecific,
/* name*/ new PrologAtom(n->get_name().getString()),
isStatic,
scope,
PPI(vr));
}