/* Visitor interfaces, each Expression class should have
overridden the default. */
- void visit (Expression *)
+ void visit (Expression *) final override
{
gcc_unreachable ();
}
expression is void, then the resulting type is void. Otherwise
they are implicitly converted to a common type. */
- void visit (CondExp *e)
+ void visit (CondExp *e) final override
{
tree cond = convert_for_condition (build_expr (e->econd),
e->econd->type);
usual conversions to bring them to a common type before comparison.
The result type is bool. */
- void visit (IdentityExp *e)
+ void visit (IdentityExp *e) final override
{
tree_code code = (e->op == EXP::identity) ? EQ_EXPR : NE_EXPR;
Type *tb1 = e->e1->type->toBasetype ();
equality or inequality. Operands go through the usual conversions to bring
them to a common type before comparison. The result type is bool. */
- void visit (EqualExp *e)
+ void visit (EqualExp *e) final override
{
Type *tb1 = e->e1->type->toBasetype ();
Type *tb2 = e->e2->type->toBasetype ();
exists in an associative array. The result is a pointer to the
element, or null if false. */
- void visit (InExp *e)
+ void visit (InExp *e) final override
{
Type *tb2 = e->e2->type->toBasetype ();
Type *tkey = tb2->isTypeAArray ()->index->toBasetype ();
/* Build a relational expression. The result type is bool. */
- void visit (CmpExp *e)
+ void visit (CmpExp *e) final override
{
Type *tb1 = e->e1->type->toBasetype ();
Type *tb2 = e->e2->type->toBasetype ();
expression is void, then the resulting type is void. Otherwise the
result is bool. */
- void visit (LogicalExp *e)
+ void visit (LogicalExp *e) final override
{
tree_code code = (e->op == EXP::andAnd) ? TRUTH_ANDIF_EXPR : TRUTH_ORIF_EXPR;
/* Build a binary operand expression. Operands go through usual arithmetic
conversions to bring them to a common type before evaluating. */
- void visit (BinExp *e)
+ void visit (BinExp *e) final override
{
tree_code code;
same type, producing a dynamic array with the result. If one operand
is an element type, that element is converted to an array of length 1. */
- void visit (CatExp *e)
+ void visit (CatExp *e) final override
{
Type *tb1 = e->e1->type->toBasetype ();
Type *tb2 = e->e2->type->toBasetype ();
/* Build an assignment operator expression. The right operand is implicitly
converted to the type of the left operand, and assigned to it. */
- void visit (BinAssignExp *e)
+ void visit (BinAssignExp *e) final override
{
tree_code code;
Expression *e1b = e->e1;
/* Build a concat assignment expression. The right operand is appended
to the left operand. */
- void visit (CatAssignExp *e)
+ void visit (CatAssignExp *e) final override
{
Type *tb1 = e->e1->type->toBasetype ();
Type *tb2 = e->e2->type->toBasetype ();
/* Build an assignment expression. The right operand is implicitly
converted to the type of the left operand, and assigned to it. */
- void visit (AssignExp *e)
+ void visit (AssignExp *e) final override
{
/* First, handle special assignment semantics. */
/* Build a throw expression. */
- void visit (ThrowExp *e)
+ void visit (ThrowExp *e) final override
{
tree arg = build_expr_dtor (e->e1);
this->result_ = build_libcall (LIBCALL_THROW, Type::tvoid, 1, arg);
/* Build a postfix expression. */
- void visit (PostExp *e)
+ void visit (PostExp *e) final override
{
tree result;
/* Build an index expression. */
- void visit (IndexExp *e)
+ void visit (IndexExp *e) final override
{
Type *tb1 = e->e1->type->toBasetype ();
/* Build a comma expression. The type is the type of the right operand. */
- void visit (CommaExp *e)
+ void visit (CommaExp *e) final override
{
tree t1 = build_expr (e->e1);
tree t2 = build_expr (e->e2);
/* Build an array length expression. Returns the number of elements
in the array. The result is of type size_t. */
- void visit (ArrayLengthExp *e)
+ void visit (ArrayLengthExp *e) final override
{
if (e->e1->type->toBasetype ()->ty == TY::Tarray)
this->result_ = d_array_length (build_expr (e->e1));
/* Build a delegate pointer expression. This will return the frame
pointer value as a type void*. */
- void visit (DelegatePtrExp *e)
+ void visit (DelegatePtrExp *e) final override
{
tree t1 = build_expr (e->e1);
this->result_ = delegate_object (t1);
/* Build a delegate function pointer expression. This will return the
function pointer value as a function type. */
- void visit (DelegateFuncptrExp *e)
+ void visit (DelegateFuncptrExp *e) final override
{
tree t1 = build_expr (e->e1);
this->result_ = delegate_method (t1);
/* Build a slice expression. */
- void visit (SliceExp *e)
+ void visit (SliceExp *e) final override
{
Type *tb = e->type->toBasetype ();
Type *tb1 = e->e1->type->toBasetype ();
/* Build a cast expression, which converts the given unary expression to the
type of result. */
- void visit (CastExp *e)
+ void visit (CastExp *e) final override
{
Type *ebtype = e->e1->type->toBasetype ();
Type *tbtype = e->to->toBasetype ();
/* Build a delete expression. */
- void visit (DeleteExp *e)
+ void visit (DeleteExp *e) final override
{
tree t1 = build_expr (e->e1);
Type *tb1 = e->e1->type->toBasetype ();
/* Build a remove expression, which removes a particular key from an
associative array. */
- void visit (RemoveExp *e)
+ void visit (RemoveExp *e) final override
{
/* Check that the array is actually an associative array. */
if (e->e1->type->toBasetype ()->ty == TY::Taarray)
/* Build an unary not expression. */
- void visit (NotExp *e)
+ void visit (NotExp *e) final override
{
tree result = convert_for_condition (build_expr (e->e1), e->e1->type);
/* Need to convert to boolean type or this will fail. */
complemented. Note: unlike in C, the usual integral promotions
are not performed prior to the complement operation. */
- void visit (ComExp *e)
+ void visit (ComExp *e) final override
{
TY ty1 = e->e1->type->toBasetype ()->ty;
gcc_assert (ty1 != TY::Tarray && ty1 != TY::Tsarray);
/* Build an unary negation expression. */
- void visit (NegExp *e)
+ void visit (NegExp *e) final override
{
TY ty1 = e->e1->type->toBasetype ()->ty;
gcc_assert (ty1 != TY::Tarray && ty1 != TY::Tsarray);
/* Build a pointer index expression. */
- void visit (PtrExp *e)
+ void visit (PtrExp *e) final override
{
Type *tnext = NULL;
size_t offset;
/* Build an unary address expression. */
- void visit (AddrExp *e)
+ void visit (AddrExp *e) final override
{
tree type = build_ctype (e->type);
tree exp;
/* Build a function call expression. */
- void visit (CallExp *e)
+ void visit (CallExp *e) final override
{
Type *tb = e->e1->type->toBasetype ();
Expression *e1b = e->e1;
/* Build a delegate expression. */
- void visit (DelegateExp *e)
+ void visit (DelegateExp *e) final override
{
if (e->func->semanticRun == PASS::semantic3done)
{
/* Build a type component expression. */
- void visit (DotTypeExp *e)
+ void visit (DotTypeExp *e) final override
{
/* Just a pass through to underlying expression. */
this->result_ = build_expr (e->e1);
/* Build a component reference expression. */
- void visit (DotVarExp *e)
+ void visit (DotVarExp *e) final override
{
VarDeclaration *vd = e->var->isVarDeclaration ();
/* Build an assert expression, used to declare conditions that must hold at
that a given point in the program. */
- void visit (AssertExp *e)
+ void visit (AssertExp *e) final override
{
Type *tb1 = e->e1->type->toBasetype ();
tree arg = build_expr (e->e1);
/* Build a declaration expression. */
- void visit (DeclarationExp *e)
+ void visit (DeclarationExp *e) final override
{
/* Compile the declaration. */
push_stmt_list ();
/* Build a typeid expression. Returns an instance of class TypeInfo
corresponding to. */
- void visit (TypeidExp *e)
+ void visit (TypeidExp *e) final override
{
if (Type *tid = isType (e->obj))
{
/* Build a function/lambda expression. */
- void visit (FuncExp *e)
+ void visit (FuncExp *e) final override
{
Type *ftype = e->type->toBasetype ();
/* Build a halt expression. */
- void visit (HaltExp *)
+ void visit (HaltExp *) final override
{
/* Should we use trap() or abort()? */
tree ttrap = builtin_decl_explicit (BUILT_IN_TRAP);
/* Build a symbol pointer offset expression. */
- void visit (SymOffExp *e)
+ void visit (SymOffExp *e) final override
{
/* Build the address and offset of the symbol. */
size_t soffset = e->isSymOffExp ()->offset;
/* Build a variable expression. */
- void visit (VarExp *e)
+ void visit (VarExp *e) final override
{
if (e->var->needThis ())
{
/* Build a this variable expression. */
- void visit (ThisExp *e)
+ void visit (ThisExp *e) final override
{
FuncDeclaration *fd = d_function_chain ? d_function_chain->function : NULL;
tree result = NULL_TREE;
/* Build a new expression, which allocates memory either on the garbage
collected heap or by using a class or struct specific allocator. */
- void visit (NewExp *e)
+ void visit (NewExp *e) final override
{
Type *tb = e->type->toBasetype ();
tree result;
/* Build an integer literal. */
- void visit (IntegerExp *e)
+ void visit (IntegerExp *e) final override
{
tree ctype = build_ctype (e->type->toBasetype ());
this->result_ = build_integer_cst (e->value, ctype);
/* Build a floating-point literal. */
- void visit (RealExp *e)
+ void visit (RealExp *e) final override
{
this->result_ = build_float_cst (e->value, e->type->toBasetype ());
}
/* Build a complex literal. */
- void visit (ComplexExp *e)
+ void visit (ComplexExp *e) final override
{
Type *tnext;
/* Build a string literal, all strings are null terminated except for
static arrays. */
- void visit (StringExp *e)
+ void visit (StringExp *e) final override
{
Type *tb = e->type->toBasetype ();
tree type = build_ctype (e->type);
be the type of the array element, and all elements are implicitly
converted to that type. */
- void visit (ArrayLiteralExp *e)
+ void visit (ArrayLiteralExp *e) final override
{
Type *tb = e->type->toBasetype ();
taken to be the key type, and common type of all values the value type.
All keys and values are then implicitly converted as needed. */
- void visit (AssocArrayLiteralExp *e)
+ void visit (AssocArrayLiteralExp *e) final override
{
/* Want the mutable type for typeinfo reference. */
Type *tb = e->type->toBasetype ()->mutableOf ();
/* Build a struct literal. */
- void visit (StructLiteralExp *e)
+ void visit (StructLiteralExp *e) final override
{
/* Handle empty struct literals. */
if (e->elements == NULL || e->sd->fields.length == 0)
/* Build a null literal. */
- void visit (NullExp *e)
+ void visit (NullExp *e) final override
{
this->result_ = build_typeof_null_value (e->type);
}
/* Build a vector literal. */
- void visit (VectorExp *e)
+ void visit (VectorExp *e) final override
{
tree type = build_ctype (e->type);
/* Build a static array representation of a vector expression. */
- void visit (VectorArrayExp *e)
+ void visit (VectorArrayExp *e) final override
{
this->result_ = convert_expr (build_expr (e->e1, this->constp_, true),
e->e1->type, e->type);
/* Build a static class literal, return its reference. */
- void visit (ClassReferenceExp *e)
+ void visit (ClassReferenceExp *e) final override
{
/* The result of build_new_class_expr is a RECORD_TYPE, we want
the reference. */
/* Build an uninitialized value, generated from void initializers. */
- void visit (VoidInitExp *e)
+ void visit (VoidInitExp *e) final override
{
/* The front-end only generates these for the initializer of globals.
Represent `void' as zeroes, regardless of the type's default value. */
/* These expressions are mainly just a placeholders in the frontend.
We shouldn't see them here. */
- void visit (ScopeExp *e)
+ void visit (ScopeExp *e) final override
{
error_at (make_location_t (e->loc), "%qs is not an expression",
e->toChars ());
this->result_ = error_mark_node;
}
- void visit (TypeExp *e)
+ void visit (TypeExp *e) final override
{
error_at (make_location_t (e->loc), "type %qs is not an expression",
e->toChars ());
}
/* This should be overridden by each symbol class. */
- void visit (Dsymbol *)
+ void visit (Dsymbol *) final override
{
gcc_unreachable ();
}
/* Build the module decl for M, this is considered toplevel, regardless
of whether there are any parent packages in the module system. */
- void visit (Module *m)
+ void visit (Module *m) final override
{
Loc loc = (m->md != NULL) ? m->md->loc
: Loc (m->srcfile.toChars (), 1, 0);
/* Build an import of another module symbol. */
- void visit (Import *m)
+ void visit (Import *m) final override
{
tree module = build_import_decl (m->mod);
this->result_ = this->make_import (module);
/* Build an import for any kind of user defined type.
Use the TYPE_DECL associated with the type symbol. */
- void visit (EnumDeclaration *d)
+ void visit (EnumDeclaration *d) final override
{
tree type = build_ctype (d->type);
/* Not all kinds of D enums create a TYPE_DECL. */
this->result_ = this->make_import (TYPE_STUB_DECL (type));
}
- void visit (AggregateDeclaration *d)
+ void visit (AggregateDeclaration *d) final override
{
tree type = build_ctype (d->type);
this->result_ = this->make_import (TYPE_STUB_DECL (type));
}
- void visit (ClassDeclaration *d)
+ void visit (ClassDeclaration *d) final override
{
/* Want the RECORD_TYPE, not POINTER_TYPE. */
tree type = TREE_TYPE (build_ctype (d->type));
}
/* For now, ignore importing other kinds of dsymbols. */
- void visit (ScopeDsymbol *)
+ void visit (ScopeDsymbol *) final override
{
}
/* Alias symbols aren't imported, but their targets are. */
- void visit (AliasDeclaration *d)
+ void visit (AliasDeclaration *d) final override
{
Dsymbol *dsym = d->toAlias ();
}
/* Visit the underlying alias symbol of overloadable aliases. */
- void visit (OverDeclaration *d)
+ void visit (OverDeclaration *d) final override
{
if (d->aliassym != NULL)
d->aliassym->accept (this);
}
/* Function aliases are the same as alias symbols. */
- void visit (FuncAliasDeclaration *d)
+ void visit (FuncAliasDeclaration *d) final override
{
FuncDeclaration *fd = d->toAliasFunc ();
}
/* Skip over importing templates and tuples. */
- void visit (TemplateDeclaration *)
+ void visit (TemplateDeclaration *) final override
{
}
- void visit (TupleDeclaration *)
+ void visit (TupleDeclaration *) final override
{
}
/* Import any other kind of declaration. If the class does not implement
symbol generation routines, the compiler will throw an error. */
- void visit (Declaration *d)
+ void visit (Declaration *d) final override
{
this->result_ = this->make_import (get_symbol_decl (d));
}