diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-06-03 15:26:25 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2020-06-16 23:31:24 +0200 |
commit | 89fdaf5ad853c3d55060b9929027946833aee77a (patch) | |
tree | bd31fe1405120ce155c606fb258d6944e6a6be6b /gcc/d/decl.cc | |
parent | 8fb4d1d58362b77da78c09740c6b5562124a369e (diff) | |
download | gcc-89fdaf5ad853c3d55060b9929027946833aee77a.zip gcc-89fdaf5ad853c3d55060b9929027946833aee77a.tar.gz gcc-89fdaf5ad853c3d55060b9929027946833aee77a.tar.bz2 |
d: Use new isTypeXxxx helpers where possible.
gcc/d/ChangeLog:
* d-builtins.cc (d_eval_constant_expression): Use isTypeXxxx helpers
instead of explicit casts.
(d_build_builtins_module): Likewise.
* d-codegen.cc (get_array_length): Likewise.
(identity_compare_p): Likewise.
(lower_struct_comparison): Likewise.
(build_array_from_val): Likewise.
(array_bounds_check): Likewise.
(get_function_type): Likewise.
(d_build_call): Likewise.
* d-compiler.cc (Compiler::paintAsType): Likewise.
* d-convert.cc (convert_expr): Likewise.
(convert_for_assignment): Likewise.
* d-lang.cc (d_classify_record): Likewise.
(d_build_eh_runtime_type): Likewise.
* decl.cc (DeclVisitor::visit): Likewise.
* expr.cc (ExprVisitor::needs_postblit): Likewise.
(ExprVisitor::needs_dtor): Likewise.
(ExprVisitor::visit): Likewise.
* imports.cc (ImportVisitor::visit): Likewise.
* typeinfo.cc (get_typeinfo_kind): Likewise.
(TypeInfoVisitor::visit): Likewise.
(TypeDeclInfoVisitor::visit): Likewise.
* types.cc (merge_aggregate_types): Likewise.
(TypeVisitor::visit): Likewise.
Diffstat (limited to 'gcc/d/decl.cc')
-rw-r--r-- | gcc/d/decl.cc | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc index 84aa42c..0586863 100644 --- a/gcc/d/decl.cc +++ b/gcc/d/decl.cc @@ -313,9 +313,9 @@ public: TemplateInstance *ti = NULL; if (tb->ty == Tstruct) - ti = ((TypeStruct *) tb)->sym->isInstantiated (); + ti = tb->isTypeStruct ()->sym->isInstantiated (); else if (tb->ty == Tclass) - ti = ((TypeClass *) tb)->sym->isInstantiated (); + ti = tb->isTypeClass ()->sym->isInstantiated (); /* Return type is instantiated from this template declaration, walk over all members of the instance. */ @@ -620,7 +620,7 @@ public: if (have_typeinfo_p (Type::dtypeinfo)) create_typeinfo (d->type, NULL); - TypeEnum *tc = (TypeEnum *) d->type; + TypeEnum *tc = d->type->isTypeEnum (); if (tc->sym->members && !d->type->isZeroInit ()) { /* Generate static initializer. */ @@ -717,11 +717,8 @@ public: } else { - if (d->type->ty == Tstruct) - { - StructDeclaration *sd = ((TypeStruct *) d->type)->sym; - DECL_INITIAL (decl) = layout_struct_initializer (sd); - } + if (TypeStruct *ts = d->type->isTypeStruct ()) + DECL_INITIAL (decl) = layout_struct_initializer (ts->sym); else { Expression *e = d->type->defaultInitLiteral (d->loc); @@ -813,9 +810,8 @@ public: return; /* Check if any errors occurred when running semantic. */ - if (d->type->ty == Tfunction) + if (TypeFunction *tf = d->type->isTypeFunction ()) { - TypeFunction *tf = (TypeFunction *) d->type; if (tf->next == NULL || tf->next->ty == Terror) return; } |