aboutsummaryrefslogtreecommitdiffstats
path: root/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp')
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp b/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
index 96adb72c9532..033105efdc53 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
@@ -14,6 +14,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/Log.h"
using namespace lldb_private;
@@ -29,7 +30,7 @@ dw_tag_t DWARFBaseDIE::Tag() const {
if (m_die)
return m_die->Tag();
else
- return 0;
+ return llvm::dwarf::DW_TAG_null;
}
const char *DWARFBaseDIE::GetTagAsCString() const {
@@ -102,19 +103,22 @@ SymbolFileDWARF *DWARFBaseDIE::GetDWARF() const {
return nullptr;
}
-lldb_private::TypeSystem *DWARFBaseDIE::GetTypeSystem() const {
- if (m_cu)
- return m_cu->GetTypeSystem();
- else
- return nullptr;
+llvm::Expected<lldb_private::TypeSystem &> DWARFBaseDIE::GetTypeSystem() const {
+ if (!m_cu)
+ return llvm::make_error<llvm::StringError>(
+ "Unable to get TypeSystem, no compilation unit available",
+ llvm::inconvertibleErrorCode());
+ return m_cu->GetTypeSystem();
}
DWARFASTParser *DWARFBaseDIE::GetDWARFParser() const {
- lldb_private::TypeSystem *type_system = GetTypeSystem();
- if (type_system)
- return type_system->GetDWARFParser();
- else
+ auto type_system_or_err = GetTypeSystem();
+ if (auto err = type_system_or_err.takeError()) {
+ LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS),
+ std::move(err), "Unable to get DWARFASTParser");
return nullptr;
+ }
+ return type_system_or_err->GetDWARFParser();
}
bool DWARFBaseDIE::HasChildren() const {