Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: ollydbg on February 07, 2012, 07:55:07 am

Title: unused tree pointer variable in CC
Post by: ollydbg on February 07, 2012, 07:55:07 am
When build CC, I find some un-used variables, like:
Code
size_t NativeParser::ResolveActualType(wxString searchText, const TokenIdxSet& searchScope, TokenIdxSet& result)
{
    // break up the search text for next analysis.
    std::queue<ParserComponent> typeComponents;
    BreakUpComponents(searchText, typeComponents);
    if (!typeComponents.empty())
    {
        TokenIdxSet initialScope;
        if (!searchScope.empty())
            initialScope = searchScope;
        else
            initialScope.insert(-1);

        TokensTree* tree = m_Parser->GetTokensTree(); // accessed by GenerateResultSet

        CC_LOCKER_TRACK_TT_MTX_LOCK(s_TokensTreeMutex)

        while (!typeComponents.empty())
        {
            TokenIdxSet initialResult;
            ParserComponent component = typeComponents.front();
            typeComponents.pop();
            wxString actualTypeStr = component.component;

            // All functions that call the recursive GenerateResultSet should already entered a critical section.
            GenerateResultSet(actualTypeStr, initialScope, initialResult, true, false, 0xFFFF);

            if (!initialResult.empty())
            {
                initialScope.clear();
                for (TokenIdxSet::iterator it = initialResult.begin(); it != initialResult.end(); ++it)
                    // TODO (blueshake#1#): eclimate the variable/function
                    initialScope.insert(*it);
            }
            else
            {
                initialScope.clear();
                break;
            }
        }

        CC_LOCKER_TRACK_TT_MTX_UNLOCK(s_TokensTreeMutex)

        if (!initialScope.empty())
            result = initialScope;
    }

    return result.size();
}

What does this means? comments is still confusing.
Code
TokensTree* tree = m_Parser->GetTokensTree(); // accessed by GenerateResultSet
Title: Re: unused tree pointer variable in CC
Post by: MortenMacFly on February 07, 2012, 09:10:25 am
TokensTree* tree = m_Parser->GetTokensTree(); // accessed by GenerateResultSet
You can comment these lines. They were for me to understand, what tree has to be locked when calling one of the recursive functions that require a lock from "outside" (i.e. the caller). Don't remove, just comment please.