d: Set up input_location before lowering Dsymbol AST
authorIain Buclaw <ibuclaw@gdcproject.org>
Tue, 2 Jun 2020 09:21:22 +0000 (11:21 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Tue, 2 Jun 2020 10:53:52 +0000 (12:53 +0200)
commit7edc15f29233bca0bc12530b1a3083325c49e0f6
treeca2c7144f5e6ddfba46d4a24688b167f5764c3f6
parent54a0eb7fa5f504bf26be03060b779f756d998be5
d: Set up input_location before lowering Dsymbol AST

Like a similarly named function in the visitor class for statements,
this ensures that the current input_location is set to the correct
source file location of the decl.

It is likely that there are a number of cases where declarations have
ended up with no location without this.

gcc/d/ChangeLog:

* decl.cc (DeclVisitor::build_dsymbol): New function.
(DeclVisitor::visit (TupleDeclaration *)): Use build_dsymbol to
traverse AST instead of accept.
(DeclVisitor::visit (AttribDeclaration *)): Likewise.
(DeclVisitor::visit (Nspace *)): Likewise.
(DeclVisitor::visit (TemplateDeclaration *)): Likewise.
(DeclVisitor::visit (TemplateInstance *)): Likewise.
(DeclVisitor::visit (TemplateMixin *)): Likewise.
(DeclVisitor::visit (StructDeclaration *)): Likewise.
(DeclVisitor::visit (ClassDeclaration *)): Likewise.
(DeclVisitor::visit (InterfaceDeclaration *)): Likewise.
(DeclVisitor::visit (VarDeclaration *)): Likewise.
(build_decl_tree): Likewise.
gcc/d/decl.cc