Merge pull request #446 from Dmitry-Me/eliminateDualSearch
Cache search result to avoid dual search
This commit is contained in:
commit
47a3548bea
|
@ -7526,8 +7526,9 @@ public:
|
||||||
|
|
||||||
void simplify(const std::map<std::string, EnumValue> &enumValues) {
|
void simplify(const std::map<std::string, EnumValue> &enumValues) {
|
||||||
for (Token *tok = start; tok; tok = tok->next()) {
|
for (Token *tok = start; tok; tok = tok->next()) {
|
||||||
if (enumValues.find(tok->str()) != enumValues.end()) {
|
std::map<std::string, EnumValue>::const_iterator it = enumValues.find(tok->str());
|
||||||
const EnumValue &other = enumValues.find(tok->str())->second;
|
if (it != enumValues.end()) {
|
||||||
|
const EnumValue &other = it->second;
|
||||||
if (other.value != nullptr)
|
if (other.value != nullptr)
|
||||||
tok->str(other.value->str());
|
tok->str(other.value->str());
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue