summaryrefslogtreecommitdiff
path: root/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-10-23 17:53:01 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-10-23 17:53:01 +0000
commitead246455adf1a215ec2715dad6533073a6beb4e (patch)
treef3f97a47d77053bf96fe74cdbd6fae74380e8a92 /source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
parentfdb00c4408990a0a63ef7f496d809ce59f263bc5 (diff)
Notes
Diffstat (limited to 'source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp')
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 33e83d1fe57f..9964cf4b893c 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -438,7 +438,7 @@ lldb::ByteOrder DWARFUnit::GetByteOrder() const {
return m_dwarf.GetObjectFile()->GetByteOrder();
}
-TypeSystem *DWARFUnit::GetTypeSystem() {
+llvm::Expected<TypeSystem &> DWARFUnit::GetTypeSystem() {
return m_dwarf.GetTypeSystemForLanguage(GetLanguageType());
}
@@ -540,19 +540,15 @@ void DWARFUnit::ParseProducerInfo() {
} else if (strstr(producer_cstr, "clang")) {
static RegularExpression g_clang_version_regex(
llvm::StringRef("clang-([0-9]+)\\.([0-9]+)\\.([0-9]+)"));
- RegularExpression::Match regex_match(3);
+ llvm::SmallVector<llvm::StringRef, 4> matches;
if (g_clang_version_regex.Execute(llvm::StringRef(producer_cstr),
- &regex_match)) {
- std::string str;
- if (regex_match.GetMatchAtIndex(producer_cstr, 1, str))
- m_producer_version_major =
- StringConvert::ToUInt32(str.c_str(), UINT32_MAX, 10);
- if (regex_match.GetMatchAtIndex(producer_cstr, 2, str))
- m_producer_version_minor =
- StringConvert::ToUInt32(str.c_str(), UINT32_MAX, 10);
- if (regex_match.GetMatchAtIndex(producer_cstr, 3, str))
- m_producer_version_update =
- StringConvert::ToUInt32(str.c_str(), UINT32_MAX, 10);
+ &matches)) {
+ m_producer_version_major =
+ StringConvert::ToUInt32(matches[1].str().c_str(), UINT32_MAX, 10);
+ m_producer_version_minor =
+ StringConvert::ToUInt32(matches[2].str().c_str(), UINT32_MAX, 10);
+ m_producer_version_update =
+ StringConvert::ToUInt32(matches[3].str().c_str(), UINT32_MAX, 10);
}
m_producer = eProducerClang;
} else if (strstr(producer_cstr, "GNU"))
@@ -870,7 +866,7 @@ DWARFUnit::FindRnglistFromOffset(dw_offset_t offset) const {
llvm::Expected<DWARFRangeList>
DWARFUnit::FindRnglistFromIndex(uint32_t index) const {
- const DWARFDebugRangesBase *debug_rnglists = m_dwarf.GetDebugRngLists();
+ const DWARFDebugRngLists *debug_rnglists = m_dwarf.GetDebugRngLists();
if (!debug_rnglists)
return llvm::make_error<llvm::object::GenericBinaryError>(
"No debug_rnglists section");