Пример #1
0
void StrucType()
{
  /*
    StrucType -> ArrayType | RecType | PointerType | ProcType
  */

  if ( debugMode) printf( "In StrucType\n");
  switch( sym) 
  {
    case ARRAY_SYM:
      ArrayType();
      break;
    case RECORD_SYM:
      RecType();
      break;
    case POINTER_SYM:
      PointerType();
      break;
    case PROCEDURE_SYM:
      ProcType();
      break;
    default:
      error( invalid_sym, 1);
  }

  if ( debugMode) printf( "Out StrucType\n");
}
Пример #2
0
	PointerType::PointerType(const NodePtr& node) {

		// check given node type
		assert_true(node) << "Invalid input node!";
		assert_true(isPointer(node)) << "Given node " << *node << " is not a pointer type!";

		// get the type
		NodePtr trg = node;
		if (auto expr = node.isa<ExpressionPtr>()) trg = expr->getType();

		// process node type
		auto tupleType = trg.as<TupleTypePtr>();
		*this = PointerType(
				extractReferencedType(tupleType),
				isTrueMarker(extractConstMarker(tupleType)),
				isTrueMarker(extractVolatileMarker(tupleType))
		);
	}
Пример #3
0
	TypePtr PointerType::create(const TypePtr& elementType, bool _const, bool _volatile) {
		assert_true(elementType);
		return PointerType(elementType, _const, _volatile).operator TypePtr();
	}