News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

New code completion remarks/issues

Started by killerbot, September 15, 2009, 12:24:28 PM

Previous topic - Next topic

ollydbg

Quote from: blueshake on October 05, 2009, 06:36:23 AM
Quote from: ollydbg on October 05, 2009, 06:06:39 AM
@blueshake:

look at the Get function prototype, it is a static function.

class DLLIMPORT Manager
{
   static Manager* Get();
}

but, in the symbol tree debug dialog, you will see that the
Quotetype is Manager *
actual type is Manager

That's may be the cause of bug...


But it worked before.I updated the local copy,and it don't work.
look at these codes.The static are ignored.
       else if (token==ParserConsts::kw_static ||
           token==ParserConsts::kw_virtual ||
           token==ParserConsts::kw_inline)
       {
           // do nothing (skip it)
       }


Hi, after one and a half hour examing. I find the bug, and the patch to fix it.


Index: nativeparser.cpp
===================================================================
--- nativeparser.cpp (revision 5834)
+++ nativeparser.cpp (working copy)
@@ -1465,7 +1465,7 @@
                tokenType = pttNamespace;
            else
                tokenType = pttClass;
-            line.Remove(0, startAt + 2);
+            line.Remove(0, startAt + 1);
        }
        else
            line.Clear();


Here is the explanation:

For the code:

Manager::Get()->

The nativeparser should divide the line to "Manager" and "Get".

The current trunk code just mistakenly divide to "Manager" and "et", so, this patch can solve the bug.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

blueshake

#106
Cool man.

I just check the codes,found that we used IsOperatorEnd(startAt, line),so this is why patch should be applied.

@ollydbg
watch these codes in nativeparser.cpp
       startAt = BeginOfToken(startAt, line);

       // Check for [Class]. ('.' pressed)
       if (IsOperatorDot(startAt, line))
       {
           --startAt;
           repeat = true; // yes -> repeat.
       }
       // Check for [Class]-> ('>' pressed)
       // Check for [Class]:: (':' pressed)
       else if (IsOperatorEnd(startAt, line))
       {
           startAt -= 2;
           repeat = true; // yes -> repeat.
       }
[/s]

should the startAt -=2;be changed to startAt -=1;.I think the reason is same to the patch. :D
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

blueshake

I can confirm the issues I reported in reply 93,#99 can be fixed by ollydbg's #105 patch,even the tkTypedef can work too.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

ollydbg

Quote from: blueshake on October 05, 2009, 10:42:07 AM
I can confirm the issues I reported in reply 93,#99 can be fixed by ollydbg's #105 patch,even the tkTypedef can work too.
I'm so grad to hear that!!!! :lol:
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

mmkider

Hi
I found a issue.

if stest is a struct;

stest->b. ;   //this is fail. Tip window can't pop up c
stest.b.c  ;  //this  is ok .


blueshake

Quote from: mmkider on October 05, 2009, 12:03:38 PM
Hi
I found a issue.

if stest is a struct;

stest->b. ;   //this is fail. Tip window can't pop up c
stest.b.c  ;  //this  is ok .




Full test codes,please.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

mmkider

#111


typedef struct U_TKey{
int u32Key;

}U_KEYPAD_TWOKEY;

typedef struct S_KeyPad{
U_KEYPAD_TWOKEY   unTKey;
void *   pParam;
char   u8CallBack_Type;
char  u8DebounceClk;
char  u8IntNum;
char  u8TriggerType;
}S_KEYPAD_CLASS;

It's ok

S_KEYPAD_CLASS  sTest;
sTest.unTKey.u32Key=10;


It's fail.


S_KEYPAD_CLASS  *psTest;
psTest->unTkey.     // can't popup u32Key


MortenMacFly

#112
This works fine here:
 S_KEYPAD_CLASS *psTest;
 psTest->unTKey.

("u32Key" will be suggested).

...version, patform etc?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

mmkider

#113
Quote from: MortenMacFly on October 05, 2009, 01:56:52 PM
This works fine here:
 S_KEYPAD_CLASS *psTest;
 psTest->unTKey.

("u32Key" will be suggested).

...version, patform etc?

I use codeblocks svn 5839 in the WinXp sp2.
In my system, "u32Key" will not be suggested.


S_KEYPAD_CLASS  *psTest;
psTest->unTkey.                      // can't popup u32Key

