/** * class: SgEnumType * term: enum_type(declaration) * arg declaration: the term representation of the declaration */ PrologCompTerm* RoseToTerm::getEnumTypeSpecific(SgType* mtype) { /*make sure we are actually dealing with a class type*/ SgEnumType* ctype = isSgEnumType(mtype); ROSE_ASSERT(ctype != NULL); /*add base type*/ string id = ctype->get_name().str(); if (id == "") { /* nameless enum declarations can occur in typedefs */ SgTypedefDeclaration *td; if (td = isSgTypedefDeclaration(ctype->get_declaration()->get_parent())) { id = td->get_mangled_name().str(); } } ROSE_ASSERT(id != "" && id != "''"); /*nested type -> nested term*/ return new PrologCompTerm("enum_type", /*1,*/ new PrologAtom(id)); }
/** * class SgEnumDeclaration * term: enum_declaration_annotation(name,decl_att) * arg name: name of the enum * arg decl_att: declaration attributes (see SgDeclarationStatement */ PrologCompTerm* RoseToTerm::getEnumDeclarationSpecific(SgEnumDeclaration* d) { ROSE_ASSERT(d != NULL); //get Enum name string ename = d->get_name().getString(); if (ename == "") { /* nameless enum declarations can occur in typedefs */ SgTypedefDeclaration *td; if (td = isSgTypedefDeclaration(d->get_parent())) { ename = td->get_mangled_name().str(); } } ROSE_ASSERT(ename != ""); PrologTerm *typet = getTypeSpecific(d->get_type()); typeWasDeclaredBefore(typet->getRepresentation()); //create term return new PrologCompTerm ("enum_declaration_annotation", //4, new PrologAtom(ename), getDeclarationAttributes(d), new PrologInt(d->get_embedded()), PPI(d)); }