[Lldb-commits] [PATCH] D41086: [lldb] Check that a regex is valid before searching by regex for a symbol in a pdb.
Greg Clayton via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 19 08:38:39 PST 2017
clayborg added inline comments.
Comment at: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp:394
+ if (name_str.find_first_of("?*.-+\\") != std::string::npos)
+ FindTypesByRegex(RegularExpression(name_str), max_matches, types);
You should make the RegularExpression object first and then check for errors. If there are errors, the type lookup should happen by normal name. This is again why I don't like us sniffing for a regular expression. If there is an error, like when trying to lookup "char*" as mentioned by Aaron, would you expect to see an error message saying "char*" isn't a valid regex? Then the user thinks that the type lookup always takes a regular expression which is not the case, just something the PDB plugin added for some reason. I do believe part of this patch should be adding the lldb_private::SymbolFile::FindTypesByRegex(...) to the base class and fixing this issue by removing the regex sniffing code since it is fragile at best (how are we doing to lookup a template type without triggering the regex issues?).
More information about the lldb-commits