DWARFASTParserClang: Move attribute parsing into a single function
authorPavel Labath <pavel@labath.sk>
Thu, 30 May 2019 09:39:36 +0000 (09:39 +0000)
committerPavel Labath <pavel@labath.sk>
Thu, 30 May 2019 09:39:36 +0000 (09:39 +0000)
commit7e4d62a8dd41f8e87a62887d89e34055dbb1a3e4
treef849fe4c06839595e43a854f1fad2ec6d77e50b7
parentfa147c97d6ba1a59fe885a193a40a274158f38da
DWARFASTParserClang: Move attribute parsing into a single function

Summary:
The ParseTypeFromDWARF function consists of a huge switch on the kind of
type being parsed. Each case in this switch starts with parsing the
attributes of the current DIE. A lot of these attributes are specific to
one kind of a type, but a lot of them are common too, leading to code
duplication.

This patch reduces the duplication (and the size of ParseTypeFromDWARF)
by moving the attribute parsing to a separate function. It creates a
struct (ParsedTypeAttributes), which contains a parsed form of all
attributes which are useful for parsing any kind of a type. The parsing
code for a specific type kind can then access the fields which are
relevant for that specific case.

Reviewers: JDevlieghere, clayborg, aprantl

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 362075
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp