Fix a crash when emitting DIEs for variable-length arrays

VLAs may refer to a previous DIE to express the DW_AT_count of their
type. Clang generates an artificial "vla_expr" variable for this. If
this DIE hasn't been created yet LLVM asserts. This patch fixes this
by sorting the local variables so that dependencies come before they
are needed. It also replaces the linear scan in DWARFFile with a
std::map, which can be faster.

Differential Revision: https://reviews.llvm.org/D42940

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324412 91177308-0d34-0410-b5e6-96231b3b80d8
4 files changed