Sorry I missed this, lgtm<br><div class="gmail_quote"><div dir="ltr">On Fri, Dec 22, 2017 at 7:55 PM Aaron Smith via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">asmith created this revision.<br>
asmith added reviewers: zturner, lldb-commits, labath, clayborg.<br>
<br>
<a href="https://reviews.llvm.org/D41086" rel="noreferrer" target="_blank">https://reviews.llvm.org/D41086</a> fixed an exception in FindTypes()/FindTypesByRegex() and caused two lldb unit test to fail. This change updates the unit tests to pass again.<br>
<br>
Related review:<br>
<a href="https://reviews.llvm.org/D41086" rel="noreferrer" target="_blank">https://reviews.llvm.org/D41086</a><br>
<br>
<br>
Repository:<br>
rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D41550" rel="noreferrer" target="_blank">https://reviews.llvm.org/D41550</a><br>
<br>
Files:<br>
source/Plugins/SymbolFile/PDB/SymbolFilePDB.h<br>
unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp<br>
<br>
<br>
Index: unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp<br>
===================================================================<br>
--- unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp<br>
+++ unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp<br>
@@ -512,13 +512,14 @@<br>
SymbolVendor *plugin = module->GetSymbolVendor();<br>
SymbolFilePDB *symfile =<br>
static_cast<SymbolFilePDB *>(plugin->GetSymbolFile());<br>
- SymbolContext sc;<br>
- llvm::DenseSet<SymbolFile *> searched_files;<br>
TypeMap results;<br>
- uint32_t num_results = symfile->FindTypes(sc, ConstString(".*"), nullptr,<br>
- false, 0, searched_files, results);<br>
- EXPECT_GT(num_results, 1u);<br>
- EXPECT_EQ(num_results, results.GetSize());<br>
+ symfile->FindTypesByRegex(RegularExpression(".*"), 0, results);<br>
+ EXPECT_GT(results.GetSize(), 1u);<br>
+<br>
+ // We expect no exception thrown if the given regex can't be compiled<br>
+ results.Clear();<br>
+ symfile->FindTypesByRegex(RegularExpression("**"), 0, results);<br>
+ EXPECT_EQ(0u, results.GetSize());<br>
}<br>
<br>
TEST_F(SymbolFilePDBTests, TestMaxMatches) {<br>
@@ -532,7 +533,8 @@<br>
SymbolContext sc;<br>
llvm::DenseSet<SymbolFile *> searched_files;<br>
TypeMap results;<br>
- uint32_t num_results = symfile->FindTypes(sc, ConstString(".*"), nullptr,<br>
+ const ConstString name("ClassTypedef");<br>
+ uint32_t num_results = symfile->FindTypes(sc, name, nullptr,<br>
false, 0, searched_files, results);<br>
// Try to limit ourselves from 1 to 10 results, otherwise we could be doing<br>
// this thousands of times.<br>
@@ -542,7 +544,7 @@<br>
uint32_t iterations = std::min(num_results, 10u);<br>
for (uint32_t i = 1; i <= iterations; ++i) {<br>
uint32_t num_limited_results = symfile->FindTypes(<br>
- sc, ConstString(".*"), nullptr, false, i, searched_files, results);<br>
+ sc, name, nullptr, false, i, searched_files, results);<br>
EXPECT_EQ(i, num_limited_results);<br>
EXPECT_EQ(num_limited_results, results.GetSize());<br>
}<br>
Index: source/Plugins/SymbolFile/PDB/SymbolFilePDB.h<br>
===================================================================<br>
--- source/Plugins/SymbolFile/PDB/SymbolFilePDB.h<br>
+++ source/Plugins/SymbolFile/PDB/SymbolFilePDB.h<br>
@@ -140,6 +140,10 @@<br>
size_t FindTypes(const std::vector<lldb_private::CompilerContext> &context,<br>
bool append, lldb_private::TypeMap &types) override;<br>
<br>
+ void FindTypesByRegex(const lldb_private::RegularExpression ®ex,<br>
+ uint32_t max_matches,<br>
+ lldb_private::TypeMap &types);<br>
+<br>
lldb_private::TypeList *GetTypeList() override;<br>
<br>
size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,<br>
@@ -172,9 +176,6 @@<br>
const llvm::pdb::PDBSymbolCompiland &cu,<br>
llvm::DenseMap<uint32_t, uint32_t> &index_map) const;<br>
<br>
- void FindTypesByRegex(const std::string ®ex, uint32_t max_matches,<br>
- lldb_private::TypeMap &types);<br>
-<br>
void FindTypesByName(const std::string &name, uint32_t max_matches,<br>
lldb_private::TypeMap &types);<br>
<br>
<br>
<br>
</blockquote></div>