Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: ollydbg on March 16, 2012, 03:41:54 pm

Title: calculation of BaseType has changed?
Post by: ollydbg on March 16, 2012, 03:41:54 pm
I see many bug report said that BaseType lost the "*", I'm not sure this is a regression or a long time bug.

See:

Functions returning T* are displayed as returning T (http://developer.berlios.de/bugs/?func=detailbug&bug_id=18534&group_id=5358)

or

Insert all class methods without implementation malfunction (http://developer.berlios.de/bugs/?func=detailbug&bug_id=18526&group_id=5358)
Title: Re: calculation of BaseType has changed?
Post by: MortenMacFly on March 16, 2012, 05:25:18 pm
I see many bug report said that BaseType lost the "*", I'm not sure this is a regression or a long time bug.
You can easily find out by trying with 10/05 or 08/02.

BTW: I think there are actually two issues: First, the correct type of functions / methods is not found due to what I have commented in ParserThread::GetTokenBaseType() (I am working on that but its not so easy). For the other one: If is is working safely with FullType its OK, but I wonder if the actual error is that the base type gets truncated. What's in full/base type at that moment for the samples in the bug tracker?
Title: Re: calculation of BaseType has changed?
Post by: ollydbg on March 17, 2012, 08:34:00 am
What's in full/base type at that moment for the samples in the bug tracker?
CC has such code snippet to set full/base type.

Code
    if (!(kind & (tkConstructor | tkDestructor)))
    {
        wxString tokenFullType = m_Str;
        if (!m_PointerOrRef.IsEmpty())
        {
            tokenFullType << m_PointerOrRef;
            m_PointerOrRef.Clear();
        }
        wxString tokenBaseType = GetTokenBaseType();
        if (tokenBaseType.Find(ParserConsts::space_chr) == wxNOT_FOUND)
        {
            // token type must contain all namespaces
            wxString prepend;

            // Notice: clears the queue "m_EncounteredTypeNamespaces", too
            while (!m_EncounteredTypeNamespaces.empty())
            {
                prepend << m_EncounteredTypeNamespaces.front() << ParserConsts::dcolon;
                m_EncounteredTypeNamespaces.pop();
            }

            TRACE(_T("DoAddToken() : Prepending '%s'"), prepend.wx_str());
            tokenBaseType.Prepend(prepend);
        }
        newToken->m_FullType = tokenFullType;
        newToken->m_BaseType = tokenBaseType;
    }

    newToken->m_IsLocal    = m_IsLocal;
    newToken->m_IsTemp     = m_Options.isTemp;
    newToken->m_IsOperator = isOperator;

So, the fulltype is "char*", and the basetype is "char", so it looks like we can safely use m_FullType, right?
Title: Re: calculation of BaseType has changed?
Post by: MortenMacFly on March 17, 2012, 09:20:16 am
So, the fulltype is "char*", and the basetype is "char", so it looks like we can safely use m_FullType, right?
Looks like that... why don't you try? I wonder is that works for e.g. template specialisation, too.
Title: Re: calculation of BaseType has changed?
Post by: ollydbg on March 17, 2012, 09:37:31 am
So, the fulltype is "char*", and the basetype is "char", so it looks like we can safely use m_FullType, right?
Looks like that... why don't you try? I wonder is that works for e.g. template specialisation, too.
oh, i have debuged that already. ha.
Title: Re: calculation of BaseType has changed?
Post by: ollydbg on March 18, 2012, 02:47:39 am
BTW: I think there are actually two issues: First, the correct type of functions / methods is not found due to what I have commented in ParserThread::GetTokenBaseType() (I am working on that but its not so easy).

Code
    // TODO (Morten#5#): Handle stuff like the following gracefully:
    // int __cdecl __MINGW_NOTHROW vscanf (const char * __restrict__, __VALIST);

1, we can add a function like "RemoveAttributeSpecifier()", so we can remove something like: __cdecl  or __stdcall
2, __MINGW_NOTHROW can be macro replaced, either to an empty string, or to #define __MINGW_NOTHROW __attribute__ ((__nothrow__)), and I think the __attribute__ should be removed in the RemoveAttributeSpecifier().
3, we can heuristically remove all the tokens like "__XXXXXX".