blueshake

Work here,too.see the attachment.

Sorry to say that,but tktypedef don't work again.ollydbg is right,something is wrong with codes below,if I comment them,worked.!!!!!!!!


        if (token->m_TokenKind == tkTypedef)
        {
            std::queue<ParserComponent> type_components;
            BreakUpComponents(parser, token->m_ActualType, type_components);

            while(!components.empty())
            {
                ParserComponent comp = components.front();
                components.pop();
                type_components.push(comp);
            }

    #if DEBUG_CC_AI
            if (s_DebugSmartSense)
            #if wxCHECK_VERSION(2, 9, 0)
                Manager::Get()->GetLogManager()->DebugLog(F(_T("Replacing %s to %s"), token->m_Name.wx_str(), token->m_ActualType.wx_str()));
            #else
                Manager::Get()->GetLogManager()->DebugLog(F(_T("Replacing %s to %s"), token->m_Name.c_str(), token->m_ActualType.c_str()));
            #endif
    #endif
            return FindAIMatches(parser, type_components, result, parentTokenIdx, noPartialMatch, caseSensitive, use_inheritance, kindMask, search_scope);
        }

    }




[attachment deleted by admin]
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

mmkider

Quote from: blueshake on October 05, 2009, 02:14:16 PM
Work here,too.see the attachment.

Sorry to say that,but tktypedef don't work again.ollydbg is right,something is wrong with codes below,if I comment them,worked.!!!!!!!!


        if (token->m_TokenKind == tkTypedef)
        {
            std::queue<ParserComponent> type_components;
            BreakUpComponents(parser, token->m_ActualType, type_components);

            while(!components.empty())
            {
                ParserComponent comp = components.front();
                components.pop();
                type_components.push(comp);
            }

    #if DEBUG_CC_AI
            if (s_DebugSmartSense)
            #if wxCHECK_VERSION(2, 9, 0)
                Manager::Get()->GetLogManager()->DebugLog(F(_T("Replacing %s to %s"), token->m_Name.wx_str(), token->m_ActualType.wx_str()));
            #else
                Manager::Get()->GetLogManager()->DebugLog(F(_T("Replacing %s to %s"), token->m_Name.c_str(), token->m_ActualType.c_str()));
            #endif
    #endif
            return FindAIMatches(parser, type_components, result, parentTokenIdx, noPartialMatch, caseSensitive, use_inheritance, kindMask, search_scope);
        }

    }




I update src of codeblocks to SVN 5840.
It work well.

Thank all.


MortenMacFly

Quote from: blueshake on October 05, 2009, 02:14:16 PM
Sorry to say that,but tktypedef don't work again.ollydbg is right,something is wrong with codes below,if I comment them,worked.!!!!!!!!
What does not work exactly? My test cases all work very well...?! Are you using latest SVN code?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

mmkider

#117
Quote from: MortenMacFly on October 05, 2009, 02:54:07 PM
Quote from: blueshake on October 05, 2009, 02:14:16 PM
Sorry to say that,but tktypedef don't work again.ollydbg is right,something is wrong with codes below,if I comment them,worked.!!!!!!!!
What does not work exactly? My test cases all work very well...?! Are you using latest SVN code?

I can't  update all easily.
Because I remain wxflatnotebook in the src of codeblocks.
So I use other folder to update new src of codeblocks  and trandsfer some codes  of  my interest to my old folder.
I thank I do some wrong  thing between the new folder and the old folder :(.


ollydbg

Quote from: MortenMacFly on October 05, 2009, 02:54:07 PM
Quote from: blueshake on October 05, 2009, 02:14:16 PM
Sorry to say that,but tktypedef don't work again.ollydbg is right,something is wrong with codes below,if I comment them,worked.!!!!!!!!
What does not work exactly? My test cases all work very well...?! Are you using latest SVN code?

@Morten

blueshake's test code in this post:
http://forums.next.codeblocks.org/index.php/topic,11187.msg76788.html#msg76788

failed when entering "wwww", there is a flash of the suggestion list.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Jenna

Quote from: ollydbg on October 05, 2009, 03:17:31 PM
failed when entering "wwww", there is a flash of the suggestion list.

CC works for me in this case on linux, but not on windows (immediately close of suggestion window -> flash), but CC believes wwwwwwwww is a class, that's most likely because of the tktypedef-stuff.