[idl_parser] Improve symbols lookup thru parent namespaces (#6407)

Added the new method LookupTableByName for searching symbols in parent namespaces.
This method speedup (x50 or greater) symbol resolution (enum or struct) in parent namespaces.
The speedup was measured without `table.empty()` guard condition.

This method should suppress fuzzer timeout issue without artificial limits for nested namespaces (https://oss-fuzz.com/testcase-detail/6244168439169024).

Additionally, this commit speedup (x5) the GetFullyQualifiedName method by removing unnecessary temporary std::string object.
This commit is contained in:
Vladimir Glavnyy
2021-01-20 03:49:24 +07:00
committed by GitHub
parent 91b0958c43
commit 75c859e98f
2 changed files with 37 additions and 16 deletions

View File

@@ -856,6 +856,7 @@ class Parser : public ParserState {
flexbuffers::Builder *builder);
StructDef *LookupStruct(const std::string &id) const;
StructDef *LookupStructThruParentNamespaces(const std::string &id) const;
std::string UnqualifiedName(const std::string &fullQualifiedName);