// Interrogates an SgType to build up a TypeDescription
TypeDescription buildTypeDescription(SgType * const type, SgExpression * const kind)
{
   ROSE_ASSERT( type != NULL );

  //SgExpression * kind = type->get_type_kind();
  TypeDescription::intrinsic_e fortranType = TypeDescription::eNOTINTRINSIC;
  // TODO: is this complete?
  if( isSgTypeChar(type)         != NULL ||
      isSgTypeUnsignedChar(type) != NULL ){
    fortranType = TypeDescription::eCHARACTER;
  } else if( isSgTypeBool(type) != NULL ){
    // need to check for bool before int
    // as SgBoolType.isIntegerType() == true
    fortranType = TypeDescription::eLOGICAL;
  } else if( type->isFloatType() ){
    fortranType = TypeDescription::eREAL;
  } else if( type->isIntegerType() ){
    fortranType = TypeDescription::eINTEGER;
  } else if( isSgTypeComplex(type) != NULL ){
    fortranType = TypeDescription::eCOMPLEX;
  }
  return TypeDescription(type, fortranType, kind);
}
Ejemplo n.º 2
0
bool Type::isUnsignedChar() const {
	return isSgTypeUnsignedChar( t_ ) != 0;
}