summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-09-21 16:01:28 +0000
committerZachary Turner <zturner@google.com>2016-09-21 16:01:28 +0000
commit95eae4235d4cfa5cee67ab6c4e686baf8a57e9e5 (patch)
tree0e9d2a42e76e13cf5ed5d6a8f0b935a83e40ea69 /lldb/source/Plugins
parent07171f21d148d340115ec634be6a7f296799517d (diff)
downloadbcm5719-llvm-95eae4235d4cfa5cee67ab6c4e686baf8a57e9e5.tar.gz
bcm5719-llvm-95eae4235d4cfa5cee67ab6c4e686baf8a57e9e5.zip
Make lldb::Regex use StringRef.
This updates getters and setters to use StringRef instead of const char *. I tested the build on Linux, Windows, and OSX and saw no build or test failures. I cannot test any BSD or Android variants, however I expect the required changes to be minimal or non-existant. llvm-svn: 282079
Diffstat (limited to 'lldb/source/Plugins')
-rw-r--r--lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp5
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp2
-rw-r--r--lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp3
-rw-r--r--lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp2
-rw-r--r--lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp42
-rw-r--r--lldb/source/Plugins/Language/Java/JavaLanguage.cpp2
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp8
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp18
-rw-r--r--lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp4
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp7
-rw-r--r--lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp2
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp14
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp26
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp3
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp8
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp2
16 files changed, 82 insertions, 66 deletions
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
index 8d6be243be8..2f6e7e46d0f 100644
--- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
+++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
@@ -371,11 +371,12 @@ public:
}
}
- static RegularExpression s_regex("[ \t]*([^ ^\t]+)[ \t]*([^ ^\t].*)?");
+ static RegularExpression s_regex(
+ llvm::StringRef("[ \t]*([^ ^\t]+)[ \t]*([^ ^\t].*)?"));
RegularExpression::Match matches(3);
- if (s_regex.Execute(out_string.c_str(), &matches)) {
+ if (s_regex.Execute(out_string, &matches)) {
matches.GetMatchAtIndex(out_string.c_str(), 1, m_opcode_name);
matches.GetMatchAtIndex(out_string.c_str(), 2, m_mnemonics);
}
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index 0dbdff3f86a..89121bd12a4 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -999,7 +999,7 @@ size_t DynamicLoaderDarwin::FindEquivalentSymbols(
equivalent_regex_buf.append(trampoline_name.GetCString());
equivalent_regex_buf.append(resolver_name_regex);
- RegularExpression equivalent_name_regex(equivalent_regex_buf.c_str());
+ RegularExpression equivalent_name_regex(equivalent_regex_buf);
const bool append = true;
images.FindSymbolsMatchingRegExAndType(equivalent_name_regex, eSymbolTypeCode,
equivalent_symbols, append);
diff --git a/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
index 7b905878a0e..45c26e85edc 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
@@ -57,7 +57,8 @@ AddressSanitizerRuntime::~AddressSanitizerRuntime() { Deactivate(); }
const RegularExpression &
AddressSanitizerRuntime::GetPatternForRuntimeLibrary() {
// FIXME: This shouldn't include the "dylib" suffix.
- static RegularExpression regex("libclang_rt.asan_(.*)_dynamic\\.dylib");
+ static RegularExpression regex(
+ llvm::StringRef("libclang_rt.asan_(.*)_dynamic\\.dylib"));
return regex;
}
diff --git a/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp b/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
index dfac55a4944..c78836a8064 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
@@ -832,7 +832,7 @@ bool ThreadSanitizerRuntime::NotifyBreakpointHit(
}
const RegularExpression &ThreadSanitizerRuntime::GetPatternForRuntimeLibrary() {
- static RegularExpression regex("libclang_rt.tsan_");
+ static RegularExpression regex(llvm::StringRef("libclang_rt.tsan_"));
return regex;
}
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index 0b4e341888e..81ca95cd36a 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -153,12 +153,13 @@ static bool IsValidBasename(const llvm::StringRef &basename) {
if (!basename.startswith("operator"))
return false;
- static RegularExpression g_operator_regex("^(operator)( "
- "?)([A-Za-z_][A-Za-z_0-9]*|\\(\\)|"
- "\\[\\]|[\\^<>=!\\/"
- "*+-]+)(<.*>)?(\\[\\])?$");
+ static RegularExpression g_operator_regex(
+ llvm::StringRef("^(operator)( "
+ "?)([A-Za-z_][A-Za-z_0-9]*|\\(\\)|"
+ "\\[\\]|[\\^<>=!\\/"
+ "*+-]+)(<.*>)?(\\[\\])?$"));
std::string basename_str(basename.str());
- return g_operator_regex.Execute(basename_str.c_str(), nullptr);
+ return g_operator_regex.Execute(basename_str, nullptr);
}
void CPlusPlusLanguage::MethodName::Parse() {
@@ -289,10 +290,11 @@ bool CPlusPlusLanguage::IsCPPMangledName(const char *name) {
bool CPlusPlusLanguage::ExtractContextAndIdentifier(
const char *name, llvm::StringRef &context, llvm::StringRef &identifier) {
- static RegularExpression g_basename_regex(
- "^(([A-Za-z_][A-Za-z_0-9]*::)*)(~?[A-Za-z_~][A-Za-z_0-9]*)$");
+ static RegularExpression g_basename_regex(llvm::StringRef(
+ "^(([A-Za-z_][A-Za-z_0-9]*::)*)(~?[A-Za-z_~][A-Za-z_0-9]*)$"));
RegularExpression::Match match(4);
- if (g_basename_regex.Execute(name, &match)) {
+ if (g_basename_regex.Execute(llvm::StringRef::withNullAsEmpty(name),
+ &match)) {
match.GetMatchAtIndex(name, 1, context);
match.GetMatchAtIndex(name, 3, identifier);
return true;
@@ -564,8 +566,8 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
ConstString("^std::__(ndk)?1::atomic<.+>$"), stl_synth_flags, true);
cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
- RegularExpressionSP(
- new RegularExpression("^(std::__(ndk)?1::)deque<.+>(( )?&)?$")),
+ RegularExpressionSP(new RegularExpression(
+ llvm::StringRef("^(std::__(ndk)?1::)deque<.+>(( )?&)?$"))),
SyntheticChildrenSP(new ScriptedSyntheticChildren(
stl_synth_flags,
"lldb.formatters.cpp.libcxx.stddeque_SynthProvider")));
@@ -750,34 +752,38 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
false);
cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
- RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")),
+ RegularExpressionSP(
+ new RegularExpression(llvm::StringRef("^std::vector<.+>(( )?&)?$"))),
SyntheticChildrenSP(new ScriptedSyntheticChildren(
stl_synth_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
- RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")),
+ RegularExpressionSP(
+ new RegularExpression(llvm::StringRef("^std::map<.+> >(( )?&)?$"))),
SyntheticChildrenSP(new ScriptedSyntheticChildren(
stl_synth_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdMapSynthProvider")));
cpp_category_sp->GetRegexTypeSyntheticsContainer()->Add(
- RegularExpressionSP(
- new RegularExpression("^std::(__cxx11::)?list<.+>(( )?&)?$")),
+ RegularExpressionSP(new RegularExpression(
+ llvm::StringRef("^std::(__cxx11::)?list<.+>(( )?&)?$"))),
SyntheticChildrenSP(new ScriptedSyntheticChildren(
stl_synth_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
stl_summary_flags.SetDontShowChildren(false);
stl_summary_flags.SetSkipPointers(true);
cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")),
+ RegularExpressionSP(
+ new RegularExpression(llvm::StringRef("^std::vector<.+>(( )?&)?$"))),
TypeSummaryImplSP(
new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")),
+ RegularExpressionSP(
+ new RegularExpression(llvm::StringRef("^std::map<.+> >(( )?&)?$"))),
TypeSummaryImplSP(
new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
cpp_category_sp->GetRegexTypeSummariesContainer()->Add(
- RegularExpressionSP(
- new RegularExpression("^std::(__cxx11::)?list<.+>(( )?&)?$")),
+ RegularExpressionSP(new RegularExpression(
+ llvm::StringRef("^std::(__cxx11::)?list<.+>(( )?&)?$"))),
TypeSummaryImplSP(
new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
diff --git a/lldb/source/Plugins/Language/Java/JavaLanguage.cpp b/lldb/source/Plugins/Language/Java/JavaLanguage.cpp
index 77121c8823e..f58b51f53e7 100644
--- a/lldb/source/Plugins/Language/Java/JavaLanguage.cpp
+++ b/lldb/source/Plugins/Language/Java/JavaLanguage.cpp
@@ -70,7 +70,7 @@ lldb::TypeCategoryImplSP JavaLanguage::GetFormatters() {
std::call_once(g_initialize, [this]() -> void {
DataVisualization::Categories::GetCategory(GetPluginName(), g_category);
if (g_category) {
- const char *array_regexp = "^.*\\[\\]&?$";
+ llvm::StringRef array_regexp("^.*\\[\\]&?$");
lldb::TypeSummaryImplSP string_summary_sp(new CXXFunctionSummaryFormat(
TypeSummaryImpl::Flags().SetDontShowChildren(true),
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index fa97888d6fd..630490e3271 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -542,7 +542,8 @@ protected:
break;
case 1: {
regex_up.reset(new RegularExpression());
- if (!regex_up->Compile(command.GetArgumentAtIndex(0))) {
+ if (!regex_up->Compile(llvm::StringRef::withNullAsEmpty(
+ command.GetArgumentAtIndex(0)))) {
result.AppendError(
"invalid argument - please provide a valid regular expression");
result.SetStatus(lldb::eReturnStatusFailed);
@@ -567,7 +568,8 @@ protected:
if (iterator->second) {
const char *class_name =
iterator->second->GetClassName().AsCString("<unknown>");
- if (regex_up && class_name && !regex_up->Execute(class_name))
+ if (regex_up && class_name &&
+ !regex_up->Execute(llvm::StringRef(class_name)))
continue;
std_out.Printf("isa = 0x%" PRIx64, iterator->first);
std_out.Printf(" name = %s", class_name);
@@ -607,7 +609,7 @@ protected:
nullptr);
}
} else {
- if (regex_up && !regex_up->Execute(""))
+ if (regex_up && !regex_up->Execute(llvm::StringRef()))
continue;
std_out.Printf("isa = 0x%" PRIx64 " has no associated class.\n",
iterator->first);
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index 832f50dba88..9d751a75da0 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -1964,8 +1964,9 @@ void RenderScriptRuntime::FindStructTypeName(Element &elem,
// Find all the global variables from the script rs modules
VariableList variable_list;
for (auto module_sp : m_rsmodules)
- module_sp->m_module->FindGlobalVariables(RegularExpression("."), true,
- UINT32_MAX, variable_list);
+ module_sp->m_module->FindGlobalVariables(
+ RegularExpression(llvm::StringRef(".")), true, UINT32_MAX,
+ variable_list);
// Iterate over all the global variables looking for one with a matching type
// to the Element.
@@ -3741,15 +3742,16 @@ public:
RegularExpression regex;
RegularExpression::Match regex_match(3);
+ llvm::StringRef id_ref = llvm::StringRef::withNullAsEmpty(id_cstr);
bool matched = false;
- if (regex.Compile("^([0-9]+),([0-9]+),([0-9]+)$") &&
- regex.Execute(id_cstr, &regex_match))
+ if (regex.Compile(llvm::StringRef("^([0-9]+),([0-9]+),([0-9]+)$")) &&
+ regex.Execute(id_ref, &regex_match))
matched = true;
- else if (regex.Compile("^([0-9]+),([0-9]+)$") &&
- regex.Execute(id_cstr, &regex_match))
+ else if (regex.Compile(llvm::StringRef("^([0-9]+),([0-9]+)$")) &&
+ regex.Execute(id_ref, &regex_match))
matched = true;
- else if (regex.Compile("^([0-9]+)$") &&
- regex.Execute(id_cstr, &regex_match))
+ else if (regex.Compile(llvm::StringRef("^([0-9]+)$")) &&
+ regex.Execute(id_ref, &regex_match))
matched = true;
for (uint32_t i = 0; i < 3; i++) {
std::string group;
diff --git a/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp b/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
index e609cb96456..7c8c26047f8 100644
--- a/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
+++ b/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
@@ -125,9 +125,9 @@ DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict,
// LSBIT - the least significant bit at which the current register value
// ends at
static RegularExpression g_bitfield_regex(
- "([A-Za-z_][A-Za-z0-9_]*)\\[([0-9]+):([0-9]+)\\]");
+ llvm::StringRef("([A-Za-z_][A-Za-z0-9_]*)\\[([0-9]+):([0-9]+)\\]"));
RegularExpression::Match regex_match(3);
- if (g_bitfield_regex.Execute(slice_str.c_str(), &regex_match)) {
+ if (g_bitfield_regex.Execute(slice_str, &regex_match)) {
llvm::StringRef reg_name_str;
std::string msbit_str;
std::string lsbit_str;
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 2c0a5e06c78..de7d52480bc 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -404,11 +404,11 @@ GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock(
std::string regex_str = "^";
regex_str += echo_packet;
regex_str += "$";
- response_regex.Compile(regex_str.c_str());
+ response_regex.Compile(regex_str);
} else {
echo_packet_len =
::snprintf(echo_packet, sizeof(echo_packet), "qC");
- response_regex.Compile("^QC[0-9A-Fa-f]+$");
+ response_regex.Compile(llvm::StringRef("^QC[0-9A-Fa-f]+$"));
}
PacketResult echo_packet_result =
@@ -422,8 +422,7 @@ GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock(
echo_response, timeout_usec, false);
if (echo_packet_result == PacketResult::Success) {
++successful_responses;
- if (response_regex.Execute(
- echo_response.GetStringRef().c_str())) {
+ if (response_regex.Execute(echo_response.GetStringRef())) {
sync_success = true;
break;
} else if (successful_responses == 1) {
diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
index 59175cfc53d..4c5585be2c5 100644
--- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -312,7 +312,7 @@ private:
}
// Instantiate the regex so we can report any errors.
- auto regex = RegularExpression(op_arg.c_str());
+ auto regex = RegularExpression(op_arg);
if (!regex.IsValid()) {
char error_text[256];
error_text[0] = '\0';
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
index 82faf7fc06c..66dee4b7ff8 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -999,16 +999,18 @@ void DWARFCompileUnit::ParseProducerInfo() {
const char *producer_cstr = die->GetAttributeValueAsString(
m_dwarf2Data, this, DW_AT_producer, NULL);
if (producer_cstr) {
- RegularExpression llvm_gcc_regex("^4\\.[012]\\.[01] \\(Based on Apple "
- "Inc\\. build [0-9]+\\) \\(LLVM build "
- "[\\.0-9]+\\)$");
- if (llvm_gcc_regex.Execute(producer_cstr)) {
+ RegularExpression llvm_gcc_regex(
+ llvm::StringRef("^4\\.[012]\\.[01] \\(Based on Apple "
+ "Inc\\. build [0-9]+\\) \\(LLVM build "
+ "[\\.0-9]+\\)$"));
+ if (llvm_gcc_regex.Execute(llvm::StringRef(producer_cstr))) {
m_producer = eProducerLLVMGCC;
} else if (strstr(producer_cstr, "clang")) {
static RegularExpression g_clang_version_regex(
- "clang-([0-9]+)\\.([0-9]+)\\.([0-9]+)");
+ llvm::StringRef("clang-([0-9]+)\\.([0-9]+)\\.([0-9]+)"));
RegularExpression::Match regex_match(3);
- if (g_clang_version_regex.Execute(producer_cstr, &regex_match)) {
+ 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 =
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index e06c1b8e3b8..9dc656d7932 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -535,18 +535,20 @@ FindCallbackString(SymbolFileDWARF *dwarf2Data, DWARFCompileUnit *cu,
const uint32_t curr_depth, void *userData) {
FindCallbackStringInfo *info = (FindCallbackStringInfo *)userData;
- if (die) {
- const char *die_name = die->GetName(dwarf2Data, cu);
- if (die_name) {
- if (info->regex) {
- if (info->regex->Execute(die_name))
- info->die_offsets.push_back(die->GetOffset());
- } else {
- if ((info->ignore_case ? strcasecmp(die_name, info->name)
- : strcmp(die_name, info->name)) == 0)
- info->die_offsets.push_back(die->GetOffset());
- }
- }
+ if (!die)
+ return next_offset;
+
+ const char *die_name = die->GetName(dwarf2Data, cu);
+ if (!die_name)
+ return next_offset;
+
+ if (info->regex) {
+ if (info->regex->Execute(llvm::StringRef(die_name)))
+ info->die_offsets.push_back(die->GetOffset());
+ } else {
+ if ((info->ignore_case ? strcasecmp(die_name, info->name)
+ : strcmp(die_name, info->name)) == 0)
+ info->die_offsets.push_back(die->GetOffset());
}
// Just return the current offset to parse the next CU or DIE entry
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
index 16c0b907a18..afdb1d6afed 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "HashedNameToDIE.h"
+#include "llvm/ADT/StringRef.h"
void DWARFMappedHash::ExtractDIEArray(const DIEInfoArray &die_info_array,
DIEArray &die_offsets) {
@@ -469,7 +470,7 @@ DWARFMappedHash::MemoryTable::AppendHashDataForRegularExpression(
if (count > 0 &&
m_data.ValidOffsetForDataOfSize(*hash_data_offset_ptr,
min_total_hash_data_size)) {
- const bool match = regex.Execute(strp_cstr);
+ const bool match = regex.Execute(llvm::StringRef(strp_cstr));
if (!match && m_header.header_data.HashDataHasFixedByteSize()) {
// If the regex doesn't match and we have fixed size data,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 5c8083c68ce..92e513d856f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2198,7 +2198,7 @@ uint32_t SymbolFileDWARF::FindGlobalVariables(const RegularExpression &regex,
GetObjectFile()->GetModule()->LogMessage(
log, "SymbolFileDWARF::FindGlobalVariables (regex=\"%s\", append=%u, "
"max_matches=%u, variables)",
- regex.GetText(), append, max_matches);
+ regex.GetText().str().c_str(), append, max_matches);
}
DWARFDebugInfo *info = DebugInfo();
@@ -2252,7 +2252,7 @@ uint32_t SymbolFileDWARF::FindGlobalVariables(const RegularExpression &regex,
GetObjectFile()->GetModule()->ReportErrorIfModifyDetected(
"the DWARF debug information has been modified (.apple_names "
"accelerator table had bad die 0x%8.8x for regex '%s')\n",
- die_ref.die_offset, regex.GetText());
+ die_ref.die_offset, regex.GetText().str().c_str());
}
}
}
@@ -2673,7 +2673,7 @@ uint32_t SymbolFileDWARF::FindFunctions(const RegularExpression &regex,
SymbolContextList &sc_list) {
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
"SymbolFileDWARF::FindFunctions (regex = '%s')",
- regex.GetText());
+ regex.GetText().str().c_str());
Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
@@ -2681,7 +2681,7 @@ uint32_t SymbolFileDWARF::FindFunctions(const RegularExpression &regex,
GetObjectFile()->GetModule()->LogMessage(
log,
"SymbolFileDWARF::FindFunctions (regex=\"%s\", append=%u, sc_list)",
- regex.GetText(), append);
+ regex.GetText().str().c_str(), append);
}
// If we aren't appending the results to this list, then clear the list
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 3933a2b862d..6a1b6b423fb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -1020,7 +1020,7 @@ uint32_t SymbolFileDWARFDebugMap::FindFunctions(const RegularExpression &regex,
SymbolContextList &sc_list) {
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
"SymbolFileDWARFDebugMap::FindFunctions (regex = '%s')",
- regex.GetText());
+ regex.GetText().str().c_str());
uint32_t initial_size = 0;
if (append)
OpenPOWER on IntegriCloud