summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-05-29 09:32:59 +0000
committerPavel Labath <pavel@labath.sk>2019-05-29 09:32:59 +0000
commitd2042d3dd770ec593f0bf27a6fabe976d3fab804 (patch)
tree7089091935c7562f3a72e4f5cbc3abce648541cd
parent78cfe1e6feecebeeb7928cb1ffa1e2a64f5ed976 (diff)
downloadbcm5719-llvm-d2042d3dd770ec593f0bf27a6fabe976d3fab804.tar.gz
bcm5719-llvm-d2042d3dd770ec593f0bf27a6fabe976d3fab804.zip
DWARFASTParserClang: Unify compilation unit language handling
Summary: The function was not being consistent in how it retrieved the language of the current compile unit. Sometimes it did so from the lldb CU object, and sometimes from the DWARF die. This patch unifies the handling on the latter. The reason for choosing the DWARF method is because I'd eventually like to stop creating lldb CUs for dwarf type units (and so this code needs to would need to work without them). Reviewers: clayborg, JDevlieghere, aprantl Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D62481 llvm-svn: 361939
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index b1e826582a8..a260684285d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -294,6 +294,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
dw_attr_t attr;
TypeSP type_sp;
+ LanguageType cu_language = die.GetLanguage();
switch (tag) {
case DW_TAG_typedef:
case DW_TAG_base_type:
@@ -468,11 +469,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
}
}
- bool translation_unit_is_objc =
- (sc.comp_unit->GetLanguage() == eLanguageTypeObjC ||
- sc.comp_unit->GetLanguage() == eLanguageTypeObjC_plus_plus);
-
- if (translation_unit_is_objc) {
+ if (cu_language == eLanguageTypeObjC ||
+ cu_language == eLanguageTypeObjC_plus_plus) {
if (type_name_cstr != nullptr) {
static ConstString g_objc_type_name_id("id");
static ConstString g_objc_type_name_Class("Class");
@@ -629,8 +627,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
Declaration unique_decl(decl);
if (type_name_const_str) {
- LanguageType die_language = die.GetLanguage();
- if (Language::LanguageIsCPlusPlus(die_language)) {
+ if (Language::LanguageIsCPlusPlus(cu_language)) {
// For C++, we rely solely upon the one definition rule that says
// only one thing can exist at a given decl context. We ignore the
// file and line that things are declared on.
@@ -668,7 +665,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
}
if (byte_size && *byte_size == 0 && type_name_cstr && !die.HasChildren() &&
- sc.comp_unit->GetLanguage() == eLanguageTypeObjC) {
+ cu_language == eLanguageTypeObjC) {
// Work around an issue with clang at the moment where forward
// declarations for objective C classes are emitted as:
// DW_TAG_structure_type [2]
OpenPOWER on IntegriCloud