summaryrefslogtreecommitdiff
path: root/lib/DebugInfo/DWARFCompileUnit.h
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-07-15 08:43:35 +0000
committerAlexey Samsonov <samsonov@google.com>2013-07-15 08:43:35 +0000
commit40d8c69c596e3aa5c2679014f07bb065ced2cb3b (patch)
tree7da2b696426f9f66cc819253ca38efac81492349 /lib/DebugInfo/DWARFCompileUnit.h
parent3c70fcf02b367f517e93c1bd4ce237966383ebf8 (diff)
downloadllvm-40d8c69c596e3aa5c2679014f07bb065ced2cb3b.tar.gz
llvm-40d8c69c596e3aa5c2679014f07bb065ced2cb3b.tar.bz2
llvm-40d8c69c596e3aa5c2679014f07bb065ced2cb3b.tar.xz
DebugInfo: Factor out parsing compile unit DIEs to a separate function. Improve code style and comments.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186315 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/DebugInfo/DWARFCompileUnit.h')
-rw-r--r--lib/DebugInfo/DWARFCompileUnit.h34
1 files changed, 10 insertions, 24 deletions
diff --git a/lib/DebugInfo/DWARFCompileUnit.h b/lib/DebugInfo/DWARFCompileUnit.h
index 2a74605fcb..071be905e6 100644
--- a/lib/DebugInfo/DWARFCompileUnit.h
+++ b/lib/DebugInfo/DWARFCompileUnit.h
@@ -39,7 +39,7 @@ class DWARFCompileUnit {
const DWARFAbbreviationDeclarationSet *Abbrevs;
uint8_t AddrSize;
uint64_t BaseAddr;
- // The compile unit debug information entry item.
+ // The compile unit debug information entry items.
std::vector<DWARFDebugInfoEntryMinimal> DieArray;
public:
@@ -64,7 +64,7 @@ public:
/// extractDIEsIfNeeded - Parses a compile unit and indexes its DIEs if it
/// hasn't already been done. Returns the number of DIEs parsed at this call.
- size_t extractDIEsIfNeeded(bool cu_die_only);
+ size_t extractDIEsIfNeeded(bool CUDieOnly);
/// extractRangeList - extracts the range list referenced by this compile
/// unit from .debug_ranges section. Returns true on success.
/// Requires that compile unit is already extracted.
@@ -98,9 +98,7 @@ public:
const DWARFDebugInfoEntryMinimal *
getCompileUnitDIE(bool extract_cu_die_only = true) {
extractDIEsIfNeeded(extract_cu_die_only);
- if (DieArray.empty())
- return NULL;
- return &DieArray[0];
+ return DieArray.empty() ? NULL : &DieArray[0];
}
const char *getCompilationDir();
@@ -110,25 +108,6 @@ public:
/// parent, sibling and child pointers for quick DIE navigation.
void setDIERelations();
- void addDIE(DWARFDebugInfoEntryMinimal &die) {
- // The average bytes per DIE entry has been seen to be
- // around 14-20 so lets pre-reserve the needed memory for
- // our DIE entries accordingly. Search forward for "Compute
- // average bytes per DIE" to see #if'ed out code that does
- // that determination.
-
- // Only reserve the memory if we are adding children of
- // the main compile unit DIE. The compile unit DIE is always
- // the first entry, so if our size is 1, then we are adding
- // the first compile unit child DIE and should reserve
- // the memory.
- if (DieArray.empty())
- DieArray.reserve(getDebugInfoSize() / 14);
- DieArray.push_back(die);
- }
-
- void clearDIEs(bool keep_compile_unit_die);
-
void buildAddressRangeTable(DWARFDebugAranges *debug_aranges,
bool clear_dies_if_already_not_parsed);
@@ -136,6 +115,13 @@ public:
/// Returns empty chain if there is no subprogram containing address.
DWARFDebugInfoEntryMinimal::InlinedChain getInlinedChainForAddress(
uint64_t Address);
+
+private:
+ /// extractDIEsToVector - Appends all parsed DIEs to a vector.
+ void extractDIEsToVector(bool AppendCUDie, bool AppendNonCUDIEs,
+ std::vector<DWARFDebugInfoEntryMinimal> &DIEs) const;
+ /// clearDIEs - Clear parsed DIEs to keep memory usage low.
+ void clearDIEs(bool KeepCUDie);
};
}