예제 #1
0
bool TCompiler::pruneUnusedFunctions(TIntermNode *root)
{
    TIntermAggregate *rootNode = root->getAsAggregate();
    ASSERT(rootNode != nullptr);

    UnusedPredicate isUnused(&mCallDag, &functionMetadata);
    TIntermSequence *sequence = rootNode->getSequence();
    sequence->erase(std::remove_if(sequence->begin(), sequence->end(), isUnused), sequence->end());

    return true;
}
예제 #2
0
void BytecodeTranslatorVisitor::processBlockNode(BlockNode* node) {
    for (uint32_t i = 0; i < node->nodes(); i++) {
        AstNode* ith = node->nodeAt(i);

        warningIf(isUnused(ith), "unused result of statement");

        VISIT(ith);
        VarType result = popType();

        if (result != VT_VOID && !ith->isReturnNode())
            EMIT(BC_POP);
    }
}
예제 #3
0
void ShopViewer::on_listWidget_customContextMenuRequested(const QPoint &pos) {
    auto listItem = ui->listWidget->itemAt(pos);
    if (listItem) {
        auto shop = listItem->data(Qt::UserRole + 1).value<Shop*>();
        if (shop && !shop->isUnused()) {
            QMenu menu;
            auto deleteAction = menu.addAction("Delete " + listItem->text());
            // Execute offset so double right clicking doesn't delete
            // TODO(rory): Replace this with a dialog to confirm deletion
            if (menu.exec(ui->listWidget->mapToGlobal(pos) + QPoint(5, 0)) == deleteAction) {
                removeShop(shop);
            }
        }
    }
}
예제 #4
0
void MemoryCache::clearUnused()
{
    boost::mutex::scoped_lock lockerMap(_mutexMap);
    for(MAP::iterator it = _map.begin(); it != _map.end();)
    {
        if(isUnused(it->second))
        {
            _map.erase(
                it++); // post-increment here, increments 'it' and returns a copy of the original 'it' to be used by erase()
        }
        else
        {
            ++it;
        }
    }
}