Skip to content

Commit 2edb905

Browse files
committed
Simplify control flow (NFC)
1 parent 14aa3f3 commit 2edb905

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -661,31 +661,31 @@ bool DWARFUnit::Supports_unnamed_objc_bitfields() {
661661
}
662662

663663
void DWARFUnit::ParseProducerInfo() {
664+
m_producer = eProducerOther;
664665
const DWARFDebugInfoEntry *die = GetUnitDIEPtrOnly();
665-
if (die) {
666-
const char *producer_cstr =
667-
die->GetAttributeValueAsString(this, DW_AT_producer, nullptr);
668-
llvm::StringRef producer(producer_cstr);
669-
if (!producer.empty()) {
670-
RegularExpression llvm_gcc_regex(
671-
llvm::StringRef("^4\\.[012]\\.[01] \\(Based on Apple "
672-
"Inc\\. build [0-9]+\\) \\(LLVM build "
673-
"[\\.0-9]+\\)$"));
674-
if (llvm_gcc_regex.Execute(producer)) {
675-
m_producer = eProducerLLVMGCC;
676-
} else if (producer.contains("clang")) {
677-
static RegularExpression g_clang_version_regex(
678-
llvm::StringRef(R"(clang-([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?))"));
679-
llvm::SmallVector<llvm::StringRef, 4> matches;
680-
if (g_clang_version_regex.Execute(producer, &matches))
681-
m_producer_version.tryParse(matches[1]);
682-
m_producer = eProducerClang;
683-
} else if (producer.contains("GNU"))
684-
m_producer = eProducerGCC;
685-
}
686-
}
687-
if (m_producer == eProducerInvalid)
688-
m_producer = eProducerOther;
666+
if (!die)
667+
return;
668+
669+
llvm::StringRef producer(
670+
die->GetAttributeValueAsString(this, DW_AT_producer, nullptr));
671+
if (producer.empty())
672+
return;
673+
674+
static RegularExpression llvm_gcc_regex(
675+
llvm::StringRef("^4\\.[012]\\.[01] \\(Based on Apple "
676+
"Inc\\. build [0-9]+\\) \\(LLVM build "
677+
"[\\.0-9]+\\)$"));
678+
if (llvm_gcc_regex.Execute(producer)) {
679+
m_producer = eProducerLLVMGCC;
680+
} else if (producer.contains("clang")) {
681+
static RegularExpression g_clang_version_regex(
682+
llvm::StringRef(R"(clang-([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?))"));
683+
llvm::SmallVector<llvm::StringRef, 4> matches;
684+
if (g_clang_version_regex.Execute(producer, &matches))
685+
m_producer_version.tryParse(matches[1]);
686+
m_producer = eProducerClang;
687+
} else if (producer.contains("GNU"))
688+
m_producer = eProducerGCC;
689689
}
690690

691691
DWARFProducer DWARFUnit::GetProducer() {

0 commit comments

Comments
 (0)