| 1443 | } |
| 1444 | |
| 1445 | void SymbolDatabase::createSymbolDatabaseEnums() |
| 1446 | { |
| 1447 | // fill in enumerators in enum |
| 1448 | for (const Scope &scope : scopeList) { |
| 1449 | if (scope.type != ScopeType::eEnum) |
| 1450 | continue; |
| 1451 | |
| 1452 | // add enumerators to enumerator tokens |
| 1453 | for (const Enumerator & i : scope.enumeratorList) |
| 1454 | const_cast<Token *>(i.name)->enumerator(&i); |
| 1455 | } |
| 1456 | |
| 1457 | std::set<std::string> tokensThatAreNotEnumeratorValues; |
| 1458 | |
| 1459 | for (const Scope &scope : scopeList) { |
| 1460 | if (scope.type != ScopeType::eEnum) |
| 1461 | continue; |
| 1462 | |
| 1463 | for (const Enumerator & enumerator : scope.enumeratorList) { |
| 1464 | // look for initialization tokens that can be converted to enumerators and convert them |
| 1465 | if (enumerator.start) { |
| 1466 | if (!enumerator.end) |
| 1467 | mTokenizer.syntaxError(enumerator.start); |
| 1468 | for (const Token * tok3 = enumerator.start; tok3 && tok3 != enumerator.end->next(); tok3 = tok3->next()) { |
| 1469 | if (tok3->tokType() == Token::eName) { |
| 1470 | const Enumerator * e = findEnumerator(tok3, tokensThatAreNotEnumeratorValues); |
| 1471 | if (e) |
| 1472 | const_cast<Token *>(tok3)->enumerator(e); |
| 1473 | } |
| 1474 | } |
| 1475 | } |
| 1476 | } |
| 1477 | } |
| 1478 | |
| 1479 | // find enumerators |
| 1480 | for (Token* tok = mTokenizer.list.front(); tok != mTokenizer.list.back(); tok = tok->next()) { |
| 1481 | const bool isVariable = (tok->tokType() == Token::eVariable && !tok->variable()); |
| 1482 | if (tok->tokType() != Token::eName && !isVariable) |
| 1483 | continue; |
| 1484 | const Enumerator * enumerator = findEnumerator(tok, tokensThatAreNotEnumeratorValues); |
| 1485 | if (enumerator) { |
| 1486 | if (isVariable) |
| 1487 | tok->varId(0); |
| 1488 | tok->enumerator(enumerator); |
| 1489 | } |
| 1490 | } |
| 1491 | } |
| 1492 | |
| 1493 | void SymbolDatabase::createSymbolDatabaseIncompleteVars() |
| 1494 | { |
nothing calls this directly
no test coverage detected